diff options
Diffstat (limited to 'common/flash.c')
-rw-r--r-- | common/flash.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/common/flash.c b/common/flash.c index 235121f51e..ab3cd23df0 100644 --- a/common/flash.c +++ b/common/flash.c @@ -218,9 +218,9 @@ int flash_bank_start_offset(int bank) static int flash_range_ok(int offset, int size_req, int align) { if (offset < 0 || size_req < 0 || - offset > CONFIG_FLASH_SIZE || - size_req > CONFIG_FLASH_SIZE || - offset + size_req > CONFIG_FLASH_SIZE || + offset > CONFIG_FLASH_SIZE_BYTES || + size_req > CONFIG_FLASH_SIZE_BYTES || + offset + size_req > CONFIG_FLASH_SIZE_BYTES || (offset | size_req) & (align - 1)) return 0; /* Invalid range */ @@ -251,7 +251,7 @@ int flash_dataptr(int offset, int size_req, int align, const char **ptrp) if (ptrp) *ptrp = flash_physical_dataptr(offset); - return CONFIG_FLASH_SIZE - offset; + return CONFIG_FLASH_SIZE_BYTES - offset; } #endif @@ -979,7 +979,7 @@ static int command_flash_info(int argc, char **argv) { int i, flags; - ccprintf("Usable: %4d KB\n", CONFIG_FLASH_SIZE / 1024); + ccprintf("Usable: %4d KB\n", CONFIG_FLASH_SIZE_BYTES / 1024); ccprintf("Write: %4d B (ideal %d B)\n", CONFIG_FLASH_WRITE_SIZE, CONFIG_FLASH_WRITE_IDEAL_SIZE); #ifdef CONFIG_FLASH_MULTIPLE_REGION @@ -1234,7 +1234,7 @@ static enum ec_status flash_command_get_info(struct host_cmd_handler_args *args) #error "Flash: Bank size expected bigger or equal to erase size." #endif struct ec_flash_bank single_bank = { - .count = CONFIG_FLASH_SIZE / CONFIG_FLASH_BANK_SIZE, + .count = CONFIG_FLASH_SIZE_BYTES / CONFIG_FLASH_BANK_SIZE, .size_exp = __fls(CONFIG_FLASH_BANK_SIZE), .write_size_exp = __fls(CONFIG_FLASH_WRITE_SIZE), .erase_size_exp = __fls(CONFIG_FLASH_ERASE_SIZE), @@ -1265,7 +1265,8 @@ static enum ec_status flash_command_get_info(struct host_cmd_handler_args *args) if (args->version >= 2) { args->response_size = sizeof(struct ec_response_flash_info_2); - r_2->flash_size = CONFIG_FLASH_SIZE - EC_FLASH_REGION_START; + r_2->flash_size = + CONFIG_FLASH_SIZE_BYTES - EC_FLASH_REGION_START; #if (CONFIG_FLASH_ERASED_VALUE32 == 0) r_2->flags = EC_FLASH_INFO_ERASE_TO_0; #else @@ -1285,7 +1286,7 @@ static enum ec_status flash_command_get_info(struct host_cmd_handler_args *args) #ifdef CONFIG_FLASH_MULTIPLE_REGION return EC_RES_INVALID_PARAM; #else - r_1->flash_size = CONFIG_FLASH_SIZE - EC_FLASH_REGION_START; + r_1->flash_size = CONFIG_FLASH_SIZE_BYTES - EC_FLASH_REGION_START; r_1->flags = 0; r_1->write_block_size = CONFIG_FLASH_WRITE_SIZE; r_1->erase_block_size = CONFIG_FLASH_ERASE_SIZE; |