1 /* SPDX-License-Identifier: GPL-2.0-only */
4 * This file is created based on Intel Tiger Lake Processor CPU Datasheet
5 * Document number: 575683
9 #include <device/pci.h>
10 #include <cpu/x86/mp.h>
11 #include <cpu/x86/msr.h>
12 #include <cpu/intel/smm_reloc.h>
13 #include <cpu/intel/turbo.h>
14 #include <cpu/intel/common/common.h>
16 #include <intelblocks/cpulib.h>
17 #include <intelblocks/mp_init.h>
18 #include <intelblocks/msr.h>
21 #include <soc/pci_devs.h>
22 #include <soc/soc_chip.h>
25 bool cpu_soc_is_in_untrusted_mode(void)
29 msr
= rdmsr(MSR_BIOS_DONE
);
30 return !!(msr
.lo
& ENABLE_IA_UNTRUSTED
);
33 void cpu_soc_bios_done(void)
37 msr
= rdmsr(MSR_BIOS_DONE
);
38 msr
.lo
|= ENABLE_IA_UNTRUSTED
;
39 wrmsr(MSR_BIOS_DONE
, msr
);
42 static void soc_fsp_load(void)
47 static void configure_misc(void)
51 config_t
*conf
= config_of_soc();
53 msr
= rdmsr(IA32_MISC_ENABLE
);
54 msr
.lo
|= (1 << 0); /* Fast String enable */
55 msr
.lo
|= (1 << 3); /* TM1/TM2/EMTTM enable */
56 wrmsr(IA32_MISC_ENABLE
, msr
);
59 cpu_set_eist(conf
->eist_enable
);
61 /* Disable Thermal interrupts */
64 wrmsr(IA32_THERM_INTERRUPT
, msr
);
66 /* Enable package critical interrupt only */
69 wrmsr(IA32_PACKAGE_THERM_INTERRUPT
, msr
);
72 msr
= rdmsr(MSR_POWER_CTL
);
73 msr
.lo
|= (1 << 0); /* Enable Bi-directional PROCHOT as an input */
74 msr
.lo
|= (1 << 23); /* Lock it */
75 wrmsr(MSR_POWER_CTL
, msr
);
78 /* All CPUs including BSP will run the following function. */
79 void soc_core_init(struct device
*cpu
)
81 /* Clear out pending MCEs */
82 /* TODO(adurbin): This should only be done on a cold boot. Also, some
83 * of these banks are core vs package scope. For now every CPU clears
89 /* Configure Enhanced SpeedStep and Thermal Sensors */
92 enable_pm_timer_emulation();
94 /* Enable Direct Cache Access */
97 /* Set energy policy */
98 set_energy_perf_bias(ENERGY_POLICY_NORMAL
);
104 static void per_cpu_smm_trigger(void)
106 /* Relocate the SMM handler. */
110 static void post_mp_init(void)
116 * 1. Now that all APs have been relocated as well as the BSP let SMIs
118 * 2. Skip enabling power button SMI and enable it after BS_CHIPS_INIT
119 * to avoid shutdown hang due to lack of init on certain IP in FSP-S.
121 global_smi_enable_no_pwrbtn();
124 static const struct mp_ops mp_ops
= {
126 * Skip Pre MP init MTRR programming as MTRRs are mirrored from BSP,
127 * that are set prior to ramstage.
128 * Real MTRRs programming are being done after resource allocation.
130 .pre_mp_init
= soc_fsp_load
,
131 .get_cpu_count
= get_cpu_count
,
132 .get_smm_info
= smm_info
,
133 .get_microcode_info
= get_microcode_info
,
134 .pre_mp_smm_init
= smm_initialize
,
135 .per_cpu_smm_trigger
= per_cpu_smm_trigger
,
136 .relocation_handler
= smm_relocation_handler
,
137 .post_mp_init
= post_mp_init
,
140 void mp_init_cpus(struct bus
*cpu_bus
)
142 /* TODO: Handle mp_init_with_smm failure? */
143 mp_init_with_smm(cpu_bus
, &mp_ops
);
145 /* Thermal throttle activation offset */
146 configure_tcc_thermal_target();