]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiPayloadPkg: Add performance measurement feature
authorLiu, Zhiguang <Zhiguang.Liu@intel.com>
Wed, 24 Nov 2021 09:15:09 +0000 (17:15 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 8 Dec 2021 04:08:21 +0000 (04:08 +0000)
Add a Macro to enable performance measurement feature.
For any platform that uses UniversalPayload, we assume it supports
BaseCpuTimerLib and use it to align timerlib to get more accurate
performance result.

Reviewed-by: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
UefiPayloadPkg/UefiPayloadPkg.dsc
UefiPayloadPkg/UefiPayloadPkg.fdf

index 0df5f827c9036f8a87649522d82574e3d0316861..a1ef711f24cfbb62186b9275fe99889360897098 100644 (file)
   DEFINE RTC_TARGET_REGISTER = 0x71\r
 \r
   DEFINE SERIAL_DRIVER_ENABLE = TRUE\r
+  DEFINE PERFORMANCE_MEASUREMENT_ENABLE  = FALSE\r
 \r
 [BuildOptions]\r
   *_*_*_CC_FLAGS                 = -D DISABLE_NEW_DEPRECATED_INTERFACES\r
   #\r
   # Platform\r
   #\r
+!if $(UNIVERSAL_PAYLOAD) == TRUE\r
+  TimerLib|UefiCpuPkg/Library/CpuTimerLib/BaseCpuTimerLib.inf\r
+!else\r
   TimerLib|UefiPayloadPkg/Library/AcpiTimerLib/AcpiTimerLib.inf\r
+!endif\r
   ResetSystemLib|UefiPayloadPkg/Library/ResetSystemLib/ResetSystemLib.inf\r
   SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf\r
   PlatformHookLib|UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf\r
   DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf\r
 !endif\r
   CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf\r
+!if $(PERFORMANCE_MEASUREMENT_ENABLE)\r
+  PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf\r
+!endif\r
 \r
 [LibraryClasses.common.DXE_DRIVER]\r
   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf\r
 !endif\r
   CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf\r
   MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf\r
+!if $(PERFORMANCE_MEASUREMENT_ENABLE)\r
+  PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf\r
+!endif\r
 \r
 [LibraryClasses.common.DXE_RUNTIME_DRIVER]\r
   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf\r
   MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf\r
   ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeReportStatusCodeLib.inf\r
   VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf\r
+!if $(PERFORMANCE_MEASUREMENT_ENABLE)\r
+  PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf\r
+!endif\r
 \r
 [LibraryClasses.common.UEFI_DRIVER,LibraryClasses.common.UEFI_APPLICATION]\r
   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf\r
   MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf\r
   ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf\r
+!if $(PERFORMANCE_MEASUREMENT_ENABLE)\r
+  PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf\r
+!endif\r
 \r
 [LibraryClasses.common.SMM_CORE]\r
 !if $(SMM_SUPPORT) == TRUE\r
   SmmCorePlatformHookLib|MdeModulePkg/Library/SmmCorePlatformHookLibNull/SmmCorePlatformHookLibNull.inf\r
   SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf\r
   ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf\r
+!if $(PERFORMANCE_MEASUREMENT_ENABLE)\r
+  PerformanceLib|MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.inf\r
+!endif\r
 !endif\r
 \r
 [LibraryClasses.common.DXE_SMM_DRIVER]\r
   SmmCpuFeaturesLib|UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf\r
   CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf\r
   ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf\r
+!if $(PERFORMANCE_MEASUREMENT_ENABLE)\r
+  PerformanceLib|MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.inf\r
+!endif\r
 !endif\r
 !if $(VARIABLE_SUPPORT) == "SPI"\r
   SpiFlashLib|UefiPayloadPkg/Library/SpiFlashLib/SpiFlashLib.inf\r
   gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2\r
 !endif\r
   gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmStackSize|0x4000\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdEdkiiFpdtStringRecordEnableOnly| TRUE\r
+!if $(PERFORMANCE_MEASUREMENT_ENABLE)\r
+  gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask       | 0x1\r
+!endif\r
 \r
 [PcdsPatchableInModule.X64]\r
   gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister|$(RTC_INDEX_REGISTER)\r
   MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf\r
 !endif\r
   UefiPayloadPkg/GraphicsOutputDxe/GraphicsOutputDxe.inf\r
-\r
+!if $(PERFORMANCE_MEASUREMENT_ENABLE)\r
+  MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf\r
+!endif\r
   #\r
   # SMM Support\r
   #\r
   UefiPayloadPkg/PchSmiDispatchSmm/PchSmiDispatchSmm.inf\r
   UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf\r
   UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf\r
+!if $(PERFORMANCE_MEASUREMENT_ENABLE)\r
+  MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.inf\r
+!endif\r
 !endif\r
 \r
 !if $(VARIABLE_SUPPORT) == "EMU"\r
index c9707dba980f179119b79d5ee2c1a0571961e1e5..f619a23139edd806f447f64b80d09e4f2f0d5f3e 100644 (file)
@@ -117,6 +117,9 @@ INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe
 INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf\r
 !endif\r
 INF PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf\r
+!if $(PERFORMANCE_MEASUREMENT_ENABLE)\r
+  INF MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf\r
+!endif\r
 \r
 #\r
 # SMM Support\r
@@ -130,6 +133,9 @@ INF PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
   INF UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf\r
   INF UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf\r
   INF UefiPayloadPkg/PchSmiDispatchSmm/PchSmiDispatchSmm.inf\r
+!if $(PERFORMANCE_MEASUREMENT_ENABLE)\r
+  INF  MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableSmm/FirmwarePerformanceSmm.inf\r
+!endif\r
 !endif\r
 \r
 !if $(VARIABLE_SUPPORT) == "EMU"\r