From nobody Tue Dec 24 14:13:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1511762139160399.00403129093036; Sun, 26 Nov 2017 21:55:39 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5C02B21B00DC4; Sun, 26 Nov 2017 21:51:15 -0800 (PST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 B655621A1099D for ; Sun, 26 Nov 2017 21:51:13 -0800 (PST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Nov 2017 21:55:35 -0800 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.15]) by orsmga005.jf.intel.com with ESMTP; 26 Nov 2017 21:55:34 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,463,1505804400"; d="scan'208";a="178109684" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Mon, 27 Nov 2017 13:55:30 +0800 Message-Id: <20171127055532.320556-2-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.15.0.gvfs.1.preview.4 In-Reply-To: <20171127055532.320556-1-ruiyu.ni@intel.com> References: <20171127055532.320556-1-ruiyu.ni@intel.com> Subject: [edk2] [PATCH v2 1/3] ShellPkg/ShellLib: Constructor doesn't depend on ShellParameters 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: , Cc: Jaben Carsey , Michael D Kinney MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When ShellLib is linked to a driver producing DynamicCommand protocol, ShellParameters protocol is set by DynamicCommand.Handler(). The driver image handle doesn't have ShellParameters protocol installed. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Cc: Jaben Carsey Cc: Michael D Kinney --- ShellPkg/Library/UefiShellLib/UefiShellLib.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Librar= y/UefiShellLib/UefiShellLib.c index 677791c67f..00f58ca0c1 100644 --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c @@ -215,7 +215,7 @@ ShellLibConstructorWorker ( gEfiShellParametersProtocol =3D NULL; } =20 - if (gEfiShellParametersProtocol =3D=3D NULL || gEfiShellProtocol =3D=3D = NULL) { + if (gEfiShellProtocol =3D=3D NULL) { // // Moved to seperate function due to complexity // @@ -238,10 +238,14 @@ ShellLibConstructorWorker ( } =20 // - // only success getting 2 of either the old or new, but no 1/2 and 1/2 + // Getting either EDK Shell's ShellEnvironment2 and ShellInterface proto= col + // or UEFI Shell's Shell protocol. + // When ShellLib is linked to a driver producing DynamicCommand protocol, + // ShellParameters protocol is set by DynamicCommand.Handler(). // - if ((mEfiShellEnvironment2 !=3D NULL && mEfiShellInterface !=3D= NULL) || - (gEfiShellProtocol !=3D NULL && gEfiShellParametersProtocol !=3D= NULL) ) { + if ((mEfiShellEnvironment2 !=3D NULL && mEfiShellInterface !=3D NULL) || + (gEfiShellProtocol !=3D NULL) + ) { if (gEfiShellProtocol !=3D NULL) { FileFunctionMap.GetFileInfo =3D gEfiShellProtocol->GetFileInfo; FileFunctionMap.SetFileInfo =3D gEfiShellProtocol->SetFileInfo; --=20 2.15.0.gvfs.1.preview.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Tue Dec 24 14:13:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1511762141503994.5380521551335; Sun, 26 Nov 2017 21:55:41 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9AFF721A1099D; Sun, 26 Nov 2017 21:51:18 -0800 (PST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 0D8C421A1099A for ; Sun, 26 Nov 2017 21:51:15 -0800 (PST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Nov 2017 21:55:36 -0800 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.15]) by orsmga005.jf.intel.com with ESMTP; 26 Nov 2017 21:55:35 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,463,1505804400"; d="scan'208";a="178109689" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Mon, 27 Nov 2017 13:55:31 +0800 Message-Id: <20171127055532.320556-3-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.15.0.gvfs.1.preview.4 In-Reply-To: <20171127055532.320556-1-ruiyu.ni@intel.com> References: <20171127055532.320556-1-ruiyu.ni@intel.com> Subject: [edk2] [PATCH v2 2/3] ShellPkg/tftp: 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: , Cc: Jaben Carsey , Michael D Kinney MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" UEFI Shell spec defines Shell Dynamic Command protocol which is just for the purpose to extend internal command. So tftp command is changed from NULL class library to be a driver producing DynamicCommand protocol. 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. TftpApp.inf is to provide a standalone application. TftpDynamicCommand.inf is to provide a standalone driver producing Dynamic Command protocol. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Cc: Jaben Carsey Cc: Michael D Kinney --- .../TftpDynamicCommand}/Tftp.c | 92 +++++++++++---- .../TftpDynamicCommand/Tftp.h} | 40 +++++-- .../TftpDynamicCommand/Tftp.uni} | 0 .../DynamicCommand/TftpDynamicCommand/TftpApp.c | 54 +++++++++ .../TftpDynamicCommand/TftpApp.inf} | 34 +++--- .../TftpDynamicCommand/TftpDynamicCommand.c | 131 +++++++++++++++++= ++++ .../TftpDynamicCommand/TftpDynamicCommand.inf} | 39 +++--- .../UefiShellTftpCommandLib.c | 97 --------------- ShellPkg/ShellPkg.dsc | 11 +- 9 files changed, 325 insertions(+), 173 deletions(-) rename ShellPkg/{Library/UefiShellTftpCommandLib =3D> DynamicCommand/TftpD= ynamicCommand}/Tftp.c (91%) mode change 100755 =3D> 100644 rename ShellPkg/{Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.h= =3D> DynamicCommand/TftpDynamicCommand/Tftp.h} (56%) rename ShellPkg/{Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.u= ni =3D> DynamicCommand/TftpDynamicCommand/Tftp.uni} (100%) create mode 100644 ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.c copy ShellPkg/{Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.inf= =3D> DynamicCommand/TftpDynamicCommand/TftpApp.inf} (59%) create mode 100644 ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicC= ommand.c rename ShellPkg/{Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.i= nf =3D> DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf} (55%) delete mode 100644 ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpC= ommandLib.c diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c b/ShellPkg/Dyn= amicCommand/TftpDynamicCommand/Tftp.c old mode 100755 new mode 100644 similarity index 91% rename from ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c rename to ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c index fbde3bfe60..8569c966dd --- a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c +++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.c @@ -2,7 +2,7 @@ The implementation for the 'tftp' Shell command. =20 Copyright (c) 2015, ARM Ltd. All rights reserved.
- Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
(C) Copyright 2015 Hewlett Packard Enterprise Development LP
=20 This program and the accompanying materials @@ -14,9 +14,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. **/ =20 -#include "UefiShellTftpCommandLib.h" +#include "Tftp.h" =20 #define IP4_CONFIG2_INTERFACE_INFO_NAME_LENGTH 32 +EFI_HANDLE mTftpHiiHandle; =20 /* Constant strings and definitions related to the message indicating the = amount of @@ -256,8 +257,7 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] =3D { =20 **/ SHELL_STATUS -EFIAPI -ShellCommandRunTftp ( +RunTftp ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) @@ -315,7 +315,7 @@ ShellCommandRunTftp ( if ((Status =3D=3D EFI_VOLUME_CORRUPTED) && (ProblemParam !=3D NULL) ) { ShellPrintHiiEx ( - -1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellTftpHiiHandle, + -1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), mTftpHiiHandle, L"tftp", ProblemParam ); FreePool (ProblemParam); @@ -332,14 +332,14 @@ ShellCommandRunTftp ( if (ParamCount > 4) { ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), - gShellTftpHiiHandle, L"tftp" + mTftpHiiHandle, L"tftp" ); goto Error; } if (ParamCount < 3) { ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), - gShellTftpHiiHandle, L"tftp" + mTftpHiiHandle, L"tftp" ); goto Error; } @@ -354,7 +354,7 @@ ShellCommandRunTftp ( if (EFI_ERROR (Status)) { ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), - gShellTftpHiiHandle, L"tftp", ValueStr + mTftpHiiHandle, L"tftp", ValueStr ); goto Error; } @@ -416,7 +416,7 @@ ShellCommandRunTftp ( if (Mtftp4ConfigData.TimeoutValue =3D=3D 0) { ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), - gShellTftpHiiHandle, L"tftp", ValueStr + mTftpHiiHandle, L"tftp", ValueStr ); goto Error; } @@ -430,7 +430,7 @@ ShellCommandRunTftp ( if (BlockSize < MTFTP_MIN_BLKSIZE || BlockSize > MTFTP_MAX_BLKSIZE) { ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), - gShellTftpHiiHandle, L"tftp", ValueStr + mTftpHiiHandle, L"tftp", ValueStr ); goto Error; } @@ -450,7 +450,7 @@ ShellCommandRunTftp ( if (EFI_ERROR (Status) || (HandleCount =3D=3D 0)) { ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_NO_NIC), - gShellTftpHiiHandle + mTftpHiiHandle ); goto Error; } @@ -465,7 +465,7 @@ ShellCommandRunTftp ( if (EFI_ERROR (Status)) { ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_NIC_NAME), - gShellTftpHiiHandle, NicNumber, Status + mTftpHiiHandle, NicNumber, Status ); continue; } @@ -487,7 +487,7 @@ ShellCommandRunTftp ( if (EFI_ERROR (Status)) { ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_OPEN_PROTOCOL), - gShellTftpHiiHandle, NicName, Status + mTftpHiiHandle, NicName, Status ); continue; } @@ -496,7 +496,7 @@ ShellCommandRunTftp ( if (EFI_ERROR (Status)) { ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_CONFIGURE), - gShellTftpHiiHandle, NicName, Status + mTftpHiiHandle, NicName, Status ); goto NextHandle; } @@ -505,7 +505,7 @@ ShellCommandRunTftp ( if (EFI_ERROR (Status)) { ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_FILE_SIZE), - gShellTftpHiiHandle, RemoteFilePath, NicName, Status + mTftpHiiHandle, RemoteFilePath, NicName, Status ); goto NextHandle; } @@ -514,7 +514,7 @@ ShellCommandRunTftp ( if (EFI_ERROR (Status)) { ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_DOWNLOAD), - gShellTftpHiiHandle, RemoteFilePath, NicName, Status + mTftpHiiHandle, RemoteFilePath, NicName, Status ); goto NextHandle; } @@ -534,7 +534,7 @@ ShellCommandRunTftp ( if (EFI_ERROR (Status)) { ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), - gShellTftpHiiHandle, L"tftp", LocalFilePath + mTftpHiiHandle, L"tftp", LocalFilePath ); goto NextHandle; } @@ -546,7 +546,7 @@ ShellCommandRunTftp ( } else { ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_WRITE), - gShellTftpHiiHandle, LocalFilePath, Status + mTftpHiiHandle, LocalFilePath, Status ); } ShellCloseFile (&FileHandle); @@ -568,7 +568,7 @@ ShellCommandRunTftp ( if ((UserNicName !=3D NULL) && (!NicFound)) { ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_TFTP_ERR_NIC_NOT_FOUND), - gShellTftpHiiHandle, UserNicName + mTftpHiiHandle, UserNicName ); } =20 @@ -607,7 +607,7 @@ StringToUint16 ( if (Val > MAX_UINT16) { ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), - gShellTftpHiiHandle, L"tftp", ValueStr + mTftpHiiHandle, L"tftp", ValueStr ); return FALSE; } @@ -948,13 +948,13 @@ DownloadFile ( =20 ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_TFTP_DOWNLOADING), - gShellTftpHiiHandle, FilePath + mTftpHiiHandle, FilePath ); =20 Status =3D Mtftp4->ReadFile (Mtftp4, &Mtftp4Token); ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_GEN_CRLF), - gShellTftpHiiHandle + mTftpHiiHandle ); =20 Error : @@ -1052,3 +1052,51 @@ CheckPacket ( =20 return EFI_SUCCESS; } + +/** + 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/UefiShellTftpCommandLib/UefiShellTftpCommandL= ib.h b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.h similarity index 56% rename from ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLi= b.h rename to ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.h index 6767f95166..9963eab3eb 100644 --- a/ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.h +++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.h @@ -1,7 +1,7 @@ /** @file - header file for NULL named library for 'tftp' Shell command functions. + Header file for 'tftp' command functions. =20 - Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
Copyright (c) 2015, ARM Ltd. All rights reserved.
=20 This program and the accompanying materials @@ -14,13 +14,12 @@ =20 **/ =20 -#ifndef _UEFI_SHELL_TFTP_COMMAND_LIB_H_ -#define _UEFI_SHELL_TFTP_COMMAND_LIB_H_ +#ifndef _TFTP_H_ +#define _TFTP_H_ =20 #include =20 -#include - +#include #include #include =20 @@ -28,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -36,8 +34,9 @@ #include #include #include +#include =20 -extern EFI_HANDLE gShellTftpHiiHandle; +extern EFI_HANDLE mTftpHiiHandle; =20 typedef struct { UINTN FileSize; @@ -48,14 +47,29 @@ typedef struct { /** Function for 'tftp' command. =20 - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). + @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 -EFIAPI -ShellCommandRunTftp ( +RunTftp ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ); =20 -#endif /* _UEFI_SHELL_TFTP_COMMAND_LIB_H_ */ +/** + 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 // _TFTP_H_ diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandL= ib.uni b/ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni similarity index 100% rename from ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLi= b.uni rename to ShellPkg/DynamicCommand/TftpDynamicCommand/Tftp.uni diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.c b/ShellPk= g/DynamicCommand/TftpDynamicCommand/TftpApp.c new file mode 100644 index 0000000000..23f2bf7d9b --- /dev/null +++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.c @@ -0,0 +1,54 @@ +/** @file + Entrypoint of "tftp" shell standalone application. + + Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
+ Copyright (c) 2015, ARM Ltd. All rights reserved.
+ + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e 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 IMP= LIED. + +**/ +#include "Tftp.h" + +// +// String token ID of help message text. +// Shell supports to find help message in the resource section of an appli= cation image if +// .MAN file is not found. This global variable is added to make build too= l recognizes +// that the help string is consumed by user and then build tool will add t= he string into +// the resource section. Thus the application can use '-?' option to show = help message in +// Shell. +// +GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId =3D STRING_= TOKEN (STR_GET_HELP_TFTP); + +/** + 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 +TftpAppInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + mTftpHiiHandle =3D InitializeHiiPackage (ImageHandle); + if (mTftpHiiHandle =3D=3D NULL) { + return EFI_ABORTED; + } + + Status =3D (EFI_STATUS)RunTftp (ImageHandle, SystemTable); + HiiRemovePackages (mTftpHiiHandle); + return Status; +} diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandL= ib.inf b/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.inf similarity index 59% copy from ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.= inf copy to ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.inf index 96db258920..185bd4557a 100644 --- a/ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.inf +++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.inf @@ -1,7 +1,7 @@ ## @file -# Provides Shell 'tftp' command functions +# Provides Shell 'tftp' standalone application. # -# Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
# Copyright (c) 2015, ARM Ltd. All rights reserved.
# # This program and the accompanying materials @@ -16,19 +16,21 @@ =20 [Defines] INF_VERSION =3D 0x00010006 - BASE_NAME =3D UefiShellTftpCommandLib - FILE_GUID =3D D2B61A25-9835-4E5D-906A-15615E1FF668 + BASE_NAME =3D tftp + FILE_GUID =3D 8DC58D0D-67F5-4B97-9DFC-E442BB9A5648 MODULE_TYPE =3D UEFI_APPLICATION VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D NULL|UEFI_APPLICATION UEFI_DRIVER - CONSTRUCTOR =3D ShellTftpCommandLibConstructor - DESTRUCTOR =3D ShellTftpCommandLibDestructor + ENTRY_POINT =3D TftpAppInitialize +# +# This flag specifies whether HII resource section is generated into PE i= mage. +# + UEFI_HII_RESOURCE_SECTION =3D TRUE =20 [Sources.common] - UefiShellTftpCommandLib.uni - UefiShellTftpCommandLib.c - UefiShellTftpCommandLib.h + Tftp.uni + Tftp.h Tftp.c + TftpApp.c =20 [Packages] MdePkg/MdePkg.dec @@ -40,22 +42,18 @@ [LibraryClasses] BaseLib BaseMemoryLib DebugLib - ShellCommandLib ShellLib UefiLib UefiRuntimeServicesTableLib UefiBootServicesTableLib - PcdLib + UefiApplicationEntryPoint + UefiHiiServicesLib HiiLib FileHandleLib NetLib =20 -[Pcd] - gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask ## CONSUMES - [Protocols] gEfiManagedNetworkServiceBindingProtocolGuid ## CONSUMES gEfiMtftp4ServiceBindingProtocolGuid ## CONSUMES - -[Guids] - gShellTftpHiiGuid ## CONSUMES ## HII + gEfiMtftp4ProtocolGuid ## CONSUMES + gEfiHiiPackageListProtocolGuid ## CONSUMES diff --git a/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.= c b/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c new file mode 100644 index 0000000000..928ef08468 --- /dev/null +++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.c @@ -0,0 +1,131 @@ +/** @file + Produce "tftp" shell dynamic command. + + Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
+ Copyright (c) 2015, ARM Ltd. All rights reserved.
+ + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e 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 IMP= LIED. + +**/ +#include "Tftp.h" +#include + +/** + This is the shell command handler function pointer callback type. This + 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 com= mand. + @param[in] Shell The instance of the shell protocol use= d in the context + of processing this command. + + @return EFI_SUCCESS the operation was sucessful + @return other the operation failed. +**/ +SHELL_STATUS +EFIAPI +TftpCommandHandler ( + 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 RunTftp (gImageHandle, SystemTable); +} + +/** + This is the command help handler function pointer callback type. This + function is responsible for displaying help information for the associat= ed + command. + + @param[in] This The instance of the EFI_SHELL_DYNAMIC_= COMMAND_PROTOCOL. + @param[in] Language The pointer to the language string to = use. + + @return string Pool allocated help string, must be fr= eed by caller +**/ +CHAR16 * +EFIAPI +TftpCommandGetHelp ( + IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This, + IN CONST CHAR8 *Language + ) +{ + return HiiGetString (mTftpHiiHandle, STRING_TOKEN (STR_GET_HELP_TFTP), L= anguage); +} + +EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mTftpDynamicCommand =3D { + L"tftp", + TftpCommandHandler, + TftpCommandGetHelp +}; + +/** + 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 +TftpCommandInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + mTftpHiiHandle =3D InitializeHiiPackage (ImageHandle); + if (mTftpHiiHandle =3D=3D NULL) { + return EFI_ABORTED; + } + + Status =3D gBS->InstallProtocolInterface ( + &ImageHandle, + &gEfiShellDynamicCommandProtocolGuid, + EFI_NATIVE_INTERFACE, + &mTftpDynamicCommand + ); + 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 +TftpUnload ( + IN EFI_HANDLE ImageHandle +) +{ + EFI_STATUS Status; + Status =3D gBS->UninstallProtocolInterface ( + ImageHandle, + &gEfiShellDynamicCommandProtocolGuid, + &mTftpDynamicCommand + ); + if (EFI_ERROR (Status)) { + return Status; + } + HiiRemovePackages (mTftpHiiHandle); + return EFI_SUCCESS; +} diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandL= ib.inf b/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf similarity index 55% rename from ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLi= b.inf rename to ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf index 96db258920..85d04b77dc 100644 --- a/ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.inf +++ b/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf @@ -1,7 +1,7 @@ ## @file -# Provides Shell 'tftp' command functions +# Provides Shell 'tftp' dynamic command. # -# Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
# Copyright (c) 2015, ARM Ltd. All rights reserved.
# # This program and the accompanying materials @@ -16,19 +16,22 @@ =20 [Defines] INF_VERSION =3D 0x00010006 - BASE_NAME =3D UefiShellTftpCommandLib - FILE_GUID =3D D2B61A25-9835-4E5D-906A-15615E1FF668 - MODULE_TYPE =3D UEFI_APPLICATION + BASE_NAME =3D tftpDynamicCommand + FILE_GUID =3D A487A478-51EF-48AA-8794-7BEE2A0562F1 + MODULE_TYPE =3D DXE_DRIVER VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D NULL|UEFI_APPLICATION UEFI_DRIVER - CONSTRUCTOR =3D ShellTftpCommandLibConstructor - DESTRUCTOR =3D ShellTftpCommandLibDestructor + ENTRY_POINT =3D TftpCommandInitialize + UNLOAD_IMAGE =3D TftpUnload +# +# This flag specifies whether HII resource section is generated into PE i= mage. +# + UEFI_HII_RESOURCE_SECTION =3D TRUE =20 [Sources.common] - UefiShellTftpCommandLib.uni - UefiShellTftpCommandLib.c - UefiShellTftpCommandLib.h + Tftp.uni + Tftp.h Tftp.c + TftpDynamicCommand.c =20 [Packages] MdePkg/MdePkg.dec @@ -40,22 +43,22 @@ [LibraryClasses] BaseLib BaseMemoryLib DebugLib - ShellCommandLib ShellLib UefiLib UefiRuntimeServicesTableLib UefiBootServicesTableLib - PcdLib + UefiDriverEntryPoint + UefiHiiServicesLib HiiLib FileHandleLib NetLib =20 -[Pcd] - gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask ## CONSUMES - [Protocols] gEfiManagedNetworkServiceBindingProtocolGuid ## CONSUMES gEfiMtftp4ServiceBindingProtocolGuid ## CONSUMES + gEfiMtftp4ProtocolGuid ## CONSUMES + gEfiHiiPackageListProtocolGuid ## CONSUMES + gEfiShellDynamicCommandProtocolGuid ## PRODUCES =20 -[Guids] - gShellTftpHiiGuid ## CONSUMES ## HII +[DEPEX] + TRUE diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandL= ib.c b/ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.c deleted file mode 100644 index 22c81b8d2a..0000000000 --- a/ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.c +++ /dev/null @@ -1,97 +0,0 @@ -/** @file - Main file for NULL named library for 'tftp' Shell command functions. - - Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
- Copyright (c) 2015, ARM Ltd. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BS= D License - which accompanies this distribution. The full text of the license may b= e 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 IMP= LIED. - -**/ -#include "UefiShellTftpCommandLib.h" - -CONST CHAR16 gShellTftpFileName[] =3D L"ShellCommand"; -EFI_HANDLE gShellTftpHiiHandle =3D NULL; - -/** - Return the file name of the help text file if not using HII. - - @return The string pointer to the file name. -**/ -CONST CHAR16* -EFIAPI -ShellCommandGetManFileNameTftp ( - VOID - ) -{ - return gShellTftpFileName; -} - -/** - Constructor for the Shell Tftp Command library. - - Install the handlers for Tftp UEFI Shell command. - - @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 -ShellTftpCommandLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - gShellTftpHiiHandle =3D NULL; - - // - // check our bit of the profiles mask - // - if ((PcdGet8 (PcdShellProfileMask) & BIT3) =3D=3D 0) { - return EFI_SUCCESS; - } - - gShellTftpHiiHandle =3D HiiAddPackages ( - &gShellTftpHiiGuid, gImageHandle, - UefiShellTftpCommandLibStrings, NULL - ); - if (gShellTftpHiiHandle =3D=3D NULL) { - return EFI_DEVICE_ERROR; - } - // - // Install our Shell command handler - // - ShellCommandRegisterCommandName ( - L"tftp", ShellCommandRunTftp, ShellCommandGetManFileNameTftp, 0, - L"tftp", TRUE , gShellTftpHiiHandle, STRING_TOKEN (STR_GET_HELP_TFTP) - ); - - 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 -ShellTftpCommandLibDestructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - if (gShellTftpHiiHandle !=3D NULL) { - HiiRemovePackages (gShellTftpHiiHandle); - } - return EFI_SUCCESS; -} diff --git a/ShellPkg/ShellPkg.dsc b/ShellPkg/ShellPkg.dsc index ed6ac4356d..8fc20709f4 100644 --- a/ShellPkg/ShellPkg.dsc +++ b/ShellPkg/ShellPkg.dsc @@ -25,6 +25,7 @@ [Defines] =20 [LibraryClasses.common] UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiA= pplicationEntryPoint.inf + UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry= Point.inf UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBoo= tServicesTableLib.inf DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptional= DevicePathProtocol.inf !if $(TARGET) =3D=3D RELEASE @@ -79,7 +80,6 @@ [LibraryClasses.AARCH64] =20 [PcdsFixedAtBuild] gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0xFF - gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|16000 !ifdef $(NO_SHELL_PROFILES) gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask|0x00 @@ -103,7 +103,6 @@ [Components] ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.i= nf ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsL= ib.inf ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsL= ib.inf - ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.inf =20 ShellPkg/Library/UefiDpLib/UefiDpLib.inf { @@ -112,6 +111,8 @@ [Components] } =20 ShellPkg/Application/Shell/Shell.inf { + + gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE NULL|ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2Comm= andsLib.inf NULL|ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1Comm= andsLib.inf @@ -125,11 +126,11 @@ [Components] !ifdef $(INCLUDE_DP) NULL|ShellPkg/Library/UefiDpLib/UefiDpLib.inf !endif #$(INCLUDE_DP) -!ifdef $(INCLUDE_TFTP_COMMAND) - NULL|ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLi= b.inf -!endif #$(INCLUDE_TFTP_COMMAND) !endif #$(NO_SHELL_PROFILES) } =20 + ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf + ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.inf + [BuildOptions] *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES --=20 2.15.0.gvfs.1.preview.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Tue Dec 24 14:13:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1511762144175145.5856199432577; Sun, 26 Nov 2017 21:55:44 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id DA8E421B00DFC; Sun, 26 Nov 2017 21:51:18 -0800 (PST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 AF19421B00DFC for ; Sun, 26 Nov 2017 21:51:16 -0800 (PST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Nov 2017 21:55:38 -0800 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.15]) by orsmga005.jf.intel.com with ESMTP; 26 Nov 2017 21:55:36 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,463,1505804400"; d="scan'208";a="178109695" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Mon, 27 Nov 2017 13:55:32 +0800 Message-Id: <20171127055532.320556-4-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.15.0.gvfs.1.preview.4 In-Reply-To: <20171127055532.320556-1-ruiyu.ni@intel.com> References: <20171127055532.320556-1-ruiyu.ni@intel.com> Subject: [edk2] [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: , Cc: Jaben Carsey , Michael D Kinney MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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. 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. DpApp.inf is to provide a standalone application. DpDynamicCommand.inf is to provide a standalone driver producing Dynamic Command protocol. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Cc: Jaben Carsey Cc: Michael D Kinney Reviewed-by: Jaben Carsey --- .../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}/D= p.c (84%) rename ShellPkg/{Library/UefiDpLib =3D> DynamicCommand/DpDynamicCommand}/D= p.h (70%) rename ShellPkg/{Library/UefiDpLib/UefiDpLib.uni =3D> DynamicCommand/DpDyn= amicCommand/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/DpDynamicComma= nd.c create mode 100644 ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicComma= nd.inf rename ShellPkg/{Library/UefiDpLib =3D> DynamicCommand/DpDynamicCommand}/D= pInternal.h (96%) rename ShellPkg/{Library/UefiDpLib =3D> DynamicCommand/DpDynamicCommand}/D= pProfile.c (87%) rename ShellPkg/{Library/UefiDpLib =3D> DynamicCommand/DpDynamicCommand}/D= pTrace.c (89%) rename ShellPkg/{Library/UefiDpLib =3D> DynamicCommand/DpDynamicCommand}/D= pUtilities.c (87%) rename ShellPkg/{Library/UefiDpLib =3D> DynamicCommand/DpDynamicCommand}/L= iterals.c (100%) rename ShellPkg/{Library/UefiDpLib =3D> DynamicCommand/DpDynamicCommand}/L= iterals.h (100%) rename ShellPkg/{Library/UefiDpLib =3D> DynamicCommand/DpDynamicCommand}/P= erformanceTokens.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 diff --git a/ShellPkg/Library/UefiDpLib/Dp.c b/ShellPkg/DynamicCommand/DpDy= namicCommand/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 IMP= LIED. **/ =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_SE= CTION_STATISTICS), NULL); - StringPtrUnknown =3D HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_ALIT_= UNKNOWN), NULL); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), gDp= HiiHandle, + StringPtr =3D HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SE= CTION_STATISTICS), NULL); + StringPtrUnknown =3D HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_= UNKNOWN), NULL); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDp= HiiHandle, (StringPtr =3D=3D NULL) ? StringPtrUnknown : StringPtr); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMTRACE), gDp= HiiHandle, 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), gD= pHiiHandle, SummaryData.NumSummary); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMHANDLES), g= DpHiiHandle, SummaryData.NumHandles, SummaryData.NumTrace - SummaryData.= NumHandles); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMPEIMS), gDp= HiiHandle, SummaryData.NumPEIMs); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMGLOBALS), g= DpHiiHandle, SummaryData.NumGlobal); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMTRACE), mDp= HiiHandle, 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), mD= pHiiHandle, SummaryData.NumSummary); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMHANDLES), m= DpHiiHandle, SummaryData.NumHandles, SummaryData.NumTrace - SummaryData.= NumHandles); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMPEIMS), mDp= HiiHandle, SummaryData.NumPEIMs); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMGLOBALS), m= DpHiiHandle, SummaryData.NumGlobal); #if PROFILING_IMPLEMENTED - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMPROFILE), g= DpHiiHandle, SummaryData.NumProfile); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_STATS_NUMPROFILE), m= DpHiiHandle, 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), gDpH= iiHandle); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_INVALID_ARG), mDpH= iiHandle); return SHELL_INVALID_PARAMETER; } =20 @@ -273,7 +262,7 @@ ShellCommandRunDp ( // Status =3D EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid, (V= OID **) &PerformanceProperty); if (EFI_ERROR (Status) || (PerformanceProperty =3D=3D NULL)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PERF_PROPERTY_NOT_FOU= ND), gDpHiiHandle); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PERF_PROPERTY_NOT_FOU= ND), 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), gDp= HiiHandle, DP_MAJOR_VERSION, DP_MINOR_VERSION); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_BUILD_REVISION), mDp= HiiHandle, 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_D= P_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 /*************************************************************************= *** @@ -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/DpDy= namicCommand/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 BS= D License which accompanies this distribution. The full text of the license may b= e 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 IMP= LIED. + **/ =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 accu= mulated. } 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/DynamicCom= mand/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/Dy= namicCommand/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 BS= D License + which accompanies this distribution. The full text of the license may b= e 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 IMP= LIED. + +**/ +#include "Dp.h" + +// +// String token ID of help message text. +// Shell supports to find help message in the resource section of an appli= cation image if +// .MAN file is not found. This global variable is added to make build too= l recognizes +// that the help string is consumed by user and then build tool will add t= he string into +// the resource section. Thus the application can use '-?' option to show = 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 B= SD License +# which accompanies this distribution. The full text of the license may b= e 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 IM= PLIED. +# +# +## + +[Defines] + INF_VERSION =3D 0x00010006 + BASE_NAME =3D dp + FILE_GUID =3D 1831A379-2D48-45BD-9744-D4059D93815D + 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 i= mage. +# + 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 ## S= ystemTable + +[Protocols] + gEfiLoadedImageProtocolGuid ## CONSUMES + gEfiDriverBindingProtocolGuid ## SOMETIMES_CON= SUMES + gEfiComponentName2ProtocolGuid ## SOMETIMES_CON= SUMES + gEfiLoadedImageDevicePathProtocolGuid ## SOMETIMES_CON= SUMES + 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 BS= D License + which accompanies this distribution. The full text of the license may b= e 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 IMP= LIED. + +**/ +#include "Dp.h" +#include + +/** + This is the shell command handler function pointer callback type. This + 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 com= mand. + @param[in] Shell The instance of the shell protocol use= d 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 associat= ed + command. + + @param[in] This The instance of the EFI_SHELL_DYNAMIC_= COMMAND_PROTOCOL. + @param[in] Language The pointer to the language string to = use. + + @return string Pool allocated help string, must be fr= eed 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), Langu= age); +} + +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.inf = b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf new file mode 100644 index 0000000000..3164561958 --- /dev/null +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf @@ -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 B= SD License +# which accompanies this distribution. The full text of the license may b= e 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 IM= PLIED. +# +# +## + +[Defines] + INF_VERSION =3D 0x00010006 + BASE_NAME =3D dpDynamicCommand + FILE_GUID =3D 0253F9FA-129A-4A8D-B12E-7DC2B6376302 + 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 i= mage. +# + 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 ## S= ystemTable + +[Protocols] + gEfiLoadedImageProtocolGuid ## CONSUMES + gEfiDriverBindingProtocolGuid ## SOMETIMES_CON= SUMES + gEfiComponentName2ProtocolGuid ## SOMETIMES_CON= SUMES + gEfiLoadedImageDevicePathProtocolGuid ## SOMETIMES_CON= SUMES + gEfiHiiPackageListProtocolGuid ## CONSUMES + gEfiShellDynamicCommandProtocolGuid ## PRODUCES + +[Pcd] + gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize ## CONSUMES + +[DEPEX] + TRUE diff --git a/ShellPkg/Library/UefiDpLib/DpInternal.h b/ShellPkg/DynamicComm= and/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/DynamicComma= nd/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 -/**=20 +/** Gather and print ALL Profiling Records. - =20 + Displays all "interesting" Profile measurements in order. The number of records displayed is controlled by: - records with a duration less than mInterestThreshold microseconds a= re not displayed. - No more than Limit records are displayed. A Limit of zero will not= limit the output. - If the ExcludeFlag is TRUE, records matching entries in the CumData= array are not displayed. - =20 + @pre The mInterestThreshold global variable is set to the shortest du= ration to be printed. The mGaugeString and mUnicodeToken global arrays are used for t= emporary string storage. They must not be in use by a calling function. - =20 + @param[in] Limit The number of records to print. Zero is ALL. @param[in] ExcludeFlag TRUE to exclude individual Cumulative items = from display. - =20 + **/ VOID DumpAllProfile( @@ -55,32 +55,32 @@ DumpAllProfile( EFI_STRING StringPtr; EFI_STRING StringPtrUnknown; =20 - StringPtrUnknown =3D HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_ALIT_= UNKNOWN), NULL); =20 - StringPtr =3D HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_P= ROFILE), NULL); + StringPtrUnknown =3D HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_= UNKNOWN), NULL); + StringPtr =3D HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_P= ROFILE), NULL); =20 - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), gDp= HiiHandle,=20 + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDp= HiiHandle, (StringPtr =3D=3D NULL) ? StringPtrUnknown: StringPtr); FreePool (StringPtr); FreePool (StringPtrUnknown); } =20 -/**=20 +/** Gather and print Raw Profile Records. - =20 + All Profile measurements with a duration greater than or equal to mInterestThreshold are printed without interpretation. - =20 + The number of records displayed is controlled by: - records with a duration less than mInterestThreshold microseconds a= re not displayed. - No more than Limit records are displayed. A Limit of zero will not= limit the output. - If the ExcludeFlag is TRUE, records matching entries in the CumData= array are not displayed. - =20 + @pre The mInterestThreshold global variable is set to the shortest du= ration to be printed. - =20 + @param[in] Limit The number of records to print. Zero is ALL. @param[in] ExcludeFlag TRUE to exclude individual Cumulative items = from display. - =20 + **/ 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_R= AWPROFILE), NULL); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), gDp= HiiHandle,=20 + StringPtrUnknown =3D HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_= UNKNOWN), NULL); + StringPtr =3D HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_R= AWPROFILE), NULL); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDp= HiiHandle, (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 -/**=20 +/** Collect verbose statistics about the logged performance measurements. - =20 + 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. - =20 + @pre The SummaryData and CumData structures must be initialized prior to calling this function. - =20 + @post The SummaryData and CumData structures contain statistics for the current performance logs. =20 @@ -118,23 +118,23 @@ GatherStatistics( } } =20 -/**=20 +/** Gather and print ALL Trace Records. - =20 + Displays all "interesting" Trace measurements in order.
The number of records displayed is controlled by: - records with a duration less than mInterestThreshold microseconds a= re not displayed. - No more than Limit records are displayed. A Limit of zero will not= limit the output. - If the ExcludeFlag is TRUE, records matching entries in the CumData= array are not displayed. - =20 + @pre The mInterestThreshold global variable is set to the shortest du= ration to be printed. The mGaugeString and mUnicodeToken global arrays are used for t= emporary string storage. They must not be in use by a calling function. - =20 + @param[in] Limit The number of records to print. Zero is ALL. @param[in] ExcludeFlag TRUE to exclude individual Cumulative items fr= om display. - =20 + @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), gDp= HiiHandle, + 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), mDp= HiiHandle, (IncFlag =3D=3D NULL) ? StringPtrUnknown : IncFlag); FreePool (StringPtrUnknown); =20 @@ -169,7 +169,7 @@ DumpAllTrace( // Status =3D gBS->LocateHandleBuffer (AllHandles, NULL, NULL, &HandleCoun= t, &HandleBuffer); if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLES_ERROR), gD= pHiiHandle, Status); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLES_ERROR), mD= pHiiHandle, 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), gDp= HiiHandle); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_DASHES2), gD= pHiiHandle); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_HEADR2), mDp= HiiHandle); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_DASHES2), mD= pHiiHandle); } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_HEADR), gDpH= iiHandle); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), gDpHiiH= andle); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_HEADR), mDpH= iiHandle); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), mDpHiiH= andle); } =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_COMPL= ETE), NULL); + IncFlag =3D HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_COMPL= ETE), NULL); } else { - IncFlag =3D HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_INCOM= PLETE), NULL); // Mark incomplete records + IncFlag =3D HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_INCOM= PLETE), NULL); // Mark incomplete records } if (((Measurement.EndTimeStamp !=3D 0) && (ElapsedTime < mInterestTh= reshold)) || ((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), gD= pHiiHandle, + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_VARS2), mD= pHiiHandle, Index, // 1 based, Which measurement record is being printed IncFlag, Measurement.Handle, @@ -250,7 +250,7 @@ DumpAllTrace( Measurement.Identifier ); } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_VARS), gDp= HiiHandle, + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_ALL_VARS), mDp= HiiHandle, Index, // 1 based, Which measurement record is being printed IncFlag, Measurement.Handle, @@ -273,20 +273,20 @@ DumpAllTrace( return Status; } =20 -/**=20 +/** Gather and print Raw Trace Records. - =20 + All Trace measurements with a duration greater than or equal to mInterestThreshold are printed without interpretation. - =20 + The number of records displayed is controlled by: - records with a duration less than mInterestThreshold microseconds a= re not displayed. - No more than Limit records are displayed. A Limit of zero will not= limit the output. - If the ExcludeFlag is TRUE, records matching entries in the CumData= array are not displayed. - =20 + @pre The mInterestThreshold global variable is set to the shortest du= ration to be printed. - =20 + @param[in] Limit The number of records to print. Zero is ALL. @param[in] ExcludeFlag TRUE to exclude individual Cumulative items fr= om display. =20 @@ -312,19 +312,19 @@ DumpRawTrace( =20 Status =3D EFI_SUCCESS; =20 - StringPtrUnknown =3D HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_ALIT_= UNKNOWN), NULL); =20 - StringPtr =3D HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_R= AWTRACE), NULL); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), gDp= HiiHandle, + StringPtrUnknown =3D HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_= UNKNOWN), NULL); + StringPtr =3D HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_R= AWTRACE), NULL); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDp= HiiHandle, (StringPtr =3D=3D NULL) ? StringPtrUnknown : StringPtr); FreePool (StringPtr); FreePool (StringPtrUnknown); =20 if (mShowId) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_HEADR2), gDpHi= iHandle); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_DASHES2), gDpH= iiHandle); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_HEADR2), mDpHi= iHandle); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_DASHES2), mDpH= iiHandle); } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_HEADR), gDpHii= Handle); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_DASHES), gDpHi= iHandle); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_HEADR), mDpHii= Handle); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_DASHES), mDpHi= iHandle); } =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), gDpH= iiHandle, + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_VARS2), mDpH= iiHandle, Index, // 1 based, Which measurement record is being printed Measurement.Handle, Measurement.StartTimeStamp, @@ -365,7 +365,7 @@ DumpRawTrace( Measurement.Identifier ); } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_VARS), gDpHi= iHandle, + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RAW_VARS), mDpHi= iHandle, Index, // 1 based, Which measurement record is being printed Measurement.Handle, Measurement.StartTimeStamp, @@ -382,9 +382,9 @@ DumpRawTrace( return Status; } =20 -/**=20 +/** Gather and print Major Phase metrics. - =20 + **/ VOID ProcessPhases( @@ -412,9 +412,9 @@ ProcessPhases( // // Get Execution Phase Statistics // - StringPtrUnknown =3D HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_ALIT_= UNKNOWN), NULL); =20 - StringPtr =3D HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_P= HASES), NULL); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), gDp= HiiHandle, + StringPtrUnknown =3D HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_= UNKNOWN), NULL); + StringPtr =3D HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_P= HASES), NULL); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDp= HiiHandle, (StringPtr =3D=3D NULL) ? StringPtrUnknown : StringPtr); FreePool (StringPtr); FreePool (StringPtrUnknown); @@ -456,7 +456,7 @@ ProcessPhases( if (SecTime > 0) { ElapsedTime =3D DurationInMicroSeconds ( SecTime ); // Calculate e= lapsed time in microseconds Total +=3D DivU64x32 (ElapsedTime, 1000); // Accumulate time in mill= iseconds - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SEC_PHASE), gDpHii= Handle, ElapsedTime); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SEC_PHASE), mDpHii= Handle, 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), g= DpHiiHandle, ALit_PEI, ElapsedTime); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PHASE_DURATION), m= DpHiiHandle, 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), g= DpHiiHandle, ALit_DXE, ElapsedTime); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PHASE_DURATION), m= DpHiiHandle, 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), g= DpHiiHandle, ALit_BDS, ElapsedTime); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PHASE_DURATION), m= DpHiiHandle, 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), gDpH= iiHandle, ALit_BdsTO, ElapsedTime); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PHASE_BDSTO), mDpH= iiHandle, ALit_BdsTO, ElapsedTime); } =20 - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_TOTAL_DURATION), gDp= HiiHandle, Total); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_TOTAL_DURATION), mDp= HiiHandle, Total); } =20 -/**=20 +/** Gather and print Handle data. - =20 + @param[in] ExcludeFlag TRUE to exclude individual Cumulative items = from display. - =20 + @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); =20 - StringPtr =3D HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_D= RIVERS), NULL); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), gDp= HiiHandle, + StringPtrUnknown =3D HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_= UNKNOWN), NULL); + StringPtr =3D HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_D= RIVERS), NULL); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDp= HiiHandle, (StringPtr =3D=3D NULL) ? StringPtrUnknown : StringPtr); FreePool (StringPtr); FreePool (StringPtrUnknown); =20 Status =3D gBS->LocateHandleBuffer (AllHandles, NULL, NULL, &HandleCount= , &HandleBuffer); if (EFI_ERROR (Status)) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLES_ERROR), gD= pHiiHandle, Status); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLES_ERROR), mD= pHiiHandle, 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), gDpHiiHan= dle); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), mDpHiiHan= dle); =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 prin= ted 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_VARS)= , gDpHiiHandle, + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_HANDLE_VARS)= , mDpHiiHandle, Count, // 1 based, Which measurement record is being prin= ted Index + 1, // 1 based, Which handle is being printed mGaugeString, @@ -618,11 +618,11 @@ ProcessHandles( return Status; } =20 -/**=20 +/** Gather and print PEIM data. - =20 + Only prints complete PEIM records - =20 + @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); =20 - StringPtr =3D HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_P= EIMS), NULL); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), gDp= HiiHandle, + StringPtrUnknown =3D HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_= UNKNOWN), NULL); + StringPtr =3D HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_P= EIMS), NULL); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDp= HiiHandle, (StringPtr =3D=3D NULL) ? StringPtrUnknown : StringPtr); FreePool (StringPtr); FreePool (StringPtrUnknown); =20 if (mShowId) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_SECTION2), gD= pHiiHandle); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_SECTION2), mD= pHiiHandle); } else { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_SECTION), gDp= HiiHandle); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_SECTION), mDp= HiiHandle); } - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), gDpHiiHandl= e); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), mDpHiiHandl= e); 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 contai= ns its file guid. if (mShowId) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_VARS2), g= DpHiiHandle, + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_VARS2), m= DpHiiHandle, TIndex, // 1 based, Which measurement record is being prin= ted 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), gD= pHiiHandle, + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_PEIM_VARS), mD= pHiiHandle, TIndex, // 1 based, Which measurement record is being prin= ted Measurement.Handle, // base address Measurement.Handle, // file guid @@ -702,14 +702,14 @@ ProcessPeims( return Status; } =20 -/**=20 +/** Gather and print global data. - =20 + 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. - =20 + @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); =20 - StringPtr =3D HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_G= ENERAL), NULL); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), gDp= HiiHandle, + StringPtrUnknown =3D HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_= UNKNOWN), NULL); + StringPtr =3D HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_G= ENERAL), NULL); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDp= HiiHandle, (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), g= DpHiiHandle); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GLOBAL_SECTION), m= DpHiiHandle); } - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), gDpHiiHandl= e); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_DASHES), mDpHiiHandl= e); =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_VARS= ), gDpHiiHandle, + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GLOBAL_VARS= ), mDpHiiHandle, Index, mGaugeString, mUnicodeToken, @@ -794,9 +794,9 @@ ProcessGlobal( return Status; } =20 -/**=20 +/** Gather and print cumulative data. - =20 + 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 durat= ions. @@ -818,16 +818,16 @@ ProcessCumulative( UINTN TIndex; EFI_STRING StringPtrUnknown; =20 - StringPtrUnknown =3D HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_ALIT_= UNKNOWN), NULL); =20 - StringPtr =3D HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_C= UMULATIVE), NULL); - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), gDp= HiiHandle, + StringPtrUnknown =3D HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_= UNKNOWN), NULL); + StringPtr =3D HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_C= UMULATIVE), NULL); + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDp= HiiHandle, (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), gDpHiiHandl= e); + 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), mDpHiiHandl= e); =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); - =20 - 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/DynamicCom= mand/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 first = supported language. // - PlatformLanguage =3D GetBestLanguageForDriver(ComponentName2->Supporte= dLanguages, NULL, FALSE); + GetVariable2 (L"PlatformLang", &gEfiGlobalVariableGuid, (VOID**)&Platf= ormLanguage, 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 ? PlatformLangua= ge : "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_GA= UGE_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_NAM= E), NULL); + StringPtr =3D HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_ERROR_NAM= E), 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/DynamicComman= d/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/DynamicComman= d/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/Dyna= micCommand/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/UefiD= pLib/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/Uefi= DpLib/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 BS= D License - which accompanies this distribution. The full text of the license may b= e 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 IMP= LIED. - -**/ - -#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 suc= essfully - @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 f= ollowed by 'Strings', e.g. mycommands.uni must be - // specified as 'mycommandsStrings' because the build Autogen process de= fines this as a string array for the strings in your - // .uni file. Examine your Build folder under your package's DEBUG fold= er and you will find it defined in a xxxStrDefs.h file. - // - gDpHiiHandle =3D HiiAddPackages (&gDpHiiGuid, gImageHandle, UefiDpLibStr= ings, NULL); - if (gDpHiiHandle =3D=3D NULL) { - return (EFI_DEVICE_ERROR); - } - - // - // install our shell command handlers that are always installed - // - ShellCommandRegisterCommandName(L"dp", ShellCommandRunDp , UefiDpLibGetM= anFileName, 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/Uefi= DpLib/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 BS= D License - which accompanies this distribution. The full text of the license may b= e 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 IMP= LIED. - -**/ - -#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/Ue= fiDpLib/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 BS= D License -# which accompanies this distribution. The full text of the license may b= e 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 IMP= LIED. -# -## - -[Defines] - INF_VERSION =3D 0x00010006 - BASE_NAME =3D UefiDpLib - FILE_GUID =3D 9DF262F7-CF81-4294-B5A5-B2E3CAFE5618 - 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 the = 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 ## S= ystemTable - -[Protocols] - gEfiLoadedImageProtocolGuid ## CONSUMES - gEfiDriverBindingProtocolGuid ## SOMETIMES_CON= SUMES - gEfiComponentName2ProtocolGuid ## SOMETIMES_CON= SUMES - gEfiLoadedImageDevicePathProtocolGuid ## SOMETIMES_CON= SUMES - -[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] ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsL= ib.inf ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsL= ib.inf =20 - ShellPkg/Library/UefiDpLib/UefiDpLib.inf { - - PerformanceLib|MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerfo= rmanceLib.inf - DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf - } - ShellPkg/Application/Shell/Shell.inf { gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE @@ -123,14 +117,19 @@ [Components] NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comm= andsLib.inf NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1= CommandsLib.inf NULL|ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2= CommandsLib.inf -!ifdef $(INCLUDE_DP) - NULL|ShellPkg/Library/UefiDpLib/UefiDpLib.inf -!endif #$(INCLUDE_DP) !endif #$(NO_SHELL_PROFILES) } =20 ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf ShellPkg/DynamicCommand/TftpDynamicCommand/TftpApp.inf + ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf { + + PerformanceLib|MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerfo= rmanceLib.inf + } + ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf { + + PerformanceLib|MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerfo= rmanceLib.inf + } =20 [BuildOptions] *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES --=20 2.15.0.gvfs.1.preview.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel