summaryrefslogtreecommitdiff
path: root/chip
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2019-06-12 10:54:31 -0700
committerCommit Bot <commit-bot@chromium.org>2019-06-13 21:29:04 +0000
commit77161023d45559feb338d9d556a86c35c79d07f4 (patch)
tree4887ed9d34b819c00ec32cb802bfbb299567a2bf /chip
parente2c51fd77fb12427ad84c44ee03a7f9465aec4f7 (diff)
downloadchrome-ec-77161023d45559feb338d9d556a86c35c79d07f4.tar.gz
g: use GLOBALSEC_REGION5 for flash log access control
Flash log space access needs to be explicitly enabled. The previously chosen for this purpose global security region 7 is also used by the TPM endorsement procedure, and this may cause race condition resulting in flash log space not accessible. Let's use previously unused region 5 instead. This is how the regions are configured after this patch on a system where RO_A and RW_B are active (bit 0 enables region in general, bit 1 enables reads, bit 2 enables writes): Reg Base Size Enable bits 0 00040000 000027ff 3 # RO_A 1 00084000 00037fff 3 # RW_B 2 00044000 000387ff 7 # RW_A 3 0007c800 000037ff 7 # NVMEM 4 000bc800 000037ff 7 # NVMEM 5 00083800 000007ff 3 # Flash log 6 00028400 0000000f 3 # Info 1 board ID 7 00028000 000007ff 3 # Info 1 endorsement seed BRANCH=cr50. cr50-mp BUG=b:132287488 TEST=verified that there is no flash log lockups when the device boots with an unendorsed TPM. Change-Id: I4fc65989b3930d91ed8e076310ecb58bac5f085e Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1656158 Reviewed-by: Andrey Pronin <apronin@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r--chip/g/flash.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/chip/g/flash.c b/chip/g/flash.c
index b0d678f33b..07573f7fd9 100644
--- a/chip/g/flash.c
+++ b/chip/g/flash.c
@@ -58,7 +58,7 @@ static struct mutex flash_mtx;
#ifdef CONFIG_FLASH_LOG
static void flash_log_space_control(int enable)
{
- GWRITE_FIELD(GLOBALSEC, FLASH_REGION7_CTRL, WR_EN, !!enable);
+ GWRITE_FIELD(GLOBALSEC, FLASH_REGION5_CTRL, WR_EN, !!enable);
}
#endif
@@ -97,10 +97,10 @@ int flash_pre_init(void)
* Allow access to flash elog space and register the access control
* function.
*/
- GREG32(GLOBALSEC, FLASH_REGION7_BASE_ADDR) = CONFIG_FLASH_LOG_BASE;
- GREG32(GLOBALSEC, FLASH_REGION7_SIZE) = CONFIG_FLASH_LOG_SPACE - 1;
- GWRITE_FIELD(GLOBALSEC, FLASH_REGION7_CTRL, EN, 1);
- GWRITE_FIELD(GLOBALSEC, FLASH_REGION7_CTRL, RD_EN, 1);
+ GREG32(GLOBALSEC, FLASH_REGION5_BASE_ADDR) = CONFIG_FLASH_LOG_BASE;
+ GREG32(GLOBALSEC, FLASH_REGION5_SIZE) = CONFIG_FLASH_LOG_SPACE - 1;
+ GWRITE_FIELD(GLOBALSEC, FLASH_REGION5_CTRL, EN, 1);
+ GWRITE_FIELD(GLOBALSEC, FLASH_REGION5_CTRL, RD_EN, 1);
flash_log_register_flash_control_callback(flash_log_space_control);
#endif
return EC_SUCCESS;