1 /* SPDX-License-Identifier: GPL-2.0-only */
4 * This file is created based on Intel Alder Lake Processor CPU Datasheet
5 * Document number: 619501
9 #include <console/console.h>
10 #include <device/pci.h>
11 #include <cpu/x86/lapic.h>
12 #include <cpu/x86/mp.h>
13 #include <cpu/x86/msr.h>
14 #include <cpu/intel/smm_reloc.h>
15 #include <cpu/intel/turbo.h>
16 #include <cpu/intel/common/common.h>
18 #include <intelblocks/cpulib.h>
19 #include <intelblocks/mp_init.h>
20 #include <intelblocks/msr.h>
23 #include <soc/pci_devs.h>
24 #include <soc/soc_chip.h>
26 static void soc_fsp_load(void)
31 static void configure_misc(void)
35 config_t
*conf
= config_of_soc();
37 msr
= rdmsr(IA32_MISC_ENABLE
);
38 msr
.lo
|= (1 << 0); /* Fast String enable */
39 msr
.lo
|= (1 << 3); /* TM1/TM2/EMTTM enable */
40 wrmsr(IA32_MISC_ENABLE
, msr
);
43 cpu_set_eist(conf
->eist_enable
);
45 /* Disable Thermal interrupts */
48 wrmsr(IA32_THERM_INTERRUPT
, msr
);
50 /* Enable package critical interrupt only */
53 wrmsr(IA32_PACKAGE_THERM_INTERRUPT
, msr
);
56 msr
= rdmsr(MSR_POWER_CTL
);
57 msr
.lo
|= (1 << 0); /* Enable Bi-directional PROCHOT as an input*/
58 msr
.lo
|= (1 << 23); /* Lock it */
59 wrmsr(MSR_POWER_CTL
, msr
);
62 /* All CPUs including BSP will run the following function. */
63 void soc_core_init(struct device
*cpu
)
65 /* Clear out pending MCEs */
66 /* TODO(adurbin): This should only be done on a cold boot. Also, some
67 * of these banks are core vs package scope. For now every CPU clears
71 /* Enable the local CPU apics */
75 /* Configure Enhanced SpeedStep and Thermal Sensors */
78 enable_pm_timer_emulation();
80 /* Enable Direct Cache Access */
83 /* Set energy policy */
84 set_energy_perf_bias(ENERGY_POLICY_NORMAL
);
90 static void per_cpu_smm_trigger(void)
92 /* Relocate the SMM handler. */
96 static void post_mp_init(void)
102 * 1. Now that all APs have been relocated as well as the BSP let SMIs
104 * 2. Skip enabling power button SMI and enable it after BS_CHIPS_INIT
105 * to avoid shutdown hang due to lack of init on certain IP in FSP-S.
107 global_smi_enable_no_pwrbtn();
110 static const struct mp_ops mp_ops
= {
112 * Skip Pre MP init MTRR programming as MTRRs are mirrored from BSP,
113 * that are set prior to ramstage.
114 * Real MTRRs programming are being done after resource allocation.
116 .pre_mp_init
= soc_fsp_load
,
117 .get_cpu_count
= get_cpu_count
,
118 .get_smm_info
= smm_info
,
119 .get_microcode_info
= get_microcode_info
,
120 .pre_mp_smm_init
= smm_initialize
,
121 .per_cpu_smm_trigger
= per_cpu_smm_trigger
,
122 .relocation_handler
= smm_relocation_handler
,
123 .post_mp_init
= post_mp_init
,
126 void soc_init_cpus(struct bus
*cpu_bus
)
128 if (mp_init_with_smm(cpu_bus
, &mp_ops
))
129 printk(BIOS_ERR
, "MP initialization failure.\n");
131 /* Thermal throttle activation offset */
132 configure_tcc_thermal_target();