summaryrefslogtreecommitdiff
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
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>
-rw-r--r--Makefile4
-rw-r--r--board/zinger/board.c6
-rw-r--r--chip/g/config_std_flash.h14
-rw-r--r--chip/host/config_chip.h14
-rw-r--r--chip/host/system.c4
-rw-r--r--chip/it83xx/config_chip.h14
-rw-r--r--chip/lm4/config_chip.h14
-rw-r--r--chip/mec1322/config_chip.h20
-rw-r--r--chip/mec1322/flash.c14
-rw-r--r--chip/mec1322/lfw/ec_lfw.c10
-rw-r--r--chip/mec1322/system.c2
-rw-r--r--chip/npcx/config_chip.h12
-rw-r--r--chip/npcx/lfw/ec_lfw.c8
-rw-r--r--chip/npcx/system.c2
-rw-r--r--chip/nrf51/config_chip.h12
-rw-r--r--chip/stm32/config-stm32f03x.h14
-rw-r--r--chip/stm32/config-stm32f07x.h14
-rw-r--r--chip/stm32/config-stm32f100.h14
-rw-r--r--chip/stm32/config-stm32f10x.h14
-rw-r--r--chip/stm32/config-stm32f373.h14
-rw-r--r--chip/stm32/config-stm32l100.h14
-rw-r--r--chip/stm32/config-stm32l15x.h16
-rw-r--r--chip/stm32/config-stm32ts60.h14
-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
-rw-r--r--core/cortex-m/ec.lds.S4
-rw-r--r--core/cortex-m/mpu.c6
-rw-r--r--core/cortex-m0/ec.lds.S4
-rw-r--r--include/config.h27
-rw-r--r--include/flash.h8
-rw-r--r--test/flash.c44
36 files changed, 238 insertions, 223 deletions
diff --git a/Makefile b/Makefile
index ca1e239944..1cfe28a964 100644
--- a/Makefile
+++ b/Makefile
@@ -93,10 +93,10 @@ ifneq "$(CONFIG_COMMON_RUNTIME)" "y"
endif
# Compute RW firmware size and offset
-_rw_off_str:=$(shell echo "CONFIG_FW_RW_OFF" | $(CPP) $(CPPFLAGS) -P \
+_rw_off_str:=$(shell echo "CONFIG_RW_MEM_OFF" | $(CPP) $(CPPFLAGS) -P \
-Ichip/$(CHIP) -Iboard/$(BOARD) -imacros include/config.h)
_rw_off:=$(shell echo "$$(($(_rw_off_str)))")
-_rw_size_str:=$(shell echo "CONFIG_FW_RW_SIZE" | $(CPP) $(CPPFLAGS) -P \
+_rw_size_str:=$(shell echo "CONFIG_RW_SIZE" | $(CPP) $(CPPFLAGS) -P \
-Ichip/$(CHIP) -Iboard/$(BOARD) -imacros include/config.h)
_rw_size:=$(shell echo "$$(($(_rw_size_str)))")
_flash_base_str:=$(shell echo "CONFIG_FLASH_BASE" | $(CPP) $(CPPFLAGS) -P \
diff --git a/board/zinger/board.c b/board/zinger/board.c
index 7130f68572..5f1201ea76 100644
--- a/board/zinger/board.c
+++ b/board/zinger/board.c
@@ -20,8 +20,8 @@
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;
/* Large 768-Byte buffer for RSA computation : could be re-use afterwards... */
static uint32_t rsa_workbuf[3 * RSANUMWORDS];
@@ -29,7 +29,7 @@ extern void pd_rx_handler(void);
/* 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);
/* External interrupt EXTINT7 for external comparator on PA7 */
void pd_rx_interrupt(void)
diff --git a/chip/g/config_std_flash.h b/chip/g/config_std_flash.h
index cee332fad2..86df29c4e4 100644
--- a/chip/g/config_std_flash.h
+++ b/chip/g/config_std_flash.h
@@ -7,7 +7,7 @@
#define __CROS_EC_CONFIG_STD_FLASH_H
/* RO firmware must start at beginning of flash */
-#define CONFIG_FW_RO_OFF 0
+#define CONFIG_RO_MEM_OFF 0
/*
* The EC uses the one bank of flash to emulate a SPI-like write protect
@@ -16,17 +16,17 @@
#define CONFIG_FW_PSTATE_SIZE CONFIG_FLASH_BANK_SIZE
/* PSTATE immediately follows RO, in the first half of flash */
-#define CONFIG_FW_RO_SIZE (CONFIG_FW_IMAGE_SIZE \
+#define CONFIG_RO_SIZE (CONFIG_FW_IMAGE_SIZE \
- CONFIG_FW_PSTATE_SIZE)
-#define CONFIG_FW_PSTATE_OFF CONFIG_FW_RO_SIZE
+#define CONFIG_FW_PSTATE_OFF CONFIG_RO_SIZE
#define CONFIG_FLASH_SIZE CONFIG_FLASH_PHYSICAL_SIZE
/* RW firmware is one firmware image offset from the start */
-#define CONFIG_FW_RW_OFF CONFIG_FW_IMAGE_SIZE
-#define CONFIG_FW_RW_SIZE CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RW_MEM_OFF CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RW_SIZE CONFIG_FW_IMAGE_SIZE
/* TODO(crosbug.com/p/23796): why 2 sets of configs with the same numbers? */
-#define CONFIG_FW_WP_RO_OFF CONFIG_FW_RO_OFF
-#define CONFIG_FW_WP_RO_SIZE CONFIG_FW_RO_SIZE
+#define CONFIG_WP_OFF CONFIG_RO_MEM_OFF
+#define CONFIG_WP_SIZE CONFIG_RO_SIZE
#endif /* __CROS_EC_CONFIG_STD_FLASH_H */
diff --git a/chip/host/config_chip.h b/chip/host/config_chip.h
index a83fa778cf..df84143883 100644
--- a/chip/host/config_chip.h
+++ b/chip/host/config_chip.h
@@ -26,18 +26,18 @@ extern char __host_flash[CONFIG_FLASH_PHYSICAL_SIZE];
/* Size of one firmware image in flash */
#define CONFIG_FW_IMAGE_SIZE (64 * 1024)
-#define CONFIG_FW_RO_OFF 0
-#define CONFIG_FW_RO_SIZE (CONFIG_FW_IMAGE_SIZE - CONFIG_FW_PSTATE_SIZE)
-#define CONFIG_FW_RW_OFF CONFIG_FW_IMAGE_SIZE
-#define CONFIG_FW_RW_SIZE CONFIG_FW_IMAGE_SIZE
-#define CONFIG_FW_WP_RO_OFF CONFIG_FW_RO_OFF
-#define CONFIG_FW_WP_RO_SIZE CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RO_MEM_OFF 0
+#define CONFIG_RO_SIZE (CONFIG_FW_IMAGE_SIZE - CONFIG_FW_PSTATE_SIZE)
+#define CONFIG_RW_MEM_OFF CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RW_SIZE CONFIG_FW_IMAGE_SIZE
+#define CONFIG_WP_OFF CONFIG_RO_MEM_OFF
+#define CONFIG_WP_SIZE CONFIG_FW_IMAGE_SIZE
/*
* Put this after RO to give RW more space and make RO write protect region
* contiguous.
*/
-#define CONFIG_FW_PSTATE_OFF CONFIG_FW_RO_SIZE
+#define CONFIG_FW_PSTATE_OFF CONFIG_RO_SIZE
#define CONFIG_FW_PSTATE_SIZE CONFIG_FLASH_BANK_SIZE
/* Maximum number of deferrable functions */
diff --git a/chip/host/system.c b/chip/host/system.c
index 6e1d1c36bf..e9de6b1214 100644
--- a/chip/host/system.c
+++ b/chip/host/system.c
@@ -261,8 +261,8 @@ void system_pre_init(void)
system_set_reset_flags(load_reset_flags());
}
- *(uintptr_t *)(__host_flash + CONFIG_FW_RO_OFF + 4) =
+ *(uintptr_t *)(__host_flash + CONFIG_RO_MEM_OFF + 4) =
(uintptr_t)__ro_jump_resetvec;
- *(uintptr_t *)(__host_flash + CONFIG_FW_RW_OFF + 4) =
+ *(uintptr_t *)(__host_flash + CONFIG_RW_MEM_OFF + 4) =
(uintptr_t)__rw_jump_resetvec;
}
diff --git a/chip/it83xx/config_chip.h b/chip/it83xx/config_chip.h
index d7b13d1480..5caf50562b 100644
--- a/chip/it83xx/config_chip.h
+++ b/chip/it83xx/config_chip.h
@@ -62,7 +62,7 @@
#endif
/* RO firmware must start at beginning of flash */
-#define CONFIG_FW_RO_OFF 0
+#define CONFIG_RO_MEM_OFF 0
/*
* The EC uses the one bank of flash to emulate a SPI-like write protect
@@ -71,18 +71,18 @@
#define CONFIG_FW_PSTATE_SIZE CONFIG_FLASH_BANK_SIZE
/* PSTATE immediately follows RO, in the first half of flash */
-#define CONFIG_FW_RO_SIZE (CONFIG_FW_IMAGE_SIZE \
+#define CONFIG_RO_SIZE (CONFIG_FW_IMAGE_SIZE \
- CONFIG_FW_PSTATE_SIZE)
-#define CONFIG_FW_PSTATE_OFF CONFIG_FW_RO_SIZE
+#define CONFIG_FW_PSTATE_OFF CONFIG_RO_SIZE
#define CONFIG_FLASH_SIZE CONFIG_FLASH_PHYSICAL_SIZE
/* RW firmware is one firmware image offset from the start */
-#define CONFIG_FW_RW_OFF CONFIG_FW_IMAGE_SIZE
-#define CONFIG_FW_RW_SIZE CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RW_MEM_OFF CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RW_SIZE CONFIG_FW_IMAGE_SIZE
/* TODO: why 2 sets of configs with the same numbers? */
-#define CONFIG_FW_WP_RO_OFF CONFIG_FW_RO_OFF
-#define CONFIG_FW_WP_RO_SIZE CONFIG_FW_RO_SIZE
+#define CONFIG_WP_OFF CONFIG_RO_MEM_OFF
+#define CONFIG_WP_SIZE CONFIG_RO_SIZE
/****************************************************************************/
/* Customize the build */
diff --git a/chip/lm4/config_chip.h b/chip/lm4/config_chip.h
index 535b677701..433510d460 100644
--- a/chip/lm4/config_chip.h
+++ b/chip/lm4/config_chip.h
@@ -75,7 +75,7 @@
#endif
/* RO firmware must start at beginning of flash */
-#define CONFIG_FW_RO_OFF 0
+#define CONFIG_RO_MEM_OFF 0
/*
* The EC uses the one bank of flash to emulate a SPI-like write protect
@@ -84,18 +84,18 @@
#define CONFIG_FW_PSTATE_SIZE CONFIG_FLASH_BANK_SIZE
/* PSTATE immediately follows RO, in the first half of flash */
-#define CONFIG_FW_RO_SIZE (CONFIG_FW_IMAGE_SIZE \
+#define CONFIG_RO_SIZE (CONFIG_FW_IMAGE_SIZE \
- CONFIG_FW_PSTATE_SIZE)
-#define CONFIG_FW_PSTATE_OFF CONFIG_FW_RO_SIZE
+#define CONFIG_FW_PSTATE_OFF CONFIG_RO_SIZE
#define CONFIG_FLASH_SIZE CONFIG_FLASH_PHYSICAL_SIZE
/* RW firmware is one firmware image offset from the start */
-#define CONFIG_FW_RW_OFF CONFIG_FW_IMAGE_SIZE
-#define CONFIG_FW_RW_SIZE CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RW_MEM_OFF CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RW_SIZE CONFIG_FW_IMAGE_SIZE
/* TODO(crosbug.com/p/23796): why 2 sets of configs with the same numbers? */
-#define CONFIG_FW_WP_RO_OFF CONFIG_FW_RO_OFF
-#define CONFIG_FW_WP_RO_SIZE CONFIG_FW_RO_SIZE
+#define CONFIG_WP_OFF CONFIG_RO_MEM_OFF
+#define CONFIG_WP_SIZE CONFIG_RO_SIZE
/****************************************************************************/
/* Lock the boot configuration to prevent brickage. */
diff --git a/chip/mec1322/config_chip.h b/chip/mec1322/config_chip.h
index 3accdfdf63..ffdf0e56d4 100644
--- a/chip/mec1322/config_chip.h
+++ b/chip/mec1322/config_chip.h
@@ -110,20 +110,20 @@
#endif
/* RO/RW firmware must be after Loader code */
-#define CONFIG_FW_RO_OFF CONFIG_FW_LOADER_SIZE
+#define CONFIG_RO_MEM_OFF CONFIG_FW_LOADER_SIZE
-#define CONFIG_FW_RO_SIZE CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RO_SIZE CONFIG_FW_IMAGE_SIZE
#define CONFIG_FLASH_SIZE CONFIG_FLASH_PHYSICAL_SIZE
#define CONFIG_FW_INCLUDE_RO
-#define CONFIG_FW_RW_OFF CONFIG_FW_RO_OFF
-#define CONFIG_FW_RW_SIZE CONFIG_FW_RO_SIZE
+#define CONFIG_RW_MEM_OFF CONFIG_RO_MEM_OFF
+#define CONFIG_RW_SIZE CONFIG_RO_SIZE
/* Write protect Loader and RO Image */
-#define CONFIG_FW_WP_RO_OFF CONFIG_FW_LOADER_OFF
+#define CONFIG_WP_OFF CONFIG_FW_LOADER_OFF
/* Write protect 128k section of 256k physical flash
which contains Loader and RO Images */
-#define CONFIG_FW_WP_RO_SIZE (CONFIG_FLASH_PHYSICAL_SIZE >> 1)
+#define CONFIG_WP_SIZE (CONFIG_FLASH_PHYSICAL_SIZE >> 1)
/****************************************************************************/
/* SPI Flash Memory Mapping */
@@ -132,12 +132,12 @@ which contains Loader and RO Images */
#define CONFIG_FLASH_BASE_SPI (CONFIG_SPI_FLASH_SIZE - (0x40000))
#define CONFIG_RO_WP_SPI_OFF 0x20000
-#define CONFIG_RO_SPI_OFF 0x20000
-#define CONFIG_RW_SPI_OFF 0
+#define CONFIG_RO_STORAGE_OFF 0x20000
+#define CONFIG_RW_STORAGE_OFF 0
#define CONFIG_RO_IMAGE_FLASHADDR (CONFIG_FLASH_BASE_SPI + \
- CONFIG_RO_SPI_OFF)
+ CONFIG_RO_STORAGE_OFF)
#define CONFIG_RW_IMAGE_FLASHADDR (CONFIG_FLASH_BASE_SPI + \
- CONFIG_RW_SPI_OFF)
+ CONFIG_RW_STORAGE_OFF)
/* Memory Lcation shared between lfw and RO/RWimage */
#define SHARED_RAM_LFW_RORW (CONFIG_MEC_SRAM_BASE_START + \
(CONFIG_LOADER_IMAGE_SIZE - 4))
diff --git a/chip/mec1322/flash.c b/chip/mec1322/flash.c
index e9c752e917..78beb72429 100644
--- a/chip/mec1322/flash.c
+++ b/chip/mec1322/flash.c
@@ -123,8 +123,8 @@ int flash_physical_protect_now(int all)
offset = 0;
size = CONFIG_FLASH_PHYSICAL_SIZE;
} else {
- offset = CONFIG_FW_RO_OFF;
- size = CONFIG_FW_RO_SIZE;
+ offset = CONFIG_RO_MEM_OFF;
+ size = CONFIG_RO_SIZE;
}
spi_enable(1);
@@ -145,10 +145,10 @@ uint32_t flash_physical_get_protect_flags(void)
uint32_t flags = 0;
spi_enable(1);
- if (spi_flash_check_protect(CONFIG_FW_RO_OFF, CONFIG_FW_RO_SIZE)) {
+ if (spi_flash_check_protect(CONFIG_RO_MEM_OFF, CONFIG_RO_SIZE)) {
flags |= EC_FLASH_PROTECT_RO_AT_BOOT | EC_FLASH_PROTECT_RO_NOW;
- if (spi_flash_check_protect(CONFIG_FW_RW_OFF,
- CONFIG_FW_RW_SIZE))
+ if (spi_flash_check_protect(CONFIG_RW_MEM_OFF,
+ CONFIG_RW_SIZE))
flags |= EC_FLASH_PROTECT_ALL_NOW;
}
spi_enable(0);
@@ -206,8 +206,8 @@ int flash_physical_protect_at_boot(enum flash_wp_range range)
offset = size = 0;
break;
case FLASH_WP_RO:
- offset = CONFIG_FW_RO_OFF;
- size = CONFIG_FW_RO_SIZE;
+ offset = CONFIG_RO_MEM_OFF;
+ size = CONFIG_RO_SIZE;
break;
case FLASH_WP_ALL:
offset = 0;
diff --git a/chip/mec1322/lfw/ec_lfw.c b/chip/mec1322/lfw/ec_lfw.c
index 0d953e6ae9..2ceaa35644 100644
--- a/chip/mec1322/lfw/ec_lfw.c
+++ b/chip/mec1322/lfw/ec_lfw.c
@@ -87,14 +87,14 @@ static int spi_flash_readloc(uint8_t *buf_usr,
int spi_rwimage_load(void)
{
- uint8_t *buf = (uint8_t *) (CONFIG_FW_RW_OFF + CONFIG_FLASH_BASE);
+ uint8_t *buf = (uint8_t *) (CONFIG_RW_MEM_OFF + CONFIG_FLASH_BASE);
uint32_t i;
- memset((void *)buf, 0xFF, (CONFIG_FW_RW_SIZE - 4));
+ memset((void *)buf, 0xFF, (CONFIG_RW_SIZE - 4));
spi_enable(1);
- for (i = 0; i < CONFIG_FW_RW_SIZE; i += SPI_CHUNK_SIZE)
+ for (i = 0; i < CONFIG_RW_SIZE; i += SPI_CHUNK_SIZE)
spi_flash_readloc(&buf[i],
CONFIG_RW_IMAGE_FLASHADDR + i,
SPI_CHUNK_SIZE);
@@ -226,11 +226,11 @@ void lfw_main()
switch (*image_type) {
case SYSTEM_IMAGE_RW:
- init_addr = CONFIG_FW_RW_OFF + CONFIG_FLASH_BASE;
+ init_addr = CONFIG_RW_MEM_OFF + CONFIG_FLASH_BASE;
spi_rwimage_load();
case SYSTEM_IMAGE_RO:
default:
- init_addr = CONFIG_FW_RO_OFF + CONFIG_FLASH_BASE;
+ init_addr = CONFIG_RO_MEM_OFF + CONFIG_FLASH_BASE;
}
jump_to_image(*(uintptr_t *)(init_addr + 4));
diff --git a/chip/mec1322/system.c b/chip/mec1322/system.c
index b94e93ff07..2460dc51b2 100644
--- a/chip/mec1322/system.c
+++ b/chip/mec1322/system.c
@@ -379,5 +379,5 @@ enum system_image_copy_t system_get_shrspi_image_copy(void)
/* TODO(crosbug.com/p/37510): Implement bootloader */
uint32_t system_get_lfw_address(uint32_t flash_addr)
{
- return CONFIG_FW_RO_OFF;
+ return CONFIG_RO_MEM_OFF;
}
diff --git a/chip/npcx/config_chip.h b/chip/npcx/config_chip.h
index b6fc1d1f3a..560be8e6c9 100644
--- a/chip/npcx/config_chip.h
+++ b/chip/npcx/config_chip.h
@@ -75,17 +75,17 @@
#endif
/* RO firmware offset of flash */
-#define CONFIG_FW_RO_OFF 0
-#define CONFIG_FW_RO_SIZE CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RO_MEM_OFF 0
+#define CONFIG_RO_SIZE CONFIG_FW_IMAGE_SIZE
#define CONFIG_FLASH_SIZE CONFIG_FLASH_PHYSICAL_SIZE
/* RW firmware is one firmware image offset from the start */
-#define CONFIG_FW_RW_OFF CONFIG_FW_IMAGE_SIZE
-#define CONFIG_FW_RW_SIZE CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RW_MEM_OFF CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RW_SIZE CONFIG_FW_IMAGE_SIZE
/* TODO(crosbug.com/p/23796): why 2 sets of configs with the same numbers? */
-#define CONFIG_FW_WP_RO_OFF CONFIG_FW_RO_OFF
-#define CONFIG_FW_WP_RO_SIZE CONFIG_FW_RO_SIZE
+#define CONFIG_WP_OFF CONFIG_RO_MEM_OFF
+#define CONFIG_WP_SIZE CONFIG_RO_SIZE
/*
* The offset from top of flash wich used by booter
diff --git a/chip/npcx/lfw/ec_lfw.c b/chip/npcx/lfw/ec_lfw.c
index e9710398f3..c3a505ce69 100644
--- a/chip/npcx/lfw/ec_lfw.c
+++ b/chip/npcx/lfw/ec_lfw.c
@@ -83,12 +83,12 @@ bin2ram(void)
{
/* copy image from RO base */
if (IS_BIT_SET(NPCX_FWCTRL, NPCX_FWCTRL_RO_REGION))
- flash_burst_copy_fw_to_mram(CONFIG_FW_RO_OFF, CONFIG_CDRAM_BASE,
- CONFIG_FW_RO_SIZE - LFW_SIZE);
+ flash_burst_copy_fw_to_mram(CONFIG_RO_MEM_OFF,
+ CONFIG_CDRAM_BASE, CONFIG_RO_SIZE - LFW_SIZE);
/* copy image from RW base */
else
- flash_burst_copy_fw_to_mram(CONFIG_FW_RW_OFF, CONFIG_CDRAM_BASE,
- CONFIG_FW_RW_SIZE - LFW_SIZE);
+ flash_burst_copy_fw_to_mram(CONFIG_RW_MEM_OFF,
+ CONFIG_CDRAM_BASE, CONFIG_RW_SIZE - LFW_SIZE);
/* Disable FIU pins to tri-state */
CLEAR_BIT(NPCX_DEVCNT, NPCX_DEVCNT_F_SPI_TRIS);
diff --git a/chip/npcx/system.c b/chip/npcx/system.c
index 44f5c03f64..a103292e0e 100644
--- a/chip/npcx/system.c
+++ b/chip/npcx/system.c
@@ -854,7 +854,7 @@ enum system_image_copy_t system_get_shrspi_image_copy(void)
static void system_sysjump(void)
{
/* Jump to RO region -- set flag */
- if (base_addr == CONFIG_FLASH_BASE + CONFIG_FW_RO_OFF)
+ if (base_addr == CONFIG_FLASH_BASE + CONFIG_RO_MEM_OFF)
SET_BIT(NPCX_FWCTRL, NPCX_FWCTRL_RO_REGION);
else /* Jump to RW region -- clear flag */
CLEAR_BIT(NPCX_FWCTRL, NPCX_FWCTRL_RO_REGION);
diff --git a/chip/nrf51/config_chip.h b/chip/nrf51/config_chip.h
index 9de7b1eb76..104fceb0ca 100644
--- a/chip/nrf51/config_chip.h
+++ b/chip/nrf51/config_chip.h
@@ -48,17 +48,17 @@
#define CONFIG_FW_IMAGE_SIZE (128 * 1024)
/* Define the RO/RW offset */
-#define CONFIG_FW_RO_OFF 0
-#define CONFIG_FW_RO_SIZE (CONFIG_FW_IMAGE_SIZE - CONFIG_FW_PSTATE_SIZE)
-#define CONFIG_FW_RW_OFF CONFIG_FW_IMAGE_SIZE
-#define CONFIG_FW_RW_SIZE CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RO_MEM_OFF 0
+#define CONFIG_RO_SIZE (CONFIG_FW_IMAGE_SIZE - CONFIG_FW_PSTATE_SIZE)
+#define CONFIG_RW_MEM_OFF CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RW_SIZE CONFIG_FW_IMAGE_SIZE
/*
* Put pstate after RO to give RW more space and make RO write protect
* region contiguous.
*/
-#define CONFIG_FW_PSTATE_SIZE CONFIG_FLASH_BANK_SIZE
-#define CONFIG_FW_PSTATE_OFF (CONFIG_FW_RO_OFF + CONFIG_FW_RO_SIZE)
+#define CONFIG_FW_PSTATE_SIZE CONFIG_FLASH_BANK_SIZE
+#define CONFIG_FW_PSTATE_OFF (CONFIG_RO_MEM_OFF + CONFIG_RO_SIZE)
/* Number of IRQ vectors on the NVIC */
diff --git a/chip/stm32/config-stm32f03x.h b/chip/stm32/config-stm32f03x.h
index a1211d38a7..2bd4da74cb 100644
--- a/chip/stm32/config-stm32f03x.h
+++ b/chip/stm32/config-stm32f03x.h
@@ -20,12 +20,12 @@
/* Size of one firmware image in flash */
#define CONFIG_FW_IMAGE_SIZE (16 * 1024)
-#define CONFIG_FW_RO_OFF 0
-#define CONFIG_FW_RO_SIZE (CONFIG_FW_IMAGE_SIZE - CONFIG_FW_PSTATE_SIZE)
-#define CONFIG_FW_RW_OFF CONFIG_FW_IMAGE_SIZE
-#define CONFIG_FW_RW_SIZE CONFIG_FW_IMAGE_SIZE
-#define CONFIG_FW_WP_RO_OFF CONFIG_FW_RO_OFF
-#define CONFIG_FW_WP_RO_SIZE CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RO_MEM_OFF 0
+#define CONFIG_RO_SIZE (CONFIG_FW_IMAGE_SIZE - CONFIG_FW_PSTATE_SIZE)
+#define CONFIG_RW_MEM_OFF CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RW_SIZE CONFIG_FW_IMAGE_SIZE
+#define CONFIG_WP_OFF CONFIG_RO_MEM_OFF
+#define CONFIG_WP_SIZE CONFIG_FW_IMAGE_SIZE
/*
* Put pstate after RO to give RW more space and make RO write protect region
@@ -37,7 +37,7 @@
#else
#define CONFIG_FW_PSTATE_SIZE CONFIG_FLASH_BANK_SIZE
#endif
-#define CONFIG_FW_PSTATE_OFF (CONFIG_FW_RO_OFF + CONFIG_FW_RO_SIZE)
+#define CONFIG_FW_PSTATE_OFF (CONFIG_RO_MEM_OFF + CONFIG_RO_SIZE)
/* Number of IRQ vectors on the NVIC */
#define CONFIG_IRQ_COUNT 32
diff --git a/chip/stm32/config-stm32f07x.h b/chip/stm32/config-stm32f07x.h
index 1b652cfb66..d1d01824e9 100644
--- a/chip/stm32/config-stm32f07x.h
+++ b/chip/stm32/config-stm32f07x.h
@@ -20,19 +20,19 @@
/* Size of the first firmware image in flash */
#define CONFIG_FW_IMAGE_SIZE (CONFIG_FLASH_SIZE / 2)
-#define CONFIG_FW_RO_OFF 0
-#define CONFIG_FW_RO_SIZE (CONFIG_FW_IMAGE_SIZE - CONFIG_FW_PSTATE_SIZE)
-#define CONFIG_FW_RW_OFF (CONFIG_FW_RO_OFF + CONFIG_FW_IMAGE_SIZE)
-#define CONFIG_FW_RW_SIZE (CONFIG_FLASH_SIZE - CONFIG_FW_IMAGE_SIZE)
-#define CONFIG_FW_WP_RO_OFF CONFIG_FW_RO_OFF
-#define CONFIG_FW_WP_RO_SIZE CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RO_MEM_OFF 0
+#define CONFIG_RO_SIZE (CONFIG_FW_IMAGE_SIZE - CONFIG_FW_PSTATE_SIZE)
+#define CONFIG_RW_MEM_OFF (CONFIG_RO_MEM_OFF + CONFIG_FW_IMAGE_SIZE)
+#define CONFIG_RW_SIZE (CONFIG_FLASH_SIZE - CONFIG_FW_IMAGE_SIZE)
+#define CONFIG_WP_OFF CONFIG_RO_MEM_OFF
+#define CONFIG_WP_SIZE CONFIG_FW_IMAGE_SIZE
/*
* Put pstate after RO to give RW more space and make RO write protect region
* contiguous.
*/
#define CONFIG_FW_PSTATE_SIZE CONFIG_FLASH_BANK_SIZE
-#define CONFIG_FW_PSTATE_OFF (CONFIG_FW_RO_OFF + CONFIG_FW_RO_SIZE)
+#define CONFIG_FW_PSTATE_OFF (CONFIG_RO_MEM_OFF + CONFIG_RO_SIZE)
/* Number of IRQ vectors on the NVIC */
#define CONFIG_IRQ_COUNT 32
diff --git a/chip/stm32/config-stm32f100.h b/chip/stm32/config-stm32f100.h
index 92b5ab4dca..297da6b238 100644
--- a/chip/stm32/config-stm32f100.h
+++ b/chip/stm32/config-stm32f100.h
@@ -20,19 +20,19 @@
/* Size of one firmware image in flash */
#define CONFIG_FW_IMAGE_SIZE (64 * 1024)
-#define CONFIG_FW_RO_OFF 0
-#define CONFIG_FW_RO_SIZE (CONFIG_FW_IMAGE_SIZE - CONFIG_FW_PSTATE_SIZE)
-#define CONFIG_FW_RW_OFF CONFIG_FW_IMAGE_SIZE
-#define CONFIG_FW_RW_SIZE CONFIG_FW_IMAGE_SIZE
-#define CONFIG_FW_WP_RO_OFF CONFIG_FW_RO_OFF
-#define CONFIG_FW_WP_RO_SIZE CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RO_MEM_OFF 0
+#define CONFIG_RO_SIZE (CONFIG_FW_IMAGE_SIZE - CONFIG_FW_PSTATE_SIZE)
+#define CONFIG_RW_MEM_OFF CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RW_SIZE CONFIG_FW_IMAGE_SIZE
+#define CONFIG_WP_OFF CONFIG_RO_MEM_OFF
+#define CONFIG_WP_SIZE CONFIG_FW_IMAGE_SIZE
/*
* Put pstate after RO to give RW more space and make RO write protect region
* contiguous.
*/
#define CONFIG_FW_PSTATE_SIZE CONFIG_FLASH_BANK_SIZE
-#define CONFIG_FW_PSTATE_OFF (CONFIG_FW_RO_OFF + CONFIG_FW_RO_SIZE)
+#define CONFIG_FW_PSTATE_OFF (CONFIG_RO_MEM_OFF + CONFIG_RO_SIZE)
/* Number of IRQ vectors on the NVIC */
#define CONFIG_IRQ_COUNT 61
diff --git a/chip/stm32/config-stm32f10x.h b/chip/stm32/config-stm32f10x.h
index a201f52c4f..e638fdd377 100644
--- a/chip/stm32/config-stm32f10x.h
+++ b/chip/stm32/config-stm32f10x.h
@@ -20,19 +20,19 @@
/* Size of one firmware image in flash */
#define CONFIG_FW_IMAGE_SIZE (64 * 1024)
-#define CONFIG_FW_RO_OFF 0
-#define CONFIG_FW_RO_SIZE (CONFIG_FW_IMAGE_SIZE - CONFIG_FW_PSTATE_SIZE)
-#define CONFIG_FW_RW_OFF CONFIG_FW_IMAGE_SIZE
-#define CONFIG_FW_RW_SIZE CONFIG_FW_IMAGE_SIZE
-#define CONFIG_FW_WP_RO_OFF CONFIG_FW_RO_OFF
-#define CONFIG_FW_WP_RO_SIZE CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RO_MEM_OFF 0
+#define CONFIG_RO_SIZE (CONFIG_FW_IMAGE_SIZE - CONFIG_FW_PSTATE_SIZE)
+#define CONFIG_RW_MEM_OFF CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RW_SIZE CONFIG_FW_IMAGE_SIZE
+#define CONFIG_WP_OFF CONFIG_RO_MEM_OFF
+#define CONFIG_WP_SIZE CONFIG_FW_IMAGE_SIZE
/*
* Put pstate after RO to give RW more space and make RO write protect region
* contiguous.
*/
#define CONFIG_FW_PSTATE_SIZE CONFIG_FLASH_BANK_SIZE
-#define CONFIG_FW_PSTATE_OFF (CONFIG_FW_RO_OFF + CONFIG_FW_RO_SIZE)
+#define CONFIG_FW_PSTATE_OFF (CONFIG_RO_MEM_OFF + CONFIG_RO_SIZE)
/* Number of IRQ vectors on the NVIC */
#define CONFIG_IRQ_COUNT 68
diff --git a/chip/stm32/config-stm32f373.h b/chip/stm32/config-stm32f373.h
index 32a9d0b5fa..05f50f9cdd 100644
--- a/chip/stm32/config-stm32f373.h
+++ b/chip/stm32/config-stm32f373.h
@@ -20,19 +20,19 @@
/* Size of one firmware image in flash */
#define CONFIG_FW_IMAGE_SIZE (128 * 1024)
-#define CONFIG_FW_RO_OFF 0
-#define CONFIG_FW_RO_SIZE (CONFIG_FW_IMAGE_SIZE - CONFIG_FW_PSTATE_SIZE)
-#define CONFIG_FW_RW_OFF CONFIG_FW_IMAGE_SIZE
-#define CONFIG_FW_RW_SIZE CONFIG_FW_IMAGE_SIZE
-#define CONFIG_FW_WP_RO_OFF CONFIG_FW_RO_OFF
-#define CONFIG_FW_WP_RO_SIZE CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RO_MEM_OFF 0
+#define CONFIG_RO_SIZE (CONFIG_FW_IMAGE_SIZE - CONFIG_FW_PSTATE_SIZE)
+#define CONFIG_RW_MEM_OFF CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RW_SIZE CONFIG_FW_IMAGE_SIZE
+#define CONFIG_WP_OFF CONFIG_RO_MEM_OFF
+#define CONFIG_WP_SIZE CONFIG_FW_IMAGE_SIZE
/*
* Put pstate after RO to give RW more space and make RO write protect region
* contiguous.
*/
#define CONFIG_FW_PSTATE_SIZE CONFIG_FLASH_BANK_SIZE
-#define CONFIG_FW_PSTATE_OFF (CONFIG_FW_RO_OFF + CONFIG_FW_RO_SIZE)
+#define CONFIG_FW_PSTATE_OFF (CONFIG_RO_MEM_OFF + CONFIG_RO_SIZE)
/* Number of IRQ vectors on the NVIC */
#define CONFIG_IRQ_COUNT 81
diff --git a/chip/stm32/config-stm32l100.h b/chip/stm32/config-stm32l100.h
index 983f956b84..ae063be847 100644
--- a/chip/stm32/config-stm32l100.h
+++ b/chip/stm32/config-stm32l100.h
@@ -29,19 +29,19 @@
/* Size of one firmware image in flash */
#define CONFIG_FW_IMAGE_SIZE (64 * 1024)
-#define CONFIG_FW_RO_OFF 0
-#define CONFIG_FW_RO_SIZE (CONFIG_FW_IMAGE_SIZE - CONFIG_FW_PSTATE_SIZE)
-#define CONFIG_FW_RW_OFF CONFIG_FW_IMAGE_SIZE
-#define CONFIG_FW_RW_SIZE CONFIG_FW_IMAGE_SIZE
-#define CONFIG_FW_WP_RO_OFF CONFIG_FW_RO_OFF
-#define CONFIG_FW_WP_RO_SIZE CONFIG_FW_RO_SIZE
+#define CONFIG_RO_MEM_OFF 0
+#define CONFIG_RO_SIZE (CONFIG_FW_IMAGE_SIZE - CONFIG_FW_PSTATE_SIZE)
+#define CONFIG_RW_MEM_OFF CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RW_SIZE CONFIG_FW_IMAGE_SIZE
+#define CONFIG_WP_OFF CONFIG_RO_MEM_OFF
+#define CONFIG_WP_SIZE CONFIG_RO_SIZE
/*
* Put pstate after RO to give RW more space and make RO write protect
* region contiguous.
*/
#define CONFIG_FW_PSTATE_SIZE CONFIG_FLASH_BANK_SIZE
-#define CONFIG_FW_PSTATE_OFF (CONFIG_FW_RO_OFF + CONFIG_FW_RO_SIZE)
+#define CONFIG_FW_PSTATE_OFF (CONFIG_RO_MEM_OFF + CONFIG_RO_SIZE)
/* Number of IRQ vectors on the NVIC */
#define CONFIG_IRQ_COUNT 45
diff --git a/chip/stm32/config-stm32l15x.h b/chip/stm32/config-stm32l15x.h
index 4ba9fe24b5..4e5a9dca06 100644
--- a/chip/stm32/config-stm32l15x.h
+++ b/chip/stm32/config-stm32l15x.h
@@ -29,19 +29,19 @@
/* Size of one firmware image in flash */
#define CONFIG_FW_IMAGE_SIZE (64 * 1024)
-#define CONFIG_FW_RO_OFF 0
-#define CONFIG_FW_RO_SIZE (CONFIG_FW_IMAGE_SIZE - CONFIG_FW_PSTATE_SIZE)
-#define CONFIG_FW_RW_OFF CONFIG_FW_IMAGE_SIZE
-#define CONFIG_FW_RW_SIZE CONFIG_FW_IMAGE_SIZE
-#define CONFIG_FW_WP_RO_OFF CONFIG_FW_RO_OFF
-#define CONFIG_FW_WP_RO_SIZE CONFIG_FW_RO_SIZE
+#define CONFIG_RO_MEM_OFF 0
+#define CONFIG_RO_SIZE (CONFIG_FW_IMAGE_SIZE - CONFIG_FW_PSTATE_SIZE)
+#define CONFIG_RW_MEM_OFF CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RW_SIZE CONFIG_FW_IMAGE_SIZE
+#define CONFIG_WP_OFF CONFIG_RO_MEM_OFF
+#define CONFIG_WP_SIZE CONFIG_RO_SIZE
/*
* Put pstate after RO to give RW more space and make RO write protect
* region contiguous.
*/
-#define CONFIG_FW_PSTATE_SIZE CONFIG_FLASH_BANK_SIZE
-#define CONFIG_FW_PSTATE_OFF (CONFIG_FW_RO_OFF + CONFIG_FW_RO_SIZE)
+#define CONFIG_FW_PSTATE_SIZE CONFIG_FLASH_BANK_SIZE
+#define CONFIG_FW_PSTATE_OFF (CONFIG_RO_MEM_OFF + CONFIG_RO_SIZE)
/* Number of IRQ vectors on the NVIC */
#define CONFIG_IRQ_COUNT 45
diff --git a/chip/stm32/config-stm32ts60.h b/chip/stm32/config-stm32ts60.h
index 0713b201d6..85a78af6d5 100644
--- a/chip/stm32/config-stm32ts60.h
+++ b/chip/stm32/config-stm32ts60.h
@@ -20,19 +20,19 @@
/* Size of one firmware image in flash */
#define CONFIG_FW_IMAGE_SIZE (32 * 1024)
-#define CONFIG_FW_RO_OFF 0
-#define CONFIG_FW_RO_SIZE (CONFIG_FW_IMAGE_SIZE - CONFIG_FW_PSTATE_SIZE)
-#define CONFIG_FW_RW_OFF CONFIG_FW_IMAGE_SIZE
-#define CONFIG_FW_RW_SIZE CONFIG_FW_IMAGE_SIZE
-#define CONFIG_FW_WP_RO_OFF CONFIG_FW_RO_OFF
-#define CONFIG_FW_WP_RO_SIZE CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RO_MEM_OFF 0
+#define CONFIG_RO_SIZE (CONFIG_FW_IMAGE_SIZE - CONFIG_FW_PSTATE_SIZE)
+#define CONFIG_RW_MEM_OFF CONFIG_FW_IMAGE_SIZE
+#define CONFIG_RW_SIZE CONFIG_FW_IMAGE_SIZE
+#define CONFIG_WP_OFF CONFIG_RO_MEM_OFF
+#define CONFIG_WP_SIZE CONFIG_FW_IMAGE_SIZE
/*
* Put pstate after RO to give RW more space and make RO write protect region
* contiguous.
*/
#define CONFIG_FW_PSTATE_SIZE CONFIG_FLASH_BANK_SIZE
-#define CONFIG_FW_PSTATE_OFF (CONFIG_FW_RO_OFF + CONFIG_FW_RO_SIZE)
+#define CONFIG_FW_PSTATE_OFF (CONFIG_RO_MEM_OFF + CONFIG_RO_SIZE)
/* Number of IRQ vectors on the NVIC */
#define CONFIG_IRQ_COUNT 59
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);
}
diff --git a/core/cortex-m/ec.lds.S b/core/cortex-m/ec.lds.S
index 5cbc18d527..c637612bf7 100644
--- a/core/cortex-m/ec.lds.S
+++ b/core/cortex-m/ec.lds.S
@@ -5,10 +5,10 @@
#include "config.h"
#include "rsa.h"
-#define FW_OFF_(section) CONFIG_FW_##section##_OFF
+#define FW_OFF_(section) CONFIG_##section##_MEM_OFF
#define FW_OFF(section) (CONFIG_FLASH_BASE + FW_OFF_(section))
-#define FW_SIZE_(section) CONFIG_FW_##section##_SIZE
+#define FW_SIZE_(section) CONFIG_##section##_SIZE
#define FW_SIZE(section) FW_SIZE_(section)
diff --git a/core/cortex-m/mpu.c b/core/cortex-m/mpu.c
index 9082f545c3..8cdf4c9194 100644
--- a/core/cortex-m/mpu.c
+++ b/core/cortex-m/mpu.c
@@ -140,14 +140,14 @@ int mpu_protect_ram(void)
int mpu_lock_ro_flash(void)
{
- return mpu_lock_region(REGION_FLASH_MEMORY, CONFIG_FW_RO_OFF,
+ return mpu_lock_region(REGION_FLASH_MEMORY, CONFIG_RO_MEM_OFF,
CONFIG_FW_IMAGE_SIZE, MPU_ATTR_FLASH_MEMORY);
}
int mpu_lock_rw_flash(void)
{
- return mpu_lock_region(REGION_FLASH_MEMORY, CONFIG_FW_RW_OFF,
- CONFIG_FW_RW_SIZE, MPU_ATTR_FLASH_MEMORY);
+ return mpu_lock_region(REGION_FLASH_MEMORY, CONFIG_RW_MEM_OFF,
+ CONFIG_RW_SIZE, MPU_ATTR_FLASH_MEMORY);
}
int mpu_pre_init(void)
diff --git a/core/cortex-m0/ec.lds.S b/core/cortex-m0/ec.lds.S
index 69b06530cf..a61add0276 100644
--- a/core/cortex-m0/ec.lds.S
+++ b/core/cortex-m0/ec.lds.S
@@ -5,10 +5,10 @@
#include "config.h"
#include "rsa.h"
-#define FW_OFF_(section) CONFIG_FW_##section##_OFF
+#define FW_OFF_(section) CONFIG_##section##_MEM_OFF
#define FW_OFF(section) (CONFIG_FLASH_BASE + FW_OFF_(section))
-#define FW_SIZE_(section) CONFIG_FW_##section##_SIZE
+#define FW_SIZE_(section) CONFIG_##section##_SIZE
#define FW_SIZE(section) FW_SIZE_(section)
diff --git a/include/config.h b/include/config.h
index 27137fdf00..7bccb41a27 100644
--- a/include/config.h
+++ b/include/config.h
@@ -644,12 +644,27 @@
#undef CONFIG_FW_IMAGE_SIZE
#undef CONFIG_FW_PSTATE_OFF
#undef CONFIG_FW_PSTATE_SIZE
-#undef CONFIG_FW_RO_OFF
-#undef CONFIG_FW_RO_SIZE
-#undef CONFIG_FW_RW_OFF
-#undef CONFIG_FW_RW_SIZE
-#undef CONFIG_FW_WP_RO_OFF
-#undef CONFIG_FW_WP_RO_SIZE
+
+/*
+ * Read-only / read-write image configuration.
+ * Images may reside on storage (ex. external or internal SPI) at a different
+ * offset than when copied to program memory. Hence, two sets of offsets,
+ * for STORAGE and for MEMORY.
+ */
+#undef CONFIG_RO_MEM_OFF
+#undef CONFIG_RO_STORAGE_OFF
+#undef CONFIG_RO_SIZE
+
+#undef CONFIG_RW_MEM_OFF
+#undef CONFIG_RW_STORAGE_OFF
+#undef CONFIG_RW_SIZE
+
+/*
+ * Write protect region offset / size. This region normally encompasses the
+ * RO image, but may also contain additional images or data.
+ */
+#undef CONFIG_WP_OFF
+#undef CONFIG_WP_SIZE
/*
* Board Image ec.bin contains a RO firmware. If not defined, the image will
diff --git a/include/flash.h b/include/flash.h
index b724142ffa..b9cccb82cd 100644
--- a/include/flash.h
+++ b/include/flash.h
@@ -15,12 +15,12 @@
#define PHYSICAL_BANKS (CONFIG_FLASH_PHYSICAL_SIZE / CONFIG_FLASH_BANK_SIZE)
/* Read-only firmware offset and size in units of flash banks */
-#define RO_BANK_OFFSET (CONFIG_FW_RO_OFF / CONFIG_FLASH_BANK_SIZE)
-#define RO_BANK_COUNT (CONFIG_FW_RO_SIZE / CONFIG_FLASH_BANK_SIZE)
+#define RO_BANK_OFFSET (CONFIG_RO_MEM_OFF / CONFIG_FLASH_BANK_SIZE)
+#define RO_BANK_COUNT (CONFIG_RO_SIZE / CONFIG_FLASH_BANK_SIZE)
/* Read-write firmware offset and size in units of flash banks */
-#define RW_BANK_OFFSET (CONFIG_FW_RW_OFF / CONFIG_FLASH_BANK_SIZE)
-#define RW_BANK_COUNT (CONFIG_FW_RW_SIZE / CONFIG_FLASH_BANK_SIZE)
+#define RW_BANK_OFFSET (CONFIG_RW_MEM_OFF / CONFIG_FLASH_BANK_SIZE)
+#define RW_BANK_COUNT (CONFIG_RW_SIZE / CONFIG_FLASH_BANK_SIZE)
/* Persistent protection state flash offset / size / bank */
#if defined(CONFIG_FLASH_PSTATE) && defined(CONFIG_FLASH_PSTATE_BANK)
diff --git a/test/flash.c b/test/flash.c
index 2b3114854c..ab99272ff2 100644
--- a/test/flash.c
+++ b/test/flash.c
@@ -286,11 +286,11 @@ static int test_overwrite_current(void)
/* Test that we cannot overwrite current image */
if (system_get_image_copy() == SYSTEM_IMAGE_RO) {
- offset = CONFIG_FW_RO_OFF;
- size = CONFIG_FW_RO_SIZE;
+ offset = CONFIG_RO_MEM_OFF;
+ size = CONFIG_RO_SIZE;
} else {
- offset = CONFIG_FW_RW_OFF;
- size = CONFIG_FW_RW_SIZE;
+ offset = CONFIG_RW_MEM_OFF;
+ size = CONFIG_RW_SIZE;
}
#ifdef EMU_BUILD
@@ -312,11 +312,11 @@ static int test_overwrite_other(void)
/* Test that we can overwrite the other image */
if (system_get_image_copy() == SYSTEM_IMAGE_RW) {
- offset = CONFIG_FW_RO_OFF;
- size = CONFIG_FW_RO_SIZE;
+ offset = CONFIG_RO_MEM_OFF;
+ size = CONFIG_RO_SIZE;
} else {
- offset = CONFIG_FW_RW_OFF;
- size = CONFIG_FW_RW_SIZE;
+ offset = CONFIG_RW_MEM_OFF;
+ size = CONFIG_RW_SIZE;
}
#ifdef EMU_BUILD
@@ -335,10 +335,10 @@ static int test_overwrite_other(void)
static int test_op_failure(void)
{
mock_flash_op_fail = EC_ERROR_UNKNOWN;
- VERIFY_NO_WRITE(CONFIG_FW_RO_OFF, sizeof(testdata), testdata);
- VERIFY_NO_WRITE(CONFIG_FW_RW_OFF, sizeof(testdata), testdata);
- VERIFY_NO_ERASE(CONFIG_FW_RO_OFF, CONFIG_FLASH_ERASE_SIZE);
- VERIFY_NO_ERASE(CONFIG_FW_RW_OFF, CONFIG_FLASH_ERASE_SIZE);
+ VERIFY_NO_WRITE(CONFIG_RO_MEM_OFF, sizeof(testdata), testdata);
+ VERIFY_NO_WRITE(CONFIG_RW_MEM_OFF, sizeof(testdata), testdata);
+ VERIFY_NO_ERASE(CONFIG_RO_MEM_OFF, CONFIG_FLASH_ERASE_SIZE);
+ VERIFY_NO_ERASE(CONFIG_RW_MEM_OFF, CONFIG_FLASH_ERASE_SIZE);
mock_flash_op_fail = EC_SUCCESS;
return EC_SUCCESS;
@@ -360,11 +360,11 @@ static int test_flash_info(void)
static int test_region_info(void)
{
VERIFY_REGION_INFO(EC_FLASH_REGION_RO,
- CONFIG_FW_RO_OFF, CONFIG_FW_RO_SIZE);
+ CONFIG_RO_MEM_OFF, CONFIG_RO_SIZE);
VERIFY_REGION_INFO(EC_FLASH_REGION_RW,
- CONFIG_FW_RW_OFF, CONFIG_FW_RW_SIZE);
+ CONFIG_RW_MEM_OFF, CONFIG_RW_SIZE);
VERIFY_REGION_INFO(EC_FLASH_REGION_WP_RO,
- CONFIG_FW_WP_RO_OFF, CONFIG_FW_WP_RO_SIZE);
+ CONFIG_WP_OFF, CONFIG_WP_SIZE);
return EC_SUCCESS;
}
@@ -391,16 +391,16 @@ static int test_write_protect(void)
ASSERT_WP_FLAGS(EC_FLASH_PROTECT_ALL_NOW | EC_FLASH_PROTECT_RO_AT_BOOT);
/* Check we cannot erase anything */
- TEST_ASSERT(flash_physical_erase(CONFIG_FW_RO_OFF,
+ TEST_ASSERT(flash_physical_erase(CONFIG_RO_MEM_OFF,
CONFIG_FLASH_ERASE_SIZE) != EC_SUCCESS);
- TEST_ASSERT(flash_physical_erase(CONFIG_FW_RW_OFF,
+ TEST_ASSERT(flash_physical_erase(CONFIG_RW_MEM_OFF,
CONFIG_FLASH_ERASE_SIZE) != EC_SUCCESS);
/* We should not even try to write/erase */
- VERIFY_NO_ERASE(CONFIG_FW_RO_OFF, CONFIG_FLASH_ERASE_SIZE);
- VERIFY_NO_ERASE(CONFIG_FW_RW_OFF, CONFIG_FLASH_ERASE_SIZE);
- VERIFY_NO_WRITE(CONFIG_FW_RO_OFF, sizeof(testdata), testdata);
- VERIFY_NO_WRITE(CONFIG_FW_RW_OFF, sizeof(testdata), testdata);
+ VERIFY_NO_ERASE(CONFIG_RO_MEM_OFF, CONFIG_FLASH_ERASE_SIZE);
+ VERIFY_NO_ERASE(CONFIG_RW_MEM_OFF, CONFIG_FLASH_ERASE_SIZE);
+ VERIFY_NO_WRITE(CONFIG_RO_MEM_OFF, sizeof(testdata), testdata);
+ VERIFY_NO_WRITE(CONFIG_RW_MEM_OFF, sizeof(testdata), testdata);
return EC_SUCCESS;
}
@@ -409,7 +409,7 @@ static int test_boot_write_protect(void)
{
/* Check write protect state persists through reboot */
ASSERT_WP_FLAGS(EC_FLASH_PROTECT_RO_NOW | EC_FLASH_PROTECT_RO_AT_BOOT);
- TEST_ASSERT(flash_physical_erase(CONFIG_FW_RO_OFF,
+ TEST_ASSERT(flash_physical_erase(CONFIG_RO_MEM_OFF,
CONFIG_FLASH_ERASE_SIZE) != EC_SUCCESS);
return EC_SUCCESS;