diff options
-rw-r--r-- | common/system.c | 6 | ||||
-rw-r--r-- | common/vboot_hash.c | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/common/system.c b/common/system.c index 3d3d3d24cd..fa79b909a1 100644 --- a/common/system.c +++ b/common/system.c @@ -336,9 +336,9 @@ test_mockable enum system_image_copy_t system_get_image_copy(void) int system_get_image_used(enum system_image_copy_t copy) { #ifndef CONFIG_MAPPED_STORAGE - int image_offset; uint8_t buf[SPI_FLASH_MAX_WRITE_SIZE]; #endif + int image_offset; const uint8_t *image; int size; size = get_size(copy); @@ -350,10 +350,10 @@ int system_get_image_used(enum system_image_copy_t copy) * last byte of the image. See ec.lds.S for how this is inserted at * the end of the image. */ -#ifndef CONFIG_MAPPED_STORAGE image_offset = (copy == SYSTEM_IMAGE_RW) ? CONFIG_EC_WRITABLE_STORAGE_OFF + CONFIG_RW_STORAGE_OFF : CONFIG_EC_PROTECTED_STORAGE_OFF + CONFIG_RO_STORAGE_OFF; +#ifndef CONFIG_MAPPED_STORAGE image = buf; do { @@ -368,7 +368,7 @@ int system_get_image_used(enum system_image_copy_t copy) } while (*image != 0xea); #else - image = (const uint8_t *)get_program_memory_addr(copy); + image = (const uint8_t *)(image_offset + CONFIG_MAPPED_STORAGE_BASE); for (size--; size > 0 && image[size] != 0xea; size--) ; #endif diff --git a/common/vboot_hash.c b/common/vboot_hash.c index e90fe50b07..42d1a0f11c 100644 --- a/common/vboot_hash.c +++ b/common/vboot_hash.c @@ -112,7 +112,7 @@ static void vboot_hash_next_chunk(void) size = MIN(CHUNK_SIZE, data_size - curr_pos); #ifdef CONFIG_MAPPED_STORAGE - SHA256_update(&ctx, (const uint8_t *)(CONFIG_PROGRAM_MEMORY_BASE + + SHA256_update(&ctx, (const uint8_t *)(CONFIG_MAPPED_STORAGE_BASE + data_offset + curr_pos), size); #else if (read_and_hash_chunk(data_offset + curr_pos, size) != EC_SUCCESS) |