diff options
author | Nicolas Boichat <drinkcat@google.com> | 2017-01-20 18:42:32 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-03-02 23:46:18 -0800 |
commit | c45402564f732b4bd6e6f780d255223105d24163 (patch) | |
tree | f1a2065b7c55a560ca571846412b3cba553bc824 | |
parent | 9e7fdc239c5e8aaffb0ff174b69d022baf61a3e0 (diff) | |
download | chrome-ec-c45402564f732b4bd6e6f780d255223105d24163.tar.gz |
hammer: Add rollback protection flash region
In the process, also manually specify all regions exact size,
which will be useful later on (e.g. when using RO/RW of different
sizes).
BRANCH=none
BUG=chrome-os-partner:61671
TEST=make BOARD=hammer -j; flashwp true/rb/rw protects the expected
regions, flashwp noall unprotects them.
Change-Id: Ib31d9384060b1373e0834cfecb4ebd0a7bafd356
Reviewed-on: https://chromium-review.googlesource.com/430520
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r-- | board/hammer/board.h | 56 |
1 files changed, 54 insertions, 2 deletions
diff --git a/board/hammer/board.h b/board/hammer/board.h index 1302291089..ddf618f662 100644 --- a/board/hammer/board.h +++ b/board/hammer/board.h @@ -11,11 +11,59 @@ /* TODO: Remove CONFIG_SYSTEM_UNLOCKED prior to building MP FW. */ #define CONFIG_SYSTEM_UNLOCKED +/* 48 MHz SYSCLK clock frequency */ +#define CPU_CLOCK 48000000 + +/* + * Flash layout: we redefine the sections offsets and sizes as we want to + * include a rollback region, and will use RO/RW regions of different sizes. + */ +#undef _IMAGE_SIZE +#undef CONFIG_ROLLBACK_OFF +#undef CONFIG_ROLLBACK_SIZE +#undef CONFIG_FLASH_PSTATE +#undef CONFIG_FW_PSTATE_SIZE +#undef CONFIG_FW_PSTATE_OFF +#undef CONFIG_SHAREDLIB_SIZE +#undef CONFIG_RO_MEM_OFF +#undef CONFIG_RO_STORAGE_OFF +#undef CONFIG_RO_SIZE +#undef CONFIG_RW_MEM_OFF +#undef CONFIG_RW_STORAGE_OFF +#undef CONFIG_RW_SIZE +#undef CONFIG_EC_PROTECTED_STORAGE_OFF +#undef CONFIG_EC_PROTECTED_STORAGE_SIZE +#undef CONFIG_EC_WRITABLE_STORAGE_OFF +#undef CONFIG_EC_WRITABLE_STORAGE_SIZE +#undef CONFIG_WP_STORAGE_OFF +#undef CONFIG_WP_STORAGE_SIZE + +#define _IMAGE_SIZE (CONFIG_FLASH_SIZE / 2) + +/* EC rollback protection block */ +#define CONFIG_ROLLBACK_OFF _IMAGE_SIZE +#define CONFIG_ROLLBACK_SIZE CONFIG_FLASH_BANK_SIZE + +#define CONFIG_FLASH_PSTATE /* Do not use a dedicated PSTATE bank */ #undef CONFIG_FLASH_PSTATE_BANK -/* 48 MHz SYSCLK clock frequency */ -#define CPU_CLOCK 48000000 +#define CONFIG_SHAREDLIB_SIZE 0 + +#define CONFIG_RO_MEM_OFF 0 +#define CONFIG_RO_STORAGE_OFF 0 +#define CONFIG_RO_SIZE _IMAGE_SIZE +#define CONFIG_RW_MEM_OFF (_IMAGE_SIZE + CONFIG_ROLLBACK_SIZE) +#define CONFIG_RW_STORAGE_OFF 0 +#define CONFIG_RW_SIZE (_IMAGE_SIZE - CONFIG_ROLLBACK_SIZE) + +#define CONFIG_EC_PROTECTED_STORAGE_OFF CONFIG_RO_MEM_OFF +#define CONFIG_EC_PROTECTED_STORAGE_SIZE CONFIG_RO_SIZE +#define CONFIG_EC_WRITABLE_STORAGE_OFF CONFIG_RW_MEM_OFF +#define CONFIG_EC_WRITABLE_STORAGE_SIZE CONFIG_RW_SIZE + +#define CONFIG_WP_STORAGE_OFF CONFIG_EC_PROTECTED_STORAGE_OFF +#define CONFIG_WP_STORAGE_SIZE CONFIG_EC_PROTECTED_STORAGE_SIZE /* The UART console is on USART1 (PA9/PA10) */ #undef CONFIG_UART_CONSOLE @@ -88,6 +136,10 @@ #define CONFIG_RSA_KEY_SIZE 2048 #define CONFIG_RSA_EXPONENT_3 +/* + * Add rollback protection, and independent RW region protection. + */ +#define CONFIG_ROLLBACK #define CONFIG_FLASH_PROTECT_RW /* Enable elan trackpad driver */ |