mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-12 10:55:21 +00:00
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>
This commit is contained in:
committed by
chrome-bot
parent
96931840bc
commit
75e0015cc1
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user