diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2012-07-10 01:29:12 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2012-07-10 01:29:12 +0000 |
commit | 26221ccfc107472e3be0de79817efcd296d052a3 (patch) | |
tree | 1a63396a8da0cb4b1f2a4a438d5517db94ddb70d /libdde_linux26/lib/src/arch/l4/pci.c | |
parent | 9d7168c4373f66fb5eb6b31296d7b954105f6bbf (diff) | |
parent | eaa21da4ea94937a1bc2157c042a233d524d17ce (diff) |
Merge branch 'dde' into dde-clean
Diffstat (limited to 'libdde_linux26/lib/src/arch/l4/pci.c')
-rw-r--r-- | libdde_linux26/lib/src/arch/l4/pci.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/libdde_linux26/lib/src/arch/l4/pci.c b/libdde_linux26/lib/src/arch/l4/pci.c index c393fd3a..b50a7353 100644 --- a/libdde_linux26/lib/src/arch/l4/pci.c +++ b/libdde_linux26/lib/src/arch/l4/pci.c @@ -24,10 +24,6 @@ typedef struct l4dde_pci_dev { /** List of Linux-DDEKit PCIDev mappings */ static LIST_HEAD(pcidev_mappings); -/** PCI bus */ -static struct pci_bus *pci_bus = NULL; -static struct pci_bus *pci_bus1 = NULL; - static int l4dde26_pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val); static int l4dde26_pci_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val); @@ -187,18 +183,21 @@ int pcibios_enable_device(struct pci_dev *dev, int mask) void __init l4dde26_init_pci(void) { ddekit_pci_init(); - - // TODO it's a temporary solution to handle 2 buses. - // we need to find a way to detect buses. - pci_bus = pci_create_bus(NULL, 0, &dde_pcibus_ops, NULL); - Assert(pci_bus); - - pci_do_scan_bus(pci_bus); - - pci_bus1 = pci_create_bus(NULL, 2, &dde_pcibus_ops, NULL); - Assert(pci_bus1); - - pci_do_scan_bus(pci_bus1); + int nr; + char found[256] = { }; + int bus, slot, func; + + for (nr = 0; ; nr++) { + if (ddekit_pci_get_device(nr, &bus, &slot, &func) != 0) + break; + if (!found[bus]) { + struct pci_bus *pci_bus = pci_create_bus(NULL, bus, &dde_pcibus_ops, NULL); + Assert(pci_bus); + pci_do_scan_bus(pci_bus); + + found[bus] = 1; + } + } INITIALIZE_INITVAR(dde26_pci); } |