summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2015-05-11 10:16:41 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-05-12 20:54:37 +0000
commit39bd18b890bb708e79e9ba50dd3b5bf3d35e9ff1 (patch)
tree69b9331013e942bcbae05c10f863ad0ae9bc4f3b /common
parent3a36c29e6756231f2fb1fdd26447d519cbd5b26a (diff)
downloadchrome-ec-39bd18b890bb708e79e9ba50dd3b5bf3d35e9ff1.tar.gz
cleanup: Rename image geometry CONFIGs
Rename image geometry configs with a uniform naming scheme to make their purposes more clear. CONFIG_RO_MEM_OFF (was CONFIG_FW_RO_OFF) - RO image offset in program memory CONFIG_RO_STORAGE_OFF (was CONFIG_RO_SPI_OFF) - RO image offset on storage CONFIG_RO_SIZE (was CONFIG_FW_RO_SIZE) - Size of RO image CONFIG_RW_MEM_OFF (was CONFIG_FW_RW_OFF) - RW image offset in program memory CONFIG_RW_STORAGE_OFF (was CONFIG_RW_SPI_OFF) - RW image offset on storage CONFIG_RW_SIZE (was CONFIG_FW_RW_SIZE) - Size of RW image CONFIG_WP_OFF (was CONFIG_FW_WP_RO_OFF) - Offset of WP region on storage CONFIG_WP_SIZE (was CONFIG_FW_WP_RO_SIZE) - Size of WP region on storage BUG=chrome-os-partner:39741,chrome-os-partner:23796 TEST=Set date / version strings to constants then `make buildall -j`. Verify that each ec.bin image is identical pre- and post-change. BRANCH=None Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I6ea0a4e456dae71c266fa917a309b9f6fa4b50cd Reviewed-on: https://chromium-review.googlesource.com/270189 Reviewed-by: Anton Staaf <robotboy@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/firmware_image.lds.S8
-rw-r--r--common/flash.c14
-rw-r--r--common/fmap.c22
-rw-r--r--common/rwsig.c10
-rw-r--r--common/system.c24
-rw-r--r--common/usb_pd_policy.c12
-rw-r--r--common/vboot_hash.c14
7 files changed, 52 insertions, 52 deletions
diff --git a/common/firmware_image.lds.S b/common/firmware_image.lds.S
index e17e25546a..af6aa927b5 100644
--- a/common/firmware_image.lds.S
+++ b/common/firmware_image.lds.S
@@ -14,17 +14,17 @@ MEMORY
SECTIONS
{
. = ALIGN(CONFIG_FLASH_BANK_SIZE);
- .image.RO : AT(CONFIG_FLASH_BASE + CONFIG_FW_RO_OFF) {
+ .image.RO : AT(CONFIG_FLASH_BASE + CONFIG_RO_MEM_OFF) {
*(.image.RO)
} > FLASH =0xff
. = ALIGN(CONFIG_FLASH_BANK_SIZE);
-#if (CONFIG_FW_RO_OFF == CONFIG_FW_RW_OFF)
+#if (CONFIG_RO_MEM_OFF == CONFIG_RW_MEM_OFF)
/* This is applicable to ECs in which RO and RW execution is
mapped to the same location but we still have to generate an ec.bin with RO
and RW images at different Flash offset */
- .image.RW : AT(CONFIG_FLASH_BASE + CONFIG_FW_RO_OFF + CONFIG_FW_RO_SIZE) {
+ .image.RW : AT(CONFIG_FLASH_BASE + CONFIG_RO_MEM_OFF + CONFIG_RO_SIZE) {
#else
- .image.RW : AT(CONFIG_FLASH_BASE + CONFIG_FW_RW_OFF) {
+ .image.RW : AT(CONFIG_FLASH_BASE + CONFIG_RW_MEM_OFF) {
#endif
*(.image.RW)
} > FLASH =0xff
diff --git a/common/flash.c b/common/flash.c
index add0c1f12a..302dae0f08 100644
--- a/common/flash.c
+++ b/common/flash.c
@@ -203,7 +203,7 @@ static const uintptr_t get_pstate_addr(void)
/* Always use the pstate data in RO, even if we're RW */
if (system_get_image_copy() == SYSTEM_IMAGE_RW)
- addr += CONFIG_FW_RO_OFF - CONFIG_FW_RW_OFF;
+ addr += CONFIG_RO_MEM_OFF - CONFIG_RW_MEM_OFF;
return addr;
}
@@ -879,16 +879,16 @@ static int flash_command_region_info(struct host_cmd_handler_args *args)
switch (p->region) {
case EC_FLASH_REGION_RO:
- r->offset = CONFIG_FW_RO_OFF;
- r->size = CONFIG_FW_RO_SIZE;
+ r->offset = CONFIG_RO_MEM_OFF;
+ r->size = CONFIG_RO_SIZE;
break;
case EC_FLASH_REGION_RW:
- r->offset = CONFIG_FW_RW_OFF;
- r->size = CONFIG_FW_RW_SIZE;
+ r->offset = CONFIG_RW_MEM_OFF;
+ r->size = CONFIG_RW_SIZE;
break;
case EC_FLASH_REGION_WP_RO:
- r->offset = CONFIG_FW_WP_RO_OFF;
- r->size = CONFIG_FW_WP_RO_SIZE;
+ r->offset = CONFIG_WP_OFF;
+ r->size = CONFIG_WP_SIZE;
break;
default:
return EC_RES_INVALID_PARAM;
diff --git a/common/fmap.c b/common/fmap.c
index 946299bfb7..0785dc30d7 100644
--- a/common/fmap.c
+++ b/common/fmap.c
@@ -69,15 +69,15 @@ const struct _ec_fmap {
* volatile data (ex, calibration results).
*/
.area_name = "EC_RO",
- .area_offset = CONFIG_FW_RO_OFF,
- .area_size = CONFIG_FW_RO_SIZE,
+ .area_offset = CONFIG_RO_MEM_OFF,
+ .area_size = CONFIG_RO_SIZE,
.area_flags = FMAP_AREA_STATIC | FMAP_AREA_RO,
},
{
/* (Optional) RO firmware code. */
.area_name = "FR_MAIN",
- .area_offset = CONFIG_FW_RO_OFF,
- .area_size = CONFIG_FW_RO_SIZE,
+ .area_offset = CONFIG_RO_MEM_OFF,
+ .area_size = CONFIG_RO_SIZE,
.area_flags = FMAP_AREA_STATIC | FMAP_AREA_RO,
},
{
@@ -86,7 +86,7 @@ const struct _ec_fmap {
* ASCII, and padded with \0.
*/
.area_name = "RO_FRID",
- .area_offset = CONFIG_FW_RO_OFF +
+ .area_offset = CONFIG_RO_MEM_OFF +
RELATIVE((uint32_t)__version_struct_offset) +
offsetof(struct version_struct, version),
.area_size = sizeof(version_data.version),
@@ -96,7 +96,7 @@ const struct _ec_fmap {
/* Other RO stuff: FMAP, WP, KEYS, etc. */
{
.area_name = "FMAP",
- .area_offset = CONFIG_FW_RO_OFF +
+ .area_offset = CONFIG_RO_MEM_OFF +
RELATIVE((uint32_t)&ec_fmap),
.area_size = sizeof(ec_fmap),
.area_flags = FMAP_AREA_STATIC | FMAP_AREA_RO,
@@ -108,8 +108,8 @@ const struct _ec_fmap {
* EC_RO and aligned to hardware specification.
*/
.area_name = "WP_RO",
- .area_offset = CONFIG_FW_WP_RO_OFF,
- .area_size = CONFIG_FW_WP_RO_SIZE,
+ .area_offset = CONFIG_WP_OFF,
+ .area_size = CONFIG_WP_SIZE,
.area_flags = FMAP_AREA_STATIC | FMAP_AREA_RO,
},
@@ -117,8 +117,8 @@ const struct _ec_fmap {
{
/* The range of RW firmware to be auto-updated. */
.area_name = "EC_RW",
- .area_offset = CONFIG_FW_RW_OFF,
- .area_size = CONFIG_FW_RW_SIZE,
+ .area_offset = CONFIG_RW_MEM_OFF,
+ .area_size = CONFIG_RW_SIZE,
.area_flags = FMAP_AREA_STATIC | FMAP_AREA_RO,
},
{
@@ -127,7 +127,7 @@ const struct _ec_fmap {
* ASCII, and padded with \0.
*/
.area_name = "RW_FWID",
- .area_offset = CONFIG_FW_RW_OFF +
+ .area_offset = CONFIG_RW_MEM_OFF +
RELATIVE((uint32_t)__version_struct_offset) +
offsetof(struct version_struct, version),
.area_size = sizeof(version_data.version),
diff --git a/common/rwsig.c b/common/rwsig.c
index 6b90c6cd87..e3224c1df8 100644
--- a/common/rwsig.c
+++ b/common/rwsig.c
@@ -25,12 +25,12 @@ const struct rsa_public_key pkey __attribute__((section(".rsa_pubkey"))) =
#include "gen_pub_key.h"
/* The RSA signature is stored at the end of the RW firmware */
-static const void *rw_sig = (void *)CONFIG_FLASH_BASE + CONFIG_FW_RW_OFF
- + CONFIG_FW_RW_SIZE - RSANUMBYTES;
+static const void *rw_sig = (void *)CONFIG_FLASH_BASE + CONFIG_RW_MEM_OFF
+ + CONFIG_RW_SIZE - RSANUMBYTES;
/* RW firmware reset vector */
static uint32_t * const rw_rst =
- (uint32_t *)(CONFIG_FLASH_BASE+CONFIG_FW_RW_OFF+4);
+ (uint32_t *)(CONFIG_FLASH_BASE+CONFIG_RW_MEM_OFF+4);
void check_rw_signature(void)
{
@@ -58,8 +58,8 @@ void check_rw_signature(void)
/* SHA-256 Hash of the RW firmware */
SHA256_init(&ctx);
- SHA256_update(&ctx, (void *)CONFIG_FLASH_BASE + CONFIG_FW_RW_OFF,
- CONFIG_FW_RW_SIZE - RSANUMBYTES);
+ SHA256_update(&ctx, (void *)CONFIG_FLASH_BASE + CONFIG_RW_MEM_OFF,
+ CONFIG_RW_SIZE - RSANUMBYTES);
hash = SHA256_final(&ctx);
good = rsa_verify(&pkey, (void *)rw_sig, (void *)hash, rsa_workbuf);
diff --git a/common/system.c b/common/system.c
index 4bd70400d0..abb62e331b 100644
--- a/common/system.c
+++ b/common/system.c
@@ -98,9 +98,9 @@ static uintptr_t get_base(enum system_image_copy_t copy)
{
switch (copy) {
case SYSTEM_IMAGE_RO:
- return CONFIG_FLASH_BASE + CONFIG_FW_RO_OFF;
+ return CONFIG_FLASH_BASE + CONFIG_RO_MEM_OFF;
case SYSTEM_IMAGE_RW:
- return CONFIG_FLASH_BASE + CONFIG_FW_RW_OFF;
+ return CONFIG_FLASH_BASE + CONFIG_RW_MEM_OFF;
default:
return 0xffffffff;
}
@@ -113,9 +113,9 @@ static uint32_t get_size(enum system_image_copy_t copy)
{
switch (copy) {
case SYSTEM_IMAGE_RO:
- return CONFIG_FW_RO_SIZE;
+ return CONFIG_RO_SIZE;
case SYSTEM_IMAGE_RW:
- return CONFIG_FW_RW_SIZE;
+ return CONFIG_RW_SIZE;
default:
return 0;
}
@@ -317,12 +317,12 @@ test_mockable enum system_image_copy_t system_get_image_copy(void)
uintptr_t my_addr = (uintptr_t)system_get_image_copy -
CONFIG_FLASH_BASE;
- if (my_addr >= CONFIG_FW_RO_OFF &&
- my_addr < (CONFIG_FW_RO_OFF + CONFIG_FW_RO_SIZE))
+ if (my_addr >= CONFIG_RO_MEM_OFF &&
+ my_addr < (CONFIG_RO_MEM_OFF + CONFIG_RO_SIZE))
return SYSTEM_IMAGE_RO;
- if (my_addr >= CONFIG_FW_RW_OFF &&
- my_addr < (CONFIG_FW_RW_OFF + CONFIG_FW_RW_SIZE))
+ if (my_addr >= CONFIG_RW_MEM_OFF &&
+ my_addr < (CONFIG_RW_MEM_OFF + CONFIG_RW_SIZE))
return SYSTEM_IMAGE_RW;
return SYSTEM_IMAGE_UNKNOWN;
@@ -357,12 +357,12 @@ test_mockable int system_unsafe_to_overwrite(uint32_t offset, uint32_t size)
switch (system_get_image_copy()) {
case SYSTEM_IMAGE_RO:
- r_offset = CONFIG_FW_RO_OFF;
- r_size = CONFIG_FW_RO_SIZE;
+ r_offset = CONFIG_RO_MEM_OFF;
+ r_size = CONFIG_RO_SIZE;
break;
case SYSTEM_IMAGE_RW:
- r_offset = CONFIG_FW_RW_OFF;
- r_size = CONFIG_FW_RW_SIZE;
+ r_offset = CONFIG_RW_MEM_OFF;
+ r_size = CONFIG_RW_SIZE;
break;
default:
return 0;
diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c
index 21d4f1b0e1..0ed69cb8a7 100644
--- a/common/usb_pd_policy.c
+++ b/common/usb_pd_policy.c
@@ -819,7 +819,7 @@ DECLARE_HOST_COMMAND(EC_CMD_USB_PD_GET_AMODE,
#endif
-#define FW_RW_END (CONFIG_FW_RW_OFF + CONFIG_FW_RW_SIZE)
+#define FW_RW_END (CONFIG_RW_MEM_OFF + CONFIG_RW_SIZE)
uint8_t *flash_hash_rw(void)
{
@@ -830,8 +830,8 @@ uint8_t *flash_hash_rw(void)
rw_flash_changed = 0;
SHA256_init(&ctx);
SHA256_update(&ctx, (void *)CONFIG_FLASH_BASE +
- CONFIG_FW_RW_OFF,
- CONFIG_FW_RW_SIZE - RSANUMBYTES);
+ CONFIG_RW_MEM_OFF,
+ CONFIG_RW_SIZE - RSANUMBYTES);
return SHA256_final(&ctx);
} else {
return ctx.buf;
@@ -881,14 +881,14 @@ 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_FW_RW_OFF;
- flash_physical_erase(CONFIG_FW_RW_OFF, CONFIG_FW_RW_SIZE);
+ flash_offset = CONFIG_RW_MEM_OFF;
+ flash_physical_erase(CONFIG_RW_MEM_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_FW_RW_OFF))
+ (flash_offset < CONFIG_RW_MEM_OFF))
break;
flash_physical_write(flash_offset, 4*(cnt - 1),
(const char *)(payload+1));
diff --git a/common/vboot_hash.c b/common/vboot_hash.c
index f2fa839c67..b19931b1ab 100644
--- a/common/vboot_hash.c
+++ b/common/vboot_hash.c
@@ -217,7 +217,7 @@ static void vboot_hash_init(void)
#endif
{
/* Start computing the hash of RW firmware */
- vboot_hash_start(CONFIG_FW_RW_OFF,
+ vboot_hash_start(CONFIG_RW_MEM_OFF,
system_get_image_used(SYSTEM_IMAGE_RW),
NULL, 0);
}
@@ -251,8 +251,8 @@ DECLARE_HOOK(HOOK_SYSJUMP, vboot_hash_preserve_state, HOOK_PRIO_DEFAULT);
#ifdef CONFIG_CMD_HASH
static int command_hash(int argc, char **argv)
{
- uint32_t offset = CONFIG_FW_RW_OFF;
- uint32_t size = CONFIG_FW_RW_SIZE;
+ uint32_t offset = CONFIG_RW_MEM_OFF;
+ uint32_t size = CONFIG_RW_SIZE;
char *e;
if (argc == 1) {
@@ -277,12 +277,12 @@ static int command_hash(int argc, char **argv)
return EC_SUCCESS;
} else if (!strcasecmp(argv[1], "rw")) {
return vboot_hash_start(
- CONFIG_FW_RW_OFF,
+ CONFIG_RW_MEM_OFF,
system_get_image_used(SYSTEM_IMAGE_RW),
NULL, 0);
} else if (!strcasecmp(argv[1], "ro")) {
return vboot_hash_start(
- CONFIG_FW_RO_OFF,
+ CONFIG_RO_MEM_OFF,
system_get_image_used(SYSTEM_IMAGE_RO),
NULL, 0);
}
@@ -354,10 +354,10 @@ static int host_start_hash(const struct ec_params_vboot_hash *p)
/* Handle special offset values */
if (offset == EC_VBOOT_HASH_OFFSET_RO) {
- offset = CONFIG_FW_RO_OFF;
+ offset = CONFIG_RO_MEM_OFF;
size = system_get_image_used(SYSTEM_IMAGE_RO);
} else if (p->offset == EC_VBOOT_HASH_OFFSET_RW) {
- offset = CONFIG_FW_RW_OFF;
+ offset = CONFIG_RW_MEM_OFF;
size = system_get_image_used(SYSTEM_IMAGE_RW);
}