[SeaBIOS] [PATCH 1/2] optionroms: Drop support for CONFIG_OPTIONROMS_DEPLOYED

Kevin O'Connor kevin at koconnor.net
Tue Apr 5 18:51:55 CEST 2016


No modern software uses this option and it complicates the code.

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 src/Kconfig      |  8 --------
 src/fw/shadow.c  | 15 +-------------
 src/optionroms.c | 61 ++++++++++++++++++++------------------------------------
 3 files changed, 23 insertions(+), 61 deletions(-)

diff --git a/src/Kconfig b/src/Kconfig
index de39b38..e767be1 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -395,14 +395,6 @@ menu "BIOS interfaces"
         default y
         help
             Support finding and running option roms during POST.
-    config OPTIONROMS_DEPLOYED
-        depends on OPTIONROMS && QEMU
-        bool "Option roms are already at 0xc0000-0xf0000"
-        default n
-        help
-            Select this if option ROMs are already copied to
-            0xc0000-0xf0000.  This must only be selected when using
-            Bochs or QEMU versions older than 0.12.
     config PMM
         depends on OPTIONROMS
         bool "PMM interface"
diff --git a/src/fw/shadow.c b/src/fw/shadow.c
index bdb5c5b..f766bb5 100644
--- a/src/fw/shadow.c
+++ b/src/fw/shadow.c
@@ -26,24 +26,11 @@ static void
 __make_bios_writable_intel(u16 bdf, u32 pam0)
 {
     // Make ram from 0xc0000-0xf0000 writable
-    int clear = 0;
     int i;
     for (i=0; i<6; i++) {
         u32 pam = pam0 + 1 + i;
-        int reg = pci_config_readb(bdf, pam);
-        if (CONFIG_OPTIONROMS_DEPLOYED && (reg & 0x11) != 0x11) {
-            // Need to copy optionroms to work around qemu implementation
-            void *mem = (void*)(BUILD_ROM_START + i * 32*1024);
-            memcpy((void*)BUILD_BIOS_TMP_ADDR, mem, 32*1024);
-            pci_config_writeb(bdf, pam, 0x33);
-            memcpy(mem, (void*)BUILD_BIOS_TMP_ADDR, 32*1024);
-            clear = 1;
-        } else {
-            pci_config_writeb(bdf, pam, 0x33);
-        }
+        pci_config_writeb(bdf, pam, 0x33);
     }
-    if (clear)
-        memset((void*)BUILD_BIOS_TMP_ADDR, 0, 32*1024);
 
     // Make ram from 0xf0000-0x100000 writable
     int reg = pci_config_readb(bdf, pam0);
diff --git a/src/optionroms.c b/src/optionroms.c
index 9897753..65f7fe0 100644
--- a/src/optionroms.c
+++ b/src/optionroms.c
@@ -347,28 +347,16 @@ optionrom_setup(void)
     memset(sources, 0, sizeof(sources));
     u32 post_vga = rom_get_last();
 
-    if (CONFIG_OPTIONROMS_DEPLOYED) {
-        // Option roms are already deployed on the system.
-        u32 pos = post_vga;
-        while (pos < rom_get_max()) {
-            int ret = init_optionrom((void*)pos, 0, 0);
-            if (ret)
-                pos += OPTION_ROM_ALIGN;
-            else
-                pos = rom_get_last();
-        }
-    } else {
-        // Find and deploy PCI roms.
-        struct pci_device *pci;
-        foreachpci(pci) {
-            if (pci->class == PCI_CLASS_DISPLAY_VGA || pci->have_driver)
-                continue;
-            init_pcirom(pci, 0, sources);
-        }
-
-        // Find and deploy CBFS roms not associated with a device.
-        run_file_roms("genroms/", 0, sources);
+    // Find and deploy PCI roms.
+    struct pci_device *pci;
+    foreachpci(pci) {
+        if (pci->class == PCI_CLASS_DISPLAY_VGA || pci->have_driver)
+            continue;
+        init_pcirom(pci, 0, sources);
     }
+
+    // Find and deploy CBFS roms not associated with a device.
+    run_file_roms("genroms/", 0, sources);
     rom_reserve(0);
 
     // All option roms found and deployed - now build BEV/BCV vectors.
@@ -427,26 +415,21 @@ vgarom_setup(void)
     RunPCIroms = romfile_loadint("etc/pci-optionrom-exec", 2);
     ScreenAndDebug = romfile_loadint("etc/screen-and-debug", 1);
 
-    if (CONFIG_OPTIONROMS_DEPLOYED) {
-        // Option roms are already deployed on the system.
-        init_optionrom((void*)BUILD_ROM_START, 0, 1);
-    } else {
-        // Clear option rom memory
-        memset((void*)BUILD_ROM_START, 0, rom_get_max() - BUILD_ROM_START);
-
-        // Find and deploy PCI VGA rom.
-        struct pci_device *pci;
-        foreachpci(pci) {
-            if (!is_pci_vga(pci))
-                continue;
-            vgahook_setup(pci);
-            init_pcirom(pci, 1, NULL);
-            break;
-        }
+    // Clear option rom memory
+    memset((void*)BUILD_ROM_START, 0, rom_get_max() - BUILD_ROM_START);
 
-        // Find and deploy CBFS vga-style roms not associated with a device.
-        run_file_roms("vgaroms/", 1, NULL);
+    // Find and deploy PCI VGA rom.
+    struct pci_device *pci;
+    foreachpci(pci) {
+        if (!is_pci_vga(pci))
+            continue;
+        vgahook_setup(pci);
+        init_pcirom(pci, 1, NULL);
+        break;
     }
+
+    // Find and deploy CBFS vga-style roms not associated with a device.
+    run_file_roms("vgaroms/", 1, NULL);
     rom_reserve(0);
 
     if (rom_get_last() == BUILD_ROM_START)
-- 
2.5.5




More information about the SeaBIOS mailing list