summaryrefslogtreecommitdiff
path: root/include/flash.h
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@google.com>2017-01-11 14:17:33 +0800
committerchrome-bot <chrome-bot@chromium.org>2017-02-12 21:05:11 -0800
commit8c12f0a53f93e12530081fcbe164dab48257e58d (patch)
treece2873f66b05e28ad2d9b0170c52f5856f74eb1e /include/flash.h
parent14533749af1c89f3b0224092c580ebe147611299 (diff)
downloadchrome-ec-8c12f0a53f93e12530081fcbe164dab48257e58d.tar.gz
flash: Pass more precise parameter to flash_[physical_]protect_at_boot
In preparation for adding the rollback protection block, pass EC_FLASH_PROTECT_RO/ALL_AT_BOOT to flash_[physical_]protect_at_boot, instead of an enumeration no protection/RO/ALL. This will later allow us to protect/unprotect the rollback region only, by adding a EC_FLASH_PROTECT_ROLLBACK_AT_BOOT flag. BRANCH=none BUG=chrome-os-partner:61671 TEST=Build hammer with CONFIG_CMD_FLASH command, so that write protection can be checked with flasherase/flashwrite. TEST=On hammer (stm32f072): flashinfo => RO+RW not protected flashwp true; reboot => only RO protected flashwp rw; reboot => RO+RW protected flashwp norw; reboot => only RO protected TEST=On reef (npcx): deassert WP, flashwp false; flashinfo => RO+RW not protected flashwp true => only RO protected reboot => only RO protected flashwp rw => RO+RW protected reboot => only RO protected Change-Id: Iec96a7377baabc9100fc59de0a31505095a3499f Reviewed-on: https://chromium-review.googlesource.com/430518 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'include/flash.h')
-rw-r--r--include/flash.h17
1 files changed, 6 insertions, 11 deletions
diff --git a/include/flash.h b/include/flash.h
index e0873028f5..caa6d0b897 100644
--- a/include/flash.h
+++ b/include/flash.h
@@ -26,13 +26,6 @@
#define PSTATE_BANK_COUNT 0
#endif
-/* Range of write protection */
-enum flash_wp_range {
- FLASH_WP_NONE = 0,
- FLASH_WP_RO,
- FLASH_WP_ALL,
-};
-
/*****************************************************************************/
/* Low-level methods, for use by flash_common. */
@@ -86,10 +79,11 @@ uint32_t flash_physical_get_protect_flags(void);
/**
* Enable/disable protecting firmware/pstate at boot.
*
- * @param range The range to protect
+ * @param new_flags to protect (only EC_FLASH_PROTECT_*_AT_BOOT are
+ * taken care of)
* @return non-zero if error.
*/
-int flash_physical_protect_at_boot(enum flash_wp_range range);
+int flash_physical_protect_at_boot(uint32_t new_flags);
/**
* Protect flash now.
@@ -154,10 +148,11 @@ int flash_is_erased(uint32_t offset, int size);
* protect pin is deasserted, the protect setting is ignored, and the entire
* flash will be writable.
*
- * @param range The range to protect.
+ * @param new_flags to protect (only EC_FLASH_PROTECT_*_AT_BOOT are
+ * taken care of)
* @return EC_SUCCESS, or nonzero if error.
*/
-int flash_protect_at_boot(enum flash_wp_range range);
+int flash_protect_at_boot(uint32_t new_flags);
/*****************************************************************************/
/* High-level interface for use by other modules. */