diff options
author | Felix Held <felix-coreboot@felixheld.de> | 2021-02-16 17:42:56 +0100 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2021-02-19 22:11:30 +0000 |
commit | 746f438ada87ba4219f67355b3ce73b177914fca (patch) | |
tree | c8220f5166832e57dd89b090902b46e01a06f855 /src/soc | |
parent | 7aacdd1d35aaa772a02c93fdecb908da82692535 (diff) |
soc/amd: move SMM finalization to common code
This adds the SMM finalization to Cezanne.
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I1a2b433d92df2a76979e2e6a3d1dde996303ba78
Reviewed-on: https://review.coreboot.org/c/coreboot/+/50801
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc')
-rw-r--r-- | src/soc/amd/common/block/cpu/Kconfig | 3 | ||||
-rw-r--r-- | src/soc/amd/common/block/cpu/smm/Makefile.inc | 1 | ||||
-rw-r--r-- | src/soc/amd/common/block/cpu/smm/finalize.c (renamed from src/soc/amd/picasso/finalize.c) | 0 | ||||
-rw-r--r-- | src/soc/amd/picasso/Makefile.inc | 1 | ||||
-rw-r--r-- | src/soc/amd/stoneyridge/Makefile.inc | 1 | ||||
-rw-r--r-- | src/soc/amd/stoneyridge/finalize.c | 55 |
6 files changed, 3 insertions, 58 deletions
diff --git a/src/soc/amd/common/block/cpu/Kconfig b/src/soc/amd/common/block/cpu/Kconfig index 851b09175d..1437326f9d 100644 --- a/src/soc/amd/common/block/cpu/Kconfig +++ b/src/soc/amd/common/block/cpu/Kconfig @@ -29,7 +29,8 @@ endif # SOC_AMD_COMMON_BLOCK_NONCAR config SOC_AMD_COMMON_BLOCK_SMM bool help - Add common SMM relocation and handler functionality to the build. + Add common SMM relocation, finalization and handler functionality to + the build. config SOC_AMD_COMMON_BLOCK_TSC_FAM17H_19H bool diff --git a/src/soc/amd/common/block/cpu/smm/Makefile.inc b/src/soc/amd/common/block/cpu/smm/Makefile.inc index 3008868760..4c18d12b1d 100644 --- a/src/soc/amd/common/block/cpu/smm/Makefile.inc +++ b/src/soc/amd/common/block/cpu/smm/Makefile.inc @@ -4,6 +4,7 @@ subdirs-y += ../../../../../../cpu/x86/smm romstage-y += smm_helper.c postcar-y += smm_helper.c +ramstage-y += finalize.c ramstage-y += smm_relocate.c ramstage-y += smm_helper.c smm-y += smi_handler.c diff --git a/src/soc/amd/picasso/finalize.c b/src/soc/amd/common/block/cpu/smm/finalize.c index 2df55247cf..2df55247cf 100644 --- a/src/soc/amd/picasso/finalize.c +++ b/src/soc/amd/common/block/cpu/smm/finalize.c diff --git a/src/soc/amd/picasso/Makefile.inc b/src/soc/amd/picasso/Makefile.inc index 8a965c4f0d..c8cc458da0 100644 --- a/src/soc/amd/picasso/Makefile.inc +++ b/src/soc/amd/picasso/Makefile.inc @@ -45,7 +45,6 @@ ramstage-y += reset.c ramstage-y += acp.c ramstage-y += sata.c ramstage-y += uart.c -ramstage-y += finalize.c ramstage-y += soc_util.c ramstage-y += fsp_params.c ramstage-y += graphics.c diff --git a/src/soc/amd/stoneyridge/Makefile.inc b/src/soc/amd/stoneyridge/Makefile.inc index 856f6e6140..c3ca69da06 100644 --- a/src/soc/amd/stoneyridge/Makefile.inc +++ b/src/soc/amd/stoneyridge/Makefile.inc @@ -60,7 +60,6 @@ ramstage-y += memmap.c ramstage-y += uart.c ramstage-y += usb.c ramstage-y += tsc_freq.c -ramstage-y += finalize.c ramstage-y += psp.c all-y += reset.c diff --git a/src/soc/amd/stoneyridge/finalize.c b/src/soc/amd/stoneyridge/finalize.c deleted file mode 100644 index 2df55247cf..0000000000 --- a/src/soc/amd/stoneyridge/finalize.c +++ /dev/null @@ -1,55 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -#include <acpi/acpi.h> -#include <cpu/x86/mp.h> -#include <cpu/x86/msr.h> -#include <cpu/amd/msr.h> -#include <bootstate.h> -#include <console/console.h> -#include <amdblocks/acpi.h> - -static void per_core_finalize(void *unused) -{ - msr_t hwcr, mask; - - /* Finalize SMM settings */ - hwcr = rdmsr(HWCR_MSR); - if (hwcr.lo & SMM_LOCK) /* Skip if already locked, avoid GPF */ - return; - - if (CONFIG(HAVE_SMI_HANDLER)) { - mask = rdmsr(SMM_MASK_MSR); - mask.lo |= SMM_TSEG_VALID; - wrmsr(SMM_MASK_MSR, mask); - } - - hwcr.lo |= SMM_LOCK; - wrmsr(HWCR_MSR, hwcr); -} - -static void finalize_cores(void) -{ - int r; - printk(BIOS_SPEW, "Lock SMM configuration\n"); - - r = mp_run_on_all_cpus(per_core_finalize, NULL); - if (r) - printk(BIOS_WARNING, "Failed to finalize all cores\n"); -} - -static void soc_finalize(void *unused) -{ - finalize_cores(); - - if (!acpi_is_wakeup_s3()) { - if (CONFIG(HAVE_SMI_HANDLER)) - acpi_disable_sci(); - else - acpi_enable_sci(); - } - - post_code(POST_OS_BOOT); -} - -BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, soc_finalize, NULL); -BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_LOAD, BS_ON_EXIT, soc_finalize, NULL); |