diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2018-04-18 09:39:47 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-05-04 03:02:49 -0700 |
commit | 84a843bf63ad287bdf63285ccdf3c955b65f7a33 (patch) | |
tree | eda1f348a363fbd90a20cbc8fd97c6af90c347f0 /common/cbi.c | |
parent | 74d08a581d9f08cfa5b5c02ad56267384fb42c9b (diff) | |
download | chrome-ec-84a843bf63ad287bdf63285ccdf3c955b65f7a33.tar.gz |
CBI: Disallow board version and OEM ID to be reprogrammed
This patch makes CBI refuse to change board version and OEM ID.
When CONFIG_SYSTEM_UNLOCKED is defined, this restriction is removed.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
BUG=b:74946347
BRANCH=none
TEST=buildall
Change-Id: I6ceda5764af56ed18a575f5563eaf294bb2876d0
Reviewed-on: https://chromium-review.googlesource.com/1017225
Commit-Ready: Jett Rink <jettrink@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common/cbi.c')
-rw-r--r-- | common/cbi.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/common/cbi.c b/common/cbi.c index 584a6e8415..0b6704a6a3 100644 --- a/common/cbi.c +++ b/common/cbi.c @@ -264,6 +264,13 @@ static int hc_cbi_set(struct host_cmd_handler_args *args) const struct __ec_align4 ec_params_set_cbi *p = args->params; int rv; +#ifndef CONFIG_SYSTEM_UNLOCKED + /* These fields are not allowed to be reprogrammed regardless the + * hardware WP state. They're considered as a part of the hardware. */ + if (p->tag == CBI_TAG_BOARD_VERSION || p->tag == CBI_TAG_OEM_ID) + return EC_RES_ACCESS_DENIED; +#endif + if (p->flag & CBI_SET_INIT) { memset(cbi, 0, sizeof(cbi)); memcpy(head->magic, cbi_magic, sizeof(cbi_magic)); |