From: Bin Meng <bmeng.cn@gmail.com>
Date: Wed, 8 Jul 2015 05:06:41 +0000 (+0800)
Subject: pci: Disable expansion ROM address decoding when signature check fails
X-Git-Tag: v2025.01-rc5-pxa1908~12604^2
X-Git-Url: http://git.dujemihanovic.xyz/img/static/%7B%7B%20%24.Site.BaseURL%20%7D%7Dposts/%7B%7B?a=commitdiff_plain;h=f110da9984c0aa0aba9e1c4178b67b7abecf7e8d;p=u-boot.git

pci: Disable expansion ROM address decoding when signature check fails

We should not leave the expansion ROM address window open when there
is not a valid ROM.

Suggested-by: Matt Porter <mporter@konsulko.com>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
---

diff --git a/drivers/pci/pci_rom.c b/drivers/pci/pci_rom.c
index aa06767d2a..a33efae263 100644
--- a/drivers/pci/pci_rom.c
+++ b/drivers/pci/pci_rom.c
@@ -104,6 +104,10 @@ static int pci_rom_probe(pci_dev_t dev, uint class,
 	if (le16_to_cpu(rom_header->signature) != PCI_ROM_HDR) {
 		printf("Incorrect expansion ROM header signature %04x\n",
 		       le16_to_cpu(rom_header->signature));
+#ifndef CONFIG_VGA_BIOS_ADDR
+		/* Disable expansion ROM address decoding */
+		pci_write_config_dword(dev, PCI_ROM_ADDRESS, rom_address);
+#endif
 		return -EINVAL;
 	}