summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGovindraj Raja <govindraj.raja@arm.com>2023-10-16 09:30:16 -0500
committerGovindraj Raja <govindraj.raja@arm.com>2023-10-27 08:31:54 -0500
commit3e6d245772ccb4b43f1ba6cd9d1bb8abe86a516c (patch)
treea61e327b13b66831d9fc10a60cb51542db768e4d
parent1051606c3df3b5a0ebd4e4dad1e5e4a57e2f4d69 (diff)
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>
-rw-r--r--plat/arm/common/fconf/arm_fconf_io.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/plat/arm/common/fconf/arm_fconf_io.c b/plat/arm/common/fconf/arm_fconf_io.c
index 27acc3a64..8fe8c3372 100644
--- a/plat/arm/common/fconf/arm_fconf_io.c
+++ b/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] = {