From a32b6b9471696951b99d577882508eb9e526eadc Mon Sep 17 00:00:00 2001 From: Duncan Laurie Date: Thu, 15 Jan 2015 15:49:07 -0800 Subject: soc/intel/common: Add function to protect MRC cache Add support for applying write protection to the MRC cache region in SPI flash. This is only enabled if there is write protect GPIO that is set, and the flash status register reports that the flash chip is currently write protected. Then it will call out to a SOC specific function that will enable write protection on the RW_MRC_CACHE region of flash. The implementation is not quite as clean as I would like because there is not a common flash protect interface across SOCs so instead it relies on a new Kconfig variable to be set that will indicate a SOC implements the function to protect a region of SPI flash. BUG=chrome-os-partner:28234 BRANCH=broadwell TEST=build and boot on samus 1) with either WPSW=0 or SRP0=0 the PRR is not applied 2) with both WPSW=1 and SRP0=1 the PRR is applied Change-Id: If5907b7ddf3f966c546ae32dc99aa815beb27587 Signed-off-by: Stefan Reinauer Original-Commit-Id: a3e0e71dfd7339aab171a26b67aec465a3f332d6 Original-Change-Id: I94e54e4723b1dcdacbb6a05f047d0c0ebc7d8711 Original-Signed-off-by: Duncan Laurie Original-Reviewed-on: https://chromium-review.googlesource.com/241170 Original-Reviewed-by: Shawn N Reviewed-on: http://review.coreboot.org/9494 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- src/soc/intel/common/nvm.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/soc/intel/common/nvm.h') diff --git a/src/soc/intel/common/nvm.h b/src/soc/intel/common/nvm.h index d332d831f7..2e6b364c9f 100644 --- a/src/soc/intel/common/nvm.h +++ b/src/soc/intel/common/nvm.h @@ -31,4 +31,10 @@ int nvm_erase(void *start, size_t size); /* Write data to NVM. Returns 0 on success < 0 on error. */ int nvm_write(void *start, const void *data, size_t size); +/* Determine if flash device is write protected */ +int nvm_is_write_protected(void); + +/* Apply protection to a range of flash */ +int nvm_protect(void *start, size_t size); + #endif /* _COMMON_NVM_H_ */ -- cgit v1.2.3