[coreboot-gerrit] Change in coreboot[master]: amd/stoneyridge: Move SmmLock to end of POST
Marshall Dawson (Code Review)
gerrit at coreboot.org
Thu Jan 25 23:24:46 CET 2018
Marshall Dawson has uploaded this change for review. ( https://review.coreboot.org/23437
Change subject: amd/stoneyridge: Move SmmLock to end of POST
......................................................................
amd/stoneyridge: Move SmmLock to end of POST
Relocate locking of the SMM settings from the CPU initialization to
the end of POST (or just before resuming).
Change-Id: I70b7e33e7045d397e41f571caff6a2acbb64eaab
Signed-off-by: Marshall Dawson <marshalldawson3rd at gmail.com>
---
M src/soc/amd/stoneyridge/Makefile.inc
A src/soc/amd/stoneyridge/finalize.c
M src/soc/amd/stoneyridge/model_15_init.c
3 files changed, 53 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/37/23437/1
diff --git a/src/soc/amd/stoneyridge/Makefile.inc b/src/soc/amd/stoneyridge/Makefile.inc
index 3401808..da0b22a 100644
--- a/src/soc/amd/stoneyridge/Makefile.inc
+++ b/src/soc/amd/stoneyridge/Makefile.inc
@@ -101,6 +101,7 @@
ramstage-y += usb.c
ramstage-y += tsc_freq.c
ramstage-$(CONFIG_SPI_FLASH) += spi.c
+ramstage-y += finalize.c
smm-y += smihandler.c
smm-y += smi_util.c
diff --git a/src/soc/amd/stoneyridge/finalize.c b/src/soc/amd/stoneyridge/finalize.c
new file mode 100644
index 0000000..7de9315
--- /dev/null
+++ b/src/soc/amd/stoneyridge/finalize.c
@@ -0,0 +1,52 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2018 Advanced Micro Devices, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <cpu/x86/mp.h>
+#include <cpu/x86/msr.h>
+#include <cpu/amd/amdfam15.h>
+#include <bootstate.h>
+#include <timer.h>
+#include <console/console.h>
+
+static void per_core_finalize(void)
+{
+ msr_t msr;
+
+ /* Lock down SMM settings */
+ msr = rdmsr(HWCR_MSR);
+ msr.lo |= SMM_LOCK;
+ wrmsr(HWCR_MSR, msr);
+}
+
+static void finalize_cores(void)
+{
+ int r;
+ printk(BIOS_SPEW, "Lock SMM configuration\n");
+
+ r = mp_run_on_all_cpus(per_core_finalize, 10 * USECS_PER_MSEC);
+ if (r)
+ printk(BIOS_DEBUG, "Failed to finalize all cores\n");
+}
+
+static void soc_finalize(void *unused)
+{
+ finalize_cores();
+
+ 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);
+
diff --git a/src/soc/amd/stoneyridge/model_15_init.c b/src/soc/amd/stoneyridge/model_15_init.c
index 930e395..56f747c 100644
--- a/src/soc/amd/stoneyridge/model_15_init.c
+++ b/src/soc/amd/stoneyridge/model_15_init.c
@@ -76,11 +76,6 @@
msr.hi = 0;
for (i = 0 ; i < 6 ; i++)
wrmsr(MCI_STATUS + (i * 4), msr);
-
- /* Write protect SMM space with SMMLOCK. */
- msr = rdmsr(HWCR_MSR);
- msr.lo |= (1 << 0);
- wrmsr(HWCR_MSR, msr);
}
static struct device_operations cpu_dev_ops = {
--
To view, visit https://review.coreboot.org/23437
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I70b7e33e7045d397e41f571caff6a2acbb64eaab
Gerrit-Change-Number: 23437
Gerrit-PatchSet: 1
Gerrit-Owner: Marshall Dawson <marshalldawson3rd at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180125/a2ca5bc8/attachment-0001.html>
More information about the coreboot-gerrit
mailing list