diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2015-09-07 13:47:48 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2015-09-16 14:49:32 -0700 |
commit | 1167cad6a88e45bbf6a5599f19d018cd6a8b5233 (patch) | |
tree | eaff44a061fa989b49a5c52fc58ef14f3ccb48c3 /common/usb_pd_policy.c | |
parent | 558c465165acf494905fa59c822c7190b4646899 (diff) | |
download | chrome-ec-1167cad6a88e45bbf6a5599f19d018cd6a8b5233.tar.gz |
cleanup: Change meaning of storage offset CONFIGs
In order to support architectures with non-contiguous writable and
protected regions, change storage offsets to be relative to writable and
protected regions, rather than relative to "the start of the region of
storage belonging to the EC".
Spec doc available at https://goo.gl/fnzTvr.
BRANCH=None
BUG=chrome-os-partner:23796
TEST=With entire patch series, on both Samus and Glados:
- Verify 'version' EC console command is correct
- Verify 'flashrom -p ec -r read.bin' reads back EC image
- Verify software sync correctly flashes both EC and PD RW images
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I796f8e7305a6336495bd256a78774595cb16a2e4
Reviewed-on: https://chromium-review.googlesource.com/297823
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common/usb_pd_policy.c')
-rw-r--r-- | common/usb_pd_policy.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c index e628e6e556..0cd4160614 100644 --- a/common/usb_pd_policy.c +++ b/common/usb_pd_policy.c @@ -816,7 +816,8 @@ DECLARE_HOST_COMMAND(EC_CMD_USB_PD_GET_AMODE, #endif -#define FW_RW_END (CONFIG_RW_STORAGE_OFF + CONFIG_RW_SIZE) +#define FW_RW_END (CONFIG_EC_WRITABLE_STORAGE_OFF + \ + CONFIG_RW_STORAGE_OFF + CONFIG_RW_SIZE) uint8_t *flash_hash_rw(void) { @@ -878,14 +879,17 @@ int pd_custom_flash_vdm(int port, int cnt, uint32_t *payload) if (system_get_image_copy() != SYSTEM_IMAGE_RO) break; pd_log_event(PD_EVENT_ACC_RW_ERASE, 0, 0, NULL); - flash_offset = CONFIG_RW_STORAGE_OFF; - flash_physical_erase(CONFIG_RW_STORAGE_OFF, CONFIG_RW_SIZE); + flash_offset = CONFIG_EC_WRITABLE_STORAGE_OFF + + CONFIG_RW_STORAGE_OFF; + flash_physical_erase(CONFIG_EC_WRITABLE_STORAGE_OFF + + CONFIG_RW_STORAGE_OFF, CONFIG_RW_SIZE); rw_flash_changed = 1; break; case VDO_CMD_FLASH_WRITE: /* do not kill the code under our feet */ if ((system_get_image_copy() != SYSTEM_IMAGE_RO) || - (flash_offset < CONFIG_RW_STORAGE_OFF)) + (flash_offset < CONFIG_EC_WRITABLE_STORAGE_OFF + + CONFIG_RW_STORAGE_OFF)) break; flash_physical_write(flash_offset, 4*(cnt - 1), (const char *)(payload+1)); |