diff --git a/EdkModulePkg/EdkModulePkg.spd b/EdkModulePkg/EdkModulePkg.spd
index 37a1a1fc6d..86d33e69cd 100644
--- a/EdkModulePkg/EdkModulePkg.spd
+++ b/EdkModulePkg/EdkModulePkg.spd
@@ -987,6 +987,15 @@
4
kbytes size of runtime memory.
+
+ PcdMaxPeiPerformanceLogEntries
+ 0x0001002f
+ gEfiEdkModulePkgTokenSpaceGuid
+ UINT8
+ FIXED_AT_BUILD PATCHABLE_IN_MODULE
+ 28
+ Maximun number of performance log entries during PEI phase.
+
PcdFlashFvBaseArray
0x31000001
diff --git a/EdkModulePkg/Include/Guid/PeiPerformanceHob.h b/EdkModulePkg/Include/Guid/PeiPerformanceHob.h
index 33a2dc9089..c3bfc1f77a 100644
--- a/EdkModulePkg/Include/Guid/PeiPerformanceHob.h
+++ b/EdkModulePkg/Include/Guid/PeiPerformanceHob.h
@@ -33,10 +33,6 @@ Abstract:
//
#define PEI_PERFORMANCE_STRING_SIZE 8
#define PEI_PERFORMANCE_STRING_LENGTH (PEI_PERFORMANCE_STRING_SIZE - 1)
-//
-// Bugbug: This macro will be replaced by a binary patchable PCD entry in EdkModulePkg
-//
-#define MAX_PEI_PERFORMANCE_LOG_ENTRIES 28
typedef struct {
EFI_PHYSICAL_ADDRESS Handle;
diff --git a/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c b/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
index 64c7454c66..268a6a04f2 100644
--- a/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
+++ b/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
@@ -438,7 +438,7 @@ DxeCorePerformanceLibConstructor (
);
ASSERT_EFI_ERROR (Status);
- mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + MAX_PEI_PERFORMANCE_LOG_ENTRIES;
+ mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + PcdGet8 (PcdMaxPeiPerformanceLogEntries);
mGaugeData = AllocateZeroPool (sizeof (GAUGE_DATA_HEADER) + (sizeof (GAUGE_DATA_ENTRY) * mMaxGaugeRecords));
ASSERT (mGaugeData != NULL);
diff --git a/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.msa b/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.msa
index f00b9da4a8..ab6edcb912 100644
--- a/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.msa
+++ b/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.msa
@@ -91,5 +91,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
The bitmask of flags that specify the enable/disable of
Performance Measurement.
+
+ PcdMaxPeiPerformanceLogEntries
+ gEfiEdkModulePkgTokenSpaceGuid
+ Maximun number of performance log entries during PEI phase.
+
\ No newline at end of file
diff --git a/EdkModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c b/EdkModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
index b97849fa35..dcb360c5e7 100644
--- a/EdkModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
+++ b/EdkModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
@@ -57,7 +57,7 @@ InternalGetPerformanceHobLog (
// PEI Performance HOB was not found, then build one.
//
PeiPerformanceLogSize = sizeof (PEI_PERFORMANCE_LOG_HEADER) +
- sizeof (PEI_PERFORMANCE_LOG_ENTRY) * MAX_PEI_PERFORMANCE_LOG_ENTRIES;
+ sizeof (PEI_PERFORMANCE_LOG_ENTRY) * PcdGet8 (PcdMaxPeiPerformanceLogEntries);
PeiPerformanceLog = BuildGuidHob (&gPeiPerformanceHobGuid, PeiPerformanceLogSize);
PeiPerformanceLog = ZeroMem (PeiPerformanceLog, PeiPerformanceLogSize);
}
@@ -152,7 +152,7 @@ StartPerformanceMeasurement (
PeiPerformanceLog = InternalGetPerformanceHobLog ();
- if (PeiPerformanceLog->NumberOfEntries >= MAX_PEI_PERFORMANCE_LOG_ENTRIES) {
+ if (PeiPerformanceLog->NumberOfEntries >= PcdGet8 (PcdMaxPeiPerformanceLogEntries)) {
return RETURN_OUT_OF_RESOURCES;
}
Index = PeiPerformanceLog->NumberOfEntries++;
diff --git a/EdkModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.msa b/EdkModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.msa
index 834bd34780..90126acf91 100644
--- a/EdkModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.msa
+++ b/EdkModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.msa
@@ -77,5 +77,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
The bitmask of flags that specify the enable/disable of
Performance Measurement.
+
+ PcdMaxPeiPerformanceLogEntries
+ gEfiEdkModulePkgTokenSpaceGuid
+ Maximun number of performance log entries during PEI phase.
+
\ No newline at end of file