diff options
author | Mary Ruthven <mruthven@chromium.org> | 2019-04-11 15:50:43 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-04-15 17:51:48 -0700 |
commit | 15196acec9b793a4d4500f0ac659cf6e74e4ebe2 (patch) | |
tree | f92beb1f388139660dcf1687e6681ca34c57441e | |
parent | b166142439f81abaf08a8a62a1d3c04e5f7ab78e (diff) | |
download | chrome-ec-15196acec9b793a4d4500f0ac659cf6e74e4ebe2.tar.gz |
cr50: sqa: don't modify flags if board id is erased
Cr50 can only set a board id if the board id is blank.
0xffffffff:0xffffffff:0xffffffff is a blank board id. As SQA images are
now if you run eraseflashinfo while the board id isn't set,
eraseflashinfo will set the flags to 0 without changing the RLZ
information. The BID will be 0xffffffff:0xffffffff:0. This board id
isn't considered blank, so you won't be able to set the RLZ in the
future. Also the second field is not the inverse of the first, so it
will be considered invalid. This is a very bad state to get the board id
into because you can't change it, but it's also invalid.
This change checks that the board id is set before modifying the flags.
Cr50 wont modify the flags of an erased board id. It will only change
the flags if the board id is set.
BUG=none
BRANCH=none
TEST=erase the board id. make sure flags aren't set to 0 after running
eraseflashinfo. Set the board id. Make sure flags are set to 0 after
running eraseflashinfo.
Change-Id: Idc184e58c0dc398bc93c1119d822a13889c59963
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1565452
Reviewed-by: Namyoon Woo <namyoon@chromium.org>
-rw-r--r-- | chip/g/flash.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/chip/g/flash.c b/chip/g/flash.c index 2f567d89b4..8a9622e64c 100644 --- a/chip/g/flash.c +++ b/chip/g/flash.c @@ -551,7 +551,12 @@ static int command_erase_flash_info(int argc, char **argv) } } #endif - info1->board_space.bid.flags = flags; + if (board_id_is_blank(&info1->board_space.bid)) { + ccprintf("BID is erased. Not modifying flags\n"); + } else { + ccprintf("setting BID flags to %x\n", flags); + info1->board_space.bid.flags = flags; + } if (check_board_id_vs_header(&info1->board_space.bid, get_current_image_header())) { ccprintf("Flags %x would lock out current image\n", |