diff options
author | Andrey Petrov <anpetrov@fb.com> | 2019-10-23 15:15:08 -0700 |
---|---|---|
committer | Andrey Petrov <anpetrov@fb.com> | 2019-10-28 18:26:50 +0000 |
commit | b8eaa6a5848d8d055a9b124b1b49e9dd774e7611 (patch) | |
tree | a8e47aa83024b98d6838bba142dbd5e31dab1cc2 | |
parent | 19e353473dd09a43c922310eaf7868ce02842e77 (diff) | |
download | coreboot-b8eaa6a5848d8d055a9b124b1b49e9dd774e7611.tar.xz |
arch/x86: Move max cpuid leaf function into arch/x86
This cpuid function (0) is same across Intel and AMD so having it in
arch/x86 seems like a good idea.
Change-Id: I38f1c40bceac38ed6428f74b08bf60b971644f5a
Signed-off-by: Andrey Petrov <anpetrov@fb.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/36282
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
-rw-r--r-- | src/arch/x86/include/arch/cpu.h | 5 | ||||
-rw-r--r-- | src/soc/intel/common/block/timer/timer.c | 9 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/arch/x86/include/arch/cpu.h b/src/arch/x86/include/arch/cpu.h index b82473621d..9133f53065 100644 --- a/src/arch/x86/include/arch/cpu.h +++ b/src/arch/x86/include/arch/cpu.h @@ -141,6 +141,11 @@ static inline unsigned int cpuid_edx(unsigned int op) return edx; } +static inline unsigned int cpuid_get_max_func(void) +{ + return cpuid_eax(0); +} + #define X86_VENDOR_INVALID 0 #define X86_VENDOR_INTEL 1 #define X86_VENDOR_CYRIX 2 diff --git a/src/soc/intel/common/block/timer/timer.c b/src/soc/intel/common/block/timer/timer.c index 219c634e76..94e2e65683 100644 --- a/src/soc/intel/common/block/timer/timer.c +++ b/src/soc/intel/common/block/timer/timer.c @@ -30,11 +30,6 @@ static int get_processor_model(void) return c.x86_model; } -static unsigned int get_max_cpuid_func(void) -{ - return cpuid_eax(0); -} - static unsigned long get_hardcoded_crystal_freq(void) { unsigned long core_crystal_nominal_freq_khz = 0; @@ -72,7 +67,7 @@ static unsigned long calculate_tsc_freq_from_core_crystal(void) unsigned long core_crystal_nominal_freq_khz; struct cpuid_result cpuidr_15h; - if (get_max_cpuid_func() < 0x15) + if (cpuid_get_max_func() < 0x15) return 0; /* CPUID 15H TSC/Crystal ratio, plus optionally Crystal Hz */ @@ -103,7 +98,7 @@ static unsigned long calculate_tsc_freq_from_core_crystal(void) */ static unsigned long get_freq_from_cpuid16h(void) { - if (get_max_cpuid_func() < 0x16) + if (cpuid_get_max_func() < 0x16) return 0; return cpuid_eax(0x16); |