]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
disk: part_efi: print partition UUIDs
authorStephen Warren <swarren@nvidia.com>
Mon, 8 Oct 2012 08:14:34 +0000 (08:14 +0000)
committerTom Rini <trini@ti.com>
Wed, 17 Oct 2012 14:59:10 +0000 (07:59 -0700)
When printing the partition table, print the partition type UUID and the
individual partition UUID. Do this unconditionally, since partition UUIDs
are useful.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
disk/part_efi.c

index b6b2bf505ec344dcc62eede180e0a4335234b6f4..6b80cd98d4c3ada00a4e8c5ffc07cde986028c55 100644 (file)
@@ -113,6 +113,26 @@ static char *print_efiname(gpt_entry *pte)
        return name;
 }
 
        return name;
 }
 
+static void uuid_string(unsigned char *uuid, char *str)
+{
+       static const u8 le[16] = {3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11,
+                                 12, 13, 14, 15};
+       int i;
+
+       for (i = 0; i < 16; i++) {
+               sprintf(str, "%02x", uuid[le[i]]);
+               str += 2;
+               switch (i) {
+               case 3:
+               case 5:
+               case 7:
+               case 9:
+                       *str++ = '-';
+                       break;
+               }
+       }
+}
+
 /*
  * Public Functions (include/part.h)
  */
 /*
  * Public Functions (include/part.h)
  */
@@ -122,6 +142,7 @@ void print_part_efi(block_dev_desc_t * dev_desc)
        ALLOC_CACHE_ALIGN_BUFFER(gpt_header, gpt_head, 1);
        gpt_entry *gpt_pte = NULL;
        int i = 0;
        ALLOC_CACHE_ALIGN_BUFFER(gpt_header, gpt_head, 1);
        gpt_entry *gpt_pte = NULL;
        int i = 0;
+       char uuid[37];
 
        if (!dev_desc) {
                printf("%s: Invalid Argument(s)\n", __func__);
 
        if (!dev_desc) {
                printf("%s: Invalid Argument(s)\n", __func__);
@@ -137,6 +158,9 @@ void print_part_efi(block_dev_desc_t * dev_desc)
        debug("%s: gpt-entry at %p\n", __func__, gpt_pte);
 
        printf("Part\tStart LBA\tEnd LBA\t\tName\n");
        debug("%s: gpt-entry at %p\n", __func__, gpt_pte);
 
        printf("Part\tStart LBA\tEnd LBA\t\tName\n");
+       printf("\tType UUID\n");
+       printf("\tPartition UUID\n");
+
        for (i = 0; i < le32_to_int(gpt_head->num_partition_entries); i++) {
                /* Stop at the first non valid PTE */
                if (!is_pte_valid(&gpt_pte[i]))
        for (i = 0; i < le32_to_int(gpt_head->num_partition_entries); i++) {
                /* Stop at the first non valid PTE */
                if (!is_pte_valid(&gpt_pte[i]))
@@ -146,6 +170,10 @@ void print_part_efi(block_dev_desc_t * dev_desc)
                        le64_to_int(gpt_pte[i].starting_lba),
                        le64_to_int(gpt_pte[i].ending_lba),
                        print_efiname(&gpt_pte[i]));
                        le64_to_int(gpt_pte[i].starting_lba),
                        le64_to_int(gpt_pte[i].ending_lba),
                        print_efiname(&gpt_pte[i]));
+               uuid_string(gpt_pte[i].partition_type_guid.b, uuid);
+               printf("\ttype:\t%s\n", uuid);
+               uuid_string(gpt_pte[i].unique_partition_guid.b, uuid);
+               printf("\tuuid:\t%s\n", uuid);
        }
 
        /* Remember to free pte */
        }
 
        /* Remember to free pte */
@@ -153,28 +181,6 @@ void print_part_efi(block_dev_desc_t * dev_desc)
        return;
 }
 
        return;
 }
 
-#ifdef CONFIG_PARTITION_UUIDS
-static void uuid_string(unsigned char *uuid, char *str)
-{
-       static const u8 le[16] = {3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11,
-                                 12, 13, 14, 15};
-       int i;
-
-       for (i = 0; i < 16; i++) {
-               sprintf(str, "%02x", uuid[le[i]]);
-               str += 2;
-               switch (i) {
-               case 3:
-               case 5:
-               case 7:
-               case 9:
-                       *str++ = '-';
-                       break;
-               }
-       }
-}
-#endif
-
 int get_partition_info_efi(block_dev_desc_t * dev_desc, int part,
                                disk_partition_t * info)
 {
 int get_partition_info_efi(block_dev_desc_t * dev_desc, int part,
                                disk_partition_t * info)
 {