In csm mode, the bev pointer of the pci option rom was not
added to the bootentry list, resulting in failure to boot
from pci option rom. This patch fixed it.

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

diff --git a/src/fw/csm.c b/src/fw/csm.c
index 82d375c..3370fa5 100644
--- a/src/fw/csm.c
+++ b/src/fw/csm.c
@@ -19,6 +19,7 @@
 #include "std/acpi.h" // RSDP_SIGNATURE
 #include "std/bda.h" // struct bios_data_area_s
 #include "std/optionrom.h" // struct rom_header
+#include "std/pnpbios.h" // PNP_SIGNATURE
 #include "util.h" // copy_smbios
 
 #define UINT8 u8
@@ -228,6 +229,7 @@ handle_csm_0005(struct bregs *regs)
 {
     EFI_DISPATCH_OPROM_TABLE *table = MAKE_FLATPTR(regs->es, regs->bx);
     struct rom_header *rom;
+    struct pnp_data *pnp;
     u16 bdf;
 
     if (!CONFIG_OPTIONROMS) {
@@ -254,6 +256,21 @@ handle_csm_0005(struct bregs *regs)
 
     rom_confirm(rom->size * 512);
 
+    // PnP rom - check for BEV and BCV boot capabilities.
+    pnp = (void*)((u8*)rom + rom->pnpoffset);
+    if (pnp->signature == PNP_SIGNATURE) {
+        struct pci_device pci_dev = {
+            .bdf = bdf,
+        };
+        int prio = csm_bootprio_pci(&pci_dev);
+        if (pnp->bev)
+            boot_add_bev(FLATPTR_TO_SEG(rom), pnp->bev, pnp->productname, 
prio);
+        else if (pnp->bcv)
+            boot_add_bcv(FLATPTR_TO_SEG(rom), pnp->bcv, pnp->productname, 
prio);
+    } else {
+        dprintf(1, "rom %p: not a PnP rom, no BEV or BCV capability\n", table);
+    }
+
     regs->bx = 0; // FIXME
     regs->ax = 0;
 }
-- 
2.17.1
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-le...@seabios.org

Reply via email to