]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
MdeModulePkg: Update PerformanceLib instances not to check Identifier.
[mirror_edk2.git] / MdeModulePkg / Library / PeiPerformanceLib / PeiPerformanceLib.c
index 0b5a717caa01890f8e64aea12675f24894fefa21..62527b2c34d1c598beb1d992ed510542a1f623a3 100644 (file)
@@ -4,9 +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
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<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
@@ -50,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
@@ -70,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
@@ -134,8 +140,7 @@ InternalSearchForLogEntry (
     if (LogEntryArray[Index2].EndTimeStamp == 0 &&\r
         (LogEntryArray[Index2].Handle == (EFI_PHYSICAL_ADDRESS) (UINTN) Handle) &&\r
         AsciiStrnCmp (LogEntryArray[Index2].Token, Token, PEI_PERFORMANCE_STRING_LENGTH) == 0 &&\r
-        AsciiStrnCmp (LogEntryArray[Index2].Module, Module, PEI_PERFORMANCE_STRING_LENGTH) == 0 &&\r
-        (PeiPerformanceIdArray[Index2] == Identifier)) {\r
+        AsciiStrnCmp (LogEntryArray[Index2].Module, Module, PEI_PERFORMANCE_STRING_LENGTH) == 0) {\r
       Index = Index2;\r
       break;\r
     }\r
@@ -179,10 +184,16 @@ 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
   Index                       = PeiPerformanceLog->NumberOfEntries++;\r
@@ -210,7 +221,7 @@ StartPerformanceMeasurementEx (
 /**\r
   Fills in the end time of a performance measurement.\r
 \r
-  Looks up the record that matches Handle, Token, Module and Identifier.\r
+  Looks up the record that matches Handle, Token and Module.\r
   If the record can not be found then return RETURN_NOT_FOUND.\r
   If the record is found and TimeStamp is not zero,\r
   then TimeStamp is added to the record as the end time.\r