summaryrefslogtreecommitdiffstats
path: root/disk/part_efi.c
diff options
context:
space:
mode:
authorSteve Rae <srae@broadcom.com>2014-05-26 11:52:24 -0700
committerTom Rini <trini@ti.com>2014-06-05 14:44:56 -0400
commit60bf94169366acaf7dafeb30d7439af366f2c585 (patch)
tree93b5ecb5562f8945fc97b12f1140d11dd985b347 /disk/part_efi.c
parente04350d2991ed628587e94b5b6d89c24f439e172 (diff)
downloadblackbird-obmc-uboot-60bf94169366acaf7dafeb30d7439af366f2c585.tar.gz
blackbird-obmc-uboot-60bf94169366acaf7dafeb30d7439af366f2c585.zip
disk: part_efi: add get_partition_info_efi_by_name()
Add function to find a GPT table entry by name. Tested on little endian ARMv7 and ARMv8 configurations Signed-off-by: Steve Rae <srae@broadcom.com>
Diffstat (limited to 'disk/part_efi.c')
-rw-r--r--disk/part_efi.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/disk/part_efi.c b/disk/part_efi.c
index 78a37829f0..612f0926b6 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -181,7 +181,7 @@ int get_partition_info_efi(block_dev_desc_t * dev_desc, int part,
UUID_STR_FORMAT_GUID);
#endif
- debug("%s: start 0x" LBAF ", size 0x" LBAF ", name %s", __func__,
+ debug("%s: start 0x" LBAF ", size 0x" LBAF ", name %s\n", __func__,
info->start, info->size, info->name);
/* Remember to free pte */
@@ -189,6 +189,25 @@ int get_partition_info_efi(block_dev_desc_t * dev_desc, int part,
return 0;
}
+int get_partition_info_efi_by_name(block_dev_desc_t *dev_desc,
+ const char *name, disk_partition_t *info)
+{
+ int ret;
+ int i;
+ for (i = 1; i < GPT_ENTRY_NUMBERS; i++) {
+ ret = get_partition_info_efi(dev_desc, i, info);
+ if (ret != 0) {
+ /* no more entries in table */
+ return -1;
+ }
+ if (strcmp(name, (const char *)info->name) == 0) {
+ /* matched */
+ return 0;
+ }
+ }
+ return -2;
+}
+
int test_part_efi(block_dev_desc_t * dev_desc)
{
ALLOC_CACHE_ALIGN_BUFFER_PAD(legacy_mbr, legacymbr, 1, dev_desc->blksz);
OpenPOWER on IntegriCloud