summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal
diff options
context:
space:
mode:
authorDandan Bi <dandan.bi@intel.com>2018-01-30 11:07:36 +0800
committerLiming Gao <liming.gao@intel.com>2018-02-08 12:50:21 +0800
commit718a937ed963697527b24b4949d716cb694eda75 (patch)
treee7104c954641c121e331a490c23a4738a1957553 /MdeModulePkg/Universal
parent9e62c230170c96f16d9c5d46e100683ef3ccefb7 (diff)
downloadedk2-718a937ed963697527b24b4949d716cb694eda75.zip
edk2-718a937ed963697527b24b4949d716cb694eda75.tar.gz
edk2-718a937ed963697527b24b4949d716cb694eda75.tar.bz2
MdeModulePkg/FirmwarePerfSmm:Enhance for new pref infrastructure
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 <liming.gao@intel.com> Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'MdeModulePkg/Universal')
-rw-r--r--MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.c35
-rw-r--r--MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.inf1
2 files changed, 10 insertions, 26 deletions
diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.c b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.c
index c750331..d4ac849 100644
--- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.c
+++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.c
@@ -40,13 +40,12 @@
#include <Library/SynchronizationLib.h>
#include <Library/SmmMemLib.h>
-#define EXTENSION_RECORD_SIZE 0x1000
+SMM_BOOT_PERFORMANCE_TABLE *mSmmBootPerformanceTable = NULL;
EFI_SMM_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
UINT64 mSuspendStartTime = 0;
BOOLEAN mS3SuspendLockBoxSaved = FALSE;
UINT32 mBootRecordSize = 0;
-UINT32 mBootRecordMaxSize = 0;
UINT8 *mBootRecordBuffer = NULL;
SPIN_LOCK mSmmFpdtLock;
@@ -84,7 +83,6 @@ FpdtStatusCodeListenerSmm (
EFI_STATUS Status;
UINT64 CurrentTime;
EFI_ACPI_5_0_FPDT_S3_SUSPEND_RECORD S3SuspendRecord;
- UINT8 *NewRecordBuffer;
//
// Check whether status code is what we are interested in.
@@ -96,32 +94,14 @@ FpdtStatusCodeListenerSmm (
//
// Collect one or more Boot records in boot time
//
- if (Data != NULL && CompareGuid (&Data->Type, &gEfiFirmwarePerformanceGuid)) {
+ if (Data != NULL && CompareGuid (&Data->Type, &gEdkiiFpdtExtendedFirmwarePerformanceGuid)) {
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);
+
ReleaseSpinLock (&mSmmFpdtLock);
return EFI_SUCCESS;
}
@@ -239,6 +219,9 @@ FpdtSmiHandler (
switch (SmmCommData->Function) {
case SMM_FPDT_FUNCTION_GET_BOOT_RECORD_SIZE :
+ if (mSmmBootPerformanceTable != NULL) {
+ mBootRecordSize = mSmmBootPerformanceTable->Header.Length - sizeof (SMM_BOOT_PERFORMANCE_TABLE);
+ }
SmmCommData->BootRecordSize = mBootRecordSize;
break;
diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.inf b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.inf
index 724e7bc..cae0111 100644
--- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.inf
+++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.inf
@@ -60,6 +60,7 @@
## PRODUCES ## UNDEFINED # SmiHandlerRegister
## SOMETIMES_CONSUMES ## UNDEFINED # StatusCode Data
gEfiFirmwarePerformanceGuid
+ gEdkiiFpdtExtendedFirmwarePerformanceGuid ## SOMETIMES_PRODUCES ## UNDEFINED # StatusCode Data
[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeS3SuspendStart ## CONSUMES