aboutsummaryrefslogtreecommitdiff
path: root/src/soc/intel/skylake/smihandler.c
diff options
context:
space:
mode:
authorRavi Sarawadi <ravishankar.sarawadi@intel.com>2017-09-07 12:15:45 -0700
committerAaron Durbin <adurbin@chromium.org>2017-09-11 21:26:27 +0000
commitb051a9f5348abab842748577eaf4f06418df0ba3 (patch)
tree139e0c4938baa9b998c107642a45e78c613442b1 /src/soc/intel/skylake/smihandler.c
parentbfabe62a6e5cdd9e29394b12737c5ed9bd080036 (diff)
soc/intel/skylake: Fix SPI WP disable status check
Use SPI write protect disable bit from BIOS_CONTROL register to check write protect status. Change-Id: Ie79fb4e3e92a4ae777c5d501abbb44a732a9862a Signed-off-by: Ravi Sarawadi <ravishankar.sarawadi@intel.com> Reviewed-on: https://review.coreboot.org/21449 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/intel/skylake/smihandler.c')
-rw-r--r--src/soc/intel/skylake/smihandler.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/soc/intel/skylake/smihandler.c b/src/soc/intel/skylake/smihandler.c
index 3e79065cda..32764c644a 100644
--- a/src/soc/intel/skylake/smihandler.c
+++ b/src/soc/intel/skylake/smihandler.c
@@ -31,7 +31,6 @@
#include <pc80/mc146818rtc.h>
#include <spi-generic.h>
#include <soc/iomap.h>
-#include <soc/lpc.h>
#include <soc/nvs.h>
#include <soc/pci_devs.h>
#include <soc/pch.h>
@@ -403,23 +402,22 @@ static void southbridge_smi_tco(void)
return;
if (tco_sts & (1 << 8)) { /* BIOSWR */
- u8 bios_cntl = pci_read_config16(PCH_DEV_SPI, BIOS_CNTL);
-
- if (bios_cntl & 1) {
- /*
- * BWE is RW, so the SMI was caused by a
- * write to BWE, not by a write to the BIOS
- *
- * This is the place where we notice someone
- * is trying to tinker with the BIOS. We are
- * trying to be nice and just ignore it. A more
- * resolute answer would be to power down the
- * box.
- */
- printk(BIOS_DEBUG, "Switching back to RO\n");
- pci_write_config32(PCH_DEV_SPI, BIOS_CNTL,
- (bios_cntl & ~1));
- } /* No else for now? */
+ if (IS_ENABLED(CONFIG_SPI_FLASH_SMM)) {
+ if (fast_spi_wpd_status()) {
+ /*
+ * BWE is RW, so the SMI was caused by a
+ * write to BWE, not by a write to the BIOS
+ *
+ * This is the place where we notice someone
+ * is trying to tinker with the BIOS. We are
+ * trying to be nice and just ignore it. A more
+ * resolute answer would be to power down the
+ * box.
+ */
+ printk(BIOS_DEBUG, "Switching back to RO\n");
+ fast_spi_enable_wp();
+ } /* No else for now? */
+ }
} else if (tco_sts & (1 << 3)) { /* TIMEOUT */
/* Handle TCO timeout */
printk(BIOS_DEBUG, "TCO Timeout.\n");