From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (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 96D4221BADAB2 for ; Fri, 3 Aug 2018 02:35:42 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Aug 2018 02:35:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,438,1526367600"; d="scan'208";a="63037822" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga006.jf.intel.com with ESMTP; 03 Aug 2018 02:31:57 -0700 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 3 Aug 2018 02:31:57 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 3 Aug 2018 02:31:56 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.81]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.57]) with mapi id 14.03.0319.002; Fri, 3 Aug 2018 17:31:54 +0800 From: "Gao, Liming" To: "Bi, Dandan" , "edk2-devel@lists.01.org" CC: "Zeng, Star" Thread-Topic: [patch 4/4] MdeModulePkg: Remove DxeSmmPerformanceLib Thread-Index: AQHUJ8iN+oOqOB+NT0OpB/lmOsTIS6StygOg Date: Fri, 3 Aug 2018 09:31:53 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E2C5535@SHSMSX104.ccr.corp.intel.com> References: <20180730054504.6480-1-dandan.bi@intel.com> <20180730054504.6480-5-dandan.bi@intel.com> In-Reply-To: <20180730054504.6480-5-dandan.bi@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [patch 4/4] MdeModulePkg: Remove DxeSmmPerformanceLib X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Aug 2018 09:35:42 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao >-----Original Message----- >From: Bi, Dandan >Sent: Monday, July 30, 2018 1:45 PM >To: edk2-devel@lists.01.org >Cc: Gao, Liming ; Zeng, Star >Subject: [patch 4/4] MdeModulePkg: Remove DxeSmmPerformanceLib > >DxeSmmPerformanceLib previously is used by DP tool. >But in new pweformance infrastructure, we have updated >Dp tool to get the performance data from firmware >performance data table in ACPI. >Now the DxeSmmPerformanceLib is not used by >any module. So remove it from edk2 code base to >avoid being used by mistake. > >Cc: Liming Gao >Cc: Star Zeng >Contributed-under: TianoCore Contribution Agreement 1.1 >Signed-off-by: Dandan Bi >--- > .../DxeSmmPerformanceLib/DxeSmmPerformanceLib.c | 866 ----------------= - >---- > .../DxeSmmPerformanceLib/DxeSmmPerformanceLib.inf | 68 -- > .../DxeSmmPerformanceLib/DxeSmmPerformanceLib.uni | 24 - > MdeModulePkg/MdeModulePkg.dsc | 1 - > 4 files changed, 959 deletions(-) > delete mode 100644 >MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib.c > delete mode 100644 >MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib.i >nf > delete mode 100644 >MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib.u >ni > >diff --git >a/MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib >.c >b/MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib >.c >deleted file mode 100644 >index 353174724e..0000000000 >--- >a/MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib >.c >+++ /dev/null >@@ -1,866 +0,0 @@ >-/** @file >- Performance library instance used in DXE phase to dump both PEI/DXE and >SMM performance data. >- >- This library instance allows a DXE driver or UEFI application to dump b= oth >PEI/DXE and SMM performance data. >- StartPerformanceMeasurement(), EndPerformanceMeasurement(), >StartPerformanceMeasurementEx() >- and EndPerformanceMeasurementEx() are not implemented. >- >- Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
>-This program and the accompanying materials >-are licensed and made available under the terms and conditions of the BSD >License >-which accompanies this distribution. The full text of the license may be >found at >-http://opensource.org/licenses/bsd-license.php >- >-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, >-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER >EXPRESS OR IMPLIED. >- >-**/ >- >- >-#include >- >-#include >- >-#include >-#include >-#include >-#include >-#include >-#include >-#include >-#include >- >-#include >- >-#include >-#include >- >-#define SMM_PERFORMANCE_COMMUNICATION_BUFFER_SIZE >(OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof >(SMM_PERF_COMMUNICATE)) >- >-EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication =3D NULL; >-UINT8 *mSmmPerformanceBuffer; >-GAUGE_DATA_ENTRY *mGaugeData =3D NULL; >-UINTN mGaugeNumberOfEntries =3D 0; >-GAUGE_DATA_ENTRY_EX *mGaugeDataEx =3D NULL; >-UINTN mGaugeNumberOfEntriesEx =3D 0; >- >-BOOLEAN mNoSmmPerfHandler =3D FALSE; >-BOOLEAN mNoSmmPerfExHandler =3D FALSE; >- >-// >-// The cached Performance Protocol and PerformanceEx Protocol interface. >-// >-PERFORMANCE_PROTOCOL *mPerformance =3D NULL; >-PERFORMANCE_EX_PROTOCOL *mPerformanceEx =3D NULL; >- >-/** >- The function caches the pointer to SMM Communication protocol. >- >- The function locates SMM Communication protocol from protocol database. >- >- @retval EFI_SUCCESS SMM Communication protocol is successfully >located. >- @retval Other SMM Communication protocol is not located to lo= g >performance. >- >-**/ >-EFI_STATUS >-GetCommunicationProtocol ( >- VOID >- ) >-{ >- EFI_STATUS Status; >- EFI_SMM_COMMUNICATION_PROTOCOL *Communication; >- >- if (mSmmCommunication !=3D NULL) { >- return EFI_SUCCESS; >- } >- >- Status =3D gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL= , >(VOID **) &Communication); >- if (!EFI_ERROR (Status)) { >- ASSERT (Communication !=3D NULL); >- // >- // Cache SMM Communication protocol. >- // >- mSmmCommunication =3D Communication; >- } >- >- return Status; >-} >- >-/** >- The function caches the pointers to PerformanceEx protocol and >Performance Protocol. >- >- The function locates PerformanceEx protocol and Performance Protocol >from protocol database. >- >- @retval EFI_SUCCESS PerformanceEx protocol or Performance Protocol = is >successfully located. >- @retval EFI_NOT_FOUND Both PerformanceEx protocol and Performance >Protocol are not located to log performance. >- >-**/ >-EFI_STATUS >-GetPerformanceProtocol ( >- VOID >- ) >-{ >- EFI_STATUS Status; >- PERFORMANCE_PROTOCOL *Performance; >- PERFORMANCE_EX_PROTOCOL *PerformanceEx; >- >- if (mPerformanceEx !=3D NULL || mPerformance !=3D NULL) { >- return EFI_SUCCESS; >- } >- >- Status =3D gBS->LocateProtocol (&gPerformanceExProtocolGuid, NULL, (VOI= D >**) &PerformanceEx); >- if (!EFI_ERROR (Status)) { >- ASSERT (PerformanceEx !=3D NULL); >- // >- // Cache PerformanceEx Protocol. >- // >- mPerformanceEx =3D PerformanceEx; >- return EFI_SUCCESS; >- } >- >- Status =3D gBS->LocateProtocol (&gPerformanceProtocolGuid, NULL, (VOID = **) >&Performance); >- if (!EFI_ERROR (Status)) { >- ASSERT (Performance !=3D NULL); >- // >- // Cache performance protocol. >- // >- mPerformance =3D Performance; >- return EFI_SUCCESS; >- } >- >- return EFI_NOT_FOUND; >-} >- >-/** >- Creates a record for the beginning of a performance measurement. >- >- Creates a record that contains the Handle, Token, Module and Identifier= . >- If TimeStamp is not zero, then TimeStamp is added to the record as the = start >time. >- If TimeStamp is zero, then this function reads the current time stamp >- and adds that time stamp value to the record as the start time. >- >- @param Handle Pointer to environment specific context= used >- to identify the component being measure= d. >- @param Token Pointer to a Null-terminated ASCII stri= ng >- that identifies the component being mea= sured. >- @param Module Pointer to a Null-terminated ASCII stri= ng >- that identifies the module being measur= ed. >- @param TimeStamp 64-bit time stamp. >- @param Identifier 32-bit identifier. If the value is 0, t= he created >record >- is same as the one created by >StartPerformanceMeasurement. >- >- @retval RETURN_SUCCESS The start of the measurement was record= ed. >- @retval RETURN_OUT_OF_RESOURCES There are not enough resources to >record the measurement. >- >-**/ >-RETURN_STATUS >-EFIAPI >-StartPerformanceMeasurementEx ( >- IN CONST VOID *Handle, OPTIONAL >- IN CONST CHAR8 *Token, OPTIONAL >- IN CONST CHAR8 *Module, OPTIONAL >- IN UINT64 TimeStamp, >- IN UINT32 Identifier >- ) >-{ >- return RETURN_SUCCESS; >-} >- >-/** >- Fills in the end time of a performance measurement. >- >- Looks up the record that matches Handle, Token and Module. >- If the record can not be found then return RETURN_NOT_FOUND. >- If the record is found and TimeStamp is not zero, >- then TimeStamp is added to the record as the end time. >- If the record is found and TimeStamp is zero, then this function reads >- the current time stamp and adds that time stamp value to the record as = the >end time. >- >- @param Handle Pointer to environment specific context= used >- to identify the component being measure= d. >- @param Token Pointer to a Null-terminated ASCII stri= ng >- that identifies the component being mea= sured. >- @param Module Pointer to a Null-terminated ASCII stri= ng >- that identifies the module being measur= ed. >- @param TimeStamp 64-bit time stamp. >- @param Identifier 32-bit identifier. If the value is 0, t= he found record >- is same as the one found by EndPerforma= nceMeasurement. >- >- @retval RETURN_SUCCESS The end of the measurement was recorde= d. >- @retval RETURN_NOT_FOUND The specified measurement record could >not be found. >- >-**/ >-RETURN_STATUS >-EFIAPI >-EndPerformanceMeasurementEx ( >- IN CONST VOID *Handle, OPTIONAL >- IN CONST CHAR8 *Token, OPTIONAL >- IN CONST CHAR8 *Module, OPTIONAL >- IN UINT64 TimeStamp, >- IN UINT32 Identifier >- ) >-{ >- return RETURN_SUCCESS; >-} >- >-/** >- Creates a record for the beginning of a performance measurement. >- >- Creates a record that contains the Handle, Token, and Module. >- If TimeStamp is not zero, then TimeStamp is added to the record as the = start >time. >- If TimeStamp is zero, then this function reads the current time stamp >- and adds that time stamp value to the record as the start time. >- >- @param Handle Pointer to environment specific context= used >- to identify the component being measure= d. >- @param Token Pointer to a Null-terminated ASCII stri= ng >- that identifies the component being mea= sured. >- @param Module Pointer to a Null-terminated ASCII stri= ng >- that identifies the module being measur= ed. >- @param TimeStamp 64-bit time stamp. >- >- @retval RETURN_SUCCESS The start of the measurement was record= ed. >- @retval RETURN_OUT_OF_RESOURCES There are not enough resources to >record the measurement. >- >-**/ >-RETURN_STATUS >-EFIAPI >-StartPerformanceMeasurement ( >- IN CONST VOID *Handle, OPTIONAL >- IN CONST CHAR8 *Token, OPTIONAL >- IN CONST CHAR8 *Module, OPTIONAL >- IN UINT64 TimeStamp >- ) >-{ >- return RETURN_SUCCESS; >-} >- >-/** >- Fills in the end time of a performance measurement. >- >- Looks up the record that matches Handle, Token, and Module. >- If the record can not be found then return RETURN_NOT_FOUND. >- If the record is found and TimeStamp is not zero, >- then TimeStamp is added to the record as the end time. >- If the record is found and TimeStamp is zero, then this function reads >- the current time stamp and adds that time stamp value to the record as = the >end time. >- >- @param Handle Pointer to environment specific context= used >- to identify the component being measure= d. >- @param Token Pointer to a Null-terminated ASCII stri= ng >- that identifies the component being mea= sured. >- @param Module Pointer to a Null-terminated ASCII stri= ng >- that identifies the module being measur= ed. >- @param TimeStamp 64-bit time stamp. >- >- @retval RETURN_SUCCESS The end of the measurement was recorde= d. >- @retval RETURN_NOT_FOUND The specified measurement record could >not be found. >- >-**/ >-RETURN_STATUS >-EFIAPI >-EndPerformanceMeasurement ( >- IN CONST VOID *Handle, OPTIONAL >- IN CONST CHAR8 *Token, OPTIONAL >- IN CONST CHAR8 *Module, OPTIONAL >- IN UINT64 TimeStamp >- ) >-{ >- return RETURN_SUCCESS; >-} >- >-/** >- Attempts to retrieve a performance measurement log entry from the >performance measurement log. >- It can also retrieve the log created by StartPerformanceMeasurement and >EndPerformanceMeasurement, >- and then assign the Identifier with 0. >- >- Attempts to retrieve the performance log entry specified by LogEntryKey= . If >LogEntryKey is >- zero on entry, then an attempt is made to retrieve the first entry from= the >performance log, >- and the key for the second entry in the log is returned. If the perfor= mance >log is empty, >- then no entry is retrieved and zero is returned. If LogEntryKey is not= zero, >then the performance >- log entry associated with LogEntryKey is retrieved, and the key for the= next >entry in the log is >- returned. If LogEntryKey is the key for the last entry in the log, the= n the last >log entry is >- retrieved and an implementation specific non-zero key value that specif= ies >the end of the performance >- log is returned. If LogEntryKey is equal this implementation specific = non- >zero key value, then no entry >- is retrieved and zero is returned. In the cases where a performance lo= g >entry can be returned, >- the log entry is returned in Handle, Token, Module, StartTimeStamp, >EndTimeStamp and Identifier. >- If LogEntryKey is not a valid log entry key for the performance measure= ment >log, then ASSERT(). >- If Handle is NULL, then ASSERT(). >- If Token is NULL, then ASSERT(). >- If Module is NULL, then ASSERT(). >- If StartTimeStamp is NULL, then ASSERT(). >- If EndTimeStamp is NULL, then ASSERT(). >- If Identifier is NULL, then ASSERT(). >- >- @param LogEntryKey On entry, the key of the performance >measurement log entry to retrieve. >- 0, then the first performance measureme= nt log entry is >retrieved. >- On exit, the key of the next performanc= e log entry. >- @param Handle Pointer to environment specific context= used to >identify the component >- being measured. >- @param Token Pointer to a Null-terminated ASCII stri= ng that >identifies the component >- being measured. >- @param Module Pointer to a Null-terminated ASCII stri= ng that >identifies the module >- being measured. >- @param StartTimeStamp Pointer to the 64-bit time stamp that w= as >recorded when the measurement >- was started. >- @param EndTimeStamp Pointer to the 64-bit time stamp that w= as >recorded when the measurement >- was ended. >- @param Identifier Pointer to the 32-bit identifier that w= as recorded. >- >- @return The key for the next performance log entry (in general case). >- >-**/ >-UINTN >-EFIAPI >-GetByPerformanceProtocol ( >- IN UINTN LogEntryKey, >- OUT CONST VOID **Handle, >- OUT CONST CHAR8 **Token, >- OUT CONST CHAR8 **Module, >- OUT UINT64 *StartTimeStamp, >- OUT UINT64 *EndTimeStamp, >- OUT UINT32 *Identifier >- ) >-{ >- EFI_STATUS Status; >- GAUGE_DATA_ENTRY_EX *GaugeData; >- >- Status =3D GetPerformanceProtocol (); >- if (EFI_ERROR (Status)) { >- return 0; >- } >- >- if (mPerformanceEx !=3D NULL) { >- Status =3D mPerformanceEx->GetGaugeEx (LogEntryKey++, &GaugeData); >- } else if (mPerformance !=3D NULL) { >- Status =3D mPerformance->GetGauge (LogEntryKey++, >(GAUGE_DATA_ENTRY **) &GaugeData); >- } else { >- ASSERT (FALSE); >- return 0; >- } >- >- // >- // Make sure that LogEntryKey is a valid log entry key, >- // >- ASSERT (Status !=3D EFI_INVALID_PARAMETER); >- >- if (EFI_ERROR (Status)) { >- // >- // The LogEntryKey is the last entry (equals to the total entry numbe= r). >- // >- return 0; >- } >- >- ASSERT (GaugeData !=3D NULL); >- >- *Handle =3D (VOID *) (UINTN) GaugeData->Handle; >- *Token =3D GaugeData->Token; >- *Module =3D GaugeData->Module; >- *StartTimeStamp =3D GaugeData->StartTimeStamp; >- *EndTimeStamp =3D GaugeData->EndTimeStamp; >- if (mPerformanceEx !=3D NULL) { >- *Identifier =3D GaugeData->Identifier; >- } else { >- *Identifier =3D 0; >- } >- >- return LogEntryKey; >-} >- >- >-/** >- Retrieves all previous logged performance measurement. >- Function will use SMM communicate protocol to get all previous SMM >performance measurement data. >- If success, data buffer will be returned. If fail function will return = NULL. >- >- @param LogEntryKey On entry, the key of the performance >measurement log entry to retrieve. >- 0, then the first performance measureme= nt log entry is >retrieved. >- On exit, the key of the next performanc= e log entry. >- >- @retval !NULL Get all gauge data success. >- @retval NULL Get all gauge data failed. >-**/ >-GAUGE_DATA_ENTRY * >-EFIAPI >-GetAllSmmGaugeData ( >- IN UINTN LogEntryKey >- ) >-{ >- EFI_STATUS Status; >- EFI_SMM_COMMUNICATE_HEADER *SmmCommBufferHeader; >- SMM_PERF_COMMUNICATE *SmmPerfCommData; >- UINTN CommSize; >- UINTN DataSize; >- EDKII_PI_SMM_COMMUNICATION_REGION_TABLE >*PiSmmCommunicationRegionTable; >- UINT32 Index; >- EFI_MEMORY_DESCRIPTOR *Entry; >- UINT8 *Buffer; >- UINTN Size; >- UINTN NumberOfEntries; >- UINTN EntriesGot; >- >- if (mNoSmmPerfHandler) { >- // >- // Not try to get the SMM gauge data again >- // if no SMM Performance handler found. >- // >- return NULL; >- } >- >- if (LogEntryKey !=3D 0) { >- if (mGaugeData !=3D NULL) { >- return mGaugeData; >- } >- } else { >- // >- // Reget the SMM gauge data at the first entry get. >- // >- if (mGaugeData !=3D NULL) { >- FreePool (mGaugeData); >- mGaugeData =3D NULL; >- mGaugeNumberOfEntries =3D 0; >- } >- } >- >- Status =3D GetCommunicationProtocol (); >- if (EFI_ERROR (Status)) { >- return NULL; >- } >- >- Status =3D EfiGetSystemConfigurationTable ( >- &gEdkiiPiSmmCommunicationRegionTableGuid, >- (VOID **) &PiSmmCommunicationRegionTable >- ); >- if (EFI_ERROR (Status)) { >- return NULL; >- } >- ASSERT (PiSmmCommunicationRegionTable !=3D NULL); >- Entry =3D (EFI_MEMORY_DESCRIPTOR *) (PiSmmCommunicationRegionTable >+ 1); >- Size =3D 0; >- for (Index =3D 0; Index < PiSmmCommunicationRegionTable- >>NumberOfEntries; Index++) { >- if (Entry->Type =3D=3D EfiConventionalMemory) { >- Size =3D EFI_PAGES_TO_SIZE ((UINTN) Entry->NumberOfPages); >- if (Size >=3D (SMM_PERFORMANCE_COMMUNICATION_BUFFER_SIZE + >sizeof (GAUGE_DATA_ENTRY))) { >- break; >- } >- } >- Entry =3D (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) Entry + >PiSmmCommunicationRegionTable->DescriptorSize); >- } >- ASSERT (Index < PiSmmCommunicationRegionTable->NumberOfEntries); >- mSmmPerformanceBuffer =3D (UINT8 *) (UINTN) Entry->PhysicalStart; >- >- // >- // Initialize communicate buffer >- // >- SmmCommBufferHeader =3D (EFI_SMM_COMMUNICATE_HEADER >*)mSmmPerformanceBuffer; >- SmmPerfCommData =3D (SMM_PERF_COMMUNICATE >*)SmmCommBufferHeader->Data; >- ZeroMem((UINT8*)SmmPerfCommData, >sizeof(SMM_PERF_COMMUNICATE)); >- >- CopyGuid (&SmmCommBufferHeader->HeaderGuid, >&gSmmPerformanceProtocolGuid); >- SmmCommBufferHeader->MessageLength =3D >sizeof(SMM_PERF_COMMUNICATE); >- CommSize =3D SMM_PERFORMANCE_COMMUNICATION_BUFFER_SIZE; >- >- // >- // Get total number of SMM gauge entries >- // >- SmmPerfCommData->Function =3D >SMM_PERF_FUNCTION_GET_GAUGE_ENTRY_NUMBER; >- Status =3D mSmmCommunication->Communicate (mSmmCommunication, >mSmmPerformanceBuffer, &CommSize); >- if (Status =3D=3D EFI_NOT_FOUND) { >- mNoSmmPerfHandler =3D TRUE; >- } >- if (EFI_ERROR (Status) || EFI_ERROR (SmmPerfCommData->ReturnStatus) >|| SmmPerfCommData->NumberOfEntries =3D=3D 0) { >- return NULL; >- } >- >- mGaugeNumberOfEntries =3D SmmPerfCommData->NumberOfEntries; >- >- Buffer =3D mSmmPerformanceBuffer + >SMM_PERFORMANCE_COMMUNICATION_BUFFER_SIZE; >- NumberOfEntries =3D (Size - >SMM_PERFORMANCE_COMMUNICATION_BUFFER_SIZE) / sizeof >(GAUGE_DATA_ENTRY); >- DataSize =3D mGaugeNumberOfEntries * sizeof(GAUGE_DATA_ENTRY); >- mGaugeData =3D AllocateZeroPool(DataSize); >- ASSERT (mGaugeData !=3D NULL); >- >- // >- // Get all SMM gauge data >- // >- SmmPerfCommData->Function =3D >SMM_PERF_FUNCTION_GET_GAUGE_DATA; >- SmmPerfCommData->GaugeData =3D (GAUGE_DATA_ENTRY *) Buffer; >- EntriesGot =3D 0; >- do { >- SmmPerfCommData->LogEntryKey =3D EntriesGot; >- if ((mGaugeNumberOfEntries - EntriesGot) >=3D NumberOfEntries) { >- SmmPerfCommData->NumberOfEntries =3D NumberOfEntries; >- } else { >- SmmPerfCommData->NumberOfEntries =3D mGaugeNumberOfEntries - >EntriesGot; >- } >- Status =3D mSmmCommunication->Communicate (mSmmCommunication, >mSmmPerformanceBuffer, &CommSize); >- if (EFI_ERROR (Status) || EFI_ERROR (SmmPerfCommData->ReturnStatus)) >{ >- FreePool (mGaugeData); >- mGaugeData =3D NULL; >- mGaugeNumberOfEntries =3D 0; >- return NULL; >- } else { >- CopyMem (&mGaugeData[EntriesGot], Buffer, SmmPerfCommData- >>NumberOfEntries * sizeof (GAUGE_DATA_ENTRY)); >- } >- EntriesGot +=3D SmmPerfCommData->NumberOfEntries; >- } while (EntriesGot < mGaugeNumberOfEntries); >- >- return mGaugeData; >-} >- >-/** >- Retrieves all previous logged performance measurement. >- Function will use SMM communicate protocol to get all previous SMM >performance measurement data. >- If success, data buffer will be returned. If fail function will return = NULL. >- >- @param LogEntryKey On entry, the key of the performance >measurement log entry to retrieve. >- 0, then the first performance measureme= nt log entry is >retrieved. >- On exit, the key of the next performanc= e log entry. >- >- @retval !NULL Get all gauge data success. >- @retval NULL Get all gauge data failed. >-**/ >-GAUGE_DATA_ENTRY_EX * >-EFIAPI >-GetAllSmmGaugeDataEx ( >- IN UINTN LogEntryKey >- ) >-{ >- EFI_STATUS Status; >- EFI_SMM_COMMUNICATE_HEADER *SmmCommBufferHeader; >- SMM_PERF_COMMUNICATE_EX *SmmPerfCommData; >- UINTN CommSize; >- UINTN DataSize; >- EDKII_PI_SMM_COMMUNICATION_REGION_TABLE >*PiSmmCommunicationRegionTable; >- UINT32 Index; >- EFI_MEMORY_DESCRIPTOR *Entry; >- UINT8 *Buffer; >- UINTN Size; >- UINTN NumberOfEntries; >- UINTN EntriesGot; >- >- if (mNoSmmPerfExHandler) { >- // >- // Not try to get the SMM gauge data again >- // if no SMM PerformanceEx handler found. >- // >- return NULL; >- } >- >- if (LogEntryKey !=3D 0) { >- if (mGaugeDataEx !=3D NULL) { >- return mGaugeDataEx; >- } >- } else { >- // >- // Reget the SMM gauge data at the first entry get. >- // >- if (mGaugeDataEx !=3D NULL) { >- FreePool (mGaugeDataEx); >- mGaugeDataEx =3D NULL; >- mGaugeNumberOfEntriesEx =3D 0; >- } >- } >- >- Status =3D GetCommunicationProtocol (); >- if (EFI_ERROR (Status)) { >- return NULL; >- } >- >- Status =3D EfiGetSystemConfigurationTable ( >- &gEdkiiPiSmmCommunicationRegionTableGuid, >- (VOID **) &PiSmmCommunicationRegionTable >- ); >- if (EFI_ERROR (Status)) { >- return NULL; >- } >- ASSERT (PiSmmCommunicationRegionTable !=3D NULL); >- Entry =3D (EFI_MEMORY_DESCRIPTOR *) (PiSmmCommunicationRegionTable >+ 1); >- Size =3D 0; >- for (Index =3D 0; Index < PiSmmCommunicationRegionTable- >>NumberOfEntries; Index++) { >- if (Entry->Type =3D=3D EfiConventionalMemory) { >- Size =3D EFI_PAGES_TO_SIZE ((UINTN) Entry->NumberOfPages); >- if (Size >=3D (SMM_PERFORMANCE_COMMUNICATION_BUFFER_SIZE + >sizeof (GAUGE_DATA_ENTRY_EX))) { >- break; >- } >- } >- Entry =3D (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) Entry + >PiSmmCommunicationRegionTable->DescriptorSize); >- } >- ASSERT (Index < PiSmmCommunicationRegionTable->NumberOfEntries); >- mSmmPerformanceBuffer =3D (UINT8 *) (UINTN) Entry->PhysicalStart; >- // >- // Initialize communicate buffer >- // >- SmmCommBufferHeader =3D (EFI_SMM_COMMUNICATE_HEADER >*)mSmmPerformanceBuffer; >- SmmPerfCommData =3D (SMM_PERF_COMMUNICATE_EX >*)SmmCommBufferHeader->Data; >- ZeroMem((UINT8*)SmmPerfCommData, >sizeof(SMM_PERF_COMMUNICATE_EX)); >- >- CopyGuid (&SmmCommBufferHeader->HeaderGuid, >&gSmmPerformanceExProtocolGuid); >- SmmCommBufferHeader->MessageLength =3D >sizeof(SMM_PERF_COMMUNICATE_EX); >- CommSize =3D SMM_PERFORMANCE_COMMUNICATION_BUFFER_SIZE; >- >- // >- // Get total number of SMM gauge entries >- // >- SmmPerfCommData->Function =3D >SMM_PERF_FUNCTION_GET_GAUGE_ENTRY_NUMBER; >- Status =3D mSmmCommunication->Communicate (mSmmCommunication, >mSmmPerformanceBuffer, &CommSize); >- if (Status =3D=3D EFI_NOT_FOUND) { >- mNoSmmPerfExHandler =3D TRUE; >- } >- if (EFI_ERROR (Status) || EFI_ERROR (SmmPerfCommData->ReturnStatus) >|| SmmPerfCommData->NumberOfEntries =3D=3D 0) { >- return NULL; >- } >- >- mGaugeNumberOfEntriesEx =3D SmmPerfCommData->NumberOfEntries; >- >- Buffer =3D mSmmPerformanceBuffer + >SMM_PERFORMANCE_COMMUNICATION_BUFFER_SIZE; >- NumberOfEntries =3D (Size - >SMM_PERFORMANCE_COMMUNICATION_BUFFER_SIZE) / sizeof >(GAUGE_DATA_ENTRY_EX); >- DataSize =3D mGaugeNumberOfEntriesEx * sizeof(GAUGE_DATA_ENTRY_EX); >- mGaugeDataEx =3D AllocateZeroPool(DataSize); >- ASSERT (mGaugeDataEx !=3D NULL); >- >- // >- // Get all SMM gauge data >- // >- SmmPerfCommData->Function =3D >SMM_PERF_FUNCTION_GET_GAUGE_DATA; >- SmmPerfCommData->GaugeDataEx =3D (GAUGE_DATA_ENTRY_EX *) Buffer; >- EntriesGot =3D 0; >- do { >- SmmPerfCommData->LogEntryKey =3D EntriesGot; >- if ((mGaugeNumberOfEntriesEx - EntriesGot) >=3D NumberOfEntries) { >- SmmPerfCommData->NumberOfEntries =3D NumberOfEntries; >- } else { >- SmmPerfCommData->NumberOfEntries =3D mGaugeNumberOfEntriesEx - >EntriesGot; >- } >- Status =3D mSmmCommunication->Communicate (mSmmCommunication, >mSmmPerformanceBuffer, &CommSize); >- if (EFI_ERROR (Status) || EFI_ERROR (SmmPerfCommData->ReturnStatus)) >{ >- FreePool (mGaugeDataEx); >- mGaugeDataEx =3D NULL; >- mGaugeNumberOfEntriesEx =3D 0; >- return NULL; >- } else { >- CopyMem (&mGaugeDataEx[EntriesGot], Buffer, SmmPerfCommData- >>NumberOfEntries * sizeof (GAUGE_DATA_ENTRY_EX)); >- } >- EntriesGot +=3D SmmPerfCommData->NumberOfEntries; >- } while (EntriesGot < mGaugeNumberOfEntriesEx); >- >- return mGaugeDataEx; >-} >- >-/** >- Attempts to retrieve a performance measurement log entry from the >performance measurement log. >- It can also retrieve the log created by StartPerformanceMeasurement and >EndPerformanceMeasurement, >- and then assign the Identifier with 0. >- >- Attempts to retrieve the performance log entry specified by LogEntryKey= . If >LogEntryKey is >- zero on entry, then an attempt is made to retrieve the first entry from= the >performance log, >- and the key for the second entry in the log is returned. If the perfor= mance >log is empty, >- then no entry is retrieved and zero is returned. If LogEntryKey is not= zero, >then the performance >- log entry associated with LogEntryKey is retrieved, and the key for the= next >entry in the log is >- returned. If LogEntryKey is the key for the last entry in the log, the= n the last >log entry is >- retrieved and an implementation specific non-zero key value that specif= ies >the end of the performance >- log is returned. If LogEntryKey is equal this implementation specific = non- >zero key value, then no entry >- is retrieved and zero is returned. In the cases where a performance lo= g >entry can be returned, >- the log entry is returned in Handle, Token, Module, StartTimeStamp, >EndTimeStamp and Identifier. >- If LogEntryKey is not a valid log entry key for the performance measure= ment >log, then ASSERT(). >- If Handle is NULL, then ASSERT(). >- If Token is NULL, then ASSERT(). >- If Module is NULL, then ASSERT(). >- If StartTimeStamp is NULL, then ASSERT(). >- If EndTimeStamp is NULL, then ASSERT(). >- If Identifier is NULL, then ASSERT(). >- >- @param LogEntryKey On entry, the key of the performance >measurement log entry to retrieve. >- 0, then the first performance measureme= nt log entry is >retrieved. >- On exit, the key of the next performanc= e log entry. >- @param Handle Pointer to environment specific context= used to >identify the component >- being measured. >- @param Token Pointer to a Null-terminated ASCII stri= ng that >identifies the component >- being measured. >- @param Module Pointer to a Null-terminated ASCII stri= ng that >identifies the module >- being measured. >- @param StartTimeStamp Pointer to the 64-bit time stamp that w= as >recorded when the measurement >- was started. >- @param EndTimeStamp Pointer to the 64-bit time stamp that w= as >recorded when the measurement >- was ended. >- @param Identifier Pointer to the 32-bit identifier that w= as recorded. >- >- @return The key for the next performance log entry (in general case). >- >-**/ >-UINTN >-EFIAPI >-GetPerformanceMeasurementEx ( >- IN UINTN LogEntryKey, >- OUT CONST VOID **Handle, >- OUT CONST CHAR8 **Token, >- OUT CONST CHAR8 **Module, >- OUT UINT64 *StartTimeStamp, >- OUT UINT64 *EndTimeStamp, >- OUT UINT32 *Identifier >- ) >-{ >- GAUGE_DATA_ENTRY_EX *GaugeData; >- >- GaugeData =3D NULL; >- >- ASSERT (Handle !=3D NULL); >- ASSERT (Token !=3D NULL); >- ASSERT (Module !=3D NULL); >- ASSERT (StartTimeStamp !=3D NULL); >- ASSERT (EndTimeStamp !=3D NULL); >- ASSERT (Identifier !=3D NULL); >- >- mGaugeDataEx =3D GetAllSmmGaugeDataEx (LogEntryKey); >- if (mGaugeDataEx !=3D NULL) { >- if (LogEntryKey >=3D mGaugeNumberOfEntriesEx) { >- // >- // Try to get the data by Performance Protocol. >- // >- LogEntryKey =3D LogEntryKey - mGaugeNumberOfEntriesEx; >- LogEntryKey =3D GetByPerformanceProtocol ( >- LogEntryKey, >- Handle, >- Token, >- Module, >- StartTimeStamp, >- EndTimeStamp, >- Identifier >- ); >- if (LogEntryKey =3D=3D 0) { >- // >- // Last entry. >- // >- return LogEntryKey; >- } else { >- return (LogEntryKey + mGaugeNumberOfEntriesEx); >- } >- } >- >- GaugeData =3D &mGaugeDataEx[LogEntryKey++]; >- *Identifier =3D GaugeData->Identifier; >- } else { >- mGaugeData =3D GetAllSmmGaugeData (LogEntryKey); >- if (mGaugeData !=3D NULL) { >- if (LogEntryKey >=3D mGaugeNumberOfEntries) { >- // >- // Try to get the data by Performance Protocol. >- // >- LogEntryKey =3D LogEntryKey - mGaugeNumberOfEntries; >- LogEntryKey =3D GetByPerformanceProtocol ( >- LogEntryKey, >- Handle, >- Token, >- Module, >- StartTimeStamp, >- EndTimeStamp, >- Identifier >- ); >- if (LogEntryKey =3D=3D 0) { >- // >- // Last entry. >- // >- return LogEntryKey; >- } else { >- return (LogEntryKey + mGaugeNumberOfEntries); >- } >- } >- >- GaugeData =3D (GAUGE_DATA_ENTRY_EX *) >&mGaugeData[LogEntryKey++]; >- *Identifier =3D 0; >- } else { >- return GetByPerformanceProtocol ( >- LogEntryKey, >- Handle, >- Token, >- Module, >- StartTimeStamp, >- EndTimeStamp, >- Identifier >- ); >- } >- } >- >- *Handle =3D (VOID *) (UINTN) GaugeData->Handle; >- *Token =3D GaugeData->Token; >- *Module =3D GaugeData->Module; >- *StartTimeStamp =3D GaugeData->StartTimeStamp; >- *EndTimeStamp =3D GaugeData->EndTimeStamp; >- >- return LogEntryKey; >-} >- >-/** >- Attempts to retrieve a performance measurement log entry from the >performance measurement log. >- It can also retrieve the log created by StartPerformanceMeasurementEx a= nd >EndPerformanceMeasurementEx, >- and then eliminate the Identifier. >- >- Attempts to retrieve the performance log entry specified by LogEntryKey= . If >LogEntryKey is >- zero on entry, then an attempt is made to retrieve the first entry from= the >performance log, >- and the key for the second entry in the log is returned. If the perfor= mance >log is empty, >- then no entry is retrieved and zero is returned. If LogEntryKey is not= zero, >then the performance >- log entry associated with LogEntryKey is retrieved, and the key for the= next >entry in the log is >- returned. If LogEntryKey is the key for the last entry in the log, the= n the last >log entry is >- retrieved and an implementation specific non-zero key value that specif= ies >the end of the performance >- log is returned. If LogEntryKey is equal this implementation specific = non- >zero key value, then no entry >- is retrieved and zero is returned. In the cases where a performance lo= g >entry can be returned, >- the log entry is returned in Handle, Token, Module, StartTimeStamp, and >EndTimeStamp. >- If LogEntryKey is not a valid log entry key for the performance measure= ment >log, then ASSERT(). >- If Handle is NULL, then ASSERT(). >- If Token is NULL, then ASSERT(). >- If Module is NULL, then ASSERT(). >- If StartTimeStamp is NULL, then ASSERT(). >- If EndTimeStamp is NULL, then ASSERT(). >- >- @param LogEntryKey On entry, the key of the performance >measurement log entry to retrieve. >- 0, then the first performance measureme= nt log entry is >retrieved. >- On exit, the key of the next performanc= e log entry. >- @param Handle Pointer to environment specific context= used to >identify the component >- being measured. >- @param Token Pointer to a Null-terminated ASCII stri= ng that >identifies the component >- being measured. >- @param Module Pointer to a Null-terminated ASCII stri= ng that >identifies the module >- being measured. >- @param StartTimeStamp Pointer to the 64-bit time stamp that w= as >recorded when the measurement >- was started. >- @param EndTimeStamp Pointer to the 64-bit time stamp that w= as >recorded when the measurement >- was ended. >- >- @return The key for the next performance log entry (in general case). >- >-**/ >-UINTN >-EFIAPI >-GetPerformanceMeasurement ( >- IN UINTN LogEntryKey, >- OUT CONST VOID **Handle, >- OUT CONST CHAR8 **Token, >- OUT CONST CHAR8 **Module, >- OUT UINT64 *StartTimeStamp, >- OUT UINT64 *EndTimeStamp >- ) >-{ >- UINT32 Identifier; >- return GetPerformanceMeasurementEx (LogEntryKey, Handle, Token, >Module, StartTimeStamp, EndTimeStamp, &Identifier); >-} >- >-/** >- Returns TRUE if the performance measurement macros are enabled. >- >- This function returns TRUE if the >PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of >- PcdPerformanceLibraryPropertyMask is set. Otherwise FALSE is returned. >- >- @retval TRUE The >PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of >- PcdPerformanceLibraryPropertyMask is se= t. >- @retval FALSE The >PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of >- PcdPerformanceLibraryPropertyMask is cl= ear. >- >-**/ >-BOOLEAN >-EFIAPI >-PerformanceMeasurementEnabled ( >- VOID >- ) >-{ >- return (BOOLEAN) ((PcdGet8(PcdPerformanceLibraryPropertyMask) & >PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) !=3D 0); >-} >diff --git >a/MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib >.inf >b/MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib >.inf >deleted file mode 100644 >index f4d94c23e8..0000000000 >--- >a/MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib >.inf >+++ /dev/null >@@ -1,68 +0,0 @@ >-## @file >-# Performance library instance used in DXE phase to dump SMM >performance data. >-# >-# This library instance allows a DXE driver or UEFI application to dump = both >PEI/DXE and SMM performance data. >-# StartPerformanceMeasurement(), EndPerformanceMeasurement(), >StartPerformanceMeasurementEx() >-# and EndPerformanceMeasurementEx() are not implemented. >-# >-# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
>-# This program and the accompanying materials >-# are licensed and made available under the terms and conditions of the = BSD >License >-# which accompanies this distribution. The full text of the license may= be >found at >-# http://opensource.org/licenses/bsd-license.php >-# >-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" >BASIS, >-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER >EXPRESS OR IMPLIED. >-# >-## >- >-[Defines] >- INF_VERSION =3D 0x00010005 >- BASE_NAME =3D DxeSmmPerformanceLib >- MODULE_UNI_FILE =3D DxeSmmPerformanceLib.uni >- FILE_GUID =3D DA80C15C-0B4D-4e75-8946-4043DE559B0C >- MODULE_TYPE =3D DXE_DRIVER >- VERSION_STRING =3D 1.0 >- LIBRARY_CLASS =3D PerformanceLib|DXE_DRIVER >DXE_RUNTIME_DRIVER UEFI_APPLICATION >- >-# >-# The following information is for reference only and not required by the >build tools. >-# >-# VALID_ARCHITECTURES =3D IA32 X64 >-# >- >-[Sources] >- DxeSmmPerformanceLib.c >- >- >-[Packages] >- MdePkg/MdePkg.dec >- MdeModulePkg/MdeModulePkg.dec >- >- >-[LibraryClasses] >- BaseLib >- UefiBootServicesTableLib >- PcdLib >- DebugLib >- BaseMemoryLib >- UefiRuntimeServicesTableLib >- MemoryAllocationLib >- UefiLib >- >-[Guids] >- gPerformanceProtocolGuid ## SOMETIMES_CONSUMES ## >UNDEFINED # Locate protocol >- gPerformanceExProtocolGuid ## SOMETIMES_CONSUMES ## >UNDEFINED # Locate protocol >- gSmmPerformanceProtocolGuid ## SOMETIMES_PRODUCES ## >UNDEFINED # Used to do smm communication >- gSmmPerformanceExProtocolGuid ## SOMETIMES_PRODUCES ## >UNDEFINED # Used to do smm communication >- gEdkiiPiSmmCommunicationRegionTableGuid ## CONSUMES ## >SystemTable >- >-[Protocols] >- gEfiSmmCommunicationProtocolGuid ## CONSUMES >- >- >-[Pcd] >- gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask ## >CONSUMES >- >-[Depex.common.DXE_DRIVER, Depex.common.DXE_RUNTIME_DRIVER] >- gEfiSmmCommunicationProtocolGuid >diff --git >a/MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib >.uni >b/MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib >.uni >deleted file mode 100644 >index 6db8cff7a4..0000000000 >--- >a/MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib >.uni >+++ /dev/null >@@ -1,24 +0,0 @@ >-// /** @file >-// Performance library instance used in DXE phase to dump SMM >performance data. >-// >-// This library instance allows a DXE driver or UEFI application to dump = the >SMM performance data. >-// StartPerformanceMeasurement(), EndPerformanceMeasurement(), >StartPerformanceMeasurementEx() >-// and EndPerformanceMeasurementEx() are not implemented. >-// >-// Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
>-// >-// This program and the accompanying materials >-// are licensed and made available under the terms and conditions of the = BSD >License >-// which accompanies this distribution. The full text of the license may= be >found at >-// http://opensource.org/licenses/bsd-license.php >-// >-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" >BASIS, >-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER >EXPRESS OR IMPLIED. >-// >-// **/ >- >- >-#string STR_MODULE_ABSTRACT #language en-US "Used in DXE phas= e >to dump SMM performance data" >- >-#string STR_MODULE_DESCRIPTION #language en-US "This library >instance allows a DXE driver or UEFI application to dump the SMM >performance data. StartPerformanceMeasurement(), >EndPerformanceMeasurement(), StartPerformanceMeasurementEx() and >EndPerformanceMeasurementEx() are not implemented." >- >diff --git a/MdeModulePkg/MdeModulePkg.dsc >b/MdeModulePkg/MdeModulePkg.dsc >index ef7b46fedc..19d7713c33 100644 >--- a/MdeModulePkg/MdeModulePkg.dsc >+++ b/MdeModulePkg/MdeModulePkg.dsc >@@ -487,11 +487,10 @@ > >MdeModulePkg/Library/SmmMemoryAllocationProfileLib/SmmMemoryAlloc >ationProfileLib.inf > >MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemor >yAllocationProfileLib.inf > >MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemor >yAllocationLib.inf > >MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib. >inf > MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.inf >- >MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib.i >nf > MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.inf > MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxDxeLib.inf > MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.inf > >MdeModulePkg/Library/SmmCorePlatformHookLibNull/SmmCorePlatformHo >okLibNull.inf > >MdeModulePkg/Library/SmmSmiHandlerProfileLib/SmmSmiHandlerProfileLib >.inf >-- >2.14.3.windows.1