[SeaBIOS] [PATCH 14/14] pci: Consistently set pci->have_drivers for devices with internal drivers

Kevin O'Connor kevin at koconnor.net
Wed Feb 3 05:18:57 CET 2016


Set the pci->have_drivers flag for any device that calls
pci_enable_x() to ensure that the flag is consistently set on any
device with an internal driver.  Setting this flag prevents an option
rom on the device from being executed.

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 src/hw/ata.c    | 1 -
 src/hw/pci.c    | 3 +++
 src/hw/sdcard.c | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/hw/ata.c b/src/hw/ata.c
index 7aaf2f1..12dab96 100644
--- a/src/hw/ata.c
+++ b/src/hw/ata.c
@@ -945,7 +945,6 @@ init_controller(struct pci_device *pci, int chanid, int irq
 static void
 init_pciata(struct pci_device *pci, u8 prog_if)
 {
-    pci->have_driver = 1;
     u8 pciirq = pci_config_readb(pci->bdf, PCI_INTERRUPT_LINE);
     int master = 0;
     if (CONFIG_ATA_DMA && prog_if & 0x80) {
diff --git a/src/hw/pci.c b/src/hw/pci.c
index 86b7d54..76c293c 100644
--- a/src/hw/pci.c
+++ b/src/hw/pci.c
@@ -279,6 +279,7 @@ pci_enable_busmaster(struct pci_device *pci)
     ASSERT32FLAT();
     wait_preempt();
     pci_config_maskw(pci->bdf, PCI_COMMAND, 0, PCI_COMMAND_MASTER);
+    pci->have_driver = 1;
 }
 
 // Verify an IO bar and return it to the caller
@@ -298,6 +299,7 @@ pci_enable_iobar(struct pci_device *pci, u32 addr)
         return 0;
     }
     pci_config_maskw(pci->bdf, PCI_COMMAND, 0, PCI_COMMAND_IO);
+    pci->have_driver = 1;
     return bar;
 }
 
@@ -326,6 +328,7 @@ pci_enable_membar(struct pci_device *pci, u32 addr)
         return NULL;
     }
     pci_config_maskw(pci->bdf, PCI_COMMAND, 0, PCI_COMMAND_MEMORY);
+    pci->have_driver = 1;
     return (void*)bar;
 }
 
diff --git a/src/hw/sdcard.c b/src/hw/sdcard.c
index 1524b51..68a5e56 100644
--- a/src/hw/sdcard.c
+++ b/src/hw/sdcard.c
@@ -562,6 +562,7 @@ sdcard_setup(void)
         if (pci->class != PCI_CLASS_SYSTEM_SDHCI || pci->prog_if >= 2)
             // Not an SDHCI controller following SDHCI spec
             continue;
+        pci->have_driver = 1; // Note driver present prior to starting thread
         run_thread(sdcard_pci_setup, pci);
     }
 }
-- 
2.5.0




More information about the SeaBIOS mailing list