| 1 |
|
| 2 |
|
| 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> |
| 11 |
|
| 12 |
static void late_smm_lock(void *unused) |
| 13 |
{ |
| 14 |
|
| 15 |
if (is_smm_locked()) |
| 16 |
return; |
| 17 |
|
| 18 |
if (CONFIG(HAVE_SMI_HANDLER)) |
| 19 |
tseg_valid(); |
| 20 |
|
| 21 |
lock_smm(); |
| 22 |
} |
| 23 |
|
| 24 |
static void late_smm_finalize(void) |
| 25 |
{ |
| 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"); |
| 29 |
} |
| 30 |
|
| 31 |
static void soc_finalize(void *unused) |
| 32 |
{ |
| 33 |
if (CONFIG(SOC_AMD_COMMON_LATE_SMM_LOCKING)) |
| 34 |
late_smm_finalize(); |
| 35 |
|
| 36 |
if (!acpi_is_wakeup_s3()) { |
| 37 |
acpi_clear_pm_gpe_status(); |
| 38 |
|
| 39 |
if (CONFIG(HAVE_SMI_HANDLER)) |
| 40 |
acpi_disable_sci(); |
| 41 |
else |
| 42 |
acpi_enable_sci(); |
| 43 |
} |
| 44 |
|
| 45 |
post_code(POSTCODE_OS_BOOT); |
| 46 |
} |
| 47 |
|
| 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); |