diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2019-01-21 14:19:01 +0200 |
---|---|---|
committer | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2019-01-22 14:06:39 +0000 |
commit | 69f6fd4589ee4d7cb0bfa12face26eba1fa0a973 (patch) | |
tree | f36dfb9e04c2cabe462394f6586a67f988346160 /src/northbridge/amd/pi | |
parent | edbf5d913819726a09cd56bace2d13e74b560ab1 (diff) | |
download | coreboot-69f6fd4589ee4d7cb0bfa12face26eba1fa0a973.tar.xz |
AGESA/binaryPI: Add NULL pointers check
Fix regression after commits
4ad7f5b AGESA: Use pcidev_on_root()
33ff44c binaryPI: Use pcidev_on_root()
Previously used call dev_find_slot() returned
pointers to PCI device nodes that were actually
not present in the hardware at all. Register
reads would come back with invalid (0xff) values
and writes would be ignored.
After change to pcidev_on_root(), attempting to
do register operations with non-present PCI
hardware immediately halts with error
get_pbus: dev is NULL!
Change-Id: I785350c171a642207c5fab884a953d45a3bfe592
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/31026
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/northbridge/amd/pi')
-rw-r--r-- | src/northbridge/amd/pi/00660F01/northbridge.c | 8 | ||||
-rw-r--r-- | src/northbridge/amd/pi/00730F01/northbridge.c | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/northbridge/amd/pi/00660F01/northbridge.c b/src/northbridge/amd/pi/00660F01/northbridge.c index 056e7012d9..00558a5095 100644 --- a/src/northbridge/amd/pi/00660F01/northbridge.c +++ b/src/northbridge/amd/pi/00660F01/northbridge.c @@ -558,9 +558,11 @@ static void fam15_finalize(void *chip_info) /* disable No Snoop */ dev = pcidev_on_root(1, 1); - value = pci_read_config32(dev, 0x60); - value &= ~(1 << 11); - pci_write_config32(dev, 0x60, value); + if (dev != NULL) { + value = pci_read_config32(dev, 0x60); + value &= ~(1 << 11); + pci_write_config32(dev, 0x60, value); + } } struct chip_operations northbridge_amd_pi_00660F01_ops = { diff --git a/src/northbridge/amd/pi/00730F01/northbridge.c b/src/northbridge/amd/pi/00730F01/northbridge.c index 2579d370a7..81517afa90 100644 --- a/src/northbridge/amd/pi/00730F01/northbridge.c +++ b/src/northbridge/amd/pi/00730F01/northbridge.c @@ -792,9 +792,11 @@ static void fam16_finalize(void *chip_info) /* disable No Snoop */ dev = pcidev_on_root(1, 1); - value = pci_read_config32(dev, 0x60); - value &= ~(1 << 11); - pci_write_config32(dev, 0x60, value); + if (dev != NULL) { + value = pci_read_config32(dev, 0x60); + value &= ~(1 << 11); + pci_write_config32(dev, 0x60, value); + } } struct chip_operations northbridge_amd_pi_00730F01_ops = { |