diff options
author | Vic Yang <victoryang@chromium.org> | 2014-10-09 15:19:22 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-10-15 23:55:55 +0000 |
commit | 82915c25029c0bc2c018cfc080d913255ed82aac (patch) | |
tree | 1da32cff8e9e01142b63960fd454ff2b1832278a /include | |
parent | 5ff320f66e990a5efe8270f6125ed7c55699d50c (diff) | |
download | chrome-ec-82915c25029c0bc2c018cfc080d913255ed82aac.tar.gz |
Write protect support for STM32F0
On STM32F0, we cannot work around the hard fault triggered when trying
to protect the whole flash. Therefore, we need to go with the
ALL_AT_BOOT approach. When write protect is enabled, instead of setting
ALL_NOW flag to immediately lock down the entire flash, we need to set
ALL_AT_BOOT and then reboot to have the protection take effect.
BUG=chrome-os-partner:32745
TEST=Along with the next CL. On Ryu:
1. Enable HW WP. Check the output of 'ectool flashprotect' and see
correct flags.
2. 'flashrom -p ec --wp-range 0 0x10000'. Check RO_AT_BOOT is set.
3. Reboot EC and check RO_NOW is enabled.
4. Boot the system and check ALL_NOW is set.
5. Update BIOS and reboot. Check software sync updates EC-RW.
6. 'flashrom -p ec --wp-disable' and check it fails.
7. Disable HW WP and reboot EC. Check RO_NOW and ALL_NOW are cleared.
8. 'flashrom -p ec --wp-disable' and check RO_AT_BOOT is cleared.
TEST=Enable/disable WP on Spring. Check RO_AT_BOOT/ALL_NOW can be set
properly.
BRANCH=samus
Change-Id: I1c7c4f98f2535f1c8a1c7daaa88d47412d015977
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/222622
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/flash.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/flash.h b/include/flash.h index dff1be7948..0c6e11c429 100644 --- a/include/flash.h +++ b/include/flash.h @@ -125,17 +125,17 @@ int flash_physical_restore_state(void); int flash_is_erased(uint32_t offset, int size); /** - * Enable write protect for the read-only code. + * Enable write protect for the specified range. * * Once write protect is enabled, it will STAY enabled until the system is * hard-rebooted with the hardware write protect pin deasserted. If the write * protect pin is deasserted, the protect setting is ignored, and the entire * flash will be writable. * - * @param enable Enable write protection + * @param range The range to protect. * @return EC_SUCCESS, or nonzero if error. */ -int flash_protect_ro_at_boot(int enable); +int flash_protect_at_boot(enum flash_wp_range range); /*****************************************************************************/ /* High-level interface for use by other modules. */ |