From 7dd0e8b98c71254148180b3cc432de1c4936526c Mon Sep 17 00:00:00 2001 From: gaobin gaobin@amazon.com Date: Thu, 19 Sep 2019 11:17:46 -0700 Subject: [PATCH 1/4] csm: Call pci_probe_devices() late until PrepareToBoot is invoked by UEFI
On real 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.
Signed-off-by: gaobin gaobin@amazon.com --- src/fw/csm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/fw/csm.c b/src/fw/csm.c index 8359bcb..c8111cd 100644 --- a/src/fw/csm.c +++ b/src/fw/csm.c @@ -63,7 +63,6 @@ static void csm_maininit(struct bregs *regs) { interface_init(); - pci_probe_devices();
csm_compat_table.PnPInstallationCheckSegment = SEG_BIOS; csm_compat_table.PnPInstallationCheckOffset = get_pnp_offset(); @@ -143,6 +142,12 @@ handle_csm_0002(struct bregs *regs) return; }
+ // On real 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. + pci_probe_devices(); + dprintf(3, "PrepareToBoot table %04x:%04x\n", regs->es, regs->bx);
struct e820entry *p = (void *)csm_compat_table.E820Pointer;