diff options
author | Louis Yung-Chieh Lo <yjlou@chromium.org> | 2012-07-11 17:12:34 +0800 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-07-25 21:52:04 -0700 |
commit | d0d50b6da7b826c0aa13391d6794b66e1c0f1303 (patch) | |
tree | 0ba4a24cebd129ca231ea2de541806cecf059590 /common/fmap.c | |
parent | 3cc4745be2503a4da28ca92e63b9cf5397f5a820 (diff) | |
download | chrome-ec-d0d50b6da7b826c0aa13391d6794b66e1c0f1303.tar.gz |
Change some FMAP area_offset to be related to the start of flash.
The area_offset of following area are wrong which is related to the CPU
view in the STM32 chip:
FMAP
RO_FRID
RW_FWID
Add a macro RELATIVE() to calculate the real offset in flash.
BUG=chrome-os-partner:11269
TEST=build in chroot for link and snow.
Those fmap afddress are related to the start of flash.
Change-Id: I691814e2f53b1de0ecf9fd385bed8d5c598373a7
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28388
Commit-Ready: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
Reviewed-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
Tested-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
Diffstat (limited to 'common/fmap.c')
-rw-r--r-- | common/fmap.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/common/fmap.c b/common/fmap.c index e01591b6fc..3adb1c1c6f 100644 --- a/common/fmap.c +++ b/common/fmap.c @@ -18,6 +18,12 @@ #define FMAP_VER_MAJOR 1 #define FMAP_VER_MINOR 0 +/* + * For address containing CONFIG_FLASH_BASE (symbols in *.lds.S and variable), + * this computes the offset to the start of flash. + */ +#define RELATIVE(addr) ((addr) - CONFIG_FLASH_BASE) + typedef struct _FmapHeader { char fmap_signature[FMAP_SIGNATURE_SIZE]; uint8_t fmap_ver_major; @@ -83,7 +89,7 @@ const struct _ec_fmap { * ASCIIZ, and padded with \0. */ .area_name = "RO_FRID", .area_offset = CONFIG_FW_RO_OFF + - (uint32_t)__version_struct_offset + + RELATIVE((uint32_t)__version_struct_offset) + offsetof(struct version_struct, version), .area_size = sizeof(version_data.version), .area_flags = FMAP_AREA_STATIC | FMAP_AREA_RO, @@ -92,7 +98,8 @@ const struct _ec_fmap { /* Other RO stuff: FMAP, WP, KEYS, etc. */ { .area_name = "FMAP", - .area_offset = (uint32_t)&ec_fmap, + .area_offset = CONFIG_FW_RO_OFF + + RELATIVE((uint32_t)&ec_fmap), .area_size = sizeof(ec_fmap), .area_flags = FMAP_AREA_STATIC | FMAP_AREA_RO, }, @@ -127,7 +134,7 @@ const struct _ec_fmap { * ASCIIZ, and padded with \0. */ .area_name = "RW_FWID", .area_offset = CONFIG_FW_RW_OFF + - (uint32_t)__version_struct_offset + + RELATIVE((uint32_t)__version_struct_offset) + offsetof(struct version_struct, version), .area_size = sizeof(version_data.version), .area_flags = FMAP_AREA_STATIC, |