#include <ide.h>
 #include <malloc.h>
 #include "part_efi.h"
+#include <linux/ctype.h>
 
 #if defined(CONFIG_CMD_IDE) || \
     defined(CONFIG_CMD_MG_DISK) || \
 
 static int is_pte_valid(gpt_entry * pte);
 
+static char *print_efiname(gpt_entry *pte)
+{
+       static char name[PARTNAME_SZ + 1];
+       int i;
+       for (i = 0; i < PARTNAME_SZ; i++) {
+               u8 c;
+               c = pte->partition_name[i] & 0xff;
+               c = (c && !isprint(c)) ? '.' : c;
+               name[i] = c;
+       }
+       name[PARTNAME_SZ] = 0;
+       return name;
+}
+
 /*
  * Public Functions (include/part.h)
  */
 
        debug("%s: gpt-entry at 0x%08X\n", __FUNCTION__, (unsigned int)*pgpt_pte);
 
-       printf("Part  Start LBA  End LBA\n");
+       printf("Part\tName\t\t\tStart LBA\tEnd LBA\n");
        for (i = 0; i < le32_to_int(gpt_head.num_partition_entries); i++) {
 
                if (is_pte_valid(&(*pgpt_pte)[i])) {
-                       printf("%s%d  0x%llX    0x%llX\n", GPT_ENTRY_NAME,
-                               (i + 1),
+                       printf("%3d\t%-18s\t0x%08llX\t0x%08llX\n", (i + 1),
+                               print_efiname(&(*pgpt_pte)[i]),
                                le64_to_int((*pgpt_pte)[i].starting_lba),
                                le64_to_int((*pgpt_pte)[i].ending_lba));
                } else {
                     - info->start;
        info->blksz = GPT_BLOCK_SIZE;
 
-       sprintf((char *)info->name, "%s%d", GPT_ENTRY_NAME, part);
+       sprintf((char *)info->name, "%s",
+                       print_efiname(&(*pgpt_pte)[part - 1]));
        sprintf((char *)info->type, "U-Boot");
 
        debug("%s: start 0x%lX, size 0x%lX, name %s", __FUNCTION__,
 
        unsigned long long type_guid_specific:16;
 } __attribute__ ((packed)) gpt_entry_attributes;
 
+#define PARTNAME_SZ    (72 / sizeof(efi_char16_t))
 typedef struct _gpt_entry {
        efi_guid_t partition_type_guid;
        efi_guid_t unique_partition_guid;
        unsigned char starting_lba[8];
        unsigned char ending_lba[8];
        gpt_entry_attributes attributes;
-       efi_char16_t partition_name[72 / sizeof(efi_char16_t)];
+       efi_char16_t partition_name[PARTNAME_SZ];
 }
 __attribute__ ((packed)) gpt_entry;