summaryrefslogtreecommitdiff
path: root/chip/g/board_id.c
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2019-07-31 11:06:13 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-08-10 16:55:19 -0700
commitfb0eb4d1b932ba469f7385e42cf43f5a11f09c85 (patch)
tree73a4fb7328b0871cfd7cc81f732cd34e5c9009e3 /chip/g/board_id.c
parent023fb69d7ff6cb35bbe05708205f357133d9365b (diff)
downloadchrome-ec-fb0eb4d1b932ba469f7385e42cf43f5a11f09c85.tar.gz
cr50: use dedicated region for info1 accesses
The INFO1 flash space is used for various purposes (endorsement key seed, Board ID and flags, serial number, etc.). Accessing these spaces in INFO1 is accompanied by managing the flash region registers, each time opening a window of the appropriate size, with appropriate permissions, etc, In fact none of these spaces contain a secret, to simplify things and preventing situations when concurrent accesses change the flash range window settings lets dedicate previously unused Region 7 register file to providing always open read access to INFO1. Write access will be enabled/disabled as required. In prod images write accesses will always happen from the vendor command context. In DBG images CLI commands will also have write access to INFO1. INFO1 window is accessed by other H1 based devices as well, this is why it is necessary to enable the window in the common chip code. BRANCH=cr50, cr50-mp BUG=b:138256149 TEST=the firmware_Cr50SetBoardId test now passes on Mistral. Cq-Depend: chrome-internal:1577866, chrome-internal:1581327 Change-Id: Id27348f3b04191f1b3b60fd838d06009f756baa2 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1730147 Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Diffstat (limited to 'chip/g/board_id.c')
-rw-r--r--chip/g/board_id.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/chip/g/board_id.c b/chip/g/board_id.c
index 1f46bd8226..c863a81fba 100644
--- a/chip/g/board_id.c
+++ b/chip/g/board_id.c
@@ -74,14 +74,6 @@ int read_board_id(struct board_id *id)
id_p = (uint32_t *)id;
- /* Make sure INFO1 board ID space is readable */
- if (flash_info_read_enable(INFO_BOARD_ID_OFFSET,
- INFO_BOARD_ID_PROTECT_SIZE) !=
- EC_SUCCESS) {
- CPRINTS("%s: failed to enable read access to info", __func__);
- return EC_ERROR_ACCESS_DENIED;
- }
-
for (i = 0; i < sizeof(*id); i += sizeof(uint32_t)) {
int rv;
@@ -156,13 +148,7 @@ static int write_board_id(const struct board_id *id, int clear_flags)
return EC_ERROR_ACCESS_DENIED;
}
- /* Enable write access */
- if (flash_info_write_enable(INFO_BOARD_ID_OFFSET,
- INFO_BOARD_ID_PROTECT_SIZE) !=
- EC_SUCCESS) {
- CPRINTS("%s: failed to enable write access", __func__);
- return EC_ERROR_ACCESS_DENIED;
- }
+ flash_info_write_enable();
/* Write Board ID */
rv = flash_info_physical_write(INFO_BOARD_ID_OFFSET +
@@ -171,7 +157,6 @@ static int write_board_id(const struct board_id *id, int clear_flags)
if (rv != EC_SUCCESS)
CPRINTS("%s: write failed", __func__);
- /* Disable write access */
flash_info_write_disable();
return rv;