diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2008-12-04 19:22:49 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2008-12-04 19:22:49 -0500 |
commit | 53ab0b600cc7cd14403a9d8feafb1bd1a81e56eb (patch) | |
tree | 4f4fbe49402a4a8a49f10f0eb5580448b6811031 /src | |
parent | 5a1b8281f9d2ffcaa310f8fb537c2d2f165ca812 (diff) | |
download | seabios-53ab0b600cc7cd14403a9d8feafb1bd1a81e56eb.tar.gz |
Only support IDE devices with pci class of PCI_CLASS_STORAGE_IDE.
Devices of class PCI_CLASS_STORAGE_OTHER may work with some devices,
but they are just as likely to cause a crash with other devices.
Diffstat (limited to 'src')
-rw-r--r-- | src/ata.c | 27 |
1 files changed, 10 insertions, 17 deletions
@@ -893,18 +893,11 @@ ata_init() } // Scan PCI bus for ATA adapters - int count=0, bdf=-1; - u16 classid = PCI_CLASS_STORAGE_OTHER; // SATA first - while (count<CONFIG_MAX_ATA_INTERFACES-1) { - bdf = pci_find_class(classid, bdf+1); - if (bdf < 0) { - if (classid == PCI_CLASS_STORAGE_IDE) - // Done - break; - classid = PCI_CLASS_STORAGE_IDE; // PATA controllers - bdf = -1; + int count=0; + int bdf, max; + foreachpci(bdf, max, 0) { + if (pci_config_readw(bdf, PCI_CLASS_DEVICE) != PCI_CLASS_STORAGE_IDE) continue; - } u8 irq = pci_config_readb(bdf, PCI_INTERRUPT_LINE); SET_EBDA(ata.channels[count].irq, irq); @@ -913,7 +906,7 @@ ata_init() u8 prog_if = pci_config_readb(bdf, PCI_CLASS_PROG); u32 port1, port2; - if (classid != PCI_CLASS_STORAGE_IDE || prog_if & 1) { + if (prog_if & 1) { port1 = pci_config_readl(bdf, PCI_BASE_ADDRESS_0) & ~3; port2 = pci_config_readl(bdf, PCI_BASE_ADDRESS_1) & ~3; } else { @@ -922,19 +915,19 @@ ata_init() } SET_EBDA(ata.channels[count].iobase1, port1); SET_EBDA(ata.channels[count].iobase2, port2); - dprintf(1, "ATA controller %d at %x/%x (dev %x class %x/%x)\n" - , count, port1, port2, bdf, classid, prog_if); + dprintf(1, "ATA controller %d at %x/%x (dev %x prog_if %x)\n" + , count, port1, port2, bdf, prog_if); count++; - if (classid != PCI_CLASS_STORAGE_IDE || prog_if & 4) { + if (prog_if & 4) { port1 = pci_config_readl(bdf, PCI_BASE_ADDRESS_2) & ~3; port2 = pci_config_readl(bdf, PCI_BASE_ADDRESS_3) & ~3; } else { port1 = 0x170; port2 = 0x370; } - dprintf(1, "ATA controller %d at %x/%x (dev %x class %x/%x)\n" - , count, port1, port2, bdf, classid, prog_if); + dprintf(1, "ATA controller %d at %x/%x (dev %x prog_if %x)\n" + , count, port1, port2, bdf, prog_if); SET_EBDA(ata.channels[count].iobase1, port1); SET_EBDA(ata.channels[count].iobase2, port2); count++; |