diff options
author | Andrey Petrov <andrey.petrov@intel.com> | 2015-06-10 10:33:39 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-07-16 18:47:22 +0000 |
commit | ef4d930f88ecf150bffa5761af72e7fa68b77afd (patch) | |
tree | 18326cf15cbadd91030fbc5ca988bd7ee45e00ff /common/spi_flash_reg.c | |
parent | d705a4d208826a3666e4c201a6379434bc8695e8 (diff) | |
download | chrome-ec-ef4d930f88ecf150bffa5761af72e7fa68b77afd.tar.gz |
cyan: fix issues with write protection
* Fixes cyan/board.h to use correct SPI part
* Adds new flash protection regions in spi_flash_reg.c
* Sets SRP register in flash_physical_protect_at_boot()
* Fixes a bug in COMPARE_BIT macro
* Makes spi_flash_set_status() fail only when both HW pin is asserted
AND SRP(s) are set
* Makes sure set_flash_set_status() completes before returning
BUG=chrome-os-partner:40908
BRANCH=master
TEST=on Cyan:
With WP pin de-asserted:
flashrom -p ec --wp-enable
flashrom -p ec --wp-status, make sure it is enabled
flashrom -p ec --wp-disable
flashrom -p ec --status, make sure it is disabled
flashrom -p ec --wp-enable
Assert WP pin (either with screwdriver or dut-control)
flashrom -p ec --wp-disable
make sure it failed
Change-Id: I338cc906b73e723fdbb37f7c2fd0c4da358b6c8e
Signed-off-by: Andrey Petrov <andrey.petrov@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/276671
Reviewed-by: Shawn N <shawnn@chromium.org>
Tested-by: Divya Jyothi <divya.jyothi@intel.com>
Commit-Queue: Divya Jyothi <divya.jyothi@intel.com>
Diffstat (limited to 'common/spi_flash_reg.c')
-rw-r--r-- | common/spi_flash_reg.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/common/spi_flash_reg.c b/common/spi_flash_reg.c index f1261ad823..6eab99f1cc 100644 --- a/common/spi_flash_reg.c +++ b/common/spi_flash_reg.c @@ -27,7 +27,7 @@ struct protect_range { }; /* Compare macro for (x =? b) for 'X' comparison */ -#define COMPARE_BIT(a, b) ((a) != X && (a) != (b)) +#define COMPARE_BIT(a, b) ((a) != X && (a) != !!(b)) /* Assignment macro where 'X' = 0 */ #define GET_BIT(a) ((a) == X ? 0 : (a)) @@ -44,6 +44,9 @@ static const struct protect_range spi_flash_protect_ranges[] = { { X, X, 1, { 0, 0, 1 }, 0, 0x10000 }, /* Lower 1/8 */ { X, X, 1, { 0, 1, 0 }, 0, 0x20000 }, /* Lower 1/4 */ { X, X, X, { 1, X, X }, 0, 0x80000 }, /* All protected */ + { X, X, 0, { 0, 0, 1 }, 0x70000, 0x10000 }, /* Upper 1/8*/ + { X, X, 0, { 0, 1, 0 }, 0x60000, 0x20000 }, /* Upper 1/4*/ + { X, X, 0, { 0, 1, 1 }, 0x40000, 0x40000 }, /* Upper 1/2*/ }; #elif defined(CONFIG_SPI_FLASH_W25Q64) |