On physical hardware, some PCI devices are not detectable when UEFI
BIOS invokes our InitializeYourself() function. But they are
guaranteed to be available before UEFI invokes our PreparToBoot()
function. So in the case of running CSM on physical hardware, we execute
pci_probe_devices() at PrepareToBoot() stage.

Signed-off-by: Bin Gao <gao...@amazon.com>
---
 src/fw/csm.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/fw/csm.c b/src/fw/csm.c
index 8359bcb..82d375c 100644
--- a/src/fw/csm.c
+++ b/src/fw/csm.c
@@ -63,7 +63,9 @@ static void
 csm_maininit(struct bregs *regs)
 {
     interface_init();
-    pci_probe_devices();
+
+    if (CONFIG_CSM && CONFIG_QEMU_HARDWARE)
+        pci_probe_devices();
 
     csm_compat_table.PnPInstallationCheckSegment = SEG_BIOS;
     csm_compat_table.PnPInstallationCheckOffset = get_pnp_offset();
@@ -143,6 +145,13 @@ handle_csm_0002(struct bregs *regs)
         return;
     }
 
+    // On physical hardware, some PCI devices are not detectable when
+    // UEFI invokes our InitializeYourself() function. But they
+    // are guaranteed to be available before UEFI invokes our
+    // PreparToBoot() function.
+    if (CONFIG_CSM && !CONFIG_QEMU_HARDWARE)
+        pci_probe_devices();
+
     dprintf(3, "PrepareToBoot table %04x:%04x\n", regs->es, regs->bx);
 
     struct e820entry *p = (void *)csm_compat_table.E820Pointer;
-- 
2.17.1
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-le...@seabios.org

Reply via email to