Felix Held | dd2f3fa | 2021-02-08 22:23:54 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <amdblocks/cpu.h> |
Felix Held | d4b5ad0 | 2022-01-25 04:14:05 +0100 | [diff] [blame] | 4 | #include <cpu/amd/cpuid.h> |
Felix Held | dd2f3fa | 2021-02-08 22:23:54 +0100 | [diff] [blame] | 5 | #include <cpu/cpu.h> |
Felix Held | 9a6fc57 | 2021-02-08 22:37:17 +0100 | [diff] [blame] | 6 | #include <cpu/x86/msr.h> |
| 7 | #include <cpu/amd/msr.h> |
Fred Reitberger | ffd75c2 | 2022-06-23 11:25:16 -0400 | [diff] [blame] | 8 | #include <smbios.h> |
Felix Held | 9a6fc57 | 2021-02-08 22:37:17 +0100 | [diff] [blame] | 9 | #include <soc/iomap.h> |
Felix Held | dd2f3fa | 2021-02-08 22:23:54 +0100 | [diff] [blame] | 10 | |
Fred Reitberger | ffd75c2 | 2022-06-23 11:25:16 -0400 | [diff] [blame] | 11 | unsigned int smbios_processor_family(struct cpuid_result res) |
| 12 | { |
| 13 | return 0x6b; /* Zen */ |
| 14 | } |
| 15 | |
Felix Held | d4b5ad0 | 2022-01-25 04:14:05 +0100 | [diff] [blame] | 16 | unsigned int get_threads_per_core(void) |
| 17 | { |
| 18 | return 1 + ((cpuid_ebx(CPUID_EBX_CORE_ID) & CPUID_EBX_THREADS_MASK) |
| 19 | >> CPUID_EBX_THREADS_SHIFT); |
| 20 | } |
| 21 | |
Felix Held | 9a6fc57 | 2021-02-08 22:37:17 +0100 | [diff] [blame] | 22 | void set_cstate_io_addr(void) |
| 23 | { |
| 24 | msr_t cst_addr; |
| 25 | |
| 26 | cst_addr.hi = 0; |
| 27 | cst_addr.lo = ACPI_CPU_CONTROL; |
| 28 | wrmsr(MSR_CSTATE_ADDRESS, cst_addr); |
| 29 | } |