Skip to content

Commit

Permalink
UefiCpuPkg: Calculate DisplayFamily correctly
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Ray Ni <[email protected]>
Cc: Rahul Kumar <[email protected]>
Acked-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
Cc: Mike Maslenkin <[email protected]>
Signed-off-by: Zhiguang Liu <[email protected]>
  • Loading branch information
LiuZhiguang001 authored and mergify[bot] committed Mar 7, 2023
1 parent f335d91 commit aa1cd44
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions UefiCpuPkg/Application/Cpuid/Cpuid.c
Original file line number Diff line number Diff line change
@@ -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
**/
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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
**/
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit aa1cd44

Please sign in to comment.