From 2a1325206da5381292c2b268e248702c523cc927 Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Wed, 22 Aug 2012 16:16:26 +0200 Subject: Initial Toradex Colibri T20 L4T R15 support. --- disk/part_efi.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'disk/part_efi.c') diff --git a/disk/part_efi.c b/disk/part_efi.c index 2fef7e7b41..2d7a7b85d7 100644 --- a/disk/part_efi.c +++ b/disk/part_efi.c @@ -125,8 +125,17 @@ void print_part_efi(block_dev_desc_t * dev_desc) /* This function validates AND fills in the GPT header and PTE */ if (is_gpt_valid(dev_desc, GPT_PRIMARY_PARTITION_TABLE_LBA, gpt_head, &gpt_pte) != 1) { - printf("%s: *** ERROR: Invalid GPT ***\n", __func__); - goto failure; + printf("%s: *** ERROR: Invalid Primary GPT ***\n", __func__); + /* Testing secondary GPT */ + if(is_gpt_valid(dev_desc, dev_desc->lba - 1, + gpt_head, &gpt_pte) != 1) { + printf("%s: *** ERROR: Invalid Secondary GPT ***\n", __func__); + goto failure; + } + else + { + /* Fix primary GPT here */ + } } debug("%s: gpt-entry at %p\n", __func__, gpt_pte); @@ -175,9 +184,18 @@ int get_partition_info_efi(block_dev_desc_t * dev_desc, int part, /* This function validates AND fills in the GPT header and PTE */ if (is_gpt_valid(dev_desc, GPT_PRIMARY_PARTITION_TABLE_LBA, gpt_head, &gpt_pte) != 1) { - printf("%s: *** ERROR: Invalid GPT ***\n", __func__); - err = -1; - goto failure; + printf("%s: *** ERROR: Invalid Primary GPT ***\n", __func__); + /* Testing secondary GPT */ + if(is_gpt_valid(dev_desc, dev_desc->lba-1, + gpt_head, &gpt_pte) != 1) { + printf("%s: *** ERROR: Invalid Secondary GPT ***\n", __func__); + err = -1; + goto failure; + } + else + { + /* Fix primary GPT here */ + } } /* The ulong casting limits the maximum disk size to 2 TB */ @@ -398,6 +416,8 @@ static gpt_entry *alloc_read_gpt_entries(block_dev_desc_t * dev_desc, le32_to_int(pgpt_head->num_partition_entries), le32_to_int(pgpt_head->sizeof_partition_entry), count); + /* Set count to be a multiple of 512 */ + count = ((count+GPT_BLOCK_SIZE-1) / GPT_BLOCK_SIZE) * GPT_BLOCK_SIZE; /* Allocate memory for PTE, remember to FREE */ if (count != 0) { pte = memalign(CACHE_LINE_SIZE, count); -- cgit v1.2.3