ec/google/chromeec: Enable ACPI memory mapping for Microchip EC
[coreboot2.git] / src / soc / amd / common / block / cpu / smm / finalize.c
bloba3ba188d9e153b70b7fd447766e93587e3aa2712
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <acpi/acpi.h>
4 #include <amdblocks/acpi.h>
5 #include <amdblocks/smm.h>
6 #include <bootstate.h>
7 #include <console/console.h>
8 #include <cpu/x86/mp.h>
9 #include <cpu/x86/msr.h>
10 #include <types.h>
12 static void late_smm_lock(void *unused)
14 /* Finalize SMM settings */
15 if (is_smm_locked()) /* Skip if already locked, avoid GPF */
16 return;
18 if (CONFIG(HAVE_SMI_HANDLER))
19 tseg_valid();
21 lock_smm();
24 static void late_smm_finalize(void)
26 printk(BIOS_SPEW, "Lock SMM configuration\n");
27 if (mp_run_on_all_cpus(late_smm_lock, NULL) != CB_SUCCESS)
28 printk(BIOS_WARNING, "Failed to finalize all cores\n");
31 static void soc_finalize(void *unused)
33 if (CONFIG(SOC_AMD_COMMON_LATE_SMM_LOCKING))
34 late_smm_finalize();
36 if (!acpi_is_wakeup_s3()) {
37 acpi_clear_pm_gpe_status();
39 if (CONFIG(HAVE_SMI_HANDLER))
40 acpi_disable_sci();
41 else
42 acpi_enable_sci();
45 post_code(POSTCODE_OS_BOOT);
48 BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, soc_finalize, NULL);
49 BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_LOAD, BS_ON_EXIT, soc_finalize, NULL);