From 8c9be4327154ef46ffc96da13f816ffddb77253d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Sat, 29 Jun 2019 22:34:07 +0300 Subject: [PATCH] device/pci_rom: Fix on-board optionrom address MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The function pci_rom_probe() may be called multiple times for a device. For cases where CBFS does not contain optionrom file, only the first time probing for the on-board ROM chip worked. PCI_ROM_ADDRESS_ENABLE is set on the first run. Mask out all the reserved bits of PCI_ROM_ADDRESS register to get correct physical address for rom_header. Change-Id: I14374954af09201494bf2f13e5a6e4dc640c05ee Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/33908 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Rudolph Reviewed-by: Mike Banon --- src/device/pci_rom.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/device/pci_rom.c b/src/device/pci_rom.c index 3160c2041b..7322e57f45 100644 --- a/src/device/pci_rom.c +++ b/src/device/pci_rom.c @@ -77,6 +77,8 @@ struct rom_header *pci_rom_probe(struct device *dev) rom_address|PCI_ROM_ADDRESS_ENABLE); } + rom_address &= PCI_ROM_ADDRESS_MASK; + printk(BIOS_DEBUG, "Option ROM address for %s = %lx\n", dev_path(dev), (unsigned long)rom_address); rom_header = (struct rom_header *)rom_address;