]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
MdeModulePkg: Increase the maximum number of PEI performance log entries
[mirror_edk2.git] / MdeModulePkg / Library / PeiPerformanceLib / PeiPerformanceLib.c
index 9674bbc6210f6d3dacd514925300430c050cf614..b3b11b95198430054ef716870767250effe937f2 100644 (file)
@@ -4,10 +4,11 @@
   This file implements all APIs in Performance Library class in MdePkg. It creates\r
   performance logging GUIDed HOB on the first performance logging and then logs the\r
   performance data to the GUIDed HOB. Due to the limitation of temporary RAM, the maximum\r
-  number of performance logging entry is specified by PcdMaxPeiPerformanceLogEntries.  \r
+  number of performance logging entry is specified by PcdMaxPeiPerformanceLogEntries or \r
+  PcdMaxPeiPerformanceLogEntries16.\r
 \r
 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
-(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
+(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -51,10 +52,14 @@ InternalGetPerformanceHobLog (
 {\r
   EFI_HOB_GUID_TYPE           *GuidHob;\r
   UINTN                       PeiPerformanceSize;\r
+  UINT16                      PeiPerformanceLogEntries;\r
 \r
   ASSERT (PeiPerformanceLog != NULL);\r
   ASSERT (PeiPerformanceIdArray != NULL);\r
 \r
+  PeiPerformanceLogEntries = (UINT16) (PcdGet16 (PcdMaxPeiPerformanceLogEntries16) != 0 ?\r
+                                       PcdGet16 (PcdMaxPeiPerformanceLogEntries16) :\r
+                                       PcdGet8 (PcdMaxPeiPerformanceLogEntries));\r
   GuidHob = GetFirstGuidHob (&gPerformanceProtocolGuid);\r
 \r
   if (GuidHob != NULL) {\r
@@ -71,11 +76,11 @@ InternalGetPerformanceHobLog (
     // PEI Performance HOB was not found, then build one.\r
     //\r
     PeiPerformanceSize     = sizeof (PEI_PERFORMANCE_LOG_HEADER) +\r
-                             sizeof (PEI_PERFORMANCE_LOG_ENTRY) * PcdGet8 (PcdMaxPeiPerformanceLogEntries);\r
+                             sizeof (PEI_PERFORMANCE_LOG_ENTRY) * PeiPerformanceLogEntries;\r
     *PeiPerformanceLog     = BuildGuidHob (&gPerformanceProtocolGuid, PeiPerformanceSize);\r
     *PeiPerformanceLog     = ZeroMem (*PeiPerformanceLog, PeiPerformanceSize);\r
 \r
-    PeiPerformanceSize     = sizeof (UINT32) * PcdGet8 (PcdMaxPeiPerformanceLogEntries);\r
+    PeiPerformanceSize     = sizeof (UINT32) * PeiPerformanceLogEntries;\r
     *PeiPerformanceIdArray = BuildGuidHob (&gPerformanceExProtocolGuid, PeiPerformanceSize);\r
     *PeiPerformanceIdArray = ZeroMem (*PeiPerformanceIdArray, PeiPerformanceSize);\r
   }\r
@@ -180,10 +185,15 @@ StartPerformanceMeasurementEx (
   UINT32                      *PeiPerformanceIdArray;\r
   PEI_PERFORMANCE_LOG_ENTRY   *LogEntryArray;\r
   UINT32                      Index;\r
+  UINT16                      PeiPerformanceLogEntries;\r
+\r
+  PeiPerformanceLogEntries = (UINT16) (PcdGet16 (PcdMaxPeiPerformanceLogEntries16) != 0 ?\r
+                                       PcdGet16 (PcdMaxPeiPerformanceLogEntries16) :\r
+                                       PcdGet8 (PcdMaxPeiPerformanceLogEntries));\r
 \r
   InternalGetPerformanceHobLog (&PeiPerformanceLog, &PeiPerformanceIdArray);\r
 \r
-  if (PeiPerformanceLog->NumberOfEntries >= PcdGet8 (PcdMaxPeiPerformanceLogEntries)) {\r
+  if (PeiPerformanceLog->NumberOfEntries >= PeiPerformanceLogEntries) {\r
     DEBUG ((DEBUG_ERROR, "PEI performance log array out of resources\n"));\r
     return RETURN_OUT_OF_RESOURCES;\r
   }\r