From nobody Wed May 15 14:07:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+81743+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81743+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1633924158; cv=none; d=zohomail.com; s=zohoarc; b=TTIsI3c6U0P14TnzLQc1WD/cS1RAtpfGiUm7ETlXXl+UIcKxuZjfKTDdOZoN6sT2h93tHUNSFWoqd0Sjx8F8SCX7hLwF56hUeL4jz1puG1JPkp3SxSmQwD4sIlsfWFPsf9uVRfCVSY2Jd9N2QSahryX6Ebbb7gfmlmN9Ah7nnuc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633924158; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=uJF18L48rrcUyqdLwxeRbEdgX1zHm5NX2UO5x+AzipM=; b=cpjeqzGpcntfUGNHjjFoIBQuf8DxT/E1509Ss+M3zoZ69TJWL5AWVpFvOZIH16zEhxPXJ7eoOdPLCs2eRQh4YrCpQqcBm/BXflQrMJi4GfbnLMooW7EOEaXdFxrr9sBtiOoBMowV5GK4xGMM7uZ2OuS0REqudA2OjpVrbvoofpE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81743+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1633924158657241.35232385801282; Sun, 10 Oct 2021 20:49:18 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id ZntmYY1788612xDitCpGfYiU; Sun, 10 Oct 2021 20:49:18 -0700 X-Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web09.7237.1633924156394808362 for ; Sun, 10 Oct 2021 20:49:17 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10133"; a="287670281" X-IronPort-AV: E=Sophos;i="5.85,363,1624345200"; d="scan'208";a="287670281" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2021 20:49:15 -0700 X-IronPort-AV: E=Sophos;i="5.85,363,1624345200"; d="scan'208";a="490295818" X-Received: from shwdeqlab1144.ccr.corp.intel.com ([10.239.154.132]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2021 20:49:13 -0700 From: "Dandan Bi" To: devel@edk2.groups.io Cc: Dandan Bi , Liming Gao , Hao A Wu , Jian J Wang Subject: [edk2-devel] [PATCH] MdeModulePkg/FPDT: Lock boot performance table address variable at EndOfDxe Date: Mon, 11 Oct 2021 11:48:52 +0800 Message-Id: <20211011034852.12032-1-dandan.bi@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,dandan.bi@intel.com X-Gm-Message-State: hrHnRxk70snIXBY8GzU3K7xYx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1633924158; bh=RLhHOB8axzw3i6hOCbmdIqgL7N2VG003kBcb6PypKkY=; h=Cc:Date:From:Reply-To:Subject:To; b=IDzAvGRUykNR2D8LkcN3CI3FTgL2pHQnlc+R8XzOBLBZVxSMu1MHFGe5UT2wS0oPmUD DGdkn1660GxkK9kquMAb9Q6YPVb/k8q4Szbh1cxmopzgHVCECsBjbs3mbCYsR2/ayqBSt p6vV3OTChj632VYWyC4dh31XxAZHNksd2O0= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1633924160037100001 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2957 1. Allocate performance data table at EndOfDxe and then lock the varible which store the table address at EndOfDxe. 2. Enlarge PCD gEfiMdeModulePkgTokenSpaceGuid.PcdExtFpdtBootRecordPadSize from 0x20000 to 0x30000 in order to hold the Delta performance data between EndOfDxe and ReadyToBoot. 3. SMM performance data is collected by DXE modules through SMM communicati= on at ReadyToBoot before. Now to do SMM communication twice, one for allocating the performance size at EndOfDxe, another is at ReadyToBoot to get SMM performance data. 4. Make SmmCorePerformanceLib rather than FirmwarePerformanceSmm to communi= cate with DxeCorePerformanceLib for SMM performance data and size. Cc: Liming Gao Cc: Hao A Wu Cc: Jian J Wang =20 Signed-off-by: Dandan Bi Reviewed-by: Hao A Wu --- .../DxeCorePerformanceLib.c | 132 +++++++++++---- .../DxeCorePerformanceLib.inf | 3 +- .../SmmCorePerformanceLib.c | 142 +++++++++++++---- .../SmmCorePerformanceLib.inf | 5 +- MdeModulePkg/MdeModulePkg.dec | 4 +- .../FirmwarePerformanceDxe.c | 90 +++++++++-- .../FirmwarePerformanceDxe.inf | 6 +- .../FirmwarePerformanceCommon.c | 150 +----------------- .../FirmwarePerformanceCommon.h | 17 +- .../FirmwarePerformanceSmm.inf | 4 +- .../FirmwarePerformanceStandaloneMm.c | 21 +-- .../FirmwarePerformanceStandaloneMm.inf | 4 +- .../FirmwarePerformanceTraditional.c | 21 +-- 13 files changed, 306 insertions(+), 293 deletions(-) diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceL= ib.c b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c index d378c59dd9..532b3f8c90 100644 --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c @@ -10,7 +10,7 @@ This library is mainly used by DxeCore to start performance logging to e= nsure that Performance Protocol is installed at the very beginning of DXE phase. =20 -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -64,7 +64,7 @@ UINT32 mLoadImageCount =3D 0; UINT32 mPerformanceLength =3D 0; UINT32 mMaxPerformanceLength =3D 0; UINT32 mBootRecordSize =3D 0; -UINT32 mBootRecordMaxSize =3D 0; +UINTN mBootRecordMaxSize =3D 0; UINT32 mCachedLength =3D 0; =20 BOOLEAN mFpdtBufferIsReported =3D FALSE; @@ -205,25 +205,26 @@ IsKnownID ( } =20 /** - Allocate buffer for Boot Performance table. + This internal function dumps all the SMM performance data and size. =20 - @return Status code. + @param SmmPerfData Smm Performance data. The buffer contain th= e SMM perf data is allocated by this function and caller needs to free it. + @param SmmPerfDataSize Smm Performance data size. + @param SkipGetPerfData Skip to get performance data, just get the = size. =20 **/ -EFI_STATUS -AllocateBootPerformanceTable ( +VOID +InternalGetSmmPerfData ( + OUT VOID **SmmPerfData, + OUT UINTN *SmmPerfDataSize, + IN BOOLEAN SkipGetPerfData ) { EFI_STATUS Status; - UINTN Size; UINT8 *SmmBootRecordCommBuffer; EFI_SMM_COMMUNICATE_HEADER *SmmCommBufferHeader; SMM_BOOT_RECORD_COMMUNICATE *SmmCommData; UINTN CommSize; - UINTN BootPerformanceDataSize; - UINT8 *BootPerformanceData; EFI_SMM_COMMUNICATION_PROTOCOL *Communication; - FIRMWARE_PERFORMANCE_VARIABLE PerformanceVariable; EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *SmmCommRegionTable; EFI_MEMORY_DESCRIPTOR *SmmCommMemRegion; UINTN Index; @@ -237,7 +238,6 @@ AllocateBootPerformanceTable ( SmmBootRecordCommBuffer =3D NULL; SmmCommData =3D NULL; SmmBootRecordData =3D NULL; - SmmBootRecordDataSize =3D 0; ReservedMemSize =3D 0; Status =3D gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL,= (VOID **) &Communication); if (!EFI_ERROR (Status)) { @@ -284,6 +284,10 @@ AllocateBootPerformanceTable ( Status =3D Communication->Communicate (Communication, SmmBootRecor= dCommBuffer, &CommSize); =20 if (!EFI_ERROR (Status) && !EFI_ERROR (SmmCommData->ReturnStatus) = && SmmCommData->BootRecordSize !=3D 0) { + if (SkipGetPerfData) { + *SmmPerfDataSize =3D SmmCommData->BootRecordSize; + return; + } // // Get all boot records // @@ -305,19 +309,45 @@ AllocateBootPerformanceTable ( } SmmCommData->BootRecordOffset =3D SmmCommData->BootRecordOffse= t + SmmCommData->BootRecordSize; } + *SmmPerfData =3D SmmBootRecordData; + *SmmPerfDataSize =3D SmmBootRecordDataSize; } } } } +} + +/** + Allocate buffer for Boot Performance table. + + @return Status code. + +**/ +EFI_STATUS +AllocateBootPerformanceTable ( + VOID + ) +{ + EFI_STATUS Status; + UINTN Size; + UINTN BootPerformanceDataSize; + UINT8 *BootPerformanceData; + FIRMWARE_PERFORMANCE_VARIABLE PerformanceVariable; + UINTN SmmBootRecordDataSize; + + SmmBootRecordDataSize =3D 0; + + // + // Get SMM performance data size at the point of EndOfDxe in order to al= locate the boot performance table. + // Will Get all the data at ReadyToBoot. + // + InternalGetSmmPerfData (NULL, &SmmBootRecordDataSize, TRUE); =20 // // Prepare memory for Boot Performance table. // Boot Performance table includes BasicBoot record, and one or more app= ended Boot Records. // - BootPerformanceDataSize =3D sizeof (BOOT_PERFORMANCE_TABLE) + mPerforman= ceLength + PcdGet32 (PcdExtFpdtBootRecordPadSize); - if (SmmCommData !=3D NULL && SmmBootRecordData !=3D NULL) { - BootPerformanceDataSize +=3D SmmBootRecordDataSize; - } + BootPerformanceDataSize =3D sizeof (BOOT_PERFORMANCE_TABLE) + mPerforman= ceLength + SmmBootRecordDataSize + PcdGet32 (PcdExtFpdtBootRecordPadSize); =20 // // Try to allocate the same runtime buffer as last time boot. @@ -358,9 +388,6 @@ AllocateBootPerformanceTable ( DEBUG ((DEBUG_INFO, "DxeCorePerformanceLib: ACPI Boot Performance Table = address =3D 0x%x\n", mAcpiBootPerformanceTable)); =20 if (mAcpiBootPerformanceTable =3D=3D NULL) { - if (SmmCommData !=3D NULL && SmmBootRecordData !=3D NULL) { - FreePool (SmmBootRecordData); - } return EFI_OUT_OF_RESOURCES; } =20 @@ -385,19 +412,10 @@ AllocateBootPerformanceTable ( mPerformanceLength =3D 0; mMaxPerformanceLength =3D 0; } - if (SmmCommData !=3D NULL && SmmBootRecordData !=3D NULL) { - // - // Fill Boot records from SMM drivers. - // - CopyMem (BootPerformanceData, SmmBootRecordData, SmmBootRecordDataSize= ); - FreePool (SmmBootRecordData); - mAcpiBootPerformanceTable->Header.Length =3D (UINT32) (mAcpiBootPerfor= manceTable->Header.Length + SmmBootRecordDataSize); - BootPerformanceData =3D BootPerformanceData + SmmBootRecordDataSize; - } =20 mBootRecordBuffer =3D (UINT8 *) mAcpiBootPerformanceTable; mBootRecordSize =3D mAcpiBootPerformanceTable->Header.Length; - mBootRecordMaxSize =3D mBootRecordSize + PcdGet32 (PcdExtFpdtBootRecordP= adSize); + mBootRecordMaxSize =3D BootPerformanceDataSize; =20 return EFI_SUCCESS; } @@ -1336,6 +1354,47 @@ ReportFpdtRecordBuffer ( } } =20 +/** + Update Boot Performance table. + + @param Event The event of notify protocol. + @param Context Notify event context. + +**/ +VOID +EFIAPI +UpdateBootPerformanceTable ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + VOID *SmmBootRecordData; + UINTN SmmBootRecordDataSize; + UINTN AppendSize; + UINT8 *FirmwarePerformanceTablePtr; + + // + // Get SMM performance data. + // + SmmBootRecordData =3D NULL; + InternalGetSmmPerfData (&SmmBootRecordData, &SmmBootRecordDataSize, FALS= E); + + FirmwarePerformanceTablePtr =3D (UINT8 *) mAcpiBootPerformanceTable + mA= cpiBootPerformanceTable->Header.Length; + + if (mAcpiBootPerformanceTable->Header.Length + SmmBootRecordDataSize > m= BootRecordMaxSize) { + DEBUG ((DEBUG_INFO, "DxeCorePerformanceLib: No enough space to save al= l SMM boot performance data\n")); + AppendSize =3D mBootRecordMaxSize - mAcpiBootPerformanceTable->Header.= Length; + } else { + AppendSize =3D SmmBootRecordDataSize; + } + if (SmmBootRecordData !=3D NULL) { + CopyMem (FirmwarePerformanceTablePtr, SmmBootRecordData, AppendSize); + mAcpiBootPerformanceTable->Header.Length +=3D (UINT32) AppendSize; + mBootRecordSize +=3D (UINT32) AppendSize; + FreePool (SmmBootRecordData); + } +} + /** The constructor function initializes Performance infrastructure for DXE = phase. =20 @@ -1358,6 +1417,7 @@ DxeCorePerformanceLibConstructor ( { EFI_STATUS Status; EFI_HANDLE Handle; + EFI_EVENT EndOfDxeEvent; EFI_EVENT ReadyToBootEvent; PERFORMANCE_PROPERTY *PerformanceProperty; =20 @@ -1386,13 +1446,25 @@ DxeCorePerformanceLibConstructor ( ASSERT_EFI_ERROR (Status); =20 // - // Register ReadyToBoot event to report StatusCode data + // Register EndOfDxe event to allocate the boot performance table and re= port the table address through status code. // Status =3D gBS->CreateEventEx ( EVT_NOTIFY_SIGNAL, - TPL_CALLBACK, + TPL_NOTIFY, ReportFpdtRecordBuffer, NULL, + &gEfiEndOfDxeEventGroupGuid, + &EndOfDxeEvent + ); + + // + // Register ReadyToBoot event to update the boot performance table for S= MM performance data. + // + Status =3D gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_CALLBACK, + UpdateBootPerformanceTable, + NULL, &gEfiEventReadyToBootGuid, &ReadyToBootEvent ); diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceL= ib.inf b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.i= nf index 1c1dcc60a6..599d4dea66 100644 --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf @@ -9,7 +9,7 @@ # This library is mainly used by DxeCore to start performance logging to = ensure that # Performance and PerformanceEx Protocol are installed at the very beginn= ing of DXE phase. # -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
# SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -67,6 +67,7 @@ [Guids] gZeroGuid ## SOMETIMES_CONSUMES ## G= UID gEfiFirmwarePerformanceGuid ## SOMETIMES_PRODUCES ## U= NDEFINED # StatusCode Data gEdkiiFpdtExtendedFirmwarePerformanceGuid ## SOMETIMES_CONSUMES ## H= OB # StatusCode Data + gEfiEndOfDxeEventGroupGuid ## CONSUMES ## E= vent gEfiEventReadyToBootGuid ## CONSUMES ## E= vent gEdkiiPiSmmCommunicationRegionTableGuid ## SOMETIMES_CONSUMES #= # SystemTable gEdkiiPerformanceMeasurementProtocolGuid ## PRODUCES ## U= NDEFINED # Install protocol diff --git a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceL= ib.c b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c index b4f22c14ae..d80f37e520 100644 --- a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c +++ b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c @@ -16,7 +16,7 @@ =20 SmmPerformanceHandlerEx(), SmmPerformanceHandler() will receive untrusted= input and do basic validation. =20 -Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2011 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -48,6 +48,7 @@ CHAR8 *mPlatformLanguage =3D NULL; SPIN_LOCK mSmmFpdtLock; PERFORMANCE_PROPERTY mPerformanceProperty; UINT32 mCachedLength =3D 0; +UINT32 mBootRecordSize =3D 0; =20 // // Interfaces for SMM PerformanceMeasurement Protocol. @@ -776,41 +777,116 @@ InsertFpdtRecord ( } =20 /** - SmmReadyToBoot protocol notification event handler. + Communication service SMI Handler entry. =20 - @param Protocol Points to the protocol's unique identifier - @param Interface Points to the interface instance - @param Handle The handle on which the interface was installed + This SMI handler provides services for report MM boot records. =20 - @retval EFI_SUCCESS SmmReadyToBootCallback runs successfully + Caution: This function may receive untrusted input. + Communicate buffer and buffer size are external input, so this function = will do basic validation. + + @param[in] DispatchHandle The unique handle assigned to this handle= r by SmiHandlerRegister(). + @param[in] RegisterContext Points to an optional handler context whi= ch was specified when the + handler was registered. + @param[in, out] CommBuffer A pointer to a collection of data in memo= ry that will + be conveyed from a non-MM environment int= o an MM environment. + @param[in, out] CommBufferSize The size of the CommBuffer. + + @retval EFI_SUCCESS The interrupt was handled an= d quiesced. No other handlers + should still be called. + @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED The interrupt has been quies= ced but other handlers should + still be called. + @retval EFI_WARN_INTERRUPT_SOURCE_PENDING The interrupt is still pendi= ng and other handlers should still + be called. + @retval EFI_INTERRUPT_PENDING The interrupt could not be q= uiesced. =20 **/ EFI_STATUS EFIAPI -SmmReportFpdtRecordData ( - IN CONST EFI_GUID *Protocol, - IN VOID *Interface, - IN EFI_HANDLE Handle +FpdtSmiHandler ( + IN EFI_HANDLE DispatchHandle, + IN CONST VOID *RegisterContext, + IN OUT VOID *CommBuffer, + IN OUT UINTN *CommBufferSize ) { - UINT64 SmmBPDTddr; - - if (!mFpdtDataIsReported && mSmmBootPerformanceTable !=3D NULL) { - SmmBPDTddr =3D (UINT64)(UINTN)mSmmBootPerformanceTable; - REPORT_STATUS_CODE_EX ( - EFI_PROGRESS_CODE, - EFI_SOFTWARE_SMM_DRIVER, - 0, - NULL, - &gEdkiiFpdtExtendedFirmwarePerformanceGuid, - &SmmBPDTddr, - sizeof (UINT64) + EFI_STATUS Status; + SMM_BOOT_RECORD_COMMUNICATE *SmmCommData; + UINTN BootRecordOffset; + UINTN BootRecordSize; + VOID *BootRecordData; + UINTN TempCommBufferSize; + UINT8 *BootRecordBuffer; + + // + // If input is invalid, stop processing this SMI + // + if (CommBuffer =3D=3D NULL || CommBufferSize =3D=3D NULL) { + return EFI_SUCCESS; + } + + TempCommBufferSize =3D *CommBufferSize; + + if(TempCommBufferSize < sizeof (SMM_BOOT_RECORD_COMMUNICATE)) { + return EFI_SUCCESS; + } + + if (!SmmIsBufferOutsideSmmValid ((UINTN)CommBuffer, TempCommBufferSize))= { + DEBUG ((DEBUG_ERROR, "FpdtSmiHandler: MM communication data buffer in = MMRAM or overflow!\n")); + return EFI_SUCCESS; + } + + SmmCommData =3D (SMM_BOOT_RECORD_COMMUNICATE*)CommBuffer; + + Status =3D EFI_SUCCESS; + + switch (SmmCommData->Function) { + case SMM_FPDT_FUNCTION_GET_BOOT_RECORD_SIZE : + if (mSmmBootPerformanceTable !=3D NULL) { + mBootRecordSize =3D mSmmBootPerformanceTable->Header.Length - size= of (SMM_BOOT_PERFORMANCE_TABLE); + } + SmmCommData->BootRecordSize =3D mBootRecordSize; + break; + + case SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA : + Status =3D EFI_UNSUPPORTED; + break; + + case SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET : + BootRecordOffset =3D SmmCommData->BootRecordOffset; + BootRecordData =3D SmmCommData->BootRecordData; + BootRecordSize =3D SmmCommData->BootRecordSize; + if (BootRecordData =3D=3D NULL || BootRecordOffset >=3D mBootRecordS= ize) { + Status =3D EFI_INVALID_PARAMETER; + break; + } + + // + // Sanity check + // + if (BootRecordSize > mBootRecordSize - BootRecordOffset) { + BootRecordSize =3D mBootRecordSize - BootRecordOffset; + } + SmmCommData->BootRecordSize =3D BootRecordSize; + if (!SmmIsBufferOutsideSmmValid ((UINTN)BootRecordData, BootRecordSi= ze)) { + DEBUG ((DEBUG_ERROR, "FpdtSmiHandler: MM Data buffer in MMRAM or o= verflow!\n")); + Status =3D EFI_ACCESS_DENIED; + break; + } + BootRecordBuffer =3D ((UINT8 *) (mSmmBootPerformanceTable)) + sizeof= (SMM_BOOT_PERFORMANCE_TABLE); + CopyMem ( + (UINT8*)BootRecordData, + BootRecordBuffer + BootRecordOffset, + BootRecordSize ); - // - // Set FPDT report state to TRUE. - // - mFpdtDataIsReported =3D TRUE; + mFpdtDataIsReported =3D TRUE; + break; + + default: + Status =3D EFI_UNSUPPORTED; } + + SmmCommData->ReturnStatus =3D Status; + return EFI_SUCCESS; } =20 @@ -830,8 +906,8 @@ InitializeSmmCorePerformanceLib ( ) { EFI_HANDLE Handle; + EFI_HANDLE SmiHandle; EFI_STATUS Status; - VOID *SmmReadyToBootRegistration; PERFORMANCE_PROPERTY *PerformanceProperty; =20 // @@ -851,11 +927,13 @@ InitializeSmmCorePerformanceLib ( ); ASSERT_EFI_ERROR (Status); =20 - Status =3D gSmst->SmmRegisterProtocolNotify ( - &gEdkiiSmmReadyToBootProtocolGuid, - SmmReportFpdtRecordData, - &SmmReadyToBootRegistration - ); + // + // Register SMI handler. + // + SmiHandle =3D NULL; + Status =3D gSmst->SmiHandlerRegister (FpdtSmiHandler, &gEfiFirmwarePerfo= rmanceGuid, &SmiHandle); + ASSERT_EFI_ERROR (Status); + Status =3D EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid, (V= OID **) &PerformanceProperty); if (EFI_ERROR (Status)) { // diff --git a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceL= ib.inf b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.i= nf index 6b013b8557..9eecc4b58c 100644 --- a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.inf +++ b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.inf @@ -8,7 +8,7 @@ # This library is mainly used by SMM Core to start performance logging to= ensure that # SMM Performance and PerformanceEx Protocol are installed at the very be= ginning of SMM phase. # -# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2011 - 2021, Intel Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -58,14 +58,13 @@ [LibraryClasses] =20 [Protocols] gEfiSmmBase2ProtocolGuid ## CONSUMES - gEdkiiSmmReadyToBootProtocolGuid ## NOTIFY =20 [Guids] ## PRODUCES ## SystemTable gPerformanceProtocolGuid - gEdkiiFpdtExtendedFirmwarePerformanceGuid ## SOMETIMES_PRODUCES ## UNDEF= INED # StatusCode Data gZeroGuid ## SOMETIMES_CONSUMES ## GUID gEdkiiSmmPerformanceMeasurementProtocolGuid ## PRODUCES ## U= NDEFINED # Install protocol + gEfiFirmwarePerformanceGuid ## SOMETIMES_PRODUCES ## UNDEF= INED # SmiHandlerRegister =20 [Pcd] gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask ## CON= SUMES diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 133e04ee86..463e889e9a 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -1879,9 +1879,9 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic= , PcdsDynamicEx] gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosEntryPointProvideMethod|0x3|UINT= 32|0x00010069 =20 ## This PCD specifies the additional pad size in FPDT Basic Boot Perform= ance Table for - # the extension FPDT boot records received after ReadyToBoot and before= ExitBootService. + # the extension FPDT boot records received after EndOfDxe and before Ex= itBootService. # @Prompt Pad size for extension FPDT boot records. - gEfiMdeModulePkgTokenSpaceGuid.PcdExtFpdtBootRecordPadSize|0x20000|UINT3= 2|0x0001005F + gEfiMdeModulePkgTokenSpaceGuid.PcdExtFpdtBootRecordPadSize|0x30000|UINT3= 2|0x0001005F =20 ## Indicates if ConIn device are connected on demand.

