diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2015-05-11 14:23:31 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-05-15 06:42:30 +0000 |
commit | e3dce49334a2b44e337744bc719a27c63261f35e (patch) | |
tree | 3ee485350fafffaf53206036a3a19184068feeb5 /common/flash.c | |
parent | cba37a13d2342e4c81b0be3c84010baf3d846162 (diff) | |
download | chrome-ec-e3dce49334a2b44e337744bc719a27c63261f35e.tar.gz |
cleanup: Use appropriate image geometry CONFIGs
- Use CONFIG_*_MEM when dealing with images in program memory.
- Use CONFIG_*_STORAGE when dealing with images on storage.
- Use CONFIG_WP when dealing with the entire WP RO region.
BUG=chrome-os-partner:39741,chrome-os-partner:23796
TEST=Manual on Cyan with subsequent commit. Verify that FMAP matches
actual layout of image. Verify flashrom succeeds flashing + verifying EC
image using host command interface.
BRANCH=None
Change-Id: Iadc02daa89fe3bf07b083ed0f7be2e60702a1867
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/270269
Diffstat (limited to 'common/flash.c')
-rw-r--r-- | common/flash.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/common/flash.c b/common/flash.c index 302dae0f08..6d903eca95 100644 --- a/common/flash.c +++ b/common/flash.c @@ -400,17 +400,11 @@ uint32_t flash_get_protect(void) /* Scan flash protection */ for (i = 0; i < PHYSICAL_BANKS; i++) { /* Is this bank part of RO */ - int is_ro = (i >= RO_BANK_OFFSET && - i < RO_BANK_OFFSET + RO_BANK_COUNT) ? 1 : 0; - int bank_flag; - -#if defined(CONFIG_FLASH_PSTATE) && defined(CONFIG_FLASH_PSTATE_BANK) - /* PSTATE acts like part of RO; protected at same time */ - if (i >= PSTATE_BANK && i < PSTATE_BANK + PSTATE_BANK_COUNT) - is_ro = 1; -#endif - bank_flag = (is_ro ? EC_FLASH_PROTECT_RO_NOW : - EC_FLASH_PROTECT_ALL_NOW); + int is_ro = (i >= WP_BANK_OFFSET && + i < WP_BANK_OFFSET + WP_BANK_COUNT) ? 1 : 0; + + int bank_flag = (is_ro ? EC_FLASH_PROTECT_RO_NOW : + EC_FLASH_PROTECT_ALL_NOW); if (flash_physical_get_protect(i)) { /* At least one bank in the region is protected */ @@ -879,11 +873,11 @@ static int flash_command_region_info(struct host_cmd_handler_args *args) switch (p->region) { case EC_FLASH_REGION_RO: - r->offset = CONFIG_RO_MEM_OFF; + r->offset = CONFIG_RO_STORAGE_OFF; r->size = CONFIG_RO_SIZE; break; case EC_FLASH_REGION_RW: - r->offset = CONFIG_RW_MEM_OFF; + r->offset = CONFIG_RW_STORAGE_OFF; r->size = CONFIG_RW_SIZE; break; case EC_FLASH_REGION_WP_RO: |