diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2008-06-21 11:55:29 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2008-06-21 11:55:29 -0400 |
commit | db03d5db185430812775f0075a18da459b96a019 (patch) | |
tree | 17aab1642efbd0baf5c07123a3f14ba515798654 /src/pci.c | |
parent | b8d7a4797d06c9ff69712a3b436d2e0458ac7a51 (diff) | |
download | seabios-hppa-db03d5db185430812775f0075a18da459b96a019.zip seabios-hppa-db03d5db185430812775f0075a18da459b96a019.tar.gz seabios-hppa-db03d5db185430812775f0075a18da459b96a019.tar.bz2 |
PCI fixes
Only set the PIR table signature and checksum in the init function -
that way, if it is disabled at runtime (eg, due to coreboot) then
it wont be found by the OS.
Fix parameter swap bug in handle_1ab102.
Add support for more than one bus in pci scanning code (but only have
1 bus for now).
Diffstat (limited to 'src/pci.c')
-rw-r--r-- | src/pci.c | 55 |
1 files changed, 31 insertions, 24 deletions
@@ -7,6 +7,9 @@ #include "pci.h" // PCIDevice #include "ioport.h" // outl +#include "util.h" // dprintf + +#define MAX_BUS 1 void pci_config_writel(PCIDevice d, u32 addr, u32 val) { @@ -53,20 +56,22 @@ u8 pci_config_readb(PCIDevice d, u32 addr) int pci_find_device(u16 vendid, u16 devid, int index, PCIDevice *dev) { - int devfn; + int devfn, bus; u32 id = (devid << 16) | vendid; - for (devfn=0; devfn<0x100; devfn++) { - PCIDevice d = pci_bd(0, devfn); - u32 v = pci_config_readl(d, 0x00); - if (v != id) - continue; - if (index) { - index--; - continue; + for (bus=0; bus < MAX_BUS; bus++) { + for (devfn=0; devfn<0x100; devfn++) { + PCIDevice d = pci_bd(bus, devfn); + u32 v = pci_config_readl(d, 0x00); + if (v != id) + continue; + if (index) { + index--; + continue; + } + // Found it. + *dev = d; + return 0; } - // Found it. - *dev = d; - return 0; } return -1; } @@ -74,20 +79,22 @@ pci_find_device(u16 vendid, u16 devid, int index, PCIDevice *dev) int pci_find_class(u32 classid, int index, PCIDevice *dev) { - int devfn; + int devfn, bus; u32 id = classid << 8; - for (devfn=0; devfn<0x100; devfn++) { - PCIDevice d = pci_bd(0, devfn); - u32 v = pci_config_readl(d, 0x08); - if (v != id) - continue; - if (index) { - index--; - continue; + for (bus=0; bus < MAX_BUS; bus++) { + for (devfn=0; devfn<0x100; devfn++) { + PCIDevice d = pci_bd(bus, devfn); + u32 v = pci_config_readl(d, 0x08); + if (v != id) + continue; + if (index) { + index--; + continue; + } + // Found it. + *dev = d; + return 0; } - // Found it. - *dev = d; - return 0; } return -1; } |