diff options
Diffstat (limited to 'MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c')
-rw-r--r-- | MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c | 612 |
1 files changed, 326 insertions, 286 deletions
diff --git a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c index 7cdf5d0b79..3efe56e056 100644 --- a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c +++ b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c @@ -21,14 +21,13 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/
-
#include "SmmCorePerformanceLibInternal.h"
-#define STRING_SIZE (FPDT_STRING_EVENT_RECORD_NAME_LENGTH * sizeof (CHAR8))
-#define FIRMWARE_RECORD_BUFFER 0x1000
-#define CACHE_HANDLE_GUID_COUNT 0x100
+#define STRING_SIZE (FPDT_STRING_EVENT_RECORD_NAME_LENGTH * sizeof (CHAR8))
+#define FIRMWARE_RECORD_BUFFER 0x1000
+#define CACHE_HANDLE_GUID_COUNT 0x100
-SMM_BOOT_PERFORMANCE_TABLE *mSmmBootPerformanceTable = NULL;
+SMM_BOOT_PERFORMANCE_TABLE *mSmmBootPerformanceTable = NULL;
typedef struct {
EFI_HANDLE Handle;
@@ -36,24 +35,24 @@ typedef struct { EFI_GUID ModuleGuid;
} HANDLE_GUID_MAP;
-HANDLE_GUID_MAP mCacheHandleGuidTable[CACHE_HANDLE_GUID_COUNT];
-UINTN mCachePairCount = 0;
+HANDLE_GUID_MAP mCacheHandleGuidTable[CACHE_HANDLE_GUID_COUNT];
+UINTN mCachePairCount = 0;
-UINT32 mPerformanceLength = sizeof (SMM_BOOT_PERFORMANCE_TABLE);
-UINT32 mMaxPerformanceLength = 0;
-UINT32 mLoadImageCount = 0;
-BOOLEAN mFpdtDataIsReported = FALSE;
-BOOLEAN mLackSpaceIsReport = FALSE;
-CHAR8 *mPlatformLanguage = NULL;
-SPIN_LOCK mSmmFpdtLock;
+UINT32 mPerformanceLength = sizeof (SMM_BOOT_PERFORMANCE_TABLE);
+UINT32 mMaxPerformanceLength = 0;
+UINT32 mLoadImageCount = 0;
+BOOLEAN mFpdtDataIsReported = FALSE;
+BOOLEAN mLackSpaceIsReport = FALSE;
+CHAR8 *mPlatformLanguage = NULL;
+SPIN_LOCK mSmmFpdtLock;
PERFORMANCE_PROPERTY mPerformanceProperty;
-UINT32 mCachedLength = 0;
-UINT32 mBootRecordSize = 0;
+UINT32 mCachedLength = 0;
+UINT32 mBootRecordSize = 0;
//
// Interfaces for SMM PerformanceMeasurement Protocol.
//
-EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL mPerformanceMeasurementInterface = {
+EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL mPerformanceMeasurementInterface = {
CreatePerformanceMeasurement,
};
@@ -68,9 +67,9 @@ EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL mPerformanceMeasurementInterface = { **/
EFI_STATUS
GetFpdtRecordPtr (
- IN UINT8 RecordSize,
- IN OUT FPDT_RECORD_PTR *FpdtRecordPtr
-)
+ IN UINT8 RecordSize,
+ IN OUT FPDT_RECORD_PTR *FpdtRecordPtr
+ )
{
if (mFpdtDataIsReported) {
//
@@ -81,12 +80,13 @@ GetFpdtRecordPtr ( DEBUG ((DEBUG_INFO, "SmmCorePerformanceLib: No enough space to save boot records\n"));
mLackSpaceIsReport = TRUE;
}
+
return EFI_OUT_OF_RESOURCES;
} else {
//
// Covert buffer to FPDT Ptr Union type.
//
- FpdtRecordPtr->RecordHeader = (EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER *)((UINT8*)mSmmBootPerformanceTable + mSmmBootPerformanceTable->Header.Length);
+ FpdtRecordPtr->RecordHeader = (EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER *)((UINT8 *)mSmmBootPerformanceTable + mSmmBootPerformanceTable->Header.Length);
}
} else {
//
@@ -97,24 +97,26 @@ GetFpdtRecordPtr ( mPerformanceLength,
mPerformanceLength + RecordSize + FIRMWARE_RECORD_BUFFER,
mSmmBootPerformanceTable
- );
+ );
if (mSmmBootPerformanceTable == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
mSmmBootPerformanceTable->Header.Length = mPerformanceLength;
- mMaxPerformanceLength = mPerformanceLength + RecordSize + FIRMWARE_RECORD_BUFFER;
+ mMaxPerformanceLength = mPerformanceLength + RecordSize + FIRMWARE_RECORD_BUFFER;
}
+
//
// Covert buffer to FPDT Ptr Union type.
//
- FpdtRecordPtr->RecordHeader = (EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER *)((UINT8*)mSmmBootPerformanceTable + mSmmBootPerformanceTable->Header.Length);
+ FpdtRecordPtr->RecordHeader = (EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER *)((UINT8 *)mSmmBootPerformanceTable + mSmmBootPerformanceTable->Header.Length);
}
+
FpdtRecordPtr->RecordHeader->Length = 0;
return EFI_SUCCESS;
}
-
/**
Check whether the Token is a known one which is uesed by core.
@@ -133,16 +135,17 @@ IsKnownTokens ( return FALSE;
}
- if (AsciiStrCmp (Token, SEC_TOK) == 0 ||
- AsciiStrCmp (Token, PEI_TOK) == 0 ||
- AsciiStrCmp (Token, DXE_TOK) == 0 ||
- AsciiStrCmp (Token, BDS_TOK) == 0 ||
- AsciiStrCmp (Token, DRIVERBINDING_START_TOK) == 0 ||
- AsciiStrCmp (Token, DRIVERBINDING_SUPPORT_TOK) == 0 ||
- AsciiStrCmp (Token, DRIVERBINDING_STOP_TOK) == 0 ||
- AsciiStrCmp (Token, LOAD_IMAGE_TOK) == 0 ||
- AsciiStrCmp (Token, START_IMAGE_TOK) == 0 ||
- AsciiStrCmp (Token, PEIM_TOK) == 0) {
+ if ((AsciiStrCmp (Token, SEC_TOK) == 0) ||
+ (AsciiStrCmp (Token, PEI_TOK) == 0) ||
+ (AsciiStrCmp (Token, DXE_TOK) == 0) ||
+ (AsciiStrCmp (Token, BDS_TOK) == 0) ||
+ (AsciiStrCmp (Token, DRIVERBINDING_START_TOK) == 0) ||
+ (AsciiStrCmp (Token, DRIVERBINDING_SUPPORT_TOK) == 0) ||
+ (AsciiStrCmp (Token, DRIVERBINDING_STOP_TOK) == 0) ||
+ (AsciiStrCmp (Token, LOAD_IMAGE_TOK) == 0) ||
+ (AsciiStrCmp (Token, START_IMAGE_TOK) == 0) ||
+ (AsciiStrCmp (Token, PEIM_TOK) == 0))
+ {
return TRUE;
} else {
return FALSE;
@@ -160,19 +163,20 @@ Check whether the ID is a known one which map to the known Token. **/
BOOLEAN
IsKnownID (
- IN UINT32 Identifier
+ IN UINT32 Identifier
)
{
- if (Identifier == MODULE_START_ID ||
- Identifier == MODULE_END_ID ||
- Identifier == MODULE_LOADIMAGE_START_ID ||
- Identifier == MODULE_LOADIMAGE_END_ID ||
- Identifier == MODULE_DB_START_ID ||
- Identifier == MODULE_DB_END_ID ||
- Identifier == MODULE_DB_SUPPORT_START_ID ||
- Identifier == MODULE_DB_SUPPORT_END_ID ||
- Identifier == MODULE_DB_STOP_START_ID ||
- Identifier == MODULE_DB_STOP_END_ID) {
+ if ((Identifier == MODULE_START_ID) ||
+ (Identifier == MODULE_END_ID) ||
+ (Identifier == MODULE_LOADIMAGE_START_ID) ||
+ (Identifier == MODULE_LOADIMAGE_END_ID) ||
+ (Identifier == MODULE_DB_START_ID) ||
+ (Identifier == MODULE_DB_END_ID) ||
+ (Identifier == MODULE_DB_SUPPORT_START_ID) ||
+ (Identifier == MODULE_DB_SUPPORT_END_ID) ||
+ (Identifier == MODULE_DB_STOP_START_ID) ||
+ (Identifier == MODULE_DB_STOP_END_ID))
+ {
return TRUE;
} else {
return FALSE;
@@ -205,34 +209,39 @@ GetFpdtRecordId ( // Token to Id.
//
if (String != NULL) {
- if (AsciiStrCmp (String, START_IMAGE_TOK) == 0) { // "StartImage:"
+ if (AsciiStrCmp (String, START_IMAGE_TOK) == 0) {
+ // "StartImage:"
if (Attribute == PerfStartEntry) {
- *ProgressID = MODULE_START_ID;
+ *ProgressID = MODULE_START_ID;
} else {
- *ProgressID = MODULE_END_ID;
+ *ProgressID = MODULE_END_ID;
}
- } else if (AsciiStrCmp (String, LOAD_IMAGE_TOK) == 0) { // "LoadImage:"
+ } else if (AsciiStrCmp (String, LOAD_IMAGE_TOK) == 0) {
+ // "LoadImage:"
if (Attribute == PerfStartEntry) {
- *ProgressID = MODULE_LOADIMAGE_START_ID;
+ *ProgressID = MODULE_LOADIMAGE_START_ID;
} else {
- *ProgressID = MODULE_LOADIMAGE_END_ID;
+ *ProgressID = MODULE_LOADIMAGE_END_ID;
}
- } else { // Pref used in Modules
+ } else {
+ // Pref used in Modules
if (Attribute == PerfStartEntry) {
- *ProgressID = PERF_INMODULE_START_ID;
+ *ProgressID = PERF_INMODULE_START_ID;
} else {
- *ProgressID = PERF_INMODULE_END_ID;
+ *ProgressID = PERF_INMODULE_END_ID;
}
}
- } else if (Handle != NULL) { // Pref used in Modules
+ } else if (Handle != NULL) {
+ // Pref used in Modules
if (Attribute == PerfStartEntry) {
- *ProgressID = PERF_INMODULE_START_ID;
+ *ProgressID = PERF_INMODULE_START_ID;
} else {
- *ProgressID = PERF_INMODULE_END_ID;
+ *ProgressID = PERF_INMODULE_END_ID;
}
} else {
return EFI_UNSUPPORTED;
}
+
return EFI_SUCCESS;
}
@@ -253,26 +262,26 @@ GetFpdtRecordId ( EFI_STATUS
EFIAPI
GetModuleInfoFromHandle (
- IN EFI_HANDLE Handle,
- OUT CHAR8 *NameString,
- IN UINTN BufferSize,
- OUT EFI_GUID *ModuleGuid OPTIONAL
+ IN EFI_HANDLE Handle,
+ OUT CHAR8 *NameString,
+ IN UINTN BufferSize,
+ OUT EFI_GUID *ModuleGuid OPTIONAL
)
{
- EFI_STATUS Status;
- EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
- EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
- CHAR8 *PdbFileName;
- EFI_GUID *TempGuid;
- UINTN StartIndex;
- UINTN Index;
- INTN Count;
- BOOLEAN ModuleGuidIsGet;
- UINTN StringSize;
- CHAR16 *StringPtr;
- MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFilePath;
-
- if (NameString == NULL || BufferSize == 0) {
+ EFI_STATUS Status;
+ EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
+ EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
+ CHAR8 *PdbFileName;
+ EFI_GUID *TempGuid;
+ UINTN StartIndex;
+ UINTN Index;
+ INTN Count;
+ BOOLEAN ModuleGuidIsGet;
+ UINTN StringSize;
+ CHAR16 *StringPtr;
+ MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFilePath;
+
+ if ((NameString == NULL) || (BufferSize == 0)) {
return EFI_INVALID_PARAMETER;
}
@@ -289,14 +298,14 @@ GetModuleInfoFromHandle ( }
}
- Status = EFI_INVALID_PARAMETER;
+ Status = EFI_INVALID_PARAMETER;
LoadedImage = NULL;
ModuleGuidIsGet = FALSE;
//
// Initialize GUID as zero value.
//
- TempGuid = &gZeroGuid;
+ TempGuid = &gZeroGuid;
//
// Initialize it as "" string.
//
@@ -307,49 +316,50 @@ GetModuleInfoFromHandle ( // Try Handle as ImageHandle.
//
Status = gBS->HandleProtocol (
- Handle,
- &gEfiLoadedImageProtocolGuid,
- (VOID**) &LoadedImage
- );
+ Handle,
+ &gEfiLoadedImageProtocolGuid,
+ (VOID **)&LoadedImage
+ );
if (EFI_ERROR (Status)) {
//
// Try Handle as Controller Handle
//
Status = gBS->OpenProtocol (
- Handle,
- &gEfiDriverBindingProtocolGuid,
- (VOID **) &DriverBinding,
- NULL,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
+ Handle,
+ &gEfiDriverBindingProtocolGuid,
+ (VOID **)&DriverBinding,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
if (!EFI_ERROR (Status)) {
//
// Get Image protocol from ImageHandle
//
Status = gBS->HandleProtocol (
- DriverBinding->ImageHandle,
- &gEfiLoadedImageProtocolGuid,
- (VOID**) &LoadedImage
- );
+ DriverBinding->ImageHandle,
+ &gEfiLoadedImageProtocolGuid,
+ (VOID **)&LoadedImage
+ );
}
}
}
- if (!EFI_ERROR (Status) && LoadedImage != NULL) {
+ if (!EFI_ERROR (Status) && (LoadedImage != NULL)) {
//
// Get Module Guid from DevicePath.
//
- if (LoadedImage->FilePath != NULL &&
- LoadedImage->FilePath->Type == MEDIA_DEVICE_PATH &&
- LoadedImage->FilePath->SubType == MEDIA_PIWG_FW_FILE_DP
- ) {
+ if ((LoadedImage->FilePath != NULL) &&
+ (LoadedImage->FilePath->Type == MEDIA_DEVICE_PATH) &&
+ (LoadedImage->FilePath->SubType == MEDIA_PIWG_FW_FILE_DP)
+ )
+ {
//
// Determine GUID associated with module logging performance
//
ModuleGuidIsGet = TRUE;
- FvFilePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) LoadedImage->FilePath;
+ FvFilePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)LoadedImage->FilePath;
TempGuid = &FvFilePath->FvFileName;
}
@@ -357,20 +367,21 @@ GetModuleInfoFromHandle ( // Method 1 Get Module Name from PDB string.
//
PdbFileName = PeCoffLoaderGetPdbPointer (LoadedImage->ImageBase);
- if (PdbFileName != NULL && BufferSize > 0) {
+ if ((PdbFileName != NULL) && (BufferSize > 0)) {
StartIndex = 0;
for (Index = 0; PdbFileName[Index] != 0; Index++) {
if ((PdbFileName[Index] == '\\') || (PdbFileName[Index] == '/')) {
StartIndex = Index + 1;
}
}
+
//
// Copy the PDB file name to our temporary string.
// If the length is bigger than BufferSize, trim the redudant characters to avoid overflow in array boundary.
//
for (Index = 0; Index < BufferSize - 1; Index++) {
NameString[Index] = PdbFileName[Index + StartIndex];
- if (NameString[Index] == 0 || NameString[Index] == '.') {
+ if ((NameString[Index] == 0) || (NameString[Index] == '.')) {
NameString[Index] = 0;
break;
}
@@ -379,6 +390,7 @@ GetModuleInfoFromHandle ( if (Index == BufferSize - 1) {
NameString[Index] = 0;
}
+
//
// Module Name is got.
//
@@ -392,21 +404,22 @@ GetModuleInfoFromHandle ( //
StringPtr = NULL;
StringSize = 0;
- Status = GetSectionFromAnyFv (
- TempGuid,
- EFI_SECTION_USER_INTERFACE,
- 0,
- (VOID **) &StringPtr,
- &StringSize
- );
+ Status = GetSectionFromAnyFv (
+ TempGuid,
+ EFI_SECTION_USER_INTERFACE,
+ 0,
+ (VOID **)&StringPtr,
+ &StringSize
+ );
if (!EFI_ERROR (Status)) {
//
// Method 3. Get the name string from FFS UI section
//
for (Index = 0; Index < BufferSize - 1 && StringPtr[Index] != 0; Index++) {
- NameString[Index] = (CHAR8) StringPtr[Index];
+ NameString[Index] = (CHAR8)StringPtr[Index];
}
+
NameString[Index] = 0;
FreePool (StringPtr);
}
@@ -418,9 +431,9 @@ Done: //
if (ModuleGuid != NULL) {
CopyGuid (ModuleGuid, TempGuid);
- if (IsZeroGuid(TempGuid) && (Handle != NULL) && !ModuleGuidIsGet) {
- // Handle is GUID
- CopyGuid (ModuleGuid, (EFI_GUID *) Handle);
+ if (IsZeroGuid (TempGuid) && (Handle != NULL) && !ModuleGuidIsGet) {
+ // Handle is GUID
+ CopyGuid (ModuleGuid, (EFI_GUID *)Handle);
}
}
@@ -431,7 +444,7 @@ Done: mCacheHandleGuidTable[mCachePairCount].Handle = Handle;
CopyGuid (&mCacheHandleGuidTable[mCachePairCount].ModuleGuid, ModuleGuid);
AsciiStrCpyS (mCacheHandleGuidTable[mCachePairCount].NameString, FPDT_STRING_EVENT_RECORD_NAME_LENGTH, NameString);
- mCachePairCount ++;
+ mCachePairCount++;
}
return Status;
@@ -448,9 +461,9 @@ Done: **/
VOID
CopyStringIntoPerfRecordAndUpdateLength (
- IN OUT CHAR8 *Destination,
+ IN OUT CHAR8 *Destination,
IN CONST CHAR8 *Source,
- IN OUT UINT8 *Length
+ IN OUT UINT8 *Length
)
{
UINTN StringLen;
@@ -466,12 +479,13 @@ CopyStringIntoPerfRecordAndUpdateLength ( DestMax = STRING_SIZE;
}
}
+
StringLen = AsciiStrLen (Source);
if (StringLen >= DestMax) {
StringLen = DestMax -1;
}
- AsciiStrnCpyS(Destination, DestMax, Source, StringLen);
+ AsciiStrnCpyS (Destination, DestMax, Source, StringLen);
*Length += (UINT8)DestMax;
return;
@@ -513,18 +527,18 @@ InsertFpdtRecord ( )
{
- EFI_STATUS Status;
- EFI_GUID ModuleGuid;
- CHAR8 ModuleName[FPDT_STRING_EVENT_RECORD_NAME_LENGTH];
- FPDT_RECORD_PTR FpdtRecordPtr;
- FPDT_RECORD_PTR CachedFpdtRecordPtr;
- UINT64 TimeStamp;
- CONST CHAR8 *StringPtr;
- UINTN DestMax;
- UINTN StringLen;
- UINT16 ProgressId;
-
- StringPtr = NULL;
+ EFI_STATUS Status;
+ EFI_GUID ModuleGuid;
+ CHAR8 ModuleName[FPDT_STRING_EVENT_RECORD_NAME_LENGTH];
+ FPDT_RECORD_PTR FpdtRecordPtr;
+ FPDT_RECORD_PTR CachedFpdtRecordPtr;
+ UINT64 TimeStamp;
+ CONST CHAR8 *StringPtr;
+ UINTN DestMax;
+ UINTN StringLen;
+ UINT16 ProgressId;
+
+ StringPtr = NULL;
ZeroMem (ModuleName, sizeof (ModuleName));
//
@@ -550,6 +564,7 @@ InsertFpdtRecord ( PerfId += 1;
}
}
+
if (PerfId == 0) {
//
// Get ProgressID form the String Token.
@@ -558,6 +573,7 @@ InsertFpdtRecord ( if (EFI_ERROR (Status)) {
return Status;
}
+
PerfId = ProgressId;
}
}
@@ -586,134 +602,147 @@ InsertFpdtRecord ( // 4. Fill in the FPDT record according to different Performance Identifier.
//
switch (PerfId) {
- case MODULE_START_ID:
- case MODULE_END_ID:
- GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, sizeof (ModuleName), &ModuleGuid);
- StringPtr = ModuleName;
- //
- // Cache the offset of start image start record and use to update the start image end record if needed.
- //
- if (PerfId == MODULE_START_ID && Attribute == PerfEntry) {
- mCachedLength = mSmmBootPerformanceTable->Header.Length;
- }
- if (!PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly)) {
- FpdtRecordPtr.GuidEvent->Header.Type = FPDT_GUID_EVENT_TYPE;
- FpdtRecordPtr.GuidEvent->Header.Length = sizeof (FPDT_GUID_EVENT_RECORD);
- FpdtRecordPtr.GuidEvent->Header.Revision = FPDT_RECORD_REVISION_1;
- FpdtRecordPtr.GuidEvent->ProgressID = PerfId;
- FpdtRecordPtr.GuidEvent->Timestamp = TimeStamp;
- CopyMem (&FpdtRecordPtr.GuidEvent->Guid, &ModuleGuid, sizeof (FpdtRecordPtr.GuidEvent->Guid));
- if (CallerIdentifier == NULL && PerfId == MODULE_END_ID && mCachedLength != 0) {
- CachedFpdtRecordPtr.RecordHeader = (EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER *)((UINT8*)mSmmBootPerformanceTable + mCachedLength);
- CopyMem (&FpdtRecordPtr.GuidEvent->Guid, &CachedFpdtRecordPtr.GuidEvent->Guid, sizeof (FpdtRecordPtr.GuidEvent->Guid));
- mCachedLength = 0;
- }
- }
- break;
-
- case MODULE_LOADIMAGE_START_ID:
- case MODULE_LOADIMAGE_END_ID:
- GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, sizeof (ModuleName), &ModuleGuid);
- StringPtr = ModuleName;
- if (PerfId == MODULE_LOADIMAGE_START_ID) {
- mLoadImageCount++;
+ case MODULE_START_ID:
+ case MODULE_END_ID:
+ GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, sizeof (ModuleName), &ModuleGuid);
+ StringPtr = ModuleName;
//
- // Cache the offset of load image start record and use to be updated by the load image end record if needed.
+ // Cache the offset of start image start record and use to update the start image end record if needed.
//
- if (CallerIdentifier == NULL && Attribute == PerfEntry) {
+ if ((PerfId == MODULE_START_ID) && (Attribute == PerfEntry)) {
mCachedLength = mSmmBootPerformanceTable->Header.Length;
}
- }
- if (!PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly)) {
- FpdtRecordPtr.GuidQwordEvent->Header.Type = FPDT_GUID_QWORD_EVENT_TYPE;
- FpdtRecordPtr.GuidQwordEvent->Header.Length = sizeof (FPDT_GUID_QWORD_EVENT_RECORD);
- FpdtRecordPtr.GuidQwordEvent->Header.Revision = FPDT_RECORD_REVISION_1;
- FpdtRecordPtr.GuidQwordEvent->ProgressID = PerfId;
- FpdtRecordPtr.GuidQwordEvent->Timestamp = TimeStamp;
- FpdtRecordPtr.GuidQwordEvent->Qword = mLoadImageCount;
- CopyMem (&FpdtRecordPtr.GuidQwordEvent->Guid, &ModuleGuid, sizeof (FpdtRecordPtr.GuidQwordEvent->Guid));
- if (PerfId == MODULE_LOADIMAGE_END_ID && mCachedLength != 0) {
- CachedFpdtRecordPtr.RecordHeader = (EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER *)((UINT8*)mSmmBootPerformanceTable + mCachedLength);
- CopyMem (&CachedFpdtRecordPtr.GuidQwordEvent->Guid, &ModuleGuid, sizeof (CachedFpdtRecordPtr.GuidQwordEvent->Guid));
- mCachedLength = 0;
+
+ if (!PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly)) {
+ FpdtRecordPtr.GuidEvent->Header.Type = FPDT_GUID_EVENT_TYPE;
+ FpdtRecordPtr.GuidEvent->Header.Length = sizeof (FPDT_GUID_EVENT_RECORD);
+ FpdtRecordPtr.GuidEvent->Header.Revision = FPDT_RECORD_REVISION_1;
+ FpdtRecordPtr.GuidEvent->ProgressID = PerfId;
+ FpdtRecordPtr.GuidEvent->Timestamp = TimeStamp;
+ CopyMem (&FpdtRecordPtr.GuidEvent->Guid, &ModuleGuid, sizeof (FpdtRecordPtr.GuidEvent->Guid));
+ if ((CallerIdentifier == NULL) && (PerfId == MODULE_END_ID) && (mCachedLength != 0)) {
+ CachedFpdtRecordPtr.RecordHeader = (EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER *)((UINT8 *)mSmmBootPerformanceTable + mCachedLength);
+ CopyMem (&FpdtRecordPtr.GuidEvent->Guid, &CachedFpdtRecordPtr.GuidEvent->Guid, sizeof (FpdtRecordPtr.GuidEvent->Guid));
+ mCachedLength = 0;
+ }
}
- }
- break;
- case PERF_EVENTSIGNAL_START_ID:
- case PERF_EVENTSIGNAL_END_ID:
- case PERF_CALLBACK_START_ID:
- case PERF_CALLBACK_END_ID:
- if (String == NULL || Guid == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- StringPtr = String;
- if (AsciiStrLen (String) == 0) {
- StringPtr = "unknown name";
- }
- if (!PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly)) {
- FpdtRecordPtr.DualGuidStringEvent->Header.Type = FPDT_DUAL_GUID_STRING_EVENT_TYPE;
- FpdtRecordPtr.DualGuidStringEvent->Header.Length = sizeof (FPDT_DUAL_GUID_STRING_EVENT_RECORD);
- FpdtRecordPtr.DualGuidStringEvent->Header.Revision = FPDT_RECORD_REVISION_1;
- FpdtRecordPtr.DualGuidStringEvent->ProgressID = PerfId;
- FpdtRecordPtr.DualGuidStringEvent->Timestamp = TimeStamp;
- CopyMem (&FpdtRecordPtr.DualGuidStringEvent->Guid1, CallerIdentifier, sizeof (FpdtRecordPtr.DualGuidStringEvent->Guid1));
- CopyMem (&FpdtRecordPtr.DualGuidStringEvent->Guid2, Guid, sizeof (FpdtRecordPtr.DualGuidStringEvent->Guid2));
- CopyStringIntoPerfRecordAndUpdateLength (FpdtRecordPtr.DualGuidStringEvent->String, StringPtr, &FpdtRecordPtr.DualGuidStringEvent->Header.Length);
- }
- break;
-
- case PERF_EVENT_ID:
- case PERF_FUNCTION_START_ID:
- case PERF_FUNCTION_END_ID:
- case PERF_INMODULE_START_ID:
- case PERF_INMODULE_END_ID:
- case PERF_CROSSMODULE_START_ID:
- case PERF_CROSSMODULE_END_ID:
- GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, sizeof (ModuleName), &ModuleGuid);
- if (String != NULL) {
- StringPtr = String;
- } else {
+ break;
+
+ case MODULE_LOADIMAGE_START_ID:
+ case MODULE_LOADIMAGE_END_ID:
+ GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, sizeof (ModuleName), &ModuleGuid);
StringPtr = ModuleName;
- }
- if (AsciiStrLen (StringPtr) == 0) {
- StringPtr = "unknown name";
- }
- if (!PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly)) {
- FpdtRecordPtr.DynamicStringEvent->Header.Type = FPDT_DYNAMIC_STRING_EVENT_TYPE;
- FpdtRecordPtr.DynamicStringEvent->Header.Length = sizeof (FPDT_DYNAMIC_STRING_EVENT_RECORD);
- FpdtRecordPtr.DynamicStringEvent->Header.Revision = FPDT_RECORD_REVISION_1;
- FpdtRecordPtr.DynamicStringEvent->ProgressID = PerfId;
- FpdtRecordPtr.DynamicStringEvent->Timestamp = TimeStamp;
- CopyMem (&FpdtRecordPtr.DynamicStringEvent->Guid, &ModuleGuid, sizeof (FpdtRecordPtr.DynamicStringEvent->Guid));
- CopyStringIntoPerfRecordAndUpdateLength (FpdtRecordPtr.DynamicStringEvent->String, StringPtr, &FpdtRecordPtr.DynamicStringEvent->Header.Length);
- }
- break;
+ if (PerfId == MODULE_LOADIMAGE_START_ID) {
+ mLoadImageCount++;
+ //
+ // Cache the offset of load image start record and use to be updated by the load image end record if needed.
+ //
+ if ((CallerIdentifier == NULL) && (Attribute == PerfEntry)) {
+ mCachedLength = mSmmBootPerformanceTable->Header.Length;
+ }
+ }
+
+ if (!PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly)) {
+ FpdtRecordPtr.GuidQwordEvent->Header.Type = FPDT_GUID_QWORD_EVENT_TYPE;
+ FpdtRecordPtr.GuidQwordEvent->Header.Length = sizeof (FPDT_GUID_QWORD_EVENT_RECORD);
+ FpdtRecordPtr.GuidQwordEvent->Header.Revision = FPDT_RECORD_REVISION_1;
+ FpdtRecordPtr.GuidQwordEvent->ProgressID = PerfId;
+ FpdtRecordPtr.GuidQwordEvent->Timestamp = TimeStamp;
+ FpdtRecordPtr.GuidQwordEvent->Qword = mLoadImageCount;
+ CopyMem (&FpdtRecordPtr.GuidQwordEvent->Guid, &ModuleGuid, sizeof (FpdtRecordPtr.GuidQwordEvent->Guid));
+ if ((PerfId == MODULE_LOADIMAGE_END_ID) && (mCachedLength != 0)) {
+ CachedFpdtRecordPtr.RecordHeader = (EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER *)((UINT8 *)mSmmBootPerformanceTable + mCachedLength);
+ CopyMem (&CachedFpdtRecordPtr.GuidQwordEvent->Guid, &ModuleGuid, sizeof (CachedFpdtRecordPtr.GuidQwordEvent->Guid));
+ mCachedLength = 0;
+ }
+ }
+
+ break;
+
+ case PERF_EVENTSIGNAL_START_ID:
+ case PERF_EVENTSIGNAL_END_ID:
+ case PERF_CALLBACK_START_ID:
+ case PERF_CALLBACK_END_ID:
+ if ((String == NULL) || (Guid == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ StringPtr = String;
+ if (AsciiStrLen (String) == 0) {
+ StringPtr = "unknown name";
+ }
- default:
- if (Attribute != PerfEntry) {
+ if (!PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly)) {
+ FpdtRecordPtr.DualGuidStringEvent->Header.Type = FPDT_DUAL_GUID_STRING_EVENT_TYPE;
+ FpdtRecordPtr.DualGuidStringEvent->Header.Length = sizeof (FPDT_DUAL_GUID_STRING_EVENT_RECORD);
+ FpdtRecordPtr.DualGuidStringEvent->Header.Revision = FPDT_RECORD_REVISION_1;
+ FpdtRecordPtr.DualGuidStringEvent->ProgressID = PerfId;
+ FpdtRecordPtr.DualGuidStringEvent->Timestamp = TimeStamp;
+ CopyMem (&FpdtRecordPtr.DualGuidStringEvent->Guid1, CallerIdentifier, sizeof (FpdtRecordPtr.DualGuidStringEvent->Guid1));
+ CopyMem (&FpdtRecordPtr.DualGuidStringEvent->Guid2, Guid, sizeof (FpdtRecordPtr.DualGuidStringEvent->Guid2));
+ CopyStringIntoPerfRecordAndUpdateLength (FpdtRecordPtr.DualGuidStringEvent->String, StringPtr, &FpdtRecordPtr.DualGuidStringEvent->Header.Length);
+ }
+
+ break;
+
+ case PERF_EVENT_ID:
+ case PERF_FUNCTION_START_ID:
+ case PERF_FUNCTION_END_ID:
+ case PERF_INMODULE_START_ID:
+ case PERF_INMODULE_END_ID:
+ case PERF_CROSSMODULE_START_ID:
+ case PERF_CROSSMODULE_END_ID:
GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, sizeof (ModuleName), &ModuleGuid);
if (String != NULL) {
StringPtr = String;
} else {
StringPtr = ModuleName;
}
+
if (AsciiStrLen (StringPtr) == 0) {
StringPtr = "unknown name";
}
+
if (!PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly)) {
- FpdtRecordPtr.DynamicStringEvent->Header.Type = FPDT_DYNAMIC_STRING_EVENT_TYPE;
- FpdtRecordPtr.DynamicStringEvent->Header.Length = sizeof (FPDT_DYNAMIC_STRING_EVENT_RECORD);
- FpdtRecordPtr.DynamicStringEvent->Header.Revision = FPDT_RECORD_REVISION_1;
- FpdtRecordPtr.DynamicStringEvent->ProgressID = PerfId;
- FpdtRecordPtr.DynamicStringEvent->Timestamp = TimeStamp;
+ FpdtRecordPtr.DynamicStringEvent->Header.Type = FPDT_DYNAMIC_STRING_EVENT_TYPE;
+ FpdtRecordPtr.DynamicStringEvent->Header.Length = sizeof (FPDT_DYNAMIC_STRING_EVENT_RECORD);
+ FpdtRecordPtr.DynamicStringEvent->Header.Revision = FPDT_RECORD_REVISION_1;
+ FpdtRecordPtr.DynamicStringEvent->ProgressID = PerfId;
+ FpdtRecordPtr.DynamicStringEvent->Timestamp = TimeStamp;
CopyMem (&FpdtRecordPtr.DynamicStringEvent->Guid, &ModuleGuid, sizeof (FpdtRecordPtr.DynamicStringEvent->Guid));
CopyStringIntoPerfRecordAndUpdateLength (FpdtRecordPtr.DynamicStringEvent->String, StringPtr, &FpdtRecordPtr.DynamicStringEvent->Header.Length);
}
- } else {
- return EFI_INVALID_PARAMETER;
- }
- break;
+
+ break;
+
+ default:
+ if (Attribute != PerfEntry) {
+ GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, sizeof (ModuleName), &ModuleGuid);
+ if (String != NULL) {
+ StringPtr = String;
+ } else {
+ StringPtr = ModuleName;
+ }
+
+ if (AsciiStrLen (StringPtr) == 0) {
+ StringPtr = "unknown name";
+ }
+
+ if (!PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly)) {
+ FpdtRecordPtr.DynamicStringEvent->Header.Type = FPDT_DYNAMIC_STRING_EVENT_TYPE;
+ FpdtRecordPtr.DynamicStringEvent->Header.Length = sizeof (FPDT_DYNAMIC_STRING_EVENT_RECORD);
+ FpdtRecordPtr.DynamicStringEvent->Header.Revision = FPDT_RECORD_REVISION_1;
+ FpdtRecordPtr.DynamicStringEvent->ProgressID = PerfId;
+ FpdtRecordPtr.DynamicStringEvent->Timestamp = TimeStamp;
+ CopyMem (&FpdtRecordPtr.DynamicStringEvent->Guid, &ModuleGuid, sizeof (FpdtRecordPtr.DynamicStringEvent->Guid));
+ CopyStringIntoPerfRecordAndUpdateLength (FpdtRecordPtr.DynamicStringEvent->String, StringPtr, &FpdtRecordPtr.DynamicStringEvent->Header.Length);
+ }
+ } else {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ break;
}
//
@@ -723,11 +752,12 @@ InsertFpdtRecord ( if (StringPtr == NULL) {
return EFI_INVALID_PARAMETER;
}
- FpdtRecordPtr.DynamicStringEvent->Header.Type = FPDT_DYNAMIC_STRING_EVENT_TYPE;
- FpdtRecordPtr.DynamicStringEvent->Header.Length = sizeof (FPDT_DYNAMIC_STRING_EVENT_RECORD);
- FpdtRecordPtr.DynamicStringEvent->Header.Revision = FPDT_RECORD_REVISION_1;
- FpdtRecordPtr.DynamicStringEvent->ProgressID = PerfId;
- FpdtRecordPtr.DynamicStringEvent->Timestamp = TimeStamp;
+
+ FpdtRecordPtr.DynamicStringEvent->Header.Type = FPDT_DYNAMIC_STRING_EVENT_TYPE;
+ FpdtRecordPtr.DynamicStringEvent->Header.Length = sizeof (FPDT_DYNAMIC_STRING_EVENT_RECORD);
+ FpdtRecordPtr.DynamicStringEvent->Header.Revision = FPDT_RECORD_REVISION_1;
+ FpdtRecordPtr.DynamicStringEvent->ProgressID = PerfId;
+ FpdtRecordPtr.DynamicStringEvent->Timestamp = TimeStamp;
if (Guid != NULL) {
//
// Cache the event guid in string event record.
@@ -736,33 +766,39 @@ InsertFpdtRecord ( } else {
CopyMem (&FpdtRecordPtr.DynamicStringEvent->Guid, &ModuleGuid, sizeof (FpdtRecordPtr.DynamicStringEvent->Guid));
}
+
if (AsciiStrLen (StringPtr) == 0) {
StringPtr = "unknown name";
}
+
CopyStringIntoPerfRecordAndUpdateLength (FpdtRecordPtr.DynamicStringEvent->String, StringPtr, &FpdtRecordPtr.DynamicStringEvent->Header.Length);
if ((PerfId == MODULE_LOADIMAGE_START_ID) || (PerfId == MODULE_END_ID)) {
FpdtRecordPtr.DynamicStringEvent->Header.Length = (UINT8)(sizeof (FPDT_DYNAMIC_STRING_EVENT_RECORD)+ STRING_SIZE);
}
- if ((PerfId == MODULE_LOADIMAGE_END_ID || PerfId == MODULE_END_ID) && mCachedLength != 0) {
- CachedFpdtRecordPtr.RecordHeader = (EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER *)((UINT8*)mSmmBootPerformanceTable + mCachedLength);
+
+ if (((PerfId == MODULE_LOADIMAGE_END_ID) || (PerfId == MODULE_END_ID)) && (mCachedLength != 0)) {
+ CachedFpdtRecordPtr.RecordHeader = (EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER *)((UINT8 *)mSmmBootPerformanceTable + mCachedLength);
if (PerfId == MODULE_LOADIMAGE_END_ID) {
- DestMax = CachedFpdtRecordPtr.DynamicStringEvent->Header.Length - sizeof (FPDT_DYNAMIC_STRING_EVENT_RECORD);
+ DestMax = CachedFpdtRecordPtr.DynamicStringEvent->Header.Length - sizeof (FPDT_DYNAMIC_STRING_EVENT_RECORD);
StringLen = AsciiStrLen (StringPtr);
if (StringLen >= DestMax) {
StringLen = DestMax -1;
}
+
CopyMem (&CachedFpdtRecordPtr.DynamicStringEvent->Guid, &ModuleGuid, sizeof (CachedFpdtRecordPtr.DynamicStringEvent->Guid));
AsciiStrnCpyS (CachedFpdtRecordPtr.DynamicStringEvent->String, DestMax, StringPtr, StringLen);
} else if (PerfId == MODULE_END_ID) {
- DestMax = FpdtRecordPtr.DynamicStringEvent->Header.Length - sizeof (FPDT_DYNAMIC_STRING_EVENT_RECORD);
+ DestMax = FpdtRecordPtr.DynamicStringEvent->Header.Length - sizeof (FPDT_DYNAMIC_STRING_EVENT_RECORD);
StringLen = AsciiStrLen (CachedFpdtRecordPtr.DynamicStringEvent->String);
if (StringLen >= DestMax) {
StringLen = DestMax -1;
}
+
CopyMem (&FpdtRecordPtr.DynamicStringEvent->Guid, &CachedFpdtRecordPtr.DynamicStringEvent->Guid, sizeof (CachedFpdtRecordPtr.DynamicStringEvent->Guid));
AsciiStrnCpyS (FpdtRecordPtr.DynamicStringEvent->String, DestMax, CachedFpdtRecordPtr.DynamicStringEvent->String, StringLen);
}
+
mCachedLength = 0;
}
}
@@ -770,7 +806,7 @@ InsertFpdtRecord ( //
// 5. Update the length of the used buffer after fill in the record.
//
- mPerformanceLength += FpdtRecordPtr.RecordHeader->Length;
+ mPerformanceLength += FpdtRecordPtr.RecordHeader->Length;
mSmmBootPerformanceTable->Header.Length += FpdtRecordPtr.RecordHeader->Length;
return EFI_SUCCESS;
@@ -803,10 +839,10 @@ InsertFpdtRecord ( EFI_STATUS
EFIAPI
FpdtSmiHandler (
- IN EFI_HANDLE DispatchHandle,
- IN CONST VOID *RegisterContext,
- IN OUT VOID *CommBuffer,
- IN OUT UINTN *CommBufferSize
+ IN EFI_HANDLE DispatchHandle,
+ IN CONST VOID *RegisterContext,
+ IN OUT VOID *CommBuffer,
+ IN OUT UINTN *CommBufferSize
)
{
EFI_STATUS Status;
@@ -820,13 +856,13 @@ FpdtSmiHandler ( //
// If input is invalid, stop processing this SMI
//
- if (CommBuffer == NULL || CommBufferSize == NULL) {
+ if ((CommBuffer == NULL) || (CommBufferSize == NULL)) {
return EFI_SUCCESS;
}
TempCommBufferSize = *CommBufferSize;
- if(TempCommBufferSize < sizeof (SMM_BOOT_RECORD_COMMUNICATE)) {
+ if (TempCommBufferSize < sizeof (SMM_BOOT_RECORD_COMMUNICATE)) {
return EFI_SUCCESS;
}
@@ -835,27 +871,28 @@ FpdtSmiHandler ( return EFI_SUCCESS;
}
- SmmCommData = (SMM_BOOT_RECORD_COMMUNICATE*)CommBuffer;
+ SmmCommData = (SMM_BOOT_RECORD_COMMUNICATE *)CommBuffer;
Status = EFI_SUCCESS;
switch (SmmCommData->Function) {
- case SMM_FPDT_FUNCTION_GET_BOOT_RECORD_SIZE :
+ case SMM_FPDT_FUNCTION_GET_BOOT_RECORD_SIZE:
if (mSmmBootPerformanceTable != NULL) {
mBootRecordSize = mSmmBootPerformanceTable->Header.Length - sizeof (SMM_BOOT_PERFORMANCE_TABLE);
}
+
SmmCommData->BootRecordSize = mBootRecordSize;
break;
- case SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA :
+ case SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA:
Status = EFI_UNSUPPORTED;
break;
- case SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET :
+ case SMM_FPDT_FUNCTION_GET_BOOT_RECORD_DATA_BY_OFFSET:
BootRecordOffset = SmmCommData->BootRecordOffset;
BootRecordData = SmmCommData->BootRecordData;
BootRecordSize = SmmCommData->BootRecordSize;
- if (BootRecordData == NULL || BootRecordOffset >= mBootRecordSize) {
+ if ((BootRecordData == NULL) || (BootRecordOffset >= mBootRecordSize)) {
Status = EFI_INVALID_PARAMETER;
break;
}
@@ -866,15 +903,17 @@ FpdtSmiHandler ( if (BootRecordSize > mBootRecordSize - BootRecordOffset) {
BootRecordSize = mBootRecordSize - BootRecordOffset;
}
+
SmmCommData->BootRecordSize = BootRecordSize;
if (!SmmIsBufferOutsideSmmValid ((UINTN)BootRecordData, BootRecordSize)) {
DEBUG ((DEBUG_ERROR, "FpdtSmiHandler: MM Data buffer in MMRAM or overflow!\n"));
Status = EFI_ACCESS_DENIED;
break;
}
- BootRecordBuffer = ((UINT8 *) (mSmmBootPerformanceTable)) + sizeof (SMM_BOOT_PERFORMANCE_TABLE);
+
+ BootRecordBuffer = ((UINT8 *)(mSmmBootPerformanceTable)) + sizeof (SMM_BOOT_PERFORMANCE_TABLE);
CopyMem (
- (UINT8*)BootRecordData,
+ (UINT8 *)BootRecordData,
BootRecordBuffer + BootRecordOffset,
BootRecordSize
);
@@ -901,14 +940,14 @@ FpdtSmiHandler ( VOID
EFIAPI
InitializeSmmCorePerformanceLib (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
- EFI_HANDLE Handle;
- EFI_HANDLE SmiHandle;
- EFI_STATUS Status;
- PERFORMANCE_PROPERTY *PerformanceProperty;
+ EFI_HANDLE Handle;
+ EFI_HANDLE SmiHandle;
+ EFI_STATUS Status;
+ PERFORMANCE_PROPERTY *PerformanceProperty;
//
// Initialize spin lock
@@ -931,10 +970,10 @@ InitializeSmmCorePerformanceLib ( // Register SMI handler.
//
SmiHandle = NULL;
- Status = gSmst->SmiHandlerRegister (FpdtSmiHandler, &gEfiFirmwarePerformanceGuid, &SmiHandle);
+ Status = gSmst->SmiHandlerRegister (FpdtSmiHandler, &gEfiFirmwarePerformanceGuid, &SmiHandle);
ASSERT_EFI_ERROR (Status);
- Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid, (VOID **) &PerformanceProperty);
+ Status = EfiGetSystemConfigurationTable (&gPerformanceProtocolGuid, (VOID **)&PerformanceProperty);
if (EFI_ERROR (Status)) {
//
// Install configuration table for performance property.
@@ -1025,7 +1064,7 @@ SmmCorePerformanceLibConstructor ( **/
EFI_STATUS
EFIAPI
-CreatePerformanceMeasurement(
+CreatePerformanceMeasurement (
IN CONST VOID *CallerIdentifier OPTIONAL,
IN CONST VOID *Guid OPTIONAL,
IN CONST CHAR8 *String OPTIONAL,
@@ -1035,7 +1074,7 @@ CreatePerformanceMeasurement( IN PERF_MEASUREMENT_ATTRIBUTE Attribute
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
Status = EFI_SUCCESS;
@@ -1080,7 +1119,7 @@ StartPerformanceMeasurementEx ( IN UINT32 Identifier
)
{
- CONST CHAR8 *String;
+ CONST CHAR8 *String;
if (Token != NULL) {
String = Token;
@@ -1129,7 +1168,7 @@ EndPerformanceMeasurementEx ( IN UINT32 Identifier
)
{
- CONST CHAR8 *String;
+ CONST CHAR8 *String;
if (Token != NULL) {
String = Token;
@@ -1188,13 +1227,13 @@ EndPerformanceMeasurementEx ( UINTN
EFIAPI
GetPerformanceMeasurementEx (
- IN UINTN LogEntryKey,
- OUT CONST VOID **Handle,
- OUT CONST CHAR8 **Token,
- OUT CONST CHAR8 **Module,
- OUT UINT64 *StartTimeStamp,
- OUT UINT64 *EndTimeStamp,
- OUT UINT32 *Identifier
+ IN UINTN LogEntryKey,
+ OUT CONST VOID **Handle,
+ OUT CONST CHAR8 **Token,
+ OUT CONST CHAR8 **Module,
+ OUT UINT64 *StartTimeStamp,
+ OUT UINT64 *EndTimeStamp,
+ OUT UINT32 *Identifier
)
{
return 0;
@@ -1315,12 +1354,12 @@ EndPerformanceMeasurement ( UINTN
EFIAPI
GetPerformanceMeasurement (
- IN UINTN LogEntryKey,
- OUT CONST VOID **Handle,
- OUT CONST CHAR8 **Token,
- OUT CONST CHAR8 **Module,
- OUT UINT64 *StartTimeStamp,
- OUT UINT64 *EndTimeStamp
+ IN UINTN LogEntryKey,
+ OUT CONST VOID **Handle,
+ OUT CONST CHAR8 **Token,
+ OUT CONST CHAR8 **Module,
+ OUT UINT64 *StartTimeStamp,
+ OUT UINT64 *EndTimeStamp
)
{
return 0;
@@ -1344,7 +1383,7 @@ PerformanceMeasurementEnabled ( VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0);
}
/**
@@ -1390,14 +1429,15 @@ LogPerformanceMeasurement ( BOOLEAN
EFIAPI
LogPerformanceMeasurementEnabled (
- IN CONST UINTN Type
+ IN CONST UINTN Type
)
{
//
// When Performance measurement is enabled and the type is not filtered, the performance can be logged.
//
- if (PerformanceMeasurementEnabled () && (PcdGet8(PcdPerformanceLibraryPropertyMask) & Type) == 0) {
+ if (PerformanceMeasurementEnabled () && ((PcdGet8 (PcdPerformanceLibraryPropertyMask) & Type) == 0)) {
return TRUE;
}
+
return FALSE;
}
|