SFDP: Move handling of no sector map into `if`

When a flash chip's SFDP table has no sector map, we treat the whole
flash as a single region. As an optimization, this should only be
done if there is indeed no sector map.
pull/14983/head
Lingkai Dong 2021-08-04 11:33:04 +01:00
parent 06c9799db4
commit 68694255b5
1 changed files with 5 additions and 4 deletions

View File

@ -239,12 +239,13 @@ int sfdp_parse_sector_map_table(Callback<int(bd_addr_t, void *, bd_size_t)> sfdp
// Default set to all type bits 1-4 are common
int min_common_erase_type_bits = SFDP_ERASE_BITMASK_ALL;
// If there's no region map, we have a single region sized the entire device size
sfdp_info.smptbl.region_size[0] = sfdp_info.bptbl.device_size_bytes;
sfdp_info.smptbl.region_high_boundary[0] = sfdp_info.bptbl.device_size_bytes - 1;
if (!sfdp_info.smptbl.addr || !sfdp_info.smptbl.size) {
tr_debug("No Sector Map Table");
// If there's no sector map, we have a single region sized the entire device size
sfdp_info.smptbl.region_size[0] = sfdp_info.bptbl.device_size_bytes;
sfdp_info.smptbl.region_high_boundary[0] = sfdp_info.bptbl.device_size_bytes - 1;
return MBED_SUCCESS;
}