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.120; helo=mga04.intel.com; envelope-from=dandan.bi@intel.com; receiver=edk2-devel@lists.01.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 5011D22364880 for ; Tue, 30 Jan 2018 05:48:54 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jan 2018 05:54:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,435,1511856000"; d="scan'208";a="170304866" Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by orsmga004.jf.intel.com with ESMTP; 30 Jan 2018 05:54:27 -0800 From: Dandan Bi To: edk2-devel@lists.01.org Cc: Liming Gao , Star Zeng Date: Tue, 30 Jan 2018 21:53:56 +0800 Message-Id: <1517320437-11688-8-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1517320437-11688-1-git-send-email-dandan.bi@intel.com> References: <1517320437-11688-1-git-send-email-dandan.bi@intel.com> Subject: [PATCH v2 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: , X-List-Received-Date: Tue, 30 Jan 2018 13:48:54 -0000 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 | 29 +++++----------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.c b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.c index c750331..28fb3d0 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.c +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.c @@ -82,11 +82,11 @@ FpdtStatusCodeListenerSmm ( ) { EFI_STATUS Status; UINT64 CurrentTime; EFI_ACPI_5_0_FPDT_S3_SUSPEND_RECORD S3SuspendRecord; - UINT8 *NewRecordBuffer; + SMM_BOOT_PERFORMANCE_TABLE *mSmmBootPerformanceTable; // // Check whether status code is what we are interested in. // if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) != EFI_PROGRESS_CODE) { @@ -96,34 +96,17 @@ FpdtStatusCodeListenerSmm ( // // Collect one or more Boot records in boot time // if (Data != NULL && CompareGuid (&Data->Type, &gEfiFirmwarePerformanceGuid)) { AcquireSpinLock (&mSmmFpdtLock); - - if (mBootRecordSize + Data->Size > mBootRecordMaxSize) { - // - // Try to allocate big SMRAM data to store Boot record. - // - if (mSmramIsOutOfResource) { - ReleaseSpinLock (&mSmmFpdtLock); - return EFI_OUT_OF_RESOURCES; - } - NewRecordBuffer = ReallocatePool (mBootRecordSize, mBootRecordSize + Data->Size + EXTENSION_RECORD_SIZE, mBootRecordBuffer); - if (NewRecordBuffer == NULL) { - ReleaseSpinLock (&mSmmFpdtLock); - mSmramIsOutOfResource = TRUE; - return EFI_OUT_OF_RESOURCES; - } - mBootRecordBuffer = NewRecordBuffer; - mBootRecordMaxSize = mBootRecordSize + Data->Size + EXTENSION_RECORD_SIZE; - } // - // Save boot record into the temp memory space. + // Get the boot performance data. // - CopyMem (mBootRecordBuffer + mBootRecordSize, Data + 1, Data->Size); - mBootRecordSize += Data->Size; - + CopyMem (&mSmmBootPerformanceTable, Data + 1, Data->Size); + mBootRecordBuffer = ((UINT8 *) (mSmmBootPerformanceTable)) + sizeof (SMM_BOOT_PERFORMANCE_TABLE); + mBootRecordSize = mSmmBootPerformanceTable->Header.Length - sizeof (SMM_BOOT_PERFORMANCE_TABLE) ; + ReleaseSpinLock (&mSmmFpdtLock); return EFI_SUCCESS; } if ((Value != PcdGet32 (PcdProgressCodeS3SuspendStart)) && -- 1.9.5.msysgit.1