From 8e90a2f0075eed0e401db384569bae2fadf869e3 Mon Sep 17 00:00:00 2001 From: vit9696 Date: Thu, 25 Feb 2021 19:45:33 +0300 Subject: [PATCH] OcCpuLib: Fixed showing core count for some AMD CPUs --- Changelog.md | 1 + Library/OcCpuLib/OcCpuLib.c | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Changelog.md b/Changelog.md index b1c50a6c..a5b90098 100644 --- a/Changelog.md +++ b/Changelog.md @@ -18,6 +18,7 @@ OpenCore Changelog - Removed `KeyMergeThreshold` as it never functioned anyway - Added `acdtinfo` utility to lookup certain products - Fixed `FSBFrequency` calculation with fractional multiplier +- Fixed showing core count for some AMD CPUs #### v0.6.6 - Added keyboard and pointer entry scroll support in OpenCanopy diff --git a/Library/OcCpuLib/OcCpuLib.c b/Library/OcCpuLib/OcCpuLib.c index b4cc6284..51350744 100755 --- a/Library/OcCpuLib/OcCpuLib.c +++ b/Library/OcCpuLib/OcCpuLib.c @@ -525,13 +525,6 @@ ScanAmdProcessor ( Recalculate = TRUE; DEBUG_CODE_END (); - // - // Faking an Intel Core i5 Processor. - // This value is purely cosmetic, but it makes sense to fake something - // that is somewhat representative of the kind of Processor that's actually - // in the system - // - Cpu->AppleProcessorType = AppleProcessorTypeCorei5Type5; // // get TSC Frequency calculated in OcTimerLib, unless we got it already from virtualization extensions. // FIXME(1): This code assumes the CPU operates in P0. Either ensure it does @@ -551,6 +544,18 @@ ScanAmdProcessor ( Cpu->ThreadCount = (UINT16) (BitFieldRead32 (CpuidEcx, 0, 7) + 1); } + // + // Faking an Intel processor with matching core count if possible. + // This value is purely cosmetic, but it makes sense to fake something + // that is somewhat representative of the kind of Processor that's actually + // in the system + // + if (Cpu->ThreadCount >= 8) { + Cpu->AppleProcessorType = AppleProcessorTypeXeonW; + } else { + Cpu->AppleProcessorType = AppleProcessorTypeCorei5Type5; + } + if (Cpu->Family == AMD_CPU_FAMILY) { Divisor = 0; CoreFrequencyID = 0; -- GitLab