From nobody Mon Dec 23 14:24:48 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 1517560267477223.357761244328; Fri, 2 Feb 2018 00:31:07 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 07D6922393645; Fri, 2 Feb 2018 00:25:25 -0800 (PST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 6F9D422393645 for ; Fri, 2 Feb 2018 00:25:23 -0800 (PST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Feb 2018 00:31:01 -0800 Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by fmsmga005.fm.intel.com with ESMTP; 02 Feb 2018 00:31:00 -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=192.55.52.88; helo=mga01.intel.com; envelope-from=dandan.bi@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,447,1511856000"; d="scan'208";a="200629862" From: Dandan Bi To: edk2-devel@lists.01.org Date: Fri, 2 Feb 2018 16:30:33 +0800 Message-Id: <1517560234-17068-8-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1517560234-17068-1-git-send-email-dandan.bi@intel.com> References: <1517560234-17068-1-git-send-email-dandan.bi@intel.com> Subject: [edk2] [PATCH v3 7/8] MdeModulePkg/FirmwarePerfSmm:Enhance for new pref infrastructure X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Star Zeng , Liming Gao 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" V3: a. Remove unused definitions b. Get records size form the records buffer when getting size action is triggered. V2: Update FirmwarePerformanceSmm to receive the address of performance records instead of records content. Receive buffer address of Boot performance records which are reported by SmmCorePerformanceLib. Cc: Liming Gao Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi --- .../FirmwarePerformanceSmm.c | 35 ++++++------------= ---- .../FirmwarePerformanceSmm.inf | 1 + 2 files changed, 10 insertions(+), 26 deletions(-) diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/Fi= rmwarePerformanceSmm.c b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDat= aTableSmm/FirmwarePerformanceSmm.c index c750331..d4ac849 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwareP= erformanceSmm.c +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwareP= erformanceSmm.c @@ -38,17 +38,16 @@ #include #include #include #include =20 -#define EXTENSION_RECORD_SIZE 0x1000 +SMM_BOOT_PERFORMANCE_TABLE *mSmmBootPerformanceTable =3D NULL; =20 EFI_SMM_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol =3D NULL; UINT64 mSuspendStartTime =3D 0; BOOLEAN mS3SuspendLockBoxSaved =3D FALSE; UINT32 mBootRecordSize =3D 0; -UINT32 mBootRecordMaxSize =3D 0; UINT8 *mBootRecordBuffer =3D NULL; =20 SPIN_LOCK mSmmFpdtLock; BOOLEAN mSmramIsOutOfResource =3D FALSE; =20 @@ -82,11 +81,10 @@ FpdtStatusCodeListenerSmm ( ) { EFI_STATUS Status; UINT64 CurrentTime; EFI_ACPI_5_0_FPDT_S3_SUSPEND_RECORD S3SuspendRecord; - UINT8 *NewRecordBuffer; =20 // // Check whether status code is what we are interested in. // if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) !=3D EFI_PROGRESS_CODE) { @@ -94,36 +92,18 @@ FpdtStatusCodeListenerSmm ( } =20 // // Collect one or more Boot records in boot time // - if (Data !=3D NULL && CompareGuid (&Data->Type, &gEfiFirmwarePerformance= Guid)) { + if (Data !=3D NULL && CompareGuid (&Data->Type, &gEdkiiFpdtExtendedFirmw= arePerformanceGuid)) { AcquireSpinLock (&mSmmFpdtLock); - =20 - if (mBootRecordSize + Data->Size > mBootRecordMaxSize) { - // - // Try to allocate big SMRAM data to store Boot record.=20 - // - if (mSmramIsOutOfResource) { - ReleaseSpinLock (&mSmmFpdtLock); - return EFI_OUT_OF_RESOURCES; - } - NewRecordBuffer =3D ReallocatePool (mBootRecordSize, mBootRecordSize= + Data->Size + EXTENSION_RECORD_SIZE, mBootRecordBuffer);=20 - if (NewRecordBuffer =3D=3D NULL) { - ReleaseSpinLock (&mSmmFpdtLock); - mSmramIsOutOfResource =3D TRUE; - return EFI_OUT_OF_RESOURCES; - } - mBootRecordBuffer =3D NewRecordBuffer; - mBootRecordMaxSize =3D mBootRecordSize + Data->Size + EXTENSION_RECO= RD_SIZE; - } // - // Save boot record into the temp memory space. + // Get the boot performance data. // - CopyMem (mBootRecordBuffer + mBootRecordSize, Data + 1, Data->Size); - mBootRecordSize +=3D Data->Size; - =20 + CopyMem (&mSmmBootPerformanceTable, Data + 1, Data->Size); + mBootRecordBuffer =3D ((UINT8 *) (mSmmBootPerformanceTable)) + sizeof = (SMM_BOOT_PERFORMANCE_TABLE); + ReleaseSpinLock (&mSmmFpdtLock); return EFI_SUCCESS; } =20 if ((Value !=3D PcdGet32 (PcdProgressCodeS3SuspendStart)) && @@ -237,10 +217,13 @@ FpdtSmiHandler ( =20 Status =3D EFI_SUCCESS; =20 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; =20 case SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA : Status =3D EFI_UNSUPPORTED; diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/Fi= rmwarePerformanceSmm.inf b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceD= ataTableSmm/FirmwarePerformanceSmm.inf index 724e7bc..cae0111 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwareP= erformanceSmm.inf +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwareP= erformanceSmm.inf @@ -58,10 +58,11 @@ [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 gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeS3SuspendEnd ## CONSUMES =20 --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel