Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 3 | #include <amdblocks/cpu.h> |
| 4 | #include <amdblocks/mca.h> |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 5 | #include <cpu/amd/microcode.h> |
| 6 | #include <cpu/cpu.h> |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 7 | #include <device/device.h> |
| 8 | #include <soc/cpu.h> |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 9 | |
Felix Held | d40e8b6 | 2022-02-07 17:25:44 +0100 | [diff] [blame] | 10 | _Static_assert(CONFIG_MAX_CPUS == 8, "Do not override MAX_CPUS. To reduce the number of " |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 11 | "available cores, use the downcore_mode and disable_smt devicetree settings instead."); |
| 12 | |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 13 | static void zen_2_3_init(struct device *dev) |
| 14 | { |
| 15 | check_mca(); |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 16 | set_cstate_io_addr(); |
| 17 | |
Grzegorz Bernacki | d34dbe5 | 2023-04-25 15:30:14 +0000 | [diff] [blame] | 18 | amd_apply_microcode_patch(); |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 19 | } |
| 20 | |
| 21 | static struct device_operations cpu_dev_ops = { |
| 22 | .init = zen_2_3_init, |
| 23 | }; |
| 24 | |
| 25 | static struct cpu_device_id cpu_table[] = { |
Felix Held | 309043e | 2023-02-06 17:25:35 +0100 | [diff] [blame] | 26 | { X86_VENDOR_AMD, MENDOCINO_A0_CPUID, CPUID_ALL_STEPPINGS_MASK }, |
Felix Held | 1e78165 | 2023-02-08 11:39:16 +0100 | [diff] [blame] | 27 | CPU_TABLE_END |
Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 28 | }; |
| 29 | |
| 30 | static const struct cpu_driver zen_2_3 __cpu_driver = { |
| 31 | .ops = &cpu_dev_ops, |
| 32 | .id_table = cpu_table, |
| 33 | }; |