From patchwork Wed Sep 7 11:17:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Wen X-Patchwork-Id: 113741 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 265D3B6F86 for ; Wed, 7 Sep 2011 21:17:19 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7035E280C3; Wed, 7 Sep 2011 13:17:17 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ru4ybUiuLu9P; Wed, 7 Sep 2011 13:17:16 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id F148B280A1; Wed, 7 Sep 2011 13:17:13 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E51A2280A1 for ; Wed, 7 Sep 2011 13:17:10 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xwXQMnjxiVaJ for ; Wed, 7 Sep 2011 13:17:09 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from dakia2.marvell.com (dakia2.marvell.com [65.219.4.35]) by theia.denx.de (Postfix) with ESMTPS id 5075728099 for ; Wed, 7 Sep 2011 13:17:07 +0200 (CEST) X-ASG-Debug-ID: 1315394225-082e6a850001-4l7tJC Received: from maili.marvell.com (maili.marvell.com [10.68.76.51]) by dakia2.marvell.com with ESMTP id E5xKu126eKqXSJpI for ; Wed, 07 Sep 2011 04:17:05 -0700 (PDT) X-Barracuda-Envelope-From: leiwen@marvell.com Received: from localhost (sh4-dt.marvell.com [10.38.164.102]) by maili.marvell.com (Postfix) with ESMTP id B65B08A002 for ; Wed, 7 Sep 2011 04:17:04 -0700 (PDT) From: Lei Wen To: u-boot@lists.denx.de X-ASG-Orig-Subj: [PATCH] part: show efi partition name when print out partition info Date: Wed, 7 Sep 2011 04:17:03 -0700 X-ASG-Orig-Subj: [PATCH] part: show efi partition name when print out partition info Message-Id: <1315394223-12399-1-git-send-email-leiwen@marvell.com> X-Mailer: git-send-email 1.7.0.4 X-Barracuda-Connect: maili.marvell.com[10.68.76.51] X-Barracuda-Start-Time: 1315394225 X-Barracuda-URL: http://10.68.76.222:80/cgi-mod/mark.cgi X-Barracuda-Spam-Score: -1002.00 X-Barracuda-Spam-Status: No, SCORE=-1002.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=1000.0 Subject: [U-Boot] [PATCH] part: show efi partition name when print out partition info X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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 --- disk/part_efi.c | 24 ++++++++++++++++++++---- 1 files changed, 20 insertions(+), 4 deletions(-) diff --git a/disk/part_efi.c b/disk/part_efi.c index 1b04c27..9e2a0dd 100644 --- a/disk/part_efi.c +++ b/disk/part_efi.c @@ -35,6 +35,7 @@ #include #include #include "part_efi.h" +#include #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[37]; + int i; + for (i = 0; i < 37; i++) { + u8 c; + c = pte->partition_name[i] & 0xff; + c = (c && !isprint(c)) ? '!' : c; + name[i] = c; + } + name[36] = 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\t\tName\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("%2d\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__,