From 08e39c572f36f503e782cb810e9d34c008ddd990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Tue, 3 Feb 2015 09:17:44 +0200 Subject: AMD K8: Remove some excessive preprocessor use MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tests on CPUID are valid regardless of revision. Change-Id: I5a3a01baca2c0ecfb018ca7965994ba74889a2e2 Signed-off-by: Kyösti Mälkki Reviewed-on: http://review.coreboot.org/8337 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Patrick Georgi --- src/include/cpu/amd/model_fxx_rev.h | 58 ++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'src/include/cpu') diff --git a/src/include/cpu/amd/model_fxx_rev.h b/src/include/cpu/amd/model_fxx_rev.h index 1e8559692d..7cd6158d48 100644 --- a/src/include/cpu/amd/model_fxx_rev.h +++ b/src/include/cpu/amd/model_fxx_rev.h @@ -2,7 +2,6 @@ int init_processor_name(void); -#if !CONFIG_K8_REV_F_SUPPORT static inline int is_cpu_rev_a0(void) { return (cpuid_eax(1) & 0xfffef) == 0x0f00; @@ -48,13 +47,32 @@ static inline int is_cpu_e0(void) return (cpuid_eax(1) & 0xfff00) == 0x20f00; } +//AMD_F0_SUPPORT +static inline int is_cpu_pre_f0(void) +{ + return (cpuid_eax(1) & 0xfff0f) < 0x40f00; +} + +static inline int is_cpu_f0(void) +{ + return (cpuid_eax(1) & 0xfff00) == 0x40f00; +} + +static inline int is_cpu_pre_f2(void) +{ + return (cpuid_eax(1) & 0xfff0f) < 0x40f02; +} #ifdef __PRE_RAM__ -static int is_e0_later_in_bsp(int nodeid) +static inline int is_e0_later_in_bsp(int nodeid) { uint32_t val; uint32_t val_old; int e0_later; + + if (IS_ENABLED(CONFIG_K8_REV_F_SUPPORT)) + return 1; + if(nodeid==0) { // we don't need to do that for node 0 in core0/node0 return !is_cpu_pre_e0(); } @@ -73,50 +91,32 @@ static int is_e0_later_in_bsp(int nodeid) return e0_later; } -#else -int is_e0_later_in_bsp(int nodeid); //defined model_fxx_init.c -#endif - -#endif - -#if CONFIG_K8_REV_F_SUPPORT -//AMD_F0_SUPPORT -static inline int is_cpu_pre_f0(void) -{ - return (cpuid_eax(1) & 0xfff0f) < 0x40f00; -} - -static inline int is_cpu_f0(void) -{ - return (cpuid_eax(1) & 0xfff00) == 0x40f00; -} - -static inline int is_cpu_pre_f2(void) -{ - return (cpuid_eax(1) & 0xfff0f) < 0x40f02; -} -#ifdef __PRE_RAM__ -//AMD_F0_SUPPORT static inline int is_cpu_f0_in_bsp(int nodeid) { uint32_t dword; device_t dev; + if (!IS_ENABLED(CONFIG_K8_REV_F_SUPPORT)) + return 0; dev = PCI_DEV(0, 0x18+nodeid, 3); dword = pci_read_config32(dev, 0xfc); return (dword & 0xfff00) == 0x40f00; } + static inline int is_cpu_pre_f2_in_bsp(int nodeid) { uint32_t dword; device_t dev; + if (!IS_ENABLED(CONFIG_K8_REV_F_SUPPORT)) + return 1; dev = PCI_DEV(0, 0x18+nodeid, 3); dword = pci_read_config32(dev, 0xfc); return (dword & 0xfff0f) < 0x40f02; } + #else -int is_cpu_f0_in_bsp(int nodeid); // defined in model_fxx_init.c -#endif -#endif +int is_e0_later_in_bsp(int nodeid); +int is_cpu_f0_in_bsp(int nodeid); +#endif -- cgit v1.2.3