summaryrefslogtreecommitdiffstats
path: root/disk
diff options
context:
space:
mode:
authorLei Wen <leiwen@marvell.com>2011-09-07 18:11:19 +0000
committerWolfgang Denk <wd@denx.de>2011-10-06 20:42:47 +0200
commit6eecc0307927fee1ff70151980b3a8c02ffeb947 (patch)
tree993d7a66609a4efe874c0acec18cae749a39f97d /disk
parent9f8765805400db65b44c3edb68a638f17dd8399d (diff)
downloadtalos-obmc-uboot-6eecc0307927fee1ff70151980b3a8c02ffeb947.tar.gz
talos-obmc-uboot-6eecc0307927fee1ff70151980b3a8c02ffeb947.zip
part: show efi partition name when print out partition info
Previous output: Marvell>> mmc part Partition Map for MMC device 1 -- Partition Type: EFI Part Start LBA End LBA gpt1 0x8C00 0xCBFF gpt2 0xCC00 0x57BFF gpt3 0x57C00 0xA2BFF gpt4 0xA2C00 0xECBFDE With the patch, the output becomes: Marvell>> mmc part Partition Map for MMC device 1 -- Partition Type: EFI Part Name Start LBA End LBA 1 ramdisk 0x00008C00 0x0000CBFF 2 system 0x0000CC00 0x00057BFF 3 userdata 0x00057C00 0x000A2BFF 4 remaining 0x000A2C00 0x00ECBFDE Signed-off-by: Lei Wen <leiwen@marvell.com>
Diffstat (limited to 'disk')
-rw-r--r--disk/part_efi.c24
-rw-r--r--disk/part_efi.h3
2 files changed, 22 insertions, 5 deletions
diff --git a/disk/part_efi.c b/disk/part_efi.c
index 1b04c27cea..0a513c6ed0 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -35,6 +35,7 @@
#include <ide.h>
#include <malloc.h>
#include "part_efi.h"
+#include <linux/ctype.h>
#if defined(CONFIG_CMD_IDE) || \
defined(CONFIG_CMD_MG_DISK) || \
@@ -99,6 +100,20 @@ static gpt_entry *alloc_read_gpt_entries(block_dev_desc_t * dev_desc,
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)
*/
@@ -122,12 +137,12 @@ void print_part_efi(block_dev_desc_t * dev_desc)
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 {
@@ -169,7 +184,8 @@ int get_partition_info_efi(block_dev_desc_t * dev_desc, int part,
- 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__,
diff --git a/disk/part_efi.h b/disk/part_efi.h
index 6bbb06bde9..5903e7c812 100644
--- a/disk/part_efi.h
+++ b/disk/part_efi.h
@@ -117,13 +117,14 @@ typedef struct _gpt_entry_attributes {
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;
OpenPOWER on IntegriCloud