提交 7d2f5c10 编写于 作者: V vit9696

OcSmbiosLib: Fixed SMBIOS Type4 External Clock values

上级 1623dddd
......@@ -18,12 +18,6 @@
#include <IndustryStandard/CpuId.h>
#include <IndustryStandard/AppleIntelCpuInfo.h>
//
// External clock value on Sandy Bridge and above (in MHz).
// Rounded FSB * 4.
//
#define OC_CPU_SNB_QPB_CLOCK 0x19U
typedef struct {
//
// Note, Vendor and BrandString are reordered for proper alignment.
......@@ -69,6 +63,11 @@ typedef struct {
UINT16 CoreCount;
UINT16 ThreadCount;
//
// External clock for SMBIOS Type4 table.
//
UINT16 ExternalClock;
//
// Platform-dependent frequency for the Always Running Timer (ART), normally
// 24Mhz. Firmwares may choose to override this. Some CPUs like Xeon Scalable
......
......@@ -1478,6 +1478,26 @@ OcCpuScanProcessor (
return;
}
//
// SMBIOS Type4 ExternalClock field is assumed to have X*4 FSB frequency in MT/s.
// This value is cosmetics, but we still want to set it properly.
// Magic 4 value comes from 4 links in pretty much every modern Intel CPU.
// On modern CPUs this is now named Base clock (BCLK).
// Note, that this value was incorrect for most Macs since iMac12,x till iMac18,x inclusive.
// REF: https://github.com/acidanthera/bugtracker/issues/622#issuecomment-570811185
//
Cpu->ExternalClock = (UINT16) DivU64x32 (Cpu->FSBFrequency, 1000000);
//
// This is again cosmetics by errors in FSBFrequency calculation.
//
if (Cpu->ExternalClock >= 99 && Cpu->ExternalClock <= 101) {
Cpu->ExternalClock = 100;
} else if (Cpu->ExternalClock >= 132 && Cpu->ExternalClock <= 134) {
Cpu->ExternalClock = 133;
} else if (Cpu->ExternalClock >= 265 && Cpu->ExternalClock <= 267) {
Cpu->ExternalClock = 266;
}
DEBUG ((
DEBUG_INFO,
"OCCPU: CPUFrequencyFromTSC %11LuHz %5LuMHz\n",
......
......@@ -327,15 +327,7 @@ PatchProcessorInformation (
SMBIOS_OVERRIDE_V (Table, Standard.Type4->ProcessorId, Original, NULL, NULL);
SMBIOS_OVERRIDE_S (Table, Standard.Type4->ProcessorVersion, Original, NULL, &StringIndex, NULL);
SMBIOS_OVERRIDE_V (Table, Standard.Type4->Voltage, Original, NULL, NULL);
//
// Models newer than Sandybridge require quad pumped bus value instead of a front side bus value.
//
if (CpuInfo->Model >= CPU_MODEL_SANDYBRIDGE) {
Table->CurrentPtr.Standard.Type4->ExternalClock = OC_CPU_SNB_QPB_CLOCK;
} else {
Table->CurrentPtr.Standard.Type4->ExternalClock = (UINT16) DivU64x32 (CpuInfo->FSBFrequency, 1000000);
}
Table->CurrentPtr.Standard.Type4->ExternalClock = CpuInfo->ExternalClock;
Table->CurrentPtr.Standard.Type4->MaxSpeed = (UINT16) DivU64x32 (CpuInfo->CPUFrequency, 1000000);
if (Table->CurrentPtr.Standard.Type4->MaxSpeed % 100 != 0) {
Table->CurrentPtr.Standard.Type4->MaxSpeed = (UINT16) (((Table->CurrentPtr.Standard.Type4->MaxSpeed + 50) / 100) * 100);
......@@ -980,8 +972,7 @@ CreateAppleProcessorSpeed (
{
#ifndef OC_PROVIDE_APPLE_PROCESSOR_BUS_SPEED
//
// I believe this table is no longer used.
// The code below may be inaccurate as well, since it expects KHz.
// This table is not added in all modern Macs.
//
(VOID) Table;
(VOID) Data;
......@@ -995,11 +986,7 @@ CreateAppleProcessorSpeed (
return;
}
if (CpuInfo->Model >= CPU_MODEL_SANDYBRIDGE) {
Table->CurrentPtr.Type132->ProcessorBusSpeed = OC_CPU_SNB_QPB_CLOCK * 1000;
} else {
Table->CurrentPtr.Type132->ProcessorBusSpeed = (UINT16) DivU64x32 (CpuInfo->FSBFrequency, 1000);
}
Table->CurrentPtr.Type132->ProcessorBusSpeed = CpuInfo->ExternalClock * 4;
SmbiosFinaliseStruct (Table);
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册