[edk2-devel] [PATCH] UefiPayloadPkg: Use BaseCpuTimerLib for Universal Payload by default

Zhiguang Liu posted 1 patch 2 years, 3 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/edk2 tags/patchew/20220119091646.130-1-zhiguang.liu@intel.com
UefiPayloadPkg/UefiPayloadPkg.dsc | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
[edk2-devel] [PATCH] UefiPayloadPkg: Use BaseCpuTimerLib for Universal Payload by default
Posted by Zhiguang Liu 2 years, 3 months ago
Current, a macro CPU_TIMER_LIB_ENABLE is added to determine which timerlib
is used. BaseCpuTimerLib.inf is a better way and only fit for recent CPU.
Meanwhile, Universal Payload are only aimed to work with recent CPU.
Therefore, for Universal Payload, use the BaseCpuTimerLib by default

Cc: 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 | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 65c1bd610e..1ce96a51c1 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -111,10 +111,10 @@
   DEFINE SERIAL_DRIVER_ENABLE = TRUE
   DEFINE PERFORMANCE_MEASUREMENT_ENABLE  = FALSE
 
-  # For recent X86 CPU, 0x15 CPUID instruction will return Time Stamp Counter.
-  # This is recommended way to get the time, and also how BaseCpuTimerLib works.
-  # However, some CPU doesn't support this feature, so disable it by default.
-  DEFINE CPU_TIMER_LIB_ENABLE  = FALSE
+  # For recent X86 CPU, 0x15 CPUID instruction will return Time Stamp Counter Frequence.
+  # This is how BaseCpuTimerLib works, and a recommended way to get Frequence, so set the default value as TRUE.
+  # Note: for emulation platform such as QEMU, this may not work and should set it as FALSE
+  DEFINE CPU_TIMER_LIB_ENABLE  = TRUE
 
 [BuildOptions]
   *_*_*_CC_FLAGS                 = -D DISABLE_NEW_DEPRECATED_INTERFACES
@@ -222,7 +222,7 @@
   #
   # Platform
   #
-!if $(CPU_TIMER_LIB_ENABLE) == TRUE
+!if $(CPU_TIMER_LIB_ENABLE) == TRUE && $(UNIVERSAL_PAYLOAD) == TRUE
   TimerLib|UefiCpuPkg/Library/CpuTimerLib/BaseCpuTimerLib.inf
 !else
   TimerLib|UefiPayloadPkg/Library/AcpiTimerLib/AcpiTimerLib.inf
-- 
2.32.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#85809): https://edk2.groups.io/g/devel/message/85809
Mute This Topic: https://groups.io/mt/88530668/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH] UefiPayloadPkg: Use BaseCpuTimerLib for Universal Payload by default
Posted by Ni, Ray 2 years, 2 months ago
Reviewed-by: Ray Ni <ray.ni@intel.com>

-----Original Message-----
From: Liu, Zhiguang <zhiguang.liu@intel.com> 
Sent: Wednesday, January 19, 2022 5:17 PM
To: devel@edk2.groups.io
Cc: Dong, Guo <guo.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Ma, Maurice <maurice.ma@intel.com>; You, Benjamin <benjamin.you@intel.com>
Subject: [PATCH] UefiPayloadPkg: Use BaseCpuTimerLib for Universal Payload by default

Current, a macro CPU_TIMER_LIB_ENABLE is added to determine which timerlib
is used. BaseCpuTimerLib.inf is a better way and only fit for recent CPU.
Meanwhile, Universal Payload are only aimed to work with recent CPU.
Therefore, for Universal Payload, use the BaseCpuTimerLib by default

Cc: 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 | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 65c1bd610e..1ce96a51c1 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -111,10 +111,10 @@
   DEFINE SERIAL_DRIVER_ENABLE = TRUE

   DEFINE PERFORMANCE_MEASUREMENT_ENABLE  = FALSE

 

-  # For recent X86 CPU, 0x15 CPUID instruction will return Time Stamp Counter.

-  # This is recommended way to get the time, and also how BaseCpuTimerLib works.

-  # However, some CPU doesn't support this feature, so disable it by default.

-  DEFINE CPU_TIMER_LIB_ENABLE  = FALSE

+  # For recent X86 CPU, 0x15 CPUID instruction will return Time Stamp Counter Frequence.

+  # This is how BaseCpuTimerLib works, and a recommended way to get Frequence, so set the default value as TRUE.

+  # Note: for emulation platform such as QEMU, this may not work and should set it as FALSE

+  DEFINE CPU_TIMER_LIB_ENABLE  = TRUE

 

 [BuildOptions]

   *_*_*_CC_FLAGS                 = -D DISABLE_NEW_DEPRECATED_INTERFACES

@@ -222,7 +222,7 @@
   #

   # Platform

   #

-!if $(CPU_TIMER_LIB_ENABLE) == TRUE

+!if $(CPU_TIMER_LIB_ENABLE) == TRUE && $(UNIVERSAL_PAYLOAD) == TRUE

   TimerLib|UefiCpuPkg/Library/CpuTimerLib/BaseCpuTimerLib.inf

 !else

   TimerLib|UefiPayloadPkg/Library/AcpiTimerLib/AcpiTimerLib.inf

-- 
2.32.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#86037): https://edk2.groups.io/g/devel/message/86037
Mute This Topic: https://groups.io/mt/88530668/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-