Reviewed-by: Samer EL-Haj-Mahmoud <el...@hpe.com>
-----Original Message----- From: Shia, Cinnamon Sent: Monday, March 7, 2016 1:57 AM To: edk2-devel@lists.01.org Cc: El-Haj-Mahmoud, Samer <samer.el-haj-mahm...@hpe.com>; Shia, Cinnamon <cinnamon.s...@hpe.com> Subject: [PATCH v2] MdeModulePkg: Change the type of PcdMaxPeiPerformanceLogEntries to UINT16 Change the type of PcdMaxPeiPerformanceLogEntries from UINT8 to UINT16 to log more than 255 performance entries in PEI. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Cinnamon Shia <cinnamon.s...@hpe.com> --- .../DxeCorePerformanceLib/DxeCorePerformanceLib.c | 5 ++++- .../DxeCorePerformanceLib/DxeCorePerformanceLib.inf | 2 ++ .../Library/PeiPerformanceLib/PeiPerformanceLib.c | 20 +++++++++++++++----- .../Library/PeiPerformanceLib/PeiPerformanceLib.inf | 2 ++ MdeModulePkg/MdeModulePkg.dec | 9 +++++++++ 5 files changed, 32 insertions(+), 6 deletions(-) diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c index 0eb8e57..bbad2e9 100644 --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c @@ -11,6 +11,7 @@ Performance Protocol is installed at the very beginning of DXE phase. Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR> +(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -522,7 +523,9 @@ DxeCorePerformanceLibConstructor ( ); ASSERT_EFI_ERROR (Status); - mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + PcdGet8 (PcdMaxPeiPerformanceLogEntries); + mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + (UINT16) (PcdGet8 (PcdMaxPeiPerformanceLogEntries) != 0 ? + PcdGet8 (PcdMaxPeiPerformanceLogEntries) != 0 : + PcdGet16 + (PcdMaxPeiPerformanceLogEntriesMoreThan255)); mGaugeData = AllocateZeroPool (sizeof (GAUGE_DATA_HEADER) + (sizeof (GAUGE_DATA_ENTRY_EX) * mMaxGaugeRecords)); ASSERT (mGaugeData != NULL); diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf index 5f29063..8cecdd2 100644 --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.i +++ nf @@ -10,6 +10,7 @@ # Performance and PerformanceEx Protocol are installed at the very beginning of DXE phase. # # Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR> +# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR> # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -67,4 +68,5 @@ [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries ## CONSUMES + + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntriesMoreThan2 + 55 ## CONSUMES gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask ## CONSUMES diff --git a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c index 9674bbc..0f90ca8 100644 --- a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c +++ b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c @@ -4,10 +4,11 @@ This file implements all APIs in Performance Library class in MdePkg. It creates performance logging GUIDed HOB on the first performance logging and then logs the performance data to the GUIDed HOB. Due to the limitation of temporary RAM, the maximum - number of performance logging entry is specified by PcdMaxPeiPerformanceLogEntries. + number of performance logging entry is specified by + PcdMaxPeiPerformanceLogEntries or + PcdMaxPeiPerformanceLogEntriesMoreThan255 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR> -(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR> +(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -51,10 +52,14 @@ InternalGetPerformanceHobLog ( { EFI_HOB_GUID_TYPE *GuidHob; UINTN PeiPerformanceSize; + UINT16 PeiPerformanceLogEntries; ASSERT (PeiPerformanceLog != NULL); ASSERT (PeiPerformanceIdArray != NULL); + PeiPerformanceLogEntries = (UINT16) (PcdGet8 (PcdMaxPeiPerformanceLogEntries) != 0 ? + PcdGet8 (PcdMaxPeiPerformanceLogEntries) : + PcdGet16 + (PcdMaxPeiPerformanceLogEntriesMoreThan255)); GuidHob = GetFirstGuidHob (&gPerformanceProtocolGuid); if (GuidHob != NULL) { @@ -71,11 +76,11 @@ InternalGetPerformanceHobLog ( // PEI Performance HOB was not found, then build one. // PeiPerformanceSize = sizeof (PEI_PERFORMANCE_LOG_HEADER) + - sizeof (PEI_PERFORMANCE_LOG_ENTRY) * PcdGet8 (PcdMaxPeiPerformanceLogEntries); + sizeof (PEI_PERFORMANCE_LOG_ENTRY) * + PeiPerformanceLogEntries; *PeiPerformanceLog = BuildGuidHob (&gPerformanceProtocolGuid, PeiPerformanceSize); *PeiPerformanceLog = ZeroMem (*PeiPerformanceLog, PeiPerformanceSize); - PeiPerformanceSize = sizeof (UINT32) * PcdGet8 (PcdMaxPeiPerformanceLogEntries); + PeiPerformanceSize = sizeof (UINT32) * PeiPerformanceLogEntries; *PeiPerformanceIdArray = BuildGuidHob (&gPerformanceExProtocolGuid, PeiPerformanceSize); *PeiPerformanceIdArray = ZeroMem (*PeiPerformanceIdArray, PeiPerformanceSize); } @@ -180,10 +185,15 @@ StartPerformanceMeasurementEx ( UINT32 *PeiPerformanceIdArray; PEI_PERFORMANCE_LOG_ENTRY *LogEntryArray; UINT32 Index; + UINT16 PeiPerformanceLogEntries; + + PeiPerformanceLogEntries = (UINT16) (PcdGet8 (PcdMaxPeiPerformanceLogEntries) != 0 ? + PcdGet8 (PcdMaxPeiPerformanceLogEntries) : + PcdGet16 + (PcdMaxPeiPerformanceLogEntriesMoreThan255)); InternalGetPerformanceHobLog (&PeiPerformanceLog, &PeiPerformanceIdArray); - if (PeiPerformanceLog->NumberOfEntries >= PcdGet8 (PcdMaxPeiPerformanceLogEntries)) { + if (PeiPerformanceLog->NumberOfEntries >= PeiPerformanceLogEntries) { DEBUG ((DEBUG_ERROR, "PEI performance log array out of resources\n")); return RETURN_OUT_OF_RESOURCES; } diff --git a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf index 7a5d240..b8fc318 100644 --- a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf +++ b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf @@ -6,6 +6,7 @@ # so that it can be taken over by DxeCorePerformanceLib. # # Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR> +# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR> # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -59,4 +60,5 @@ [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries ## CONSUMES + + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntriesMoreThan2 + 55 ## CONSUMES gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask ## CONSUMES diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index efd870b..4f74364 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -5,6 +5,7 @@ # # Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR> +# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR> # This program and the accompanying materials are licensed and made available under # the terms and conditions of the BSD License that accompanies this distribution. # The full text of the license may be found at @@ -869,9 +870,17 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleCoalesceFile|{ 0xA6, 0xE4, 0xFD, 0xF7, 0x4C, 0x29, 0x3c, 0x49, 0xB5, 0x0F, 0x97, 0x34, 0x55, 0x3B, 0xB7, 0x57 }|VOID*|0x30000017 ## Maximum number of performance log entries during PEI phase. + # If the number of performance log entries during PEI phase is more + than 255, set PcdMaxPeiPerformanceLogEntries # to 0 and use + PcdMaxPeiPerformanceLogEntriesMoreThan255 # @Prompt Maximum number of PEI performance log entries. gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries|40|UINT8|0x0001002f + ## Maximum number of performance log entries during PEI phase. + # If the number of performance log entries during PEI phase is more + than 255, set PcdMaxPeiPerformanceLogEntries # to 0 and use + PcdMaxPeiPerformanceLogEntriesMoreThan255 + # @Prompt Maximum number of PEI performance log entries. + + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntriesMoreThan2 + 55|256|UINT16|0x00010035 + ## RTC Update Timeout Value(microsecond). # @Prompt RTC Update Timeout Value. gEfiMdeModulePkgTokenSpaceGuid.PcdRealTimeClockUpdateTimeout|100000|UINT32|0x00010034 -- 2.7.0.windows.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel