From: Kevin O'Connor Date: Tue, 21 Jun 2011 02:20:43 +0000 (-0400) Subject: Convert ATA detection code to use struct pci_device. X-Git-Tag: rel-1.6.3~75 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=3f3e58d29f0cbf1f084aedf4e69d19ac2b9ff6b8;p=seabios.git Convert ATA detection code to use struct pci_device. --- diff --git a/src/ata.c b/src/ata.c index 2630431..e07aabe 100644 --- a/src/ata.c +++ b/src/ata.c @@ -11,7 +11,7 @@ #include "cmos.h" // inb_cmos #include "pic.h" // enable_hwirq #include "biosvar.h" // GET_EBDA -#include "pci.h" // foreachbdf +#include "pci.h" // foreachpci #include "pci_ids.h" // PCI_CLASS_STORAGE_OTHER #include "pci_regs.h" // PCI_INTERRUPT_LINE #include "boot.h" // boot_add_hd @@ -1032,21 +1032,20 @@ static const struct pci_device_id pci_ata_tbl[] = { static void ata_init(void) { - // Scan PCI bus for ATA adapters - int pcicount=0; - int bdf, max; - foreachbdf(bdf, max) { - pcicount++; - pci_init_device(pci_ata_tbl, bdf, NULL); - } - - if (!CONFIG_COREBOOT && !pcicount) { + if (!CONFIG_COREBOOT && !PCIDevices) { // No PCI devices found - probably a QEMU "-M isapc" machine. // Try using ISA ports for ATA controllers. init_controller(-1, IRQ_ATA1 , PORT_ATA1_CMD_BASE, PORT_ATA1_CTRL_BASE, 0); init_controller(-1, IRQ_ATA2 , PORT_ATA2_CMD_BASE, PORT_ATA2_CTRL_BASE, 0); + return; + } + + // Scan PCI bus for ATA adapters + struct pci_device *pci; + foreachpci(pci) { + pci_init_device(pci_ata_tbl, pci->bdf, NULL); } }