From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2D13C21F2AF7A for ; Thu, 28 Sep 2017 01:46:29 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Sep 2017 01:49:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,449,1500966000"; d="scan'208";a="154297180" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga005.jf.intel.com with ESMTP; 28 Sep 2017 01:49:40 -0700 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 28 Sep 2017 01:49:39 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 28 Sep 2017 01:49:39 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by shsmsx102.ccr.corp.intel.com ([169.254.2.175]) with mapi id 14.03.0319.002; Thu, 28 Sep 2017 16:49:37 +0800 From: "Ni, Ruiyu" To: "Wu, Hao A" , "edk2-devel@lists.01.org" CC: "Carsey, Jaben" Thread-Topic: [PATCH v2] ShellPkg/dh: Add the 'dh' dump support for Partition Info protocol Thread-Index: AQHTODRv04mieV8Mi0qSJn/OBqesWaLJ/JeA Date: Thu, 28 Sep 2017 08:49:36 +0000 Deferred-Delivery: Thu, 28 Sep 2017 08:49:00 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5BA6EB8C@SHSMSX103.ccr.corp.intel.com> References: <20170928083259.3776-1-hao.a.wu@intel.com> In-Reply-To: <20170928083259.3776-1-hao.a.wu@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v2] ShellPkg/dh: Add the 'dh' dump support for Partition Info protocol X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Sep 2017 08:46:29 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ruiyu Ni Thanks/Ray > -----Original Message----- > From: Wu, Hao A > Sent: Thursday, September 28, 2017 4:33 PM > To: edk2-devel@lists.01.org > Cc: Wu, Hao A ; Ni, Ruiyu ; Carse= y, > Jaben > Subject: [PATCH v2] ShellPkg/dh: Add the 'dh' dump support for Partition = Info > protocol >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D655 >=20 > V2 change: > Put some strings into the UNI file for localization. >=20 > The dump information will include: > a. The type of the partition (Mbr, Gpt or Other); b. Whether the partitio= n is an > EFI System Partition. >=20 > Cc: Ruiyu Ni > Cc: Jaben Carsey > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Hao Wu > --- > .../UefiHandleParsingLib/UefiHandleParsingLib.c | 86 > ++++++++++++++++++++++ > .../UefiHandleParsingLib/UefiHandleParsingLib.h | 1 + > .../UefiHandleParsingLib/UefiHandleParsingLib.inf | 1 > + .../UefiHandleParsingLib/UefiHandleParsingLib.uni | 9 +++ > 4 files changed, 97 insertions(+) >=20 > diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c > b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c > index d12466c7b0..a228226623 100644 > --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c > +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c > @@ -1933,6 +1933,87 @@ ERROR_EXIT: > return NULL; > } >=20 > +/** > + Function to dump information about Partition Information protocol. > + > + This will allocate the return buffer from boot services pool. > + > + @param[in] TheHandle The handle that has the protocol installed. > + @param[in] Verbose TRUE for additional information, FALSE other= wise. > + > + @retval A pointer to a string containing the information. > +**/ > +CHAR16* > +EFIAPI > +PartitionInfoProtocolDumpInformation ( > + IN CONST EFI_HANDLE TheHandle, > + IN CONST BOOLEAN Verbose > + ) > +{ > + EFI_STATUS Status; > + EFI_PARTITION_INFO_PROTOCOL *PartitionInfo; > + CHAR16 *PartitionType; > + CHAR16 *EfiSystemPartition; > + CHAR16 *RetVal; > + > + if (!Verbose) { > + return NULL; > + } > + > + Status =3D gBS->OpenProtocol ( > + TheHandle, > + &gEfiPartitionInfoProtocolGuid, > + (VOID**)&PartitionInfo, > + gImageHandle, > + NULL, > + EFI_OPEN_PROTOCOL_GET_PROTOCOL > + ); > + if (EFI_ERROR (Status)) { > + return NULL; > + } > + > + HandleParsingHiiInit (); > + > + switch (PartitionInfo->Type) { > + case PARTITION_TYPE_OTHER: > + PartitionType =3D HiiGetString (mHandleParsingHiiHandle, > STRING_TOKEN(STR_PARTINFO_DUMP_TYPE_OTHER), NULL); > + break; > + case PARTITION_TYPE_MBR: > + PartitionType =3D HiiGetString (mHandleParsingHiiHandle, > STRING_TOKEN(STR_PARTINFO_DUMP_TYPE_MBR), NULL); > + break; > + case PARTITION_TYPE_GPT: > + PartitionType =3D HiiGetString (mHandleParsingHiiHandle, > STRING_TOKEN(STR_PARTINFO_DUMP_TYPE_GPT), NULL); > + break; > + default: > + PartitionType =3D NULL; > + break; > + } > + if (PartitionType =3D=3D NULL) { > + return NULL; > + } > + > + if (PartitionInfo->System =3D=3D 1) { > + EfiSystemPartition =3D HiiGetString (mHandleParsingHiiHandle, > + STRING_TOKEN(STR_PARTINFO_DUMP_EFI_SYS_PART), NULL); } else { > + EfiSystemPartition =3D HiiGetString (mHandleParsingHiiHandle, > + STRING_TOKEN(STR_PARTINFO_DUMP_NOT_EFI_SYS_PART), NULL); } if > + (EfiSystemPartition =3D=3D NULL) { > + SHELL_FREE_NON_NULL (PartitionType); > + return NULL; > + } > + > + RetVal =3D CatSPrint ( > + NULL, > + L"%s\r\n%s", > + PartitionType, > + EfiSystemPartition > + ); > + > + SHELL_FREE_NON_NULL (EfiSystemPartition); > + SHELL_FREE_NON_NULL (PartitionType); > + return RetVal; > +} > + > // > // Put the information on the NT32 protocol GUIDs here so we are not > dependant on the Nt32Pkg // @@ -2147,6 +2228,11 @@ STATIC CONST > GUID_INFO_BLOCK mGuidStringList[] =3D { > {STRING_TOKEN(STR_ADAPTER_INFO), > &gEfiAdapterInformationProtocolGuid, > AdapterInformationDumpInformation}, >=20 > // > +// UEFI 2.7 > +// > + {STRING_TOKEN(STR_PARTITION_INFO), &gEfiPartitionInfoProtocolGu= id, > PartitionInfoProtocolDumpInformation}, > + > +// > // PI Spec ones > // > {STRING_TOKEN(STR_IDE_CONT_INIT), > &gEfiIdeControllerInitProtocolGuid, NULL}, > diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h > b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h > index cf849658aa..68bb00c620 100644 > --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h > +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h > @@ -138,6 +138,7 @@ > #include #include > #include > +#include >=20 > #include > #include > diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.i= nf > b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf > index 4c1c3d3846..ee1b85552b 100644 > --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf > +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf > @@ -292,6 +292,7 @@ > gEfiHttpProtocolGuid ## UNDEFINED > gEfiHttpUtilitiesProtocolGuid ## UNDEFINED > gEfiRestProtocolGuid ## UNDEFINED > + gEfiPartitionInfoProtocolGuid ## CONSUMES >=20 > [Guids] > gEfiFileInfoGuid ## UNDEFINED > diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.u= ni > b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni > index f49ca94623..be583aa742 100644 > --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni > +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni > @@ -152,6 +152,9 @@ > #string STR_SHELL #language en-US "Shell" > #string STR_SHELL_DYNAMIC #language en-US "ShellDynamicCommand" >=20 > +// Partition Information > +#string STR_PARTITION_INFO #language en-US "PartitionInformation" > + > #string STR_EFI_GLOBAL_VARIABLE #language en-US "EFIGlobalVariable" >=20 > // NT32 emulation > @@ -478,3 +481,9 @@ > = " > AttributesSetting : %%H%s%%N\r\n" > = " > Compatibilities : %%H0x%L016x%%N\r\n" > = " > LowestSupportedImageVersion : %%H0x%08x%%N\r\n" > + > +#string STR_PARTINFO_DUMP_TYPE_OTHER #language en-US " Partition > Type : Other" > +#string STR_PARTINFO_DUMP_TYPE_MBR #language en-US " Partition > Type : MBR" > +#string STR_PARTINFO_DUMP_TYPE_GPT #language en-US " Partition > Type : GPT" > +#string STR_PARTINFO_DUMP_EFI_SYS_PART #language en-US " EFI Syste= m > Partition : Yes" > +#string STR_PARTINFO_DUMP_NOT_EFI_SYS_PART #language en-US " EFI > System Partition : No" > -- > 2.12.0.windows.1