diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2018-04-04 17:39:36 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2018-04-05 23:45:40 +0000 |
commit | 9e8239eeebb7ed54466e9a8f17cedcd6d0823350 (patch) | |
tree | dc2f7ca64d298d5ac7a230510084b18e04cb9935 | |
parent | c0d85275a57514d58731077f996d0ed45f29ea3c (diff) | |
download | chrome-ec-9e8239eeebb7ed54466e9a8f17cedcd6d0823350.tar.gz |
flash: Allow currently active regions to be modified
This patch allows chips which run code in RAM to erase or write
regions even if they're active.
BUG=b:77306460
BRANCH=none
TEST=flashrom -p ec -w /tmp/ec.bin on Fizz
Change-Id: Ib536b250dde78283513acb942507c67da0a6f622
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/997022
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
(cherry picked from commit 75e0015cc16d287724ef353c5d7f50c1287db2cb)
Reviewed-on: https://chromium-review.googlesource.com/998974
-rw-r--r-- | common/flash.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/common/flash.c b/common/flash.c index d463aee244..6746f178ef 100644 --- a/common/flash.c +++ b/common/flash.c @@ -1165,8 +1165,10 @@ static int flash_command_write(struct host_cmd_handler_args *args) if (p->size + sizeof(*p) > args->params_size) return EC_RES_INVALID_PARAM; +#ifdef CONFIG_INTERNAL_STORAGE if (system_unsafe_to_overwrite(offset, p->size)) return EC_RES_ACCESS_DENIED; +#endif if (flash_write(offset, p->size, (const uint8_t *)(p + 1))) return EC_RES_ERROR; @@ -1204,8 +1206,10 @@ static int flash_command_erase(struct host_cmd_handler_args *args) if (flash_get_protect() & EC_FLASH_PROTECT_ALL_NOW) return EC_RES_ACCESS_DENIED; +#ifdef CONFIG_INTERNAL_STORAGE if (system_unsafe_to_overwrite(offset, p->size)) return EC_RES_ACCESS_DENIED; +#endif switch (cmd) { case FLASH_ERASE_SECTOR: |