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=jaben.carsey@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 2647C21A1099D for ; Mon, 27 Nov 2017 06:54:50 -0800 (PST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Nov 2017 06:59:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,465,1505804400"; d="scan'208";a="181095395" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga006.fm.intel.com with ESMTP; 27 Nov 2017 06:59:12 -0800 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 27 Nov 2017 06:59:12 -0800 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.117]) by fmsmsx156.amr.corp.intel.com ([169.254.13.63]) with mapi id 14.03.0319.002; Mon, 27 Nov 2017 06:59:11 -0800 From: "Carsey, Jaben" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" CC: "Kinney, Michael D" Thread-Topic: [PATCH v2 3/3] ShellPkg/dp: Convert from NULL class library to Dynamic Command Thread-Index: AQHTZ0Rdv+g9RpBrl0yxjNQP8yx4iaMoUf5g Date: Mon, 27 Nov 2017 14:59:11 +0000 Message-ID: References: <20171127055532.320556-1-ruiyu.ni@intel.com> <20171127055532.320556-4-ruiyu.ni@intel.com> In-Reply-To: <20171127055532.320556-4-ruiyu.ni@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNmM5OThmYmQtMDMzOS00YjNiLThjOTctNWE2ODk1OGU0NGJhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6Ik1FTFpWdWRsTWJwSnJ3UUhmd1BSazdBUnVidXFcL3oyaDByMzZDRTVYQ1wvTT0ifQ== x-ctpclassification: CTP_IC x-originating-ip: [10.1.200.108] MIME-Version: 1.0 Subject: Re: [PATCH v2 3/3] ShellPkg/dp: Convert from NULL class library to Dynamic Command 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: Mon, 27 Nov 2017 14:54:51 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jaben Carsey > -----Original Message----- > From: Ni, Ruiyu > Sent: Sunday, November 26, 2017 9:56 PM > To: edk2-devel@lists.01.org > Cc: Carsey, Jaben ; Kinney, Michael D > > Subject: [PATCH v2 3/3] ShellPkg/dp: Convert from NULL class library to > Dynamic Command > Importance: High >=20 > UEFI Shell spec defines Shell Dynamic Command protocol which is just > for the purpose to extend internal command. > So dp command is changed from NULL class library to be a driver > producing DynamicCommand protocol. >=20 > The guideline is: > 1. Only use NULL class library for Shell spec defined commands. > 2. New commands can be provided as not only a standalone application > but also a dynamic command. So it can be used either as an > internal command, but also as a standalone application. >=20 > DpApp.inf is to provide a standalone application. > DpDynamicCommand.inf is to provide a standalone driver producing > Dynamic Command protocol. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ruiyu Ni > Cc: Jaben Carsey > Cc: Michael D Kinney > --- > .../DpDynamicCommand}/Dp.c | 100 +++++++---- > .../DpDynamicCommand}/Dp.h | 63 ++++++- > .../DpDynamicCommand/Dp.uni} | 0 > ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.c | 53 ++++++ > ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf | 73 > +++++++++ > .../DpDynamicCommand/DpDynamicCommand.c | 130 > +++++++++++++++ > .../DpDynamicCommand/DpDynamicCommand.inf | 78 +++++++++ > .../DpDynamicCommand}/DpInternal.h | 2 +- > .../DpDynamicCommand}/DpProfile.c | 34 ++-- > .../DpDynamicCommand}/DpTrace.c | 182 ++++++++++-----= ------ > .../DpDynamicCommand}/DpUtilities.c | 44 +++-- > .../DpDynamicCommand}/Literals.c | 0 > .../DpDynamicCommand}/Literals.h | 0 > .../DpDynamicCommand}/PerformanceTokens.h | 0 > ShellPkg/Library/UefiDpLib/Readme.txt | 2 - > ShellPkg/Library/UefiDpLib/UefiDpLib.c | 101 ------------ > ShellPkg/Library/UefiDpLib/UefiDpLib.h | 64 -------- > ShellPkg/Library/UefiDpLib/UefiDpLib.inf | 77 --------- > ShellPkg/ShellPkg.dsc | 17 +- > 19 files changed, 605 insertions(+), 415 deletions(-) > rename ShellPkg/{Library/UefiDpLib =3D> > DynamicCommand/DpDynamicCommand}/Dp.c (84%) > rename ShellPkg/{Library/UefiDpLib =3D> > DynamicCommand/DpDynamicCommand}/Dp.h (70%) > rename ShellPkg/{Library/UefiDpLib/UefiDpLib.uni =3D> > DynamicCommand/DpDynamicCommand/Dp.uni} (100%) > create mode 100644 > ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.c > create mode 100644 > ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf > create mode 100644 > ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.c > create mode 100644 > ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf > rename ShellPkg/{Library/UefiDpLib =3D> > DynamicCommand/DpDynamicCommand}/DpInternal.h (96%) > rename ShellPkg/{Library/UefiDpLib =3D> > DynamicCommand/DpDynamicCommand}/DpProfile.c (87%) > rename ShellPkg/{Library/UefiDpLib =3D> > DynamicCommand/DpDynamicCommand}/DpTrace.c (89%) > rename ShellPkg/{Library/UefiDpLib =3D> > DynamicCommand/DpDynamicCommand}/DpUtilities.c (87%) > rename ShellPkg/{Library/UefiDpLib =3D> > DynamicCommand/DpDynamicCommand}/Literals.c (100%) > rename ShellPkg/{Library/UefiDpLib =3D> > DynamicCommand/DpDynamicCommand}/Literals.h (100%) > rename ShellPkg/{Library/UefiDpLib =3D> > DynamicCommand/DpDynamicCommand}/PerformanceTokens.h (100%) > delete mode 100644 ShellPkg/Library/UefiDpLib/Readme.txt > delete mode 100644 ShellPkg/Library/UefiDpLib/UefiDpLib.c > delete mode 100644 ShellPkg/Library/UefiDpLib/UefiDpLib.h > delete mode 100644 ShellPkg/Library/UefiDpLib/UefiDpLib.inf >=20 > diff --git a/ShellPkg/Library/UefiDpLib/Dp.c > b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c > similarity index 84% > rename from ShellPkg/Library/UefiDpLib/Dp.c > rename to ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c > index 94fa61c710..3ecc753d0c 100644 > --- a/ShellPkg/Library/UefiDpLib/Dp.c > +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c > @@ -24,20 +24,13 @@ > WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > **/ >=20 > -#include "UefiDpLib.h" > -#include > -#include > -#include > -#include > -#include > - > -#include > - > #include "PerformanceTokens.h" > #include "Dp.h" > #include "Literals.h" > #include "DpInternal.h" >=20 > +EFI_HANDLE mDpHiiHandle; > + > // > /// Module-Global Variables > ///@{ > @@ -89,18 +82,18 @@ DumpStatistics( void ) > { > EFI_STRING StringPtr; > EFI_STRING StringPtrUnknown; > - StringPtr =3D HiiGetString (gDpHiiHandle, STRING_TOKEN > (STR_DP_SECTION_STATISTICS), NULL); > - StringPtrUnknown =3D HiiGetString (gDpHiiHandle, STRING_TOKEN > (STR_ALIT_UNKNOWN), NULL); > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), > gDpHiiHandle, > + StringPtr =3D HiiGetString (mDpHiiHandle, STRING_TOKEN > (STR_DP_SECTION_STATISTICS), NULL); > + StringPtrUnknown =3D HiiGetString (mDpHiiHandle, STRING_TOKEN > (STR_ALIT_UNKNOWN), NULL); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), > mDpHiiHandle, > (StringPtr =3D=3D NULL) ? StringPtrUnknown : StringPtr); > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMTRACE), > gDpHiiHandle, SummaryData.NumTrace); > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_STATS_NUMINCOMPLETE), gDpHiiHandle, > SummaryData.NumIncomplete); > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_STATS_NUMPHASES), gDpHiiHandle, > SummaryData.NumSummary); > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_STATS_NUMHANDLES), gDpHiiHandle, > SummaryData.NumHandles, SummaryData.NumTrace - > SummaryData.NumHandles); > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMPEIMS), > gDpHiiHandle, SummaryData.NumPEIMs); > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_STATS_NUMGLOBALS), gDpHiiHandle, > SummaryData.NumGlobal); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_STATS_NUMTRACE), mDpHiiHandle, SummaryData.NumTrace); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_STATS_NUMINCOMPLETE), mDpHiiHandle, > SummaryData.NumIncomplete); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_STATS_NUMPHASES), mDpHiiHandle, > SummaryData.NumSummary); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_STATS_NUMHANDLES), mDpHiiHandle, > SummaryData.NumHandles, SummaryData.NumTrace - > SummaryData.NumHandles); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_STATS_NUMPEIMS), mDpHiiHandle, SummaryData.NumPEIMs); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_STATS_NUMGLOBALS), mDpHiiHandle, > SummaryData.NumGlobal); > #if PROFILING_IMPLEMENTED > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_STATS_NUMPROFILE), gDpHiiHandle, SummaryData.NumProfile); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_STATS_NUMPROFILE), mDpHiiHandle, > SummaryData.NumProfile); > #endif // PROFILING_IMPLEMENTED > SHELL_FREE_NON_NULL (StringPtr); > SHELL_FREE_NON_NULL (StringPtrUnknown); > @@ -137,8 +130,7 @@ InitCumulativeData ( > @retval value Unknown error. > **/ > SHELL_STATUS > -EFIAPI > -ShellCommandRunDp ( > +RunDp ( > IN EFI_HANDLE ImageHandle, > IN EFI_SYSTEM_TABLE *SystemTable > ) > @@ -182,15 +174,12 @@ ShellCommandRunDp ( > Status =3D ShellInitialize(); > ASSERT_EFI_ERROR(Status); >=20 > - Status =3D CommandInit(); > - ASSERT_EFI_ERROR(Status); > - > // > // Process Command Line arguments > // > Status =3D ShellCommandLineParse (ParamList, &ParamPackage, NULL, > TRUE); > if (EFI_ERROR(Status)) { > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_INVALID_ARG), > gDpHiiHandle); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_INVALID_ARG), > mDpHiiHandle); > return SHELL_INVALID_PARAMETER; > } >=20 > @@ -273,7 +262,7 @@ ShellCommandRunDp ( > // > Status =3D EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid, > (VOID **) &PerformanceProperty); > if (EFI_ERROR (Status) || (PerformanceProperty =3D=3D NULL)) { > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_PERF_PROPERTY_NOT_FOUND), gDpHiiHandle); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_PERF_PROPERTY_NOT_FOUND), mDpHiiHandle); > goto Done; > } >=20 > @@ -288,22 +277,22 @@ ShellCommandRunDp ( > // Print header > // > // print DP's build version > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_BUILD_REVISION), > gDpHiiHandle, DP_MAJOR_VERSION, DP_MINOR_VERSION); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_BUILD_REVISION), > mDpHiiHandle, DP_MAJOR_VERSION, DP_MINOR_VERSION); >=20 > // print performance timer characteristics > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_KHZ), gDpHiiHandle= , > TimerInfo.Frequency); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_KHZ), > mDpHiiHandle, TimerInfo.Frequency); >=20 > if (VerboseMode && !RawMode) { > - StringPtr =3D HiiGetString (gDpHiiHandle, > + StringPtr =3D HiiGetString (mDpHiiHandle, > (EFI_STRING_ID) (TimerInfo.CountUp ? STRING_TOKEN > (STR_DP_UP) : STRING_TOKEN (STR_DP_DOWN)), NULL); > ASSERT (StringPtr !=3D NULL); > // Print Timer count range and direction > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_TIMER_PROPERTIES), gDpHiiHandle, > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_TIMER_PROPERTIES), mDpHiiHandle, > StringPtr, > TimerInfo.StartCount, > TimerInfo.EndCount > ); > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_VERBOSE_THRESHOLD), gDpHiiHandle, mInterestThreshold); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_VERBOSE_THRESHOLD), mDpHiiHandle, mInterestThreshold); > } >=20 >=20 > /********************************************************** > ****************** > @@ -398,3 +387,52 @@ Done: >=20 > return ShellStatus; > } > + > + > +/** > + Retrive HII package list from ImageHandle and publish to HII database. > + > + @param ImageHandle The image handle of the process. > + > + @return HII handle. > +**/ > +EFI_HANDLE > +InitializeHiiPackage ( > + EFI_HANDLE ImageHandle > + ) > +{ > + EFI_STATUS Status; > + EFI_HII_PACKAGE_LIST_HEADER *PackageList; > + EFI_HANDLE HiiHandle; > + > + // > + // Retrieve HII package list from ImageHandle > + // > + Status =3D gBS->OpenProtocol ( > + ImageHandle, > + &gEfiHiiPackageListProtocolGuid, > + (VOID **)&PackageList, > + ImageHandle, > + NULL, > + EFI_OPEN_PROTOCOL_GET_PROTOCOL > + ); > + ASSERT_EFI_ERROR (Status); > + if (EFI_ERROR (Status)) { > + return NULL; > + } > + > + // > + // Publish HII package list to HII Database. > + // > + Status =3D gHiiDatabase->NewPackageList ( > + gHiiDatabase, > + PackageList, > + NULL, > + &HiiHandle > + ); > + ASSERT_EFI_ERROR (Status); > + if (EFI_ERROR (Status)) { > + return NULL; > + } > + return HiiHandle; > +} > diff --git a/ShellPkg/Library/UefiDpLib/Dp.h > b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h > similarity index 70% > rename from ShellPkg/Library/UefiDpLib/Dp.h > rename to ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h > index 06fee3bcf4..4027b6b84e 100644 > --- a/ShellPkg/Library/UefiDpLib/Dp.h > +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h > @@ -1,7 +1,7 @@ > /** @file > - Common declarations for the Dp Performance Reporting Utility. > + Header file for 'dp' command functions. >=20 > - Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved. > + Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved. > This program and the accompanying materials > are licensed and made available under the terms and conditions of the = BSD > License > which accompanies this distribution. The full text of the license may= be > found at > @@ -9,12 +9,37 @@ >=20 > THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > BASIS, > WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > + > **/ >=20 > -#ifndef _EFI_APP_DP_H_ > -#define _EFI_APP_DP_H_ > +#ifndef _DP_H_ > +#define _DP_H_ > + > + > +#include > + > +#include >=20 > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > #include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +extern EFI_HANDLE mDpHiiHandle; >=20 > #define DP_MAJOR_VERSION 2 > #define DP_MINOR_VERSION 4 > @@ -94,4 +119,32 @@ typedef struct { > UINT32 Count; ///< Number of measurements ac= cumulated. > } PROFILE_RECORD; >=20 > -#endif // _EFI_APP_DP_H_ > +/** > + Dump performance data. > + > + @param[in] ImageHandle The image handle. > + @param[in] SystemTable The system table. > + > + @retval SHELL_SUCCESS Command completed successfully. > + @retval SHELL_INVALID_PARAMETER Command usage error. > + @retval SHELL_ABORTED The user aborts the operation. > + @retval value Unknown error. > +**/ > +SHELL_STATUS > +RunDp ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ); > + > +/** > + Retrive HII package list from ImageHandle and publish to HII database. > + > + @param ImageHandle The image handle of the process. > + > + @return HII handle. > +**/ > +EFI_HANDLE > +InitializeHiiPackage ( > + EFI_HANDLE ImageHandle > + ); > +#endif // _DP_H_ > diff --git a/ShellPkg/Library/UefiDpLib/UefiDpLib.uni > b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.uni > similarity index 100% > rename from ShellPkg/Library/UefiDpLib/UefiDpLib.uni > rename to ShellPkg/DynamicCommand/DpDynamicCommand/Dp.uni > diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.c > b/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.c > new file mode 100644 > index 0000000000..f96209b27a > --- /dev/null > +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.c > @@ -0,0 +1,53 @@ > +/** @file > + Entrypoint of "dp" shell standalone application. > + > + Copyright (c) 2017, Intel Corporation. All rights reserved.
> + > + This program and the accompanying materials > + are licensed and made available under the terms and conditions of the = BSD > License > + which accompanies this distribution. The full text of the license may= be > found at > + http://opensource.org/licenses/bsd-license.php > + > + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > BASIS, > + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > + > +**/ > +#include "Dp.h" > + > +// > +// String token ID of help message text. > +// Shell supports to find help message in the resource section of an > application image if > +// .MAN file is not found. This global variable is added to make build t= ool > recognizes > +// that the help string is consumed by user and then build tool will add= the > string into > +// the resource section. Thus the application can use '-?' option to sho= w > help message in > +// Shell. > +// > +GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId > =3D STRING_TOKEN (STR_GET_HELP_DP); > + > +/** > + Entry point of Tftp standalone application. > + > + @param ImageHandle The image handle of the process. > + @param SystemTable The EFI System Table pointer. > + > + @retval EFI_SUCCESS Tftp command is executed sucessfully. > + @retval EFI_ABORTED HII package was failed to initialize. > + @retval others Other errors when executing tftp command= . > +**/ > +EFI_STATUS > +EFIAPI > +DpAppInitialize ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + EFI_STATUS Status; > + mDpHiiHandle =3D InitializeHiiPackage (ImageHandle); > + if (mDpHiiHandle =3D=3D NULL) { > + return EFI_ABORTED; > + } > + > + Status =3D (EFI_STATUS)RunDp (ImageHandle, SystemTable); > + HiiRemovePackages (mDpHiiHandle); > + return Status; > +} > diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf > b/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf > new file mode 100644 > index 0000000000..b0ed229b49 > --- /dev/null > +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf > @@ -0,0 +1,73 @@ > +## @file > +# Provides Shell 'dp' standalone application. > +# > +# Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved. > +# This program and the accompanying materials > +# are licensed and made available under the terms and conditions of the > BSD License > +# which accompanies this distribution. The full text of the license may= be > found at > +# http://opensource.org/licenses/bsd-license.php > +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > BASIS, > +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > +# > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010006 > + BASE_NAME =3D dp > + FILE_GUID =3D 1831A379-2D48-45BD-9744-D4059D93815= D > + MODULE_TYPE =3D UEFI_APPLICATION > + VERSION_STRING =3D 1.0 > + ENTRY_POINT =3D DpAppInitialize > +# > +# This flag specifies whether HII resource section is generated into PE > image. > +# > + UEFI_HII_RESOURCE_SECTION =3D TRUE > + > +[Sources.common] > + PerformanceTokens.h > + Dp.uni > + Dp.c > + Dp.h > + Literals.h > + Literals.c > + DpInternal.h > + DpUtilities.c > + DpTrace.c > + DpProfile.c > + DpApp.c > + > +[Packages] > + MdePkg/MdePkg.dec > + ShellPkg/ShellPkg.dec > + MdeModulePkg/MdeModulePkg.dec > + > +[LibraryClasses] > + MemoryAllocationLib > + BaseLib > + BaseMemoryLib > + DebugLib > + ShellLib > + UefiLib > + UefiRuntimeServicesTableLib > + UefiBootServicesTableLib > + UefiApplicationEntryPoint > + SortLib > + PrintLib > + DevicePathLib > + PerformanceLib > + DxeServicesLib > + PeCoffGetEntryPointLib > + > +[Guids] > + gPerformanceProtocolGuid ## CONSUMES ##= SystemTable > + > +[Protocols] > + gEfiLoadedImageProtocolGuid ## CONSUMES > + gEfiDriverBindingProtocolGuid ## SOMETIMES_C= ONSUMES > + gEfiComponentName2ProtocolGuid ## > SOMETIMES_CONSUMES > + gEfiLoadedImageDevicePathProtocolGuid ## > SOMETIMES_CONSUMES > + gEfiHiiPackageListProtocolGuid ## CONSUMES > + > +[Pcd] > + gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize ## > CONSUMES > diff --git > a/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand. > c > b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand. > c > new file mode 100644 > index 0000000000..6f3997fff4 > --- /dev/null > +++ > b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand. > c > @@ -0,0 +1,130 @@ > +/** @file > + Produce "dp" shell dynamic command. > + > + Copyright (c) 2017, Intel Corporation. All rights reserved.
> + > + This program and the accompanying materials > + are licensed and made available under the terms and conditions of the = BSD > License > + which accompanies this distribution. The full text of the license may= be > found at > + http://opensource.org/licenses/bsd-license.php > + > + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > BASIS, > + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > + > +**/ > +#include "Dp.h" > +#include > + > +/** > + This is the shell command handler function pointer callback type. Thi= s > + function handles the command when it is invoked in the shell. > + > + @param[in] This The instance of the > EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL. > + @param[in] SystemTable The pointer to the system table. > + @param[in] ShellParameters The parameters associated with the > command. > + @param[in] Shell The instance of the shell protocol u= sed in the > context > + of processing this command. > + > + @return EFI_SUCCESS the operation was sucessful > + @return other the operation failed. > +**/ > +SHELL_STATUS > +EFIAPI > +DpCommandHandler ( > + IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This, > + IN EFI_SYSTEM_TABLE *SystemTable, > + IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, > + IN EFI_SHELL_PROTOCOL *Shell > + ) > +{ > + gEfiShellParametersProtocol =3D ShellParameters; > + return RunDp (gImageHandle, SystemTable); > +} > + > +/** > + This is the command help handler function pointer callback type. This > + function is responsible for displaying help information for the associ= ated > + command. > + > + @param[in] This The instance of the > EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL. > + @param[in] Language The pointer to the language string t= o use. > + > + @return string Pool allocated help string, must be = freed by caller > +**/ > +CHAR16 * > +EFIAPI > +DpCommandGetHelp ( > + IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This, > + IN CONST CHAR8 *Language > + ) > +{ > + return HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_GET_HELP_DP), > Language); > +} > + > +EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mDpDynamicCommand =3D { > + L"dp", > + DpCommandHandler, > + DpCommandGetHelp > +}; > + > +/** > + Entry point of Tftp Dynamic Command. > + > + Produce the DynamicCommand protocol to handle "tftp" command. > + > + @param ImageHandle The image handle of the process. > + @param SystemTable The EFI System Table pointer. > + > + @retval EFI_SUCCESS Tftp command is executed sucessfully. > + @retval EFI_ABORTED HII package was failed to initialize. > + @retval others Other errors when executing tftp command= . > +**/ > +EFI_STATUS > +EFIAPI > +DpCommandInitialize ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + EFI_STATUS Status; > + mDpHiiHandle =3D InitializeHiiPackage (ImageHandle); > + if (mDpHiiHandle =3D=3D NULL) { > + return EFI_ABORTED; > + } > + > + Status =3D gBS->InstallProtocolInterface ( > + &ImageHandle, > + &gEfiShellDynamicCommandProtocolGuid, > + EFI_NATIVE_INTERFACE, > + &mDpDynamicCommand > + ); > + ASSERT_EFI_ERROR (Status); > + return Status; > +} > + > +/** > + Tftp driver unload handler. > + > + @param ImageHandle The image handle of the process. > + > + @retval EFI_SUCCESS The image is unloaded. > + @retval Others Failed to unload the image. > +**/ > +EFI_STATUS > +EFIAPI > +DpUnload ( > + IN EFI_HANDLE ImageHandle > +) > +{ > + EFI_STATUS Status; > + Status =3D gBS->UninstallProtocolInterface ( > + ImageHandle, > + &gEfiShellDynamicCommandProtocolGuid, > + &mDpDynamicCommand > + ); > + if (EFI_ERROR (Status)) { > + return Status; > + } > + HiiRemovePackages (mDpHiiHandle); > + return EFI_SUCCESS; > +} > diff --git > a/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.i > nf > b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.i > nf > new file mode 100644 > index 0000000000..3164561958 > --- /dev/null > +++ > b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.i > nf > @@ -0,0 +1,78 @@ > +## @file > +# Provides Shell 'dp' dynamic command. > +# > +# Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved. > +# This program and the accompanying materials > +# are licensed and made available under the terms and conditions of the > BSD License > +# which accompanies this distribution. The full text of the license may= be > found at > +# http://opensource.org/licenses/bsd-license.php > +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > BASIS, > +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > +# > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010006 > + BASE_NAME =3D dpDynamicCommand > + FILE_GUID =3D 0253F9FA-129A-4A8D-B12E-7DC2B637630= 2 > + MODULE_TYPE =3D DXE_DRIVER > + VERSION_STRING =3D 1.0 > + ENTRY_POINT =3D DpCommandInitialize > + UNLOAD_IMAGE =3D DpUnload > +# > +# This flag specifies whether HII resource section is generated into PE > image. > +# > + UEFI_HII_RESOURCE_SECTION =3D TRUE > + > +[Sources.common] > + PerformanceTokens.h > + Dp.uni > + Dp.c > + Dp.h > + Literals.h > + Literals.c > + DpInternal.h > + DpUtilities.c > + DpTrace.c > + DpProfile.c > + DpDynamicCommand.c > + > +[Packages] > + MdePkg/MdePkg.dec > + ShellPkg/ShellPkg.dec > + MdeModulePkg/MdeModulePkg.dec > + > +[LibraryClasses] > + MemoryAllocationLib > + BaseLib > + BaseMemoryLib > + DebugLib > + ShellLib > + UefiLib > + UefiRuntimeServicesTableLib > + UefiBootServicesTableLib > + UefiDriverEntryPoint > + SortLib > + PrintLib > + DevicePathLib > + PerformanceLib > + DxeServicesLib > + PeCoffGetEntryPointLib > + > +[Guids] > + gPerformanceProtocolGuid ## CONSUMES ##= SystemTable > + > +[Protocols] > + gEfiLoadedImageProtocolGuid ## CONSUMES > + gEfiDriverBindingProtocolGuid ## SOMETIMES_C= ONSUMES > + gEfiComponentName2ProtocolGuid ## > SOMETIMES_CONSUMES > + gEfiLoadedImageDevicePathProtocolGuid ## > SOMETIMES_CONSUMES > + gEfiHiiPackageListProtocolGuid ## CONSUMES > + gEfiShellDynamicCommandProtocolGuid ## PRODUCES > + > +[Pcd] > + gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize ## > CONSUMES > + > +[DEPEX] > + TRUE > diff --git a/ShellPkg/Library/UefiDpLib/DpInternal.h > b/ShellPkg/DynamicCommand/DpDynamicCommand/DpInternal.h > similarity index 96% > rename from ShellPkg/Library/UefiDpLib/DpInternal.h > rename to ShellPkg/DynamicCommand/DpDynamicCommand/DpInternal.h > index 6de194aaaa..ece1c23aaf 100644 > --- a/ShellPkg/Library/UefiDpLib/DpInternal.h > +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpInternal.h > @@ -24,7 +24,7 @@ > // > /// Module-Global Variables > ///@{ > -extern EFI_HII_HANDLE gDpHiiHandle; > +extern EFI_HII_HANDLE mDpHiiHandle; > extern CHAR16 mGaugeString[DP_GAUGE_STRING_LENGTH + 1]; > extern CHAR16 mUnicodeToken[DXE_PERFORMANCE_STRING_SIZE]; > extern UINT64 mInterestThreshold; > diff --git a/ShellPkg/Library/UefiDpLib/DpProfile.c > b/ShellPkg/DynamicCommand/DpDynamicCommand/DpProfile.c > similarity index 87% > rename from ShellPkg/Library/UefiDpLib/DpProfile.c > rename to ShellPkg/DynamicCommand/DpDynamicCommand/DpProfile.c > index e4434034c6..af25217dae 100644 > --- a/ShellPkg/Library/UefiDpLib/DpProfile.c > +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpProfile.c > @@ -28,23 +28,23 @@ > #include "Literals.h" > #include "DpInternal.h" >=20 > -/** > +/** > Gather and print ALL Profiling Records. > - > + > Displays all "interesting" Profile measurements in order. > The number of records displayed is controlled by: > - records with a duration less than mInterestThreshold microseconds= are > not displayed. > - No more than Limit records are displayed. A Limit of zero will n= ot limit > the output. > - If the ExcludeFlag is TRUE, records matching entries in the CumDa= ta array > are not > displayed. > - > + > @pre The mInterestThreshold global variable is set to the shortest > duration to be printed. > The mGaugeString and mUnicodeToken global arrays are used for > temporary string storage. > They must not be in use by a calling function. > - > + > @param[in] Limit The number of records to print. Zero is A= LL. > @param[in] ExcludeFlag TRUE to exclude individual Cumulative item= s > from display. > - > + > **/ > VOID > DumpAllProfile( > @@ -55,32 +55,32 @@ DumpAllProfile( > EFI_STRING StringPtr; > EFI_STRING StringPtrUnknown; >=20 > - StringPtrUnknown =3D HiiGetString (gDpHiiHandle, STRING_TOKEN > (STR_ALIT_UNKNOWN), NULL); > - StringPtr =3D HiiGetString (gDpHiiHandle, STRING_TOKEN > (STR_DP_SECTION_PROFILE), NULL); > + StringPtrUnknown =3D HiiGetString (mDpHiiHandle, STRING_TOKEN > (STR_ALIT_UNKNOWN), NULL); > + StringPtr =3D HiiGetString (mDpHiiHandle, STRING_TOKEN > (STR_DP_SECTION_PROFILE), NULL); >=20 > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), > gDpHiiHandle, > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), > mDpHiiHandle, > (StringPtr =3D=3D NULL) ? StringPtrUnknown: StringPtr); > FreePool (StringPtr); > FreePool (StringPtrUnknown); > } >=20 > -/** > +/** > Gather and print Raw Profile Records. > - > + > All Profile measurements with a duration greater than or equal to > mInterestThreshold are printed without interpretation. > - > + > The number of records displayed is controlled by: > - records with a duration less than mInterestThreshold microseconds= are > not displayed. > - No more than Limit records are displayed. A Limit of zero will n= ot limit > the output. > - If the ExcludeFlag is TRUE, records matching entries in the CumDa= ta array > are not > displayed. > - > + > @pre The mInterestThreshold global variable is set to the shortest > duration to be printed. > - > + > @param[in] Limit The number of records to print. Zero is A= LL. > @param[in] ExcludeFlag TRUE to exclude individual Cumulative item= s > from display. > - > + > **/ > VOID > DumpRawProfile( > @@ -91,9 +91,9 @@ DumpRawProfile( > EFI_STRING StringPtr; > EFI_STRING StringPtrUnknown; >=20 > - StringPtrUnknown =3D HiiGetString (gDpHiiHandle, STRING_TOKEN > (STR_ALIT_UNKNOWN), NULL); > - StringPtr =3D HiiGetString (gDpHiiHandle, STRING_TOKEN > (STR_DP_SECTION_RAWPROFILE), NULL); > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), > gDpHiiHandle, > + StringPtrUnknown =3D HiiGetString (mDpHiiHandle, STRING_TOKEN > (STR_ALIT_UNKNOWN), NULL); > + StringPtr =3D HiiGetString (mDpHiiHandle, STRING_TOKEN > (STR_DP_SECTION_RAWPROFILE), NULL); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), > mDpHiiHandle, > (StringPtr =3D=3D NULL) ? StringPtrUnknown: StringPtr); > FreePool (StringPtr); > FreePool (StringPtrUnknown); > diff --git a/ShellPkg/Library/UefiDpLib/DpTrace.c > b/ShellPkg/DynamicCommand/DpDynamicCommand/DpTrace.c > similarity index 89% > rename from ShellPkg/Library/UefiDpLib/DpTrace.c > rename to ShellPkg/DynamicCommand/DpDynamicCommand/DpTrace.c > index 90a71ad91b..bc882be622 100644 > --- a/ShellPkg/Library/UefiDpLib/DpTrace.c > +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpTrace.c > @@ -29,17 +29,17 @@ > #include "Literals.h" > #include "DpInternal.h" >=20 > -/** > +/** > Collect verbose statistics about the logged performance measurements. > - > + > General Summary information for all Trace measurements is gathered and > stored within the SummaryData structure. This information is both > used internally by subsequent reporting functions, and displayed > at the end of verbose reports. > - > + > @pre The SummaryData and CumData structures must be initialized > prior to calling this function. > - > + > @post The SummaryData and CumData structures contain statistics for th= e > current performance logs. >=20 > @@ -118,23 +118,23 @@ GatherStatistics( > } > } >=20 > -/** > +/** > Gather and print ALL Trace Records. > - > + > Displays all "interesting" Trace measurements in order.
> The number of records displayed is controlled by: > - records with a duration less than mInterestThreshold microseconds= are > not displayed. > - No more than Limit records are displayed. A Limit of zero will n= ot limit > the output. > - If the ExcludeFlag is TRUE, records matching entries in the CumDa= ta array > are not > displayed. > - > + > @pre The mInterestThreshold global variable is set to the shortest > duration to be printed. > The mGaugeString and mUnicodeToken global arrays are used for > temporary string storage. > They must not be in use by a calling function. > - > + > @param[in] Limit The number of records to print. Zero is ALL= . > @param[in] ExcludeFlag TRUE to exclude individual Cumulative items = from > display. > - > + > @retval EFI_SUCCESS The operation was successful. > @retval EFI_ABORTED The user aborts the operation. > @return Others from a call to gBS->LocateHandleBuffer()= . > @@ -159,9 +159,9 @@ DumpAllTrace( > EFI_STATUS Status; > EFI_STRING StringPtrUnknown; >=20 > - StringPtrUnknown =3D HiiGetString (gDpHiiHandle, STRING_TOKEN > (STR_ALIT_UNKNOWN), NULL); > - IncFlag =3D HiiGetString (gDpHiiHandle, STRING_TOKEN > (STR_DP_SECTION_ALL), NULL); > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), > gDpHiiHandle, > + StringPtrUnknown =3D HiiGetString (mDpHiiHandle, STRING_TOKEN > (STR_ALIT_UNKNOWN), NULL); > + IncFlag =3D HiiGetString (mDpHiiHandle, STRING_TOKEN > (STR_DP_SECTION_ALL), NULL); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), > mDpHiiHandle, > (IncFlag =3D=3D NULL) ? StringPtrUnknown : IncFlag); > FreePool (StringPtrUnknown); >=20 > @@ -169,7 +169,7 @@ DumpAllTrace( > // > Status =3D gBS->LocateHandleBuffer (AllHandles, NULL, NULL, > &HandleCount, &HandleBuffer); > if (EFI_ERROR (Status)) { > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLES_ERROR), > gDpHiiHandle, Status); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLES_ERROR), > mDpHiiHandle, Status); > } > else { > // We have successfully populated the HandleBuffer > @@ -179,11 +179,11 @@ DumpAllTrace( > // Display driver names in Module field for records with Handles. > // > if (mShowId) { > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_HEADR2), > gDpHiiHandle); > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_DASHES2), > gDpHiiHandle); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_HEADR2), > mDpHiiHandle); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_DASHES2), > mDpHiiHandle); > } else { > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_HEADR), > gDpHiiHandle); > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), > gDpHiiHandle); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_HEADR), > mDpHiiHandle); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), > mDpHiiHandle); > } >=20 > LogEntryKey =3D 0; > @@ -206,10 +206,10 @@ DumpAllTrace( > if (Measurement.EndTimeStamp !=3D 0) { > Duration =3D GetDuration (&Measurement); > ElapsedTime =3D DurationInMicroSeconds ( Duration ); > - IncFlag =3D HiiGetString (gDpHiiHandle, STRING_TOKEN > (STR_DP_COMPLETE), NULL); > + IncFlag =3D HiiGetString (mDpHiiHandle, STRING_TOKEN > (STR_DP_COMPLETE), NULL); > } > else { > - IncFlag =3D HiiGetString (gDpHiiHandle, STRING_TOKEN > (STR_DP_INCOMPLETE), NULL); // Mark incomplete records > + IncFlag =3D HiiGetString (mDpHiiHandle, STRING_TOKEN > (STR_DP_INCOMPLETE), NULL); // Mark incomplete records > } > if (((Measurement.EndTimeStamp !=3D 0) && (ElapsedTime < > mInterestThreshold)) || > ((ExcludeFlag) && (GetCumulativeItem(&Measurement) >=3D 0)) > @@ -240,7 +240,7 @@ DumpAllTrace( > mUnicodeToken[13] =3D 0; >=20 > if (mShowId) { > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_VARS2), > gDpHiiHandle, > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_VARS2), > mDpHiiHandle, > Index, // 1 based, Which measurement record is being prin= ted > IncFlag, > Measurement.Handle, > @@ -250,7 +250,7 @@ DumpAllTrace( > Measurement.Identifier > ); > } else { > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_VARS), > gDpHiiHandle, > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_VARS), > mDpHiiHandle, > Index, // 1 based, Which measurement record is being prin= ted > IncFlag, > Measurement.Handle, > @@ -273,20 +273,20 @@ DumpAllTrace( > return Status; > } >=20 > -/** > +/** > Gather and print Raw Trace Records. > - > + > All Trace measurements with a duration greater than or equal to > mInterestThreshold are printed without interpretation. > - > + > The number of records displayed is controlled by: > - records with a duration less than mInterestThreshold microseconds= are > not displayed. > - No more than Limit records are displayed. A Limit of zero will n= ot limit > the output. > - If the ExcludeFlag is TRUE, records matching entries in the CumDa= ta array > are not > displayed. > - > + > @pre The mInterestThreshold global variable is set to the shortest > duration to be printed. > - > + > @param[in] Limit The number of records to print. Zero is ALL= . > @param[in] ExcludeFlag TRUE to exclude individual Cumulative items = from > display. >=20 > @@ -312,19 +312,19 @@ DumpRawTrace( >=20 > Status =3D EFI_SUCCESS; >=20 > - StringPtrUnknown =3D HiiGetString (gDpHiiHandle, STRING_TOKEN > (STR_ALIT_UNKNOWN), NULL); > - StringPtr =3D HiiGetString (gDpHiiHandle, STRING_TOKEN > (STR_DP_SECTION_RAWTRACE), NULL); > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), > gDpHiiHandle, > + StringPtrUnknown =3D HiiGetString (mDpHiiHandle, STRING_TOKEN > (STR_ALIT_UNKNOWN), NULL); > + StringPtr =3D HiiGetString (mDpHiiHandle, STRING_TOKEN > (STR_DP_SECTION_RAWTRACE), NULL); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), > mDpHiiHandle, > (StringPtr =3D=3D NULL) ? StringPtrUnknown : StringPtr); > FreePool (StringPtr); > FreePool (StringPtrUnknown); >=20 > if (mShowId) { > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_HEADR2), > gDpHiiHandle); > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_DASHES2), > gDpHiiHandle); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_HEADR2), > mDpHiiHandle); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_DASHES2), > mDpHiiHandle); > } else { > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_HEADR), > gDpHiiHandle); > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_DASHES), > gDpHiiHandle); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_HEADR), > mDpHiiHandle); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_DASHES), > mDpHiiHandle); > } >=20 > LogEntryKey =3D 0; > @@ -355,7 +355,7 @@ DumpRawTrace( > ++Count; // Count the number of records printed >=20 > if (mShowId) { > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_VARS2), > gDpHiiHandle, > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_VARS2), > mDpHiiHandle, > Index, // 1 based, Which measurement record is being printe= d > Measurement.Handle, > Measurement.StartTimeStamp, > @@ -365,7 +365,7 @@ DumpRawTrace( > Measurement.Identifier > ); > } else { > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_VARS), > gDpHiiHandle, > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_VARS), > mDpHiiHandle, > Index, // 1 based, Which measurement record is being printe= d > Measurement.Handle, > Measurement.StartTimeStamp, > @@ -382,9 +382,9 @@ DumpRawTrace( > return Status; > } >=20 > -/** > +/** > Gather and print Major Phase metrics. > - > + > **/ > VOID > ProcessPhases( > @@ -412,9 +412,9 @@ ProcessPhases( > // > // Get Execution Phase Statistics > // > - StringPtrUnknown =3D HiiGetString (gDpHiiHandle, STRING_TOKEN > (STR_ALIT_UNKNOWN), NULL); > - StringPtr =3D HiiGetString (gDpHiiHandle, STRING_TOKEN > (STR_DP_SECTION_PHASES), NULL); > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), > gDpHiiHandle, > + StringPtrUnknown =3D HiiGetString (mDpHiiHandle, STRING_TOKEN > (STR_ALIT_UNKNOWN), NULL); > + StringPtr =3D HiiGetString (mDpHiiHandle, STRING_TOKEN > (STR_DP_SECTION_PHASES), NULL); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), > mDpHiiHandle, > (StringPtr =3D=3D NULL) ? StringPtrUnknown : StringPtr); > FreePool (StringPtr); > FreePool (StringPtrUnknown); > @@ -456,7 +456,7 @@ ProcessPhases( > if (SecTime > 0) { > ElapsedTime =3D DurationInMicroSeconds ( SecTime ); // Calculate= elapsed > time in microseconds > Total +=3D DivU64x32 (ElapsedTime, 1000); // Accumulate time in > milliseconds > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SEC_PHASE), > gDpHiiHandle, ElapsedTime); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SEC_PHASE), > mDpHiiHandle, ElapsedTime); > } >=20 > // print PEI phase duration time > @@ -467,7 +467,7 @@ ProcessPhases( > (UINT32)TimerInfo.Frequency > ); > Total +=3D ElapsedTime; > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_PHASE_DURATION), gDpHiiHandle, ALit_PEI, ElapsedTime); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_PHASE_DURATION), mDpHiiHandle, ALit_PEI, ElapsedTime); > } >=20 > // print DXE phase duration time > @@ -478,7 +478,7 @@ ProcessPhases( > (UINT32)TimerInfo.Frequency > ); > Total +=3D ElapsedTime; > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_PHASE_DURATION), gDpHiiHandle, ALit_DXE, ElapsedTime); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_PHASE_DURATION), mDpHiiHandle, ALit_DXE, ElapsedTime); > } >=20 > // print BDS phase duration time > @@ -489,7 +489,7 @@ ProcessPhases( > (UINT32)TimerInfo.Frequency > ); > Total +=3D ElapsedTime; > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_PHASE_DURATION), gDpHiiHandle, ALit_BDS, ElapsedTime); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_PHASE_DURATION), mDpHiiHandle, ALit_BDS, ElapsedTime); > } >=20 > if (BdsTimeoutValue > 0) { > @@ -497,17 +497,17 @@ ProcessPhases( > BdsTimeoutValue, > (UINT32)TimerInfo.Frequency > ); > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PHASE_BDSTO), > gDpHiiHandle, ALit_BdsTO, ElapsedTime); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PHASE_BDSTO), > mDpHiiHandle, ALit_BdsTO, ElapsedTime); > } >=20 > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_TOTAL_DURATION), > gDpHiiHandle, Total); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_TOTAL_DURATION), > mDpHiiHandle, Total); > } >=20 > -/** > +/** > Gather and print Handle data. > - > + > @param[in] ExcludeFlag TRUE to exclude individual Cumulative item= s > from display. > - > + > @retval EFI_SUCCESS The operation was successful. > @retval EFI_ABORTED The user aborts the operation. > @return Others from a call to gBS->LocateHandleBuffer= (). > @@ -529,16 +529,16 @@ ProcessHandles( > EFI_STATUS Status; > EFI_STRING StringPtrUnknown; >=20 > - StringPtrUnknown =3D HiiGetString (gDpHiiHandle, STRING_TOKEN > (STR_ALIT_UNKNOWN), NULL); > - StringPtr =3D HiiGetString (gDpHiiHandle, STRING_TOKEN > (STR_DP_SECTION_DRIVERS), NULL); > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), > gDpHiiHandle, > + StringPtrUnknown =3D HiiGetString (mDpHiiHandle, STRING_TOKEN > (STR_ALIT_UNKNOWN), NULL); > + StringPtr =3D HiiGetString (mDpHiiHandle, STRING_TOKEN > (STR_DP_SECTION_DRIVERS), NULL); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), > mDpHiiHandle, > (StringPtr =3D=3D NULL) ? StringPtrUnknown : StringPtr); > FreePool (StringPtr); > FreePool (StringPtrUnknown); >=20 > Status =3D gBS->LocateHandleBuffer (AllHandles, NULL, NULL, &HandleCou= nt, > &HandleBuffer); > if (EFI_ERROR (Status)) { > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLES_ERROR), > gDpHiiHandle, Status); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLES_ERROR), > mDpHiiHandle, Status); > } > else { > #if DP_DEBUG =3D=3D 2 > @@ -546,11 +546,11 @@ ProcessHandles( > #endif >=20 > if (mShowId) { > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_HANDLE_SECTION2), gDpHiiHandle); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_HANDLE_SECTION2), mDpHiiHandle); > } else { > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_HANDLE_SECTION), gDpHiiHandle); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_HANDLE_SECTION), mDpHiiHandle); > } > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), > gDpHiiHandle); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), > mDpHiiHandle); >=20 > LogEntryKey =3D 0; > Count =3D 0; > @@ -588,7 +588,7 @@ ProcessHandles( > if (mGaugeString[0] !=3D 0) { > // Display the record if it has a valid handle. > if (mShowId) { > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_HANDLE_VARS2), gDpHiiHandle, > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_HANDLE_VARS2), mDpHiiHandle, > Count, // 1 based, Which measurement record is being pr= inted > Index + 1, // 1 based, Which handle is being printed > mGaugeString, > @@ -597,7 +597,7 @@ ProcessHandles( > Measurement.Identifier > ); > } else { > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLE_VAR= S), > gDpHiiHandle, > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLE_VAR= S), > mDpHiiHandle, > Count, // 1 based, Which measurement record is being pr= inted > Index + 1, // 1 based, Which handle is being printed > mGaugeString, > @@ -618,11 +618,11 @@ ProcessHandles( > return Status; > } >=20 > -/** > +/** > Gather and print PEIM data. > - > + > Only prints complete PEIM records > - > + > @retval EFI_SUCCESS The operation was successful. > @retval EFI_ABORTED The user aborts the operation. > **/ > @@ -642,19 +642,19 @@ ProcessPeims( >=20 > Status =3D EFI_SUCCESS; >=20 > - StringPtrUnknown =3D HiiGetString (gDpHiiHandle, STRING_TOKEN > (STR_ALIT_UNKNOWN), NULL); > - StringPtr =3D HiiGetString (gDpHiiHandle, STRING_TOKEN > (STR_DP_SECTION_PEIMS), NULL); > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), > gDpHiiHandle, > + StringPtrUnknown =3D HiiGetString (mDpHiiHandle, STRING_TOKEN > (STR_ALIT_UNKNOWN), NULL); > + StringPtr =3D HiiGetString (mDpHiiHandle, STRING_TOKEN > (STR_DP_SECTION_PEIMS), NULL); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), > mDpHiiHandle, > (StringPtr =3D=3D NULL) ? StringPtrUnknown : StringPtr); > FreePool (StringPtr); > FreePool (StringPtrUnknown); >=20 > if (mShowId) { > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_SECTION2), > gDpHiiHandle); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_SECTION2), > mDpHiiHandle); > } else { > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_SECTION), > gDpHiiHandle); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_SECTION), > mDpHiiHandle); > } > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), > gDpHiiHandle); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), > mDpHiiHandle); > TIndex =3D 0; > LogEntryKey =3D 0; > while ((LogEntryKey =3D GetPerformanceMeasurementEx ( > @@ -678,7 +678,7 @@ ProcessPeims( > if (ElapsedTime >=3D mInterestThreshold) { > // PEIM FILE Handle is the start address of its FFS file that cont= ains its file > guid. > if (mShowId) { > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_VARS2), > gDpHiiHandle, > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_VARS2), > mDpHiiHandle, > TIndex, // 1 based, Which measurement record is being pr= inted > Measurement.Handle, // base address > Measurement.Handle, // file guid > @@ -686,7 +686,7 @@ ProcessPeims( > Measurement.Identifier > ); > } else { > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_VARS), > gDpHiiHandle, > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_VARS), > mDpHiiHandle, > TIndex, // 1 based, Which measurement record is being pr= inted > Measurement.Handle, // base address > Measurement.Handle, // file guid > @@ -702,14 +702,14 @@ ProcessPeims( > return Status; > } >=20 > -/** > +/** > Gather and print global data. > - > + > Strips out incomplete or "Execution Phase" records > Only prints records where Handle is NULL > Increment TIndex for every record, even skipped ones, so that we have = an > indication of every measurement record taken. > - > + > @retval EFI_SUCCESS The operation was successful. > @retval EFI_ABORTED The user aborts the operation. > **/ > @@ -729,19 +729,19 @@ ProcessGlobal( >=20 > Status =3D EFI_SUCCESS; >=20 > - StringPtrUnknown =3D HiiGetString (gDpHiiHandle, STRING_TOKEN > (STR_ALIT_UNKNOWN), NULL); > - StringPtr =3D HiiGetString (gDpHiiHandle, STRING_TOKEN > (STR_DP_SECTION_GENERAL), NULL); > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), > gDpHiiHandle, > + StringPtrUnknown =3D HiiGetString (mDpHiiHandle, STRING_TOKEN > (STR_ALIT_UNKNOWN), NULL); > + StringPtr =3D HiiGetString (mDpHiiHandle, STRING_TOKEN > (STR_DP_SECTION_GENERAL), NULL); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), > mDpHiiHandle, > (StringPtr =3D=3D NULL) ? StringPtrUnknown: StringPtr); > FreePool (StringPtr); > FreePool (StringPtrUnknown); >=20 > if (mShowId) { > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_GLOBAL_SECTION2), gDpHiiHandle); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_GLOBAL_SECTION2), mDpHiiHandle); > } else { > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GLOBAL_SECTION), > gDpHiiHandle); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GLOBAL_SECTION), > mDpHiiHandle); > } > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), > gDpHiiHandle); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), > mDpHiiHandle); >=20 > Index =3D 1; > LogEntryKey =3D 0; > @@ -768,7 +768,7 @@ ProcessGlobal( > ElapsedTime =3D DurationInMicroSeconds ( Duration ); > if (ElapsedTime >=3D mInterestThreshold) { > if (mShowId) { > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_GLOBAL_VARS2), gDpHiiHandle, > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_GLOBAL_VARS2), mDpHiiHandle, > Index, > mGaugeString, > mUnicodeToken, > @@ -776,7 +776,7 @@ ProcessGlobal( > Measurement.Identifier > ); > } else { > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GLOBAL_VA= RS), > gDpHiiHandle, > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_GLOBAL_VARS), mDpHiiHandle, > Index, > mGaugeString, > mUnicodeToken, > @@ -794,9 +794,9 @@ ProcessGlobal( > return Status; > } >=20 > -/** > +/** > Gather and print cumulative data. > - > + > Traverse the measurement records and:
> For each record with a Token listed in the CumData array:
> - Update the instance count and the total, minimum, and maximum > durations. > @@ -818,16 +818,16 @@ ProcessCumulative( > UINTN TIndex; > EFI_STRING StringPtrUnknown; >=20 > - StringPtrUnknown =3D HiiGetString (gDpHiiHandle, STRING_TOKEN > (STR_ALIT_UNKNOWN), NULL); > - StringPtr =3D HiiGetString (gDpHiiHandle, STRING_TOKEN > (STR_DP_SECTION_CUMULATIVE), NULL); > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), > gDpHiiHandle, > + StringPtrUnknown =3D HiiGetString (mDpHiiHandle, STRING_TOKEN > (STR_ALIT_UNKNOWN), NULL); > + StringPtr =3D HiiGetString (mDpHiiHandle, STRING_TOKEN > (STR_DP_SECTION_CUMULATIVE), NULL); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), > mDpHiiHandle, > (StringPtr =3D=3D NULL) ? StringPtrUnknown: StringPtr); > FreePool (StringPtr); > FreePool (StringPtrUnknown); >=20 > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_CUMULATIVE_SECT_1), gDpHiiHandle); > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_CUMULATIVE_SECT_2), gDpHiiHandle); > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), > gDpHiiHandle); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_CUMULATIVE_SECT_1), mDpHiiHandle); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_CUMULATIVE_SECT_2), mDpHiiHandle); > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), > mDpHiiHandle); >=20 > for ( TIndex =3D 0; TIndex < NumCum; ++TIndex) { > if (CumData[TIndex].Count !=3D 0) { > @@ -836,8 +836,8 @@ ProcessCumulative( > Dur =3D DurationInMicroSeconds(CumData[TIndex].Duration); > MaxDur =3D DurationInMicroSeconds(CumData[TIndex].MaxDur); > MinDur =3D DurationInMicroSeconds(CumData[TIndex].MinDur); > - > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_CUMULATIVE_STATS), gDpHiiHandle, > + > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_CUMULATIVE_STATS), mDpHiiHandle, > CumData[TIndex].Name, > CumData[TIndex].Count, > Dur, > @@ -864,7 +864,7 @@ ProcessCumulative( > MaxDur =3D 0; > MinDur =3D 0; > } > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_CUMULATIVE_STATS), gDpHiiHandle, > + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_CUMULATIVE_STATS), mDpHiiHandle, > CustomCumulativeData->Name, > CustomCumulativeData->Count, > Dur, > diff --git a/ShellPkg/Library/UefiDpLib/DpUtilities.c > b/ShellPkg/DynamicCommand/DpDynamicCommand/DpUtilities.c > similarity index 87% > rename from ShellPkg/Library/UefiDpLib/DpUtilities.c > rename to ShellPkg/DynamicCommand/DpDynamicCommand/DpUtilities.c > index c60d27d861..b98ec4b5bd 100644 > --- a/ShellPkg/Library/UefiDpLib/DpUtilities.c > +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpUtilities.c > @@ -196,18 +196,19 @@ DpGetNameFromHandle ( > IN EFI_HANDLE Handle > ) > { > - EFI_STATUS Status; > - EFI_LOADED_IMAGE_PROTOCOL *Image; > - CHAR8 *PdbFileName; > - EFI_DRIVER_BINDING_PROTOCOL *DriverBinding; > - EFI_STRING StringPtr; > - EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath; > - EFI_DEVICE_PATH_PROTOCOL *DevicePath; > - EFI_GUID *NameGuid; > - CHAR16 *NameString; > - UINTN StringSize; > - CHAR8 *PlatformLanguage; > - EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2; > + EFI_STATUS Status; > + EFI_LOADED_IMAGE_PROTOCOL *Image; > + CHAR8 *PdbFileName; > + EFI_DRIVER_BINDING_PROTOCOL *DriverBinding; > + EFI_STRING StringPtr; > + EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath; > + EFI_DEVICE_PATH_PROTOCOL *DevicePath; > + EFI_GUID *NameGuid; > + CHAR16 *NameString; > + UINTN StringSize; > + CHAR8 *PlatformLanguage; > + CHAR8 *BestLanguage; > + EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2; >=20 > Image =3D NULL; > LoadedImageDevicePath =3D NULL; > @@ -259,16 +260,25 @@ DpGetNameFromHandle ( > ); > if (!EFI_ERROR (Status)) { > // > - // Get the current platform language setting > + // Firstly use platform language setting, secondly use driver's firs= t > supported language. > // > - PlatformLanguage =3D GetBestLanguageForDriver(ComponentName2- > >SupportedLanguages, NULL, FALSE); > + GetVariable2 (L"PlatformLang", &gEfiGlobalVariableGuid, > (VOID**)&PlatformLanguage, NULL); > + BestLanguage =3D GetBestLanguage( > + ComponentName2->SupportedLanguages, > + FALSE, > + (PlatformLanguage !=3D NULL) ? PlatformLanguage : "= ", > + ComponentName2->SupportedLanguages, > + NULL > + ); > + SHELL_FREE_NON_NULL (PlatformLanguage); > + > Status =3D ComponentName2->GetDriverName ( > ComponentName2, > - PlatformLanguage !=3D NULL ? PlatformLang= uage : "en-US", > + BestLanguage !=3D NULL ? BestLanguage : "= en-US", > &StringPtr > ); > if (!EFI_ERROR (Status)) { > - SHELL_FREE_NON_NULL (PlatformLanguage); > + SHELL_FREE_NON_NULL (BestLanguage); > StrnCpyS (mGaugeString, DP_GAUGE_STRING_LENGTH + 1, StringPtr, > DP_GAUGE_STRING_LENGTH); > mGaugeString[DP_GAUGE_STRING_LENGTH] =3D 0; > return; > @@ -344,7 +354,7 @@ DpGetNameFromHandle ( > // > // Method 6: Unknown Driver Name > // > - StringPtr =3D HiiGetString (gDpHiiHandle, STRING_TOKEN > (STR_DP_ERROR_NAME), NULL); > + StringPtr =3D HiiGetString (mDpHiiHandle, STRING_TOKEN > (STR_DP_ERROR_NAME), NULL); > ASSERT (StringPtr !=3D NULL); > StrnCpyS (mGaugeString, DP_GAUGE_STRING_LENGTH + 1, StringPtr, > DP_GAUGE_STRING_LENGTH); > FreePool (StringPtr); > diff --git a/ShellPkg/Library/UefiDpLib/Literals.c > b/ShellPkg/DynamicCommand/DpDynamicCommand/Literals.c > similarity index 100% > rename from ShellPkg/Library/UefiDpLib/Literals.c > rename to ShellPkg/DynamicCommand/DpDynamicCommand/Literals.c > diff --git a/ShellPkg/Library/UefiDpLib/Literals.h > b/ShellPkg/DynamicCommand/DpDynamicCommand/Literals.h > similarity index 100% > rename from ShellPkg/Library/UefiDpLib/Literals.h > rename to ShellPkg/DynamicCommand/DpDynamicCommand/Literals.h > diff --git a/ShellPkg/Library/UefiDpLib/PerformanceTokens.h > b/ShellPkg/DynamicCommand/DpDynamicCommand/PerformanceTokens.h > similarity index 100% > rename from ShellPkg/Library/UefiDpLib/PerformanceTokens.h > rename to > ShellPkg/DynamicCommand/DpDynamicCommand/PerformanceTokens.h > diff --git a/ShellPkg/Library/UefiDpLib/Readme.txt > b/ShellPkg/Library/UefiDpLib/Readme.txt > deleted file mode 100644 > index 849efa4360..0000000000 > --- a/ShellPkg/Library/UefiDpLib/Readme.txt > +++ /dev/null > @@ -1,2 +0,0 @@ > -from PerformancePkg\Dp_App > -SVN 13406 > diff --git a/ShellPkg/Library/UefiDpLib/UefiDpLib.c > b/ShellPkg/Library/UefiDpLib/UefiDpLib.c > deleted file mode 100644 > index f3ecfeac7f..0000000000 > --- a/ShellPkg/Library/UefiDpLib/UefiDpLib.c > +++ /dev/null > @@ -1,101 +0,0 @@ > -/** @file > - Main file for NULL named library for install1 shell command functions. > - > - Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved. > - This program and the accompanying materials > - are licensed and made available under the terms and conditions of the = BSD > License > - which accompanies this distribution. The full text of the license may= be > found at > - http://opensource.org/licenses/bsd-license.php > - > - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > BASIS, > - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > - > -**/ > - > -#include "UefiDpLib.h" > - > -STATIC CONST CHAR16 mFileName[] =3D L"ShellCommands"; > -EFI_HANDLE gDpHiiHandle =3D NULL; > - > -#define DP_HII_GUID \ > - { \ > - 0xeb832fd9, 0x9089, 0x4898, { 0x83, 0xc9, 0x41, 0x61, 0x8f, 0x5c, 0x48= , 0xb9 > } \ > - } > - > -EFI_GUID gDpHiiGuid =3D DP_HII_GUID; > - > -/** > - Function to get the filename with help context if HII will not be used= . > - > - @return The filename with help text in it. > -**/ > -CONST CHAR16* > -EFIAPI > -UefiDpLibGetManFileName ( > - VOID > - ) > -{ > - return (mFileName); > -} > - > -/** > - Constructor for the Shell Level 1 Commands library. > - > - Install the handlers for level 1 UEFI Shell 2.0 commands. > - > - @param ImageHandle the image handle of the process > - @param SystemTable the EFI System Table pointer > - > - @retval EFI_SUCCESS the shell command handlers were installed > sucessfully > - @retval EFI_UNSUPPORTED the shell level required was not found. > -**/ > -EFI_STATUS > -EFIAPI > -UefiDpLibConstructor ( > - IN EFI_HANDLE ImageHandle, > - IN EFI_SYSTEM_TABLE *SystemTable > - ) > -{ > - // > - // check our bit of the profiles mask > - // > - if ((PcdGet8(PcdShellProfileMask) & BIT2) =3D=3D 0) { > - return (EFI_SUCCESS); > - } > - > - // > - // 3rd parameter 'HII strings array' must be name of .uni strings file > followed by 'Strings', e.g. mycommands.uni must be > - // specified as 'mycommandsStrings' because the build Autogen process > defines this as a string array for the strings in your > - // .uni file. Examine your Build folder under your package's DEBUG fo= lder > and you will find it defined in a xxxStrDefs.h file. > - // > - gDpHiiHandle =3D HiiAddPackages (&gDpHiiGuid, gImageHandle, > UefiDpLibStrings, NULL); > - if (gDpHiiHandle =3D=3D NULL) { > - return (EFI_DEVICE_ERROR); > - } > - > - // > - // install our shell command handlers that are always installed > - // > - ShellCommandRegisterCommandName(L"dp", ShellCommandRunDp , > UefiDpLibGetManFileName, 0, L"", FALSE, gDpHiiHandle, > STRING_TOKEN(STR_GET_HELP_DP)); > - > - return (EFI_SUCCESS); > -} > - > -/** > - Destructor for the library. free any resources. > - > - @param ImageHandle The image handle of the process. > - @param SystemTable The EFI System Table pointer. > -**/ > -EFI_STATUS > -EFIAPI > -UefiDpLibDestructor ( > - IN EFI_HANDLE ImageHandle, > - IN EFI_SYSTEM_TABLE *SystemTable > - ) > -{ > - if (gDpHiiHandle !=3D NULL) { > - HiiRemovePackages(gDpHiiHandle); > - } > - return (EFI_SUCCESS); > -} > diff --git a/ShellPkg/Library/UefiDpLib/UefiDpLib.h > b/ShellPkg/Library/UefiDpLib/UefiDpLib.h > deleted file mode 100644 > index 283f8337ff..0000000000 > --- a/ShellPkg/Library/UefiDpLib/UefiDpLib.h > +++ /dev/null > @@ -1,64 +0,0 @@ > -/** @file > - Main file for NULL named library for dp command functions. > - > - Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
> - (C) Copyright 2016 Hewlett Packard Enterprise Development LP
> - This program and the accompanying materials > - are licensed and made available under the terms and conditions of the = BSD > License > - which accompanies this distribution. The full text of the license may= be > found at > - http://opensource.org/licenses/bsd-license.php > - > - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > BASIS, > - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > - > -**/ > - > -#ifndef _UEFI_DP_LIB_H_ > -#define _UEFI_DP_LIB_H_ > - > -#include > - > -extern EFI_GUID gDpHiiGuid; > - > -#include > -#include > -#include > -#include > -#include > - > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > - > -extern EFI_HANDLE gDpHiiHandle; > - > -/** > - Function for 'dp' command. > - > - @param[in] ImageHandle Handle to the Image (NULL if Internal). > - @param[in] SystemTable Pointer to the System Table (NULL if Internal)= . > - > - @retval SHELL_SUCCESS Command completed successfully. > - @retval SHELL_INVALID_PARAMETER Command usage error. > - @retval SHELL_ABORTED The user aborts the operation. > - @retval value Unknown error. > -**/ > -SHELL_STATUS > -EFIAPI > -ShellCommandRunDp ( > - IN EFI_HANDLE ImageHandle, > - IN EFI_SYSTEM_TABLE *SystemTable > - ); > - > -#endif > - > diff --git a/ShellPkg/Library/UefiDpLib/UefiDpLib.inf > b/ShellPkg/Library/UefiDpLib/UefiDpLib.inf > deleted file mode 100644 > index 0bce0ce6c9..0000000000 > --- a/ShellPkg/Library/UefiDpLib/UefiDpLib.inf > +++ /dev/null > @@ -1,77 +0,0 @@ > -## @file > -# Display Performance Application, Module information file. > -# > -# Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved. > -# This program and the accompanying materials > -# are licensed and made available under the terms and conditions of the > BSD License > -# which accompanies this distribution. The full text of the license may= be > found at > -# http://opensource.org/licenses/bsd-license.php > -# > -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > BASIS, > -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > -# > -## > - > -[Defines] > - INF_VERSION =3D 0x00010006 > - BASE_NAME =3D UefiDpLib > - FILE_GUID =3D 9DF262F7-CF81-4294-B5A5-B2E3CAFE561= 8 > - MODULE_TYPE =3D UEFI_DRIVER > - VERSION_STRING =3D 1.0 > - LIBRARY_CLASS =3D NULL|UEFI_APPLICATION UEFI_DRIVER > - CONSTRUCTOR =3D UefiDpLibConstructor > - DESTRUCTOR =3D UefiDpLibDestructor > - > -# > -# The following information is for reference only and not required by th= e > build tools. > -# > -# VALID_ARCHITECTURES =3D IA32 X64 IPF EBC > -# > - > -[Sources.common] > - PerformanceTokens.h > - UefiDpLib.c > - UefiDpLib.h > - UefiDpLib.uni > - Dp.c > - Dp.h > - Literals.h > - Literals.c > - DpInternal.h > - DpUtilities.c > - DpTrace.c > - DpProfile.c > - > -[Packages] > - MdePkg/MdePkg.dec > - ShellPkg/ShellPkg.dec > - MdeModulePkg/MdeModulePkg.dec > - > -[LibraryClasses] > - PerformanceLib > - DxeServicesLib > - MemoryAllocationLib > - BaseLib > - BaseMemoryLib > - DebugLib > - ShellCommandLib > - ShellLib > - UefiLib > - UefiRuntimeServicesTableLib > - UefiBootServicesTableLib > - SortLib > - PrintLib > - DevicePathLib > - > -[Guids] > - gPerformanceProtocolGuid ## CONSUMES ##= SystemTable > - > -[Protocols] > - gEfiLoadedImageProtocolGuid ## CONSUMES > - gEfiDriverBindingProtocolGuid ## SOMETIMES_C= ONSUMES > - gEfiComponentName2ProtocolGuid ## > SOMETIMES_CONSUMES > - gEfiLoadedImageDevicePathProtocolGuid ## > SOMETIMES_CONSUMES > - > -[Pcd] > - gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize ## > UNDEFINED > - gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask ## CONSUMES > diff --git a/ShellPkg/ShellPkg.dsc b/ShellPkg/ShellPkg.dsc > index 8fc20709f4..65e8959455 100644 > --- a/ShellPkg/ShellPkg.dsc > +++ b/ShellPkg/ShellPkg.dsc > @@ -104,12 +104,6 @@ [Components] >=20 > ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1Comm > andsLib.inf >=20 > ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2Comm > andsLib.inf >=20 > - ShellPkg/Library/UefiDpLib/UefiDpLib.inf { > - > - > PerformanceLib|MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmm > PerformanceLib.inf > - DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf > - } > - > ShellPkg/Application/Shell/Shell.inf { > > gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE > @@ -123,14 +117,19 @@ [Components] >=20 > NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Com > mandsLib.inf >=20 > NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1 > CommandsLib.inf >=20 > NULL|ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2 > CommandsLib.inf > -!ifdef $(INCLUDE_DP) > - NULL|ShellPkg/Library/UefiDpLib/UefiDpLib.inf > -!endif #$(INCLUDE_DP) > !endif #$(NO_SHELL_PROFILES) > } >=20 >=20 > ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand. > inf > ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.inf > + > ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf > { > + > + > PerformanceLib|MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmm > PerformanceLib.inf > + } > + ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf { > + > + > PerformanceLib|MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmm > PerformanceLib.inf > + } >=20 > [BuildOptions] > *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES > -- > 2.15.0.gvfs.1.preview.4