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 | 11ff753 | 2023-06-06 00:29:58 +0200 | [diff] [blame] | 4 | #include <arch/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> |
Felix Held | 11ff753 | 2023-06-06 00:29:58 +0200 | [diff] [blame] | 7 | #include <cpu/amd/cpuid.h> |
Felix Held | 9a6fc57 | 2021-02-08 22:37:17 +0100 | [diff] [blame] | 8 | #include <cpu/amd/msr.h> |
Felix Held | 11ff753 | 2023-06-06 00:29:58 +0200 | [diff] [blame] | 9 | #include <cpu/amd/mtrr.h> |
Fred Reitberger | ffd75c2 | 2022-06-23 11:25:16 -0400 | [diff] [blame] | 10 | #include <smbios.h> |
Felix Held | 9a6fc57 | 2021-02-08 22:37:17 +0100 | [diff] [blame] | 11 | #include <soc/iomap.h> |
Felix Held | b39e93e | 2023-06-05 23:56:46 +0200 | [diff] [blame] | 12 | #include <types.h> |
Felix Held | dd2f3fa | 2021-02-08 22:23:54 +0100 | [diff] [blame] | 13 | |
Felix Held | 52742b6 | 2023-03-25 02:50:43 +0100 | [diff] [blame] | 14 | uint32_t get_pstate_0_reg(void) |
15 | { | ||||
16 | return 0; | ||||
17 | } | ||||
18 | |||||
Felix Held | 78cbcef | 2023-03-25 04:58:40 +0100 | [diff] [blame] | 19 | uint32_t get_pstate_latency(void) |
20 | { | ||||
21 | return 0; | ||||
22 | } | ||||
23 | |||||
Fred Reitberger | ffd75c2 | 2022-06-23 11:25:16 -0400 | [diff] [blame] | 24 | unsigned int smbios_processor_family(struct cpuid_result res) |
25 | { | ||||
26 | return 0x6b; /* Zen */ | ||||
27 | } | ||||
28 | |||||
Felix Held | 9a6fc57 | 2021-02-08 22:37:17 +0100 | [diff] [blame] | 29 | void set_cstate_io_addr(void) |
30 | { | ||||
31 | msr_t cst_addr; | ||||
32 | |||||
33 | cst_addr.hi = 0; | ||||
Felix Held | cbe55a1 | 2023-03-03 22:37:34 +0100 | [diff] [blame] | 34 | cst_addr.lo = ACPI_CSTATE_CONTROL; |
Felix Held | 9a6fc57 | 2021-02-08 22:37:17 +0100 | [diff] [blame] | 35 | wrmsr(MSR_CSTATE_ADDRESS, cst_addr); |
36 | } | ||||
Felix Held | 11ff753 | 2023-06-06 00:29:58 +0200 | [diff] [blame] | 37 | |
Felix Held | 89ca478 | 2023-09-12 15:01:02 +0200 | [diff] [blame] | 38 | /* Number of most significant physical address bits reserved for secure memory encryption */ |
39 | unsigned int get_reserved_phys_addr_bits(void) | ||||
Felix Held | 11ff753 | 2023-06-06 00:29:58 +0200 | [diff] [blame] | 40 | { |
Felix Held | 614568e | 2023-09-28 20:28:40 +0200 | [diff] [blame^] | 41 | if (!(rdmsr(SYSCFG_MSR).raw & SYSCFG_MSR_SMEE)) |
Felix Held | 11ff753 | 2023-06-06 00:29:58 +0200 | [diff] [blame] | 42 | return 0; |
Felix Held | 614568e | 2023-09-28 20:28:40 +0200 | [diff] [blame^] | 43 | |
44 | return (cpuid_ebx(CPUID_EBX_MEM_ENCRYPT) & CPUID_EBX_MEM_ENCRYPT_ADDR_BITS_MASK) >> | ||||
45 | CPUID_EBX_MEM_ENCRYPT_ADDR_BITS_SHIFT; | ||||
Felix Held | 11ff753 | 2023-06-06 00:29:58 +0200 | [diff] [blame] | 46 | } |