# TRUE - ConIn device are not connected during BDS and ReadKeyStroke/= ReadKeyStrokeEx produced diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/Fi= rmwarePerformanceDxe.c b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDat= aTableDxe/FirmwarePerformanceDxe.c index 61a7704b37..a6a0cd9e7d 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwareP= erformanceDxe.c +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwareP= erformanceDxe.c @@ -5,7 +5,7 @@ for Firmware Basic Boot Performance Record and other boot performance re= cords, and install FPDT to ACPI table. =20 - Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.
+ Copyright (c) 2011 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -16,6 +16,7 @@ #include #include #include +#include =20 #include #include @@ -32,6 +33,8 @@ #include #include #include +#include +#include =20 #define SMM_BOOT_RECORD_COMM_SIZE (OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, = Data) + sizeof(SMM_BOOT_RECORD_COMMUNICATE)) =20 @@ -278,11 +281,12 @@ InstallFirmwarePerformanceDataTable ( VOID ) { - EFI_STATUS Status; - EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol; - UINTN BootPerformanceDataSize; - FIRMWARE_PERFORMANCE_VARIABLE PerformanceVariable; - UINTN Size; + EFI_STATUS Status; + EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol; + UINTN BootPerformanceDataSize; + FIRMWARE_PERFORMANCE_VARIABLE PerformanceVariable; + UINTN Size; + EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicyProtocol; =20 // // Get AcpiTable Protocol. @@ -292,6 +296,14 @@ InstallFirmwarePerformanceDataTable ( return Status; } =20 + // + // Get VariablePolicy Protocol. + // + Status =3D gBS->LocateProtocol(&gEdkiiVariablePolicyProtocolGuid, NULL, = (VOID **)&VariablePolicyProtocol); + if (EFI_ERROR (Status)) { + return Status; + } + if (mReceivedAcpiBootPerformanceTable !=3D NULL) { mAcpiBootPerformanceTable =3D mReceivedAcpiBootPerformanceTable; mAcpiBootPerformanceTable->BasicBoot.ResetEnd =3D mBootPerformanceTabl= eTemplate.BasicBoot.ResetEnd; @@ -369,6 +381,24 @@ InstallFirmwarePerformanceDataTable ( &PerformanceVariable ); =20 + // + // Lock the variable which stores the Performance Table pointers. + // + Status =3D RegisterBasicVariablePolicy ( + VariablePolicyProtocol, + &gEfiFirmwarePerformanceGuid, + EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME, + VARIABLE_POLICY_NO_MIN_SIZE, + VARIABLE_POLICY_NO_MAX_SIZE, + VARIABLE_POLICY_NO_MUST_ATTR, + VARIABLE_POLICY_NO_CANT_ATTR, + VARIABLE_POLICY_TYPE_LOCK_NOW + ); + if (EFI_ERROR(Status)) { + DEBUG((EFI_D_ERROR, "[FirmwarePerformanceDxe] Error when lock variable= %s, Status =3D %r\n", EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME, Status)); + ASSERT_EFI_ERROR(Status); + } + // // Publish Firmware Performance Data Table. // @@ -501,18 +531,12 @@ FpdtStatusCodeListenerDxe ( DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - OsLoaderStartImageStart = =3D %ld\n", mAcpiBootPerformanceTable->BasicBoot.OsLoaderStartImageStart)); DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ExitBootServicesEntry = =3D 0\n")); DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ExitBootServicesExit = =3D 0\n")); - } else if (Value =3D=3D (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_R= EADY_TO_BOOT_EVENT)) { - if (mAcpiBootPerformanceTable =3D=3D NULL) { - // - // ACPI Firmware Performance Data Table not installed yet, install i= t now. - // - InstallFirmwarePerformanceDataTable (); - } } else if (Data !=3D NULL && CompareGuid (&Data->Type, &gEdkiiFpdtExtend= edFirmwarePerformanceGuid)) { // // Get the Boot performance table and then install it to ACPI table. // CopyMem (&mReceivedAcpiBootPerformanceTable, Data + 1, Data->Size); + InstallFirmwarePerformanceDataTable (); } else if (Data !=3D NULL && CompareGuid (&Data->Type, &gEfiFirmwarePerf= ormanceGuid)) { DEBUG ((DEBUG_ERROR, "FpdtStatusCodeListenerDxe: Performance data repo= rted through gEfiFirmwarePerformanceGuid will not be collected by FirmwareP= erformanceDataTableDxe\n")); Status =3D EFI_UNSUPPORTED; @@ -526,6 +550,32 @@ FpdtStatusCodeListenerDxe ( return Status; } =20 +/** + Notify function for event EndOfDxe. + + This is used to install ACPI Firmware Performance Data Table for basic b= oot records. + + @param[in] Event The Event that is being processed. + @param[in] Context The Event Context. + +**/ +VOID +EFIAPI +FpdtEndOfDxeEventNotify ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + // + // When performance is enabled, the FPDT will be installed when DxeCoreP= erformanceLib report the data to FimwarePerformanceDxe. + // This is used to install the FPDT for the basic boot recods when perfo= rmance infrastructure is not enabled. + // + if ((PcdGet8(PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PR= OPERTY_MEASUREMENT_ENABLED) !=3D 0) { + return; + } + ASSERT (mReceivedAcpiBootPerformanceTable =3D=3D NULL); + InstallFirmwarePerformanceDataTable (); +} =20 /** Notify function for event EVT_SIGNAL_EXIT_BOOT_SERVICES. This is used to= record @@ -596,6 +646,7 @@ FirmwarePerformanceDxeEntryPoint ( FIRMWARE_SEC_PERFORMANCE *Performance; VOID *Registration; UINT64 OemTableId; + EFI_EVENT EndOfDxeEvent; =20 CopyMem ( mFirmwarePerformanceTableTemplate.Header.OemId, @@ -620,6 +671,19 @@ FirmwarePerformanceDxeEntryPoint ( Status =3D mRscHandlerProtocol->Register (FpdtStatusCodeListenerDxe, TPL= _HIGH_LEVEL); ASSERT_EFI_ERROR (Status); =20 + // + // Register the notify function to install FPDT at EndOfDxe. + // + Status =3D gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, + FpdtEndOfDxeEventNotify, + NULL, + &gEfiEndOfDxeEventGroupGuid, + &EndOfDxeEvent + ); + ASSERT_EFI_ERROR (Status); + // // Register the notify function to update FPDT on ExitBootServices Event. // diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/Fi= rmwarePerformanceDxe.inf b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceD= ataTableDxe/FirmwarePerformanceDxe.inf index 1debb0193e..0411a22e66 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwareP= erformanceDxe.inf +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwareP= erformanceDxe.inf @@ -5,7 +5,7 @@ # for Firmware Basic Boot Performance Record and other boot performance r= ecords, # and install FPDT to ACPI table. # -# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2011 - 2021, Intel Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -46,12 +46,14 @@ [LibraryClasses] HobLib LockBoxLib UefiLib + VariablePolicyHelperLib =20 [Protocols] gEfiAcpiTableProtocolGuid ## CONSUMES gEfiRscHandlerProtocolGuid ## CONSUMES gEfiVariableArchProtocolGuid ## CONSUMES gEfiLockBoxProtocolGuid ## CONSUMES + gEdkiiVariablePolicyProtocolGuid ## CONSUMES =20 [Guids] gEfiEventExitBootServicesGuid ## CONSUMES ##= Event @@ -63,6 +65,7 @@ [Guids] gEfiFirmwarePerformanceGuid gEdkiiFpdtExtendedFirmwarePerformanceGuid ## SOMETIMES_CONSUMES ## U= NDEFINED # StatusCode Data gFirmwarePerformanceS3PointerGuid ## PRODUCES ## UNDEFINED #= SaveLockBox + gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event =20 [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeOsLoaderLoad ## CONSUMES @@ -72,6 +75,7 @@ [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision ## CONSUMES + gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask ## CONSUMES =20 [FeaturePcd] gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwarePerformanceDataTableS3Support = ## CONSUMES diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/Fi= rmwarePerformanceCommon.c b/MdeModulePkg/Universal/Acpi/FirmwarePerformance= DataTableSmm/FirmwarePerformanceCommon.c index ecadef8711..47db9a2fc0 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwareP= erformanceCommon.c +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwareP= erformanceCommon.c @@ -11,7 +11,7 @@ =20 FpdtSmiHandler() will receive untrusted input and do basic validation. =20 - Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2011 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -29,20 +29,12 @@ #include #include #include -#include -#include #include "FirmwarePerformanceCommon.h" =20 -SMM_BOOT_PERFORMANCE_TABLE *mMmBootPerformanceTable =3D NULL; =20 EFI_MM_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol =3D NULL; UINT64 mSuspendStartTime =3D 0; BOOLEAN mS3SuspendLockBoxSaved =3D FALSE; -UINT32 mBootRecordSize =3D 0; -UINT8 *mBootRecordBuffer =3D NULL; - -SPIN_LOCK mMmFpdtLock; -BOOLEAN mMmramIsOutOfResource =3D FALSE; =20 /** Report status code listener for MM. This is used to record the performan= ce @@ -84,21 +76,6 @@ FpdtStatusCodeListenerMm ( return EFI_UNSUPPORTED; } =20 - // - // Collect one or more Boot records in boot time - // - if (Data !=3D NULL && CompareGuid (&Data->Type, &gEdkiiFpdtExtendedFirmw= arePerformanceGuid)) { - AcquireSpinLock (&mMmFpdtLock); - // - // Get the boot performance data. - // - CopyMem (&mMmBootPerformanceTable, Data + 1, Data->Size); - mBootRecordBuffer =3D ((UINT8 *) (mMmBootPerformanceTable)) + sizeof (= SMM_BOOT_PERFORMANCE_TABLE); - - ReleaseSpinLock (&mMmFpdtLock); - return EFI_SUCCESS; - } - if (Data !=3D NULL && CompareGuid (&Data->Type, &gEfiFirmwarePerformance= Guid)) { DEBUG ((DEBUG_ERROR, "FpdtStatusCodeListenerMm: Performance data repor= ted through gEfiFirmwarePerformanceGuid will not be collected by FirmwarePe= rformanceDataTableMm\n")); return EFI_UNSUPPORTED; @@ -153,118 +130,6 @@ FpdtStatusCodeListenerMm ( return EFI_SUCCESS; } =20 -/** - Communication service SMI Handler entry. - - This SMI handler provides services for report MM boot records. - - Caution: This function may receive untrusted input. - Communicate buffer and buffer size are external input, so this function = will do basic validation. - - @param[in] DispatchHandle The unique handle assigned to this handle= r by SmiHandlerRegister(). - @param[in] RegisterContext Points to an optional handler context whi= ch was specified when the - handler was registered. - @param[in, out] CommBuffer A pointer to a collection of data in memo= ry that will - be conveyed from a non-MM environment int= o an MM environment. - @param[in, out] CommBufferSize The size of the CommBuffer. - - @retval EFI_SUCCESS The interrupt was handled an= d quiesced. No other handlers - should still be called. - @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED The interrupt has been quies= ced but other handlers should - still be called. - @retval EFI_WARN_INTERRUPT_SOURCE_PENDING The interrupt is still pendi= ng and other handlers should still - be called. - @retval EFI_INTERRUPT_PENDING The interrupt could not be q= uiesced. - -**/ -EFI_STATUS -EFIAPI -FpdtSmiHandler ( - IN EFI_HANDLE DispatchHandle, - IN CONST VOID *RegisterContext, - IN OUT VOID *CommBuffer, - IN OUT UINTN *CommBufferSize - ) -{ - EFI_STATUS Status; - SMM_BOOT_RECORD_COMMUNICATE *SmmCommData; - UINTN BootRecordOffset; - UINTN BootRecordSize; - VOID *BootRecordData; - UINTN TempCommBufferSize; - - // - // If input is invalid, stop processing this SMI - // - if (CommBuffer =3D=3D NULL || CommBufferSize =3D=3D NULL) { - return EFI_SUCCESS; - } - - TempCommBufferSize =3D *CommBufferSize; - - if(TempCommBufferSize < sizeof (SMM_BOOT_RECORD_COMMUNICATE)) { - return EFI_SUCCESS; - } - - if (!IsBufferOutsideMmValid ((UINTN)CommBuffer, TempCommBufferSize)) { - DEBUG ((DEBUG_ERROR, "FpdtSmiHandler: MM communication data buffer in = MMRAM or overflow!\n")); - return EFI_SUCCESS; - } - - SmmCommData =3D (SMM_BOOT_RECORD_COMMUNICATE*)CommBuffer; - - Status =3D EFI_SUCCESS; - - switch (SmmCommData->Function) { - case SMM_FPDT_FUNCTION_GET_BOOT_RECORD_SIZE : - if (mMmBootPerformanceTable !=3D NULL) { - mBootRecordSize =3D mMmBootPerformanceTable->Header.Length - sizeo= f (SMM_BOOT_PERFORMANCE_TABLE); - } - SmmCommData->BootRecordSize =3D mBootRecordSize; - break; - - case SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA : - Status =3D EFI_UNSUPPORTED; - break; - - case SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET : - BootRecordOffset =3D SmmCommData->BootRecordOffset; - BootRecordData =3D SmmCommData->BootRecordData; - BootRecordSize =3D SmmCommData->BootRecordSize; - if (BootRecordData =3D=3D NULL || BootRecordOffset >=3D mBootRecordS= ize) { - Status =3D EFI_INVALID_PARAMETER; - break; - } - - // - // Sanity check - // - if (BootRecordSize > mBootRecordSize - BootRecordOffset) { - BootRecordSize =3D mBootRecordSize - BootRecordOffset; - } - SmmCommData->BootRecordSize =3D BootRecordSize; - if (!IsBufferOutsideMmValid ((UINTN)BootRecordData, BootRecordSize))= { - DEBUG ((DEBUG_ERROR, "FpdtSmiHandler: MM Data buffer in MMRAM or o= verflow!\n")); - Status =3D EFI_ACCESS_DENIED; - break; - } - - CopyMem ( - (UINT8*)BootRecordData, - mBootRecordBuffer + BootRecordOffset, - BootRecordSize - ); - break; - - default: - Status =3D EFI_UNSUPPORTED; - } - - SmmCommData->ReturnStatus =3D Status; - - return EFI_SUCCESS; -} - /** The module Entry Point of the Firmware Performance Data Table MM driver. =20 @@ -278,12 +143,6 @@ FirmwarePerformanceCommonEntryPoint ( ) { EFI_STATUS Status; - EFI_HANDLE Handle; - - // - // Initialize spin lock - // - InitializeSpinLock (&mMmFpdtLock); =20 // // Get MM Report Status Code Handler Protocol. @@ -301,12 +160,5 @@ FirmwarePerformanceCommonEntryPoint ( Status =3D mRscHandlerProtocol->Register (FpdtStatusCodeListenerMm); ASSERT_EFI_ERROR (Status); =20 - // - // Register SMI handler. - // - Handle =3D NULL; - Status =3D gMmst->MmiHandlerRegister (FpdtSmiHandler, &gEfiFirmwarePerfo= rmanceGuid, &Handle); - ASSERT_EFI_ERROR (Status); - return Status; } diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/Fi= rmwarePerformanceCommon.h b/MdeModulePkg/Universal/Acpi/FirmwarePerformance= DataTableSmm/FirmwarePerformanceCommon.h index 0fbdac02de..0640c48db7 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwareP= erformanceCommon.h +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwareP= erformanceCommon.h @@ -11,7 +11,7 @@ =20 FpdtSmiHandler() will receive untrusted input and do basic validation. =20 - Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2011 - 2021, Intel Corporation. All rights reserved.
Copyright (c), Microsoft Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -20,21 +20,6 @@ #ifndef _FW_PERF_COMMON_H_ #define _FW_PERF_COMMON_H_ =20 -/** - This function is an abstraction layer for implementation specific Mm buf= fer validation routine. - - @param Buffer The buffer start address to be checked. - @param Length The buffer length to be checked. - - @retval TRUE This buffer is valid per processor architecture and not ov= erlap with SMRAM. - @retval FALSE This buffer is not valid per processor architecture or ove= rlap with SMRAM. -**/ -BOOLEAN -IsBufferOutsideMmValid ( - IN EFI_PHYSICAL_ADDRESS Buffer, - IN UINT64 Length - ); - /** The module Entry Point of the Firmware Performance Data Table MM driver. =20 diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/Fi= rmwarePerformanceSmm.inf b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceD= ataTableSmm/FirmwarePerformanceSmm.inf index b7194bd899..a4da0ba8b2 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwareP= erformanceSmm.inf +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwareP= erformanceSmm.inf @@ -4,7 +4,7 @@ # This module registers report status code listener to collect performanc= e data # for SMM boot performance records and S3 Suspend Performance Record. # -# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2011 - 2021, Intel Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -52,10 +52,8 @@ [Protocols] =20 [Guids] ## SOMETIMES_PRODUCES ## UNDEFINED # SaveLockBox - ## PRODUCES ## UNDEFINED # SmiHandlerRegister ## SOMETIMES_CONSUMES ## UNDEFINED # StatusCode Data gEfiFirmwarePerformanceGuid - gEdkiiFpdtExtendedFirmwarePerformanceGuid ## SOMETIMES_PRODUCES ## UNDE= FINED # StatusCode Data =20 [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeS3SuspendStart ## CONSUMES diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/Fi= rmwarePerformanceStandaloneMm.c b/MdeModulePkg/Universal/Acpi/FirmwarePerfo= rmanceDataTableSmm/FirmwarePerformanceStandaloneMm.c index d7da61c98c..be52d8ce90 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwareP= erformanceStandaloneMm.c +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwareP= erformanceStandaloneMm.c @@ -11,7 +11,7 @@ =20 FpdtSmiHandler() will receive untrusted input and do basic validation. =20 - Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2011 - 2021, Intel Corporation. All rights reserved.
Copyright (c), Microsoft Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -19,27 +19,8 @@ =20 #include =20 -#include #include "FirmwarePerformanceCommon.h" =20 -/** - This function is an abstraction layer for implementation specific Mm buf= fer validation routine. - - @param Buffer The buffer start address to be checked. - @param Length The buffer length to be checked. - - @retval TRUE This buffer is valid per processor architecture and not ov= erlap with SMRAM. - @retval FALSE This buffer is not valid per processor architecture or ove= rlap with SMRAM. -**/ -BOOLEAN -IsBufferOutsideMmValid ( - IN EFI_PHYSICAL_ADDRESS Buffer, - IN UINT64 Length - ) -{ - return MmIsBufferOutsideMmValid (Buffer, Length); -} - /** The module Entry Point of the Firmware Performance Data Table MM driver. =20 diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/Fi= rmwarePerformanceStandaloneMm.inf b/MdeModulePkg/Universal/Acpi/FirmwarePer= formanceDataTableSmm/FirmwarePerformanceStandaloneMm.inf index e6aad88be0..fabe30b071 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwareP= erformanceStandaloneMm.inf +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwareP= erformanceStandaloneMm.inf @@ -4,7 +4,7 @@ # This module registers report status code listener to collect performanc= e data # for SMM boot performance records and S3 Suspend Performance Record. # -# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2011 - 2021, Intel Corporation. All rights reserved.
# Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -53,10 +53,8 @@ [Protocols] =20 [Guids] ## SOMETIMES_PRODUCES ## UNDEFINED # SaveLockBox - ## PRODUCES ## UNDEFINED # SmiHandlerRegister ## SOMETIMES_CONSUMES ## UNDEFINED # StatusCode Data gEfiFirmwarePerformanceGuid - gEdkiiFpdtExtendedFirmwarePerformanceGuid ## SOMETIMES_PRODUCES ## UNDE= FINED # StatusCode Data =20 [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeS3SuspendStart ## CONSUMES diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/Fi= rmwarePerformanceTraditional.c b/MdeModulePkg/Universal/Acpi/FirmwarePerfor= manceDataTableSmm/FirmwarePerformanceTraditional.c index 43c050d6b5..5bd38b0ef3 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwareP= erformanceTraditional.c +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwareP= erformanceTraditional.c @@ -11,7 +11,7 @@ =20 FpdtSmiHandler() will receive untrusted input and do basic validation. =20 - Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2011 - 2021, Intel Corporation. All rights reserved.
Copyright (c), Microsoft Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -19,27 +19,8 @@ =20 #include =20 -#include #include "FirmwarePerformanceCommon.h" =20 -/** - This function is an abstraction layer for implementation specific Mm buf= fer validation routine. - - @param Buffer The buffer start address to be checked. - @param Length The buffer length to be checked. - - @retval TRUE This buffer is valid per processor architecture and not ov= erlap with SMRAM. - @retval FALSE This buffer is not valid per processor architecture or ove= rlap with SMRAM. -**/ -BOOLEAN -IsBufferOutsideMmValid ( - IN EFI_PHYSICAL_ADDRESS Buffer, - IN UINT64 Length - ) -{ - return SmmIsBufferOutsideSmmValid (Buffer, Length); -} - /** The module Entry Point of the Firmware Performance Data Table MM driver. =20 --=20 2.18.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#81743): https://edk2.groups.io/g/devel/message/81743 Mute This Topic: https://groups.io/mt/86229425/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-