blob: e9a510f6c2366b538700cf3a66b1aeec551b7131 [file] [log] [blame]
Martin Roth1a3de8e2022-10-06 15:57:21 -06001/* SPDX-License-Identifier: GPL-2.0-only */
2
Martin Roth20646cd2023-01-04 21:27:06 -07003/* TODO: Update for Phoenix */
Martin Roth1a3de8e2022-10-06 15:57:21 -06004
5#include <acpi/acpi.h>
6#include <amdblocks/cpu.h>
7#include <amdblocks/iomap.h>
8#include <amdblocks/mca.h>
9#include <console/console.h>
10#include <cpu/amd/microcode.h>
11#include <cpu/cpu.h>
12#include <cpu/x86/mp.h>
13#include <cpu/x86/mtrr.h>
14#include <acpi/acpi.h>
15#include <device/device.h>
16#include <soc/cpu.h>
17#include <soc/iomap.h>
18
Ritul Guru6de377e2023-01-06 00:20:10 +053019_Static_assert(CONFIG_MAX_CPUS == 16, "Do not override MAX_CPUS. To reduce the number of "
Martin Roth1a3de8e2022-10-06 15:57:21 -060020 "available cores, use the downcore_mode and disable_smt devicetree settings instead.");
21
22/* MP and SMM loading initialization */
23
24void mp_init_cpus(struct bus *cpu_bus)
25{
26 extern const struct mp_ops amd_mp_ops_with_smm;
27 if (mp_init_with_smm(cpu_bus, &amd_mp_ops_with_smm) != CB_SUCCESS)
28 die_with_post_code(POST_HW_INIT_FAILURE,
29 "mp_init_with_smm failed. Halting.\n");
30
31 /* pre_mp_init made the flash not cacheable. Reset to WP for performance. */
32 mtrr_use_temp_range(FLASH_BELOW_4GB_MAPPING_REGION_BASE,
33 FLASH_BELOW_4GB_MAPPING_REGION_SIZE, MTRR_TYPE_WRPROT);
34
35 /* SMMINFO only needs to be set up when booting from S5 */
36 if (!acpi_is_wakeup_s3())
37 apm_control(APM_CNT_SMMINFO);
38}
39
40static void zen_2_3_init(struct device *dev)
41{
42 check_mca();
43 set_cstate_io_addr();
44
45 amd_update_microcode_from_cbfs();
46}
47
48static struct device_operations cpu_dev_ops = {
49 .init = zen_2_3_init,
50};
51
52static struct cpu_device_id cpu_table[] = {
Martin Roth20646cd2023-01-04 21:27:06 -070053 { X86_VENDOR_AMD, PHOENIX_A0_CPUID}, /* TODO: Update for Phoenix */
Martin Roth1a3de8e2022-10-06 15:57:21 -060054 { 0, 0 },
55};
56
57static const struct cpu_driver zen_2_3 __cpu_driver = {
58 .ops = &cpu_dev_ops,
59 .id_table = cpu_table,
60};