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 <liming....@intel.com>
Cc: Star Zeng <star.z...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan...@intel.com>
---
 .../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

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to