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
\r
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
+(C) Copyright 2015 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
\r
@param PeiPerformanceLog Pointer to the data structure containing PEI \r
performance data.\r
+ @param PeiPerformanceIdArray Pointer to PEI performance identifier array.\r
@param Handle Pointer to environment specific context used\r
to identify the component being measured.\r
@param Token Pointer to a Null-terminated ASCII string\r
)\r
{\r
UINT32 Index;\r
+ UINT32 Index2;\r
UINT32 NumberOfEntries;\r
PEI_PERFORMANCE_LOG_ENTRY *LogEntryArray;\r
\r
NumberOfEntries = PeiPerformanceLog->NumberOfEntries;\r
LogEntryArray = (PEI_PERFORMANCE_LOG_ENTRY *) (PeiPerformanceLog + 1);\r
\r
+ Index2 = 0;\r
+\r
for (Index = 0; Index < NumberOfEntries; Index++) {\r
- if ((LogEntryArray[Index].Handle == (EFI_PHYSICAL_ADDRESS) (UINTN) Handle) &&\r
- AsciiStrnCmp (LogEntryArray[Index].Token, Token, PEI_PERFORMANCE_STRING_LENGTH) == 0 &&\r
- AsciiStrnCmp (LogEntryArray[Index].Module, Module, PEI_PERFORMANCE_STRING_LENGTH) == 0 &&\r
- (PeiPerformanceIdArray[Index] == Identifier) &&\r
- LogEntryArray[Index].EndTimeStamp == 0\r
- ) {\r
+ Index2 = NumberOfEntries - 1 - Index;\r
+ 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
+ Index = Index2;\r
break;\r
}\r
}\r
InternalGetPerformanceHobLog (&PeiPerformanceLog, &PeiPerformanceIdArray);\r
\r
if (PeiPerformanceLog->NumberOfEntries >= PcdGet8 (PcdMaxPeiPerformanceLogEntries)) {\r
+ DEBUG ((DEBUG_ERROR, "PEI performance log array out of resources\n"));\r
return RETURN_OUT_OF_RESOURCES;\r
}\r
Index = PeiPerformanceLog->NumberOfEntries++;\r
LogEntryArray[Index].Handle = (EFI_PHYSICAL_ADDRESS) (UINTN) Handle;\r
\r
if (Token != NULL) {\r
- AsciiStrnCpy (LogEntryArray[Index].Token, Token, PEI_PERFORMANCE_STRING_LENGTH);\r
+ AsciiStrnCpyS (LogEntryArray[Index].Token, PEI_PERFORMANCE_STRING_SIZE, Token, PEI_PERFORMANCE_STRING_LENGTH);\r
}\r
if (Module != NULL) {\r
- AsciiStrnCpy (LogEntryArray[Index].Module, Module, PEI_PERFORMANCE_STRING_LENGTH);\r
+ AsciiStrnCpyS (LogEntryArray[Index].Module, PEI_PERFORMANCE_STRING_SIZE, Module, PEI_PERFORMANCE_STRING_LENGTH);\r
}\r
\r
LogEntryArray[Index].EndTimeStamp = 0;\r