Michał Żygowski has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/62091 )
Change subject: northbridge/amd/amdfam10/bootblock.c: Get rid of preprocessor IFs ......................................................................
northbridge/amd/amdfam10/bootblock.c: Get rid of preprocessor IFs
Signed-off-by: Michał Żygowski michal.zygowski@3mdeb.com Change-Id: I96a64a1d35936f400433976a45bbee09b3792b19 --- M src/northbridge/amd/amdfam10/bootblock.c 1 file changed, 36 insertions(+), 32 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/91/62091/1
diff --git a/src/northbridge/amd/amdfam10/bootblock.c b/src/northbridge/amd/amdfam10/bootblock.c index 3fb2c94..f504355 100644 --- a/src/northbridge/amd/amdfam10/bootblock.c +++ b/src/northbridge/amd/amdfam10/bootblock.c @@ -23,8 +23,11 @@ // mmconf is not ready yet static void set_bsp_node_CHtExtNodeCfgEn(void) { -#if CONFIG(EXT_RT_TBL_SUPPORT) u32 dword; + + if (!CONFIG(EXT_RT_TBL_SUPPORT)) + return; + dword = pci_io_read_config32(PCI_DEV(0, 0x18, 0), 0x68); dword |= (1<<27) | (1<<25); /* CHtExtNodeCfgEn: coherent link extended node configuration enable, @@ -37,14 +40,16 @@ /* CHtExtAddrEn */ pci_io_write_config32(PCI_DEV(0, 0x18, 0), 0x68, dword); // CPU on bus 0xff and 0xfe now. For now on we can use CONFIG_CBB and CONFIG_CDB. -#endif }
static void enumerate_ht_chain(void) { -#if CONFIG_HT_CHAIN_UNITID_BASE != 0 -/* CONFIG_HT_CHAIN_UNITID_BASE could be 0 (only one ht device in the ht chain), - if so, don't need to go through the chain */ + + /* CONFIG_HT_CHAIN_UNITID_BASE could be 0 (only one ht device in the ht chain), + * if so, don't need to go through the chain + */ + if (CONFIG_HT_CHAIN_UNITID_BASE == 0) + return;
/* Assumption the HT chain that is bus 0 has the HT I/O Hub on it. * On most boards this just happens. If a CPU has multiple @@ -52,14 +57,12 @@ * links needs to be programed to point at bus 0. */ unsigned int next_unitid, last_unitid = 0; -#if CONFIG_HT_CHAIN_END_UNITID_BASE != 0x20 // let't record the device of last ht device, So we can set the // Unitid to CONFIG_HT_CHAIN_END_UNITID_BASE unsigned int real_last_unitid = 0; u8 real_last_pos = 0; int ht_dev_num = 0; // except host_bridge u8 end_used = 0; -#endif
next_unitid = CONFIG_HT_CHAIN_UNITID_BASE; do { @@ -101,23 +104,25 @@ unsigned int ctrl, ctrl_off; pci_devfn_t devx;
-#if CONFIG_HT_CHAIN_END_UNITID_BASE != 0x20 - if (next_unitid >= 0x18) { - if (!end_used) { - next_unitid = CONFIG_HT_CHAIN_END_UNITID_BASE; - end_used = 1; - } else { - goto out; + if (CONFIG_HT_CHAIN_END_UNITID_BASE != 0x20) { + if (next_unitid >= 0x18) { + if (!end_used) { + next_unitid = CONFIG_HT_CHAIN_END_UNITID_BASE; + end_used = 1; + } else { + goto out; + } } + real_last_unitid = next_unitid; + real_last_pos = pos; + ht_dev_num++; } - real_last_unitid = next_unitid; - real_last_pos = pos; - ht_dev_num++; -#endif - #if !CONFIG_HT_CHAIN_END_UNITID_BASE - if (!next_unitid) - goto out; - #endif + + if (CONFIG_HT_CHAIN_END_UNITID_BASE == 0) { + if (!next_unitid) + goto out; + } + flags &= ~0x1f; flags |= next_unitid & 0x1f; count = (flags >> 5) & 0x1f; @@ -163,17 +168,16 @@ } while (last_unitid != next_unitid);
out: ; -#if CONFIG_HT_CHAIN_END_UNITID_BASE != 0x20 - if ((ht_dev_num > 1) && (real_last_unitid != CONFIG_HT_CHAIN_END_UNITID_BASE) && !end_used) { - u16 flags; - flags = pci_io_read_config16(PCI_DEV(0,real_last_unitid,0), real_last_pos + PCI_CAP_FLAGS); - flags &= ~0x1f; - flags |= CONFIG_HT_CHAIN_END_UNITID_BASE & 0x1f; - pci_io_write_config16(PCI_DEV(0, real_last_unitid, 0), real_last_pos + PCI_CAP_FLAGS, flags); + if (CONFIG_HT_CHAIN_END_UNITID_BASE != 0x20) { + if ((ht_dev_num > 1) && + (real_last_unitid != CONFIG_HT_CHAIN_END_UNITID_BASE) && !end_used) { + u16 flags; + flags = pci_io_read_config16(PCI_DEV(0,real_last_unitid,0), real_last_pos + PCI_CAP_FLAGS); + flags &= ~0x1f; + flags |= CONFIG_HT_CHAIN_END_UNITID_BASE & 0x1f; + pci_io_write_config16(PCI_DEV(0, real_last_unitid, 0), real_last_pos + PCI_CAP_FLAGS, flags); + } } -#endif - -#endif }
void bootblock_early_northbridge_init(void) {