From 113f670baabab0776e68c877fe6b3d7dd07e79a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Sun, 20 May 2018 20:12:32 +0300 Subject: AGESA binaryPI: Fix and optimize for MAX_NODES_NUM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With nodeid<8, CONFIG_CDB==0x18, PCI device number does not overflow. CONFIG_CDB is not a value we can configure. Change-Id: I23e9707a8ec12dcd80c00688d6237d085d1abf36 Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/26437 Tested-by: build bot (Jenkins) Reviewed-by: Marc Jones --- src/northbridge/amd/pi/00630F01/northbridge.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'src/northbridge/amd/pi/00630F01') diff --git a/src/northbridge/amd/pi/00630F01/northbridge.c b/src/northbridge/amd/pi/00630F01/northbridge.c index fed7e53c81..76ce9da056 100644 --- a/src/northbridge/amd/pi/00630F01/northbridge.c +++ b/src/northbridge/amd/pi/00630F01/northbridge.c @@ -44,7 +44,7 @@ #include #include -#define MAX_NODE_NUMS (MAX_NODES * MAX_DIES) +#define MAX_NODE_NUMS MAX_NODES #if IS_ENABLED(CONFIG_EXT_CONF_SUPPORT) #error CONFIG_EXT_CONF_SUPPORT == 1 not support anymore! @@ -110,11 +110,7 @@ static void set_mmio_addr_reg(u32 nodeid, u32 linkn, u32 reg, u32 index, u32 mmi static struct device *get_node_pci(u32 nodeid, u32 fn) { - if (((CONFIG_CDB + nodeid) < 32) || (MAX_NODE_NUMS + CONFIG_CDB < 32)) { - return dev_find_slot(CONFIG_CBB, PCI_DEVFN(CONFIG_CDB + nodeid, fn)); - } else { - return dev_find_slot(CONFIG_CBB-1, PCI_DEVFN(CONFIG_CDB + nodeid - 32, fn)); - } + return dev_find_slot(CONFIG_CBB, PCI_DEVFN(CONFIG_CDB + nodeid, fn)); } static void get_fx_devs(void) @@ -157,14 +153,7 @@ static void f1_write_config32(unsigned reg, u32 value) static u32 amdfam15_nodeid(struct device *dev) { - unsigned busn; - busn = dev->bus->secondary; - - if ((busn != CONFIG_CBB) && (MAX_NODE_NUMS == 64)) { - return (dev->path.pci.devfn >> 3) - CONFIG_CDB + 32; - } else { - return (dev->path.pci.devfn >> 3) - CONFIG_CDB; - } + return (dev->path.pci.devfn >> 3) - CONFIG_CDB; } static void set_vga_enable_reg(u32 nodeid, u32 linkn) -- cgit v1.2.3