Use 'struct pci_device' to note which devices have native drivers.
authorKevin O'Connor <kevin@koconnor.net>
Wed, 22 Jun 2011 02:52:51 +0000 (22:52 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Wed, 22 Jun 2011 02:52:51 +0000 (22:52 -0400)
Remove the check in optionroms.c for CONFIG_ATA and
PCI_CLASS_STORAGE_IDE with a flag in 'struct pci_device'.  This
ensures devices using the ATA driver that aren't in
PCI_CLASS_STORAGE_IDE don't have their optionroms executed.  It also
allows other drivers to disable option rom execution in the future.

src/ata.c
src/optionroms.c
src/pci.h

index a6b50675d68b4a627cc7752bd44c4beffeae6dc5..79bc76f62aea18b05bb0d4326ea09ae0ff5b1a27 100644 (file)
--- a/src/ata.c
+++ b/src/ata.c
@@ -967,6 +967,7 @@ init_controller(int bdf, int irq, u32 port1, u32 port2, u32 master)
 static void
 init_pciata(struct pci_device *pci, u8 prog_if)
 {
+    pci->have_driver = 1;
     u16 bdf = pci->bdf;
     u8 pciirq = pci_config_readb(bdf, PCI_INTERRUPT_LINE);
     int master = 0;
index b2415cc848b40f93cea22d8f9c0fcceef7c02e49..27c172f592242a3a1b44c33a756e258c3a5f68a3 100644 (file)
@@ -410,9 +410,7 @@ optionrom_setup(void)
         // Find and deploy PCI roms.
         struct pci_device *pci;
         foreachpci(pci) {
-            u16 v = pci->class;
-            if (v == 0x0000 || v == 0xffff || v == PCI_CLASS_DISPLAY_VGA
-                || (CONFIG_ATA && v == PCI_CLASS_STORAGE_IDE))
+            if (pci->class == PCI_CLASS_DISPLAY_VGA || pci->have_driver)
                 continue;
             init_pcirom(pci, 0, sources);
         }
index f1e398870b45a88251d3900139a6182b1b2d08fe..a21a1fdf9ae72f3d465b30b59476cd53934cabbc 100644 (file)
--- a/src/pci.h
+++ b/src/pci.h
@@ -48,6 +48,9 @@ struct pci_device {
     u8 prog_if, revision;
     u8 header_type;
     u8 secondary_bus;
+
+    // Local information on device.
+    int have_driver;
 };
 extern struct pci_device *PCIDevices;
 extern int MaxPCIBus;