diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-07-18 13:15:40 -0700 |
---|---|---|
committer | Randall Spangler <rspangler@chromium.org> | 2012-07-18 18:15:29 -0700 |
commit | 8137b29125dec793c84273b522d8adfa7c1748dc (patch) | |
tree | 763ea30bc74eb93b205aac543be708fe6d99d583 /include/flash.h | |
parent | 3dfc336b440979c1eb58102df0f15a7cc0f305e8 (diff) | |
download | chrome-ec-8137b29125dec793c84273b522d8adfa7c1748dc.tar.gz |
Add EC flash protect command to ectool
BUG=chrome-os-partner:11150
TEST=manual
Enable WP GPIO. Then from a root shell
localhost ~ # ectool flashprotect
Flash protect flags: 0x00000008 wp_gpio_asserted
Writable flags: 0x00000005 ro_at_boot rw_now
localhost ~ # ectool flashprotect enable
Flash protect flags: 0x0000000b wp_gpio_asserted ro_at_boot ro_now
Writable flags: 0x00000004 rw_now
localhost ~ # ectool flashprotect enable
Flash protect flags: 0x0000000b wp_gpio_asserted ro_at_boot ro_now
Writable flags: 0x00000004 rw_now
localhost ~ # ectool flashprotect now
Flash protect flags: 0x0000000f wp_gpio_asserted ro_at_boot ro_now rw_now
Writable flags: 0x00000000
localhost ~ # ectool flashprotect now
Flash protect flags: 0x0000000f wp_gpio_asserted ro_at_boot ro_now rw_now
Writable flags: 0x00000000
localhost ~ # ectool flashprotect disable
Flash protect flags: 0x0000000f wp_gpio_asserted ro_at_boot ro_now rw_now
Writable flags: 0x00000000
Unable to set requested flags (wanted mask 0x00000001 flags 0x00000000)
Which is expected, because writable mask is 0x00000000.
Then disable WP GPIO and reboot
localhost ~ # ectool flashprotect
Flash protect flags: 0x00000001 ro_at_boot
Writable flags: 0x00000001 ro_at_boot
localhost ~ # ectool flashprotect disable
Flash protect flags: 0x00000000
Writable flags: 0x00000001 ro_at_boot
Change-Id: Idc5de3b3033521467aca8fb0ba9b7c378d0ad2a1
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27799
Diffstat (limited to 'include/flash.h')
-rw-r--r-- | include/flash.h | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/include/flash.h b/include/flash.h index e78119868b..617259f0c9 100644 --- a/include/flash.h +++ b/include/flash.h @@ -9,7 +9,7 @@ #define __CROS_EC_FLASH_H #include "common.h" - +#include "ec_commands.h" /* For EC_FLASH_PROTECT_* flags */ /*****************************************************************************/ /* Low-level methods, for use by flash_common. */ @@ -158,29 +158,10 @@ int flash_protect_until_reboot(void); */ int flash_enable_protect(int enable); -/* Flags for flash_get_protect() */ -/* - * Flash protection lock has been set. Note that if the write protect pin was - * deasserted at boot time, this simply indicates the state of the lock - * setting, and not whether blocks are actually protected. - */ -#define FLASH_PROTECT_RO_AT_BOOT (1 << 0) -/* - * Flash protection lock has actually been applied. Read-only firmware is - * protected, and flash protection cannot be unlocked. - */ -#define FLASH_PROTECT_RO_NOW (1 << 1) -/* Write protect pin is currently asserted */ -#define FLASH_PROTECT_PIN_ASSERTED (1 << 2) -/* Entire flash is protected until reboot */ -#define FLASH_PROTECT_RW_NOW (1 << 3) -/* At least one bank of flash is stuck locked, and cannot be unlocked */ -#define FLASH_PROTECT_STUCK_LOCKED (1 << 4) -/* At least one bank of flash which should be protected is not protected */ -#define FLASH_PROTECT_PARTIAL (1 << 5) - /** * Return the flash protect lock status. + * + * Uses the EC_FLASH_PROTECT_* flags from ec_commands.h */ int flash_get_protect(void); |