Skip to contentSkip to conversation

x86/efistub: Fix PCI ROM preservation in mixed mode

PATCH In review Mikel Rychliski 2 participants 2 messages Aug 23, 2023 – Aug 24, 2023 EFI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/efistub: Fix PCI ROM preservation in mixed mode

preserve_pci_rom_image() was accessing the romsize field in efi_pci_io_protocol_t directly instead of using the efi_table_attr() helper. This prevents the ROM image from being saved correctly during a mixed mode boot.

Fixes 2c3625cb9fa2 ("efi/x86: Fold __setup_efi_pci32() and __setup_efi_pci64() into one function")
---
 drivers/firmware/efi/libstub/x86-stub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/libstub/x86-stub.c +1 -1
index e976288728e9..2fee52ed335d 100644
@@ -72,7 +72,7 @@ preserve_pci_rom_image(efi_pci_io_protocol_t *pci, struct pci_setup_rom **__rom)
 	rom->data.type	= SETUP_PCI;
 	rom->data.len	= size - sizeof(struct setup_data);
 	rom->data.next	= 0;
-	rom->pcilen	= pci->romsize;
+	rom->pcilen	= romsize;
 	*__rom = rom;
 
 	status = efi_call_proto(pci, pci.read, EfiPciIoWidthUint16,
Signature · 1 line
2.35.3
maintainer
#1 lore raw
Quoted 8 lines · Mikel Rychliski

preserve_pci_rom_image() was accessing the romsize field in efi_pci_io_protocol_t directly instead of using the efi_table_attr() helper. This prevents the ROM image from being saved correctly during a mixed mode boot.

Fixes 2c3625cb9fa2 ("efi/x86: Fold __setup_efi_pci32() and __setup_efi_pci64() into one function")

Thanks, I've queued this up as a fix.

Quoted 20 lines
---
 drivers/firmware/efi/libstub/x86-stub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/libstub/x86-stub.c +1 -2
index e976288728e9..2fee52ed335d 100644
@@ -72,7 +72,7 @@ preserve_pci_rom_image(efi_pci_io_protocol_t *pci, struct pci_setup_rom **__rom)
        rom->data.type  = SETUP_PCI;
        rom->data.len   = size - sizeof(struct setup_data);
        rom->data.next  = 0;
-       rom->pcilen     = pci->romsize;
+       rom->pcilen     = romsize;
        *__rom = rom;
 
        status = efi_call_proto(pci, pci.read, EfiPciIoWidthUint16,
--

2.35.3