[edk2-devel] [PATCH v2] UefiCpuPkg: Calculate DisplayFamily correctly

Zhiguang Liu posted 1 patch 1 year ago
Failed in applying to current master (apply log)
UefiCpuPkg/Application/Cpuid/Cpuid.c                        | 6 +++---
.../Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c  | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
[edk2-devel] [PATCH v2] UefiCpuPkg: Calculate DisplayFamily correctly
Posted by Zhiguang Liu 1 year ago
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4348

Per SDM:
DisplayFamily = Extended_Family_ID + Family_ID.
DisplayModelID = (Extended_Model_ID << 4) + Family_ID.
Correct the related code.

Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Cc: Mike Maslenkin <mike.maslenkin@gmail.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
---
 UefiCpuPkg/Application/Cpuid/Cpuid.c                        | 6 +++---
 .../Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c  | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/UefiCpuPkg/Application/Cpuid/Cpuid.c b/UefiCpuPkg/Application/Cpuid/Cpuid.c
index 372c6ef87d..172476a275 100644
--- a/UefiCpuPkg/Application/Cpuid/Cpuid.c
+++ b/UefiCpuPkg/Application/Cpuid/Cpuid.c
@@ -1,7 +1,7 @@
 /** @file
   UEFI Application to display CPUID leaf information.
 
-  Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2016 - 2023, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -217,12 +217,12 @@ CpuidVersionInfo (
 
   DisplayFamily = Eax.Bits.FamilyId;
   if (Eax.Bits.FamilyId == 0x0F) {
-    DisplayFamily |= (Eax.Bits.ExtendedFamilyId << 4);
+    DisplayFamily += Eax.Bits.ExtendedFamilyId;
   }
 
   DisplayModel = Eax.Bits.Model;
   if ((Eax.Bits.FamilyId == 0x06) || (Eax.Bits.FamilyId == 0x0f)) {
-    DisplayModel |= (Eax.Bits.ExtendedModelId << 4);
+    DisplayModel += (Eax.Bits.ExtendedModelId << 4);
   }
 
   Print (L"  Family = %x  Model = %x  Stepping = %x\n", DisplayFamily, DisplayModel, Eax.Bits.SteppingId);
diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
index a8e4f920fc..552fdab417 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
@@ -1,7 +1,7 @@
 /** @file
   CPU Features Initialize functions.
 
-  Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -67,12 +67,12 @@ FillProcessorInfo (
 
   DisplayedFamily = Eax.Bits.FamilyId;
   if (Eax.Bits.FamilyId == 0x0F) {
-    DisplayedFamily |= (Eax.Bits.ExtendedFamilyId << 4);
+    DisplayedFamily += Eax.Bits.ExtendedFamilyId;
   }
 
   DisplayedModel = Eax.Bits.Model;
   if ((Eax.Bits.FamilyId == 0x06) || (Eax.Bits.FamilyId == 0x0f)) {
-    DisplayedModel |= (Eax.Bits.ExtendedModelId << 4);
+    DisplayedModel += (Eax.Bits.ExtendedModelId << 4);
   }
 
   CpuInfo->DisplayFamily              = DisplayedFamily;
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#100778): https://edk2.groups.io/g/devel/message/100778
Mute This Topic: https://groups.io/mt/97444543/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH v2] UefiCpuPkg: Calculate DisplayFamily correctly
Posted by Zeng, Star 1 year ago
Reviewed-by: Star Zeng <star.zeng@intel.com>

-----Original Message-----
From: Liu, Zhiguang <zhiguang.liu@intel.com> 
Sent: Tuesday, March 7, 2023 2:32 PM
To: devel@edk2.groups.io
Cc: Liu, Zhiguang <zhiguang.liu@intel.com>; Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>; Gerd Hoffmann <kraxel@redhat.com>; Zeng, Star <star.zeng@intel.com>; Mike Maslenkin <mike.maslenkin@gmail.com>
Subject: [PATCH v2] UefiCpuPkg: Calculate DisplayFamily correctly

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4348

Per SDM:
DisplayFamily = Extended_Family_ID + Family_ID.
DisplayModelID = (Extended_Model_ID << 4) + Family_ID.
Correct the related code.

Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Cc: Mike Maslenkin <mike.maslenkin@gmail.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
---
 UefiCpuPkg/Application/Cpuid/Cpuid.c                        | 6 +++---
 .../Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c  | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/UefiCpuPkg/Application/Cpuid/Cpuid.c b/UefiCpuPkg/Application/Cpuid/Cpuid.c
index 372c6ef87d..172476a275 100644
--- a/UefiCpuPkg/Application/Cpuid/Cpuid.c
+++ b/UefiCpuPkg/Application/Cpuid/Cpuid.c
@@ -1,7 +1,7 @@
 /** @file
   UEFI Application to display CPUID leaf information.
 
-  Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2016 - 2023, Intel Corporation. All rights 
+ reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -217,12 +217,12 @@ CpuidVersionInfo (
 
   DisplayFamily = Eax.Bits.FamilyId;
   if (Eax.Bits.FamilyId == 0x0F) {
-    DisplayFamily |= (Eax.Bits.ExtendedFamilyId << 4);
+    DisplayFamily += Eax.Bits.ExtendedFamilyId;
   }
 
   DisplayModel = Eax.Bits.Model;
   if ((Eax.Bits.FamilyId == 0x06) || (Eax.Bits.FamilyId == 0x0f)) {
-    DisplayModel |= (Eax.Bits.ExtendedModelId << 4);
+    DisplayModel += (Eax.Bits.ExtendedModelId << 4);
   }
 
   Print (L"  Family = %x  Model = %x  Stepping = %x\n", DisplayFamily, DisplayModel, Eax.Bits.SteppingId); diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
index a8e4f920fc..552fdab417 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
@@ -1,7 +1,7 @@
 /** @file
   CPU Features Initialize functions.
 
-  Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2017 - 2023, Intel Corporation. All rights 
+ reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -67,12 +67,12 @@ FillProcessorInfo (
 
   DisplayedFamily = Eax.Bits.FamilyId;
   if (Eax.Bits.FamilyId == 0x0F) {
-    DisplayedFamily |= (Eax.Bits.ExtendedFamilyId << 4);
+    DisplayedFamily += Eax.Bits.ExtendedFamilyId;
   }
 
   DisplayedModel = Eax.Bits.Model;
   if ((Eax.Bits.FamilyId == 0x06) || (Eax.Bits.FamilyId == 0x0f)) {
-    DisplayedModel |= (Eax.Bits.ExtendedModelId << 4);
+    DisplayedModel += (Eax.Bits.ExtendedModelId << 4);
   }
 
   CpuInfo->DisplayFamily              = DisplayedFamily;
--
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#100788): https://edk2.groups.io/g/devel/message/100788
Mute This Topic: https://groups.io/mt/97444543/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH v2] UefiCpuPkg: Calculate DisplayFamily correctly
Posted by Gerd Hoffmann 1 year ago
On Tue, Mar 07, 2023 at 02:31:36PM +0800, Zhiguang Liu wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4348
> 
> Per SDM:
> DisplayFamily = Extended_Family_ID + Family_ID.
> DisplayModelID = (Extended_Model_ID << 4) + Family_ID.
> Correct the related code.
> 
> Cc: Eric Dong <eric.dong@intel.com>
> Reviewed-by: Ray Ni <ray.ni@intel.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Reviewed-by: Star Zeng <star.zeng@intel.com>
> Cc: Mike Maslenkin <mike.maslenkin@gmail.com>
> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>

Acked-by: Gerd Hoffmann <kraxel@redhat.com>



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#100780): https://edk2.groups.io/g/devel/message/100780
Mute This Topic: https://groups.io/mt/97444543/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH v2] UefiCpuPkg: Calculate DisplayFamily correctly
Posted by Ni, Ray 1 year ago
Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: Liu, Zhiguang <zhiguang.liu@intel.com>
> Sent: Tuesday, March 7, 2023 2:32 PM
> To: devel@edk2.groups.io
> Cc: Liu, Zhiguang <zhiguang.liu@intel.com>; Dong, Eric
> <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Kumar, Rahul R
> <rahul.r.kumar@intel.com>; Gerd Hoffmann <kraxel@redhat.com>; Zeng,
> Star <star.zeng@intel.com>; Mike Maslenkin <mike.maslenkin@gmail.com>
> Subject: [PATCH v2] UefiCpuPkg: Calculate DisplayFamily correctly
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4348
> 
> Per SDM:
> DisplayFamily = Extended_Family_ID + Family_ID.
> DisplayModelID = (Extended_Model_ID << 4) + Family_ID.
> Correct the related code.
> 
> Cc: Eric Dong <eric.dong@intel.com>
> Reviewed-by: Ray Ni <ray.ni@intel.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Reviewed-by: Star Zeng <star.zeng@intel.com>
> Cc: Mike Maslenkin <mike.maslenkin@gmail.com>
> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
> ---
>  UefiCpuPkg/Application/Cpuid/Cpuid.c                        | 6 +++---
>  .../Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c  | 6 +++---
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/UefiCpuPkg/Application/Cpuid/Cpuid.c
> b/UefiCpuPkg/Application/Cpuid/Cpuid.c
> index 372c6ef87d..172476a275 100644
> --- a/UefiCpuPkg/Application/Cpuid/Cpuid.c
> +++ b/UefiCpuPkg/Application/Cpuid/Cpuid.c
> @@ -1,7 +1,7 @@
>  /** @file
>    UEFI Application to display CPUID leaf information.
> 
> -  Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2016 - 2023, Intel Corporation. All rights reserved.<BR>
>    SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> @@ -217,12 +217,12 @@ CpuidVersionInfo (
> 
>    DisplayFamily = Eax.Bits.FamilyId;
>    if (Eax.Bits.FamilyId == 0x0F) {
> -    DisplayFamily |= (Eax.Bits.ExtendedFamilyId << 4);
> +    DisplayFamily += Eax.Bits.ExtendedFamilyId;
>    }
> 
>    DisplayModel = Eax.Bits.Model;
>    if ((Eax.Bits.FamilyId == 0x06) || (Eax.Bits.FamilyId == 0x0f)) {
> -    DisplayModel |= (Eax.Bits.ExtendedModelId << 4);
> +    DisplayModel += (Eax.Bits.ExtendedModelId << 4);
>    }
> 
>    Print (L"  Family = %x  Model = %x  Stepping = %x\n", DisplayFamily,
> DisplayModel, Eax.Bits.SteppingId);
> diff --git
> a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> index a8e4f920fc..552fdab417 100644
> --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> @@ -1,7 +1,7 @@
>  /** @file
>    CPU Features Initialize functions.
> 
> -  Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.<BR>
>    SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> @@ -67,12 +67,12 @@ FillProcessorInfo (
> 
>    DisplayedFamily = Eax.Bits.FamilyId;
>    if (Eax.Bits.FamilyId == 0x0F) {
> -    DisplayedFamily |= (Eax.Bits.ExtendedFamilyId << 4);
> +    DisplayedFamily += Eax.Bits.ExtendedFamilyId;
>    }
> 
>    DisplayedModel = Eax.Bits.Model;
>    if ((Eax.Bits.FamilyId == 0x06) || (Eax.Bits.FamilyId == 0x0f)) {
> -    DisplayedModel |= (Eax.Bits.ExtendedModelId << 4);
> +    DisplayedModel += (Eax.Bits.ExtendedModelId << 4);
>    }
> 
>    CpuInfo->DisplayFamily              = DisplayedFamily;
> --
> 2.31.1.windows.1



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