aboutsummaryrefslogtreecommitdiff
path: root/disk
diff options
context:
space:
mode:
authorSteve Rae <srae@broadcom.com>2014-05-05 13:00:08 -0700
committerTom Rini <trini@ti.com>2014-05-12 15:20:05 -0400
commitae95fad5af3793ae804b4390727e0f431e5514d7 (patch)
tree65de51deeb3eef975b9f593f1cb9f36c1d3a1dbb /disk
parentfa39ffe5d61bd7f34b2ff579f5f6bb8f92a6b9b1 (diff)
downloadu-boot-ae95fad5af3793ae804b4390727e0f431e5514d7.zip
u-boot-ae95fad5af3793ae804b4390727e0f431e5514d7.tar.gz
u-boot-ae95fad5af3793ae804b4390727e0f431e5514d7.tar.bz2
disk: part_efi: add support for the Backup GPT
Check the Backup GPT table if the Primary GPT table is invalid. Renamed "Secondary GPT" to "Backup GPT" as per: UEFI Specification (Version 2.3.1, Errata A) Signed-off-by: Steve Rae <srae@broadcom.com>
Diffstat (limited to 'disk')
-rw-r--r--disk/part_efi.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/disk/part_efi.c b/disk/part_efi.c
index 216a292..c74b7b9 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -93,7 +93,15 @@ void print_part_efi(block_dev_desc_t * dev_desc)
if (is_gpt_valid(dev_desc, GPT_PRIMARY_PARTITION_TABLE_LBA,
gpt_head, &gpt_pte) != 1) {
printf("%s: *** ERROR: Invalid GPT ***\n", __func__);
- return;
+ if (is_gpt_valid(dev_desc, (dev_desc->lba - 1),
+ gpt_head, &gpt_pte) != 1) {
+ printf("%s: *** ERROR: Invalid Backup GPT ***\n",
+ __func__);
+ return;
+ } else {
+ printf("%s: *** Using Backup GPT ***\n",
+ __func__);
+ }
}
debug("%s: gpt-entry at %p\n", __func__, gpt_pte);
@@ -142,7 +150,15 @@ int get_partition_info_efi(block_dev_desc_t * dev_desc, int part,
if (is_gpt_valid(dev_desc, GPT_PRIMARY_PARTITION_TABLE_LBA,
gpt_head, &gpt_pte) != 1) {
printf("%s: *** ERROR: Invalid GPT ***\n", __func__);
- return -1;
+ if (is_gpt_valid(dev_desc, (dev_desc->lba - 1),
+ gpt_head, &gpt_pte) != 1) {
+ printf("%s: *** ERROR: Invalid Backup GPT ***\n",
+ __func__);
+ return -1;
+ } else {
+ printf("%s: *** Using Backup GPT ***\n",
+ __func__);
+ }
}
if (part > le32_to_cpu(gpt_head->num_partition_entries) ||
@@ -252,7 +268,7 @@ int write_gpt_table(block_dev_desc_t *dev_desc,
!= pte_blk_cnt)
goto err;
- /* recalculate the values for the Second GPT Header */
+ /* recalculate the values for the Backup GPT Header */
val = le64_to_cpu(gpt_h->my_lba);
gpt_h->my_lba = gpt_h->alternate_lba;
gpt_h->alternate_lba = cpu_to_le64(val);