diff options
author | Michael Kubacki <michael.kubacki@microsoft.com> | 2021-12-05 14:54:02 -0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2021-12-07 17:24:28 +0000 |
commit | 1436aea4d5707e672672a11bda72be2c63c936c3 (patch) | |
tree | 370c9d5bd8823aa8ea7bce71a0f29bff71feff67 /MdeModulePkg/Library/PeiPerformanceLib | |
parent | 7c7184e201a90a1d2376e615e55e3f4074731468 (diff) | |
download | edk2-1436aea4d5707e672672a11bda72be2c63c936c3.zip edk2-1436aea4d5707e672672a11bda72be2c63c936c3.tar.gz edk2-1436aea4d5707e672672a11bda72be2c63c936c3.tar.bz2 |
MdeModulePkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737
Apply uncrustify changes to .c/.h files in the MdeModulePkg package
Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Diffstat (limited to 'MdeModulePkg/Library/PeiPerformanceLib')
-rw-r--r-- | MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c | 384 |
1 files changed, 201 insertions, 183 deletions
diff --git a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c index ac033d4..93edc01 100644 --- a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c +++ b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c @@ -13,7 +13,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/
-
#include <PiPei.h>
#include <Guid/ExtendedFirmwarePerformance.h>
@@ -27,9 +26,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include <Library/PcdLib.h>
#include <Library/BaseMemoryLib.h>
-#define STRING_SIZE (FPDT_STRING_EVENT_RECORD_NAME_LENGTH * sizeof (CHAR8))
-#define PEI_MAX_RECORD_SIZE (sizeof (FPDT_DUAL_GUID_STRING_EVENT_RECORD) + STRING_SIZE)
-
+#define STRING_SIZE (FPDT_STRING_EVENT_RECORD_NAME_LENGTH * sizeof (CHAR8))
+#define PEI_MAX_RECORD_SIZE (sizeof (FPDT_DUAL_GUID_STRING_EVENT_RECORD) + STRING_SIZE)
/**
Return the pointer to the FPDT record in the allocated memory.
@@ -46,38 +44,40 @@ GetFpdtRecordPtr ( IN UINT8 RecordSize,
IN OUT FPDT_RECORD_PTR *FpdtRecordPtr,
IN OUT FPDT_PEI_EXT_PERF_HEADER **PeiPerformanceLogHeader
-)
+ )
{
- UINT16 PeiPerformanceLogEntries;
- UINTN PeiPerformanceSize;
- UINT8 *PeiFirmwarePerformance;
- EFI_HOB_GUID_TYPE *GuidHob;
+ UINT16 PeiPerformanceLogEntries;
+ UINTN PeiPerformanceSize;
+ UINT8 *PeiFirmwarePerformance;
+ EFI_HOB_GUID_TYPE *GuidHob;
//
// Get the number of PeiPerformanceLogEntries form PCD.
//
- PeiPerformanceLogEntries = (UINT16) (PcdGet16 (PcdMaxPeiPerformanceLogEntries16) != 0 ?
- PcdGet16 (PcdMaxPeiPerformanceLogEntries16) :
- PcdGet8 (PcdMaxPeiPerformanceLogEntries));
+ PeiPerformanceLogEntries = (UINT16)(PcdGet16 (PcdMaxPeiPerformanceLogEntries16) != 0 ?
+ PcdGet16 (PcdMaxPeiPerformanceLogEntries16) :
+ PcdGet8 (PcdMaxPeiPerformanceLogEntries));
//
// Create GUID HOB Data.
//
- GuidHob = GetFirstGuidHob (&gEdkiiFpdtExtendedFirmwarePerformanceGuid);
+ GuidHob = GetFirstGuidHob (&gEdkiiFpdtExtendedFirmwarePerformanceGuid);
PeiFirmwarePerformance = NULL;
while (GuidHob != NULL) {
//
// PEI Performance HOB was found, then return the existing one.
//
- PeiFirmwarePerformance = (UINT8*)GET_GUID_HOB_DATA (GuidHob);
+ PeiFirmwarePerformance = (UINT8 *)GET_GUID_HOB_DATA (GuidHob);
*PeiPerformanceLogHeader = (FPDT_PEI_EXT_PERF_HEADER *)PeiFirmwarePerformance;
- if (!(*PeiPerformanceLogHeader)->HobIsFull && (*PeiPerformanceLogHeader)->SizeOfAllEntries + RecordSize > (PeiPerformanceLogEntries * PEI_MAX_RECORD_SIZE)) {
+ if (!(*PeiPerformanceLogHeader)->HobIsFull && ((*PeiPerformanceLogHeader)->SizeOfAllEntries + RecordSize > (PeiPerformanceLogEntries * PEI_MAX_RECORD_SIZE))) {
(*PeiPerformanceLogHeader)->HobIsFull = TRUE;
}
- if (!(*PeiPerformanceLogHeader)->HobIsFull && (*PeiPerformanceLogHeader)->SizeOfAllEntries + RecordSize <= (PeiPerformanceLogEntries * PEI_MAX_RECORD_SIZE)) {
+
+ if (!(*PeiPerformanceLogHeader)->HobIsFull && ((*PeiPerformanceLogHeader)->SizeOfAllEntries + RecordSize <= (PeiPerformanceLogEntries * PEI_MAX_RECORD_SIZE))) {
FpdtRecordPtr->RecordHeader = (EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER *)(PeiFirmwarePerformance + sizeof (FPDT_PEI_EXT_PERF_HEADER) + (*PeiPerformanceLogHeader)->SizeOfAllEntries);
break;
}
+
//
// Previous HOB is used, then find next one.
//
@@ -88,12 +88,12 @@ GetFpdtRecordPtr ( //
// PEI Performance HOB was not found, then build one.
//
- PeiPerformanceSize = sizeof (FPDT_PEI_EXT_PERF_HEADER) +
- PEI_MAX_RECORD_SIZE * PeiPerformanceLogEntries;
- PeiFirmwarePerformance = (UINT8*)BuildGuidHob (&gEdkiiFpdtExtendedFirmwarePerformanceGuid, PeiPerformanceSize);
+ PeiPerformanceSize = sizeof (FPDT_PEI_EXT_PERF_HEADER) +
+ PEI_MAX_RECORD_SIZE * PeiPerformanceLogEntries;
+ PeiFirmwarePerformance = (UINT8 *)BuildGuidHob (&gEdkiiFpdtExtendedFirmwarePerformanceGuid, PeiPerformanceSize);
if (PeiFirmwarePerformance != NULL) {
ZeroMem (PeiFirmwarePerformance, PeiPerformanceSize);
- (*PeiPerformanceLogHeader) = (FPDT_PEI_EXT_PERF_HEADER *)PeiFirmwarePerformance;
+ (*PeiPerformanceLogHeader) = (FPDT_PEI_EXT_PERF_HEADER *)PeiFirmwarePerformance;
FpdtRecordPtr->RecordHeader = (EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER *)(PeiFirmwarePerformance + sizeof (FPDT_PEI_EXT_PERF_HEADER));
}
}
@@ -126,16 +126,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;
@@ -153,19 +154,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;
@@ -188,10 +190,10 @@ IsKnownID ( **/
EFI_STATUS
GetFpdtRecordId (
- IN BOOLEAN Attribute,
- IN CONST VOID *Handle,
- IN CONST CHAR8 *String,
- OUT UINT16 *ProgressID
+ IN BOOLEAN Attribute,
+ IN CONST VOID *Handle,
+ IN CONST CHAR8 *String,
+ OUT UINT16 *ProgressID
)
{
//
@@ -199,33 +201,38 @@ GetFpdtRecordId ( // When PcdEdkiiFpdtStringRecordEnableOnly is TRUE, all records are with type of FPDT_DYNAMIC_STRING_EVENT_TYPE.
//
if (String != NULL) {
- if (AsciiStrCmp (String, LOAD_IMAGE_TOK) == 0) { // "LoadImage:"
+ if (AsciiStrCmp (String, LOAD_IMAGE_TOK) == 0) {
+ // "LoadImage:"
if (Attribute == PerfStartEntry) {
*ProgressID = MODULE_LOADIMAGE_START_ID;
} else {
*ProgressID = MODULE_LOADIMAGE_END_ID;
}
- } else if (AsciiStrCmp (String, SEC_TOK) == 0 || // "SEC"
- AsciiStrCmp (String, PEI_TOK) == 0) { // "PEI"
+ } else if ((AsciiStrCmp (String, SEC_TOK) == 0) || // "SEC"
+ (AsciiStrCmp (String, PEI_TOK) == 0)) // "PEI"
+ {
if (Attribute == PerfStartEntry) {
*ProgressID = PERF_CROSSMODULE_START_ID;
} else {
*ProgressID = PERF_CROSSMODULE_END_ID;
}
- } else if (AsciiStrCmp (String, PEIM_TOK) == 0) { // "PEIM"
+ } else if (AsciiStrCmp (String, PEIM_TOK) == 0) {
+ // "PEIM"
if (Attribute == PerfStartEntry) {
*ProgressID = MODULE_START_ID;
} else {
*ProgressID = MODULE_END_ID;
}
- } else { //Pref used in Modules.
+ } else {
+ // Pref used in Modules.
if (Attribute == PerfStartEntry) {
*ProgressID = PERF_INMODULE_START_ID;
} else {
*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;
} else {
@@ -249,9 +256,9 @@ GetFpdtRecordId ( **/
VOID
CopyStringIntoPerfRecordAndUpdateLength (
- IN OUT CHAR8 *Destination,
+ IN OUT CHAR8 *Destination,
IN CONST CHAR8 *Source,
- IN OUT UINT8 *Length
+ IN OUT UINT8 *Length
)
{
UINTN StringLen;
@@ -267,18 +274,18 @@ 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;
}
-
/**
Convert PEI performance log to FPDT String boot record.
@@ -309,16 +316,16 @@ InsertFpdtRecord ( IN PERF_MEASUREMENT_ATTRIBUTE Attribute
)
{
- FPDT_RECORD_PTR FpdtRecordPtr;
- CONST VOID *ModuleGuid;
- CONST CHAR8 *StringPtr;
- EFI_STATUS Status;
- UINT64 TimeStamp;
- FPDT_PEI_EXT_PERF_HEADER *PeiPerformanceLogHeader;
-
- StringPtr = NULL;
+ FPDT_RECORD_PTR FpdtRecordPtr;
+ CONST VOID *ModuleGuid;
+ CONST CHAR8 *StringPtr;
+ EFI_STATUS Status;
+ UINT64 TimeStamp;
+ FPDT_PEI_EXT_PERF_HEADER *PeiPerformanceLogHeader;
+
+ StringPtr = NULL;
FpdtRecordPtr.RecordHeader = NULL;
- PeiPerformanceLogHeader = NULL;
+ PeiPerformanceLogHeader = NULL;
//
// 1. Get the Perf Id for records from PERF_START/PERF_END, PERF_START_EX/PERF_END_EX.
@@ -337,7 +344,7 @@ InsertFpdtRecord ( if ((PerfId != 0) && (IsKnownID (PerfId)) && (!IsKnownTokens (String))) {
return EFI_UNSUPPORTED;
} else if ((PerfId != 0) && (!IsKnownID (PerfId)) && (!IsKnownTokens (String))) {
- if (Attribute == PerfStartEntry && ((PerfId & 0x000F) != 0)) {
+ if ((Attribute == PerfStartEntry) && ((PerfId & 0x000F) != 0)) {
PerfId &= 0xFFF0;
} else if ((Attribute == PerfEndEntry) && ((PerfId & 0x000F) == 0)) {
PerfId += 1;
@@ -383,113 +390,123 @@ InsertFpdtRecord ( // 5. Fill in the FPDT record according to different Performance Identifier.
//
switch (PerfId) {
- case MODULE_START_ID:
- case MODULE_END_ID:
- StringPtr = PEIM_TOK;
- 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 (EFI_GUID));
- }
- break;
-
- case MODULE_LOADIMAGE_START_ID:
- case MODULE_LOADIMAGE_END_ID:
- StringPtr = LOAD_IMAGE_TOK;
- 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;
- if (PerfId == MODULE_LOADIMAGE_START_ID) {
- PeiPerformanceLogHeader->LoadImageCount++;
+ case MODULE_START_ID:
+ case MODULE_END_ID:
+ StringPtr = PEIM_TOK;
+ 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 (EFI_GUID));
}
- FpdtRecordPtr.GuidQwordEvent->Qword = PeiPerformanceLogHeader->LoadImageCount;
- CopyMem (&FpdtRecordPtr.GuidQwordEvent->Guid, ModuleGuid, sizeof (EFI_GUID));
- }
- 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, ModuleGuid, 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:
- if (String != NULL && AsciiStrLen (String) != 0) {
+
+ break;
+
+ case MODULE_LOADIMAGE_START_ID:
+ case MODULE_LOADIMAGE_END_ID:
+ StringPtr = LOAD_IMAGE_TOK;
+ 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;
+ if (PerfId == MODULE_LOADIMAGE_START_ID) {
+ PeiPerformanceLogHeader->LoadImageCount++;
+ }
+
+ FpdtRecordPtr.GuidQwordEvent->Qword = PeiPerformanceLogHeader->LoadImageCount;
+ CopyMem (&FpdtRecordPtr.GuidQwordEvent->Guid, ModuleGuid, sizeof (EFI_GUID));
+ }
+
+ 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;
- } else {
- 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 (EFI_GUID));
- CopyStringIntoPerfRecordAndUpdateLength (FpdtRecordPtr.DynamicStringEvent->String, StringPtr, &FpdtRecordPtr.DynamicStringEvent->Header.Length);
- }
- break;
-
- default:
- if (Attribute != PerfEntry) {
- if (String != NULL && AsciiStrLen (String) != 0) {
- StringPtr = String;
- } else {
- 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;
+ 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, ModuleGuid, 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:
+ if ((String != NULL) && (AsciiStrLen (String) != 0)) {
+ StringPtr = String;
+ } else {
+ 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 (EFI_GUID));
+ CopyStringIntoPerfRecordAndUpdateLength (FpdtRecordPtr.DynamicStringEvent->String, StringPtr, &FpdtRecordPtr.DynamicStringEvent->Header.Length);
+ }
+
+ break;
+
+ default:
+ if (Attribute != PerfEntry) {
+ if ((String != NULL) && (AsciiStrLen (String) != 0)) {
+ StringPtr = String;
+ } else {
+ 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;
}
//
// 5.2 When PcdEdkiiFpdtStringRecordEnableOnly==TRUE, create string record for all Perf entries.
//
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;
if (Guid != NULL) {
//
// Cache the event guid in string event record.
@@ -498,6 +515,7 @@ InsertFpdtRecord ( } else {
CopyMem (&FpdtRecordPtr.DynamicStringEvent->Guid, ModuleGuid, sizeof (EFI_GUID));
}
+
CopyStringIntoPerfRecordAndUpdateLength (FpdtRecordPtr.DynamicStringEvent->String, StringPtr, &FpdtRecordPtr.DynamicStringEvent->Header.Length);
}
@@ -543,7 +561,7 @@ StartPerformanceMeasurementEx ( IN UINT32 Identifier
)
{
- CONST CHAR8 *String;
+ CONST CHAR8 *String;
if (Token != NULL) {
String = Token;
@@ -554,7 +572,6 @@ StartPerformanceMeasurementEx ( }
return (RETURN_STATUS)InsertFpdtRecord (Handle, NULL, String, TimeStamp, 0, (UINT16)Identifier, PerfStartEntry);
-
}
/**
@@ -589,7 +606,7 @@ EndPerformanceMeasurementEx ( IN UINT32 Identifier
)
{
- CONST CHAR8 *String;
+ CONST CHAR8 *String;
if (Token != NULL) {
String = Token;
@@ -648,13 +665,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;
@@ -771,12 +788,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;
@@ -800,7 +817,7 @@ PerformanceMeasurementEnabled ( VOID
)
{
- return (BOOLEAN) ((PcdGet8(PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0);
}
/**
@@ -846,14 +863,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;
}
|