提交 0aa75e80 编写于 作者: V vit9696

Implement flex ratio quirk

上级 da708a84
......@@ -25,7 +25,7 @@ typedef struct {
//
// Note, Vendor and BrandString are reordered for proper alignment.
//
UINT8 Vendor[16];
UINT32 Vendor[4];
CHAR8 BrandString[48];
UINT8 Type;
......
......@@ -48,6 +48,8 @@
#define MSR_IA32_EXT_CONFIG 0xEE
#define MSR_FEATURE_CONFIG 0x13C
#define MSR_FLEX_RATIO 0x194
#define FLEX_RATIO_LOCK (1U << 20U)
#define FLEX_RATIO_EN (1U << 16U)
#define MSR_IA32_PERF_CONTROL 0x199
#define MSR_THERM2_CTL 0x19D
......@@ -161,12 +163,14 @@ enum {
#define CPU_MODEL_BROADWELL_ULX 0x3D
#define CPU_MODEL_BROADWELL_ULT 0x3D
#define CPU_MODEL_BRYSTALWELL 0x47
#define CPU_MODEL_AIRMONT 0x4C ///< CherryTrail / Braswell
#define CPU_MODEL_AVOTON 0x4D ///< Avaton/Rangely
#define CPU_MODEL_SKYLAKE 0x4E ///< Skylake-S
#define CPU_MODEL_SKYLAKE_ULT 0x4E
#define CPU_MODEL_SKYLAKE_ULX 0x4E
#define CPU_MODEL_SKYLAKE_DT 0x5E
#define CPU_MODEL_SKYLAKE_W 0x55
#define CPU_MODEL_GOLDMONT 0x5C ///< Apollo Lake
#define CPU_MODEL_DENVERTON 0x5F ///< Goldmont Microserver
#define CPU_MODEL_CANNONLAKE 0x66
#define CPU_MODEL_XEON_MILL 0x85 ///< Knights Mill
......
......@@ -762,7 +762,7 @@ OcCpuScanProcessor (
//
// Get vendor CPUID 0x00000000
//
AsmCpuid (CPUID_SIGNATURE, &CpuidEax, (UINT32 *) Cpu->Vendor, (UINT32 *) (Cpu->Vendor + 8), (UINT32 *) (Cpu->Vendor + 4));
AsmCpuid (CPUID_SIGNATURE, &CpuidEax, &Cpu->Vendor[0], &Cpu->Vendor[2], &Cpu->Vendor[1]);
//
// Get extended CPUID 0x80000000
......@@ -843,7 +843,7 @@ OcCpuScanProcessor (
Cpu->ExtFamily
));
if (*(UINT32 *) Cpu->Vendor == CPUID_VENDOR_INTEL) {
if (Cpu->Vendor[0] == CPUID_VENDOR_INTEL) {
ScanIntelProcessor (Cpu);
}
}
......@@ -10,7 +10,8 @@ listed here.
* OcAcpiLib
**Status**: functional
**Issues**: none
**Issues**:
1. On legacy platforms rebooting may not work afterwards.
* OcAppleBootPolicyLib
**Status**: functional
**Issues**:
......@@ -30,6 +31,7 @@ listed here.
1. No package count detection.
1. No AMD CPU support.
1. Apple processor type detection is incomplete.
1. FSBFrequency calculation is sometimes incorrect, e.g. for Core 2 Quad Q9450.
* OcCryptoLib
**Status**: functional
**Issues**: none
......@@ -96,6 +98,10 @@ listed here.
**Status**: functional
**Issues**:
1. No AMD CPU support.
* OcVirtualFsLib
**Status**: functional
**Issues**:
1. Does not support directory iteration with virtualised files.
* OcXmlLib
**Status**: functional
**Issues**: none
......@@ -43,6 +43,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/GraphicsOutput.h>
#include <Protocol/SimpleTextInEx.h>
#include <Protocol/SimpleFileSystem.h>
#include <ProcessorInfo.h>
STATIC GUID SystemUUID = {0x5BC82C38, 0x4DB6, 0x4883, {0x85, 0x2E, 0xE7, 0x8D, 0x78, 0x0A, 0x6F, 0xE6}};
STATIC UINT8 BoardRevision = 1;
......@@ -130,6 +131,29 @@ TestDataHub (
//TODO: also put elsewhere, boot.efi kills watchdog only in FV2 UI.
gBS->SetWatchdogTimer (0, 0, 0, NULL);
//TODO: put this elsewhere, fixes early reboot on APTIO IV (Ivy/Haswell).
{
UINT64 Msr;
UINT64 FlexRatio;
if (CpuInfo.Vendor[0] == CPUID_VENDOR_INTEL
&& CpuInfo.Model != CPU_MODEL_GOLDMONT
&& CpuInfo.Model != CPU_MODEL_AIRMONT
&& CpuInfo.Model != CPU_MODEL_AVOTON) {
Msr = AsmReadMsr64 (MSR_FLEX_RATIO);
if (Msr & FLEX_RATIO_EN) {
FlexRatio = BitFieldRead64 (Msr, 8, 15);
if (FlexRatio == 0) {
//
// Disable Flex Ratio if current value is 0.
//
AsmWriteMsr64 (MSR_FLEX_RATIO, Msr & ~((UINT64) MSR_FLEX_RATIO));
}
}
}
}
return EFI_SUCCESS;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册