public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH V2] UefiCpuPkg RegisterCpuFeaturesLib: Match data type and format specifier
@ 2020-02-04  7:02 Zeng, Star
  2020-02-04 11:52 ` Laszlo Ersek
  2020-02-05  2:43 ` [edk2-devel] " Dong, Eric
  0 siblings, 2 replies; 4+ messages in thread
From: Zeng, Star @ 2020-02-04  7:02 UTC (permalink / raw)
  To: devel; +Cc: Star Zeng, Eric Dong, Ray Ni, Laszlo Ersek

Match data type and format specifier for printing.
1. Type cast ProcessorNumber and FeatureIndex to UINT32
  as %d only expects a UINT32.
2. Use %08x instead of %08lx for CacheControl to print Index
  as it is UINT32 type.
3. Use %016lx instead of %08lx for MemoryMapped to print
  (Index | LShiftU64 (HighIndex, 32)) as it is UINT64 type.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
 .../CpuFeaturesInitialize.c                   | 24 +++++++++----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
index 0a4fcff033a3..fc96fb4372cf 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
@@ -430,8 +430,8 @@ DumpRegisterTableOnProcessor (
       DEBUG ((
         DebugPrintErrorLevel,
         "Processor: %04d: Index %04d, MSR  : %08x, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n",
-        ProcessorNumber,
-        FeatureIndex,
+        (UINT32) ProcessorNumber,
+        (UINT32) FeatureIndex,
         RegisterTableEntry->Index,
         RegisterTableEntry->ValidBitStart,
         RegisterTableEntry->ValidBitLength,
@@ -442,8 +442,8 @@ DumpRegisterTableOnProcessor (
       DEBUG ((
         DebugPrintErrorLevel,
         "Processor: %04d: Index %04d, CR   : %08x, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n",
-        ProcessorNumber,
-        FeatureIndex,
+        (UINT32) ProcessorNumber,
+        (UINT32) FeatureIndex,
         RegisterTableEntry->Index,
         RegisterTableEntry->ValidBitStart,
         RegisterTableEntry->ValidBitLength,
@@ -453,9 +453,9 @@ DumpRegisterTableOnProcessor (
     case MemoryMapped:
       DEBUG ((
         DebugPrintErrorLevel,
-        "Processor: %04d: Index %04d, MMIO : %08lx, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n",
-        ProcessorNumber,
-        FeatureIndex,
+        "Processor: %04d: Index %04d, MMIO : %016lx, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n",
+        (UINT32) ProcessorNumber,
+        (UINT32) FeatureIndex,
         RegisterTableEntry->Index | LShiftU64 (RegisterTableEntry->HighIndex, 32),
         RegisterTableEntry->ValidBitStart,
         RegisterTableEntry->ValidBitLength,
@@ -465,9 +465,9 @@ DumpRegisterTableOnProcessor (
     case CacheControl:
       DEBUG ((
         DebugPrintErrorLevel,
-        "Processor: %04d: Index %04d, CACHE: %08lx, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n",
-        ProcessorNumber,
-        FeatureIndex,
+        "Processor: %04d: Index %04d, CACHE: %08x, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n",
+        (UINT32) ProcessorNumber,
+        (UINT32) FeatureIndex,
         RegisterTableEntry->Index,
         RegisterTableEntry->ValidBitStart,
         RegisterTableEntry->ValidBitLength,
@@ -478,8 +478,8 @@ DumpRegisterTableOnProcessor (
       DEBUG ((
         DebugPrintErrorLevel,
         "Processor: %04d: Index %04d, SEMAP: %s\r\n",
-        ProcessorNumber,
-        FeatureIndex,
+        (UINT32) ProcessorNumber,
+        (UINT32) FeatureIndex,
         mDependTypeStr[MIN ((UINT32)RegisterTableEntry->Value, InvalidDepType)]
         ));
       break;
-- 
2.21.0.windows.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH V2] UefiCpuPkg RegisterCpuFeaturesLib: Match data type and format specifier
  2020-02-04  7:02 [PATCH V2] UefiCpuPkg RegisterCpuFeaturesLib: Match data type and format specifier Zeng, Star
@ 2020-02-04 11:52 ` Laszlo Ersek
  2020-02-05  2:43 ` [edk2-devel] " Dong, Eric
  1 sibling, 0 replies; 4+ messages in thread
From: Laszlo Ersek @ 2020-02-04 11:52 UTC (permalink / raw)
  To: Star Zeng, devel; +Cc: Eric Dong, Ray Ni

On 02/04/20 08:02, Star Zeng wrote:
> Match data type and format specifier for printing.
> 1. Type cast ProcessorNumber and FeatureIndex to UINT32
>   as %d only expects a UINT32.
> 2. Use %08x instead of %08lx for CacheControl to print Index
>   as it is UINT32 type.
> 3. Use %016lx instead of %08lx for MemoryMapped to print
>   (Index | LShiftU64 (HighIndex, 32)) as it is UINT64 type.
> 
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
>  .../CpuFeaturesInitialize.c                   | 24 +++++++++----------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> index 0a4fcff033a3..fc96fb4372cf 100644
> --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> @@ -430,8 +430,8 @@ DumpRegisterTableOnProcessor (
>        DEBUG ((
>          DebugPrintErrorLevel,
>          "Processor: %04d: Index %04d, MSR  : %08x, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n",
> -        ProcessorNumber,
> -        FeatureIndex,
> +        (UINT32) ProcessorNumber,
> +        (UINT32) FeatureIndex,
>          RegisterTableEntry->Index,
>          RegisterTableEntry->ValidBitStart,
>          RegisterTableEntry->ValidBitLength,
> @@ -442,8 +442,8 @@ DumpRegisterTableOnProcessor (
>        DEBUG ((
>          DebugPrintErrorLevel,
>          "Processor: %04d: Index %04d, CR   : %08x, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n",
> -        ProcessorNumber,
> -        FeatureIndex,
> +        (UINT32) ProcessorNumber,
> +        (UINT32) FeatureIndex,
>          RegisterTableEntry->Index,
>          RegisterTableEntry->ValidBitStart,
>          RegisterTableEntry->ValidBitLength,
> @@ -453,9 +453,9 @@ DumpRegisterTableOnProcessor (
>      case MemoryMapped:
>        DEBUG ((
>          DebugPrintErrorLevel,
> -        "Processor: %04d: Index %04d, MMIO : %08lx, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n",
> -        ProcessorNumber,
> -        FeatureIndex,
> +        "Processor: %04d: Index %04d, MMIO : %016lx, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n",
> +        (UINT32) ProcessorNumber,
> +        (UINT32) FeatureIndex,
>          RegisterTableEntry->Index | LShiftU64 (RegisterTableEntry->HighIndex, 32),
>          RegisterTableEntry->ValidBitStart,
>          RegisterTableEntry->ValidBitLength,
> @@ -465,9 +465,9 @@ DumpRegisterTableOnProcessor (
>      case CacheControl:
>        DEBUG ((
>          DebugPrintErrorLevel,
> -        "Processor: %04d: Index %04d, CACHE: %08lx, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n",
> -        ProcessorNumber,
> -        FeatureIndex,
> +        "Processor: %04d: Index %04d, CACHE: %08x, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n",
> +        (UINT32) ProcessorNumber,
> +        (UINT32) FeatureIndex,
>          RegisterTableEntry->Index,
>          RegisterTableEntry->ValidBitStart,
>          RegisterTableEntry->ValidBitLength,
> @@ -478,8 +478,8 @@ DumpRegisterTableOnProcessor (
>        DEBUG ((
>          DebugPrintErrorLevel,
>          "Processor: %04d: Index %04d, SEMAP: %s\r\n",
> -        ProcessorNumber,
> -        FeatureIndex,
> +        (UINT32) ProcessorNumber,
> +        (UINT32) FeatureIndex,
>          mDependTypeStr[MIN ((UINT32)RegisterTableEntry->Value, InvalidDepType)]
>          ));
>        break;
> 

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

Thanks!
Laszlo


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] [PATCH V2] UefiCpuPkg RegisterCpuFeaturesLib: Match data type and format specifier
  2020-02-04  7:02 [PATCH V2] UefiCpuPkg RegisterCpuFeaturesLib: Match data type and format specifier Zeng, Star
  2020-02-04 11:52 ` Laszlo Ersek
@ 2020-02-05  2:43 ` Dong, Eric
  2020-02-18  1:26   ` Zeng, Star
  1 sibling, 1 reply; 4+ messages in thread
From: Dong, Eric @ 2020-02-05  2:43 UTC (permalink / raw)
  To: devel@edk2.groups.io, Zeng, Star; +Cc: Ni, Ray, Laszlo Ersek

Reviewed-by: Eric Dong <eric.dong@intel.com>

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Zeng, Star
Sent: Tuesday, February 4, 2020 3:02 PM
To: devel@edk2.groups.io
Cc: Zeng, Star <star.zeng@intel.com>; Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>
Subject: [edk2-devel] [PATCH V2] UefiCpuPkg RegisterCpuFeaturesLib: Match data type and format specifier

Match data type and format specifier for printing.
1. Type cast ProcessorNumber and FeatureIndex to UINT32
  as %d only expects a UINT32.
2. Use %08x instead of %08lx for CacheControl to print Index
  as it is UINT32 type.
3. Use %016lx instead of %08lx for MemoryMapped to print
  (Index | LShiftU64 (HighIndex, 32)) as it is UINT64 type.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
 .../CpuFeaturesInitialize.c                   | 24 +++++++++----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
index 0a4fcff033a3..fc96fb4372cf 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
@@ -430,8 +430,8 @@ DumpRegisterTableOnProcessor (
       DEBUG ((
         DebugPrintErrorLevel,
         "Processor: %04d: Index %04d, MSR  : %08x, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n",
-        ProcessorNumber,
-        FeatureIndex,
+        (UINT32) ProcessorNumber,
+        (UINT32) FeatureIndex,
         RegisterTableEntry->Index,
         RegisterTableEntry->ValidBitStart,
         RegisterTableEntry->ValidBitLength,
@@ -442,8 +442,8 @@ DumpRegisterTableOnProcessor (
       DEBUG ((
         DebugPrintErrorLevel,
         "Processor: %04d: Index %04d, CR   : %08x, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n",
-        ProcessorNumber,
-        FeatureIndex,
+        (UINT32) ProcessorNumber,
+        (UINT32) FeatureIndex,
         RegisterTableEntry->Index,
         RegisterTableEntry->ValidBitStart,
         RegisterTableEntry->ValidBitLength,
@@ -453,9 +453,9 @@ DumpRegisterTableOnProcessor (
     case MemoryMapped:
       DEBUG ((
         DebugPrintErrorLevel,
-        "Processor: %04d: Index %04d, MMIO : %08lx, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n",
-        ProcessorNumber,
-        FeatureIndex,
+        "Processor: %04d: Index %04d, MMIO : %016lx, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n",
+        (UINT32) ProcessorNumber,
+        (UINT32) FeatureIndex,
         RegisterTableEntry->Index | LShiftU64 (RegisterTableEntry->HighIndex, 32),
         RegisterTableEntry->ValidBitStart,
         RegisterTableEntry->ValidBitLength,
@@ -465,9 +465,9 @@ DumpRegisterTableOnProcessor (
     case CacheControl:
       DEBUG ((
         DebugPrintErrorLevel,
-        "Processor: %04d: Index %04d, CACHE: %08lx, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n",
-        ProcessorNumber,
-        FeatureIndex,
+        "Processor: %04d: Index %04d, CACHE: %08x, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n",
+        (UINT32) ProcessorNumber,
+        (UINT32) FeatureIndex,
         RegisterTableEntry->Index,
         RegisterTableEntry->ValidBitStart,
         RegisterTableEntry->ValidBitLength,
@@ -478,8 +478,8 @@ DumpRegisterTableOnProcessor (
       DEBUG ((
         DebugPrintErrorLevel,
         "Processor: %04d: Index %04d, SEMAP: %s\r\n",
-        ProcessorNumber,
-        FeatureIndex,
+        (UINT32) ProcessorNumber,
+        (UINT32) FeatureIndex,
         mDependTypeStr[MIN ((UINT32)RegisterTableEntry->Value, InvalidDepType)]
         ));
       break;
-- 
2.21.0.windows.1





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] [PATCH V2] UefiCpuPkg RegisterCpuFeaturesLib: Match data type and format specifier
  2020-02-05  2:43 ` [edk2-devel] " Dong, Eric
@ 2020-02-18  1:26   ` Zeng, Star
  0 siblings, 0 replies; 4+ messages in thread
From: Zeng, Star @ 2020-02-18  1:26 UTC (permalink / raw)
  To: Gao, Liming, Dong, Eric, devel@edk2.groups.io
  Cc: Ni, Ray, Laszlo Ersek, Zeng, Star

Hi Liming,

This is a minor change and has been reviewed by Laszlo and Eric.
It will be better if it can be caught by 202002 stable tag.
You or Eric may help submit it.


Thanks,
Star
> -----Original Message-----
> From: Dong, Eric <eric.dong@intel.com>
> Sent: Wednesday, February 5, 2020 10:43 AM
> To: devel@edk2.groups.io; Zeng, Star <star.zeng@intel.com>
> Cc: Ni, Ray <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>
> Subject: RE: [edk2-devel] [PATCH V2] UefiCpuPkg RegisterCpuFeaturesLib:
> Match data type and format specifier
> 
> Reviewed-by: Eric Dong <eric.dong@intel.com>
> 
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Zeng,
> Star
> Sent: Tuesday, February 4, 2020 3:02 PM
> To: devel@edk2.groups.io
> Cc: Zeng, Star <star.zeng@intel.com>; Dong, Eric <eric.dong@intel.com>; Ni,
> Ray <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>
> Subject: [edk2-devel] [PATCH V2] UefiCpuPkg RegisterCpuFeaturesLib:
> Match data type and format specifier
> 
> Match data type and format specifier for printing.
> 1. Type cast ProcessorNumber and FeatureIndex to UINT32
>   as %d only expects a UINT32.
> 2. Use %08x instead of %08lx for CacheControl to print Index
>   as it is UINT32 type.
> 3. Use %016lx instead of %08lx for MemoryMapped to print
>   (Index | LShiftU64 (HighIndex, 32)) as it is UINT64 type.
> 
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
>  .../CpuFeaturesInitialize.c                   | 24 +++++++++----------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git
> a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> index 0a4fcff033a3..fc96fb4372cf 100644
> --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> @@ -430,8 +430,8 @@ DumpRegisterTableOnProcessor (
>        DEBUG ((
>          DebugPrintErrorLevel,
>          "Processor: %04d: Index %04d, MSR  : %08x, Bit Start: %02d, Bit
> Length: %02d, Value: %016lx\r\n",
> -        ProcessorNumber,
> -        FeatureIndex,
> +        (UINT32) ProcessorNumber,
> +        (UINT32) FeatureIndex,
>          RegisterTableEntry->Index,
>          RegisterTableEntry->ValidBitStart,
>          RegisterTableEntry->ValidBitLength,
> @@ -442,8 +442,8 @@ DumpRegisterTableOnProcessor (
>        DEBUG ((
>          DebugPrintErrorLevel,
>          "Processor: %04d: Index %04d, CR   : %08x, Bit Start: %02d, Bit
> Length: %02d, Value: %016lx\r\n",
> -        ProcessorNumber,
> -        FeatureIndex,
> +        (UINT32) ProcessorNumber,
> +        (UINT32) FeatureIndex,
>          RegisterTableEntry->Index,
>          RegisterTableEntry->ValidBitStart,
>          RegisterTableEntry->ValidBitLength,
> @@ -453,9 +453,9 @@ DumpRegisterTableOnProcessor (
>      case MemoryMapped:
>        DEBUG ((
>          DebugPrintErrorLevel,
> -        "Processor: %04d: Index %04d, MMIO : %08lx, Bit Start: %02d, Bit
> Length: %02d, Value: %016lx\r\n",
> -        ProcessorNumber,
> -        FeatureIndex,
> +        "Processor: %04d: Index %04d, MMIO : %016lx, Bit Start: %02d,
> Bit Length: %02d, Value: %016lx\r\n",
> +        (UINT32) ProcessorNumber,
> +        (UINT32) FeatureIndex,
>          RegisterTableEntry->Index | LShiftU64
> (RegisterTableEntry->HighIndex, 32),
>          RegisterTableEntry->ValidBitStart,
>          RegisterTableEntry->ValidBitLength,
> @@ -465,9 +465,9 @@ DumpRegisterTableOnProcessor (
>      case CacheControl:
>        DEBUG ((
>          DebugPrintErrorLevel,
> -        "Processor: %04d: Index %04d, CACHE: %08lx, Bit Start: %02d, Bit
> Length: %02d, Value: %016lx\r\n",
> -        ProcessorNumber,
> -        FeatureIndex,
> +        "Processor: %04d: Index %04d, CACHE: %08x, Bit Start: %02d, Bit
> Length: %02d, Value: %016lx\r\n",
> +        (UINT32) ProcessorNumber,
> +        (UINT32) FeatureIndex,
>          RegisterTableEntry->Index,
>          RegisterTableEntry->ValidBitStart,
>          RegisterTableEntry->ValidBitLength,
> @@ -478,8 +478,8 @@ DumpRegisterTableOnProcessor (
>        DEBUG ((
>          DebugPrintErrorLevel,
>          "Processor: %04d: Index %04d, SEMAP: %s\r\n",
> -        ProcessorNumber,
> -        FeatureIndex,
> +        (UINT32) ProcessorNumber,
> +        (UINT32) FeatureIndex,
>          mDependTypeStr[MIN ((UINT32)RegisterTableEntry->Value,
> InvalidDepType)]
>          ));
>        break;
> --
> 2.21.0.windows.1
> 
> 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-18  1:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-04  7:02 [PATCH V2] UefiCpuPkg RegisterCpuFeaturesLib: Match data type and format specifier Zeng, Star
2020-02-04 11:52 ` Laszlo Ersek
2020-02-05  2:43 ` [edk2-devel] " Dong, Eric
2020-02-18  1:26   ` Zeng, Star

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox