Browse Source

feat(arm): add IO policy to use backup gpt header

Add a IO block spec to use GPT backup header if primary fails.
Currently we use only the primary gpt header which is in the second
block(LBA-1) after the MBR block(LBA-0) so we restrict IO access to
primary gpt header and its entries.

But we plan to use backup GPT which is the last block of the
partition (LBA-n) in case our primary GPT header fails verification
or is corrupted.

Offset and length of the block spec will be updated runtime from
partition driver after parsing MBR data.

Change-Id: Id1d49841d6f4cbcc3248af19faf2fbd8e24a8ba1
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
pull/1993/merge
Govindraj Raja 1 year ago
parent
commit
3e6d245772
  1. 17
      plat/arm/common/fconf/arm_fconf_io.c

17
plat/arm/common/fconf/arm_fconf_io.c

@ -50,6 +50,18 @@ static const io_block_spec_t gpt_spec = {
.length = PLAT_PARTITION_BLOCK_SIZE *
(PLAT_PARTITION_MAX_ENTRIES / 4 + 2),
};
/*
* length will be assigned at runtime based on MBR header data.
* Backup GPT Header is present in Last LBA-1 and its entries
* are last 32 blocks starts at LBA-33, On runtime update these
* before device usage. Update offset to beginning LBA-33 and
* length to LBA-33.
*/
static io_block_spec_t bkup_gpt_spec = {
.offset = PLAT_ARM_FLASH_IMAGE_BASE,
.length = 0,
};
#endif /* ARM_GPT_SUPPORT */
const io_uuid_spec_t arm_uuid_spec[MAX_NUMBER_IDS] = {
@ -107,6 +119,11 @@ struct plat_io_policy policies[MAX_NUMBER_IDS] = {
(uintptr_t)&gpt_spec,
open_memmap
},
[BKUP_GPT_IMAGE_ID] = {
&memmap_dev_handle,
(uintptr_t)&bkup_gpt_spec,
open_memmap
},
#endif /* ARM_GPT_SUPPORT */
#if PSA_FWU_SUPPORT
[FWU_METADATA_IMAGE_ID] = {

Loading…
Cancel
Save