From 2c760cf30b95715791eb43701b3d5536558b3a8d Mon Sep 17 00:00:00 2001 From: Nicolas Boichat Date: Wed, 12 Sep 2018 14:25:31 -0700 Subject: flash: Add CONFIG_FLASH_READOUT_PROTECTION config option Instead of tying together CONFIG_WP_ALWAYS and RDP protection, separate the options. BRANCH=nocturne BUG=b:111330723 TEST=make buildall -j Change-Id: I905b573a900ef4dd0431666c525c951582143e09 Signed-off-by: Nicolas Boichat Reviewed-on: https://chromium-review.googlesource.com/1222093 Reviewed-by: Randall Spangler --- board/coffeecake/board.h | 1 + board/cr50/board.h | 1 + board/dingdong/board.h | 1 + board/glkrvp/board.h | 1 + board/glkrvp_ite/board.h | 1 + board/hoho/board.h | 1 + board/nucleo-f411re/board.h | 1 + chip/stm32/flash-f.c | 2 +- chip/stm32/flash-stm32l4.c | 2 +- include/config.h | 5 +++++ 10 files changed, 14 insertions(+), 2 deletions(-) diff --git a/board/coffeecake/board.h b/board/coffeecake/board.h index 3db2ea11b1..77abfa7f99 100644 --- a/board/coffeecake/board.h +++ b/board/coffeecake/board.h @@ -67,6 +67,7 @@ /* No Write-protect GPIO, force the write-protection */ #define CONFIG_WP_ALWAYS +#define CONFIG_FLASH_READOUT_PROTECTION #ifndef __ASSEMBLER__ diff --git a/board/cr50/board.h b/board/cr50/board.h index 8d5e7b17ea..cd1045d986 100644 --- a/board/cr50/board.h +++ b/board/cr50/board.h @@ -39,6 +39,7 @@ /* Flash configuration */ #undef CONFIG_FLASH_PSTATE #define CONFIG_WP_ALWAYS +#define CONFIG_FLASH_READOUT_PROTECTION #define CONFIG_CMD_FLASH #define CONFIG_CRC8 diff --git a/board/dingdong/board.h b/board/dingdong/board.h index 3636b3f34f..3ecbf7658c 100644 --- a/board/dingdong/board.h +++ b/board/dingdong/board.h @@ -52,6 +52,7 @@ /* No Write-protect GPIO, force the write-protection */ #define CONFIG_WP_ALWAYS +#define CONFIG_FLASH_READOUT_PROTECTION #ifndef __ASSEMBLER__ diff --git a/board/glkrvp/board.h b/board/glkrvp/board.h index 1b330f3d00..fc37732bc8 100644 --- a/board/glkrvp/board.h +++ b/board/glkrvp/board.h @@ -90,6 +90,7 @@ #define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL #define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL #define CONFIG_WP_ALWAYS +#define CONFIG_FLASH_READOUT_PROTECTION #define CONFIG_I2C #define CONFIG_I2C_MASTER diff --git a/board/glkrvp_ite/board.h b/board/glkrvp_ite/board.h index 4209a06bf8..3d5abee7e0 100644 --- a/board/glkrvp_ite/board.h +++ b/board/glkrvp_ite/board.h @@ -89,6 +89,7 @@ #define CONFIG_VOLUME_BUTTONS #define CONFIG_LID_SWITCH #define CONFIG_WP_ALWAYS +#define CONFIG_FLASH_READOUT_PROTECTION /* Verified boot */ #define CONFIG_SHA256_UNROLLED diff --git a/board/hoho/board.h b/board/hoho/board.h index 0698fe3f74..dd5fe2c767 100644 --- a/board/hoho/board.h +++ b/board/hoho/board.h @@ -62,6 +62,7 @@ /* No Write-protect GPIO, force the write-protection */ #define CONFIG_WP_ALWAYS +#define CONFIG_FLASH_READOUT_PROTECTION #ifndef __ASSEMBLER__ diff --git a/board/nucleo-f411re/board.h b/board/nucleo-f411re/board.h index 0a8dcc6ba8..7ffa0b0f07 100644 --- a/board/nucleo-f411re/board.h +++ b/board/nucleo-f411re/board.h @@ -53,6 +53,7 @@ #define TIM_WATCHDOG 11 #define CONFIG_WP_ALWAYS +#define CONFIG_FLASH_READOUT_PROTECTION /* ADC signal */ enum adc_channel { diff --git a/chip/stm32/flash-f.c b/chip/stm32/flash-f.c index 51fcf806ae..aaf8e69873 100644 --- a/chip/stm32/flash-f.c +++ b/chip/stm32/flash-f.c @@ -505,7 +505,7 @@ int flash_physical_protect_at_boot(uint32_t new_flags) if (original_val[i] != val[i]) write_optb(i * 2 + 8, val[i]); -#ifdef CONFIG_WP_ALWAYS +#ifdef CONFIG_FLASH_READOUT_PROTECTION /* * Set a permanent protection by increasing RDP to level 1, * trying to unprotected the flash will trigger a full erase. diff --git a/chip/stm32/flash-stm32l4.c b/chip/stm32/flash-stm32l4.c index 821d277b7a..97594733c0 100644 --- a/chip/stm32/flash-stm32l4.c +++ b/chip/stm32/flash-stm32l4.c @@ -167,7 +167,7 @@ int flash_physical_protect_at_boot(uint32_t new_flags) } unlock_optb(); -#ifdef CONFIG_WP_ALWAYS +#ifdef CONFIG_FLASH_READOUT_PROTECTION /* * Set a permanent protection by increasing RDP to level 1, * trying to unprotected the flash will trigger a full erase. diff --git a/include/config.h b/include/config.h index 21d58a0ec7..6a241e81fa 100644 --- a/include/config.h +++ b/include/config.h @@ -1440,6 +1440,11 @@ */ #undef CONFIG_FLASH_PSTATE_LOCKED +/* + * Enable readout protection. + */ +#undef CONFIG_FLASH_READOUT_PROTECTION + /* * For flash that is segemented in different regions. */ -- cgit v1.2.1