There is no problem with current implementation.
My proposal was to re-write code in this way:

  DisplayModel = Eax.Bits.Model;
  if ((Eax.Bits.FamilyId == 0x06) || (Eax.Bits.FamilyId == 0x0f)) {
    DisplayModel += (Eax.Bits.ExtendedModelId << 4);
  }

This is exactly matches spec without knowledge about Model_ID width
and makes code consistent.

There is no 'OR" operation in rules defined by SDM:
"
IF (Family_ID = 06H or Family_ID = 0FH)
  THEN DisplayModel = (Extended_Model_ID « 4) + Model_ID;
  (* Right justify and zero-extend 4-bit field; display Model_ID as
HEX field.*) ELSE DisplayModel = Model_ID;
FI;
"


"

On Mon, Mar 6, 2023 at 2:52 PM Ni, Ray <ray...@intel.com> wrote:
>
> ExtendedModelId field should use shift. So I believe nothing wrong there.
>
> > -----Original Message-----
> > From: Mike Maslenkin <mike.maslen...@gmail.com>
> > Sent: Monday, March 6, 2023 7:14 PM
> > To: devel@edk2.groups.io; Zeng, Star <star.z...@intel.com>
> > Cc: Liu, Zhiguang <zhiguang....@intel.com>; Dong, Eric
> > <eric.d...@intel.com>; Ni, Ray <ray...@intel.com>; Kumar, Rahul R
> > <rahul.r.ku...@intel.com>; Gerd Hoffmann <kra...@redhat.com>
> > Subject: Re: [edk2-devel] [PATCH] UefiCpuPkg: Calculate DisplayFamily
> > correctly
> >
> > Handling of ExtendedModelId field has the same problem.
> > This patch could be improved to fix that too.
> >
> > On Mon, Mar 6, 2023 at 1:37 PM Zeng, Star <star.z...@intel.com> wrote:
> > >
> > > BTW, look like wrong Bugzilla ID is used in commit message, please correct
> > it when merging the patch.
> > >
> > > -----Original Message-----
> > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Zeng,
> > Star
> > > Sent: Monday, March 6, 2023 6:35 PM
> > > To: devel@edk2.groups.io; Liu, Zhiguang <zhiguang....@intel.com>
> > > Cc: Dong, Eric <eric.d...@intel.com>; Ni, Ray <ray...@intel.com>; Kumar,
> > Rahul R <rahul.r.ku...@intel.com>; Gerd Hoffmann <kra...@redhat.com>;
> > Zeng, Star <star.z...@intel.com>
> > > Subject: Re: [edk2-devel] [PATCH] UefiCpuPkg: Calculate DisplayFamily
> > correctly
> > >
> > > Reviewed-by: Star Zeng <star.z...@intel.com>
> > >
> > > -----Original Message-----
> > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
> > Zhiguang Liu
> > > Sent: Thursday, March 2, 2023 9:27 AM
> > > To: devel@edk2.groups.io
> > > Cc: Liu, Zhiguang <zhiguang....@intel.com>; Dong, Eric
> > <eric.d...@intel.com>; Ni, Ray <ray...@intel.com>; Kumar, Rahul R
> > <rahul.r.ku...@intel.com>; Gerd Hoffmann <kra...@redhat.com>
> > > Subject: [edk2-devel] [PATCH] UefiCpuPkg: Calculate DisplayFamily
> > correctly
> > >
> > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4238
> > >
> > > Per SDM, DisplayFamily = Extended_Family_ID + Family_ID.
> > > Correct the related code.
> > >
> > > Cc: Eric Dong <eric.d...@intel.com>
> > > Cc: Ray Ni <ray...@intel.com>
> > > Cc: Rahul Kumar <rahul1.ku...@intel.com>
> > > Cc: Gerd Hoffmann <kra...@redhat.com>
> > > Signed-off-by: Zhiguang Liu <zhiguang....@intel.com>
> > > ---
> > >  UefiCpuPkg/Application/Cpuid/Cpuid.c                          | 4 ++--
> > >  .../Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c    | 4 ++--
> > >  2 files changed, 4 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/UefiCpuPkg/Application/Cpuid/Cpuid.c
> > b/UefiCpuPkg/Application/Cpuid/Cpuid.c
> > > index 372c6ef87d..51c463fb10 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,7 +217,7 @@ CpuidVersionInfo (
> > >
> > >    DisplayFamily = Eax.Bits.FamilyId;
> > >    if (Eax.Bits.FamilyId == 0x0F) {
> > > -    DisplayFamily |= (Eax.Bits.ExtendedFamilyId << 4);
> > > +    DisplayFamily += Eax.Bits.ExtendedFamilyId;
> > >    }
> > >
> > >    DisplayModel = Eax.Bits.Model;
> > > diff --git
> > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> > > index a8e4f920fc..25b8958252 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,7 +67,7 @@ FillProcessorInfo (
> > >
> > >    DisplayedFamily = Eax.Bits.FamilyId;
> > >    if (Eax.Bits.FamilyId == 0x0F) {
> > > -    DisplayedFamily |= (Eax.Bits.ExtendedFamilyId << 4);
> > > +    DisplayedFamily += Eax.Bits.ExtendedFamilyId;
> > >    }
> > >
> > >    DisplayedModel = Eax.Bits.Model;
> > > --
> > > 2.31.1.windows.1
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
>
>
> 
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#100733): https://edk2.groups.io/g/devel/message/100733
Mute This Topic: https://groups.io/mt/97330573/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to