diff options
author | Randall Spangler <rspangler@chromium.org> | 2013-05-21 12:34:11 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-05-24 16:27:49 -0700 |
commit | 1d28ca7cf1d8ec5f552dce7e84123735f6aecb14 (patch) | |
tree | ce6de03a89cea2fe2f8889fed0175438dbb7e38f /include/flash.h | |
parent | b144a584af63891b134c3f789fdd00ac232a9577 (diff) | |
download | chrome-ec-1d28ca7cf1d8ec5f552dce7e84123735f6aecb14.tar.gz |
Move flash_get_protect() and flash_set_protect() to flash_common.c
Much more flash code is now common between platforms, for more
consistent behavior and easier testing.
Also change STM32L to use pstate, the same way LM4 and STM32F do.
BUG=chrome-os-partner:15613
BRANCH=none
TEST=build pit, link, spring; do
- flashinfo -> (no flags)
- enable WP (via screw or dut-control)
- flashinfo -> wp_gpio_asserted
- flashwp enable
- flashinfo -> wp_gpio_asserted ro_at_boot
- flashwp now
- flashinfo -> wp_gpio_asserted ro_at_boot all_now (and possibly ro_now)
- flashwp disable -> fails
- flashinfo -> wp_gpio_asserted ro_at_boot all_now
- reboot ap-off
- flashinfo -> wp_gpio_asserted ro_at_boot ro_now
- disable WP (via screw or dut-control)
- reboot
- flashinfo -> ro_at_boot
- flashwp disable
- flashinfo -> (no flags)
Change-Id: Iccd098786454ad9b72b4e5f9f312d86819a0c8eb
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/56109
Diffstat (limited to 'include/flash.h')
-rw-r--r-- | include/flash.h | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/include/flash.h b/include/flash.h index 8f842cc6d1..55f0b0fba8 100644 --- a/include/flash.h +++ b/include/flash.h @@ -88,9 +88,13 @@ int flash_physical_erase(int offset, int size); int flash_physical_get_protect(int bank); /** - * Return non-zero if entire flash is locked for the current boot. + * Return flash protect state flags from the physical layer. + * + * This should only be called by flash_get_protect(). + * + * Uses the EC_FLASH_PROTECT_* flags from ec_commands.h */ -int flash_physical_get_all_protect_now(void); +uint32_t flash_physical_get_protect_flags(void); /** * Set physical write protect status for the next boot. @@ -104,6 +108,14 @@ int flash_physical_set_protect_at_boot(int start_bank, int bank_count, int enable); /** + * Protect flash now. + * + * @param all Protect all (=1) or just read-only and pstate (=0). + * @return non-zero if error. + */ +int flash_physical_protect_now(int all); + +/** * Force reload of flash protection bits. * * Some EC architectures (STM32L) only load the bits from option bytes at @@ -118,11 +130,6 @@ int flash_physical_force_reload(void); /* Low-level persistent state code for use by flash modules. */ /** - * Return non-zero if RO flash should be protected at boot. - */ -int flash_get_protect_ro_at_boot(void); - -/** * Enable write protect for the read-only code. * * Once write protect is enabled, it will STAY enabled until the system is |