diff options
-rw-r--r-- | chip/npcx/config_flash_layout.h | 13 | ||||
-rw-r--r-- | common/rwsig.c | 4 | ||||
-rw-r--r-- | include/rwsig.h | 18 |
3 files changed, 22 insertions, 13 deletions
diff --git a/chip/npcx/config_flash_layout.h b/chip/npcx/config_flash_layout.h index 5ba56610a8..602bdbdc5e 100644 --- a/chip/npcx/config_flash_layout.h +++ b/chip/npcx/config_flash_layout.h @@ -47,17 +47,20 @@ #define CONFIG_WP_STORAGE_OFF CONFIG_EC_PROTECTED_STORAGE_OFF #define CONFIG_WP_STORAGE_SIZE CONFIG_EC_PROTECTED_STORAGE_SIZE -/* RO firmware offset in flash */ +/* RO firmware in program memory - use all of program memory */ #define CONFIG_RO_MEM_OFF 0 #define CONFIG_RO_SIZE NPCX_PROGRAM_MEMORY_SIZE -/* RW firmware offset in flash */ -#define CONFIG_RW_MEM_OFF CONFIG_EC_WRITABLE_STORAGE_OFF + \ - CONFIG_RW_STORAGE_OFF +/* + * RW firmware in program memory - Identical to RO, only one image loaded at + * a time. + */ +#define CONFIG_RW_MEM_OFF CONFIG_RO_MEM_OFF #define CONFIG_RW_SIZE CONFIG_RO_SIZE -/* The storage offset of ec.R*.flat which is used for firmware_image.lds */ +/* RO image resides at start of protected region, right after header */ #define CONFIG_RO_STORAGE_OFF CONFIG_RO_HDR_SIZE +/* RW image resides at start of writable region */ #define CONFIG_RW_STORAGE_OFF 0 #endif /* __CROS_EC_CONFIG_FLASH_LAYOUT_H */ diff --git a/common/rwsig.c b/common/rwsig.c index 4efca2cb20..2d978e8e06 100644 --- a/common/rwsig.c +++ b/common/rwsig.c @@ -27,6 +27,10 @@ #define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args) #define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args) +#if !defined(CONFIG_MAPPED_STORAGE) +#error rwsig implementation assumes mem-mapped storage. +#endif + /* RW firmware reset vector */ static uint32_t * const rw_rst = (uint32_t *)(CONFIG_PROGRAM_MEMORY_BASE + CONFIG_RW_MEM_OFF + 4); diff --git a/include/rwsig.h b/include/rwsig.h index bb70077732..765ac09ec5 100644 --- a/include/rwsig.h +++ b/include/rwsig.h @@ -77,10 +77,11 @@ void rwsig_jump_now(void); #endif /* ! CONFIG_RO_PUBKEY_SIZE */ #ifndef CONFIG_RO_PUBKEY_ADDR #ifdef CONFIG_RWSIG_TYPE_RWSIG -/* The pubkey goes at the end of the RO region */ -#define CONFIG_RO_PUBKEY_ADDR (CONFIG_PROGRAM_MEMORY_BASE \ - + CONFIG_RO_MEM_OFF \ - + CONFIG_RO_SIZE \ +/* The pubkey resides at the end of the RO image */ +#define CONFIG_RO_PUBKEY_ADDR (CONFIG_PROGRAM_MEMORY_BASE \ + + CONFIG_EC_PROTECTED_STORAGE_OFF \ + + CONFIG_RO_STORAGE_OFF \ + + CONFIG_RO_SIZE \ - CONFIG_RO_PUBKEY_SIZE) #else /* @@ -105,10 +106,11 @@ void rwsig_jump_now(void); #endif #endif /* ! CONFIG_RW_SIG_SIZE */ #ifndef CONFIG_RW_SIG_ADDR -/* The signature goes at the end of the RW region */ -#define CONFIG_RW_SIG_ADDR (CONFIG_PROGRAM_MEMORY_BASE \ - + CONFIG_RW_MEM_OFF \ - + CONFIG_RW_SIZE \ +/* The signature resides at the end of the RW image */ +#define CONFIG_RW_SIG_ADDR (CONFIG_PROGRAM_MEMORY_BASE \ + + CONFIG_EC_WRITABLE_STORAGE_OFF \ + + CONFIG_RW_STORAGE_OFF \ + + CONFIG_RW_SIZE \ - CONFIG_RW_SIG_SIZE) #endif /* !CONFIG_RW_SIG_ADDR */ |