[SeaBIOS] [PATCH v2 12/19] Reject non-compliant PCI option ROMs with unaligned PCIR structure

David Woodhouse dwmw2 at infradead.org
Tue Feb 5 17:47:51 CET 2013


From: David Woodhouse <David.Woodhouse at intel.com>

cf. http://lists.gnu.org/archive/html/qemu-devel/2013-01/msg03650.html

Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 src/Kconfig      | 7 +++++++
 src/optionroms.c | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/src/Kconfig b/src/Kconfig
index 43046c5..b9206e5 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -285,6 +285,13 @@ menu "BIOS interfaces"
         default y
         help
             Support finding and running option roms during POST.
+    config PERMIT_UNALIGNED_PCIROM
+        bool "Allow broken PCI option ROMs with unaligned PCIR table"
+        default n
+        help
+            Support initialising PCI ROMs which violate the spec by having
+            their PCI information at an unaligned offset, and which may not
+            be accepted by other firmwares.
     config OPTIONROMS_DEPLOYED
         depends on OPTIONROMS
         bool "Option roms are already at 0xc0000-0xf0000"
diff --git a/src/optionroms.c b/src/optionroms.c
index c9e7d7b..99c4135 100644
--- a/src/optionroms.c
+++ b/src/optionroms.c
@@ -107,6 +107,8 @@ static struct pci_data *
 get_pci_rom(struct rom_header *rom)
 {
     struct pci_data *pd = (void*)((u32)rom + rom->pcioffset);
+    if ((rom->pcioffset & 3) && !CONFIG_PERMIT_UNALIGNED_PCIROM)
+        return NULL;
     if (pd->signature != PCI_ROM_SIGNATURE)
         return NULL;
     return pd;
-- 
1.8.1




More information about the SeaBIOS mailing list