Skip to content

Commit 6869425

Browse files
committed
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.
1 parent 06c9799 commit 6869425

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

storage/blockdevice/source/SFDP.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,13 @@ int sfdp_parse_sector_map_table(Callback<int(bd_addr_t, void *, bd_size_t)> sfdp
239239
// Default set to all type bits 1-4 are common
240240
int min_common_erase_type_bits = SFDP_ERASE_BITMASK_ALL;
241241

242-
// If there's no region map, we have a single region sized the entire device size
243-
sfdp_info.smptbl.region_size[0] = sfdp_info.bptbl.device_size_bytes;
244-
sfdp_info.smptbl.region_high_boundary[0] = sfdp_info.bptbl.device_size_bytes - 1;
245-
246242
if (!sfdp_info.smptbl.addr || !sfdp_info.smptbl.size) {
247243
tr_debug("No Sector Map Table");
244+
245+
// If there's no sector map, we have a single region sized the entire device size
246+
sfdp_info.smptbl.region_size[0] = sfdp_info.bptbl.device_size_bytes;
247+
sfdp_info.smptbl.region_high_boundary[0] = sfdp_info.bptbl.device_size_bytes - 1;
248+
248249
return MBED_SUCCESS;
249250
}
250251

0 commit comments

Comments
 (0)