1 /* SPDX-License-Identifier: GPL-2.0-only */
4 #include <amdblocks/acpi.h>
5 #include <amdblocks/smm.h>
7 #include <console/console.h>
8 #include <cpu/x86/mp.h>
9 #include <cpu/x86/msr.h>
12 static void late_smm_lock(void *unused
)
14 /* Finalize SMM settings */
15 if (is_smm_locked()) /* Skip if already locked, avoid GPF */
18 if (CONFIG(HAVE_SMI_HANDLER
))
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
))
36 if (!acpi_is_wakeup_s3()) {
37 acpi_clear_pm_gpe_status();
39 if (CONFIG(HAVE_SMI_HANDLER
))
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
);