mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-12 09:54:36 +01:00
Continuing refactoring SETTINGS_DATA.
This commit is contained in:
parent
60e9707d0e
commit
d33d0479fa
@ -58,14 +58,18 @@
|
||||
</CommandLineArgument>
|
||||
<CommandLineArgument
|
||||
argument = "-e UEFI_APPLICATION"
|
||||
isEnabled = "YES">
|
||||
isEnabled = "NO">
|
||||
</CommandLineArgument>
|
||||
<CommandLineArgument
|
||||
argument = "-o CloverX64.efi"
|
||||
isEnabled = "YES">
|
||||
isEnabled = "NO">
|
||||
</CommandLineArgument>
|
||||
<CommandLineArgument
|
||||
argument = "CloverX64.dll"
|
||||
isEnabled = "NO">
|
||||
</CommandLineArgument>
|
||||
<CommandLineArgument
|
||||
argument = "-e DXE_DRIVER -o /JiefLand/5.Devel/Clover/Clover-projects/Clover--CloverHackyColor--master.3/Build/Clover/DEBUG_GCC53/X64/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe/OUTPUT/HiiDatabase.efi /JiefLand/5.Devel/Clover/Clover-projects/Clover--CloverHackyColor--master.3/Build/Clover/DEBUG_GCC53/X64/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe/DEBUG/HiiDatabase.dll"
|
||||
isEnabled = "YES">
|
||||
</CommandLineArgument>
|
||||
</CommandLineArguments>
|
||||
|
@ -356,6 +356,7 @@
|
||||
9A36E52524F3BB6B007A1107 /* FloatLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FloatLib.h; sourceTree = "<group>"; };
|
||||
9A36E53A24F3EDED007A1107 /* base64.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = base64.h; sourceTree = "<group>"; };
|
||||
9A36E53B24F3EDED007A1107 /* base64.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = base64.cpp; sourceTree = "<group>"; };
|
||||
9A4147662604F82900440186 /* undefinable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = undefinable.h; sourceTree = "<group>"; };
|
||||
9A4185BE2439F73A00BEAFB8 /* XStringArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XStringArray.cpp; sourceTree = "<group>"; };
|
||||
9A4185BF2439F73A00BEAFB8 /* XStringArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XStringArray.h; sourceTree = "<group>"; };
|
||||
9A4C5762255AAC0A004F0B21 /* XToolsConf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XToolsConf.h; sourceTree = "<group>"; };
|
||||
@ -5433,6 +5434,7 @@
|
||||
9A358B3625CF117A00A3850D /* cpp_lib */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9A4147662604F82900440186 /* undefinable.h */,
|
||||
9A358B3725CF117A00A3850D /* XmlLiteParser.h */,
|
||||
9A358B3825CF117A00A3850D /* xmlLiteSimpleTypes.h */,
|
||||
9A358B3925CF117A00A3850D /* XmlLiteCompositeTypes.cpp */,
|
||||
|
@ -45,7 +45,8 @@
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
disableMainThreadChecker = "YES"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
useCustomWorkingDirectory = "YES"
|
||||
customWorkingDirectory = "$PROJECT_DIR"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
migratedStopOnEveryIssue = "YES"
|
||||
|
1042
Xcode/CloverX64TestNewParser/config-test1.plist
Normal file
1042
Xcode/CloverX64TestNewParser/config-test1.plist
Normal file
File diff suppressed because it is too large
Load Diff
@ -22,8 +22,44 @@
|
||||
|
||||
int test1()
|
||||
{
|
||||
char *source = NULL;
|
||||
size_t newLen = 0;
|
||||
FILE *fp = fopen("config-test1.plist", "r");
|
||||
if (fp == NULL) {
|
||||
fputs("Error fopen config plist", stderr);
|
||||
exit(-1);
|
||||
}
|
||||
/* Go to the end of the file. */
|
||||
if (fseek(fp, 0L, SEEK_END) == 0) {
|
||||
/* Get the size of the file. */
|
||||
long bufsize = ftell(fp);
|
||||
if (bufsize == -1) {
|
||||
fputs("Error ftell config plist", stderr);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
/* Allocate our buffer to that size. */
|
||||
source = (char*)malloc(sizeof(char) * (bufsize + 1));
|
||||
|
||||
/* Go back to the start of the file. */
|
||||
if (fseek(fp, 0L, SEEK_SET) != 0) {
|
||||
fputs("Error fseek config plist", stderr);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
/* Read the entire file into memory. */
|
||||
newLen = fread(source, sizeof(char), bufsize, fp);
|
||||
if ( ferror( fp ) != 0 ) {
|
||||
fputs("Error reading config plist", stderr);
|
||||
exit(-1);
|
||||
} else {
|
||||
source[newLen++] = '\0'; /* Just to be safe. */
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
TagDict* dict = NULL;
|
||||
EFI_STATUS Status = ParseXML(configSample1, &dict, (UINT32)strlen(configSample1));
|
||||
EFI_STATUS Status = ParseXML(source, &dict, (UINT32)newLen);
|
||||
printf("ParseXML returns %s\n", efiStrError(Status));
|
||||
if ( EFI_ERROR(Status) ) {
|
||||
return Status;
|
||||
@ -42,19 +78,23 @@ int test1()
|
||||
ConfigPlist configPlist;
|
||||
|
||||
XmlLiteParser xmlLiteParser;
|
||||
xmlLiteParser.init(configSample1, strlen(configSample1));
|
||||
xmlLiteParser.init(source, newLen);
|
||||
|
||||
printf("\n");
|
||||
printf("=== [ Parse ] ====================\n");
|
||||
b = configPlist.parse(&xmlLiteParser, LString8(""));
|
||||
// for ( size_t idx = 0 ; idx < xmlLiteParser.getErrorsAndWarnings().size() ; idx++ ) {
|
||||
// const XmlParserMessage& xmlMsg = xmlLiteParser.getErrorsAndWarnings()[idx];
|
||||
// printf("%s: %s\n", xmlMsg.isError ? "Error" : "Warning", xmlMsg.msg.c_str());
|
||||
// }
|
||||
for ( size_t idx = 0 ; idx < xmlLiteParser.getErrorsAndWarnings().size() ; idx++ ) {
|
||||
const XmlParserMessage& xmlMsg = xmlLiteParser.getErrorsAndWarnings()[idx];
|
||||
printf("%s: %s\n", xmlMsg.isError ? "Error" : "Warning", xmlMsg.msg.c_str());
|
||||
}
|
||||
if ( b ) {
|
||||
if ( xmlLiteParser.getErrorsAndWarnings().size() == 0 ) {
|
||||
printf("Your plist looks so wonderful. Well done!\n");
|
||||
}
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
printf("=== [ CompareEarlyUserSettingsWithConfigPlist ] ====================\n");
|
||||
return CompareEarlyUserSettingsWithConfigPlist(settings, configPlist) ? 0 : -1;
|
||||
}
|
||||
|
||||
|
@ -1867,17 +1867,17 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion)
|
||||
} else {
|
||||
newFadt->PreferredPmProfile = gMobile?2:1; //as calculated before
|
||||
}
|
||||
if (gSettings.ACPI.SSDT.EnableC6 || gSettings.ACPI.SSDT.EnableISS) {
|
||||
if (GlobalConfig.EnableC6 || gSettings.ACPI.SSDT.EnableISS) {
|
||||
newFadt->CstCnt = 0x85; //as in Mac
|
||||
}
|
||||
if (gSettings.ACPI.SSDT.EnableC2) newFadt->PLvl2Lat = 0x65;
|
||||
if (gSettings.ACPI.SSDT.C3Latency > 0) {
|
||||
newFadt->PLvl3Lat = gSettings.ACPI.SSDT.C3Latency;
|
||||
} else if (gSettings.ACPI.SSDT.EnableC4) {
|
||||
if (GlobalConfig.EnableC2) newFadt->PLvl2Lat = 0x65;
|
||||
if (GlobalConfig.C3Latency > 0) {
|
||||
newFadt->PLvl3Lat = GlobalConfig.C3Latency;
|
||||
} else if (GlobalConfig.EnableC4) {
|
||||
newFadt->PLvl3Lat = 0x3E9;
|
||||
}
|
||||
if (gSettings.ACPI.SSDT.C3Latency == 0) {
|
||||
gSettings.ACPI.SSDT.C3Latency = newFadt->PLvl3Lat;
|
||||
if (GlobalConfig.C3Latency == 0) {
|
||||
GlobalConfig.C3Latency = newFadt->PLvl3Lat;
|
||||
}
|
||||
|
||||
newFadt->IaPcBootArch = 0x3;
|
||||
|
@ -469,7 +469,7 @@ SetupDataForOSX(BOOLEAN Hibernate)
|
||||
FrontSideBus = 100 * Mega;
|
||||
}
|
||||
|
||||
if (gSettings.QEMU) {
|
||||
if (gSettings.CPU.QEMU) {
|
||||
FrontSideBus = gCPUStructure.TSCFrequency;
|
||||
switch (gCPUStructure.Model) {
|
||||
case CPU_MODEL_DOTHAN:
|
||||
@ -485,10 +485,10 @@ SetupDataForOSX(BOOLEAN Hibernate)
|
||||
}
|
||||
|
||||
// Save values into gSettings for the genconfig aim
|
||||
gSettings.BusSpeed = (UINT32)DivU64x32(FrontSideBus, Kilo);
|
||||
gSettings.CPU.BusSpeed = (UINT32)DivU64x32(FrontSideBus, Kilo);
|
||||
|
||||
CpuSpeed = gCPUStructure.CPUFrequency;
|
||||
gSettings.CpuFreqMHz = (UINT32)DivU64x32(CpuSpeed, Mega);
|
||||
gSettings.CPU.CpuFreqMHz = (UINT32)DivU64x32(CpuSpeed, Mega);
|
||||
|
||||
// Locate DataHub Protocol
|
||||
Status = gBS->LocateProtocol(&gEfiDataHubProtocolGuid, NULL, (void**)&gDataHub);
|
||||
@ -501,7 +501,7 @@ SetupDataForOSX(BOOLEAN Hibernate)
|
||||
|
||||
LogDataHub(&gEfiProcessorSubClassGuid, L"FSBFrequency", &FrontSideBus, sizeof(UINT64));
|
||||
|
||||
if (gCPUStructure.ARTFrequency && gSettings.UseARTFreq) {
|
||||
if (gCPUStructure.ARTFrequency && gSettings.CPU.UseARTFreq) {
|
||||
ARTFrequency = gCPUStructure.ARTFrequency;
|
||||
LogDataHub(&gEfiProcessorSubClassGuid, L"ARTFrequency", &ARTFrequency, sizeof(UINT64));
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ Headers collection for procedures
|
||||
#include "../cpp_foundation/XArray.h"
|
||||
#include "../cpp_foundation/XObjArray.h"
|
||||
#include "../cpp_util/remove_ref.h"
|
||||
#include "../cpp_lib/undefinable.h"
|
||||
#endif
|
||||
|
||||
#include "../include/OneLinerMacros.h"
|
||||
|
@ -3781,25 +3781,25 @@ static void getACPISettings(const TagDict *CfgDict, SETTINGS_DATA& gSettings)
|
||||
|
||||
Prop = SSDTDict->propertyForKey("EnableC6");
|
||||
if (Prop) {
|
||||
gSettings.ACPI.SSDT.EnableC6 = IsPropertyNotNullAndTrue(Prop);
|
||||
DBG("EnableC6: %s\n", gSettings.ACPI.SSDT.EnableC6 ? "yes" : "no");
|
||||
gSettings.ACPI.SSDT._EnableC6 = IsPropertyNotNullAndTrue(Prop);
|
||||
DBG("EnableC6: %s\n", gSettings.ACPI.SSDT._EnableC6 ? "yes" : "no");
|
||||
}
|
||||
|
||||
Prop = SSDTDict->propertyForKey("EnableC4");
|
||||
if (Prop) {
|
||||
gSettings.ACPI.SSDT.EnableC4 = IsPropertyNotNullAndTrue(Prop);
|
||||
DBG("EnableC4: %s\n", gSettings.ACPI.SSDT.EnableC4 ? "yes" : "no");
|
||||
gSettings.ACPI.SSDT._EnableC4 = IsPropertyNotNullAndTrue(Prop);
|
||||
DBG("EnableC4: %s\n", gSettings.ACPI.SSDT._EnableC4 ? "yes" : "no");
|
||||
}
|
||||
|
||||
Prop = SSDTDict->propertyForKey("EnableC2");
|
||||
if (Prop) {
|
||||
gSettings.ACPI.SSDT.EnableC2 = IsPropertyNotNullAndTrue(Prop);
|
||||
DBG("EnableC2: %s\n", gSettings.ACPI.SSDT.EnableC2 ? "yes" : "no");
|
||||
gSettings.ACPI.SSDT._EnableC2 = IsPropertyNotNullAndTrue(Prop);
|
||||
DBG("EnableC2: %s\n", gSettings.ACPI.SSDT._EnableC2 ? "yes" : "no");
|
||||
}
|
||||
|
||||
Prop = SSDTDict->propertyForKey("C3Latency");
|
||||
gSettings.ACPI.SSDT.C3Latency = (UINT16)GetPropertyAsInteger(Prop, gSettings.ACPI.SSDT.C3Latency);
|
||||
DBG("C3Latency: %d\n", gSettings.ACPI.SSDT.C3Latency);
|
||||
gSettings.ACPI.SSDT._C3Latency = (UINT16)GetPropertyAsInteger(Prop, gSettings.ACPI.SSDT._C3Latency);
|
||||
DBG("C3Latency: %d\n", gSettings.ACPI.SSDT._C3Latency);
|
||||
|
||||
Prop = SSDTDict->propertyForKey("PLimitDict");
|
||||
gSettings.ACPI.SSDT.PLimitDict = (UINT8)GetPropertyAsInteger(Prop, 0);
|
||||
@ -4821,93 +4821,98 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
|
||||
}
|
||||
|
||||
//CPU
|
||||
gSettings.CpuType = GetAdvancedCpuType(); //let it be default
|
||||
gSettings.SavingMode = 0xFF; //default
|
||||
gSettings.CPU.CpuType = GetAdvancedCpuType(); //let it be default
|
||||
gSettings.CPU.SavingMode = 0xFF; //default
|
||||
const TagDict* CPUDict = CfgDict->dictPropertyForKey("CPU");
|
||||
if (CPUDict != NULL) {
|
||||
const TagStruct* Prop = CPUDict->propertyForKey("QPI");
|
||||
if (Prop != NULL) {
|
||||
gSettings.QPI = (UINT16)GetPropertyAsInteger(Prop, gSettings.QPI);
|
||||
DBG("QPI: %dMHz\n", gSettings.QPI);
|
||||
gSettings.CPU.QPI = (UINT16)GetPropertyAsInteger(Prop, gSettings.CPU.QPI);
|
||||
DBG("QPI: %dMHz\n", gSettings.CPU.QPI);
|
||||
}
|
||||
|
||||
Prop = CPUDict->propertyForKey("FrequencyMHz");
|
||||
if (Prop != NULL) {
|
||||
gSettings.CpuFreqMHz = (UINT32)GetPropertyAsInteger(Prop, gSettings.CpuFreqMHz);
|
||||
DBG("CpuFreq: %dMHz\n", gSettings.CpuFreqMHz);
|
||||
gSettings.CPU.CpuFreqMHz = (UINT32)GetPropertyAsInteger(Prop, gSettings.CPU.CpuFreqMHz);
|
||||
DBG("CpuFreq: %dMHz\n", gSettings.CPU.CpuFreqMHz);
|
||||
}
|
||||
|
||||
Prop = CPUDict->propertyForKey("Type");
|
||||
if (Prop != NULL) {
|
||||
gSettings.CpuType = (UINT16)GetPropertyAsInteger(Prop, gSettings.CpuType);
|
||||
DBG("CpuType: %hX\n", gSettings.CpuType);
|
||||
gSettings.CPU.CpuType = (UINT16)GetPropertyAsInteger(Prop, gSettings.CPU.CpuType);
|
||||
DBG("CpuType: %hX\n", gSettings.CPU.CpuType);
|
||||
}
|
||||
|
||||
Prop = CPUDict->propertyForKey("QEMU");
|
||||
gSettings.QEMU = IsPropertyNotNullAndTrue(Prop);
|
||||
if (gSettings.QEMU) {
|
||||
gSettings.CPU.QEMU = IsPropertyNotNullAndTrue(Prop);
|
||||
if (gSettings.CPU.QEMU) {
|
||||
DBG("QEMU: true\n");
|
||||
}
|
||||
|
||||
Prop = CPUDict->propertyForKey("UseARTFrequency");
|
||||
if (Prop != NULL) {
|
||||
gSettings.UseARTFreq = IsPropertyNotNullAndTrue(Prop);
|
||||
gSettings.CPU.UseARTFreq = IsPropertyNotNullAndTrue(Prop);
|
||||
}
|
||||
|
||||
gSettings.UserChange = FALSE;
|
||||
gSettings.CPU.UserChange = FALSE;
|
||||
Prop = CPUDict->propertyForKey("BusSpeedkHz");
|
||||
if (Prop != NULL) {
|
||||
gSettings.BusSpeed = (UINT32)GetPropertyAsInteger(Prop, gSettings.BusSpeed);
|
||||
DBG("BusSpeed: %dkHz\n", gSettings.BusSpeed);
|
||||
gSettings.UserChange = TRUE;
|
||||
gSettings.CPU.BusSpeed = (UINT32)GetPropertyAsInteger(Prop, gSettings.CPU.BusSpeed);
|
||||
DBG("BusSpeed: %dkHz\n", gSettings.CPU.BusSpeed);
|
||||
gSettings.CPU.UserChange = TRUE;
|
||||
}
|
||||
|
||||
Prop = CPUDict->propertyForKey("C6");
|
||||
if (Prop != NULL) {
|
||||
gSettings.ACPI.SSDT.EnableC6 = IsPropertyNotNullAndTrue(Prop);
|
||||
// gSettings.ACPI.SSDT.EnableC6 = IsPropertyNotNullAndTrue(Prop);
|
||||
gSettings.CPU._EnableC6 = IsPropertyNotNullAndTrue(Prop);
|
||||
}
|
||||
|
||||
Prop = CPUDict->propertyForKey("C4");
|
||||
if (Prop != NULL) {
|
||||
gSettings.ACPI.SSDT.EnableC4 = IsPropertyNotNullAndTrue(Prop);
|
||||
// gSettings.ACPI.SSDT.EnableC4 = IsPropertyNotNullAndTrue(Prop);
|
||||
gSettings.CPU._EnableC4 = IsPropertyNotNullAndTrue(Prop);
|
||||
}
|
||||
|
||||
Prop = CPUDict->propertyForKey("C2");
|
||||
if (Prop != NULL) {
|
||||
gSettings.ACPI.SSDT.EnableC2 = IsPropertyNotNullAndTrue(Prop);
|
||||
// gSettings.ACPI.SSDT.EnableC2 = IsPropertyNotNullAndTrue(Prop);
|
||||
gSettings.CPU._EnableC2 = IsPropertyNotNullAndTrue(Prop);
|
||||
}
|
||||
|
||||
//Usually it is 0x03e9, but if you want Turbo, you may set 0x00FA
|
||||
Prop = CPUDict->propertyForKey("Latency");
|
||||
gSettings.ACPI.SSDT.C3Latency = (UINT16)GetPropertyAsInteger(Prop, gSettings.ACPI.SSDT.C3Latency);
|
||||
// gSettings.ACPI.SSDT.C3Latency = (UINT16)GetPropertyAsInteger(Prop, gSettings.ACPI.SSDT.C3Latency);
|
||||
if ( Prop != NULL ) gSettings.CPU._C3Latency = (UINT16)GetPropertyAsInteger(Prop, 0);
|
||||
|
||||
Prop = CPUDict->propertyForKey("SavingMode");
|
||||
gSettings.SavingMode = (UINT8)GetPropertyAsInteger(Prop, 0xFF); //the default value means not set
|
||||
gSettings.CPU.SavingMode = (UINT8)GetPropertyAsInteger(Prop, 0xFF); //the default value means not set
|
||||
|
||||
Prop = CPUDict->propertyForKey("HWPEnable");
|
||||
if (Prop && IsPropertyNotNullAndTrue(Prop) && (gCPUStructure.Model >= CPU_MODEL_SKYLAKE_U)) {
|
||||
gSettings.HWP = TRUE;
|
||||
#ifdef CLOVER_BUILD
|
||||
AsmWriteMsr64 (MSR_IA32_PM_ENABLE, 1);
|
||||
#endif
|
||||
}
|
||||
gSettings.CPU.HWPEnable = IsPropertyNotNullAndTrue(Prop);
|
||||
// if (gSettings.CPU.HWPEnable && (gCPUStructure.Model >= CPU_MODEL_SKYLAKE_U)) {
|
||||
// GlobalConfig.HWP = TRUE;
|
||||
//#ifdef CLOVER_BUILD
|
||||
// AsmWriteMsr64 (MSR_IA32_PM_ENABLE, 1);
|
||||
//#endif
|
||||
// }
|
||||
Prop = CPUDict->propertyForKey("HWPValue");
|
||||
if (Prop && gSettings.HWP) {
|
||||
gSettings.HWPValue = (UINT32)GetPropertyAsInteger(Prop, 0);
|
||||
#ifdef CLOVER_BUILD
|
||||
AsmWriteMsr64 (MSR_IA32_HWP_REQUEST, gSettings.HWPValue);
|
||||
#endif
|
||||
}
|
||||
if ( Prop ) gSettings.CPU.HWPValue = (UINT32)GetPropertyAsInteger(Prop, 0);
|
||||
// if (Prop && GlobalConfig.HWP) {
|
||||
//#ifdef CLOVER_BUILD
|
||||
// AsmWriteMsr64 (MSR_IA32_HWP_REQUEST, gSettings.CPU.HWPValue);
|
||||
//#endif
|
||||
// }
|
||||
|
||||
Prop = CPUDict->propertyForKey("TDP");
|
||||
gSettings.TDP = (UINT8)GetPropertyAsInteger(Prop, 0);
|
||||
gSettings.CPU.TDP = (UINT8)GetPropertyAsInteger(Prop, 0);
|
||||
|
||||
Prop = CPUDict->propertyForKey("TurboDisable");
|
||||
if (Prop && IsPropertyNotNullAndTrue(Prop)) {
|
||||
#ifdef CLOVER_BUILD
|
||||
UINT64 msr = AsmReadMsr64(MSR_IA32_MISC_ENABLE);
|
||||
#endif
|
||||
gSettings.Turbo = 0;
|
||||
gSettings.CPU.Turbo = 0;
|
||||
#ifdef CLOVER_BUILD
|
||||
msr &= ~(1ULL<<38);
|
||||
AsmWriteMsr64 (MSR_IA32_MISC_ENABLE, msr);
|
||||
@ -6910,7 +6915,7 @@ SetDevices (LOADER_ENTRY *Entry)
|
||||
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16, GEN_PMCON_1, 1, &PmCon);
|
||||
MsgLog ("Initial PmCon value=%hX\n", PmCon);
|
||||
|
||||
if (gSettings.ACPI.SSDT.EnableC6) {
|
||||
if (GlobalConfig.EnableC6) {
|
||||
PmCon |= 1 << 11;
|
||||
DBG("C6 enabled\n");
|
||||
} else {
|
||||
@ -6918,7 +6923,7 @@ SetDevices (LOADER_ENTRY *Entry)
|
||||
DBG("C6 disabled\n");
|
||||
}
|
||||
/*
|
||||
if (gSettings.ACPI.SSDT.EnableC2) {
|
||||
if (GlobalConfig.EnableC2) {
|
||||
PmCon |= 1 << 10;
|
||||
DBG("BIOS_PCIE enabled\n");
|
||||
} else {
|
||||
@ -6926,7 +6931,7 @@ SetDevices (LOADER_ENTRY *Entry)
|
||||
DBG("BIOS_PCIE disabled\n");
|
||||
}
|
||||
*/
|
||||
if (gSettings.ACPI.SSDT.EnableC4) {
|
||||
if (GlobalConfig.EnableC4) {
|
||||
PmCon |= 1 << 7;
|
||||
DBG("C4 enabled\n");
|
||||
} else {
|
||||
@ -7080,7 +7085,7 @@ SaveSettings ()
|
||||
// here we can apply user settings instead of default one
|
||||
gMobile = gSettings.Mobile;
|
||||
|
||||
if ((gSettings.BusSpeed != 0) && (gSettings.BusSpeed > 10 * Kilo) && (gSettings.BusSpeed < 500 * Kilo)) {
|
||||
if ((gSettings.CPU.BusSpeed != 0) && (gSettings.CPU.BusSpeed > 10 * Kilo) && (gSettings.CPU.BusSpeed < 500 * Kilo)) {
|
||||
switch (gCPUStructure.Model) {
|
||||
case CPU_MODEL_PENTIUM_M:
|
||||
case CPU_MODEL_ATOM:// Atom
|
||||
@ -7097,7 +7102,7 @@ SaveSettings ()
|
||||
case CPU_MODEL_WESTMERE:// Core i7 LGA1366, Six-core, "Westmere", "Gulftown", 32nm
|
||||
case CPU_MODEL_NEHALEM_EX:// Core i7, Nehalem-Ex Xeon, "Beckton"
|
||||
case CPU_MODEL_WESTMERE_EX:// Core i7, Nehalem-Ex Xeon, "Eagleton"
|
||||
gCPUStructure.ExternalClock = gSettings.BusSpeed;
|
||||
gCPUStructure.ExternalClock = gSettings.CPU.BusSpeed;
|
||||
//DBG("Read ExternalClock: %d MHz\n", (INT32)(DivU64x32(gCPUStructure.ExternalClock, Kilo)));
|
||||
break;
|
||||
default:
|
||||
@ -7105,21 +7110,21 @@ SaveSettings ()
|
||||
|
||||
// for sandy bridge or newer
|
||||
// to match ExternalClock 25 MHz like real mac, divide BusSpeed by 4
|
||||
gCPUStructure.ExternalClock = (gSettings.BusSpeed + 3) / 4;
|
||||
gCPUStructure.ExternalClock = (gSettings.CPU.BusSpeed + 3) / 4;
|
||||
//DBG("Corrected ExternalClock: %d MHz\n", (INT32)(DivU64x32(gCPUStructure.ExternalClock, Kilo)));
|
||||
break;
|
||||
}
|
||||
|
||||
gCPUStructure.FSBFrequency = MultU64x64 (gSettings.BusSpeed, Kilo); //kHz -> Hz
|
||||
gCPUStructure.MaxSpeed = (UINT32)(DivU64x32 ((UINT64)gSettings.BusSpeed * gCPUStructure.MaxRatio, 10000)); //kHz->MHz
|
||||
gCPUStructure.FSBFrequency = MultU64x64 (gSettings.CPU.BusSpeed, Kilo); //kHz -> Hz
|
||||
gCPUStructure.MaxSpeed = (UINT32)(DivU64x32 ((UINT64)gSettings.CPU.BusSpeed * gCPUStructure.MaxRatio, 10000)); //kHz->MHz
|
||||
}
|
||||
|
||||
if ((gSettings.CpuFreqMHz > 100) && (gSettings.CpuFreqMHz < 20000)) {
|
||||
gCPUStructure.MaxSpeed = gSettings.CpuFreqMHz;
|
||||
if ((gSettings.CPU.CpuFreqMHz > 100) && (gSettings.CPU.CpuFreqMHz < 20000)) {
|
||||
gCPUStructure.MaxSpeed = gSettings.CPU.CpuFreqMHz;
|
||||
}
|
||||
|
||||
// to determine the use of Table 132
|
||||
if (gSettings.QPI) {
|
||||
if (gSettings.CPU.QPI) {
|
||||
GlobalConfig.SetTable132 = TRUE;
|
||||
//DBG("QPI: use Table 132\n");
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "MacOsVersion.h"
|
||||
#include "KERNEL_AND_KEXT_PATCHES.h"
|
||||
#include "../libeg/XIcon.h"
|
||||
#include "../cpp_lib/undefinable.h"
|
||||
|
||||
|
||||
#define CLOVER_SIGN SIGNATURE_32('C','l','v','r')
|
||||
@ -344,10 +345,10 @@ public:
|
||||
BOOLEAN NoDynamicExtract = 0;
|
||||
BOOLEAN EnableISS = 0;
|
||||
BOOLEAN EnableC7 = 0;
|
||||
BOOLEAN EnableC6 = 0;
|
||||
BOOLEAN EnableC4 = 0;
|
||||
BOOLEAN EnableC2 = 0;
|
||||
UINT16 C3Latency = 0;
|
||||
BOOLEAN _EnableC6 = 0;
|
||||
BOOLEAN _EnableC4 = 0;
|
||||
BOOLEAN _EnableC2 = 0;
|
||||
UINT16 _C3Latency = 0;
|
||||
UINT8 PLimitDict = 0;
|
||||
UINT8 UnderVoltStep = 0;
|
||||
BOOLEAN DoubleFirstState = 0;
|
||||
@ -386,6 +387,43 @@ public:
|
||||
bool NoLegacy = false;
|
||||
} GUI = GUIClass();
|
||||
|
||||
class CPUClass {
|
||||
public:
|
||||
UINT16 QPI = 0;
|
||||
UINT32 CpuFreqMHz = 0;
|
||||
UINT16 CpuType = 0;
|
||||
BOOLEAN QEMU = 0;
|
||||
BOOLEAN UseARTFreq = 0;
|
||||
UINT32 BusSpeed = 0; //in kHz
|
||||
BOOLEAN UserChange = 0;
|
||||
UINT8 SavingMode = 0;
|
||||
bool HWPEnable = false;
|
||||
undefinable_uint32 HWPValue = undefinable_uint32();
|
||||
UINT8 TDP = 0;
|
||||
BOOLEAN Turbo = 0;
|
||||
undefinable_bool _EnableC6 = undefinable_bool();
|
||||
undefinable_bool _EnableC4 = undefinable_bool();
|
||||
undefinable_bool _EnableC2 = undefinable_bool();
|
||||
undefinable_uint16 _C3Latency = undefinable_uint16();
|
||||
} CPU = CPUClass();
|
||||
|
||||
bool getEnableC6() const {
|
||||
if ( CPU._EnableC6.isDefined() ) return CPU._EnableC6;
|
||||
return ACPI.SSDT._EnableC6;
|
||||
}
|
||||
bool getEnableC4() const {
|
||||
if ( CPU._EnableC4.isDefined() ) return CPU._EnableC4;
|
||||
return ACPI.SSDT._EnableC4;
|
||||
}
|
||||
bool getEnableC2() const {
|
||||
if ( CPU._EnableC2.isDefined() ) return CPU._EnableC2;
|
||||
return ACPI.SSDT._EnableC2;
|
||||
}
|
||||
bool getC3Latency() const {
|
||||
if ( CPU._C3Latency.isDefined() ) return CPU._C3Latency;
|
||||
return ACPI.SSDT._C3Latency;
|
||||
}
|
||||
|
||||
// SMBIOS TYPE0
|
||||
XString8 VendorName;
|
||||
XString8 RomVersion;
|
||||
@ -418,12 +456,7 @@ public:
|
||||
XString8 ChassisManufacturer;
|
||||
XString8 ChassisAssetTag;
|
||||
// SMBIOS TYPE4
|
||||
UINT32 CpuFreqMHz;
|
||||
UINT32 BusSpeed; //in kHz
|
||||
BOOLEAN Turbo;
|
||||
UINT8 EnabledCores;
|
||||
BOOLEAN UserChange;
|
||||
BOOLEAN QEMU;
|
||||
// SMBIOS TYPE17
|
||||
UINT16 SmbiosVersion;
|
||||
INT8 Attribute;
|
||||
@ -433,12 +466,9 @@ public:
|
||||
XString8 MemoryPartNumber;
|
||||
XString8 MemorySpeed;
|
||||
// SMBIOS TYPE131
|
||||
UINT16 CpuType;
|
||||
// SMBIOS TYPE132
|
||||
UINT16 QPI;
|
||||
BOOLEAN TrustSMBIOS;
|
||||
BOOLEAN TrustSMBIOS = 0;
|
||||
BOOLEAN InjectMemoryTables;
|
||||
BOOLEAN UseARTFreq;
|
||||
INT8 pad18[3];
|
||||
|
||||
// SMBIOS TYPE133
|
||||
@ -478,7 +508,6 @@ public:
|
||||
|
||||
//ACPI
|
||||
UINT8 pad23[1];
|
||||
UINT8 SavingMode;
|
||||
|
||||
// BOOLEAN DropMCFG;
|
||||
|
||||
@ -555,9 +584,6 @@ public:
|
||||
|
||||
|
||||
//SkyLake
|
||||
BOOLEAN HWP;
|
||||
UINT8 TDP;
|
||||
UINT32 HWPValue;
|
||||
|
||||
//Volumes hiding
|
||||
XString8Array HVHideStrings;
|
||||
@ -686,19 +712,19 @@ public:
|
||||
|
||||
SETTINGS_DATA() : VendorName(), RomVersion(), EfiVersion(), ReleaseDate(), ManufactureName(), ProductName(), VersionNr(), SerialNr(), SmUUID(),
|
||||
pad0{0}, FamilyName(), OEMProduct(), OEMVendor(), BoardManufactureName(), BoardSerialNumber(), BoardNumber(), LocationInChassis(),
|
||||
BoardVersion(), OEMBoard(), BoardType(0), pad1(0), Mobile(0), ChassisType(0), ChassisManufacturer(), ChassisAssetTag(), CpuFreqMHz(0),
|
||||
BusSpeed(0), Turbo(0), EnabledCores(0), UserChange(0), QEMU(0), SmbiosVersion(0), Attribute(0), pad17{0}, MemoryManufacturer(),
|
||||
MemorySerialNumber(), MemoryPartNumber(), MemorySpeed(), CpuType(0), QPI(0), TrustSMBIOS(0), InjectMemoryTables(0),
|
||||
UseARTFreq(0), PlatformFeature(0), NoRomInfo(0), Language(), CustomUuid(),
|
||||
BoardVersion(), OEMBoard(), BoardType(0), pad1(0), Mobile(0), ChassisType(0), ChassisManufacturer(), ChassisAssetTag(),
|
||||
EnabledCores(0), SmbiosVersion(0), Attribute(0), pad17{0}, MemoryManufacturer(),
|
||||
MemorySerialNumber(), MemoryPartNumber(), MemorySpeed(), InjectMemoryTables(0),
|
||||
PlatformFeature(0), NoRomInfo(0), Language(), CustomUuid(),
|
||||
IntelMaxBacklight(0), VendorEDID(0), ProductEDID(0), BacklightLevel(0), BacklightLevelConfig(0), IntelBacklight(0), MemoryFix(0), WithKexts(0),
|
||||
WithKextsIfNoFakeSMC(0), FakeSMCFound(0), NoCaches(0), Debug(0), pad22{0}, DefaultBackgroundColor(0), SavingMode(0), StringInjector(0), InjectSystemID_(0), NoDefaultProperties(0),
|
||||
WithKextsIfNoFakeSMC(0), FakeSMCFound(0), NoCaches(0), Debug(0), pad22{0}, DefaultBackgroundColor(0), StringInjector(0), InjectSystemID_(0), NoDefaultProperties(0),
|
||||
FakeATI(0), FakeNVidia(0), FakeIntel(0), FakeLAN(0), FakeWIFI(0), FakeSATA(0), FakeXHCI(0), FakeIMEI(0), GraphicsInjector(0),
|
||||
InjectIntel(0), InjectATI(0), InjectNVidia(0), DeInit(0), LoadVBios(0), PatchVBios(0), PatchVBiosBytes(0), PatchVBiosBytesCount(0), InjectEDID(0),
|
||||
LpcTune(0), DropOEM_DSM(0), CustomEDID(0), CustomEDIDsize(0), EdidFixHorizontalSyncPulseWidth(0), EdidFixVideoInputSignal(0), FBName(), VideoPorts(0), NvidiaGeneric(0),
|
||||
NvidiaNoEFI(0), NvidiaSingle(0), VRAM(0), Dcfg{0}, NVCAP{0}, BootDisplay(0), NvidiaWeb(0), pad41{0}, DualLink(0),
|
||||
IgPlatform(0), HDAInjection(0),
|
||||
HDALayoutId(0), USBInjection(0), USBFixOwnership(0), InjectClockID(0), HighCurrent(0), NameEH00(0), NameXH00(0), LANInjection(0), HDMIInjection(0),
|
||||
HWP(0), TDP(0), HWPValue(0), HVHideStrings(), KernelAndKextPatches(), KextPatchesAllowed(0),
|
||||
HVHideStrings(), KernelAndKextPatches(), KextPatchesAllowed(0),
|
||||
KernelPatchesAllowed(0), AirportBridgeDeviceName(), KbdPrevLang(0), PointerEnabled(0), PointerSpeed(0), DoubleClickTime(0), PointerMirror(0),
|
||||
RefCLK(0), RtMLB(), RtROM(), CsrActiveConfig(0), BooterConfig(0), BooterCfgStr(),
|
||||
ConfigName{0}, /*MainConfigName(0),*/ /*BlackListCount(0),*/ DisabledDriverArray(), RPlt{0}, RBr{0}, EPCI{0}, REV{0}, ForceHPET(0), ResetHDA(0), PlayAsync(0), DisableFunctions(0), SlpWak(0), UseIntelHDMI(0),
|
||||
@ -936,6 +962,12 @@ public:
|
||||
UINT8 SecureBootSetupMode = 0;
|
||||
|
||||
BOOLEAN SetTable132 = 0;
|
||||
BOOLEAN HWP = 0;
|
||||
|
||||
bool EnableC6 = 0;
|
||||
bool EnableC4 = 0;
|
||||
bool EnableC2 = 0;
|
||||
uint16_t C3Latency = 0;
|
||||
|
||||
/*
|
||||
* Defqult ctor :
|
||||
|
@ -166,7 +166,7 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
|
||||
|
||||
maximum.Control.Control = (RShiftU64(AsmReadMsr64(MSR_IA32_PERF_STATUS), 32) & 0x1F3F) | (0x4000 * cpu_noninteger_bus_ratio);
|
||||
DBG("Maximum control=0x%hX\n", maximum.Control.Control);
|
||||
if (gSettings.Turbo) {
|
||||
if (gSettings.CPU.Turbo) {
|
||||
maximum.Control.VID_FID.FID++;
|
||||
MsgLog("Turbo FID=0x%hhX\n", maximum.Control.VID_FID.FID);
|
||||
}
|
||||
@ -284,7 +284,7 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
|
||||
|
||||
realMax = maximum.Control.Control;
|
||||
DBG("Maximum control=0x%hX\n", realMax);
|
||||
if (gSettings.Turbo) {
|
||||
if (gSettings.CPU.Turbo) {
|
||||
realTurbo = (gCPUStructure.Turbo4 > gCPUStructure.Turbo1) ?
|
||||
(gCPUStructure.Turbo4 / 10) : (gCPUStructure.Turbo1 / 10);
|
||||
maximum.Control.Control = realTurbo;
|
||||
@ -393,12 +393,12 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
|
||||
|
||||
scop = aml_add_scope(root, name);
|
||||
|
||||
if (gSettings.ACPI.SSDT.Generate.GeneratePStates && !gSettings.HWP) {
|
||||
if (gSettings.ACPI.SSDT.Generate.GeneratePStates && !GlobalConfig.HWP) {
|
||||
method = aml_add_name(scop, "PSS_");
|
||||
pack = aml_add_package(method);
|
||||
|
||||
if ((gSettings.TDP != 0) && (p_states[0].Frequency != 0)) {
|
||||
TDPdiv = (gSettings.TDP * 1000) / p_states[0].Frequency;
|
||||
if ((gSettings.CPU.TDP != 0) && (p_states[0].Frequency != 0)) {
|
||||
TDPdiv = (gSettings.CPU.TDP * 1000) / p_states[0].Frequency;
|
||||
} else {
|
||||
TDPdiv = 8;
|
||||
}
|
||||
@ -481,7 +481,7 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
|
||||
|
||||
aml_destroy_node(root);
|
||||
|
||||
if (gSettings.ACPI.SSDT.Generate.GeneratePStates && !gSettings.HWP) {
|
||||
if (gSettings.ACPI.SSDT.Generate.GeneratePStates && !GlobalConfig.HWP) {
|
||||
if (gSettings.ACPI.SSDT.PluginType && gSettings.ACPI.SSDT.Generate.GeneratePluginType) {
|
||||
MsgLog ("SSDT with CPU P-States and plugin-type generated successfully\n");
|
||||
} else {
|
||||
@ -502,10 +502,10 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number)
|
||||
|
||||
SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, UINTN Number)
|
||||
{
|
||||
BOOLEAN c2_enabled = gSettings.ACPI.SSDT.EnableC2;
|
||||
BOOLEAN c2_enabled = GlobalConfig.EnableC2;
|
||||
BOOLEAN c3_enabled;
|
||||
BOOLEAN c4_enabled = gSettings.ACPI.SSDT.EnableC4;
|
||||
// BOOLEAN c6_enabled = gSettings.ACPI.SSDT.EnableC6;
|
||||
BOOLEAN c4_enabled = GlobalConfig.EnableC4;
|
||||
// BOOLEAN c6_enabled = GlobalConfig.EnableC6;
|
||||
BOOLEAN cst_using_systemio = gSettings.ACPI.SSDT.EnableISS;
|
||||
UINT8 p_blk_lo, p_blk_hi;
|
||||
UINT8 cstates_count;
|
||||
@ -531,7 +531,7 @@ SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, U
|
||||
c2_enabled = c2_enabled || (fadt->PLvl2Lat < 100);
|
||||
c3_enabled = (fadt->PLvl3Lat < 1000);
|
||||
cstates_count = 1 + (c2_enabled ? 1 : 0) + ((c3_enabled || c4_enabled)? 1 : 0)
|
||||
+ (gSettings.ACPI.SSDT.EnableC6 ? 1 : 0) + (gSettings.ACPI.SSDT.EnableC7 ? 1 : 0);
|
||||
+ (GlobalConfig.EnableC6 ? 1 : 0) + (gSettings.ACPI.SSDT.EnableC7 ? 1 : 0);
|
||||
|
||||
root = aml_create_node(NULL);
|
||||
aml_add_buffer(root, cst_ssdt_header, sizeof(cst_ssdt_header)); // SSDT header
|
||||
@ -586,10 +586,10 @@ SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, U
|
||||
resource_template_register_systemio[12] = p_blk_hi; // C3
|
||||
aml_add_buffer(tmpl, resource_template_register_systemio, sizeof(resource_template_register_systemio));
|
||||
aml_add_byte(tmpl, 0x03); // C3
|
||||
aml_add_word(tmpl, gSettings.ACPI.SSDT.C3Latency); // Latency
|
||||
aml_add_word(tmpl, GlobalConfig.C3Latency); // Latency
|
||||
aml_add_dword(tmpl, 0x000001F4); // Power
|
||||
}
|
||||
if (gSettings.ACPI.SSDT.EnableC6) { // C6
|
||||
if (GlobalConfig.EnableC6) { // C6
|
||||
p_blk_lo = (UINT8)(acpi_cpu_p_blk + 5);
|
||||
p_blk_hi = (UINT8)((acpi_cpu_p_blk + 5) >> 8);
|
||||
|
||||
@ -598,7 +598,7 @@ SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, U
|
||||
resource_template_register_systemio[12] = p_blk_hi; // C6
|
||||
aml_add_buffer(tmpl, resource_template_register_systemio, sizeof(resource_template_register_systemio));
|
||||
aml_add_byte(tmpl, 0x06); // C6
|
||||
aml_add_word(tmpl, gSettings.ACPI.SSDT.C3Latency + 3); // Latency
|
||||
aml_add_word(tmpl, GlobalConfig.C3Latency + 3); // Latency
|
||||
aml_add_dword(tmpl, 0x0000015E); // Power
|
||||
}
|
||||
if (gSettings.ACPI.SSDT.EnableC7) { //C7
|
||||
@ -652,15 +652,15 @@ SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, U
|
||||
resource_template_register_fixedhw[11] = 0x20; // C3
|
||||
aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw));
|
||||
aml_add_byte(tmpl, 0x03); // C3
|
||||
aml_add_word(tmpl, gSettings.ACPI.SSDT.C3Latency); // Latency as in MacPro6,1 = 0x0043
|
||||
aml_add_word(tmpl, GlobalConfig.C3Latency); // Latency as in MacPro6,1 = 0x0043
|
||||
aml_add_dword(tmpl, 0x000001F4); // Power
|
||||
}
|
||||
if (gSettings.ACPI.SSDT.EnableC6) { // C6
|
||||
if (GlobalConfig.EnableC6) { // C6
|
||||
tmpl = aml_add_package(pack);
|
||||
resource_template_register_fixedhw[11] = 0x20; // C6
|
||||
aml_add_buffer(tmpl, resource_template_register_fixedhw, sizeof(resource_template_register_fixedhw));
|
||||
aml_add_byte(tmpl, 0x06); // C6
|
||||
aml_add_word(tmpl, gSettings.ACPI.SSDT.C3Latency + 3); // Latency as in MacPro6,1 = 0x0046
|
||||
aml_add_word(tmpl, GlobalConfig.C3Latency + 3); // Latency as in MacPro6,1 = 0x0046
|
||||
aml_add_dword(tmpl, 0x0000015E); // Power
|
||||
}
|
||||
if (gSettings.ACPI.SSDT.EnableC7) {
|
||||
|
@ -139,7 +139,7 @@ void GetCPUProperties (void)
|
||||
gCPUStructure.MaxRatio = 10; //keep it as K*10
|
||||
gCPUStructure.MinRatio = 10; //same
|
||||
gCPUStructure.SubDivider = 0;
|
||||
gSettings.CpuFreqMHz = 0;
|
||||
gSettings.CPU.CpuFreqMHz = 0;
|
||||
gCPUStructure.FSBFrequency = MultU64x32(gCPUStructure.ExternalClock, Kilo); //kHz -> Hz
|
||||
gCPUStructure.ProcessorInterconnectSpeed = 0;
|
||||
gCPUStructure.Mobile = FALSE; //not same as gMobile
|
||||
@ -1149,7 +1149,7 @@ void GetCPUProperties (void)
|
||||
DBG("qpibusspeed %llukHz\n", qpibusspeed);
|
||||
gCPUStructure.ProcessorInterconnectSpeed = DivU64x32(qpibusspeed, Kilo); //kHz->MHz
|
||||
// set QPI for Nehalem
|
||||
gSettings.QPI = (UINT16)gCPUStructure.ProcessorInterconnectSpeed;
|
||||
gSettings.CPU.QPI = (UINT16)gCPUStructure.ProcessorInterconnectSpeed;
|
||||
|
||||
} else {
|
||||
gCPUStructure.ProcessorInterconnectSpeed = DivU64x32(LShiftU64(gCPUStructure.ExternalClock, 2), Kilo); //kHz->MHz
|
||||
@ -1181,8 +1181,8 @@ void SetCPUProperties (void)
|
||||
UINT64 msr = 0;
|
||||
|
||||
if ((gCPUStructure.CPUID[CPUID_6][ECX] & (1 << 3)) != 0) {
|
||||
if (gSettings.SavingMode != 0xFF) {
|
||||
msr = gSettings.SavingMode;
|
||||
if (gSettings.CPU.SavingMode != 0xFF) {
|
||||
msr = gSettings.CPU.SavingMode;
|
||||
AsmWriteMsr64(IA32_ENERGY_PERF_BIAS, msr);
|
||||
msr = AsmReadMsr64(IA32_ENERGY_PERF_BIAS); //0x1B0
|
||||
MsgLog("MSR 0x1B0 set to %llX\n", msr);
|
||||
|
@ -1446,7 +1446,7 @@ void GetDefaultCpuSettings()
|
||||
MACHINE_TYPES Model;
|
||||
//UINT64 msr = 0;
|
||||
Model = GetDefaultModel();
|
||||
gSettings.CpuType = GetAdvancedCpuType();
|
||||
gSettings.CPU.CpuType = GetAdvancedCpuType();
|
||||
SetDMISettingsForModel(Model, TRUE);
|
||||
|
||||
if (gCPUStructure.Model >= CPU_MODEL_IVY_BRIDGE) {
|
||||
@ -1458,7 +1458,7 @@ void GetDefaultCpuSettings()
|
||||
gSettings.ACPI.SSDT.Generate.GeneratePluginType = gSettings.ACPI.SSDT.Generate.GeneratePStates;
|
||||
// gSettings.ACPI.SSDT.EnableISS = FALSE;
|
||||
// gSettings.ACPI.SSDT.EnableC2 = TRUE;
|
||||
gSettings.ACPI.SSDT.EnableC6 = TRUE;
|
||||
gSettings.ACPI.SSDT._EnableC6 = TRUE;
|
||||
gSettings.ACPI.SSDT.PluginType = 1;
|
||||
|
||||
if (gCPUStructure.Model == CPU_MODEL_IVY_BRIDGE) {
|
||||
@ -1466,12 +1466,12 @@ void GetDefaultCpuSettings()
|
||||
}
|
||||
// gSettings.ACPI.SSDT.DoubleFirstState = FALSE;
|
||||
//gSettings.ACPI.SSDT.DropSSDT = TRUE; //why drop all???
|
||||
gSettings.ACPI.SSDT.C3Latency = 0x00FA;
|
||||
gSettings.ACPI.SSDT._C3Latency = 0x00FA;
|
||||
}
|
||||
gSettings.Turbo = gCPUStructure.Turbo;
|
||||
gSettings.SavingMode = 0xFF; //means not set
|
||||
gSettings.CPU.Turbo = gCPUStructure.Turbo;
|
||||
gSettings.CPU.SavingMode = 0xFF; //means not set
|
||||
|
||||
if (gCPUStructure.Model >= CPU_MODEL_SKYLAKE_D) {
|
||||
gSettings.UseARTFreq = true;
|
||||
gSettings.CPU.UseARTFreq = true;
|
||||
}
|
||||
}
|
||||
|
@ -1930,7 +1930,7 @@ void PatchTableType131()
|
||||
SmbiosTable = GetSmbiosTableFromType (EntryPoint, 131, 0);
|
||||
if (SmbiosTable.Raw != NULL) {
|
||||
MsgLog("Table 131 is present, CPUType=%hX\n", SmbiosTable.Type131->ProcessorType.Type);
|
||||
MsgLog("Change to: %hX\n", gSettings.CpuType);
|
||||
MsgLog("Change to: %hX\n", gSettings.CPU.CpuType);
|
||||
}
|
||||
|
||||
ZeroMem((void*)newSmbiosTable.Type131, MAX_TABLE_SIZE);
|
||||
@ -1938,7 +1938,7 @@ void PatchTableType131()
|
||||
newSmbiosTable.Type131->Hdr.Length = sizeof(SMBIOS_STRUCTURE)+2;
|
||||
newSmbiosTable.Type131->Hdr.Handle = 0x8300; //common rule
|
||||
// Patch ProcessorType
|
||||
newSmbiosTable.Type131->ProcessorType.Type = gSettings.CpuType;
|
||||
newSmbiosTable.Type131->ProcessorType.Type = gSettings.CPU.CpuType;
|
||||
Handle = LogSmbiosTable(newSmbiosTable);
|
||||
return;
|
||||
}
|
||||
@ -1954,7 +1954,7 @@ void PatchTableType132()
|
||||
SmbiosTable = GetSmbiosTableFromType (EntryPoint, 132, 0);
|
||||
if (SmbiosTable.Raw != NULL) {
|
||||
MsgLog("Table 132 is present, QPI=%hX\n", SmbiosTable.Type132->ProcessorBusSpeed);
|
||||
MsgLog("Change to: %hX\n", gSettings.QPI);
|
||||
MsgLog("Change to: %hX\n", gSettings.CPU.QPI);
|
||||
}
|
||||
|
||||
ZeroMem((void*)newSmbiosTable.Type132, MAX_TABLE_SIZE);
|
||||
@ -1963,8 +1963,8 @@ void PatchTableType132()
|
||||
newSmbiosTable.Type132->Hdr.Handle = 0x8400; //ugly
|
||||
|
||||
// Patch ProcessorBusSpeed
|
||||
if(gSettings.QPI){
|
||||
newSmbiosTable.Type132->ProcessorBusSpeed = gSettings.QPI;
|
||||
if(gSettings.CPU.QPI){
|
||||
newSmbiosTable.Type132->ProcessorBusSpeed = gSettings.CPU.QPI;
|
||||
} else {
|
||||
newSmbiosTable.Type132->ProcessorBusSpeed = (UINT16)(LShiftU64(DivU64x32(gCPUStructure.ExternalClock, Kilo), 2));
|
||||
}
|
||||
|
@ -755,8 +755,8 @@ void LOADER_ENTRY::StartLoader()
|
||||
if (EFI_ERROR(Status)) {
|
||||
DBG(" - ... but: %s\n", efiStrError(Status));
|
||||
} else {
|
||||
if ((gSettings.CpuFreqMHz > 100) && (gSettings.CpuFreqMHz < 20000)) {
|
||||
gCPUStructure.MaxSpeed = gSettings.CpuFreqMHz;
|
||||
if ((gSettings.CPU.CpuFreqMHz > 100) && (gSettings.CPU.CpuFreqMHz < 20000)) {
|
||||
gCPUStructure.MaxSpeed = gSettings.CPU.CpuFreqMHz;
|
||||
}
|
||||
//CopyMem(KernelAndKextPatches,
|
||||
// &gSettings.KernelAndKextPatches,
|
||||
@ -772,8 +772,8 @@ void LOADER_ENTRY::StartLoader()
|
||||
DivU64x32(gCPUStructure.ExternalClock + Kilo - 1, Kilo),
|
||||
DivU64x32(gCPUStructure.FSBFrequency + Kilo - 1, Kilo),
|
||||
gCPUStructure.MaxSpeed);
|
||||
if (gSettings.QPI) {
|
||||
DBG(" QPI: hw.busfrequency=%lluHz\n", MultU64x32(gSettings.QPI, Mega));
|
||||
if (gSettings.CPU.QPI) {
|
||||
DBG(" QPI: hw.busfrequency=%lluHz\n", MultU64x32(gSettings.CPU.QPI, Mega));
|
||||
} else {
|
||||
// to match the value of hw.busfrequency in the terminal
|
||||
DBG(" PIS: hw.busfrequency=%lluHz\n", MultU64x32(LShiftU64(DivU64x32(gCPUStructure.ExternalClock + Kilo - 1, Kilo), 2), Mega));
|
||||
@ -2613,6 +2613,18 @@ void afterGetUserSettings(const SETTINGS_DATA& gSettings)
|
||||
}
|
||||
DBG("Custom boot %s (0x%llX)\n", CustomBootModeToStr(GlobalConfig.CustomBoot), (uintptr_t)GlobalConfig.CustomLogo);
|
||||
|
||||
GlobalConfig.EnableC6 = gSettings.getEnableC6();
|
||||
GlobalConfig.EnableC4 = gSettings.getEnableC4();
|
||||
GlobalConfig.EnableC2 = gSettings.getEnableC2();
|
||||
GlobalConfig.C3Latency = gSettings.getEnableC6();
|
||||
|
||||
if (gSettings.CPU.HWPEnable && (gCPUStructure.Model >= CPU_MODEL_SKYLAKE_U)) {
|
||||
GlobalConfig.HWP = TRUE;
|
||||
AsmWriteMsr64 (MSR_IA32_PM_ENABLE, 1);
|
||||
if ( gSettings.CPU.HWPValue.isDefined() ) {
|
||||
AsmWriteMsr64 (MSR_IA32_HWP_REQUEST, gSettings.CPU.HWPValue);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
@ -3070,13 +3082,13 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
}
|
||||
|
||||
|
||||
if (gSettings.QEMU) {
|
||||
if (gSettings.CPU.QEMU) {
|
||||
// UINT64 Msrflex = 0ULL;
|
||||
|
||||
if (!gSettings.UserChange) {
|
||||
gSettings.BusSpeed = 200000;
|
||||
if (!gSettings.CPU.UserChange) {
|
||||
gSettings.CPU.BusSpeed = 200000;
|
||||
}
|
||||
gCPUStructure.MaxRatio = (UINT32)DivU64x32(gCPUStructure.TSCCalibr, gSettings.BusSpeed * Kilo);
|
||||
gCPUStructure.MaxRatio = (UINT32)DivU64x32(gCPUStructure.TSCCalibr, gSettings.CPU.BusSpeed * Kilo);
|
||||
DBG("Set MaxRatio for QEMU: %d\n", gCPUStructure.MaxRatio);
|
||||
gCPUStructure.MaxRatio *= 10;
|
||||
gCPUStructure.MinRatio = 60;
|
||||
|
@ -164,15 +164,15 @@ void FillInputs(BOOLEAN New)
|
||||
InputItems[InputItemsCount].ItemType = BoolValue; //9
|
||||
InputItems[InputItemsCount++].BValue = gSettings.ACPI.SSDT.Generate.GenerateCStates;
|
||||
InputItems[InputItemsCount].ItemType = BoolValue; //10
|
||||
InputItems[InputItemsCount++].BValue = gSettings.ACPI.SSDT.EnableC2;
|
||||
InputItems[InputItemsCount++].BValue = GlobalConfig.EnableC2;
|
||||
InputItems[InputItemsCount].ItemType = BoolValue; //11
|
||||
InputItems[InputItemsCount++].BValue = gSettings.ACPI.SSDT.EnableC4;
|
||||
InputItems[InputItemsCount++].BValue = GlobalConfig.EnableC4;
|
||||
InputItems[InputItemsCount].ItemType = BoolValue; //12
|
||||
InputItems[InputItemsCount++].BValue = gSettings.ACPI.SSDT.EnableC6;
|
||||
InputItems[InputItemsCount++].BValue = GlobalConfig.EnableC6;
|
||||
InputItems[InputItemsCount].ItemType = BoolValue; //13
|
||||
InputItems[InputItemsCount++].BValue = gSettings.ACPI.SSDT.EnableISS;
|
||||
InputItems[InputItemsCount].ItemType = Decimal; //14
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%06d", gSettings.QPI);
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%06d", gSettings.CPU.QPI);
|
||||
InputItems[InputItemsCount].ItemType = BoolValue; //15
|
||||
InputItems[InputItemsCount++].BValue = gSettings.ACPI.PatchNMI;
|
||||
InputItems[InputItemsCount].ItemType = BoolValue; //16
|
||||
@ -182,8 +182,8 @@ void FillInputs(BOOLEAN New)
|
||||
InputItems[InputItemsCount].ItemType = Hex; //18
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("0x%hX", gSettings.BacklightLevel);
|
||||
InputItems[InputItemsCount].ItemType = Decimal; //19
|
||||
if (gSettings.BusSpeed > 20000) {
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%06d", gSettings.BusSpeed);
|
||||
if (gSettings.CPU.BusSpeed > 20000) {
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%06d", gSettings.CPU.BusSpeed);
|
||||
} else {
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%06llu", gCPUStructure.ExternalClock);
|
||||
}
|
||||
@ -330,11 +330,11 @@ void FillInputs(BOOLEAN New)
|
||||
InputItems[InputItemsCount++].BValue = gSettings.USBFixOwnership;
|
||||
|
||||
InputItems[InputItemsCount].ItemType = Hex; //75
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("0x%04hX", gSettings.ACPI.SSDT.C3Latency);
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("0x%04hX", GlobalConfig.C3Latency);
|
||||
InputItems[InputItemsCount].ItemType = Decimal; //76
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%02d", gSettings.EnabledCores);
|
||||
InputItems[InputItemsCount].ItemType = Decimal; //77
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%02d", gSettings.SavingMode);
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%02d", gSettings.CPU.SavingMode);
|
||||
|
||||
InputItems[InputItemsCount].ItemType = ASString; //78
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.ProductName.c_str());
|
||||
@ -529,15 +529,15 @@ void ApplyInputs(void)
|
||||
}
|
||||
i++; //10
|
||||
if (InputItems[i].Valid) {
|
||||
gSettings.ACPI.SSDT.EnableC2 = InputItems[i].BValue;
|
||||
GlobalConfig.EnableC2 = InputItems[i].BValue;
|
||||
}
|
||||
i++; //11
|
||||
if (InputItems[i].Valid) {
|
||||
gSettings.ACPI.SSDT.EnableC4 = InputItems[i].BValue;
|
||||
GlobalConfig.EnableC4 = InputItems[i].BValue;
|
||||
}
|
||||
i++; //12
|
||||
if (InputItems[i].Valid) {
|
||||
gSettings.ACPI.SSDT.EnableC6 = InputItems[i].BValue;
|
||||
GlobalConfig.EnableC6 = InputItems[i].BValue;
|
||||
}
|
||||
i++; //13
|
||||
if (InputItems[i].Valid) {
|
||||
@ -545,8 +545,8 @@ void ApplyInputs(void)
|
||||
}
|
||||
i++; //14
|
||||
if (InputItems[i].Valid) {
|
||||
gSettings.QPI = (UINT16)StrDecimalToUintn(InputItems[i].SValue.wc_str());
|
||||
DBG("applied QPI=%d\n", gSettings.QPI);
|
||||
gSettings.CPU.QPI = (UINT16)StrDecimalToUintn(InputItems[i].SValue.wc_str());
|
||||
DBG("applied QPI=%d\n", gSettings.CPU.QPI);
|
||||
}
|
||||
i++; //15
|
||||
if (InputItems[i].Valid) {
|
||||
@ -568,8 +568,8 @@ void ApplyInputs(void)
|
||||
}
|
||||
i++; //19
|
||||
if (InputItems[i].Valid) {
|
||||
gSettings.BusSpeed = (UINT32)StrDecimalToUintn(InputItems[i].SValue.wc_str());
|
||||
DBG("applied BusSpeed=%d\n", gSettings.BusSpeed);
|
||||
gSettings.CPU.BusSpeed = (UINT32)StrDecimalToUintn(InputItems[i].SValue.wc_str());
|
||||
DBG("applied BusSpeed=%d\n", gSettings.CPU.BusSpeed);
|
||||
}
|
||||
|
||||
i = 19;
|
||||
@ -785,7 +785,7 @@ void ApplyInputs(void)
|
||||
}
|
||||
i++; //75
|
||||
if (InputItems[i].Valid) {
|
||||
gSettings.ACPI.SSDT.C3Latency = (UINT16)StrHexToUint64(InputItems[i].SValue.wc_str());
|
||||
GlobalConfig.C3Latency = (UINT16)StrHexToUint64(InputItems[i].SValue.wc_str());
|
||||
}
|
||||
|
||||
i++; //76
|
||||
@ -794,7 +794,7 @@ void ApplyInputs(void)
|
||||
}
|
||||
i++; //77
|
||||
if (InputItems[i].Valid) {
|
||||
gSettings.SavingMode = (UINT8)StrDecimalToUintn(InputItems[i].SValue.wc_str());
|
||||
gSettings.CPU.SavingMode = (UINT8)StrDecimalToUintn(InputItems[i].SValue.wc_str());
|
||||
}
|
||||
|
||||
i++; //78
|
||||
|
Loading…
Reference in New Issue
Block a user