Create section Smbios and BootGraphics.

Move OptionsBits and FlagsBits in GlobalConfig.
Move OEMVendor, OEMProduct, OEMBoard in GlobalConfig.
Move KernelPatchesAllowed, KextPatchesAllowed, EnabledCores and
BlockKexts in GlobalConfig.
Create RomVersionUsed, EfiVersionUsed and ReleaseDateUsed in
GlobalConfig.
Move gFwFeatures, gFwFeaturesMask, gPlatformFeature, SlotDevices in
Smbios section.
Move UserInUse, UserChannels and User from gRAM to Smbios settings
section.
Rename enum LANGUAGES to LanguageCode.
This commit is contained in:
jief666 2021-04-03 17:42:49 +03:00
parent d54fc63747
commit 6ff5bab8a5
24 changed files with 841 additions and 905 deletions

View File

@ -1,22 +0,0 @@
//
// tmp.c
// cpp_tests_compare_settings UTF16 signed char
//
// Created by Jief on 06/02/2021.
// Copyright © 2021 JF Knudsen. All rights reserved.
//
#include "tmp.h"
//
//int __vsnprintf_chk (char* buf, size_t len, int check, size_t size, const char* format, va_list va)
//{
// return 0;
//}
extern "C" void tmp()
{
wprintf(L"%ls\n", L"Hello world൧楔");
}

View File

@ -1,14 +0,0 @@
//
// tmp.h
// cpp_tests_compare_settings UTF16 signed char
//
// Created by Jief on 06/02/2021.
// Copyright © 2021 JF Knudsen. All rights reserved.
//
#ifndef tmp_h
#define tmp_h
#include <stdio.h>
#endif /* tmp_h */

View File

@ -1855,7 +1855,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion)
DBG("old FADT length=%X\n", oldLength); DBG("old FADT length=%X\n", oldLength);
CopyMem(newFadt, FadtPointer, oldLength); //old data CopyMem(newFadt, FadtPointer, oldLength); //old data
newFadt->Header.Length = 0xF4; newFadt->Header.Length = 0xF4;
CopyMem(newFadt->Header.OemId, BiosVendor.c_str(), 6); CopyMem(newFadt->Header.OemId, AppleBiosVendor.c_str(), 6);
if (newFadt->Header.Revision < EFI_ACPI_4_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION) { if (newFadt->Header.Revision < EFI_ACPI_4_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION) {
newFadt->Header.Revision = EFI_ACPI_4_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION; newFadt->Header.Revision = EFI_ACPI_4_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION;
} }

View File

@ -21,7 +21,7 @@
// //
// 2019/06/08 // 2019/06/08
// vector sigma // vector sigma
// don't inject REV, RBr and EPCI keys if gSettings.REV is zeroed // don't inject REV, RBr and EPCI keys if gSettings.Smbios.REV is zeroed
// //
#ifndef DEBUG_ALL #ifndef DEBUG_ALL
@ -268,18 +268,18 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
SetNvramVariable(L"FirmwareFeatures", SetNvramVariable(L"FirmwareFeatures",
&gEfiAppleNvramGuid, &gEfiAppleNvramGuid,
Attributes, Attributes,
sizeof(gFwFeatures), sizeof(gSettings.Smbios.gFwFeatures),
&gFwFeatures); &gSettings.Smbios.gFwFeatures);
// Download-Fritz: Should be added to SMBIOS or at least to some other config section // Download-Fritz: Should be added to SMBIOS or at least to some other config section
AddNvramVariable(L"FirmwareFeaturesMask", AddNvramVariable(L"FirmwareFeaturesMask",
&gEfiAppleNvramGuid, &gEfiAppleNvramGuid,
Attributes, Attributes,
sizeof(gFwFeaturesMask), sizeof(gSettings.Smbios.gFwFeaturesMask),
&gFwFeaturesMask); &gSettings.Smbios.gFwFeaturesMask);
// HW_MLB and HW_ROM are also around on some Macs with the same values as MLB and ROM // HW_MLB and HW_ROM are also around on some Macs with the same values as MLB and ROM
AddNvramXString8(L"HW_BID", &gEfiAppleNvramGuid, Attributes, gSettings.BoardNumber); AddNvramXString8(L"HW_BID", &gEfiAppleNvramGuid, Attributes, gSettings.Smbios.BoardNumber);
// //
@ -295,8 +295,8 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
KbdPrevLang = L"prev-lang:kbd"; KbdPrevLang = L"prev-lang:kbd";
OldData = (__typeof__(OldData))GetNvramVariable(KbdPrevLang, &gEfiAppleBootGuid, NULL, NULL); OldData = (__typeof__(OldData))GetNvramVariable(KbdPrevLang, &gEfiAppleBootGuid, NULL, NULL);
if (OldData == NULL) { if (OldData == NULL) {
gSettings.Language.trim(); gSettings.GUI.Language.trim();
SetNvramXString8(KbdPrevLang, &gEfiAppleBootGuid, Attributes, gSettings.Language); SetNvramXString8(KbdPrevLang, &gEfiAppleBootGuid, Attributes, gSettings.GUI.Language);
} else { } else {
FreePool(OldData); FreePool(OldData);
} }
@ -327,7 +327,7 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
// we should have two UUID: platform and system // we should have two UUID: platform and system
// NO! Only Platform is the best solution // NO! Only Platform is the best solution
if (!gSettings.ShouldInjectSystemID()) { if (!gSettings.ShouldInjectSystemID()) {
if (gSettings.SmUUID.notEmpty()) { if (gSettings.Smbios.SmUUID.notEmpty()) {
SetNvramVariable(L"platform-uuid", &gEfiAppleBootGuid, Attributes, sizeof(uuid), &uuid); SetNvramVariable(L"platform-uuid", &gEfiAppleBootGuid, Attributes, sizeof(uuid), &uuid);
} else { } else {
AddNvramVariable(L"platform-uuid", &gEfiAppleBootGuid, Attributes, sizeof(uuid), &uuid); AddNvramVariable(L"platform-uuid", &gEfiAppleBootGuid, Attributes, sizeof(uuid), &uuid);
@ -343,13 +343,13 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
} }
} }
if (gSettings.DefaultBackgroundColor == 0x80000000) { if (gSettings.BootGraphics.DefaultBackgroundColor == 0x80000000) {
DeleteNvramVariable(L"DefaultBackgroundColor", &gEfiAppleNvramGuid); DeleteNvramVariable(L"DefaultBackgroundColor", &gEfiAppleNvramGuid);
} else { } else {
UINT16 ActualDensity = 0xE1; UINT16 ActualDensity = 0xE1;
UINT16 DensityThreshold = 0x96; UINT16 DensityThreshold = 0x96;
UINT64 ConfigStatus = 0; UINT64 ConfigStatus = 0;
Color = gSettings.DefaultBackgroundColor; Color = gSettings.BootGraphics.DefaultBackgroundColor;
DBG("set DefaultBackgroundColor=0x%x\n", Color); DBG("set DefaultBackgroundColor=0x%x\n", Color);
SetNvramVariable(L"DefaultBackgroundColor", &gEfiAppleNvramGuid, Attributes, 4, &Color); SetNvramVariable(L"DefaultBackgroundColor", &gEfiAppleNvramGuid, Attributes, 4, &Color);
// add some UI variables // add some UI variables
@ -358,23 +358,23 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
SetNvramVariable(L"gfx-saved-config-restore-status", &gEfiAppleNvramGuid, Attributes, 8, &ConfigStatus); SetNvramVariable(L"gfx-saved-config-restore-status", &gEfiAppleNvramGuid, Attributes, 8, &ConfigStatus);
} }
if (gSettings.UIScale == 0x80000000) { if (gSettings.BootGraphics.UIScale == 0x80000000) {
DeleteNvramVariable(L"UIScale", &gEfiAppleNvramGuid); DeleteNvramVariable(L"UIScale", &gEfiAppleNvramGuid);
} else { } else {
SetNvramVariable(L"UIScale", &gEfiAppleNvramGuid, Attributes, 1, &gSettings.UIScale); SetNvramVariable(L"UIScale", &gEfiAppleNvramGuid, Attributes, 1, &gSettings.BootGraphics.UIScale);
} }
if (gSettings.EFILoginHiDPI == 0x80000000) { if (gSettings.BootGraphics.EFILoginHiDPI == 0x80000000) {
DeleteNvramVariable(L"EFILoginHiDPI", &gEfiAppleBootGuid); DeleteNvramVariable(L"EFILoginHiDPI", &gEfiAppleBootGuid);
} else { } else {
SetNvramVariable(L"EFILoginHiDPI", &gEfiAppleBootGuid, Attributes, 4, &gSettings.EFILoginHiDPI); SetNvramVariable(L"EFILoginHiDPI", &gEfiAppleBootGuid, Attributes, 4, &gSettings.BootGraphics.EFILoginHiDPI);
} }
// ->GetVariable(flagstate, gEfiAppleBootGuid, 0/0, 20, 10FE110) = Not Found // ->GetVariable(flagstate, gEfiAppleBootGuid, 0/0, 20, 10FE110) = Not Found
if (gSettings.flagstate[3] == 0x80) { if (gSettings.BootGraphics.flagstate[3] == 0x80) {
DeleteNvramVariable(L"flagstate", &gEfiAppleBootGuid); DeleteNvramVariable(L"flagstate", &gEfiAppleBootGuid);
} else { } else {
SetNvramVariable(L"flagstate", &gEfiAppleBootGuid, Attributes, 32, &gSettings.flagstate); SetNvramVariable(L"flagstate", &gEfiAppleBootGuid, Attributes, 32, &gSettings.BootGraphics.flagstate);
} }
// Hack for recovery by Asgorath // Hack for recovery by Asgorath
@ -456,12 +456,12 @@ SetupDataForOSX(BOOLEAN Hibernate)
UINT64 ARTFrequency; UINT64 ARTFrequency;
UINTN Revision; UINTN Revision;
UINT16 Zero = 0; UINT16 Zero = 0;
BOOLEAN isRevLess = (gSettings.REV[0] == 0 && BOOLEAN isRevLess = (gSettings.Smbios.REV[0] == 0 &&
gSettings.REV[1] == 0 && gSettings.Smbios.REV[1] == 0 &&
gSettings.REV[2] == 0 && gSettings.Smbios.REV[2] == 0 &&
gSettings.REV[3] == 0 && gSettings.Smbios.REV[3] == 0 &&
gSettings.REV[4] == 0 && gSettings.Smbios.REV[4] == 0 &&
gSettings.REV[5] == 0); gSettings.Smbios.REV[5] == 0);
Revision = StrDecimalToUintn(gFirmwareRevision); Revision = StrDecimalToUintn(gFirmwareRevision);
@ -497,10 +497,10 @@ SetupDataForOSX(BOOLEAN Hibernate)
Status = gBS->LocateProtocol(&gEfiDataHubProtocolGuid, NULL, (void**)&gDataHub); Status = gBS->LocateProtocol(&gEfiDataHubProtocolGuid, NULL, (void**)&gDataHub);
if (!EFI_ERROR(Status)) { if (!EFI_ERROR(Status)) {
XStringW ProductName; XStringW ProductName;
ProductName.takeValueFrom(gSettings.ProductName); ProductName.takeValueFrom(gSettings.Smbios.ProductName);
XStringW SerialNumber; XStringW SerialNumber;
SerialNumber.takeValueFrom(gSettings.SerialNr); SerialNumber.takeValueFrom(gSettings.Smbios.SerialNr);
LogDataHub(&gEfiProcessorSubClassGuid, L"FSBFrequency", &FrontSideBus, sizeof(UINT64)); LogDataHub(&gEfiProcessorSubClassGuid, L"FSBFrequency", &FrontSideBus, sizeof(UINT64));
@ -513,8 +513,8 @@ SetupDataForOSX(BOOLEAN Hibernate)
LogDataHub(&gEfiProcessorSubClassGuid, L"InitialTSC", &TscFrequency, sizeof(UINT64)); LogDataHub(&gEfiProcessorSubClassGuid, L"InitialTSC", &TscFrequency, sizeof(UINT64));
LogDataHub(&gEfiProcessorSubClassGuid, L"CPUFrequency", &CpuSpeed, sizeof(UINT64)); LogDataHub(&gEfiProcessorSubClassGuid, L"CPUFrequency", &CpuSpeed, sizeof(UINT64));
//gSettings.BoardNumber //gSettings.Smbios.BoardNumber
LogDataHubXString8(&gEfiMiscSubClassGuid, L"board-id", gSettings.BoardNumber); LogDataHubXString8(&gEfiMiscSubClassGuid, L"board-id", gSettings.Smbios.BoardNumber);
TscFrequency++; TscFrequency++;
LogDataHub(&gEfiProcessorSubClassGuid, L"board-rev", &TscFrequency, 1); LogDataHub(&gEfiProcessorSubClassGuid, L"board-rev", &TscFrequency, 1);
@ -532,18 +532,18 @@ SetupDataForOSX(BOOLEAN Hibernate)
LogDataHub(&gEfiProcessorSubClassGuid, L"clovergui-revision", &Revision, sizeof(UINT32)); LogDataHub(&gEfiProcessorSubClassGuid, L"clovergui-revision", &Revision, sizeof(UINT32));
// collect info about real hardware // collect info about real hardware
LogDataHubXString8(&gEfiMiscSubClassGuid, L"OEMVendor", gSettings.OEMVendor); LogDataHubXString8(&gEfiMiscSubClassGuid, L"OEMVendor", GlobalConfig.OEMVendorFromSmbios);
LogDataHubXString8(&gEfiMiscSubClassGuid, L"OEMProduct", gSettings.OEMProduct); LogDataHubXString8(&gEfiMiscSubClassGuid, L"OEMProduct", GlobalConfig.OEMProductFromSmbios);
LogDataHubXString8(&gEfiMiscSubClassGuid, L"OEMBoard", gSettings.OEMBoard); LogDataHubXString8(&gEfiMiscSubClassGuid, L"OEMBoard", GlobalConfig.OEMBoardFromSmbios);
// SMC helper // SMC helper
if (!isRevLess) { if (!isRevLess) {
LogDataHub(&gEfiMiscSubClassGuid, L"RBr", &gSettings.RBr, 8); LogDataHub(&gEfiMiscSubClassGuid, L"RBr", &gSettings.Smbios.RBr, 8);
LogDataHub(&gEfiMiscSubClassGuid, L"EPCI", &gSettings.EPCI, 4); LogDataHub(&gEfiMiscSubClassGuid, L"EPCI", &gSettings.Smbios.EPCI, 4);
LogDataHub(&gEfiMiscSubClassGuid, L"REV", &gSettings.REV, 6); LogDataHub(&gEfiMiscSubClassGuid, L"REV", &gSettings.Smbios.REV, 6);
} }
LogDataHub(&gEfiMiscSubClassGuid, L"RPlt", &gSettings.RPlt, 8); LogDataHub(&gEfiMiscSubClassGuid, L"RPlt", &gSettings.Smbios.RPlt, 8);
LogDataHub(&gEfiMiscSubClassGuid, L"BEMB", &gSettings.Mobile, 1); LogDataHub(&gEfiMiscSubClassGuid, L"BEMB", &gSettings.Smbios.Mobile, 1);
// all current settings // all current settings
// XBuffer<UINT8> xb = gSettings.serialize(); // XBuffer<UINT8> xb = gSettings.serialize();
@ -555,18 +555,18 @@ SetupDataForOSX(BOOLEAN Hibernate)
return; return;
} }
if (!isRevLess) { if (!isRevLess) {
AddSMCkey(SMC_MAKE_KEY('R','B','r',' '), 8, SmcKeyTypeCh8, (SMC_DATA *)&gSettings.RBr); AddSMCkey(SMC_MAKE_KEY('R','B','r',' '), 8, SmcKeyTypeCh8, (SMC_DATA *)&gSettings.Smbios.RBr);
AddSMCkey(SMC_MAKE_KEY('E','P','C','I'), 4, SmcKeyTypeUint32, (SMC_DATA *)&gSettings.EPCI); AddSMCkey(SMC_MAKE_KEY('E','P','C','I'), 4, SmcKeyTypeUint32, (SMC_DATA *)&gSettings.Smbios.EPCI);
AddSMCkey(SMC_MAKE_KEY('R','E','V',' '), 6, SmcKeyTypeCh8, (SMC_DATA *)&gSettings.REV); AddSMCkey(SMC_MAKE_KEY('R','E','V',' '), 6, SmcKeyTypeCh8, (SMC_DATA *)&gSettings.Smbios.REV);
} }
AddSMCkey(SMC_MAKE_KEY('R','P','l','t'), 8, SmcKeyTypeCh8, (SMC_DATA *)&gSettings.RPlt); AddSMCkey(SMC_MAKE_KEY('R','P','l','t'), 8, SmcKeyTypeCh8, (SMC_DATA *)&gSettings.Smbios.RPlt);
AddSMCkey(SMC_MAKE_KEY('B','E','M','B'), 1, SmcKeyTypeFlag, (SMC_DATA *)&gSettings.Mobile); AddSMCkey(SMC_MAKE_KEY('B','E','M','B'), 1, SmcKeyTypeFlag, (SMC_DATA *)&gSettings.Smbios.Mobile);
//laptop battery keys will be better to import from nvram.plist or read from ACPI(?) //laptop battery keys will be better to import from nvram.plist or read from ACPI(?)
//they are needed for FileVault2 who want to draw battery status //they are needed for FileVault2 who want to draw battery status
AddSMCkey(SMC_MAKE_KEY('B','A','T','P'), 1, SmcKeyTypeFlag, (SMC_DATA *)&Zero); //isBatteryPowered AddSMCkey(SMC_MAKE_KEY('B','A','T','P'), 1, SmcKeyTypeFlag, (SMC_DATA *)&Zero); //isBatteryPowered
AddSMCkey(SMC_MAKE_KEY('B','N','u','m'), 1, SmcKeyTypeUint8, (SMC_DATA *)&gSettings.Mobile); // Num Batteries AddSMCkey(SMC_MAKE_KEY('B','N','u','m'), 1, SmcKeyTypeUint8, (SMC_DATA *)&gSettings.Smbios.Mobile); // Num Batteries
if (gSettings.Mobile) { if (gSettings.Smbios.Mobile) {
AddSMCkey(SMC_MAKE_KEY('B','B','I','N'), 1, SmcKeyTypeUint8, (SMC_DATA *)&gSettings.Mobile); //Battery inserted AddSMCkey(SMC_MAKE_KEY('B','B','I','N'), 1, SmcKeyTypeUint8, (SMC_DATA *)&gSettings.Smbios.Mobile); //Battery inserted
} }
AddSMCkey(SMC_MAKE_KEY('M','S','T','c'), 1, SmcKeyTypeUint8, (SMC_DATA *)&Zero); // CPU Plimit AddSMCkey(SMC_MAKE_KEY('M','S','T','c'), 1, SmcKeyTypeUint8, (SMC_DATA *)&Zero); // CPU Plimit
AddSMCkey(SMC_MAKE_KEY('M','S','A','c'), 2, SmcKeyTypeUint16, (SMC_DATA *)&Zero);// GPU Plimit AddSMCkey(SMC_MAKE_KEY('M','S','A','c'), 2, SmcKeyTypeUint16, (SMC_DATA *)&Zero);// GPU Plimit

View File

@ -3071,11 +3071,11 @@ UINT32 FIXNetwork (UINT8 *dsdt, UINT32 len, UINT32 card)
k = FindName(dsdt + i, Size, "_SUN"); k = FindName(dsdt + i, Size, "_SUN");
if (k == 0) { if (k == 0) {
aml_add_name(dev, "_SUN"); aml_add_name(dev, "_SUN");
aml_add_dword(dev, SlotDevices[5].SlotID); aml_add_dword(dev, gSettings.Smbios.SlotDevices[5].SlotID);
} else { } else {
//we have name sun, set the number //we have name sun, set the number
if (dsdt[k + 4] == 0x0A) { if (dsdt[k + 4] == 0x0A) {
dsdt[k + 5] = SlotDevices[5].SlotID; dsdt[k + 5] = gSettings.Smbios.SlotDevices[5].SlotID;
} }
} }
} }
@ -3262,11 +3262,11 @@ UINT32 FIXAirport (UINT8 *dsdt, UINT32 len)
k = FindName(dsdt + i, Size, "_SUN"); k = FindName(dsdt + i, Size, "_SUN");
if (k == 0) { if (k == 0) {
aml_add_name(dev, "_SUN"); aml_add_name(dev, "_SUN");
aml_add_dword(dev, SlotDevices[6].SlotID); aml_add_dword(dev, gSettings.Smbios.SlotDevices[6].SlotID);
} else { } else {
//we have name sun, set the number //we have name sun, set the number
if (dsdt[k + 4] == 0x0A) { if (dsdt[k + 4] == 0x0A) {
dsdt[k + 5] = SlotDevices[6].SlotID; dsdt[k + 5] = gSettings.Smbios.SlotDevices[6].SlotID;
} }
} }
} else { } else {
@ -3700,11 +3700,11 @@ UINT32 FIXFirewire (UINT8 *dsdt, UINT32 len)
k = FindName(dsdt + i, Size, "_SUN"); k = FindName(dsdt + i, Size, "_SUN");
if (k == 0) { if (k == 0) {
aml_add_name(device, "_SUN"); aml_add_name(device, "_SUN");
aml_add_dword(device, SlotDevices[12].SlotID); aml_add_dword(device, gSettings.Smbios.SlotDevices[12].SlotID);
} else { } else {
//we have name sun, set the number //we have name sun, set the number
if (dsdt[k + 4] == 0x0A) { if (dsdt[k + 4] == 0x0A) {
dsdt[k + 5] = SlotDevices[12].SlotID; dsdt[k + 5] = gSettings.Smbios.SlotDevices[12].SlotID;
} }
} }
} else { } else {

View File

@ -78,7 +78,6 @@ SETTINGS_DATA gSettings;
GFX_PROPERTIES gGraphics[4]; //no more then 4 graphics cards GFX_PROPERTIES gGraphics[4]; //no more then 4 graphics cards
HDA_PROPERTIES gAudios[4]; //no more then 4 Audio Controllers HDA_PROPERTIES gAudios[4]; //no more then 4 Audio Controllers
//SLOT_DEVICE Arpt; //SLOT_DEVICE Arpt;
SLOT_DEVICE SlotDevices[16]; //assume DEV_XXX, Arpt=6
EFI_EDID_DISCOVERED_PROTOCOL *EdidDiscovered; EFI_EDID_DISCOVERED_PROTOCOL *EdidDiscovered;
//UINT8 *gEDID = NULL; //UINT8 *gEDID = NULL;
//EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; //EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
@ -2481,10 +2480,10 @@ EFI_STATUS GetEarlyUserSettings (
// } // }
// } // }
gSettings.KextPatchesAllowed = TRUE; // todo move to GlobalConfig GlobalConfig.KextPatchesAllowed = TRUE;
GlobalConfig.KernelPatchesAllowed = TRUE;
gSettings.KernelAndKextPatches.KPAppleRTC = TRUE; gSettings.KernelAndKextPatches.KPAppleRTC = TRUE;
gSettings.KernelAndKextPatches.KPDELLSMBIOS = FALSE; // default is false gSettings.KernelAndKextPatches.KPDELLSMBIOS = FALSE; // default is false
gSettings.KernelPatchesAllowed = TRUE; // todo move to GlobalConfig
if (CfgDict != NULL) { if (CfgDict != NULL) {
//DBG("Loading early settings\n"); //DBG("Loading early settings\n");
@ -2881,49 +2880,49 @@ EFI_STATUS GetEarlyUserSettings (
Prop = GUIDict->propertyForKey("Language"); Prop = GUIDict->propertyForKey("Language");
if (Prop != NULL) { if (Prop != NULL) {
gSettings.Language = Prop->getString()->stringValue(); gSettings.GUI.Language = Prop->getString()->stringValue();
if ( Prop->getString()->stringValue().contains("en") ) { if ( Prop->getString()->stringValue().contains("en") ) {
gSettings.GUI.Language = english; gSettings.GUI.languageCode = english;
// gSettings.GUI.Codepage = 0xC0; // gSettings.GUI.Codepage = 0xC0;
// gSettings.GUI.CodepageSize = 0; // gSettings.GUI.CodepageSize = 0;
} else if ( Prop->getString()->stringValue().contains("ru")) { } else if ( Prop->getString()->stringValue().contains("ru")) {
gSettings.GUI.Language = russian; gSettings.GUI.languageCode = russian;
// gSettings.GUI.Codepage = 0x410; // gSettings.GUI.Codepage = 0x410;
// gSettings.GUI.CodepageSize = 0x40; // gSettings.GUI.CodepageSize = 0x40;
} else if ( Prop->getString()->stringValue().contains("ua")) { } else if ( Prop->getString()->stringValue().contains("ua")) {
gSettings.GUI.Language = ukrainian; gSettings.GUI.languageCode = ukrainian;
// gSettings.GUI.Codepage = 0x400; // gSettings.GUI.Codepage = 0x400;
// gSettings.GUI.CodepageSize = 0x60; // gSettings.GUI.CodepageSize = 0x60;
} else if ( Prop->getString()->stringValue().contains("fr")) { } else if ( Prop->getString()->stringValue().contains("fr")) {
gSettings.GUI.Language = french; //default is extended latin gSettings.GUI.languageCode = french; //default is extended latin
} else if ( Prop->getString()->stringValue().contains("it")) { } else if ( Prop->getString()->stringValue().contains("it")) {
gSettings.GUI.Language = italian; gSettings.GUI.languageCode = italian;
} else if ( Prop->getString()->stringValue().contains("es")) { } else if ( Prop->getString()->stringValue().contains("es")) {
gSettings.GUI.Language = spanish; gSettings.GUI.languageCode = spanish;
} else if ( Prop->getString()->stringValue().contains("pt")) { } else if ( Prop->getString()->stringValue().contains("pt")) {
gSettings.GUI.Language = portuguese; gSettings.GUI.languageCode = portuguese;
} else if ( Prop->getString()->stringValue().contains("br")) { } else if ( Prop->getString()->stringValue().contains("br")) {
gSettings.GUI.Language = brasil; gSettings.GUI.languageCode = brasil;
} else if ( Prop->getString()->stringValue().contains("de")) { } else if ( Prop->getString()->stringValue().contains("de")) {
gSettings.GUI.Language = german; gSettings.GUI.languageCode = german;
} else if ( Prop->getString()->stringValue().contains("nl")) { } else if ( Prop->getString()->stringValue().contains("nl")) {
gSettings.GUI.Language = dutch; gSettings.GUI.languageCode = dutch;
} else if ( Prop->getString()->stringValue().contains("pl")) { } else if ( Prop->getString()->stringValue().contains("pl")) {
gSettings.GUI.Language = polish; gSettings.GUI.languageCode = polish;
} else if ( Prop->getString()->stringValue().contains("cz")) { } else if ( Prop->getString()->stringValue().contains("cz")) {
gSettings.GUI.Language = czech; gSettings.GUI.languageCode = czech;
} else if ( Prop->getString()->stringValue().contains("hr")) { } else if ( Prop->getString()->stringValue().contains("hr")) {
gSettings.GUI.Language = croatian; gSettings.GUI.languageCode = croatian;
} else if ( Prop->getString()->stringValue().contains("id")) { } else if ( Prop->getString()->stringValue().contains("id")) {
gSettings.GUI.Language = indonesian; gSettings.GUI.languageCode = indonesian;
} else if ( Prop->getString()->stringValue().contains("zh_CN")) { } else if ( Prop->getString()->stringValue().contains("zh_CN")) {
gSettings.GUI.Language = chinese; gSettings.GUI.languageCode = chinese;
// gSettings.GUI.Codepage = 0x3400; // gSettings.GUI.Codepage = 0x3400;
// gSettings.GUI.CodepageSize = 0x19C0; // gSettings.GUI.CodepageSize = 0x19C0;
} else if ( Prop->getString()->stringValue().contains("ro")) { } else if ( Prop->getString()->stringValue().contains("ro")) {
gSettings.GUI.Language = romanian; gSettings.GUI.languageCode = romanian;
} else if ( Prop->getString()->stringValue().contains("ko")) { } else if ( Prop->getString()->stringValue().contains("ko")) {
gSettings.GUI.Language = korean; gSettings.GUI.languageCode = korean;
// gSettings.GUI.Codepage = 0x1100; // gSettings.GUI.Codepage = 0x1100;
// gSettings.GUI.CodepageSize = 0x100; // gSettings.GUI.CodepageSize = 0x100;
} }
@ -3389,14 +3388,19 @@ EFI_STATUS GetEarlyUserSettings (
return Status; return Status;
} }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
void void
ParseSMBIOSSettings( ParseSMBIOSSettings(SETTINGS_DATA& gSettings, const TagDict* DictPointer)
const TagDict* DictPointer
)
{ {
#pragma GCC diagnostic pop
const TagStruct* Prop; const TagStruct* Prop;
const TagStruct* Prop1; const TagStruct* Prop1;
// TODO!!!
BOOLEAN Default = FALSE; BOOLEAN Default = FALSE;
@ -3406,24 +3410,24 @@ ParseSMBIOSSettings(
MsgLog("ATTENTION : property not string in ProductName\n"); MsgLog("ATTENTION : property not string in ProductName\n");
}else{ }else{
MACHINE_TYPES Model; MACHINE_TYPES Model;
gSettings.ProductName = Prop->getString()->stringValue(); gSettings.Smbios.ProductName = Prop->getString()->stringValue();
// let's fill all other fields based on this ProductName // let's fill all other fields based on this ProductName
// to serve as default // to serve as default
Model = GetModelFromString(gSettings.ProductName); Model = GetModelFromString(gSettings.Smbios.ProductName);
if (Model != MaxMachineType) { if (Model != MaxMachineType) {
SetDMISettingsForModel (Model, FALSE); SetDMISettingsForModel(gSettings, Model, FALSE);
Default = TRUE; Default = TRUE;
} else { } else {
//if new model then fill at least as iMac13,2, except custom ProductName //if new model then fill at least as iMac13,2, except custom ProductName
// something else? // something else?
SetDMISettingsForModel (iMac132, FALSE); SetDMISettingsForModel(gSettings, iMac132, FALSE);
} }
} }
} }
DBG("Using ProductName from config: %s\n", gSettings.ProductName.c_str()); DBG("Using ProductName from config: %s\n", gSettings.Smbios.ProductName.c_str());
Prop = DictPointer->propertyForKey("SmbiosVersion"); Prop = DictPointer->propertyForKey("SmbiosVersion");
gSettings.SmbiosVersion = (UINT16)GetPropertyAsInteger(Prop, 0x204); gSettings.Smbios.SmbiosVersion = (UINT16)GetPropertyAsInteger(Prop, 0x204);
// Check for BiosVersion and BiosReleaseDate by Sherlocks // Check for BiosVersion and BiosReleaseDate by Sherlocks
Prop = DictPointer->propertyForKey("BiosVersion"); Prop = DictPointer->propertyForKey("BiosVersion");
@ -3431,7 +3435,9 @@ ParseSMBIOSSettings(
if ( !Prop->isString() ) { if ( !Prop->isString() ) {
DBG("BiosVersion: not set, Using BiosVersion from clover\n"); DBG("BiosVersion: not set, Using BiosVersion from clover\n");
}else{ }else{
const CHAR8* i = gSettings.RomVersion.c_str(); gSettings.Smbios._RomVersion = Prop->getString()->stringValue();
const CHAR8* i = GlobalConfig.RomVersionUsed.c_str();
const CHAR8* j = Prop->getString()->stringValue().c_str(); const CHAR8* j = Prop->getString()->stringValue().c_str();
i += AsciiStrLen(i); i += AsciiStrLen(i);
@ -3456,22 +3462,22 @@ ParseSMBIOSSettings(
} else if ((i[5] == j[5]) && (i[6] == j[6])) { } else if ((i[5] == j[5]) && (i[6] == j[6])) {
DBG("Found same BiosVersion in clover and config\n"); DBG("Found same BiosVersion in clover and config\n");
} else { } else {
gSettings.RomVersion = Prop->getString()->stringValue(); GlobalConfig.RomVersionUsed = Prop->getString()->stringValue();
DBG("Using latest BiosVersion from config\n"); DBG("Using latest BiosVersion from config\n");
} }
} else { } else {
gSettings.RomVersion = Prop->getString()->stringValue(); GlobalConfig.RomVersionUsed = Prop->getString()->stringValue();
DBG("Using latest BiosVersion from config\n"); DBG("Using latest BiosVersion from config\n");
} }
} else { } else {
gSettings.RomVersion = Prop->getString()->stringValue(); GlobalConfig.RomVersionUsed = Prop->getString()->stringValue();
DBG("Using latest BiosVersion from config\n"); DBG("Using latest BiosVersion from config\n");
} }
} }
} else { } else {
DBG("BiosVersion: not set, Using BiosVersion from clover\n"); DBG("BiosVersion: not set, Using BiosVersion from clover\n");
} }
DBG("BiosVersion: %s\n", gSettings.RomVersion.c_str()); DBG("BiosVersion: %s\n", GlobalConfig.RomVersionUsed.c_str());
Prop1 = DictPointer->propertyForKey("BiosReleaseDate"); Prop1 = DictPointer->propertyForKey("BiosReleaseDate");
if (Prop1 != NULL) { if (Prop1 != NULL) {
@ -3479,8 +3485,9 @@ ParseSMBIOSSettings(
MsgLog("ATTENTION : property not string in BiosReleaseDate\n"); MsgLog("ATTENTION : property not string in BiosReleaseDate\n");
}else{ }else{
if (Prop != NULL) { if (Prop != NULL) {
const CHAR8* i = gSettings.ReleaseDate.c_str(); gSettings.Smbios._ReleaseDate = Prop1->getString()->stringValue();
const CHAR8* j = Prop1->getString()->stringValue().c_str(); const CHAR8* i = GlobalConfig.ReleaseDateUsed.c_str();
const CHAR8* j = gSettings.Smbios._ReleaseDate.c_str();
if ((AsciiStrLen(i) == 8) && (AsciiStrLen(j) == 8)) { if ((AsciiStrLen(i) == 8) && (AsciiStrLen(j) == 8)) {
if (((i[6] > '0') && (j[6] == '0')) || ((i[6] >= j[6]) && (i[7] > j[7]))) { if (((i[6] > '0') && (j[6] == '0')) || ((i[6] >= j[6]) && (i[7] > j[7]))) {
@ -3498,15 +3505,15 @@ ParseSMBIOSSettings(
} else if ((i[3] == j[3]) && (i[4] == j[4])) { } else if ((i[3] == j[3]) && (i[4] == j[4])) {
//DBG("Found same BiosReleaseDate in clover and config\n"); //DBG("Found same BiosReleaseDate in clover and config\n");
} else { } else {
gSettings.ReleaseDate = Prop1->getString()->stringValue(); GlobalConfig.ReleaseDateUsed = gSettings.Smbios._ReleaseDate;
//DBG("Using latest BiosReleaseDate from config\n"); //DBG("Using latest BiosReleaseDate from config\n");
} }
} else { } else {
gSettings.ReleaseDate = Prop1->getString()->stringValue(); GlobalConfig.ReleaseDateUsed = gSettings.Smbios._ReleaseDate;
//DBG("Using latest BiosReleaseDate from config\n"); //DBG("Using latest BiosReleaseDate from config\n");
} }
} else { } else {
gSettings.ReleaseDate = Prop1->getString()->stringValue(); GlobalConfig.ReleaseDateUsed = gSettings.Smbios._ReleaseDate;
//DBG("Using latest BiosReleaseDate from config\n"); //DBG("Using latest BiosReleaseDate from config\n");
} }
} else if ((AsciiStrLen(i) == 8) && (AsciiStrLen(j) == 10)) { } else if ((AsciiStrLen(i) == 8) && (AsciiStrLen(j) == 10)) {
@ -3525,15 +3532,15 @@ ParseSMBIOSSettings(
} else if ((i[3] == j[3]) && (i[4] == j[4])) { } else if ((i[3] == j[3]) && (i[4] == j[4])) {
//DBG("Found same BiosReleaseDate in clover and config\n"); //DBG("Found same BiosReleaseDate in clover and config\n");
} else { } else {
gSettings.ReleaseDate.S8Printf("%c%c/%c%c/%c%c\n", j[0], j[1], j[3], j[4], j[8], j[9]); GlobalConfig.ReleaseDateUsed.S8Printf("%c%c/%c%c/%c%c\n", j[0], j[1], j[3], j[4], j[8], j[9]);
//DBG("Using latest BiosReleaseDate from config\n"); //DBG("Using latest BiosReleaseDate from config\n");
} }
} else { } else {
gSettings.ReleaseDate.S8Printf("%c%c/%c%c/%c%c\n", j[0], j[1], j[3], j[4], j[8], j[9]); GlobalConfig.ReleaseDateUsed.S8Printf("%c%c/%c%c/%c%c\n", j[0], j[1], j[3], j[4], j[8], j[9]);
//DBG("Using latest BiosReleaseDate from config\n"); //DBG("Using latest BiosReleaseDate from config\n");
} }
} else { } else {
gSettings.ReleaseDate.S8Printf("%c%c/%c%c/%c%c\n", j[0], j[1], j[3], j[4], j[8], j[9]); GlobalConfig.ReleaseDateUsed.S8Printf("%c%c/%c%c/%c%c\n", j[0], j[1], j[3], j[4], j[8], j[9]);
//DBG("Using latest BiosReleaseDate from config\n"); //DBG("Using latest BiosReleaseDate from config\n");
} }
} else if ((AsciiStrLen(i) == 10) && (AsciiStrLen(j) == 10)) { } else if ((AsciiStrLen(i) == 10) && (AsciiStrLen(j) == 10)) {
@ -3552,15 +3559,15 @@ ParseSMBIOSSettings(
} else if ((i[3] == j[3]) && (i[4] == j[4])) { } else if ((i[3] == j[3]) && (i[4] == j[4])) {
//DBG("Found same BiosReleaseDate in clover and config\n"); //DBG("Found same BiosReleaseDate in clover and config\n");
} else { } else {
gSettings.ReleaseDate = Prop1->getString()->stringValue(); GlobalConfig.ReleaseDateUsed = Prop1->getString()->stringValue();
//DBG("Using latest BiosReleaseDate from config\n"); //DBG("Using latest BiosReleaseDate from config\n");
} }
} else { } else {
gSettings.ReleaseDate = Prop1->getString()->stringValue(); GlobalConfig.ReleaseDateUsed = Prop1->getString()->stringValue();
//DBG("Using latest BiosReleaseDate from config\n"); //DBG("Using latest BiosReleaseDate from config\n");
} }
} else { } else {
gSettings.ReleaseDate = Prop1->getString()->stringValue(); GlobalConfig.ReleaseDateUsed = Prop1->getString()->stringValue();
//DBG("Using latest BiosReleaseDate from config\n"); //DBG("Using latest BiosReleaseDate from config\n");
} }
} else if ((AsciiStrLen(i) == 10) && (AsciiStrLen(j) == 8)) { } else if ((AsciiStrLen(i) == 10) && (AsciiStrLen(j) == 8)) {
@ -3579,22 +3586,22 @@ ParseSMBIOSSettings(
} else if ((i[3] == j[3]) && (i[4] == j[4])) { } else if ((i[3] == j[3]) && (i[4] == j[4])) {
//DBG("Found same BiosReleaseDate in clover and config\n"); //DBG("Found same BiosReleaseDate in clover and config\n");
} else { } else {
gSettings.ReleaseDate.S8Printf("%c%c/%c%c/20%c%c\n", j[0], j[1], j[3], j[4], j[6], j[7]); GlobalConfig.ReleaseDateUsed.S8Printf("%c%c/%c%c/20%c%c\n", j[0], j[1], j[3], j[4], j[6], j[7]);
//DBG("Using latest BiosReleaseDate from config\n"); //DBG("Using latest BiosReleaseDate from config\n");
} }
} else { } else {
gSettings.ReleaseDate.S8Printf("%c%c/%c%c/20%c%c\n", j[0], j[1], j[3], j[4], j[6], j[7]); GlobalConfig.ReleaseDateUsed.S8Printf("%c%c/%c%c/20%c%c\n", j[0], j[1], j[3], j[4], j[6], j[7]);
//DBG("Using latest BiosReleaseDate from config\n"); //DBG("Using latest BiosReleaseDate from config\n");
} }
} else { } else {
gSettings.ReleaseDate.S8Printf("%c%c/%c%c/20%c%c\n", j[0], j[1], j[3], j[4], j[6], j[7]); GlobalConfig.ReleaseDateUsed.S8Printf("%c%c/%c%c/20%c%c\n", j[0], j[1], j[3], j[4], j[6], j[7]);
//DBG("Using latest BiosReleaseDate from config\n"); //DBG("Using latest BiosReleaseDate from config\n");
} }
} else { } else {
//DBG("Found unknown date format from config\n"); //DBG("Found unknown date format from config\n");
if (Prop != NULL) { if (Prop != NULL) {
i = gSettings.ReleaseDate.c_str(); i = GlobalConfig.ReleaseDateUsed.c_str();
j = gSettings.RomVersion.c_str(); j = GlobalConfig.RomVersionUsed.c_str();
j += AsciiStrLen(j); j += AsciiStrLen(j);
while (*j != '.') { while (*j != '.') {
@ -3602,10 +3609,10 @@ ParseSMBIOSSettings(
} }
if ((AsciiStrLen(i) == 8)) { if ((AsciiStrLen(i) == 8)) {
gSettings.ReleaseDate.S8Printf("%c%c/%c%c/%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]); GlobalConfig.ReleaseDateUsed.S8Printf("%c%c/%c%c/%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]);
//DBG("Using the date of used BiosVersion\n"); //DBG("Using the date of used BiosVersion\n");
} else if ((AsciiStrLen(i) == 10)) { } else if ((AsciiStrLen(i) == 10)) {
gSettings.ReleaseDate.S8Printf("%c%c/%c%c/20%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]); GlobalConfig.ReleaseDateUsed.S8Printf("%c%c/%c%c/20%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]);
//DBG("Using the date of used BiosVersion\n"); //DBG("Using the date of used BiosVersion\n");
} }
} else { } else {
@ -3619,8 +3626,8 @@ ParseSMBIOSSettings(
} }
} else { } else {
if (Prop != NULL) { if (Prop != NULL) {
const CHAR8* i = gSettings.ReleaseDate.c_str(); const CHAR8* i = GlobalConfig.ReleaseDateUsed.c_str();
const CHAR8* j = gSettings.RomVersion.c_str(); const CHAR8* j = GlobalConfig.RomVersionUsed.c_str();
j += AsciiStrLen(j); j += AsciiStrLen(j);
while (*j != '.') { while (*j != '.') {
@ -3628,64 +3635,65 @@ ParseSMBIOSSettings(
} }
if ((AsciiStrLen(i) == 8)) { if ((AsciiStrLen(i) == 8)) {
gSettings.ReleaseDate.S8Printf("%c%c/%c%c/%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]); GlobalConfig.ReleaseDateUsed.S8Printf("%c%c/%c%c/%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]);
//DBG("BiosReleaseDate: not set, Using the date of used BiosVersion\n"); //DBG("BiosReleaseDate: not set, Using the date of used BiosVersion\n");
} else if ((AsciiStrLen(i) == 10)) { } else if ((AsciiStrLen(i) == 10)) {
gSettings.ReleaseDate.S8Printf("%c%c/%c%c/20%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]); GlobalConfig.ReleaseDateUsed.S8Printf("%c%c/%c%c/20%c%c\n", j[3], j[4], j[5], j[6], j[1], j[2]);
//DBG("BiosReleaseDate: not set, Using the date of used BiosVersion\n"); //DBG("BiosReleaseDate: not set, Using the date of used BiosVersion\n");
} }
} else { } else {
//DBG("BiosReleaseDate: not set, Using BiosReleaseDate from clover\n"); //DBG("BiosReleaseDate: not set, Using BiosReleaseDate from clover\n");
} }
} }
DBG("BiosReleaseDate: %s\n", gSettings.ReleaseDate.c_str()); DBG("BiosReleaseDate: %s\n", GlobalConfig.ReleaseDateUsed.c_str());
Prop = DictPointer->propertyForKey("EfiVersion"); Prop = DictPointer->propertyForKey("EfiVersion");
if (Prop != NULL) { if (Prop != NULL) {
if ( !Prop->isString() ) { if ( !Prop->isString() ) {
MsgLog("ATTENTION : property not string in EfiVersion\n"); MsgLog("ATTENTION : property not string in EfiVersion\n");
if ( gSettings.EfiVersion.notEmpty() ) { if ( GlobalConfig.EfiVersionUsed.notEmpty() ) {
DBG("Using EfiVersion from clover: %s\n", gSettings.EfiVersion.c_str()); DBG("Using EfiVersion from clover: %s\n", GlobalConfig.EfiVersionUsed.c_str());
} }
}else{ }else{
if (AsciiStrVersionToUint64(gSettings.EfiVersion, 4, 5) > AsciiStrVersionToUint64(Prop->getString()->stringValue(), 4, 5)) { gSettings.Smbios._EfiVersion = Prop->getString()->stringValue();
DBG("Using latest EfiVersion from clover: %s\n", gSettings.EfiVersion.c_str()); gSettings.Smbios._EfiVersion.trim();
} else if (AsciiStrVersionToUint64(gSettings.EfiVersion, 4, 5) < AsciiStrVersionToUint64(Prop->getString()->stringValue(), 4, 5)) { if (AsciiStrVersionToUint64(GlobalConfig.EfiVersionUsed, 4, 5) > AsciiStrVersionToUint64(gSettings.Smbios._EfiVersion, 4, 5)) {
gSettings.EfiVersion = Prop->getString()->stringValue(); DBG("Using latest EfiVersion from clover: %s\n", GlobalConfig.EfiVersionUsed.c_str());
gSettings.EfiVersion.trim(); } else if (AsciiStrVersionToUint64(GlobalConfig.EfiVersionUsed, 4, 5) < AsciiStrVersionToUint64(gSettings.Smbios._EfiVersion, 4, 5)) {
DBG("Using latest EfiVersion from config: %s\n", gSettings.EfiVersion.c_str()); GlobalConfig.EfiVersionUsed = gSettings.Smbios._EfiVersion;
DBG("Using latest EfiVersion from config: %s\n", GlobalConfig.EfiVersionUsed.c_str());
} else { } else {
DBG("Using EfiVersion from clover: %s\n", gSettings.EfiVersion.c_str()); DBG("Using EfiVersion from clover: %s\n", GlobalConfig.EfiVersionUsed.c_str());
} }
} }
} else if ( gSettings.EfiVersion.notEmpty() ) { } else if ( GlobalConfig.EfiVersionUsed.notEmpty() ) {
DBG("Using EfiVersion from clover: %s\n", gSettings.EfiVersion.c_str()); DBG("Using EfiVersion from clover: %s\n", GlobalConfig.EfiVersionUsed.c_str());
} }
Prop = DictPointer->propertyForKey("FirmwareFeatures"); Prop = DictPointer->propertyForKey("FirmwareFeatures");
if (Prop != NULL) { if (Prop != NULL) {
gFwFeatures = (UINT32)GetPropertyAsInteger(Prop, gFwFeatures); gSettings.Smbios.gFwFeatures = (UINT32)GetPropertyAsInteger(Prop, gSettings.Smbios.gFwFeatures);
DBG("Using FirmwareFeatures from config: 0x%08X\n", gFwFeatures); DBG("Using FirmwareFeatures from config: 0x%08X\n", gSettings.Smbios.gFwFeatures);
} else { } else {
DBG("Using FirmwareFeatures from clover: 0x%08X\n", gFwFeatures); DBG("Using FirmwareFeatures from clover: 0x%08X\n", gSettings.Smbios.gFwFeatures);
} }
Prop = DictPointer->propertyForKey("FirmwareFeaturesMask"); Prop = DictPointer->propertyForKey("FirmwareFeaturesMask");
if (Prop != NULL) { if (Prop != NULL) {
gFwFeaturesMask = (UINT32)GetPropertyAsInteger(Prop, gFwFeaturesMask); gSettings.Smbios.gFwFeaturesMask = (UINT32)GetPropertyAsInteger(Prop, gSettings.Smbios.gFwFeaturesMask);
DBG("Using FirmwareFeaturesMask from config: 0x%08X\n", gFwFeaturesMask); DBG("Using FirmwareFeaturesMask from config: 0x%08X\n", gSettings.Smbios.gFwFeaturesMask);
} else { } else {
DBG("Using FirmwareFeaturesMask from clover: 0x%08X\n", gFwFeaturesMask); DBG("Using FirmwareFeaturesMask from clover: 0x%08X\n", gSettings.Smbios.gFwFeaturesMask);
} }
Prop = DictPointer->propertyForKey("PlatformFeature"); Prop = DictPointer->propertyForKey("PlatformFeature");
if (Prop != NULL) { if (Prop != NULL) {
gPlatformFeature = (UINT64)GetPropertyAsInteger(Prop, (INTN)gPlatformFeature); gSettings.Smbios.gPlatformFeature = (UINT64)GetPropertyAsInteger(Prop, (INTN)gSettings.Smbios.gPlatformFeature);
} else { } else {
if (gPlatformFeature == 0xFFFF) { if (gSettings.Smbios.gPlatformFeature == 0xFFFF) {
DBG("PlatformFeature will not set in SMBIOS\n"); DBG("PlatformFeature will not set in SMBIOS\n");
} else { } else {
DBG("Using PlatformFeature from clover: 0x%llX\n", gPlatformFeature); DBG("Using PlatformFeature from clover: 0x%llX\n", gSettings.Smbios.gPlatformFeature);
} }
} }
@ -3694,7 +3702,7 @@ ParseSMBIOSSettings(
if ( !Prop->isString() ) { if ( !Prop->isString() ) {
MsgLog("ATTENTION : property not string in BiosVendor\n"); MsgLog("ATTENTION : property not string in BiosVendor\n");
}else{ }else{
gSettings.VendorName = Prop->getString()->stringValue(); gSettings.Smbios.BiosVendor = Prop->getString()->stringValue();
} }
} }
@ -3703,7 +3711,7 @@ ParseSMBIOSSettings(
if ( !Prop->isString() ) { if ( !Prop->isString() ) {
MsgLog("ATTENTION : property not string in Manufacturer\n"); MsgLog("ATTENTION : property not string in Manufacturer\n");
}else{ }else{
gSettings.ManufactureName = Prop->getString()->stringValue(); gSettings.Smbios.ManufactureName = Prop->getString()->stringValue();
} }
} }
@ -3712,7 +3720,7 @@ ParseSMBIOSSettings(
if ( !Prop->isString() ) { if ( !Prop->isString() ) {
MsgLog("ATTENTION : property not string in Version\n"); MsgLog("ATTENTION : property not string in Version\n");
}else{ }else{
gSettings.VersionNr = Prop->getString()->stringValue(); gSettings.Smbios.VersionNr = Prop->getString()->stringValue();
} }
} }
@ -3721,7 +3729,7 @@ ParseSMBIOSSettings(
if ( !Prop->isString() ) { if ( !Prop->isString() ) {
MsgLog("ATTENTION : property not string in Family\n"); MsgLog("ATTENTION : property not string in Family\n");
}else{ }else{
gSettings.FamilyName = Prop->getString()->stringValue(); gSettings.Smbios.FamilyName = Prop->getString()->stringValue();
} }
} }
@ -3730,7 +3738,7 @@ ParseSMBIOSSettings(
if ( !Prop->isString() ) { if ( !Prop->isString() ) {
MsgLog("ATTENTION : property not string in SerialNumber\n"); MsgLog("ATTENTION : property not string in SerialNumber\n");
}else{ }else{
gSettings.SerialNr = Prop->getString()->stringValue(); gSettings.Smbios.SerialNr = Prop->getString()->stringValue();
} }
} }
@ -3740,7 +3748,7 @@ ParseSMBIOSSettings(
MsgLog("ATTENTION : property not string in SmUUID\n"); MsgLog("ATTENTION : property not string in SmUUID\n");
}else{ }else{
if (IsValidGuidString(Prop->getString()->stringValue())) { if (IsValidGuidString(Prop->getString()->stringValue())) {
gSettings.SmUUID = Prop->getString()->stringValue(); gSettings.Smbios.SmUUID = Prop->getString()->stringValue();
} else { } else {
DBG("Error: invalid SmUUID '%s' - should be in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n", Prop->getString()->stringValue().c_str()); DBG("Error: invalid SmUUID '%s' - should be in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n", Prop->getString()->stringValue().c_str());
} }
@ -3753,7 +3761,7 @@ ParseSMBIOSSettings(
MsgLog("ATTENTION : property not string in BoardManufacturer\n"); MsgLog("ATTENTION : property not string in BoardManufacturer\n");
}else{ }else{
if( Prop->getString()->stringValue().notEmpty() ) { if( Prop->getString()->stringValue().notEmpty() ) {
gSettings.BoardManufactureName = Prop->getString()->stringValue(); gSettings.Smbios.BoardManufactureName = Prop->getString()->stringValue();
} }
} }
} }
@ -3764,7 +3772,7 @@ ParseSMBIOSSettings(
MsgLog("ATTENTION : property not string in BoardSerialNumber\n"); MsgLog("ATTENTION : property not string in BoardSerialNumber\n");
}else{ }else{
if( Prop->getString()->stringValue().notEmpty() ) { if( Prop->getString()->stringValue().notEmpty() ) {
gSettings.BoardSerialNumber = Prop->getString()->stringValue(); gSettings.Smbios.BoardSerialNumber = Prop->getString()->stringValue();
} }
} }
} }
@ -3774,37 +3782,37 @@ ParseSMBIOSSettings(
if ( !Prop->isString() ) { if ( !Prop->isString() ) {
MsgLog("ATTENTION : property not string in Board-ID\n"); MsgLog("ATTENTION : property not string in Board-ID\n");
}else{ }else{
gSettings.BoardNumber = Prop->getString()->stringValue(); gSettings.Smbios.BoardNumber = Prop->getString()->stringValue();
DBG("Board-ID set from config as %s\n", gSettings.BoardNumber.c_str()); DBG("Board-ID set from config as %s\n", gSettings.Smbios.BoardNumber.c_str());
} }
} }
if (!Default) { if (!Default) {
gSettings.BoardVersion = gSettings.ProductName; gSettings.Smbios.BoardVersion = gSettings.Smbios.ProductName;
} }
Prop = DictPointer->propertyForKey("BoardVersion"); Prop = DictPointer->propertyForKey("BoardVersion");
if (Prop != NULL) { if (Prop != NULL) {
if ( !Prop->isString() ) { if ( !Prop->isString() ) {
MsgLog("ATTENTION : property not string in BoardVersion\n"); MsgLog("ATTENTION : property not string in BoardVersion\n");
}else{ }else{
gSettings.BoardVersion = Prop->getString()->stringValue(); gSettings.Smbios.BoardVersion = Prop->getString()->stringValue();
} }
} }
Prop = DictPointer->propertyForKey("BoardType"); Prop = DictPointer->propertyForKey("BoardType");
if (Prop != NULL) { if (Prop != NULL) {
gSettings.BoardType = (UINT8)GetPropertyAsInteger(Prop, gSettings.BoardType); gSettings.Smbios.BoardType = (UINT8)GetPropertyAsInteger(Prop, gSettings.Smbios.BoardType);
DBG("BoardType: 0x%hhX\n", gSettings.BoardType); DBG("BoardType: 0x%hhX\n", gSettings.Smbios.BoardType);
} }
Prop = DictPointer->propertyForKey("Mobile"); Prop = DictPointer->propertyForKey("Mobile");
if (Prop != NULL) { if (Prop != NULL) {
if (IsPropertyNotNullAndFalse(Prop)) if (IsPropertyNotNullAndFalse(Prop))
gSettings.Mobile = FALSE; gSettings.Smbios.Mobile = FALSE;
else if (IsPropertyNotNullAndTrue(Prop)) else if (IsPropertyNotNullAndTrue(Prop))
gSettings.Mobile = TRUE; gSettings.Smbios.Mobile = TRUE;
} else if (!Default) { } else if (!Default) {
gSettings.Mobile = gSettings.ProductName.contains("MacBook"); gSettings.Smbios.Mobile = gSettings.Smbios.ProductName.contains("MacBook");
} }
Prop = DictPointer->propertyForKey("LocationInChassis"); Prop = DictPointer->propertyForKey("LocationInChassis");
@ -3812,7 +3820,7 @@ ParseSMBIOSSettings(
if ( !Prop->isString() ) { if ( !Prop->isString() ) {
MsgLog("ATTENTION : property not string in LocationInChassis\n"); MsgLog("ATTENTION : property not string in LocationInChassis\n");
}else{ }else{
gSettings.LocationInChassis = Prop->getString()->stringValue(); gSettings.Smbios.LocationInChassis = Prop->getString()->stringValue();
} }
} }
@ -3821,7 +3829,7 @@ ParseSMBIOSSettings(
if ( !Prop->isString() ) { if ( !Prop->isString() ) {
MsgLog("ATTENTION : property not string in ChassisManufacturer\n"); MsgLog("ATTENTION : property not string in ChassisManufacturer\n");
}else{ }else{
gSettings.ChassisManufacturer = Prop->getString()->stringValue(); gSettings.Smbios.ChassisManufacturer = Prop->getString()->stringValue();
} }
} }
@ -3830,19 +3838,19 @@ ParseSMBIOSSettings(
if ( !Prop->isString() ) { if ( !Prop->isString() ) {
MsgLog("ATTENTION : property not string in ChassisAssetTag\n"); MsgLog("ATTENTION : property not string in ChassisAssetTag\n");
}else{ }else{
gSettings.ChassisAssetTag = Prop->getString()->stringValue(); gSettings.Smbios.ChassisAssetTag = Prop->getString()->stringValue();
} }
} }
Prop = DictPointer->propertyForKey("ChassisType"); Prop = DictPointer->propertyForKey("ChassisType");
if (Prop != NULL) { if (Prop != NULL) {
gSettings.ChassisType = (UINT8)GetPropertyAsInteger(Prop, gSettings.ChassisType); gSettings.Smbios.ChassisType = (UINT8)GetPropertyAsInteger(Prop, gSettings.Smbios.ChassisType);
DBG("ChassisType: 0x%hhX\n", gSettings.ChassisType); DBG("ChassisType: 0x%hhX\n", gSettings.Smbios.ChassisType);
} }
Prop = DictPointer->propertyForKey("NoRomInfo"); Prop = DictPointer->propertyForKey("NoRomInfo");
if (Prop != NULL) { if (Prop != NULL) {
gSettings.NoRomInfo = IsPropertyNotNullAndTrue(Prop); gSettings.Smbios.NoRomInfo = IsPropertyNotNullAndTrue(Prop);
} }
} }
@ -4418,6 +4426,9 @@ void SETTINGS_DATA::DevicesClass::FillDevicePropertiesOld(SETTINGS_DATA& gSettin
if ( !EFI_ERROR(PropertiesDict->getKeyAndValueAtIndex(i, &key, &value)) ) { //take a <key> with DevicePath. If GetKeyValueAtIndex return success, key and value != NULL if ( !EFI_ERROR(PropertiesDict->getKeyAndValueAtIndex(i, &key, &value)) ) { //take a <key> with DevicePath. If GetKeyValueAtIndex return success, key and value != NULL
XStringW DevicePathStr = key->keyStringValue(); XStringW DevicePathStr = key->keyStringValue();
// DBG("Device: %ls\n", DevicePathStr); // DBG("Device: %ls\n", DevicePathStr);
if (key->keyStringValue().startWithOrEqualTo("#")) {
continue;
}
// when key in Devices/Properties is one of the strings "PrimaryGPU" / "SecondaryGPU", use device path of first / second gpu accordingly // when key in Devices/Properties is one of the strings "PrimaryGPU" / "SecondaryGPU", use device path of first / second gpu accordingly
#ifdef CLOVER_BUILD #ifdef CLOVER_BUILD
@ -4459,6 +4470,7 @@ void SETTINGS_DATA::DevicesClass::FillDevicePropertiesOld(SETTINGS_DATA& gSettin
continue; continue;
} }
if (key2->keyStringValue()[0] != '#') { if (key2->keyStringValue()[0] != '#') {
continue;
(*Child)->MenuItem.BValue = TRUE; (*Child)->MenuItem.BValue = TRUE;
(*Child)->Key = S8Printf("%s", key2->keyStringValue().c_str()).forgetDataWithoutFreeing(); (*Child)->Key = S8Printf("%s", key2->keyStringValue().c_str()).forgetDataWithoutFreeing();
} }
@ -5300,38 +5312,38 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
const TagDict* SMBIOSDict = CfgDict->dictPropertyForKey("SMBIOS"); const TagDict* SMBIOSDict = CfgDict->dictPropertyForKey("SMBIOS");
if (SMBIOSDict != NULL) { if (SMBIOSDict != NULL) {
ParseSMBIOSSettings(SMBIOSDict); ParseSMBIOSSettings(gSettings, SMBIOSDict);
const TagStruct* Prop = SMBIOSDict->propertyForKey("Trust"); const TagStruct* Prop = SMBIOSDict->propertyForKey("Trust");
if (Prop != NULL) { if (Prop != NULL) {
if (IsPropertyNotNullAndFalse(Prop)) { if (IsPropertyNotNullAndFalse(Prop)) {
gSettings.TrustSMBIOS = FALSE; gSettings.Smbios.TrustSMBIOS = FALSE;
} else if (IsPropertyNotNullAndTrue(Prop)) { } else if (IsPropertyNotNullAndTrue(Prop)) {
gSettings.TrustSMBIOS = TRUE; gSettings.Smbios.TrustSMBIOS = TRUE;
} }
} }
Prop = SMBIOSDict->propertyForKey("MemoryRank"); Prop = SMBIOSDict->propertyForKey("MemoryRank");
gSettings.Attribute = (INT8)GetPropertyAsInteger(Prop, -1); //1==Single Rank, 2 == Dual Rank, 0==undefined -1 == keep as is gSettings.Smbios.Attribute = (INT8)GetPropertyAsInteger(Prop, -1); //1==Single Rank, 2 == Dual Rank, 0==undefined -1 == keep as is
// Delete the user memory when a new config is selected // Delete the user memory when a new config is selected
INTN i = 0; INTN i = 0;
for (i = 0; i < gRAM.UserInUse && i < MAX_RAM_SLOTS; i++) { for (i = 0; i < gSettings.Smbios.Memory.SlotCounts && i < MAX_RAM_SLOTS; i++) {
gRAM.User[i].ModuleSize = 0; gSettings.Smbios.Memory.User[i].ModuleSize = 0;
gRAM.User[i].InUse = 0; gSettings.Smbios.Memory.User[i].InUse = 0;
} }
gRAM.UserInUse = 0; gSettings.Smbios.Memory.SlotCounts = 0;
gRAM.UserChannels = 0; gSettings.Smbios.Memory.UserChannels = 0;
gSettings.InjectMemoryTables = FALSE; gSettings.Smbios.InjectMemoryTables = FALSE;
// Inject memory tables into SMBIOS // Inject memory tables into SMBIOS
const TagDict* MemoryDict = SMBIOSDict->dictPropertyForKey("Memory"); const TagDict* MemoryDict = SMBIOSDict->dictPropertyForKey("Memory");
if (MemoryDict != NULL){ if (MemoryDict != NULL){
// Get memory table count // Get memory table count
const TagStruct* Prop2 = MemoryDict->propertyForKey("SlotCount"); const TagStruct* Prop2 = MemoryDict->propertyForKey("SlotCount");
gRAM.UserInUse = (UINT8)GetPropertyAsInteger(Prop2, 0); gSettings.Smbios.Memory.SlotCounts = (UINT8)GetPropertyAsInteger(Prop2, 0);
// Get memory channels // Get memory channels
Prop2 = MemoryDict->propertyForKey("Channels"); Prop2 = MemoryDict->propertyForKey("Channels");
gRAM.UserChannels = (UINT8)GetPropertyAsInteger(Prop2, 0); gSettings.Smbios.Memory.UserChannels = (UINT8)GetPropertyAsInteger(Prop2, 0);
// Get memory tables // Get memory tables
const TagArray* ModulesArray = MemoryDict->arrayPropertyForKey("Modules"); // array of dict const TagArray* ModulesArray = MemoryDict->arrayPropertyForKey("Modules"); // array of dict
if (ModulesArray != NULL) { if (ModulesArray != NULL) {
@ -5358,7 +5370,7 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
continue; continue;
} }
SlotPtr = &gRAM.User[Slot]; SlotPtr = &gSettings.Smbios.Memory.User[Slot];
// Get memory size // Get memory size
Prop2 = Prop3->propertyForKey("Size"); Prop2 = Prop3->propertyForKey("Size");
@ -5369,17 +5381,17 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
// Get memory vendor // Get memory vendor
Prop2 = Prop3->propertyForKey("Vendor"); Prop2 = Prop3->propertyForKey("Vendor");
if (Prop2 && Prop2->isString() && Prop2->getString()->stringValue().notEmpty()) { if (Prop2 && Prop2->isString() && Prop2->getString()->stringValue().notEmpty()) {
SlotPtr->Vendor = S8Printf("%s", Prop2->getString()->stringValue().c_str()).forgetDataWithoutFreeing(); SlotPtr->Vendor.S8Printf("%s", Prop2->getString()->stringValue().c_str());
} }
// Get memory part number // Get memory part number
Prop2 = Prop3->propertyForKey("Part"); Prop2 = Prop3->propertyForKey("Part");
if (Prop2 && Prop2->isString() && Prop2->getString()->stringValue().notEmpty()) { if (Prop2 && Prop2->isString() && Prop2->getString()->stringValue().notEmpty()) {
SlotPtr->PartNo = S8Printf("%s", Prop2->getString()->stringValue().c_str()).forgetDataWithoutFreeing(); SlotPtr->PartNo.S8Printf("%s", Prop2->getString()->stringValue().c_str());
} }
// Get memory serial number // Get memory serial number
Prop2 = Prop3->propertyForKey("Serial"); Prop2 = Prop3->propertyForKey("Serial");
if (Prop2 && Prop2->isString() && Prop2->getString()->stringValue().notEmpty()) { if (Prop2 && Prop2->isString() && Prop2->getString()->stringValue().notEmpty()) {
SlotPtr->SerialNo = S8Printf("%s", Prop2->getString()->stringValue().c_str()).forgetDataWithoutFreeing(); SlotPtr->SerialNo.S8Printf("%s", Prop2->getString()->stringValue().c_str());
} }
// Get memory type // Get memory type
SlotPtr->Type = MemoryTypeDdr3; SlotPtr->Type = MemoryTypeDdr3;
@ -5398,14 +5410,14 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
SlotPtr->InUse = (SlotPtr->ModuleSize > 0); SlotPtr->InUse = (SlotPtr->ModuleSize > 0);
if (SlotPtr->InUse) { if (SlotPtr->InUse) {
if (gRAM.UserInUse <= Slot) { if (gSettings.Smbios.Memory.SlotCounts <= Slot) {
gRAM.UserInUse = Slot + 1; gSettings.Smbios.Memory.SlotCounts = Slot + 1;
} }
} }
} }
if (gRAM.UserInUse > 0) { if (gSettings.Smbios.Memory.SlotCounts > 0) {
gSettings.InjectMemoryTables = TRUE; gSettings.Smbios.InjectMemoryTables = TRUE;
} }
} }
} }
@ -5452,7 +5464,7 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
} }
if (DeviceN >= 0) { if (DeviceN >= 0) {
SLOT_DEVICE *SlotDevice = &SlotDevices[DeviceN]; SLOT_DEVICE *SlotDevice = &gSettings.Smbios.SlotDevices[DeviceN];
Prop2 = SlotsDict->propertyForKey("ID"); Prop2 = SlotsDict->propertyForKey("ID");
SlotDevice->SlotID = (UINT8)GetPropertyAsInteger(Prop2, DeviceN); SlotDevice->SlotID = (UINT8)GetPropertyAsInteger(Prop2, DeviceN);
SlotDevice->SlotType = SlotTypePci; SlotDevice->SlotType = SlotTypePci;
@ -5491,12 +5503,12 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
} }
Prop2 = SlotsDict->propertyForKey("Name"); Prop2 = SlotsDict->propertyForKey("Name");
if (Prop2 && (Prop2->isString()) && Prop2->getString()->stringValue().notEmpty()) { if (Prop2 && (Prop2->isString()) && Prop2->getString()->stringValue().notEmpty()) {
snprintf (SlotDevice->SlotName, 31, "%s", Prop2->getString()->stringValue().c_str()); SlotDevice->SlotName = Prop2->getString()->stringValue();
} else { } else {
snprintf (SlotDevice->SlotName, 31, "PCI Slot %lld", DeviceN); SlotDevice->SlotName.S8Printf("PCI Slot %lld", DeviceN);
} }
DBG(" - %s\n", SlotDevice->SlotName); DBG(" - %s\n", SlotDevice->SlotName.c_str());
} }
} }
} }
@ -5711,12 +5723,12 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
// if (gSettings.RtVariables.RtROM.isEmpty()) { // if (gSettings.RtVariables.RtROM.isEmpty()) {
// EFI_GUID uuid; // EFI_GUID uuid;
// StrToGuidLE(gSettings.SmUUID, &uuid); // StrToGuidLE(gSettings.Smbios.SmUUID, &uuid);
// gSettings.RtVariables.RtROM.ncpy(&uuid.Data4[2], 6); // gSettings.RtVariables.RtROM.ncpy(&uuid.Data4[2], 6);
// } // }
// if (gSettings.RtVariables.RtMLB.isEmpty()) { // if (gSettings.RtVariables.RtMLB.isEmpty()) {
// gSettings.RtVariables.RtMLB = gSettings.BoardSerialNumber; // gSettings.RtVariables.RtMLB = gSettings.Smbios.BoardSerialNumber;
// } // }
// if CustomUUID and InjectSystemID are not specified // if CustomUUID and InjectSystemID are not specified
@ -5782,16 +5794,16 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
const TagDict* BootGraphicsDict = CfgDict->dictPropertyForKey("BootGraphics"); const TagDict* BootGraphicsDict = CfgDict->dictPropertyForKey("BootGraphics");
if (BootGraphicsDict != NULL) { if (BootGraphicsDict != NULL) {
const TagStruct* Prop = BootGraphicsDict->propertyForKey("DefaultBackgroundColor"); const TagStruct* Prop = BootGraphicsDict->propertyForKey("DefaultBackgroundColor");
gSettings.DefaultBackgroundColor = (UINT32)GetPropertyAsInteger(Prop, 0x80000000); //the value 0x80000000 means not set gSettings.BootGraphics.DefaultBackgroundColor = (UINT32)GetPropertyAsInteger(Prop, 0x80000000); //the value 0x80000000 means not set
Prop = BootGraphicsDict->propertyForKey("UIScale"); Prop = BootGraphicsDict->propertyForKey("UIScale");
gSettings.UIScale = (UINT32)GetPropertyAsInteger(Prop, 0x80000000); gSettings.BootGraphics.UIScale = (UINT32)GetPropertyAsInteger(Prop, 0x80000000);
Prop = BootGraphicsDict->propertyForKey("EFILoginHiDPI"); Prop = BootGraphicsDict->propertyForKey("EFILoginHiDPI");
gSettings.EFILoginHiDPI = (UINT32)GetPropertyAsInteger(Prop, 0x80000000); gSettings.BootGraphics.EFILoginHiDPI = (UINT32)GetPropertyAsInteger(Prop, 0x80000000);
Prop = BootGraphicsDict->propertyForKey("flagstate"); Prop = BootGraphicsDict->propertyForKey("flagstate");
*(UINT32*)&gSettings.flagstate[0] = (UINT32)GetPropertyAsInteger(Prop, 0x80000000); *(UINT32*)&gSettings.BootGraphics.flagstate[0] = (UINT32)GetPropertyAsInteger(Prop, 0x80000000);
} }
/* /*
@ -6611,12 +6623,12 @@ GetDevices ()
// DBG(" - RADEON_BIOS_0_SCRATCH = 0x%08X\n", gfx->Connectors); // DBG(" - RADEON_BIOS_0_SCRATCH = 0x%08X\n", gfx->Connectors);
gfx->ConnChanged = FALSE; gfx->ConnChanged = FALSE;
SlotDevice = &SlotDevices[0]; SlotDevice = &gSettings.Smbios.SlotDevices[0];
SlotDevice->SegmentGroupNum = (UINT16)Segment; SlotDevice->SegmentGroupNum = (UINT16)Segment;
SlotDevice->BusNum = (UINT8)Bus; SlotDevice->BusNum = (UINT8)Bus;
SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07)); SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07));
SlotDevice->Valid = TRUE; SlotDevice->Valid = TRUE;
snprintf (SlotDevice->SlotName, 31, "PCI Slot 0"); SlotDevice->SlotName = "PCI Slot 0"_XS8;
SlotDevice->SlotID = 1; SlotDevice->SlotID = 1;
SlotDevice->SlotType = SlotTypePciExpressX16; SlotDevice->SlotType = SlotTypePciExpressX16;
break; break;
@ -6678,12 +6690,12 @@ GetDevices ()
DBG(" - GFX: Model=%s family %hX (%s)\n", gfx->Model, gfx->Family, CardFamily); DBG(" - GFX: Model=%s family %hX (%s)\n", gfx->Model, gfx->Family, CardFamily);
gfx->Ports = 0; gfx->Ports = 0;
SlotDevice = &SlotDevices[1]; SlotDevice = &gSettings.Smbios.SlotDevices[1];
SlotDevice->SegmentGroupNum = (UINT16)Segment; SlotDevice->SegmentGroupNum = (UINT16)Segment;
SlotDevice->BusNum = (UINT8)Bus; SlotDevice->BusNum = (UINT8)Bus;
SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07)); SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07));
SlotDevice->Valid = TRUE; SlotDevice->Valid = TRUE;
snprintf (SlotDevice->SlotName, 31, "PCI Slot 0"); SlotDevice->SlotName = "PCI Slot 0"_XS8;
SlotDevice->SlotID = 1; SlotDevice->SlotID = 1;
SlotDevice->SlotType = SlotTypePciExpressX16; SlotDevice->SlotType = SlotTypePciExpressX16;
break; break;
@ -6703,12 +6715,12 @@ GetDevices ()
else if ((Pci.Hdr.ClassCode[2] == PCI_CLASS_NETWORK) && else if ((Pci.Hdr.ClassCode[2] == PCI_CLASS_NETWORK) &&
(Pci.Hdr.ClassCode[1] == PCI_CLASS_NETWORK_OTHER)) { (Pci.Hdr.ClassCode[1] == PCI_CLASS_NETWORK_OTHER)) {
SlotDevice = &SlotDevices[6]; SlotDevice = &gSettings.Smbios.SlotDevices[6];
SlotDevice->SegmentGroupNum = (UINT16)Segment; SlotDevice->SegmentGroupNum = (UINT16)Segment;
SlotDevice->BusNum = (UINT8)Bus; SlotDevice->BusNum = (UINT8)Bus;
SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07)); SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07));
SlotDevice->Valid = TRUE; SlotDevice->Valid = TRUE;
snprintf (SlotDevice->SlotName, 31, "AirPort"); SlotDevice->SlotName = "AirPort"_XS8;
SlotDevice->SlotID = 0; SlotDevice->SlotID = 0;
SlotDevice->SlotType = SlotTypePciExpressX1; SlotDevice->SlotType = SlotTypePciExpressX1;
DBG(" - WIFI: Vendor= "); DBG(" - WIFI: Vendor= ");
@ -6741,12 +6753,12 @@ GetDevices ()
else if ((Pci.Hdr.ClassCode[2] == PCI_CLASS_NETWORK) && else if ((Pci.Hdr.ClassCode[2] == PCI_CLASS_NETWORK) &&
(Pci.Hdr.ClassCode[1] == PCI_CLASS_NETWORK_ETHERNET)) { (Pci.Hdr.ClassCode[1] == PCI_CLASS_NETWORK_ETHERNET)) {
SlotDevice = &SlotDevices[5]; SlotDevice = &gSettings.Smbios.SlotDevices[5];
SlotDevice->SegmentGroupNum = (UINT16)Segment; SlotDevice->SegmentGroupNum = (UINT16)Segment;
SlotDevice->BusNum = (UINT8)Bus; SlotDevice->BusNum = (UINT8)Bus;
SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07)); SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07));
SlotDevice->Valid = TRUE; SlotDevice->Valid = TRUE;
snprintf (SlotDevice->SlotName, 31, "Ethernet"); SlotDevice->SlotName = "Ethernet"_XS8;
SlotDevice->SlotID = 2; SlotDevice->SlotID = 2;
SlotDevice->SlotType = SlotTypePciExpressX1; SlotDevice->SlotType = SlotTypePciExpressX1;
gLanVendor[nLanCards] = Pci.Hdr.VendorId; gLanVendor[nLanCards] = Pci.Hdr.VendorId;
@ -6786,12 +6798,12 @@ GetDevices ()
else if ((Pci.Hdr.ClassCode[2] == PCI_CLASS_SERIAL) && else if ((Pci.Hdr.ClassCode[2] == PCI_CLASS_SERIAL) &&
(Pci.Hdr.ClassCode[1] == PCI_CLASS_SERIAL_FIREWIRE)) { (Pci.Hdr.ClassCode[1] == PCI_CLASS_SERIAL_FIREWIRE)) {
SlotDevice = &SlotDevices[12]; SlotDevice = &gSettings.Smbios.SlotDevices[12];
SlotDevice->SegmentGroupNum = (UINT16)Segment; SlotDevice->SegmentGroupNum = (UINT16)Segment;
SlotDevice->BusNum = (UINT8)Bus; SlotDevice->BusNum = (UINT8)Bus;
SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07)); SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07));
SlotDevice->Valid = TRUE; SlotDevice->Valid = TRUE;
snprintf (SlotDevice->SlotName, 31, "FireWire"); SlotDevice->SlotName = "FireWire"_XS8;
SlotDevice->SlotID = 3; SlotDevice->SlotID = 3;
SlotDevice->SlotType = SlotTypePciExpressX4; SlotDevice->SlotType = SlotTypePciExpressX4;
} }
@ -6813,12 +6825,12 @@ GetDevices ()
if (IsHDMIAudio(HandleArray[Index])) { if (IsHDMIAudio(HandleArray[Index])) {
DBG(" - HDMI Audio: \n"); DBG(" - HDMI Audio: \n");
SlotDevice = &SlotDevices[4]; SlotDevice = &gSettings.Smbios.SlotDevices[4];
SlotDevice->SegmentGroupNum = (UINT16)Segment; SlotDevice->SegmentGroupNum = (UINT16)Segment;
SlotDevice->BusNum = (UINT8)Bus; SlotDevice->BusNum = (UINT8)Bus;
SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07)); SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07));
SlotDevice->Valid = TRUE; SlotDevice->Valid = TRUE;
snprintf (SlotDevice->SlotName, 31, "HDMI port"); SlotDevice->SlotName = "HDMI port"_XS8;
SlotDevice->SlotID = 5; SlotDevice->SlotID = 5;
SlotDevice->SlotType = SlotTypePciExpressX4; SlotDevice->SlotType = SlotTypePciExpressX4;
} }
@ -6860,7 +6872,6 @@ SetDevices (LOADER_ENTRY *Entry)
UINTN Function; UINTN Function;
BOOLEAN StringDirty = FALSE; BOOLEAN StringDirty = FALSE;
BOOLEAN TmpDirty = FALSE; BOOLEAN TmpDirty = FALSE;
UINT16 PmCon;
UINT32 Rcba; UINT32 Rcba;
UINT32 Hptc; UINT32 Hptc;
DevPropDevice *device = NULL; DevPropDevice *device = NULL;
@ -7597,48 +7608,50 @@ SetDevices (LOADER_ENTRY *Entry)
else if ((Pci.Hdr.ClassCode[2] == PCI_CLASS_BRIDGE) && else if ((Pci.Hdr.ClassCode[2] == PCI_CLASS_BRIDGE) &&
(Pci.Hdr.ClassCode[1] == PCI_CLASS_BRIDGE_ISA)) (Pci.Hdr.ClassCode[1] == PCI_CLASS_BRIDGE_ISA))
{ {
if (gSettings.LpcTune) { // 2021-04 Jief : LpcTune doesn't exist in Settings.cpp. Never set to true.
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16, GEN_PMCON_1, 1, &PmCon); // if (gSettings.LpcTune) {
MsgLog ("Initial PmCon value=%hX\n", PmCon); // UINT16 PmCon;
// Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16, GEN_PMCON_1, 1, &PmCon);
if (GlobalConfig.EnableC6) { // MsgLog ("Initial PmCon value=%hX\n", PmCon);
PmCon |= 1 << 11; //
DBG("C6 enabled\n"); // if (GlobalConfig.EnableC6) {
} else { // PmCon |= 1 << 11;
PmCon &= ~(1 << 11); // DBG("C6 enabled\n");
DBG("C6 disabled\n"); // } else {
} // PmCon &= ~(1 << 11);
/* // DBG("C6 disabled\n");
if (GlobalConfig.EnableC2) { // }
PmCon |= 1 << 10; // /*
DBG("BIOS_PCIE enabled\n"); // if (GlobalConfig.EnableC2) {
} else { // PmCon |= 1 << 10;
PmCon &= ~(1 << 10); // DBG("BIOS_PCIE enabled\n");
DBG("BIOS_PCIE disabled\n"); // } else {
} // PmCon &= ~(1 << 10);
*/ // DBG("BIOS_PCIE disabled\n");
if (GlobalConfig.EnableC4) { // }
PmCon |= 1 << 7; // */
DBG("C4 enabled\n"); // if (GlobalConfig.EnableC4) {
} else { // PmCon |= 1 << 7;
PmCon &= ~(1 << 7); // DBG("C4 enabled\n");
DBG("C4 disabled\n"); // } else {
} // PmCon &= ~(1 << 7);
// DBG("C4 disabled\n");
if (gSettings.ACPI.SSDT.EnableISS) { // }
PmCon |= 1 << 3; //
DBG("SpeedStep enabled\n"); // if (gSettings.ACPI.SSDT.EnableISS) {
} else { // PmCon |= 1 << 3;
PmCon &= ~(1 << 3); // DBG("SpeedStep enabled\n");
DBG("SpeedStep disabled\n"); // } else {
} // PmCon &= ~(1 << 3);
// DBG("SpeedStep disabled\n");
PciIo->Pci.Write (PciIo, EfiPciIoWidthUint16, GEN_PMCON_1, 1, &PmCon); // }
//
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16,GEN_PMCON_1, 1, &PmCon); // PciIo->Pci.Write (PciIo, EfiPciIoWidthUint16, GEN_PMCON_1, 1, &PmCon);
MsgLog ("Set PmCon value=%hX\n", PmCon); //
// Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16,GEN_PMCON_1, 1, &PmCon);
} // MsgLog ("Set PmCon value=%hX\n", PmCon);
//
// }
Rcba = 0; Rcba = 0;
/* Scan Port */ /* Scan Port */
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32, 0xF0, 1, &Rcba); Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32, 0xF0, 1, &Rcba);
@ -7731,7 +7744,7 @@ SaveSettings ()
{ {
// TODO: SetVariable().. // TODO: SetVariable()..
// here we can apply user settings instead of default one // here we can apply user settings instead of default one
gMobile = gSettings.Mobile; gMobile = gSettings.Smbios.Mobile;
if ((gSettings.CPU.BusSpeed != 0) && (gSettings.CPU.BusSpeed > 10 * Kilo) && (gSettings.CPU.BusSpeed < 500 * Kilo)) { if ((gSettings.CPU.BusSpeed != 0) && (gSettings.CPU.BusSpeed > 10 * Kilo) && (gSettings.CPU.BusSpeed < 500 * Kilo)) {
switch (gCPUStructure.Model) { switch (gCPUStructure.Model) {
@ -7935,8 +7948,8 @@ InjectKextsFromDir (
// FSInject->AddStringToList(Blacklist, L"\\System\\Library\\Extensions.mkext"); // 10.6 // FSInject->AddStringToList(Blacklist, L"\\System\\Library\\Extensions.mkext"); // 10.6
// FSInject->AddStringToList(Blacklist, L"\\System\\Library\\Caches\\com.apple.kext.caches\\Startup\\kernelcache"); // 10.6/10.6 - 10.9 // FSInject->AddStringToList(Blacklist, L"\\System\\Library\\Caches\\com.apple.kext.caches\\Startup\\kernelcache"); // 10.6/10.6 - 10.9
// //
// if (gSettings.BlockKexts[0] != L'\0') { // if (gSettings.BlockKexts.notEmpty()) {
// FSInject->AddStringToList(Blacklist, SWPrintf("\\System\\Library\\Extensions\\%ls", gSettings.BlockKexts).wc_str()); // FSInject->AddStringToList(Blacklist, SWPrintf("\\System\\Library\\Extensions\\%ls", gSettings.BlockKexts.wc_str()).wc_str());
// } // }
// } // }
// //
@ -7993,7 +8006,7 @@ EFI_GUID nullUUID = {0,0,0,{0}};
const XString8& SETTINGS_DATA::getUUID() const XString8& SETTINGS_DATA::getUUID()
{ {
if ( SystemParameters.CustomUuid.notEmpty() ) return SystemParameters.CustomUuid; if ( SystemParameters.CustomUuid.notEmpty() ) return SystemParameters.CustomUuid;
return SmUUID; return Smbios.SmUUID;
} }
const XString8& SETTINGS_DATA::getUUID(EFI_GUID *uuid) const XString8& SETTINGS_DATA::getUUID(EFI_GUID *uuid)
@ -8011,9 +8024,9 @@ const XString8& SETTINGS_DATA::getUUID(EFI_GUID *uuid)
#endif #endif
return SystemParameters.CustomUuid; return SystemParameters.CustomUuid;
} }
EFI_STATUS Status = StrToGuidLE(SmUUID, uuid); EFI_STATUS Status = StrToGuidLE(Smbios.SmUUID, uuid);
#ifdef DEBUG #ifdef DEBUG
if ( EFI_ERROR(Status) ) panic("SmUUID(%s) is not valid", SmUUID.c_str()); // same as before if ( EFI_ERROR(Status) ) panic("SmUUID(%s) is not valid", Smbios.SmUUID.c_str()); // same as before
#else #else
if ( EFI_ERROR(Status) ) { if ( EFI_ERROR(Status) ) {
DBG("SmUUID(%s) is not valid\n", SmUUID.c_str()); DBG("SmUUID(%s) is not valid\n", SmUUID.c_str());
@ -8022,7 +8035,7 @@ const XString8& SETTINGS_DATA::getUUID(EFI_GUID *uuid)
} }
#endif #endif
return SmUUID; return Smbios.SmUUID;
} }

View File

@ -13,7 +13,7 @@
#include "../libeg/XIcon.h" #include "../libeg/XIcon.h"
#include "../cpp_lib/undefinable.h" #include "../cpp_lib/undefinable.h"
#include "../entry_scan/loader.h" // for KERNEL_SCAN_xxx constants #include "../entry_scan/loader.h" // for KERNEL_SCAN_xxx constants
#include "../Platform/smbios.h"
#define CLOVER_SIGN SIGNATURE_32('C','l','v','r') #define CLOVER_SIGN SIGNATURE_32('C','l','v','r')
@ -437,6 +437,20 @@ public:
}; };
class SLOT_DEVICE
{
public:
UINT16 SegmentGroupNum; // assigned by GetDevices
UINT8 BusNum; // assigned by GetDevices
UINT8 DevFuncNum; // assigned by GetDevices
bool Valid; // assigned by GetDevices
//UINT8 DeviceN;
UINT8 SlotID;
MISC_SLOT_TYPE SlotType;
XString8 SlotName;
} ;
class SETTINGS_DATA; class SETTINGS_DATA;
class ConfigPlistClass; class ConfigPlistClass;
class TagDict; class TagDict;
@ -594,7 +608,8 @@ public:
XStringW ScreenResolution = XStringW(); XStringW ScreenResolution = XStringW();
bool ProvideConsoleGop = 0; bool ProvideConsoleGop = 0;
INTN ConsoleMode = 0; INTN ConsoleMode = 0;
LANGUAGES Language = english; XString8 Language;
LanguageCode languageCode = english;
bool KbdPrevLang = 0; bool KbdPrevLang = 0;
XString8Array HVHideStrings = XString8Array(); XString8Array HVHideStrings = XString8Array();
ScanClass Scan = ScanClass(); ScanClass Scan = ScanClass();
@ -903,14 +918,14 @@ printf("%s", "");
bool compareOldAndCompatibleArb() bool compareOldAndCompatibleArb()
{ {
{ // {
size_t oldArbIdx = 0; // size_t oldArbIdx = 0;
const DEV_PROPERTY* arb = ArbProperties; // const DEV_PROPERTY* arb = ArbProperties;
while ( arb ) { // while ( arb ) {
printf("ArbProperties[%zu].Key = %s\n", oldArbIdx++, arb->Key); // printf("ArbProperties[%zu].Key = %s\n", oldArbIdx++, arb->Key);
arb = arb->Next; // arb = arb->Next;
} // }
} // }
const XObjArray<DEV_PROPERTY> compatibleArbProperties = getCompatibleArbProperty(); const XObjArray<DEV_PROPERTY> compatibleArbProperties = getCompatibleArbProperty();
size_t oldArbIdx = 0; size_t oldArbIdx = 0;
for ( size_t idx = 0 ; idx < compatibleArbProperties.size() ; ++idx ) for ( size_t idx = 0 ; idx < compatibleArbProperties.size() ; ++idx )
@ -1029,6 +1044,78 @@ printf("%s", "");
}; };
class SmbiosClass {
public:
class MemoryClass {
public:
UINT8 SlotCounts;
UINT8 UserChannels;
RAM_SLOT_INFO User[MAX_RAM_SLOTS * 4];
};
// SMBIOS TYPE0
XString8 BiosVendor;
XString8 _RomVersion;
XString8 _EfiVersion;
XString8 _ReleaseDate;
// SMBIOS TYPE1
XString8 ManufactureName;
XString8 ProductName;
XString8 VersionNr;
XString8 SerialNr;
XString8 SmUUID;
XString8 FamilyName;
// SMBIOS TYPE2
XString8 BoardManufactureName;
XString8 BoardSerialNumber;
XString8 BoardNumber; //Board-ID
XString8 LocationInChassis;
XString8 BoardVersion;
UINT8 BoardType;
// SMBIOS TYPE3
bool Mobile;
UINT8 ChassisType;
XString8 ChassisManufacturer;
XString8 ChassisAssetTag;
// SMBIOS TYPE4
// SMBIOS TYPE17
UINT16 SmbiosVersion;
INT8 Attribute;
// These were set but never used.
// XString8 MemoryManufacturer;
// XString8 MemorySerialNumber;
// XString8 MemoryPartNumber;
// XString8 MemorySpeed;
// SMBIOS TYPE131
// SMBIOS TYPE132
bool TrustSMBIOS = 0;
bool InjectMemoryTables; // same as Memory.SlotCounts
// SMBIOS TYPE133
UINT64 gPlatformFeature;
// PatchTableType11
bool NoRomInfo;
UINT32 gFwFeatures;
UINT32 gFwFeaturesMask;
MemoryClass Memory = MemoryClass();
SLOT_DEVICE SlotDevices[16]; //assume DEV_XXX, Arpt=6
// These are calculated from ApplePlatformData
CHAR8 RPlt[8] = {0};
CHAR8 RBr[8] = {0};
UINT8 EPCI[4] = {0};
UINT8 REV[6] = {0};
};
class BootGraphicsClass {
public:
UINT32 DefaultBackgroundColor = 0;
UINT32 UIScale = 0;
UINT32 EFILoginHiDPI = 0;
UINT8 flagstate[32] = {0};
};
BootClass Boot = BootClass(); BootClass Boot = BootClass();
ACPIClass ACPI = ACPIClass(); ACPIClass ACPI = ACPIClass();
@ -1041,171 +1128,18 @@ printf("%s", "");
QuirksClass Quirks = QuirksClass(); QuirksClass Quirks = QuirksClass();
RtVariablesClass RtVariables = RtVariablesClass(); RtVariablesClass RtVariables = RtVariablesClass();
DevicesClass Devices = DevicesClass(); DevicesClass Devices = DevicesClass();
SmbiosClass Smbios = SmbiosClass();
// SMBIOS TYPE0 BootGraphicsClass BootGraphics = BootGraphicsClass();
XString8 VendorName;
XString8 RomVersion;
XString8 EfiVersion;
XString8 ReleaseDate;
// SMBIOS TYPE1
XString8 ManufactureName;
XString8 ProductName;
XString8 VersionNr;
XString8 SerialNr;
XString8 SmUUID;
//CHAR8 Uuid;
//CHAR8 SKUNumber;
XString8 FamilyName;
XString8 OEMProduct;
XString8 OEMVendor;
// SMBIOS TYPE2
XString8 BoardManufactureName;
XString8 BoardSerialNumber;
XString8 BoardNumber; //Board-ID
XString8 LocationInChassis;
XString8 BoardVersion;
XString8 OEMBoard;
UINT8 BoardType;
// SMBIOS TYPE3
BOOLEAN Mobile;
UINT8 ChassisType;
XString8 ChassisManufacturer;
XString8 ChassisAssetTag;
// SMBIOS TYPE4
UINT8 EnabledCores;
// SMBIOS TYPE17
UINT16 SmbiosVersion;
INT8 Attribute;
XString8 MemoryManufacturer;
XString8 MemorySerialNumber;
XString8 MemoryPartNumber;
XString8 MemorySpeed;
// SMBIOS TYPE131
// SMBIOS TYPE132
BOOLEAN TrustSMBIOS = 0;
BOOLEAN InjectMemoryTables;
// SMBIOS TYPE133
UINT64 PlatformFeature;
// PatchTableType11
BOOLEAN NoRomInfo;
// OS parameters
XString8 Language;
//Monitor //other
//Boot options // UINT16 DropOEM_DSM; // not used anymore.
BOOLEAN MemoryFix; // BOOLEAN LpcTune; // never set to true.
BOOLEAN FakeSMCFound;
// GUI parameters SETTINGS_DATA() {}
BOOLEAN Debug;
UINT32 DefaultBackgroundColor;
//ACPI
// BOOLEAN DropMCFG;
//Injections
//Graphics
// UINT16 PCIRootUID;
BOOLEAN LpcTune;
UINT16 DropOEM_DSM; //vacant
// USB DeviceTree injection
//SkyLake
//Volumes hiding
// KernelAndKextPatches
BOOLEAN KextPatchesAllowed;
BOOLEAN KernelPatchesAllowed; //From GUI: Only for user patches, not internal Clover
// Pre-language
// SysVariables
// Multi-config
CHAR16 ConfigName[30];
// XString8 MainConfigName;
//Drivers
//SMC keys
CHAR8 RPlt[8];
CHAR8 RBr[8];
UINT8 EPCI[4];
UINT8 REV[6];
//other devices
BOOLEAN SlpWak;
BOOLEAN UseIntelHDMI;
//Add custom properties
//BlackListed kexts
CHAR16 BlockKexts[64];
// Disable inject kexts
// UINT32 DisableInjectKextCount;
// CHAR16 **DisabledInjectKext;
// INPUT_ITEM *InjectKextMenuItem;
//ACPI tables
//other
// UINT32 AudioVolume;
// boot.efi
UINT32 OptionsBits;
UINT32 FlagsBits;
UINT32 UIScale;
UINT32 EFILoginHiDPI;
UINT8 flagstate[32];
SETTINGS_DATA() : VendorName(), RomVersion(), EfiVersion(), ReleaseDate(), ManufactureName(), ProductName(), VersionNr(), SerialNr(), SmUUID(),
FamilyName(), OEMProduct(), OEMVendor(), BoardManufactureName(), BoardSerialNumber(), BoardNumber(), LocationInChassis(),
BoardVersion(), OEMBoard(), BoardType(0), Mobile(0), ChassisType(0), ChassisManufacturer(), ChassisAssetTag(),
EnabledCores(0), SmbiosVersion(0), Attribute(0), MemoryManufacturer(),
MemorySerialNumber(), MemoryPartNumber(), MemorySpeed(), InjectMemoryTables(0),
PlatformFeature(0), NoRomInfo(0), Language(),
MemoryFix(0),
FakeSMCFound(0), Debug(0), DefaultBackgroundColor(0),
LpcTune(0), DropOEM_DSM(0),
KextPatchesAllowed(0),
KernelPatchesAllowed(0),
ConfigName{0}, /*MainConfigName(0),*/ /*BlackListCount(0),*/ RPlt{0}, RBr{0}, EPCI{0}, REV{0},
SlpWak(0), UseIntelHDMI(0),
BlockKexts{0},
OptionsBits(0), FlagsBits(0), UIScale(0), EFILoginHiDPI(0), flagstate{0}
{};
SETTINGS_DATA(const SETTINGS_DATA& other) = delete; // Can be defined if needed SETTINGS_DATA(const SETTINGS_DATA& other) = delete; // Can be defined if needed
const SETTINGS_DATA& operator = ( const SETTINGS_DATA & ) = delete; // Can be defined if needed const SETTINGS_DATA& operator = ( const SETTINGS_DATA & ) = delete; // Can be defined if needed
// XBuffer<UINT8> serialize() const;
~SETTINGS_DATA() {} ~SETTINGS_DATA() {}
const XString8& getUUID(); const XString8& getUUID();
@ -1217,7 +1151,7 @@ printf("%s", "");
if ( SystemParameters._InjectSystemID == 2 ) return false; if ( SystemParameters._InjectSystemID == 2 ) return false;
else return SystemParameters._InjectSystemID; else return SystemParameters._InjectSystemID;
} }
if ( SmUUID.isEmpty() || SmUUID == nullGuidAsString ) return false; if ( Smbios.SmUUID.isEmpty() || Smbios.SmUUID == nullGuidAsString ) return false;
if ( SystemParameters._InjectSystemID == 2 ) return true; if ( SystemParameters._InjectSystemID == 2 ) return true;
return SystemParameters._InjectSystemID; return SystemParameters._InjectSystemID;
} }
@ -1256,17 +1190,6 @@ typedef struct _DRIVERS_FLAGS {
BOOLEAN APFSLoaded; BOOLEAN APFSLoaded;
} DRIVERS_FLAGS; } DRIVERS_FLAGS;
typedef struct {
UINT16 SegmentGroupNum;
UINT8 BusNum;
UINT8 DevFuncNum;
BOOLEAN Valid;
//UINT8 DeviceN;
UINT8 SlotID;
UINT8 SlotType;
CHAR8 SlotName[31];
} SLOT_DEVICE;
// ACPI/PATCHED/AML // ACPI/PATCHED/AML
class ACPI_PATCHED_AML class ACPI_PATCHED_AML
{ {
@ -1330,7 +1253,6 @@ extern UINTN NHDA;
extern SETTINGS_DATA gSettings; extern SETTINGS_DATA gSettings;
extern BOOLEAN gFirmwareClover; extern BOOLEAN gFirmwareClover;
extern DRIVERS_FLAGS gDriversFlags; extern DRIVERS_FLAGS gDriversFlags;
extern SLOT_DEVICE SlotDevices[];
extern EFI_EDID_DISCOVERED_PROTOCOL *EdidDiscovered; extern EFI_EDID_DISCOVERED_PROTOCOL *EdidDiscovered;
//extern UINT8 *gEDID; //extern UINT8 *gEDID;
@ -1415,6 +1337,25 @@ public:
bool Turbo = true; bool Turbo = true;
XString8 OEMProductFromSmbios = XString8();
XString8 OEMVendorFromSmbios = XString8();
XString8 OEMBoardFromSmbios = XString8();
UINT8 EnabledCores = 0;
// XStringW ConfigName; // Set but never used
UINT32 OptionsBits = 0;
UINT32 FlagsBits = 0;
XStringW BlockKexts;
// KernelAndKextPatches
BOOLEAN KextPatchesAllowed = 0;
BOOLEAN KernelPatchesAllowed = 0; //From GUI: Only for user patches, not internal Clover
XString8 RomVersionUsed = XString8();
XString8 EfiVersionUsed = XString8();
XString8 ReleaseDateUsed = XString8();
REFIT_CONFIG() {}; REFIT_CONFIG() {};
REFIT_CONFIG(const REFIT_CONFIG& other) = delete; // Can be defined if needed REFIT_CONFIG(const REFIT_CONFIG& other) = delete; // Can be defined if needed
const REFIT_CONFIG& operator = ( const REFIT_CONFIG & ) = delete; // Can be defined if needed const REFIT_CONFIG& operator = ( const REFIT_CONFIG & ) = delete; // Can be defined if needed
@ -1518,10 +1459,7 @@ LoadUserSettings (
TagDict** dict TagDict** dict
); );
void void ParseSMBIOSSettings(SETTINGS_DATA& gSettings, const TagDict* DictPointer);
ParseSMBIOSSettings (
const TagDict* dictPointer
);
void testConfigPlist(); void testConfigPlist();

View File

@ -975,7 +975,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
BOOLEAN SetSnb = FALSE; BOOLEAN SetSnb = FALSE;
BOOLEAN SetIg = FALSE; BOOLEAN SetIg = FALSE;
MACHINE_TYPES MacModel = GetModelFromString(gSettings.ProductName); MACHINE_TYPES MacModel = GetModelFromString(gSettings.Smbios.ProductName);
devicepath = get_pci_dev_path(gma_dev); devicepath = get_pci_dev_path(gma_dev);
@ -1509,7 +1509,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
//devprop_add_value(device, "device_type", (UINT8*)"display", 7); // this key displays two intel graphics cards in system report on 10.13.4+ //devprop_add_value(device, "device_type", (UINT8*)"display", 7); // this key displays two intel graphics cards in system report on 10.13.4+
devprop_add_value(device, "subsystem-vendor-id", common_vals[2], 4); devprop_add_value(device, "subsystem-vendor-id", common_vals[2], 4);
devprop_add_value(device, "class-code", (UINT8*)ClassFix, 4); devprop_add_value(device, "class-code", (UINT8*)ClassFix, 4);
/*if (gSettings.Mobile) { /*if (gSettings.Smbios.Mobile) {
UINT32 IntelDisplay = 1; UINT32 IntelDisplay = 1;
// these are not reference keys for all. why add these keys? // these are not reference keys for all. why add these keys?
devprop_add_value(device, "AAPL,backlight-control", (UINT8*)&IntelDisplay, 4); devprop_add_value(device, "AAPL,backlight-control", (UINT8*)&IntelDisplay, 4);
@ -2023,7 +2023,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
break; break;
default: default:
if (!SetIg) { if (!SetIg) {
if (gSettings.Mobile) { if (gSettings.Smbios.Mobile) {
devprop_add_value(device, "AAPL,ig-platform-id", ivy_bridge_ig_vals[7], 4); devprop_add_value(device, "AAPL,ig-platform-id", ivy_bridge_ig_vals[7], 4);
DBG(" Found ig-platform-id = 0x01660004\n"); DBG(" Found ig-platform-id = 0x01660004\n");
} else { } else {
@ -2501,7 +2501,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
break; break;
default: default:
if (!SetIg) { if (!SetIg) {
if (gSettings.Mobile) { if (gSettings.Smbios.Mobile) {
devprop_add_value(device, "AAPL,ig-platform-id", skylake_ig_vals[1], 4); devprop_add_value(device, "AAPL,ig-platform-id", skylake_ig_vals[1], 4);
DBG(" Found ig-platform-id = 0x19120000\n"); DBG(" Found ig-platform-id = 0x19120000\n");
} else { } else {
@ -2859,7 +2859,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
break; break;
default: default:
if (!SetIg) { if (!SetIg) {
if (gSettings.Mobile) { if (gSettings.Smbios.Mobile) {
devprop_add_value(device, "AAPL,ig-platform-id", kabylake_ig_vals[0], 4); devprop_add_value(device, "AAPL,ig-platform-id", kabylake_ig_vals[0], 4);
DBG(" Found ig-platform-id = 0x59120000\n"); DBG(" Found ig-platform-id = 0x59120000\n");
} else { } else {
@ -3106,7 +3106,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
break; break;
default: default:
if (!SetIg) { if (!SetIg) {
if (gSettings.Mobile) { if (gSettings.Smbios.Mobile) {
devprop_add_value(device, "AAPL,ig-platform-id", coffeelake_ig_vals[6], 4); devprop_add_value(device, "AAPL,ig-platform-id", coffeelake_ig_vals[6], 4);
DBG(" Found ig-platform-id = 0x3E9B0000\n"); DBG(" Found ig-platform-id = 0x3E9B0000\n");
} else { } else {

View File

@ -11,6 +11,9 @@
#include "../cpp_foundation/XStringArray.h" #include "../cpp_foundation/XStringArray.h"
#include "../cpp_foundation/unicode_conversions.h" #include "../cpp_foundation/unicode_conversions.h"
extern "C" {
#include <Uefi/UefiBaseType.h> // for EFI_GUID
}
extern "C" EFI_GUID gEfiMiscSubClassGuid; extern "C" EFI_GUID gEfiMiscSubClassGuid;

View File

@ -2619,7 +2619,7 @@ LOADER_ENTRY::BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize)
// //
//// DBG_RT("\nKernelToPatch: "); //// DBG_RT("\nKernelToPatch: ");
//// DBG_RT("Kernels patches: %d\n", KernelAndKextPatches.KernelPatches.size()); //// DBG_RT("Kernels patches: %d\n", KernelAndKextPatches.KernelPatches.size());
// if (gSettings.KernelPatchesAllowed && KernelAndKextPatches.KernelPatches.notEmpty()) { // if (GlobalConfig.KernelPatchesAllowed && KernelAndKextPatches.KernelPatches.notEmpty()) {
//// DBG_RT("Enabled: \n"); //// DBG_RT("Enabled: \n");
// DBG("Kernels patches: enabled \n"); // DBG("Kernels patches: enabled \n");
//// KernelAndKextPatcherInit(); //// KernelAndKextPatcherInit();
@ -2780,16 +2780,16 @@ LOADER_ENTRY::BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize)
// if (/*OSFLAG_ISSET(Flags, OSFLAG_WITHKEXTS) || */ // if (/*OSFLAG_ISSET(Flags, OSFLAG_WITHKEXTS) || */
// OSFLAG_ISSET(Flags, OSFLAG_CHECKFAKESMC)) { // OSFLAG_ISSET(Flags, OSFLAG_CHECKFAKESMC)) {
// DBG_RT( "\nAllowing kext patching to check if FakeSMC is present\n"); // DBG_RT( "\nAllowing kext patching to check if FakeSMC is present\n");
// gSettings.KextPatchesAllowed = TRUE; // GlobalConfig.KextPatchesAllowed = TRUE;
// KextPatchesNeeded = TRUE; // KextPatchesNeeded = TRUE;
// } // }
// //
// DBG_RT( "\nKextPatches Needed: %c, Allowed: %c ... ", // DBG_RT( "\nKextPatches Needed: %c, Allowed: %c ... ",
// (KextPatchesNeeded ? L'Y' : L'n'), // (KextPatchesNeeded ? L'Y' : L'n'),
// (gSettings.KextPatchesAllowed ? L'Y' : L'n') // (GlobalConfig.KextPatchesAllowed ? L'Y' : L'n')
// ); // );
// //
// if (KextPatchesNeeded && gSettings.KextPatchesAllowed) { // if (KextPatchesNeeded && GlobalConfig.KextPatchesAllowed) {
//// DBG_RT( "\nKext patching INIT\n"); //// DBG_RT( "\nKext patching INIT\n");
//// KernelAndKextPatcherInit(); //// KernelAndKextPatcherInit();
//// if (KernelData == NULL) goto NoKernelData; //// if (KernelData == NULL) goto NoKernelData;

View File

@ -909,7 +909,7 @@ EFI_STATUS LOADER_ENTRY::InjectKexts(IN UINT32 deviceTreeP, IN UINT32* deviceTre
KextBase = RoundPage(KextBase + KextEntry->kext.length); KextBase = RoundPage(KextBase + KextEntry->kext.length);
DBG_RT(" %llu - %s\n", Index, (CHAR8 *)(UINTN)drvinfo->bundlePathPhysAddr); DBG_RT(" %llu - %s\n", Index, (CHAR8 *)(UINTN)drvinfo->bundlePathPhysAddr);
DBG(" %llu - %s\n", Index, (CHAR8 *)(UINTN)drvinfo->bundlePathPhysAddr); DBG(" %llu - %s\n", Index, (CHAR8 *)(UINTN)drvinfo->bundlePathPhysAddr);
if (gSettings.KextPatchesAllowed) { if (GlobalConfig.KextPatchesAllowed) {
CHAR8 SavedValue; CHAR8 SavedValue;
CHAR8 *InfoPlist = (CHAR8*)(UINTN)drvinfo->infoDictPhysAddr; CHAR8 *InfoPlist = (CHAR8*)(UINTN)drvinfo->infoDictPhysAddr;
SavedValue = InfoPlist[drvinfo->infoDictLength]; SavedValue = InfoPlist[drvinfo->infoDictLength];

View File

@ -26,10 +26,6 @@
#define DBG(...) DebugLog(DEBUG_PLATFORMDATA, __VA_ARGS__) #define DBG(...) DebugLog(DEBUG_PLATFORMDATA, __VA_ARGS__)
#endif #endif
UINT32 gFwFeatures;
UINT32 gFwFeaturesMask;
UINT64 gPlatformFeature;
// All SMBIOS data were updated by Sherlocks, PMheart. // All SMBIOS data were updated by Sherlocks, PMheart.
// FredWst supported SmcExtract. // FredWst supported SmcExtract.
@ -598,12 +594,22 @@ PLATFORMDATA ApplePlatformData[] =
0x01, 0x43, 0x0f, 0, 0, 0x04, "NA"_XS8, "NA"_XS8, 0x79001 }, // need rBR RPlt EPCI 0x01, 0x43, 0x0f, 0, 0, 0x04, "NA"_XS8, "NA"_XS8, 0x79001 }, // need rBR RPlt EPCI
}; };
void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine) /*
* To ease copy/paste and text replacement from GetUserSettings, the parameter has the same name as the global
* and is passed by non-const reference.
* This temporary during the refactoring
* All code from this comes from settings.cpp. I am taking out all the init code from settings.cpp so I can replace the reading layer.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
void SetDMISettingsForModel(SETTINGS_DATA& gSettings, MACHINE_TYPES Model, BOOLEAN Redefine)
{ {
#pragma GCC diagnostic pop
const CHAR8 *i; const CHAR8 *i;
gSettings.VendorName = BiosVendor; gSettings.Smbios.BiosVendor = AppleBiosVendor;
gSettings.RomVersion = ApplePlatformData[Model].firmwareVersion; GlobalConfig.RomVersionUsed = ApplePlatformData[Model].firmwareVersion;
// AppleReleaseDate // AppleReleaseDate
switch (Model) { switch (Model) {
@ -668,7 +674,7 @@ void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
while (*i != '.') { while (*i != '.') {
i--; i--;
} }
gSettings.ReleaseDate.S8Printf("%c%c/%c%c/%c%c", i[3], i[4], i[5], i[6], i[1], i[2]); GlobalConfig.ReleaseDateUsed.S8Printf("%c%c/%c%c/%c%c", i[3], i[4], i[5], i[6], i[1], i[2]);
break; break;
default: default:
@ -678,26 +684,25 @@ void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
while (*i != '.') { while (*i != '.') {
i--; i--;
} }
gSettings.ReleaseDate.S8Printf("%c%c/%c%c/20%c%c", i[3], i[4], i[5], i[6], i[1], i[2]); GlobalConfig.ReleaseDateUsed.S8Printf("%c%c/%c%c/20%c%c", i[3], i[4], i[5], i[6], i[1], i[2]);
break; break;
} }
gSettings.EfiVersion.takeValueFrom(ApplePlatformData[Model].efiversion); GlobalConfig.EfiVersionUsed.takeValueFrom(ApplePlatformData[Model].efiversion);
gSettings.EfiVersion.trim(); gSettings.Smbios.ManufactureName = gSettings.Smbios.BiosVendor;
gSettings.ManufactureName = BiosVendor;
if (Redefine) { if (Redefine) {
gSettings.ProductName = ApplePlatformData[Model].productName; gSettings.Smbios.ProductName = ApplePlatformData[Model].productName;
} }
gSettings.VersionNr = ApplePlatformData[Model].systemVersion; gSettings.Smbios.VersionNr = ApplePlatformData[Model].systemVersion;
gSettings.SerialNr = ApplePlatformData[Model].serialNumber; gSettings.Smbios.SerialNr = ApplePlatformData[Model].serialNumber;
gSettings.FamilyName = ApplePlatformData[Model].productFamily; gSettings.Smbios.FamilyName = ApplePlatformData[Model].productFamily;
gSettings.BoardManufactureName = BiosVendor; gSettings.Smbios.BoardManufactureName = gSettings.Smbios.BiosVendor;
gSettings.BoardSerialNumber = AppleBoardSN; gSettings.Smbios.BoardSerialNumber = AppleBoardSN;
gSettings.BoardNumber = ApplePlatformData[Model].boardID; gSettings.Smbios.BoardNumber = ApplePlatformData[Model].boardID;
gSettings.BoardVersion = ApplePlatformData[Model].productName; gSettings.Smbios.BoardVersion = ApplePlatformData[Model].productName;
gSettings.LocationInChassis = AppleBoardLocation; gSettings.Smbios.LocationInChassis = AppleBoardLocation;
gSettings.ChassisManufacturer = BiosVendor; gSettings.Smbios.ChassisManufacturer = gSettings.Smbios.BiosVendor;
gSettings.ChassisAssetTag = ApplePlatformData[Model].chassisAsset; gSettings.Smbios.ChassisAssetTag = ApplePlatformData[Model].chassisAsset;
// Firmware info for 10.13+ // Firmware info for 10.13+
// by Sherlocks // by Sherlocks
@ -706,14 +711,14 @@ void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
// Verified list from Firmware // Verified list from Firmware
case MacBookPro91: case MacBookPro91:
case MacBookPro92: case MacBookPro92:
gFwFeatures = 0xC00DE137; gSettings.Smbios.gFwFeatures = 0xC00DE137;
break; break;
case MacBookAir41: case MacBookAir41:
case MacBookAir42: case MacBookAir42:
case MacMini51: case MacMini51:
case MacMini52: case MacMini52:
case MacMini53: case MacMini53:
gFwFeatures = 0xD00DE137; gSettings.Smbios.gFwFeatures = 0xD00DE137;
break; break;
case MacBookPro101: case MacBookPro101:
case MacBookPro102: case MacBookPro102:
@ -724,30 +729,30 @@ void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
case iMac131: case iMac131:
case iMac132: case iMac132:
case iMac133: case iMac133:
gFwFeatures = 0xE00DE137; gSettings.Smbios.gFwFeatures = 0xE00DE137;
break; break;
case MacMini81: case MacMini81:
gFwFeatures = 0xFD8FF466; gSettings.Smbios.gFwFeatures = 0xFD8FF466;
break; break;
case MacBookAir61: case MacBookAir61:
case MacBookAir62: case MacBookAir62:
case iMac141: case iMac141:
case iMac142: case iMac142:
case iMac143: case iMac143:
gFwFeatures = 0xE00FE137; gSettings.Smbios.gFwFeatures = 0xE00FE137;
break; break;
case MacBookPro111: case MacBookPro111:
case MacBookPro112: case MacBookPro112:
case MacBookPro113: case MacBookPro113:
case MacBookPro114: case MacBookPro114:
case MacBookPro115: case MacBookPro115:
gFwFeatures = 0xE80FE137; gSettings.Smbios.gFwFeatures = 0xE80FE137;
break; break;
case iMac144: case iMac144:
gFwFeatures = 0xF00FE177; gSettings.Smbios.gFwFeatures = 0xF00FE177;
break; break;
case iMac151: case iMac151:
gFwFeatures = 0xF80FE177; gSettings.Smbios.gFwFeatures = 0xF80FE177;
break; break;
case MacBookPro131: case MacBookPro131:
case MacBookPro132: case MacBookPro132:
@ -757,41 +762,41 @@ void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
case iMac181: case iMac181:
case iMac182: case iMac182:
case iMac183: case iMac183:
gFwFeatures = 0xFC0FE176; gSettings.Smbios.gFwFeatures = 0xFC0FE176;
break; break;
case MacBook91: case MacBook91:
case MacBook101: case MacBook101:
case MacBookPro133: case MacBookPro133:
case MacBookPro143: case MacBookPro143:
gFwFeatures = 0xFC0FE17E; gSettings.Smbios.gFwFeatures = 0xFC0FE17E;
break; break;
case iMacPro11: case iMacPro11:
gFwFeatures = 0xFD8FF53F; gSettings.Smbios.gFwFeatures = 0xFD8FF53F;
break; break;
case MacBookAir91: case MacBookAir91:
gFwFeatures = 0xFD8FF42E; gSettings.Smbios.gFwFeatures = 0xFD8FF42E;
break; break;
case iMac191: case iMac191:
case iMac192: case iMac192:
case iMac201: case iMac201:
case iMac202: case iMac202:
gFwFeatures = 0xFD8FF576; gSettings.Smbios.gFwFeatures = 0xFD8FF576;
break; break;
case MacBookPro162: case MacBookPro162:
case MacBookPro163: case MacBookPro163:
case MacBookPro164: case MacBookPro164:
gFwFeatures = 0xFDAFF066; gSettings.Smbios.gFwFeatures = 0xFDAFF066;
break; break;
// Verified list from Users // Verified list from Users
case MacBookAir31: case MacBookAir31:
case MacBookAir32: case MacBookAir32:
case MacMini41: case MacMini41:
gFwFeatures = 0xD00DE137; gSettings.Smbios.gFwFeatures = 0xD00DE137;
break; break;
case MacBookAir71: case MacBookAir71:
case MacBookAir72: case MacBookAir72:
gFwFeatures = 0xE00FE137; gSettings.Smbios.gFwFeatures = 0xE00FE137;
break; break;
case iMac101: case iMac101:
case iMac111: case iMac111:
@ -800,16 +805,16 @@ void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
case iMac121: case iMac121:
case iMac122: case iMac122:
case MacMini71: case MacMini71:
gFwFeatures = 0xE00DE137; gSettings.Smbios.gFwFeatures = 0xE00DE137;
break; break;
case MacPro51: case MacPro51:
gFwFeatures = 0xE80FE137; gSettings.Smbios.gFwFeatures = 0xE80FE137;
break; break;
case MacPro61: case MacPro61:
gFwFeatures = 0xE80FE176; gSettings.Smbios.gFwFeatures = 0xE80FE176;
break; break;
case MacPro71: case MacPro71:
gFwFeatures = 0xFD8FF53F; gSettings.Smbios.gFwFeatures = 0xFD8FF53F;
break; break;
case MacBookPro61: case MacBookPro61:
case MacBookPro62: case MacBookPro62:
@ -817,7 +822,7 @@ void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
case MacBookPro81: case MacBookPro81:
case MacBookPro82: case MacBookPro82:
case MacBookPro83: case MacBookPro83:
gFwFeatures = 0xC00DE137; gSettings.Smbios.gFwFeatures = 0xC00DE137;
break; break;
case MacBookPro121: case MacBookPro121:
case MacBookPro151: case MacBookPro151:
@ -829,16 +834,16 @@ void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
case MacBookAir82: case MacBookAir82:
case iMac161: case iMac161:
case iMac162: case iMac162:
gFwFeatures = 0xFC0FE137; gSettings.Smbios.gFwFeatures = 0xFC0FE137;
break; break;
case MacBook61: case MacBook61:
case MacBook71: case MacBook71:
case MacBook81: case MacBook81:
gFwFeatures = 0xFC0FE13F; gSettings.Smbios.gFwFeatures = 0xFC0FE13F;
break; break;
default: default:
gFwFeatures = 0xE907F537; //unknown - use oem SMBIOS value to be default gSettings.Smbios.gFwFeatures = 0xE907F537; //unknown - use oem SMBIOS value to be default
break; break;
} }
@ -871,7 +876,7 @@ void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
case iMac141: case iMac141:
case iMac142: case iMac142:
case iMac143: case iMac143:
gFwFeaturesMask = 0xFF1FFF3F; gSettings.Smbios.gFwFeaturesMask = 0xFF1FFF3F;
break; break;
case MacBook91: case MacBook91:
@ -889,23 +894,23 @@ void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
case iMac182: case iMac182:
case iMac183: case iMac183:
case MacPro61: case MacPro61:
gFwFeaturesMask = 0xFF1FFF7F; gSettings.Smbios.gFwFeaturesMask = 0xFF1FFF7F;
break; break;
case iMacPro11: case iMacPro11:
case MacBookAir91: case MacBookAir91:
gFwFeaturesMask = 0xFF9FFF3F; gSettings.Smbios.gFwFeaturesMask = 0xFF9FFF3F;
break; break;
case iMac191: case iMac191:
case iMac192: case iMac192:
case iMac201: case iMac201:
case iMac202: case iMac202:
case MacMini81: case MacMini81:
gFwFeaturesMask = 0xFFDFFF7F; gSettings.Smbios.gFwFeaturesMask = 0xFFDFFF7F;
break; break;
case MacBookPro162: case MacBookPro162:
case MacBookPro163: case MacBookPro163:
case MacBookPro164: case MacBookPro164:
gFwFeaturesMask = 0xFFFFFF7F; gSettings.Smbios.gFwFeaturesMask = 0xFFFFFF7F;
break; break;
// Verified list from Users // Verified list from Users
@ -941,15 +946,15 @@ void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
case iMac161: case iMac161:
case iMac162: case iMac162:
case MacPro51: case MacPro51:
gFwFeaturesMask = 0xFF1FFF3F; gSettings.Smbios.gFwFeaturesMask = 0xFF1FFF3F;
break; break;
case MacPro71: case MacPro71:
gFwFeaturesMask = 0xFF9FFF3F; gSettings.Smbios.gFwFeaturesMask = 0xFF9FFF3F;
break; break;
default: default:
gFwFeaturesMask = 0xFFFFFFFF; //unknown - use oem SMBIOS value to be default gSettings.Smbios.gFwFeaturesMask = 0xFFFFFFFF; //unknown - use oem SMBIOS value to be default
break; break;
} }
@ -963,7 +968,7 @@ void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
case iMac182: case iMac182:
case iMac183: case iMac183:
case MacPro71: case MacPro71:
gPlatformFeature = 0x00; gSettings.Smbios.gPlatformFeature = 0x00;
break; break;
case MacMini61: case MacMini61:
case MacMini62: case MacMini62:
@ -975,7 +980,7 @@ void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
case iMac143: case iMac143:
case iMac144: case iMac144:
case iMac151: case iMac151:
gPlatformFeature = 0x01; gSettings.Smbios.gPlatformFeature = 0x01;
break; break;
case MacBookPro111: case MacBookPro111:
case MacBookPro112: case MacBookPro112:
@ -985,15 +990,15 @@ void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
case MacBookPro121: case MacBookPro121:
case MacBookAir71: case MacBookAir71:
case MacBookAir72: case MacBookAir72:
gPlatformFeature = 0x02; gSettings.Smbios.gPlatformFeature = 0x02;
break; break;
case MacMini71: case MacMini71:
case iMac161: case iMac161:
case iMac162: case iMac162:
gPlatformFeature = 0x03; gSettings.Smbios.gPlatformFeature = 0x03;
break; break;
case MacPro61: case MacPro61:
gPlatformFeature = 0x04; gSettings.Smbios.gPlatformFeature = 0x04;
break; break;
case MacBook81: case MacBook81:
case MacBook91: case MacBook91:
@ -1004,7 +1009,7 @@ void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
case MacBookPro141: case MacBookPro141:
case MacBookPro142: case MacBookPro142:
case MacBookPro143: case MacBookPro143:
gPlatformFeature = 0x1A; gSettings.Smbios.gPlatformFeature = 0x1A;
break; break;
case iMacPro11: case iMacPro11:
case MacMini81: case MacMini81:
@ -1012,7 +1017,7 @@ void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
case iMac192: case iMac192:
case iMac201: case iMac201:
case iMac202: case iMac202:
gPlatformFeature = 0x20; gSettings.Smbios.gPlatformFeature = 0x20;
break; break;
case MacBookPro151: case MacBookPro151:
case MacBookPro152: case MacBookPro152:
@ -1022,12 +1027,12 @@ void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
case MacBookPro162: case MacBookPro162:
case MacBookPro163: case MacBookPro163:
case MacBookPro164: case MacBookPro164:
gPlatformFeature = 0x32; gSettings.Smbios.gPlatformFeature = 0x32;
break; break;
case MacBookAir81: case MacBookAir81:
case MacBookAir82: case MacBookAir82:
case MacBookAir91: case MacBookAir91:
gPlatformFeature = 0x3A; gSettings.Smbios.gPlatformFeature = 0x3A;
break; break;
// It is nonsense, ASCII code сharacter "2" = 0x32 != 0x02. Don't use ioreg, so that not to be confused. Use dmidecode dump. // It is nonsense, ASCII code сharacter "2" = 0x32 != 0x02. Don't use ioreg, so that not to be confused. Use dmidecode dump.
@ -1035,18 +1040,18 @@ void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
// case MacBookPro153: // case MacBookPro153:
// case MacBookPro154: // case MacBookPro154:
// case MacBookPro161: // case MacBookPro161:
// gPlatformFeature = 0x02; // gSettings.Smbios.gPlatformFeature = 0x02;
// break; // break;
default: default:
gPlatformFeature = 0xFFFF; // disabled gSettings.Smbios.gPlatformFeature = 0xFFFF; // disabled
break; break;
} }
if ((Model > MacPro31) && (Model < MacPro71)) { if ((Model > MacPro31) && (Model < MacPro71)) {
gSettings.BoardType = BaseBoardTypeProcessorMemoryModule; //0xB; gSettings.Smbios.BoardType = BaseBoardTypeProcessorMemoryModule; //0xB;
} else { } else {
gSettings.BoardType = BaseBoardTypeMotherBoard; //0xA; gSettings.Smbios.BoardType = BaseBoardTypeMotherBoard; //0xA;
} }
// MiscChassisType // MiscChassisType
@ -1083,13 +1088,13 @@ void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
case MacBookPro114: case MacBookPro114:
case MacBookPro115: case MacBookPro115:
case MacMini71: case MacMini71:
gSettings.ChassisType = MiscChassisTypeNotebook; //0x0A; gSettings.Smbios.ChassisType = MiscChassisTypeNotebook; //0x0A;
switch (Model) { switch (Model) {
case MacMini71: case MacMini71:
gSettings.Mobile = FALSE; gSettings.Smbios.Mobile = FALSE;
break; break;
default: default:
gSettings.Mobile = TRUE; gSettings.Smbios.Mobile = TRUE;
break; break;
} }
break; break;
@ -1129,7 +1134,7 @@ void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
case iMac201: case iMac201:
case iMac202: case iMac202:
case iMacPro11: case iMacPro11:
gSettings.ChassisType = MiscChassisTypeLapTop; //0x09; gSettings.Smbios.ChassisType = MiscChassisTypeLapTop; //0x09;
switch (Model) { switch (Model) {
case MacMini81: case MacMini81:
case iMac161: case iMac161:
@ -1143,10 +1148,10 @@ void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
case iMac201: case iMac201:
case iMac202: case iMac202:
case iMacPro11: case iMacPro11:
gSettings.Mobile = FALSE; gSettings.Smbios.Mobile = FALSE;
break; break;
default: default:
gSettings.Mobile = TRUE; gSettings.Smbios.Mobile = TRUE;
break; break;
} }
break; break;
@ -1165,8 +1170,8 @@ void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
case MacBookPro61: case MacBookPro61:
case MacBookPro62: case MacBookPro62:
case MacBookPro71: case MacBookPro71:
gSettings.ChassisType = MiscChassisTypePortable; //0x08; gSettings.Smbios.ChassisType = MiscChassisTypePortable; //0x08;
gSettings.Mobile = TRUE; gSettings.Smbios.Mobile = TRUE;
break; break;
case iMac41: case iMac41:
@ -1191,14 +1196,14 @@ void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
case iMac143: case iMac143:
case iMac144: case iMac144:
case iMac151: case iMac151:
gSettings.ChassisType = MiscChassisTypeAllInOne; //0x0D; gSettings.Smbios.ChassisType = MiscChassisTypeAllInOne; //0x0D;
gSettings.Mobile = FALSE; gSettings.Smbios.Mobile = FALSE;
break; break;
case MacMini11: case MacMini11:
case MacMini21: case MacMini21:
gSettings.ChassisType = MiscChassisTypeLowProfileDesktop; //0x04; gSettings.Smbios.ChassisType = MiscChassisTypeLowProfileDesktop; //0x04;
gSettings.Mobile = FALSE; gSettings.Smbios.Mobile = FALSE;
break; break;
case MacMini31: case MacMini31:
@ -1208,188 +1213,188 @@ void SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
case MacMini53: case MacMini53:
case MacMini61: case MacMini61:
case MacMini62: case MacMini62:
gSettings.ChassisType = MiscChassisTypeLunchBox; //0x10; gSettings.Smbios.ChassisType = MiscChassisTypeLunchBox; //0x10;
gSettings.Mobile = FALSE; gSettings.Smbios.Mobile = FALSE;
break; break;
case MacPro41: case MacPro41:
case MacPro51: case MacPro51:
case MacPro71: case MacPro71:
gSettings.ChassisType = MiscChassisTypeTower; //0x07; gSettings.Smbios.ChassisType = MiscChassisTypeTower; //0x07;
gSettings.Mobile = FALSE; gSettings.Smbios.Mobile = FALSE;
break; break;
case MacPro11: case MacPro11:
case MacPro21: case MacPro21:
case MacPro31: case MacPro31:
case MacPro61: case MacPro61:
gSettings.ChassisType = MiscChassisTypeUnknown; //0x02; this is a joke but think different! gSettings.Smbios.ChassisType = MiscChassisTypeUnknown; //0x02; this is a joke but think different!
gSettings.Mobile = FALSE; gSettings.Smbios.Mobile = FALSE;
break; break;
case Xserve11: case Xserve11:
case Xserve21: case Xserve21:
case Xserve31: case Xserve31:
gSettings.ChassisType = MiscChassisTypeRackMountChassis; //0x17; gSettings.Smbios.ChassisType = MiscChassisTypeRackMountChassis; //0x17;
gSettings.Mobile = FALSE; gSettings.Smbios.Mobile = FALSE;
break; break;
default: //unknown - use oem SMBIOS value to be default default: //unknown - use oem SMBIOS value to be default
gSettings.Mobile = gMobile; gSettings.Smbios.Mobile = gMobile;
gSettings.ChassisType = 0; //let SMBIOS value to be gSettings.Smbios.ChassisType = 0; //let SMBIOS value to be
/*if (gMobile) { /*if (gMobile) {
gSettings.ChassisType = 10; //notebook gSettings.Smbios.ChassisType = 10; //notebook
} else { } else {
gSettings.ChassisType = MiscChassisTypeDeskTop; //0x03; gSettings.Smbios.ChassisType = MiscChassisTypeDeskTop; //0x03;
}*/ }*/
break; break;
} }
//RBr helper //RBr helper
if (ApplePlatformData[Model].smcBranch[0] != 'N') { if (ApplePlatformData[Model].smcBranch[0] != 'N') {
AsciiStrCpyS(gSettings.RBr, 8, ApplePlatformData[Model].smcBranch.c_str()); AsciiStrCpyS(gSettings.Smbios.RBr, 8, ApplePlatformData[Model].smcBranch.c_str());
} else { } else {
switch (gCPUStructure.Model) { switch (gCPUStructure.Model) {
case CPU_MODEL_PENTIUM_M: case CPU_MODEL_PENTIUM_M:
case CPU_MODEL_CELERON: case CPU_MODEL_CELERON:
AsciiStrCpyS (gSettings.RBr, 8, "m70"); AsciiStrCpyS (gSettings.Smbios.RBr, 8, "m70");
break; break;
case CPU_MODEL_YONAH: case CPU_MODEL_YONAH:
AsciiStrCpyS (gSettings.RBr, 8, "k22"); AsciiStrCpyS (gSettings.Smbios.RBr, 8, "k22");
break; break;
case CPU_MODEL_MEROM: //TODO check for mobile case CPU_MODEL_MEROM: //TODO check for mobile
AsciiStrCpyS (gSettings.RBr, 8, "m75"); AsciiStrCpyS (gSettings.Smbios.RBr, 8, "m75");
break; break;
case CPU_MODEL_PENRYN: case CPU_MODEL_PENRYN:
if (gSettings.Mobile) { if (gSettings.Smbios.Mobile) {
AsciiStrCpyS (gSettings.RBr, 8, "m82"); AsciiStrCpyS (gSettings.Smbios.RBr, 8, "m82");
} else { } else {
AsciiStrCpyS (gSettings.RBr, 8, "k36"); AsciiStrCpyS (gSettings.Smbios.RBr, 8, "k36");
} }
break; break;
case CPU_MODEL_SANDY_BRIDGE: case CPU_MODEL_SANDY_BRIDGE:
if (gSettings.Mobile) { if (gSettings.Smbios.Mobile) {
AsciiStrCpyS (gSettings.RBr, 8, "k90i"); AsciiStrCpyS (gSettings.Smbios.RBr, 8, "k90i");
} else { } else {
AsciiStrCpyS (gSettings.RBr, 8, "k60"); AsciiStrCpyS (gSettings.Smbios.RBr, 8, "k60");
} }
break; break;
case CPU_MODEL_IVY_BRIDGE: case CPU_MODEL_IVY_BRIDGE:
AsciiStrCpyS (gSettings.RBr, 8, "j30"); AsciiStrCpyS (gSettings.Smbios.RBr, 8, "j30");
break; break;
case CPU_MODEL_IVY_BRIDGE_E5: case CPU_MODEL_IVY_BRIDGE_E5:
AsciiStrCpyS (gSettings.RBr, 8, "j90"); AsciiStrCpyS (gSettings.Smbios.RBr, 8, "j90");
break; break;
case CPU_MODEL_HASWELL_ULT: case CPU_MODEL_HASWELL_ULT:
AsciiStrCpyS (gSettings.RBr, 8, "j44"); AsciiStrCpyS (gSettings.Smbios.RBr, 8, "j44");
break; break;
case CPU_MODEL_HASWELL_U5: //Mobile - Broadwell case CPU_MODEL_HASWELL_U5: //Mobile - Broadwell
AsciiStrCpyS (gSettings.RBr, 8, "j52"); AsciiStrCpyS (gSettings.Smbios.RBr, 8, "j52");
break; break;
case CPU_MODEL_SKYLAKE_D: case CPU_MODEL_SKYLAKE_D:
AsciiStrCpyS (gSettings.RBr, 8, "j95j95am"); AsciiStrCpyS (gSettings.Smbios.RBr, 8, "j95j95am");
break; break;
case CPU_MODEL_SKYLAKE_U: case CPU_MODEL_SKYLAKE_U:
AsciiStrCpyS (gSettings.RBr, 8, "2016mb"); AsciiStrCpyS (gSettings.Smbios.RBr, 8, "2016mb");
break; break;
case CPU_MODEL_KABYLAKE1: //Mobile case CPU_MODEL_KABYLAKE1: //Mobile
AsciiStrCpyS (gSettings.RBr, 8, "2017mbp"); AsciiStrCpyS (gSettings.Smbios.RBr, 8, "2017mbp");
break; break;
case CPU_MODEL_KABYLAKE2: //Desktop case CPU_MODEL_KABYLAKE2: //Desktop
AsciiStrCpyS (gSettings.RBr, 8, "j133_4_5"); AsciiStrCpyS (gSettings.Smbios.RBr, 8, "j133_4_5");
break; break;
default: default:
AsciiStrCpyS (gSettings.RBr, 8, "t9"); AsciiStrCpyS (gSettings.Smbios.RBr, 8, "t9");
break; break;
} }
} }
//RPlt helper //RPlt helper
if (ApplePlatformData[Model].smcPlatform[0] != 'N') { if (ApplePlatformData[Model].smcPlatform[0] != 'N') {
AsciiStrCpyS(gSettings.RPlt, 8, ApplePlatformData[Model].smcPlatform.c_str()); AsciiStrCpyS(gSettings.Smbios.RPlt, 8, ApplePlatformData[Model].smcPlatform.c_str());
} else { } else {
switch (gCPUStructure.Model) { switch (gCPUStructure.Model) {
case CPU_MODEL_PENTIUM_M: case CPU_MODEL_PENTIUM_M:
case CPU_MODEL_CELERON: case CPU_MODEL_CELERON:
AsciiStrCpyS (gSettings.RPlt, 8, "m70"); AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "m70");
break; break;
case CPU_MODEL_YONAH: case CPU_MODEL_YONAH:
AsciiStrCpyS (gSettings.RPlt, 8, "k22"); AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "k22");
break; break;
case CPU_MODEL_MEROM: //TODO check for mobile case CPU_MODEL_MEROM: //TODO check for mobile
AsciiStrCpyS (gSettings.RPlt, 8, "m75"); AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "m75");
break; break;
case CPU_MODEL_PENRYN: case CPU_MODEL_PENRYN:
if (gSettings.Mobile) { if (gSettings.Smbios.Mobile) {
AsciiStrCpyS (gSettings.RPlt, 8, "m82"); AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "m82");
} else { } else {
AsciiStrCpyS (gSettings.RPlt, 8, "k36"); AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "k36");
} }
break; break;
case CPU_MODEL_SANDY_BRIDGE: case CPU_MODEL_SANDY_BRIDGE:
if (gSettings.Mobile) { if (gSettings.Smbios.Mobile) {
AsciiStrCpyS (gSettings.RPlt, 8, "k90i"); AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "k90i");
} else { } else {
AsciiStrCpyS (gSettings.RPlt, 8, "k60"); AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "k60");
} }
break; break;
case CPU_MODEL_IVY_BRIDGE: case CPU_MODEL_IVY_BRIDGE:
AsciiStrCpyS (gSettings.RPlt, 8, "j30"); AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "j30");
break; break;
case CPU_MODEL_IVY_BRIDGE_E5: case CPU_MODEL_IVY_BRIDGE_E5:
AsciiStrCpyS (gSettings.RPlt, 8, "j90"); AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "j90");
break; break;
case CPU_MODEL_HASWELL_ULT: case CPU_MODEL_HASWELL_ULT:
AsciiStrCpyS (gSettings.RPlt, 8, "j44"); AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "j44");
break; break;
case CPU_MODEL_HASWELL_U5: //Mobile - Broadwell case CPU_MODEL_HASWELL_U5: //Mobile - Broadwell
AsciiStrCpyS (gSettings.RPlt, 8, "j52"); AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "j52");
break; break;
case CPU_MODEL_SKYLAKE_D: case CPU_MODEL_SKYLAKE_D:
AsciiStrCpyS (gSettings.RPlt, 8, "j95"); AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "j95");
break; break;
case CPU_MODEL_SKYLAKE_U: case CPU_MODEL_SKYLAKE_U:
AsciiStrCpyS (gSettings.RPlt, 8, "j79"); AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "j79");
break; break;
case CPU_MODEL_KABYLAKE1: //Mobile case CPU_MODEL_KABYLAKE1: //Mobile
AsciiStrCpyS (gSettings.RPlt, 8, "j130a"); AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "j130a");
break; break;
case CPU_MODEL_KABYLAKE2: //Desktop case CPU_MODEL_KABYLAKE2: //Desktop
AsciiStrCpyS (gSettings.RPlt, 8, "j135"); AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "j135");
break; break;
default: default:
AsciiStrCpyS (gSettings.RPlt, 8, "t9"); AsciiStrCpyS (gSettings.Smbios.RPlt, 8, "t9");
break; break;
} }
} }
CopyMem(gSettings.REV, ApplePlatformData[Model].smcRevision, 6); CopyMem(gSettings.Smbios.REV, ApplePlatformData[Model].smcRevision, 6);
CopyMem(gSettings.EPCI, &ApplePlatformData[Model].smcConfig, 4); CopyMem(gSettings.Smbios.EPCI, &ApplePlatformData[Model].smcConfig, 4);
} }
MACHINE_TYPES GetModelFromString(const XString8& ProductName) MACHINE_TYPES GetModelFromString(const XString8& ProductName)
@ -1434,10 +1439,10 @@ void GetDefaultSettings()
gSettings.ACPI.DSDT.DsdtName = L"DSDT.aml"_XSW; gSettings.ACPI.DSDT.DsdtName = L"DSDT.aml"_XSW;
gSettings.SystemParameters.BacklightLevel = 0xFFFF; //0x0503; -- the value from MBA52 gSettings.SystemParameters.BacklightLevel = 0xFFFF; //0x0503; -- the value from MBA52
gSettings.SystemParameters.BacklightLevelConfig = FALSE; gSettings.SystemParameters.BacklightLevelConfig = FALSE;
gSettings.TrustSMBIOS = TRUE; gSettings.Smbios.TrustSMBIOS = TRUE;
gSettings.SmUUID = nullGuidAsString; gSettings.Smbios.SmUUID = nullGuidAsString;
gSettings.DefaultBackgroundColor = 0x80000000; //the value to delete the variable gSettings.BootGraphics.DefaultBackgroundColor = 0x80000000; //the value to delete the variable
GlobalConfig.RtROM.setEmpty(); GlobalConfig.RtROM.setEmpty();
gSettings.RtVariables.CsrActiveConfig = 0xFFFF; gSettings.RtVariables.CsrActiveConfig = 0xFFFF;
gSettings.RtVariables.BooterConfig = 0; gSettings.RtVariables.BooterConfig = 0;
@ -1449,19 +1454,28 @@ void GetDefaultSettings()
FreePool(OldCfgStr); FreePool(OldCfgStr);
} }
gSettings.Boot.DisableCloverHotkeys = FALSE; gSettings.Boot.DisableCloverHotkeys = FALSE;
gSettings.UIScale = 1; gSettings.BootGraphics.UIScale = 1;
ResumeFromCoreStorage = FALSE; ResumeFromCoreStorage = FALSE;
} }
void GetDefaultCpuSettings() /*
* To ease copy/paste and text replacement from GetUserSettings, the parameter has the same name as the global
* and is passed by non-const reference.
* This temporary during the refactoring
* All code from this comes from settings.cpp. I am taking out all the init code from settings.cpp so I can replace the reading layer.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
void GetDefaultCpuSettings(SETTINGS_DATA& gSettings)
{ {
#pragma GCC diagnostic pop
DbgHeader("GetDefaultCpuSettings"); DbgHeader("GetDefaultCpuSettings");
MACHINE_TYPES Model; MACHINE_TYPES Model;
//UINT64 msr = 0; //UINT64 msr = 0;
Model = GetDefaultModel(); Model = GetDefaultModel();
gSettings.CPU.CpuType = GetAdvancedCpuType(); gSettings.CPU.CpuType = GetAdvancedCpuType();
SetDMISettingsForModel(Model, TRUE); SetDMISettingsForModel(gSettings, Model, TRUE);
if (gCPUStructure.Model >= CPU_MODEL_IVY_BRIDGE) { if (gCPUStructure.Model >= CPU_MODEL_IVY_BRIDGE) {
gSettings.ACPI.SSDT.Generate.GeneratePStates = TRUE; gSettings.ACPI.SSDT.Generate.GeneratePStates = TRUE;

View File

@ -10,6 +10,7 @@
#include "../cpp_foundation/XString.h" #include "../cpp_foundation/XString.h"
#include "../Platform/Settings.h"
typedef enum { typedef enum {
@ -142,19 +143,14 @@ typedef enum {
constexpr LString8 DefaultMemEntry = "N/A"; constexpr LString8 DefaultMemEntry = "N/A";
constexpr LString8 DefaultSerial = "CT288GT9VT6"; constexpr LString8 DefaultSerial = "CT288GT9VT6";
constexpr LString8 BiosVendor = "Apple Inc."; constexpr LString8 AppleBiosVendor = "Apple Inc.";
constexpr LString8 AppleManufacturer = "Apple Computer, Inc."; //Old name, before 2007 constexpr LString8 AppleManufacturer = "Apple Computer, Inc."; //Old name, before 2007
constexpr LString8 AppleBoardSN = "C02140302D5DMT31M"; constexpr LString8 AppleBoardSN = "C02140302D5DMT31M";
constexpr LString8 AppleBoardLocation = "Part Component"; constexpr LString8 AppleBoardLocation = "Part Component";
extern UINT32 gFwFeatures;
extern UINT32 gFwFeaturesMask;
extern UINT64 gPlatformFeature;
void void
SetDMISettingsForModel ( SetDMISettingsForModel (SETTINGS_DATA& gSettings,
MACHINE_TYPES Model, MACHINE_TYPES Model,
BOOLEAN Redefine BOOLEAN Redefine
); );
@ -167,6 +163,6 @@ void
GetDefaultSettings(void); GetDefaultSettings(void);
void void
GetDefaultCpuSettings(void); GetDefaultCpuSettings(SETTINGS_DATA& gSettings);
#endif /* PLATFORM_PLATFORMDATA_H_ */ #endif /* PLATFORM_PLATFORMDATA_H_ */

View File

@ -3,7 +3,7 @@
// cpp_tests // cpp_tests
// //
// Created by Jief on 24/08/2020. // Created by Jief on 24/08/2020.
// Copyright © 2020 JF Knudsen. All rights reserved. // Copyright © 2020 jief_machack. All rights reserved.
// //
#ifndef base64_h #ifndef base64_h

View File

@ -462,21 +462,21 @@ void PatchTableType0()
UniquifySmbiosTableStr(newSmbiosTable, SMBIOS_TABLE_TYPE0_STR_IDX); UniquifySmbiosTableStr(newSmbiosTable, SMBIOS_TABLE_TYPE0_STR_IDX);
gSettings.VendorName.trim(); gSettings.Smbios.BiosVendor.trim();
if( gSettings.VendorName.notEmpty() ){ if( gSettings.Smbios.BiosVendor.notEmpty() ){
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type0->Vendor, gSettings.VendorName); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type0->Vendor, gSettings.Smbios.BiosVendor);
} }
gSettings.RomVersion.trim(); GlobalConfig.RomVersionUsed.trim();
if( gSettings.RomVersion.notEmpty() ) { if( GlobalConfig.RomVersionUsed.notEmpty() ) {
if( gSettings.EfiVersion.notEmpty() ) { if( GlobalConfig.EfiVersionUsed.notEmpty() ) {
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type0->BiosVersion, gSettings.EfiVersion); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type0->BiosVersion, GlobalConfig.EfiVersionUsed);
} else { } else {
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type0->BiosVersion, gSettings.RomVersion); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type0->BiosVersion, GlobalConfig.RomVersionUsed);
} }
} }
gSettings.ReleaseDate.trim(); GlobalConfig.ReleaseDateUsed.trim();
if( gSettings.ReleaseDate.notEmpty() ) { if( GlobalConfig.ReleaseDateUsed.notEmpty() ) {
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type0->BiosReleaseDate, gSettings.ReleaseDate); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type0->BiosReleaseDate, GlobalConfig.ReleaseDateUsed);
} }
Handle = LogSmbiosTable(newSmbiosTable); Handle = LogSmbiosTable(newSmbiosTable);
} }
@ -492,9 +492,9 @@ void GetTableType1()
return; return;
} }
gSettings.SmUUID = GuidLEToXString8(SmbiosTable.Type1->Uuid); gSettings.Smbios.SmUUID = GuidLEToXString8(SmbiosTable.Type1->Uuid);
s = GetSmbiosString(SmbiosTable, SmbiosTable.Type1->ProductName); s = GetSmbiosString(SmbiosTable, SmbiosTable.Type1->ProductName);
gSettings.OEMProduct.strncpy(s, iStrLen(s, 64)); //strncpy take care of ending zero GlobalConfig.OEMProductFromSmbios.strncpy(s, iStrLen(s, 64)); //strncpy take care of ending zero
return; return;
} }
@ -524,34 +524,34 @@ void PatchTableType1()
Once = TRUE; Once = TRUE;
EFI_GUID SmUUID; EFI_GUID SmUUID;
StrToGuidLE(gSettings.SmUUID, &SmUUID); StrToGuidLE(gSettings.Smbios.SmUUID, &SmUUID);
if((SmUUID.Data3 & 0xF000) != 0) { if((SmUUID.Data3 & 0xF000) != 0) {
CopyMem((void*)&newSmbiosTable.Type1->Uuid, (void*)&SmUUID, sizeof(SmUUID)); CopyMem((void*)&newSmbiosTable.Type1->Uuid, (void*)&SmUUID, sizeof(SmUUID));
} }
gSettings.ManufactureName.trim(); gSettings.Smbios.ManufactureName.trim();
if( gSettings.ManufactureName.notEmpty() ){ if( gSettings.Smbios.ManufactureName.notEmpty() ){
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type1->Manufacturer, gSettings.ManufactureName); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type1->Manufacturer, gSettings.Smbios.ManufactureName);
} }
gSettings.ProductName.trim(); gSettings.Smbios.ProductName.trim();
if( gSettings.ProductName.notEmpty() ){ if( gSettings.Smbios.ProductName.notEmpty() ){
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type1->ProductName, gSettings.ProductName); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type1->ProductName, gSettings.Smbios.ProductName);
} }
gSettings.VersionNr.trim(); gSettings.Smbios.VersionNr.trim();
if( gSettings.VersionNr.notEmpty() ){ if( gSettings.Smbios.VersionNr.notEmpty() ){
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type1->Version, gSettings.VersionNr); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type1->Version, gSettings.Smbios.VersionNr);
} }
gSettings.SerialNr.trim(); gSettings.Smbios.SerialNr.trim();
if( gSettings.SerialNr.notEmpty() ){ if( gSettings.Smbios.SerialNr.notEmpty() ){
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type1->SerialNumber, gSettings.SerialNr); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type1->SerialNumber, gSettings.Smbios.SerialNr);
} }
gSettings.BoardNumber.trim(); gSettings.Smbios.BoardNumber.trim();
if( gSettings.BoardNumber.notEmpty() ){ if( gSettings.Smbios.BoardNumber.notEmpty() ){
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type1->SKUNumber, gSettings.BoardNumber); //iMac17,1 - there is nothing UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type1->SKUNumber, gSettings.Smbios.BoardNumber); //iMac17,1 - there is nothing
} }
gSettings.FamilyName.trim(); gSettings.Smbios.FamilyName.trim();
if( gSettings.FamilyName.notEmpty() ){ if( gSettings.Smbios.FamilyName.notEmpty() ){
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type1->Family, gSettings.FamilyName); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type1->Family, gSettings.Smbios.FamilyName);
} }
Handle = LogSmbiosTable(newSmbiosTable); Handle = LogSmbiosTable(newSmbiosTable);
@ -569,9 +569,9 @@ void GetTableType2()
} }
s = GetSmbiosString(SmbiosTable, SmbiosTable.Type2->ProductName); s = GetSmbiosString(SmbiosTable, SmbiosTable.Type2->ProductName);
gSettings.OEMBoard.strncpy(s, iStrLen(s, 64) + 1); GlobalConfig.OEMBoardFromSmbios.strncpy(s, iStrLen(s, 64) + 1);
s = GetSmbiosString(SmbiosTable, SmbiosTable.Type2->Manufacturer); s = GetSmbiosString(SmbiosTable, SmbiosTable.Type2->Manufacturer);
gSettings.OEMVendor.strncpy(s, iStrLen(s, 64) + 1); GlobalConfig.OEMVendorFromSmbios.strncpy(s, iStrLen(s, 64) + 1);
} }
@ -603,36 +603,36 @@ void PatchTableType2()
newSmbiosTable.Type2->Hdr.Length = (UINT8)NewSize; newSmbiosTable.Type2->Hdr.Length = (UINT8)NewSize;
newSmbiosTable.Type2->ChassisHandle = mHandle3; //from GetTableType3 newSmbiosTable.Type2->ChassisHandle = mHandle3; //from GetTableType3
newSmbiosTable.Type2->BoardType = gSettings.BoardType; newSmbiosTable.Type2->BoardType = gSettings.Smbios.BoardType;
ZeroMem((void*)&newSmbiosTable.Type2->FeatureFlag, sizeof(BASE_BOARD_FEATURE_FLAGS)); ZeroMem((void*)&newSmbiosTable.Type2->FeatureFlag, sizeof(BASE_BOARD_FEATURE_FLAGS));
newSmbiosTable.Type2->FeatureFlag.Motherboard = 1; newSmbiosTable.Type2->FeatureFlag.Motherboard = 1;
newSmbiosTable.Type2->FeatureFlag.Replaceable = 1; newSmbiosTable.Type2->FeatureFlag.Replaceable = 1;
if (gSettings.BoardType == 11) { if (gSettings.Smbios.BoardType == 11) {
newSmbiosTable.Type2->FeatureFlag.Removable = 1; newSmbiosTable.Type2->FeatureFlag.Removable = 1;
} }
Once = TRUE; Once = TRUE;
UniquifySmbiosTableStr(newSmbiosTable, SMBIOS_TABLE_TYPE2_STR_IDX); UniquifySmbiosTableStr(newSmbiosTable, SMBIOS_TABLE_TYPE2_STR_IDX);
gSettings.BoardManufactureName.trim(); gSettings.Smbios.BoardManufactureName.trim();
if( gSettings.BoardManufactureName.notEmpty() ){ if( gSettings.Smbios.BoardManufactureName.notEmpty() ){
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type2->Manufacturer, gSettings.BoardManufactureName); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type2->Manufacturer, gSettings.Smbios.BoardManufactureName);
} }
gSettings.BoardNumber.trim(); gSettings.Smbios.BoardNumber.trim();
if( gSettings.BoardNumber.notEmpty() ){ if( gSettings.Smbios.BoardNumber.notEmpty() ){
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type2->ProductName, gSettings.BoardNumber); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type2->ProductName, gSettings.Smbios.BoardNumber);
} }
gSettings.BoardVersion.trim(); gSettings.Smbios.BoardVersion.trim();
if( gSettings.BoardVersion.notEmpty() ){ if( gSettings.Smbios.BoardVersion.notEmpty() ){
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type2->Version, gSettings.BoardVersion); //iMac17,1 - there is ProductName UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type2->Version, gSettings.Smbios.BoardVersion); //iMac17,1 - there is ProductName
} }
gSettings.BoardSerialNumber.trim(); gSettings.Smbios.BoardSerialNumber.trim();
if( gSettings.BoardSerialNumber.notEmpty() ){ if( gSettings.Smbios.BoardSerialNumber.notEmpty() ){
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type2->SerialNumber, gSettings.BoardSerialNumber); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type2->SerialNumber, gSettings.Smbios.BoardSerialNumber);
} }
gSettings.LocationInChassis.trim(); gSettings.Smbios.LocationInChassis.trim();
if( gSettings.LocationInChassis.notEmpty() ){ if( gSettings.Smbios.LocationInChassis.notEmpty() ){
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type2->LocationInChassis, gSettings.LocationInChassis); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type2->LocationInChassis, gSettings.Smbios.LocationInChassis);
} }
//what about Asset Tag??? Not used in real mac. till now. //what about Asset Tag??? Not used in real mac. till now.
@ -698,26 +698,26 @@ void PatchTableType3()
UniquifySmbiosTableStr(newSmbiosTable, SMBIOS_TABLE_TYPE3_STR_IDX); UniquifySmbiosTableStr(newSmbiosTable, SMBIOS_TABLE_TYPE3_STR_IDX);
if (gSettings.ChassisType != 0) { if (gSettings.Smbios.ChassisType != 0) {
newSmbiosTable.Type3->Type = gSettings.ChassisType; newSmbiosTable.Type3->Type = gSettings.Smbios.ChassisType;
} }
gSettings.ChassisManufacturer.trim(); gSettings.Smbios.ChassisManufacturer.trim();
if( gSettings.ChassisManufacturer.notEmpty() ){ if( gSettings.Smbios.ChassisManufacturer.notEmpty() ){
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type3->Manufacturer, gSettings.ChassisManufacturer); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type3->Manufacturer, gSettings.Smbios.ChassisManufacturer);
} }
//SIC! According to iMac there must be the BoardNumber //SIC! According to iMac there must be the BoardNumber
gSettings.BoardNumber.trim(); gSettings.Smbios.BoardNumber.trim();
if( gSettings.BoardNumber.notEmpty() ){ if( gSettings.Smbios.BoardNumber.notEmpty() ){
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type3->Version, gSettings.BoardNumber); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type3->Version, gSettings.Smbios.BoardNumber);
} }
gSettings.SerialNr.trim(); gSettings.Smbios.SerialNr.trim();
if( gSettings.SerialNr.notEmpty() ){ if( gSettings.Smbios.SerialNr.notEmpty() ){
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type3->SerialNumber, gSettings.SerialNr); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type3->SerialNumber, gSettings.Smbios.SerialNr);
} }
gSettings.ChassisAssetTag.trim(); gSettings.Smbios.ChassisAssetTag.trim();
if( gSettings.ChassisAssetTag.notEmpty() ){ if( gSettings.Smbios.ChassisAssetTag.notEmpty() ){
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type3->AssetTag, gSettings.ChassisAssetTag); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type3->AssetTag, gSettings.Smbios.ChassisAssetTag);
} }
Handle = LogSmbiosTable(newSmbiosTable); Handle = LogSmbiosTable(newSmbiosTable);
@ -752,9 +752,9 @@ void GetTableType4()
size_t off = OFFSET_OF(SMBIOS_TABLE_TYPE4, EnabledCoreCount); size_t off = OFFSET_OF(SMBIOS_TABLE_TYPE4, EnabledCoreCount);
if (SmbiosTable.Type4->Hdr.Length > off) { //Smbios >= 2.5 if (SmbiosTable.Type4->Hdr.Length > off) { //Smbios >= 2.5
gSettings.EnabledCores = SmbiosTable.Type4->EnabledCoreCount; GlobalConfig.EnabledCores = SmbiosTable.Type4->EnabledCoreCount;
} else { } else {
gSettings.EnabledCores = 0; //to change later GlobalConfig.EnabledCores = 0; //to change later
} }
//snwprintf(gSettings.CpuFreqMHz, 10, "%d", gCPUStructure.CurrentSpeed); //snwprintf(gSettings.CpuFreqMHz, 10, "%d", gCPUStructure.CurrentSpeed);
@ -812,7 +812,7 @@ void PatchTableType4()
//DBG("insert ExternalClock: %d MHz\n", (INT32)(DivU64x32(gCPUStructure.ExternalClock, Kilo))); //DBG("insert ExternalClock: %d MHz\n", (INT32)(DivU64x32(gCPUStructure.ExternalClock, Kilo)));
newSmbiosTable.Type4->ExternalClock = (UINT16)DivU64x32 (gCPUStructure.ExternalClock, Kilo); newSmbiosTable.Type4->ExternalClock = (UINT16)DivU64x32 (gCPUStructure.ExternalClock, Kilo);
newSmbiosTable.Type4->EnabledCoreCount = gSettings.EnabledCores; newSmbiosTable.Type4->EnabledCoreCount = GlobalConfig.EnabledCores;
//some verifications //some verifications
if ((newSmbiosTable.Type4->ThreadCount < newSmbiosTable.Type4->CoreCount) || if ((newSmbiosTable.Type4->ThreadCount < newSmbiosTable.Type4->CoreCount) ||
newSmbiosTable.Type4->ThreadCount > newSmbiosTable.Type4->CoreCount * 2) { newSmbiosTable.Type4->ThreadCount > newSmbiosTable.Type4->CoreCount * 2) {
@ -1061,29 +1061,29 @@ void PatchTableType9()
// real PC -> PCI, real Mac -> PCIe // real PC -> PCI, real Mac -> PCIe
for (Index = 0; Index < 15; Index++) { for (Index = 0; Index < 15; Index++) {
if (SlotDevices[Index].Valid) { if (gSettings.Smbios.SlotDevices[Index].Valid) {
INTN Dev, Func; INTN Dev, Func;
ZeroMem((void*)newSmbiosTable.Type9, MAX_TABLE_SIZE); ZeroMem((void*)newSmbiosTable.Type9, MAX_TABLE_SIZE);
newSmbiosTable.Type9->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_SLOTS; newSmbiosTable.Type9->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_SLOTS;
newSmbiosTable.Type9->Hdr.Length = sizeof(SMBIOS_TABLE_TYPE9); newSmbiosTable.Type9->Hdr.Length = sizeof(SMBIOS_TABLE_TYPE9);
newSmbiosTable.Type9->Hdr.Handle = (UINT16)(0x0900 + Index); newSmbiosTable.Type9->Hdr.Handle = (UINT16)(0x0900 + Index);
newSmbiosTable.Type9->SlotDesignation = 1; newSmbiosTable.Type9->SlotDesignation = 1;
newSmbiosTable.Type9->SlotType = SlotDevices[Index].SlotType; newSmbiosTable.Type9->SlotType = gSettings.Smbios.SlotDevices[Index].SlotType;
newSmbiosTable.Type9->SlotDataBusWidth = SlotDataBusWidth1X; newSmbiosTable.Type9->SlotDataBusWidth = SlotDataBusWidth1X;
newSmbiosTable.Type9->CurrentUsage = SlotUsageAvailable; newSmbiosTable.Type9->CurrentUsage = SlotUsageAvailable;
newSmbiosTable.Type9->SlotLength = SlotLengthShort; newSmbiosTable.Type9->SlotLength = SlotLengthShort;
newSmbiosTable.Type9->SlotID = SlotDevices[Index].SlotID; newSmbiosTable.Type9->SlotID = gSettings.Smbios.SlotDevices[Index].SlotID;
newSmbiosTable.Type9->SlotCharacteristics1.Provides33Volts = 1; newSmbiosTable.Type9->SlotCharacteristics1.Provides33Volts = 1;
newSmbiosTable.Type9->SlotCharacteristics2.HotPlugDevicesSupported = 1; newSmbiosTable.Type9->SlotCharacteristics2.HotPlugDevicesSupported = 1;
// take this from PCI bus for WiFi card // take this from PCI bus for WiFi card
newSmbiosTable.Type9->SegmentGroupNum = SlotDevices[Index].SegmentGroupNum; newSmbiosTable.Type9->SegmentGroupNum = gSettings.Smbios.SlotDevices[Index].SegmentGroupNum;
newSmbiosTable.Type9->BusNum = SlotDevices[Index].BusNum; newSmbiosTable.Type9->BusNum = gSettings.Smbios.SlotDevices[Index].BusNum;
newSmbiosTable.Type9->DevFuncNum = SlotDevices[Index].DevFuncNum; newSmbiosTable.Type9->DevFuncNum = gSettings.Smbios.SlotDevices[Index].DevFuncNum;
// //
Dev = SlotDevices[Index].DevFuncNum >> 3; Dev = gSettings.Smbios.SlotDevices[Index].DevFuncNum >> 3;
Func = SlotDevices[Index].DevFuncNum & 7; Func = gSettings.Smbios.SlotDevices[Index].DevFuncNum & 7;
DBG("insert table 9 for dev %llX:%llX\n", Dev, Func); DBG("insert table 9 for dev %llX:%llX\n", Dev, Func);
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type9->SlotDesignation, LString8(SlotDevices[Index].SlotName)); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type9->SlotDesignation, gSettings.Smbios.SlotDevices[Index].SlotName);
LogSmbiosTable(newSmbiosTable); LogSmbiosTable(newSmbiosTable);
} }
} }
@ -1112,17 +1112,17 @@ void PatchTableType11()
// ZeroMem(OEMString, MAX_OEM_STRING); // ZeroMem(OEMString, MAX_OEM_STRING);
// AsciiStrCatS(OEMString, MAX_OEM_STRING, "Apple ROM Version.\n"); // AsciiStrCatS(OEMString, MAX_OEM_STRING, "Apple ROM Version.\n");
// //AsciiStrCatS(OEMString, MAX_OEM_STRING, " BIOS ID:"); // //AsciiStrCatS(OEMString, MAX_OEM_STRING, " BIOS ID:");
// //AsciiStrnCatS(OEMString, MAX_OEM_STRING, gSettings.RomVersion, iStrLen(gSettings.RomVersion, 64)); // //AsciiStrnCatS(OEMString, MAX_OEM_STRING, gSettings.Smbios.RomVersion, iStrLen(gSettings.Smbios.RomVersion, 64));
// // AsciiStrCatS(OEMString, MAX_OEM_STRING, "\n EFI Version:"); // // AsciiStrCatS(OEMString, MAX_OEM_STRING, "\n EFI Version:");
// // AsciiStrnCatS(OEMString, MAX_OEM_STRING, gSettings.EfiVersion, iStrLen(gSettings.EfiVersion, 64)); // // AsciiStrnCatS(OEMString, MAX_OEM_STRING, gSettings.Smbios.EfiVersion, iStrLen(gSettings.Smbios.EfiVersion, 64));
// AsciiStrCatS(OEMString, MAX_OEM_STRING, " Board-ID : "); // AsciiStrCatS(OEMString, MAX_OEM_STRING, " Board-ID : ");
// AsciiStrnCatS(OEMString, MAX_OEM_STRING, gSettings.BoardNumber, iStrLen(gSettings.BoardNumber, 64)); // AsciiStrnCatS(OEMString, MAX_OEM_STRING, gSettings.Smbios.BoardNumber, iStrLen(gSettings.Smbios.BoardNumber, 64));
// snprintf(TempRev, MAX_OEM_STRING, "\n⌘ Powered by %s\n", gRevisionStr); // snprintf(TempRev, MAX_OEM_STRING, "\n⌘ Powered by %s\n", gRevisionStr);
// AsciiStrCatS(OEMString, MAX_OEM_STRING, TempRev); // AsciiStrCatS(OEMString, MAX_OEM_STRING, TempRev);
#ifdef JIEF_DEBUG #ifdef JIEF_DEBUG
XString8 OEMString = S8Printf("⌘ Powered by %s\n", gBuildId.c_str()); XString8 OEMString = S8Printf("⌘ Powered by %s\n", gBuildId.c_str());
#else #else
XString8 OEMString = S8Printf("Apple ROM Version.\nBoard-ID : %s\n⌘ Powered by %s\n", gSettings.BoardNumber.c_str(), gRevisionStr); XString8 OEMString = S8Printf("Apple ROM Version.\nBoard-ID : %s\n⌘ Powered by %s\n", gSettings.Smbios.BoardNumber.c_str(), gRevisionStr);
#endif #endif
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type11->StringCount, OEMString); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type11->StringCount, OEMString);
@ -1283,9 +1283,15 @@ void GetTableType17()
// Fill rest of information if in use // Fill rest of information if in use
if (gRAM.SMBIOS[Index].InUse) { if (gRAM.SMBIOS[Index].InUse) {
++(gRAM.SMBIOSInUse); ++(gRAM.SMBIOSInUse);
gRAM.SMBIOS[Index].Vendor = GetSmbiosString(SmbiosTable, SmbiosTable.Type17->Manufacturer); gRAM.SMBIOS[Index].Vendor.takeValueFrom(GetSmbiosString(SmbiosTable, SmbiosTable.Type17->Manufacturer));
gRAM.SMBIOS[Index].SerialNo = GetSmbiosString(SmbiosTable, SmbiosTable.Type17->SerialNumber); gRAM.SMBIOS[Index].Vendor.trim();
gRAM.SMBIOS[Index].PartNo = GetSmbiosString(SmbiosTable, SmbiosTable.Type17->PartNumber); gRAM.SMBIOS[Index].Vendor.deleteCharsAtPos(gRAM.SMBIOS[Index].Vendor.indexOf(' '), MAX_XSIZE);
gRAM.SMBIOS[Index].SerialNo.takeValueFrom(GetSmbiosString(SmbiosTable, SmbiosTable.Type17->SerialNumber));
gRAM.SMBIOS[Index].SerialNo.trim();
gRAM.SMBIOS[Index].SerialNo.deleteCharsAtPos(gRAM.SMBIOS[Index].SerialNo.indexOf(' '), MAX_XSIZE);
gRAM.SMBIOS[Index].PartNo.takeValueFrom(GetSmbiosString(SmbiosTable, SmbiosTable.Type17->PartNumber));
gRAM.SMBIOS[Index].PartNo.trim();
gRAM.SMBIOS[Index].PartNo.deleteCharsAtPos(gRAM.SMBIOS[Index].PartNo.indexOf(' '), MAX_XSIZE);
} }
// DBG("CntMemorySlots = %d\n", gDMI->CntMemorySlots) // DBG("CntMemorySlots = %d\n", gDMI->CntMemorySlots)
// DBG("gDMI->MemoryModules = %d\n", gDMI->MemoryModules) // DBG("gDMI->MemoryModules = %d\n", gDMI->MemoryModules)
@ -1293,9 +1299,9 @@ void GetTableType17()
DBG("SmbiosTable.Type17->Speed = %dMHz\n", gRAM.SMBIOS[Index].Frequency); DBG("SmbiosTable.Type17->Speed = %dMHz\n", gRAM.SMBIOS[Index].Frequency);
DBG("SmbiosTable.Type17->Size = %dMB\n", gRAM.SMBIOS[Index].ModuleSize); DBG("SmbiosTable.Type17->Size = %dMB\n", gRAM.SMBIOS[Index].ModuleSize);
DBG("SmbiosTable.Type17->Bank/Device = %s %s\n", GetSmbiosString(SmbiosTable, SmbiosTable.Type17->BankLocator), GetSmbiosString(SmbiosTable, SmbiosTable.Type17->DeviceLocator)); DBG("SmbiosTable.Type17->Bank/Device = %s %s\n", GetSmbiosString(SmbiosTable, SmbiosTable.Type17->BankLocator), GetSmbiosString(SmbiosTable, SmbiosTable.Type17->DeviceLocator));
DBG("SmbiosTable.Type17->Vendor = %s\n", gRAM.SMBIOS[Index].Vendor); DBG("SmbiosTable.Type17->Vendor = %s\n", gRAM.SMBIOS[Index].Vendor.c_str());
DBG("SmbiosTable.Type17->SerialNumber = %s\n", gRAM.SMBIOS[Index].SerialNo); DBG("SmbiosTable.Type17->SerialNumber = %s\n", gRAM.SMBIOS[Index].SerialNo.c_str());
DBG("SmbiosTable.Type17->PartNumber = %s\n", gRAM.SMBIOS[Index].PartNo); DBG("SmbiosTable.Type17->PartNumber = %s\n", gRAM.SMBIOS[Index].PartNo.c_str());
} }
/* /*
@ -1316,34 +1322,34 @@ void PatchTableType17()
UINT8 expectedCount = 0; UINT8 expectedCount = 0;
UINT8 channels = 2; UINT8 channels = 2;
BOOLEAN insertingEmpty = TRUE; BOOLEAN insertingEmpty = TRUE;
BOOLEAN trustSMBIOS = ((gRAM.SPDInUse == 0) || gSettings.TrustSMBIOS); BOOLEAN trustSMBIOS = ((gRAM.SPDInUse == 0) || gSettings.Smbios.TrustSMBIOS);
BOOLEAN wrongSMBIOSBanks = FALSE; BOOLEAN wrongSMBIOSBanks = FALSE;
BOOLEAN isMacPro = FALSE; BOOLEAN isMacPro = FALSE;
MACHINE_TYPES Model = GetModelFromString(gSettings.ProductName); MACHINE_TYPES Model = GetModelFromString(gSettings.Smbios.ProductName);
if ((Model == MacPro31) || (Model == MacPro41) || (Model == MacPro51) || (Model == MacPro61)) { if ((Model == MacPro31) || (Model == MacPro41) || (Model == MacPro51) || (Model == MacPro61)) {
isMacPro = TRUE; isMacPro = TRUE;
} }
// Inject user memory tables // Inject user memory tables
if (gSettings.InjectMemoryTables) { if (gSettings.Smbios.InjectMemoryTables) {
DBG("Injecting user memory modules to SMBIOS\n"); DBG("Injecting user memory modules to SMBIOS\n");
if (gRAM.UserInUse == 0) { if (gSettings.Smbios.Memory.SlotCounts == 0) {
DBG("User SMBIOS contains no memory modules\n"); DBG("User SMBIOS contains no memory modules\n");
return; return;
} }
// Check channels // Check channels
if ((gRAM.UserChannels == 0) || (gRAM.UserChannels > 8)) { if ((gSettings.Smbios.Memory.UserChannels == 0) || (gSettings.Smbios.Memory.UserChannels > 8)) {
gRAM.UserChannels = 1; gSettings.Smbios.Memory.UserChannels = 1;
} }
if (gRAM.UserInUse >= MAX_RAM_SLOTS) { if (gSettings.Smbios.Memory.SlotCounts >= MAX_RAM_SLOTS) {
gRAM.UserInUse = MAX_RAM_SLOTS; gSettings.Smbios.Memory.SlotCounts = MAX_RAM_SLOTS;
} }
DBG("Channels: %d\n", gRAM.UserChannels); DBG("Channels: %d\n", gSettings.Smbios.Memory.UserChannels);
// Setup interleaved channel map // Setup interleaved channel map
if (channels >= 2) { if (channels >= 2) {
UINT8 doubleChannels = (UINT8)gRAM.UserChannels << 1; UINT8 doubleChannels = (UINT8)gSettings.Smbios.Memory.UserChannels << 1;
for (Index = 0; Index < MAX_RAM_SLOTS; ++Index) { for (Index = 0; Index < MAX_RAM_SLOTS; ++Index) {
channelMap[Index] = (UINT8)(((Index / doubleChannels) * doubleChannels) + channelMap[Index] = (UINT8)(((Index / doubleChannels) * doubleChannels) +
((Index / gRAM.UserChannels) % 2) + ((Index % gRAM.UserChannels) << 1)); ((Index / gSettings.Smbios.Memory.UserChannels) % 2) + ((Index % gSettings.Smbios.Memory.UserChannels) << 1));
} }
} else { } else {
for (Index = 0; Index < MAX_RAM_SLOTS; ++Index) { for (Index = 0; Index < MAX_RAM_SLOTS; ++Index) {
@ -1359,9 +1365,9 @@ void PatchTableType17()
// //
gRAMCount = 0; gRAMCount = 0;
// Inject tables // Inject tables
for (Index = 0; Index < gRAM.UserInUse; Index++) { for (Index = 0; Index < gSettings.Smbios.Memory.SlotCounts; Index++) {
UINTN UserIndex = channelMap[Index]; UINTN UserIndex = channelMap[Index];
UINT8 bank = (UINT8)(Index / gRAM.UserChannels); UINT8 bank = (UINT8)(Index / gSettings.Smbios.Memory.UserChannels);
ZeroMem((void*)newSmbiosTable.Type17, MAX_TABLE_SIZE); ZeroMem((void*)newSmbiosTable.Type17, MAX_TABLE_SIZE);
newSmbiosTable.Type17->Hdr.Type = EFI_SMBIOS_TYPE_MEMORY_DEVICE; newSmbiosTable.Type17->Hdr.Type = EFI_SMBIOS_TYPE_MEMORY_DEVICE;
newSmbiosTable.Type17->Hdr.Length = sizeof(SMBIOS_TABLE_TYPE17); newSmbiosTable.Type17->Hdr.Length = sizeof(SMBIOS_TABLE_TYPE17);
@ -1380,38 +1386,38 @@ void PatchTableType17()
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->BankLocator, bankLocator); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->BankLocator, bankLocator);
} }
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->DeviceLocator, deviceLocator); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->DeviceLocator, deviceLocator);
if ((gRAM.User[UserIndex].InUse) && (gRAM.User[UserIndex].ModuleSize > 0)) { if ((gSettings.Smbios.Memory.User[UserIndex].InUse) && (gSettings.Smbios.Memory.User[UserIndex].ModuleSize > 0)) {
DBG("user SMBIOS data:\n"); DBG("user SMBIOS data:\n");
DBG("SmbiosTable.Type17->Vendor = %s\n", gRAM.User[UserIndex].Vendor); DBG("SmbiosTable.Type17->Vendor = %s\n", gSettings.Smbios.Memory.User[UserIndex].Vendor.c_str());
DBG("SmbiosTable.Type17->SerialNumber = %s\n", gRAM.User[UserIndex].SerialNo); DBG("SmbiosTable.Type17->SerialNumber = %s\n", gSettings.Smbios.Memory.User[UserIndex].SerialNo.c_str());
DBG("SmbiosTable.Type17->PartNumber = %s\n", gRAM.User[UserIndex].PartNo); DBG("SmbiosTable.Type17->PartNumber = %s\n", gSettings.Smbios.Memory.User[UserIndex].PartNo.c_str());
if (gRAM.User[UserIndex].Vendor && iStrLen(gRAM.User[UserIndex].Vendor, 64) > 0) { if (gSettings.Smbios.Memory.User[UserIndex].Vendor.notEmpty()) {
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, LString8(gRAM.User[UserIndex].Vendor)); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, gSettings.Smbios.Memory.User[UserIndex].Vendor);
} else { } else {
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, unknown); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, unknown);
} }
if (gRAM.User[UserIndex].SerialNo && iStrLen(gRAM.User[UserIndex].SerialNo, 64) > 0) { if (gSettings.Smbios.Memory.User[UserIndex].SerialNo.notEmpty()) {
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, LString8(gRAM.User[UserIndex].SerialNo)); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, gSettings.Smbios.Memory.User[UserIndex].SerialNo);
} else { } else {
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, unknown); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, unknown);
} }
if (gRAM.User[UserIndex].PartNo && iStrLen(gRAM.User[UserIndex].PartNo, 64) > 0) { if (gSettings.Smbios.Memory.User[UserIndex].PartNo.notEmpty()) {
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, LString8(gRAM.User[UserIndex].PartNo)); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, gSettings.Smbios.Memory.User[UserIndex].PartNo);
} else { } else {
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, unknown); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, unknown);
} }
newSmbiosTable.Type17->Speed = (UINT16)gRAM.User[UserIndex].Frequency; newSmbiosTable.Type17->Speed = (UINT16)gSettings.Smbios.Memory.User[UserIndex].Frequency;
if (gRAM.User[UserIndex].ModuleSize > 0x7FFF) { if (gSettings.Smbios.Memory.User[UserIndex].ModuleSize > 0x7FFF) {
newSmbiosTable.Type17->Size = 0x7FFF; newSmbiosTable.Type17->Size = 0x7FFF;
newSmbiosTable.Type17->ExtendedSize = gRAM.User[UserIndex].ModuleSize; newSmbiosTable.Type17->ExtendedSize = gSettings.Smbios.Memory.User[UserIndex].ModuleSize;
mTotalSystemMemory += newSmbiosTable.Type17->ExtendedSize; //Mb mTotalSystemMemory += newSmbiosTable.Type17->ExtendedSize; //Mb
} else { } else {
newSmbiosTable.Type17->Size = (UINT16)gRAM.User[UserIndex].ModuleSize; newSmbiosTable.Type17->Size = (UINT16)gSettings.Smbios.Memory.User[UserIndex].ModuleSize;
mTotalSystemMemory += newSmbiosTable.Type17->Size; //Mb mTotalSystemMemory += newSmbiosTable.Type17->Size; //Mb
} }
newSmbiosTable.Type17->MemoryType = gRAM.User[UserIndex].Type; newSmbiosTable.Type17->MemoryType = gSettings.Smbios.Memory.User[UserIndex].Type;
if ((newSmbiosTable.Type17->MemoryType != MemoryTypeDdr2) && if ((newSmbiosTable.Type17->MemoryType != MemoryTypeDdr2) &&
(newSmbiosTable.Type17->MemoryType != MemoryTypeDdr4) && (newSmbiosTable.Type17->MemoryType != MemoryTypeDdr4) &&
(newSmbiosTable.Type17->MemoryType != MemoryTypeDdr)) { (newSmbiosTable.Type17->MemoryType != MemoryTypeDdr)) {
@ -1483,7 +1489,7 @@ void PatchTableType17()
DBG("Trusting SMBIOS...\n"); DBG("Trusting SMBIOS...\n");
} }
// Determine expected slot count // Determine expected slot count
expectedCount = (gRAM.UserInUse != 0) ? gRAM.UserInUse : gRAM.SPDInUse; expectedCount = (gSettings.Smbios.Memory.SlotCounts != 0) ? gSettings.Smbios.Memory.SlotCounts : gRAM.SPDInUse;
if (trustSMBIOS) { if (trustSMBIOS) {
// Use the smbios in use count // Use the smbios in use count
if (expectedCount < gRAM.SMBIOSInUse) { if (expectedCount < gRAM.SMBIOSInUse) {
@ -1513,8 +1519,8 @@ void PatchTableType17()
DBG("Detected alternating SMBIOS channel banks\n"); DBG("Detected alternating SMBIOS channel banks\n");
} }
// Determine if using triple or quadruple channel // Determine if using triple or quadruple channel
if (gRAM.UserChannels != 0) { if (gSettings.Smbios.Memory.UserChannels != 0) {
channels = gRAM.UserChannels; channels = gSettings.Smbios.Memory.UserChannels;
} else if (gRAM.SPDInUse == 0) { } else if (gRAM.SPDInUse == 0) {
if (trustSMBIOS) { if (trustSMBIOS) {
if ((gRAM.SMBIOSInUse % 4) == 0) { if ((gRAM.SMBIOSInUse % 4) == 0) {
@ -1612,31 +1618,31 @@ void PatchTableType17()
SmbiosTable = GetSmbiosTableFromType(EntryPoint, EFI_SMBIOS_TYPE_MEMORY_DEVICE, SMBIOSIndex); SmbiosTable = GetSmbiosTableFromType(EntryPoint, EFI_SMBIOS_TYPE_MEMORY_DEVICE, SMBIOSIndex);
if (trustSMBIOS && gRAM.SMBIOS[SMBIOSIndex].InUse && (SmbiosTable.Raw != NULL)) { if (trustSMBIOS && gRAM.SMBIOS[SMBIOSIndex].InUse && (SmbiosTable.Raw != NULL)) {
DBG("trusted SMBIOS data:\n"); DBG("trusted SMBIOS data:\n");
DBG("SmbiosTable.Type17->Vendor = %s\n", gRAM.SMBIOS[SMBIOSIndex].Vendor); DBG("SmbiosTable.Type17->Vendor = %s\n", gRAM.SMBIOS[SMBIOSIndex].Vendor.c_str());
DBG("SmbiosTable.Type17->SerialNumber = %s\n", gRAM.SMBIOS[SMBIOSIndex].SerialNo); DBG("SmbiosTable.Type17->SerialNumber = %s\n", gRAM.SMBIOS[SMBIOSIndex].SerialNo.c_str());
DBG("SmbiosTable.Type17->PartNumber = %s\n", gRAM.SMBIOS[SMBIOSIndex].PartNo); DBG("SmbiosTable.Type17->PartNumber = %s\n", gRAM.SMBIOS[SMBIOSIndex].PartNo.c_str());
TableSize = SmbiosTableLength(SmbiosTable); TableSize = SmbiosTableLength(SmbiosTable);
CopyMem((void*)newSmbiosTable.Type17, (void *)SmbiosTable.Type17, TableSize); CopyMem((void*)newSmbiosTable.Type17, (void *)SmbiosTable.Type17, TableSize);
newSmbiosTable.Type17->AssetTag = 0; newSmbiosTable.Type17->AssetTag = 0;
if (iStrLen(gRAM.SMBIOS[SMBIOSIndex].Vendor, 64) > 0) { if ( gRAM.SMBIOS[SMBIOSIndex].Vendor.notEmpty() ) {
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, LString8(gRAM.SMBIOS[SMBIOSIndex].Vendor)); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, gRAM.SMBIOS[SMBIOSIndex].Vendor);
gSettings.MemoryManufacturer.takeValueFrom(gRAM.SMBIOS[SMBIOSIndex].Vendor); // gSettings.MemoryManufacturer.takeValueFrom(gRAM.SMBIOS[SMBIOSIndex].Vendor);
} else { } else {
// newSmbiosTable.Type17->Manufacturer = 0; // newSmbiosTable.Type17->Manufacturer = 0;
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, unknown); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, unknown);
} }
if (iStrLen(gRAM.SMBIOS[SMBIOSIndex].SerialNo, 64) > 0) { if ( gRAM.SMBIOS[SMBIOSIndex].SerialNo.notEmpty() ) {
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, LString8(gRAM.SMBIOS[SMBIOSIndex].SerialNo)); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, gRAM.SMBIOS[SMBIOSIndex].SerialNo);
gSettings.MemorySerialNumber.takeValueFrom(gRAM.SMBIOS[SMBIOSIndex].SerialNo); // gSettings.MemorySerialNumber.takeValueFrom(gRAM.SMBIOS[SMBIOSIndex].SerialNo);
} else { } else {
// newSmbiosTable.Type17->SerialNumber = 0; // newSmbiosTable.Type17->SerialNumber = 0;
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, unknown); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, unknown);
} }
if (iStrLen(gRAM.SMBIOS[SMBIOSIndex].PartNo, 64) > 0) { if ( gRAM.SMBIOS[SMBIOSIndex].PartNo.notEmpty() ) {
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, LString8(gRAM.SMBIOS[SMBIOSIndex].PartNo)); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, gRAM.SMBIOS[SMBIOSIndex].PartNo);
gSettings.MemoryPartNumber.takeValueFrom(gRAM.SMBIOS[SMBIOSIndex].PartNo); // gSettings.MemoryPartNumber.takeValueFrom(gRAM.SMBIOS[SMBIOSIndex].PartNo);
DBG(" partNum=%s\n", gRAM.SMBIOS[SMBIOSIndex].PartNo); DBG(" partNum=%s\n", gRAM.SMBIOS[SMBIOSIndex].PartNo.c_str());
} else { } else {
// newSmbiosTable.Type17->PartNumber = 0; // newSmbiosTable.Type17->PartNumber = 0;
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, unknown); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, unknown);
@ -1658,25 +1664,25 @@ void PatchTableType17()
if (gRAM.SPD[SPDIndex].InUse) { if (gRAM.SPD[SPDIndex].InUse) {
DBG("SPD data in use:\n"); DBG("SPD data in use:\n");
DBG("SmbiosTable.Type17->Vendor = %s\n", gRAM.SPD[SPDIndex].Vendor); DBG("SmbiosTable.Type17->Vendor = %s\n", gRAM.SPD[SPDIndex].Vendor.c_str());
DBG("SmbiosTable.Type17->SerialNumber = %s\n", gRAM.SPD[SPDIndex].SerialNo); DBG("SmbiosTable.Type17->SerialNumber = %s\n", gRAM.SPD[SPDIndex].SerialNo.c_str());
DBG("SmbiosTable.Type17->PartNumber = %s\n", gRAM.SPD[SPDIndex].PartNo); DBG("SmbiosTable.Type17->PartNumber = %s\n", gRAM.SPD[SPDIndex].PartNo.c_str());
if (iStrLen(gRAM.SPD[SPDIndex].Vendor, 64) > 0) { if ( gRAM.SPD[SPDIndex].Vendor.notEmpty() ) {
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, LString8(gRAM.SPD[SPDIndex].Vendor)); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, gRAM.SPD[SPDIndex].Vendor);
gSettings.MemoryManufacturer.takeValueFrom(gRAM.SPD[SPDIndex].Vendor); // gSettings.MemoryManufacturer.takeValueFrom(gRAM.SPD[SPDIndex].Vendor);
} else { } else {
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, unknown); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, unknown);
} }
if (iStrLen(gRAM.SPD[SPDIndex].SerialNo, 64) > 0) { if ( gRAM.SPD[SPDIndex].SerialNo.notEmpty() ) {
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, LString8(gRAM.SPD[SPDIndex].SerialNo)); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, gRAM.SPD[SPDIndex].SerialNo);
gSettings.MemorySerialNumber.takeValueFrom(gRAM.SPD[SPDIndex].SerialNo); // gSettings.MemorySerialNumber.takeValueFrom(gRAM.SPD[SPDIndex].SerialNo);
} else { } else {
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, unknown); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->SerialNumber, unknown);
} }
if (iStrLen(gRAM.SPD[SPDIndex].PartNo, 64) > 0) { if ( gRAM.SPD[SPDIndex].PartNo.notEmpty() ) {
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, LString8(gRAM.SPD[SPDIndex].PartNo)); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, gRAM.SPD[SPDIndex].PartNo);
gSettings.MemoryPartNumber.takeValueFrom(gRAM.SPD[SPDIndex].PartNo); // gSettings.MemoryPartNumber.takeValueFrom(gRAM.SPD[SPDIndex].PartNo);
} else { } else {
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, unknown); UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->PartNumber, unknown);
} }
@ -1699,13 +1705,14 @@ void PatchTableType17()
newSmbiosTable.Type17->Speed = (UINT16)gRAM.SMBIOS[SMBIOSIndex].Frequency; newSmbiosTable.Type17->Speed = (UINT16)gRAM.SMBIOS[SMBIOSIndex].Frequency;
} }
if (trustSMBIOS && gRAM.SMBIOS[SMBIOSIndex].InUse && if (trustSMBIOS && gRAM.SMBIOS[SMBIOSIndex].InUse &&
(iStrLen(gRAM.SMBIOS[SMBIOSIndex].Vendor, 64) > 0) && gRAM.SMBIOS[SMBIOSIndex].Vendor.notEmpty() &&
(!gRAM.SPD[SPDIndex].Vendor || strncmp(gRAM.SPD[SPDIndex].Vendor, "NoName", 6) == 0)) { ( gRAM.SPD[SPDIndex].Vendor.isEmpty() || gRAM.SPD[SPDIndex].Vendor == "NoName"_XS8 )
DBG("Type17->Manufacturer corrected by SMBIOS from NoName to %s\n", gRAM.SMBIOS[SMBIOSIndex].Vendor); ) {
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, LString8(gRAM.SMBIOS[SMBIOSIndex].Vendor)); DBG("Type17->Manufacturer corrected by SMBIOS from NoName to %s\n", gRAM.SMBIOS[SMBIOSIndex].Vendor.c_str());
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->Manufacturer, gRAM.SMBIOS[SMBIOSIndex].Vendor);
} }
gSettings.MemorySpeed.S8Printf("%d", newSmbiosTable.Type17->Speed); // gSettings.MemorySpeed.S8Printf("%d", newSmbiosTable.Type17->Speed);
// Assume DDR3 unless explicitly set to DDR2/DDR/DDR4 // Assume DDR3 unless explicitly set to DDR2/DDR/DDR4
if ((newSmbiosTable.Type17->MemoryType != MemoryTypeDdr2) && if ((newSmbiosTable.Type17->MemoryType != MemoryTypeDdr2) &&
@ -1745,8 +1752,8 @@ void PatchTableType17()
// DBG("mTotalSystemMemory = %d\n", mTotalSystemMemory); // DBG("mTotalSystemMemory = %d\n", mTotalSystemMemory);
} }
newSmbiosTable.Type17->MemoryErrorInformationHandle = 0xFFFF; newSmbiosTable.Type17->MemoryErrorInformationHandle = 0xFFFF;
if (gSettings.Attribute != -1) { if (gSettings.Smbios.Attribute != -1) {
newSmbiosTable.Type17->Attributes = gSettings.Attribute; newSmbiosTable.Type17->Attributes = gSettings.Smbios.Attribute;
} }
mHandle17[gRAMCount++] = LogSmbiosTable(newSmbiosTable); mHandle17[gRAMCount++] = LogSmbiosTable(newSmbiosTable);
} }
@ -1883,9 +1890,9 @@ void PatchTableType128()
newSmbiosTable.Type128->Hdr.Handle = 0x8000; newSmbiosTable.Type128->Hdr.Handle = 0x8000;
// set firmware-features, example: 0x80001417, imac11,2 -> 0x1403. // set firmware-features, example: 0x80001417, imac11,2 -> 0x1403.
newSmbiosTable.Type128->FirmwareFeatures = gFwFeatures; newSmbiosTable.Type128->FirmwareFeatures = gSettings.Smbios.gFwFeatures;
// set firmware-features mask // set firmware-features mask
newSmbiosTable.Type128->FirmwareFeaturesMask = gFwFeaturesMask; newSmbiosTable.Type128->FirmwareFeaturesMask = gSettings.Smbios.gFwFeaturesMask;
/** /**
* TODO: I have an idea that region should be the same as Efivar.bin * TODO: I have an idea that region should be the same as Efivar.bin
@ -1978,21 +1985,21 @@ void PatchTableType132()
void PatchTableType133() void PatchTableType133()
{ {
if (gPlatformFeature == 0xFFFF) { if (gSettings.Smbios.gPlatformFeature == 0xFFFF) {
return; return;
} }
// Get Table Type133 // Get Table Type133
SmbiosTable = GetSmbiosTableFromType (EntryPoint, 133, 0); SmbiosTable = GetSmbiosTableFromType (EntryPoint, 133, 0);
if (SmbiosTable.Raw != NULL) { if (SmbiosTable.Raw != NULL) {
MsgLog("Table 133 is present, PlatformFeature=%llX\n", SmbiosTable.Type133->PlatformFeature); MsgLog("Table 133 is present, PlatformFeature=%llX\n", SmbiosTable.Type133->PlatformFeature);
MsgLog("Change to: %llX\n", gPlatformFeature); MsgLog("Change to: %llX\n", gSettings.Smbios.gPlatformFeature);
} }
ZeroMem((void*)newSmbiosTable.Type133, MAX_TABLE_SIZE); ZeroMem((void*)newSmbiosTable.Type133, MAX_TABLE_SIZE);
newSmbiosTable.Type133->Hdr.Type = 133; newSmbiosTable.Type133->Hdr.Type = 133;
newSmbiosTable.Type133->Hdr.Length = sizeof(SMBIOS_STRUCTURE)+8; newSmbiosTable.Type133->Hdr.Length = sizeof(SMBIOS_STRUCTURE)+8;
newSmbiosTable.Type133->Hdr.Handle = 0x8500; //ugly newSmbiosTable.Type133->Hdr.Handle = 0x8500; //ugly
// newSmbiosTable.Type133->PlatformFeature = gPlatformFeature; // newSmbiosTable.Type133->PlatformFeature = gSettings.Smbios.gPlatformFeature;
CopyMem((void*)&newSmbiosTable.Type133->PlatformFeature, (void*)&gPlatformFeature, 8); CopyMem((void*)&newSmbiosTable.Type133->PlatformFeature, (void*)&gSettings.Smbios.gPlatformFeature, 8);
Handle = LogSmbiosTable(newSmbiosTable); Handle = LogSmbiosTable(newSmbiosTable);
return; return;
} }
@ -2060,9 +2067,9 @@ EFI_STATUS PrepatchSmbios()
Current = (UINT8*)Smbios; //begin fill tables from here Current = (UINT8*)Smbios; //begin fill tables from here
SmbiosEpsNew->TableAddress = (UINT32)(UINTN)Current; SmbiosEpsNew->TableAddress = (UINT32)(UINTN)Current;
SmbiosEpsNew->EntryPointLength = sizeof(SMBIOS_TABLE_ENTRY_POINT); // no matter on other versions SmbiosEpsNew->EntryPointLength = sizeof(SMBIOS_TABLE_ENTRY_POINT); // no matter on other versions
if (gSettings.SmbiosVersion != 0) { if (gSettings.Smbios.SmbiosVersion != 0) {
SmbiosEpsNew->MajorVersion = (UINT8)(gSettings.SmbiosVersion >> 8); SmbiosEpsNew->MajorVersion = (UINT8)(gSettings.Smbios.SmbiosVersion >> 8);
SmbiosEpsNew->MinorVersion = (UINT8)(gSettings.SmbiosVersion & 0xFF); SmbiosEpsNew->MinorVersion = (UINT8)(gSettings.Smbios.SmbiosVersion & 0xFF);
SmbiosEpsNew->SmbiosBcdRevision = (SmbiosEpsNew->MajorVersion << 4) + SmbiosEpsNew->MinorVersion; SmbiosEpsNew->SmbiosBcdRevision = (SmbiosEpsNew->MajorVersion << 4) + SmbiosEpsNew->MinorVersion;
} }
else { else {
@ -2104,7 +2111,7 @@ void PatchSmbios(void) //continue
PatchTableType4(); PatchTableType4();
// PatchTableType6(); // PatchTableType6();
PatchTableType9(); PatchTableType9();
if (!gSettings.NoRomInfo) { if (!gSettings.Smbios.NoRomInfo) {
PatchTableType11(); PatchTableType11();
} }
PatchTableTypeSome(); PatchTableTypeSome();

View File

@ -19,15 +19,13 @@ extern "C" {
#define MAX_RAM_FREQUENCY 5000 #define MAX_RAM_FREQUENCY 5000
typedef struct { typedef struct {
BOOLEAN InUse;
UINT8 Type;
UINT16 pad0;
UINT32 pad1;
UINT32 ModuleSize; UINT32 ModuleSize;
UINT32 Frequency; UINT32 Frequency;
CONST CHAR8* Vendor; XString8 Vendor;
CHAR8* PartNo; XString8 PartNo;
CHAR8* SerialNo; XString8 SerialNo;
UINT8 Type;
bool InUse;
} RAM_SLOT_INFO; } RAM_SLOT_INFO;
typedef struct typedef struct
@ -42,13 +40,10 @@ typedef struct
UINT8 Type; UINT8 Type;
UINT8 SPDInUse; UINT8 SPDInUse;
UINT8 SMBIOSInUse; UINT8 SMBIOSInUse;
UINT8 UserInUse;
UINT8 UserChannels;
UINT8 pad[2]; UINT8 pad[2];
RAM_SLOT_INFO SPD[MAX_RAM_SLOTS * 4]; RAM_SLOT_INFO SPD[MAX_RAM_SLOTS * 4];
RAM_SLOT_INFO SMBIOS[MAX_RAM_SLOTS * 4]; RAM_SLOT_INFO SMBIOS[MAX_RAM_SLOTS * 4];
RAM_SLOT_INFO User[MAX_RAM_SLOTS * 4];
} MEM_STRUCTURE; } MEM_STRUCTURE;

View File

@ -384,7 +384,7 @@ CONST CHAR8* getVendorName(RAM_SLOT_INFO* slot, UINT8 *spd, UINT32 base, UINT8 s
} }
} }
/* OK there is no vendor id here lets try to match the partnum if it exists */ /* OK there is no vendor id here lets try to match the partnum if it exists */
if (AsciiStrStr(slot->PartNo,"GU332") == slot->PartNo) { // Unifosa fingerprint if ( slot->PartNo.startWithOrEqualTo("GU332") ) { // Unifosa fingerprint
return "Unifosa"; return "Unifosa";
} }
return "NoName"; return "NoName";
@ -808,9 +808,15 @@ STATIC void read_smb(EFI_PCI_IO_PROTOCOL *PciIo, UINT16 vid, UINT16 did)
if (gRAM.SPD[i].ModuleSize == 0) continue; if (gRAM.SPD[i].ModuleSize == 0) continue;
//spd_type = (slot->spd[SPD_MEMORY_TYPE] < ((UINT8) 12) ? slot->spd[SPD_MEMORY_TYPE] : 0); //spd_type = (slot->spd[SPD_MEMORY_TYPE] < ((UINT8) 12) ? slot->spd[SPD_MEMORY_TYPE] : 0);
//gRAM Type = spd_mem_to_smbios[spd_type]; //gRAM Type = spd_mem_to_smbios[spd_type];
gRAM.SPD[i].PartNo = getDDRPartNum(spdbuf, base, i); gRAM.SPD[i].PartNo.takeValueFrom(getDDRPartNum(spdbuf, base, i));
gRAM.SPD[i].Vendor = getVendorName(&(gRAM.SPD[i]), spdbuf, base, i); gRAM.SPD[i].PartNo.trim();
gRAM.SPD[i].SerialNo = getDDRSerial(spdbuf); gRAM.SPD[i].PartNo.deleteCharsAtPos(gRAM.SPD[i].PartNo.indexOf(' '), MAX_XSIZE);
gRAM.SPD[i].Vendor.takeValueFrom(getVendorName(&(gRAM.SPD[i]), spdbuf, base, i));
gRAM.SPD[i].Vendor.trim();
gRAM.SPD[i].Vendor.deleteCharsAtPos(gRAM.SPD[i].Vendor.indexOf(' '), MAX_XSIZE);
gRAM.SPD[i].SerialNo.takeValueFrom(getDDRSerial(spdbuf));
gRAM.SPD[i].SerialNo.trim();
gRAM.SPD[i].SerialNo.deleteCharsAtPos(gRAM.SPD[i].SerialNo.indexOf(' '), MAX_XSIZE);
//XXX - when we can FreePool allocated for these buffers? No this is pointer copy //XXX - when we can FreePool allocated for these buffers? No this is pointer copy
// determine spd speed // determine spd speed
speed = getDDRspeedMhz(spdbuf); speed = getDDRspeedMhz(spdbuf);
@ -840,9 +846,9 @@ STATIC void read_smb(EFI_PCI_IO_PROTOCOL *PciIo, UINT16 vid, UINT16 did)
(int)gRAM.SPD[i].Type, (int)gRAM.SPD[i].Type,
gRAM.SPD[i].ModuleSize, gRAM.SPD[i].ModuleSize,
gRAM.SPD[i].Frequency, gRAM.SPD[i].Frequency,
gRAM.SPD[i].Vendor, gRAM.SPD[i].Vendor.c_str(),
gRAM.SPD[i].PartNo, gRAM.SPD[i].PartNo.c_str(),
gRAM.SPD[i].SerialNo); gRAM.SPD[i].SerialNo.c_str());
gRAM.SPD[i].InUse = TRUE; gRAM.SPD[i].InUse = TRUE;
++(gRAM.SPDInUse); ++(gRAM.SPDInUse);

View File

@ -3,7 +3,7 @@
// cpp_tests // cpp_tests
// //
// Created by jief on 25.04.20. // Created by jief on 25.04.20.
// Copyright © 2020 JF Knudsen. All rights reserved. // Copyright © 2020 jief_machack. All rights reserved.
// //
#ifndef XToolsCommon_h #ifndef XToolsCommon_h

View File

@ -760,12 +760,12 @@ UINTN REFIT_MAINMENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABS
} }
SubMenuIndex = -1; SubMenuIndex = -1;
gSettings.OptionsBits = EncodeOptions(TmpArgs); GlobalConfig.OptionsBits = EncodeOptions(TmpArgs);
// DBG("main OptionsBits = 0x%X\n", gSettings.OptionsBits); // DBG("main OptionsBits = 0x%X\n", GlobalConfig.OptionsBits);
if (MainChosenEntry->getLOADER_ENTRY()) { if (MainChosenEntry->getLOADER_ENTRY()) {
gSettings.OptionsBits |= EncodeOptions(MainChosenEntry->getLOADER_ENTRY()->LoadOptions); GlobalConfig.OptionsBits |= EncodeOptions(MainChosenEntry->getLOADER_ENTRY()->LoadOptions);
// DBG("add OptionsBits = 0x%X\n", gSettings.OptionsBits); // DBG("add OptionsBits = 0x%X\n", GlobalConfig.OptionsBits);
} }
if (MainChosenEntry->getREFIT_MENU_ITEM_BOOTNUM()) { if (MainChosenEntry->getREFIT_MENU_ITEM_BOOTNUM()) {
@ -775,9 +775,9 @@ UINTN REFIT_MAINMENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABS
if (MainChosenEntry->getLOADER_ENTRY()) { if (MainChosenEntry->getLOADER_ENTRY()) {
// Only for non-legacy entries, as LEGACY_ENTRY doesn't have Flags // Only for non-legacy entries, as LEGACY_ENTRY doesn't have Flags
gSettings.FlagsBits = MainChosenEntry->getLOADER_ENTRY()->Flags; GlobalConfig.FlagsBits = MainChosenEntry->getLOADER_ENTRY()->Flags;
} }
// DBG(" MainChosenEntry with FlagsBits = 0x%X\n", gSettings.FlagsBits); // DBG(" MainChosenEntry with FlagsBits = 0x%X\n", GlobalConfig.FlagsBits);
SubMenuExit = 0; SubMenuExit = 0;
while (!SubMenuExit) { while (!SubMenuExit) {
@ -808,7 +808,7 @@ UINTN REFIT_MAINMENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABS
DBG(" get MainChosenEntry FlagsBits = 0x%X\n", ((LOADER_ENTRY*)MainChosenEntry)->Flags); DBG(" get MainChosenEntry FlagsBits = 0x%X\n", ((LOADER_ENTRY*)MainChosenEntry)->Flags);
if (OSFLAG_ISUNSET(TempChosenEntry->getLOADER_ENTRY()->Flags, OSFLAG_NODEFAULTARGS)) { if (OSFLAG_ISUNSET(TempChosenEntry->getLOADER_ENTRY()->Flags, OSFLAG_NODEFAULTARGS)) {
DecodeOptions(TempChosenEntry->getLOADER_ENTRY()); DecodeOptions(TempChosenEntry->getLOADER_ENTRY());
// DBG("get OptionsBits = 0x%X\n", gSettings.OptionsBits); // DBG("get OptionsBits = 0x%X\n", GlobalConfig.OptionsBits);
// DBG(" TempChosenEntry FlagsBits = 0x%X\n", ((LOADER_ENTRY*)TempChosenEntry)->Flags); // DBG(" TempChosenEntry FlagsBits = 0x%X\n", ((LOADER_ENTRY*)TempChosenEntry)->Flags);
} }
// copy also loadoptions from subentry to mainentry // copy also loadoptions from subentry to mainentry

View File

@ -97,13 +97,13 @@ void DecodeOptions(REFIT_MENU_ITEM_BOOTNUM *Entry)
return; return;
} }
for (Index = 0; Index < INX_NVWEBON; Index++) { //not including INX_NVWEBON for (Index = 0; Index < INX_NVWEBON; Index++) { //not including INX_NVWEBON
if (gSettings.OptionsBits & (1 << Index)) { if (GlobalConfig.OptionsBits & (1 << Index)) {
Entry->LoadOptions.AddID(ArgOptional[Index]); Entry->LoadOptions.AddID(ArgOptional[Index]);
} }
} }
//remove unchecked options //remove unchecked options
for (Index = 0; Index < INX_NVWEBON; Index++) { //not including INX_NVWEBON for (Index = 0; Index < INX_NVWEBON; Index++) { //not including INX_NVWEBON
if ((gSettings.OptionsBits & (1 << Index)) == 0) { if ((GlobalConfig.OptionsBits & (1 << Index)) == 0) {
Entry->LoadOptions.remove(ArgOptional[Index]); Entry->LoadOptions.remove(ArgOptional[Index]);
} }
} }
@ -111,7 +111,7 @@ void DecodeOptions(REFIT_MENU_ITEM_BOOTNUM *Entry)
if (Entry->getLOADER_ENTRY()) { if (Entry->getLOADER_ENTRY()) {
LOADER_ENTRY* loaderEntry = Entry->getLOADER_ENTRY(); LOADER_ENTRY* loaderEntry = Entry->getLOADER_ENTRY();
// Only for non-legacy entries, as LEGACY_ENTRY doesn't have OSVersion // Only for non-legacy entries, as LEGACY_ENTRY doesn't have OSVersion
if (gSettings.OptionsBits & OPT_NVWEBON) { if (GlobalConfig.OptionsBits & OPT_NVWEBON) {
if ( loaderEntry->macOSVersion >= MacOsVersion("10.12"_XS8) ) { if ( loaderEntry->macOSVersion >= MacOsVersion("10.12"_XS8) ) {
gSettings.SystemParameters.NvidiaWeb = TRUE; gSettings.SystemParameters.NvidiaWeb = TRUE;
} else { } else {
@ -120,7 +120,7 @@ void DecodeOptions(REFIT_MENU_ITEM_BOOTNUM *Entry)
Entry->LoadOptions.AddID(ArgOptional[INX_NVWEBON]); Entry->LoadOptions.AddID(ArgOptional[INX_NVWEBON]);
} }
} }
if ((gSettings.OptionsBits & OPT_NVWEBON) == 0) { if ((GlobalConfig.OptionsBits & OPT_NVWEBON) == 0) {
if ( loaderEntry->macOSVersion >= MacOsVersion("10.12"_XS8)) { if ( loaderEntry->macOSVersion >= MacOsVersion("10.12"_XS8)) {
gSettings.SystemParameters.NvidiaWeb = FALSE; gSettings.SystemParameters.NvidiaWeb = FALSE;
} else { } else {

View File

@ -29,7 +29,7 @@ typedef enum {
chinese, //cn chinese, //cn
romanian //ro romanian //ro
//something else? add, please //something else? add, please
} LANGUAGES; } LanguageCode;
#endif /* Languages_h */ #endif /* Languages_h */

View File

@ -94,7 +94,7 @@ void XTheme::LoadFontImage(IN BOOLEAN UseEmbedded, IN INTN Rows, IN INTN Cols)
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *PixelPtr; EFI_GRAPHICS_OUTPUT_BLT_PIXEL *PixelPtr;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *FontPtr; EFI_GRAPHICS_OUTPUT_BLT_PIXEL *FontPtr;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL FirstPixel; EFI_GRAPHICS_OUTPUT_BLT_PIXEL FirstPixel;
BOOLEAN isKorean = (gSettings.GUI.Language == korean); BOOLEAN isKorean = (gSettings.GUI.languageCode == korean);
XStringW fontFilePath; XStringW fontFilePath;
const XStringW& commonFontDir = L"font"_XSW; const XStringW& commonFontDir = L"font"_XSW;
@ -108,7 +108,7 @@ void XTheme::LoadFontImage(IN BOOLEAN UseEmbedded, IN INTN Rows, IN INTN Cols)
CharWidth = 22; //standard for korean CharWidth = 22; //standard for korean
} else { } else {
MsgLog("...using english\n"); MsgLog("...using english\n");
gSettings.GUI.Language = english; gSettings.GUI.languageCode = english;
} }
} }
@ -308,7 +308,7 @@ INTN XTheme::RenderText(IN const XStringW& Text, OUT XImage* CompImage_ptr,
for (UINTN i = 0; i < TextLength && c0 != 0; i++) { for (UINTN i = 0; i < TextLength && c0 != 0; i++) {
UINT16 c = Text.wc_str()[i]; //including UTF8 -> UTF16 conversion UINT16 c = Text.wc_str()[i]; //including UTF8 -> UTF16 conversion
DBG("initial char to render 0x%hx\n", c); //good DBG("initial char to render 0x%hx\n", c); //good
if (gSettings.GUI.Language != korean) { //russian Codepage = 0x410 if (gSettings.GUI.languageCode != korean) { //russian Codepage = 0x410
if (c >= 0x410 && c < 0x450) { if (c >= 0x410 && c < 0x450) {
//we have russian raster fonts with chars at 0xC0 //we have russian raster fonts with chars at 0xC0
c -= 0x350; c -= 0x350;

View File

@ -386,7 +386,7 @@ void DumpKernelAndKextPatches(KERNEL_AND_KEXT_PATCHES *Patches)
return; return;
} }
DBG("Kernel and Kext Patches at %llx:\n", (uintptr_t)Patches); DBG("Kernel and Kext Patches at %llx:\n", (uintptr_t)Patches);
DBG("\tAllowed: %c\n", gSettings.KextPatchesAllowed ? 'y' : 'n'); DBG("\tAllowed: %c\n", GlobalConfig.KextPatchesAllowed ? 'y' : 'n');
DBG("\tDebug: %c\n", Patches->KPDebug ? 'y' : 'n'); DBG("\tDebug: %c\n", Patches->KPDebug ? 'y' : 'n');
// DBG("\tKernelCpu: %c\n", Patches->KPKernelCpu ? 'y' : 'n'); // DBG("\tKernelCpu: %c\n", Patches->KPKernelCpu ? 'y' : 'n');
DBG("\tKernelLapic: %c\n", Patches->KPKernelLapic ? 'y' : 'n'); DBG("\tKernelLapic: %c\n", Patches->KPKernelLapic ? 'y' : 'n');
@ -421,7 +421,7 @@ void DumpKernelAndKextPatches(KERNEL_AND_KEXT_PATCHES *Patches)
#endif #endif
void LOADER_ENTRY::FilterKextPatches() void LOADER_ENTRY::FilterKextPatches()
{ {
if ( gSettings.KextPatchesAllowed && KernelAndKextPatches.KextPatches.size() > 0 ) { if ( GlobalConfig.KextPatchesAllowed && KernelAndKextPatches.KextPatches.size() > 0 ) {
DBG("Filtering KextPatches:\n"); DBG("Filtering KextPatches:\n");
for (size_t i = 0; i < KernelAndKextPatches.KextPatches.size(); i++) { for (size_t i = 0; i < KernelAndKextPatches.KextPatches.size(); i++) {
DBG(" - [%02zu]: %s :: %s :: [OS: %s | MatchOS: %s | MatchBuild: %s]", DBG(" - [%02zu]: %s :: %s :: [OS: %s | MatchOS: %s | MatchBuild: %s]",
@ -452,7 +452,7 @@ void LOADER_ENTRY::FilterKextPatches()
void LOADER_ENTRY::FilterKernelPatches() void LOADER_ENTRY::FilterKernelPatches()
{ {
if ( gSettings.KernelPatchesAllowed && KernelAndKextPatches.KernelPatches.notEmpty() ) { if ( GlobalConfig.KernelPatchesAllowed && KernelAndKextPatches.KernelPatches.notEmpty() ) {
DBG("Filtering KernelPatches:\n"); DBG("Filtering KernelPatches:\n");
for (size_t i = 0; i < KernelAndKextPatches.KernelPatches.size(); ++i) { for (size_t i = 0; i < KernelAndKextPatches.KernelPatches.size(); ++i) {
DBG(" - [%02zu]: %s :: [OS: %s | MatchOS: %s | MatchBuild: %s]", DBG(" - [%02zu]: %s :: [OS: %s | MatchOS: %s | MatchBuild: %s]",
@ -566,9 +566,9 @@ void CheckEmptyFB()
(gSettings.Graphics.IgPlatform == 0x59120003) || (gSettings.Graphics.IgPlatform == 0x59120003) ||
(gSettings.Graphics.IgPlatform == 0x3E910003); (gSettings.Graphics.IgPlatform == 0x3E910003);
if (EmptyFB) { if (EmptyFB) {
gPlatformFeature |= PT_FEATURE_HAS_HEADLESS_GPU; gSettings.Smbios.gPlatformFeature |= PT_FEATURE_HAS_HEADLESS_GPU;
} else { } else {
gPlatformFeature &= ~PT_FEATURE_HAS_HEADLESS_GPU; gSettings.Smbios.gPlatformFeature &= ~PT_FEATURE_HAS_HEADLESS_GPU;
} }
} }
@ -2376,15 +2376,15 @@ void SetVariablesFromNvram()
// OEMPath.takeValueFrom("EFI\\CLOVER"); // OEMPath.takeValueFrom("EFI\\CLOVER");
// if ( ConfName.isEmpty() ) { // if ( ConfName.isEmpty() ) {
// DBG("set OEMPath (ConfName == NULL): %ls\n", OEMPath.wc_str()); // DBG("set OEMPath (ConfName == NULL): %ls\n", OEMPath.wc_str());
// } else if ( nLanCards > 0 && SetOEMPathIfExists(&self.getSelfRootDir(), SWPrintf("EFI\\CLOVER\\OEM\\%s--%02X-%02X-%02X-%02X-%02X-%02X", gSettings.OEMProduct.c_str(), gLanMac[0][0], gLanMac[0][1], gLanMac[0][2], gLanMac[0][3], gLanMac[0][4], gLanMac[0][5]), ConfName)) { // } else if ( nLanCards > 0 && SetOEMPathIfExists(&self.getSelfRootDir(), SWPrintf("EFI\\CLOVER\\OEM\\%s--%02X-%02X-%02X-%02X-%02X-%02X", GlobalConfig.OEMProductFromSmbios.c_str(), gLanMac[0][0], gLanMac[0][1], gLanMac[0][2], gLanMac[0][3], gLanMac[0][4], gLanMac[0][5]), ConfName)) {
// } else if ( nLanCards > 1 && SetOEMPathIfExists(&self.getSelfRootDir(), SWPrintf("EFI\\CLOVER\\OEM\\%s--%02X-%02X-%02X-%02X-%02X-%02X", gSettings.OEMProduct.c_str(), gLanMac[1][0], gLanMac[1][1], gLanMac[1][2], gLanMac[1][3], gLanMac[1][4], gLanMac[1][5]), ConfName)) { // } else if ( nLanCards > 1 && SetOEMPathIfExists(&self.getSelfRootDir(), SWPrintf("EFI\\CLOVER\\OEM\\%s--%02X-%02X-%02X-%02X-%02X-%02X", GlobalConfig.OEMProductFromSmbios.c_str(), gLanMac[1][0], gLanMac[1][1], gLanMac[1][2], gLanMac[1][3], gLanMac[1][4], gLanMac[1][5]), ConfName)) {
// } else if ( nLanCards > 2 && SetOEMPathIfExists(&self.getSelfRootDir(), SWPrintf("EFI\\CLOVER\\OEM\\%s--%02X-%02X-%02X-%02X-%02X-%02X", gSettings.OEMProduct.c_str(), gLanMac[2][0], gLanMac[2][1], gLanMac[2][2], gLanMac[2][3], gLanMac[2][4], gLanMac[2][5]), ConfName)) { // } else if ( nLanCards > 2 && SetOEMPathIfExists(&self.getSelfRootDir(), SWPrintf("EFI\\CLOVER\\OEM\\%s--%02X-%02X-%02X-%02X-%02X-%02X", GlobalConfig.OEMProductFromSmbios.c_str(), gLanMac[2][0], gLanMac[2][1], gLanMac[2][2], gLanMac[2][3], gLanMac[2][4], gLanMac[2][5]), ConfName)) {
// } else if ( nLanCards > 3 && SetOEMPathIfExists(&self.getSelfRootDir(), SWPrintf("EFI\\CLOVER\\OEM\\%s--%02X-%02X-%02X-%02X-%02X-%02X", gSettings.OEMProduct.c_str(), gLanMac[3][0], gLanMac[3][1], gLanMac[3][2], gLanMac[3][3], gLanMac[3][4], gLanMac[3][5]), ConfName)) { // } else if ( nLanCards > 3 && SetOEMPathIfExists(&self.getSelfRootDir(), SWPrintf("EFI\\CLOVER\\OEM\\%s--%02X-%02X-%02X-%02X-%02X-%02X", GlobalConfig.OEMProductFromSmbios.c_str(), gLanMac[3][0], gLanMac[3][1], gLanMac[3][2], gLanMac[3][3], gLanMac[3][4], gLanMac[3][5]), ConfName)) {
// } else if (!gFirmwareClover && SetOEMPathIfExists(&self.getSelfRootDir(), SWPrintf("EFI\\CLOVER\\OEM\\%s\\UEFI", gSettings.OEMBoard.c_str()), ConfName)) { // } else if (!gFirmwareClover && SetOEMPathIfExists(&self.getSelfRootDir(), SWPrintf("EFI\\CLOVER\\OEM\\%s\\UEFI", GlobalConfig.OEMBoardFromSmbios.c_str()), ConfName)) {
// } else if (SetOEMPathIfExists(&self.getSelfRootDir(), SWPrintf("EFI\\CLOVER\\OEM\\%s", gSettings.OEMProduct.c_str()), ConfName)) { // } else if (SetOEMPathIfExists(&self.getSelfRootDir(), SWPrintf("EFI\\CLOVER\\OEM\\%s", GlobalConfig.OEMProductFromSmbios.c_str()), ConfName)) {
// } else if (SetOEMPathIfExists(&self.getSelfRootDir(), SWPrintf("EFI\\CLOVER\\OEM\\%s-%d", gSettings.OEMProduct.c_str(), (INT32)(DivU64x32(gCPUStructure.CPUFrequency, Mega))), ConfName)) { // } else if (SetOEMPathIfExists(&self.getSelfRootDir(), SWPrintf("EFI\\CLOVER\\OEM\\%s-%d", GlobalConfig.OEMProductFromSmbios.c_str(), (INT32)(DivU64x32(gCPUStructure.CPUFrequency, Mega))), ConfName)) {
// } else if (SetOEMPathIfExists(&self.getSelfRootDir(), SWPrintf("EFI\\CLOVER\\OEM\\%s", gSettings.OEMBoard.c_str()), ConfName)) { // } else if (SetOEMPathIfExists(&self.getSelfRootDir(), SWPrintf("EFI\\CLOVER\\OEM\\%s", GlobalConfig.OEMBoardFromSmbios.c_str()), ConfName)) {
// } else if (SetOEMPathIfExists(&self.getSelfRootDir(), SWPrintf("EFI\\CLOVER\\OEM\\%s-%d", gSettings.OEMBoard.c_str(), (INT32)(DivU64x32(gCPUStructure.CPUFrequency, Mega))), ConfName) ) { // } else if (SetOEMPathIfExists(&self.getSelfRootDir(), SWPrintf("EFI\\CLOVER\\OEM\\%s-%d", GlobalConfig.OEMBoardFromSmbios.c_str(), (INT32)(DivU64x32(gCPUStructure.CPUFrequency, Mega))), ConfName) ) {
// } else { // } else {
// DBG("set OEMPath by default: %ls\n", OEMPath.wc_str()); // DBG("set OEMPath by default: %ls\n", OEMPath.wc_str());
// } // }
@ -2555,8 +2555,9 @@ GetListOfThemes ()
*/ */
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
void afterGetUserSettings(const SETTINGS_DATA& gSettings) void afterGetUserSettings(SETTINGS_DATA& gSettings)
{ {
#pragma GCC diagnostic pop
// Secure boot // Secure boot
/* this parameter, which should be called SecureBootSetupMode, is ignored if : /* this parameter, which should be called SecureBootSetupMode, is ignored if :
@ -2678,19 +2679,19 @@ void afterGetUserSettings(const SETTINGS_DATA& gSettings)
ThemeX.DarkEmbedded = gSettings.GUI.getDarkEmbedded(ThemeX.Daylight); ThemeX.DarkEmbedded = gSettings.GUI.getDarkEmbedded(ThemeX.Daylight);
if ( gSettings.GUI.Language == english ) { if ( gSettings.GUI.languageCode == english ) {
GlobalConfig.Codepage = 0xC0; GlobalConfig.Codepage = 0xC0;
GlobalConfig.CodepageSize = 0; GlobalConfig.CodepageSize = 0;
} else if ( gSettings.GUI.Language == russian ) { } else if ( gSettings.GUI.languageCode == russian ) {
GlobalConfig.Codepage = 0x410; GlobalConfig.Codepage = 0x410;
GlobalConfig.CodepageSize = 0x40; GlobalConfig.CodepageSize = 0x40;
} else if ( gSettings.GUI.Language == ukrainian ) { } else if ( gSettings.GUI.languageCode == ukrainian ) {
GlobalConfig.Codepage = 0x400; GlobalConfig.Codepage = 0x400;
GlobalConfig.CodepageSize = 0x60; GlobalConfig.CodepageSize = 0x60;
} else if ( gSettings.GUI.Language == chinese ) { } else if ( gSettings.GUI.languageCode == chinese ) {
GlobalConfig.Codepage = 0x3400; GlobalConfig.Codepage = 0x3400;
GlobalConfig.CodepageSize = 0x19C0; GlobalConfig.CodepageSize = 0x19C0;
} else if ( gSettings.GUI.Language == korean ) { } else if ( gSettings.GUI.languageCode == korean ) {
GlobalConfig.Codepage = 0x1100; GlobalConfig.Codepage = 0x1100;
GlobalConfig.CodepageSize = 0x100; GlobalConfig.CodepageSize = 0x100;
} }
@ -2714,12 +2715,12 @@ void afterGetUserSettings(const SETTINGS_DATA& gSettings)
} }
if ( GlobalConfig.RtROM.isEmpty() ) { if ( GlobalConfig.RtROM.isEmpty() ) {
EFI_GUID uuid; EFI_GUID uuid;
StrToGuidLE(gSettings.SmUUID, &uuid); StrToGuidLE(gSettings.Smbios.SmUUID, &uuid);
GlobalConfig.RtROM.ncpy(&uuid.Data4[2], 6); GlobalConfig.RtROM.ncpy(&uuid.Data4[2], 6);
} }
GlobalConfig.RtMLB = gSettings.RtVariables.RtMLBSetting; GlobalConfig.RtMLB = gSettings.RtVariables.RtMLBSetting;
if ( GlobalConfig.RtMLB.isEmpty() ) { if ( GlobalConfig.RtMLB.isEmpty() ) {
GlobalConfig.RtMLB = gSettings.BoardSerialNumber; GlobalConfig.RtMLB = gSettings.Smbios.BoardSerialNumber;
} }
for (size_t i = 0; i < NGFX; i++) { for (size_t i = 0; i < NGFX; i++) {
@ -2757,7 +2758,6 @@ void afterGetUserSettings(const SETTINGS_DATA& gSettings)
//--------- //---------
} }
#pragma GCC diagnostic pop
// //
// main entry point // main entry point
@ -2923,17 +2923,17 @@ RefitMain (IN EFI_HANDLE ImageHandle,
//debugStartImageWithOC(); // ok BS_I //debugStartImageWithOC(); // ok BS_I
GetDefaultSettings(); // do this before PrepatchSmbios() because PrepatchSmbios() change gSettings.SmUUID. GetDefaultSettings(); // do this before PrepatchSmbios() because PrepatchSmbios() change gSettings.Smbios.SmUUID.
// TODO : there is a mixup between SmUUID read from the platform and the SmUUID set by the user. They should be read in 2 different vars. // TODO : there is a mixup between SmUUID read from the platform and the SmUUID set by the user. They should be read in 2 different vars.
PrepatchSmbios(); PrepatchSmbios();
//replace / with _ //replace / with _
gSettings.OEMProduct.replaceAll(U'/', U'_'); GlobalConfig.OEMProductFromSmbios.replaceAll(U'/', U'_');
gSettings.OEMBoard.replaceAll(U'/', U'_'); GlobalConfig.OEMBoardFromSmbios.replaceAll(U'/', U'_');
DBG("Running on: '%s' with board '%s'\n", gSettings.OEMProduct.c_str(), gSettings.OEMBoard.c_str()); DBG("Running on: '%s' with board '%s'\n", GlobalConfig.OEMProductFromSmbios.c_str(), GlobalConfig.OEMBoardFromSmbios.c_str());
GetCPUProperties(); GetCPUProperties();
GetDefaultCpuSettings(); //split from GetDefaultSettings() because it should be after GetCPUProperties() GetDefaultCpuSettings(gSettings); //split from GetDefaultSettings() because it should be after GetCPUProperties()
GetDevices(); // Do this BEFORE SetOEMPath(); GetDevices(); // Do this BEFORE SetOEMPath();
// LoadOptions Parsing // LoadOptions Parsing
@ -2947,7 +2947,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
if (ConfName.isEmpty()) { if (ConfName.isEmpty()) {
gConfigDict[1] = NULL; gConfigDict[1] = NULL;
} else { } else {
selfOem.initialize(ConfName, gFirmwareClover, gSettings.OEMBoard, gSettings.OEMProduct, (INT32)(DivU64x32(gCPUStructure.CPUFrequency, Mega)), nLanCards, gLanMac); selfOem.initialize(ConfName, gFirmwareClover, GlobalConfig.OEMBoardFromSmbios, GlobalConfig.OEMProductFromSmbios, (INT32)(DivU64x32(gCPUStructure.CPUFrequency, Mega)), nLanCards, gLanMac);
Status = LoadUserSettings(ConfName, &gConfigDict[1]); Status = LoadUserSettings(ConfName, &gConfigDict[1]);
DBG("%ls\\%ls.plist %ls loaded with name from LoadOptions: %s\n", selfOem.getConfigDirFullPath().wc_str(), ConfName.wc_str(), EFI_ERROR(Status) ? L" not" : L"", efiStrError(Status)); DBG("%ls\\%ls.plist %ls loaded with name from LoadOptions: %s\n", selfOem.getConfigDirFullPath().wc_str(), ConfName.wc_str(), EFI_ERROR(Status) ? L" not" : L"", efiStrError(Status));
if (EFI_ERROR(Status)) { if (EFI_ERROR(Status)) {
@ -2965,16 +2965,16 @@ RefitMain (IN EFI_HANDLE ImageHandle,
} }
} }
if (!gConfigDict[1] || UniteConfigs) { if (!gConfigDict[1] || UniteConfigs) {
selfOem.initialize("config"_XS8, gFirmwareClover, gSettings.OEMBoard, gSettings.OEMProduct, (INT32)(DivU64x32(gCPUStructure.CPUFrequency, Mega)), nLanCards, gLanMac); selfOem.initialize("config"_XS8, gFirmwareClover, GlobalConfig.OEMBoardFromSmbios, GlobalConfig.OEMProductFromSmbios, (INT32)(DivU64x32(gCPUStructure.CPUFrequency, Mega)), nLanCards, gLanMac);
// selfOem.unInitialize(); // selfOem.unInitialize();
// selfOem.initialize("config"_XS8, gFirmwareClover, gSettings.OEMBoard, gSettings.OEMProduct, (INT32)(DivU64x32(gCPUStructure.CPUFrequency, Mega)), nLanCards, gLanMac); // selfOem.initialize("config"_XS8, gFirmwareClover, GlobalConfig.OEMBoardFromSmbios, GlobalConfig.OEMProductFromSmbios, (INT32)(DivU64x32(gCPUStructure.CPUFrequency, Mega)), nLanCards, gLanMac);
Status = LoadUserSettings(L"config"_XSW, &gConfigDict[0]); Status = LoadUserSettings(L"config"_XSW, &gConfigDict[0]);
DBG("%ls\\config.plist %ls loaded: %s\n", selfOem.getConfigDirFullPath().wc_str(), EFI_ERROR(Status) ? L" not" : L"", efiStrError(Status)); DBG("%ls\\config.plist %ls loaded: %s\n", selfOem.getConfigDirFullPath().wc_str(), EFI_ERROR(Status) ? L" not" : L"", efiStrError(Status));
} }
snwprintf(gSettings.ConfigName, 64, "%ls%ls%ls", // GlobalConfig.ConfigName.SWPrintf("%ls%ls%ls",
gConfigDict[0] ? L"config": L"", // gConfigDict[0] ? L"config": L"",
(gConfigDict[0] && gConfigDict[1]) ? L" + ": L"", // (gConfigDict[0] && gConfigDict[1]) ? L" + ": L"",
!gConfigDict[1] ? L"": (ConfName.notEmpty() ? ConfName.wc_str() : L"Load Options")); // !gConfigDict[1] ? L"": (ConfName.notEmpty() ? ConfName.wc_str() : L"Load Options"));
//gSettings.MainConfigName.takeValueFrom(gSettings.ConfigName); //gSettings.MainConfigName.takeValueFrom(gSettings.ConfigName);
gSettings.GUI.Mouse.PointerEnabled = TRUE; gSettings.GUI.Mouse.PointerEnabled = TRUE;
@ -3146,8 +3146,8 @@ RefitMain (IN EFI_HANDLE ImageHandle,
GuiEventsInitialize(); GuiEventsInitialize();
if (!gSettings.EnabledCores) { if (!GlobalConfig.EnabledCores) {
gSettings.EnabledCores = gCPUStructure.Cores; GlobalConfig.EnabledCores = gCPUStructure.Cores;
} }
GetMacAddress(); GetMacAddress();
@ -3245,7 +3245,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
if (!EFI_ERROR(LoadUserSettings(L"smbios"_XSW, &smbiosTags)) && (smbiosTags != NULL)) { if (!EFI_ERROR(LoadUserSettings(L"smbios"_XSW, &smbiosTags)) && (smbiosTags != NULL)) {
const TagDict* dictPointer = smbiosTags->dictPropertyForKey("SMBIOS"); const TagDict* dictPointer = smbiosTags->dictPropertyForKey("SMBIOS");
if (dictPointer) { if (dictPointer) {
ParseSMBIOSSettings(dictPointer); ParseSMBIOSSettings(gSettings, dictPointer);
} else { } else {
DBG("Invalid smbios.plist, not overriding config.plist!\n"); DBG("Invalid smbios.plist, not overriding config.plist!\n");
} }
@ -3333,8 +3333,8 @@ RefitMain (IN EFI_HANDLE ImageHandle,
XString8Array TmpArgs = Split<XString8Array>(gSettings.Boot.BootArgs, " "); XString8Array TmpArgs = Split<XString8Array>(gSettings.Boot.BootArgs, " ");
DBG("after NVRAM boot-args=%s\n", gSettings.Boot.BootArgs.c_str()); DBG("after NVRAM boot-args=%s\n", gSettings.Boot.BootArgs.c_str());
gSettings.OptionsBits = EncodeOptions(TmpArgs); GlobalConfig.OptionsBits = EncodeOptions(TmpArgs);
// DBG("initial OptionsBits %X\n", gSettings.OptionsBits); // DBG("initial OptionsBits %X\n", GlobalConfig.OptionsBits);
FillInputs(TRUE); FillInputs(TRUE);
// scan for loaders and tools, add then to the menu // scan for loaders and tools, add then to the menu

View File

@ -148,7 +148,7 @@ void FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = UNIString; //1 InputItems[InputItemsCount].ItemType = UNIString; //1
InputItems[InputItemsCount++].SValue.takeValueFrom(gSettings.ACPI.DSDT.DsdtName); // 1-> 2 InputItems[InputItemsCount++].SValue.takeValueFrom(gSettings.ACPI.DSDT.DsdtName); // 1-> 2
InputItems[InputItemsCount].ItemType = UNIString; //2 InputItems[InputItemsCount].ItemType = UNIString; //2
InputItems[InputItemsCount++].SValue.takeValueFrom(gSettings.BlockKexts); InputItems[InputItemsCount++].SValue = GlobalConfig.BlockKexts;
InputItems[InputItemsCount].ItemType = RadioSwitch; //3 - Themes chooser InputItems[InputItemsCount].ItemType = RadioSwitch; //3 - Themes chooser
InputItems[InputItemsCount++].IValue = 3; InputItems[InputItemsCount++].IValue = 3;
@ -180,7 +180,7 @@ void FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = BoolValue; //16 InputItems[InputItemsCount].ItemType = BoolValue; //16
InputItems[InputItemsCount++].BValue = gSettings.Graphics.PatchVBios; InputItems[InputItemsCount++].BValue = gSettings.Graphics.PatchVBios;
InputItems[InputItemsCount].ItemType = Decimal; //17 InputItems[InputItemsCount].ItemType = Decimal; //17
InputItems[InputItemsCount++].SValue.SWPrintf("0x%llX", gPlatformFeature); InputItems[InputItemsCount++].SValue.SWPrintf("0x%llX", gSettings.Smbios.gPlatformFeature);
InputItems[InputItemsCount].ItemType = Hex; //18 InputItems[InputItemsCount].ItemType = Hex; //18
InputItems[InputItemsCount++].SValue.SWPrintf("0x%hX", gSettings.SystemParameters.BacklightLevel); InputItems[InputItemsCount++].SValue.SWPrintf("0x%hX", gSettings.SystemParameters.BacklightLevel);
InputItems[InputItemsCount].ItemType = Decimal; //19 InputItems[InputItemsCount].ItemType = Decimal; //19
@ -247,7 +247,7 @@ void FillInputs(BOOLEAN New)
InputItemsCount = 44; InputItemsCount = 44;
InputItems[InputItemsCount].ItemType = BoolValue; //44 InputItems[InputItemsCount].ItemType = BoolValue; //44
InputItems[InputItemsCount++].BValue = gSettings.KextPatchesAllowed; InputItems[InputItemsCount++].BValue = GlobalConfig.KextPatchesAllowed;
InputItems[InputItemsCount].ItemType = BoolValue; //45 InputItems[InputItemsCount].ItemType = BoolValue; //45
InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.EightApple; InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.EightApple;
InputItems[InputItemsCount].ItemType = BoolValue; //46 InputItems[InputItemsCount].ItemType = BoolValue; //46
@ -294,10 +294,10 @@ void FillInputs(BOOLEAN New)
// end of change // end of change
InputItems[InputItemsCount].ItemType = Hex; //62 InputItems[InputItemsCount].ItemType = Hex; //62
InputItems[InputItemsCount++].SValue.SWPrintf("0x%08X", gFwFeatures); InputItems[InputItemsCount++].SValue.SWPrintf("0x%08X", gSettings.Smbios.gFwFeatures);
InputItems[InputItemsCount].ItemType = Hex; //63 InputItems[InputItemsCount].ItemType = Hex; //63
InputItems[InputItemsCount++].SValue.SWPrintf("0x%08X", gFwFeaturesMask); InputItems[InputItemsCount++].SValue.SWPrintf("0x%08X", gSettings.Smbios.gFwFeaturesMask);
// Debug for KernelAndKextPatches // Debug for KernelAndKextPatches
InputItems[InputItemsCount].ItemType = BoolValue; //64 InputItems[InputItemsCount].ItemType = BoolValue; //64
@ -314,9 +314,9 @@ void FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = CheckBit; //67 InputItems[InputItemsCount].ItemType = CheckBit; //67
InputItems[InputItemsCount++].IValue = gSettings.ACPI.DSDT.FixDsdt; InputItems[InputItemsCount++].IValue = gSettings.ACPI.DSDT.FixDsdt;
InputItems[InputItemsCount].ItemType = CheckBit; //68 InputItems[InputItemsCount].ItemType = CheckBit; //68
InputItems[InputItemsCount++].IValue = gSettings.OptionsBits; InputItems[InputItemsCount++].IValue = GlobalConfig.OptionsBits;
InputItems[InputItemsCount].ItemType = CheckBit; //69 InputItems[InputItemsCount].ItemType = CheckBit; //69
InputItems[InputItemsCount++].IValue = gSettings.FlagsBits; InputItems[InputItemsCount++].IValue = GlobalConfig.FlagsBits;
InputItems[InputItemsCount].ItemType = Decimal; //70 InputItems[InputItemsCount].ItemType = Decimal; //70
InputItems[InputItemsCount++].SValue.SWPrintf("%02lld", gSettings.GUI.Mouse.PointerSpeed); InputItems[InputItemsCount++].SValue.SWPrintf("%02lld", gSettings.GUI.Mouse.PointerSpeed);
@ -334,30 +334,30 @@ void FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Hex; //75 InputItems[InputItemsCount].ItemType = Hex; //75
InputItems[InputItemsCount++].SValue.SWPrintf("0x%04hX", GlobalConfig.C3Latency); InputItems[InputItemsCount++].SValue.SWPrintf("0x%04hX", GlobalConfig.C3Latency);
InputItems[InputItemsCount].ItemType = Decimal; //76 InputItems[InputItemsCount].ItemType = Decimal; //76
InputItems[InputItemsCount++].SValue.SWPrintf("%02d", gSettings.EnabledCores); InputItems[InputItemsCount++].SValue.SWPrintf("%02d", GlobalConfig.EnabledCores);
InputItems[InputItemsCount].ItemType = Decimal; //77 InputItems[InputItemsCount].ItemType = Decimal; //77
InputItems[InputItemsCount++].SValue.SWPrintf("%02d", gSettings.CPU.SavingMode); InputItems[InputItemsCount++].SValue.SWPrintf("%02d", gSettings.CPU.SavingMode);
InputItems[InputItemsCount].ItemType = ASString; //78 InputItems[InputItemsCount].ItemType = ASString; //78
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.ProductName.c_str()); InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.Smbios.ProductName.c_str());
InputItems[InputItemsCount].ItemType = ASString; //79 InputItems[InputItemsCount].ItemType = ASString; //79
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.VersionNr.c_str()); InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.Smbios.VersionNr.c_str());
InputItems[InputItemsCount].ItemType = ASString; //80 InputItems[InputItemsCount].ItemType = ASString; //80
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.SerialNr.c_str()); InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.Smbios.SerialNr.c_str());
InputItems[InputItemsCount].ItemType = ASString; //81 InputItems[InputItemsCount].ItemType = ASString; //81
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.BoardNumber.c_str()); InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.Smbios.BoardNumber.c_str());
InputItems[InputItemsCount].ItemType = ASString; //82 InputItems[InputItemsCount].ItemType = ASString; //82
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.BoardSerialNumber.c_str()); InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.Smbios.BoardSerialNumber.c_str());
InputItems[InputItemsCount].ItemType = Decimal; //83 InputItems[InputItemsCount].ItemType = Decimal; //83
InputItems[InputItemsCount++].SValue.SWPrintf("%d", gSettings.BoardType); InputItems[InputItemsCount++].SValue.SWPrintf("%d", gSettings.Smbios.BoardType);
InputItems[InputItemsCount].ItemType = ASString; //84 InputItems[InputItemsCount].ItemType = ASString; //84
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.BoardVersion.c_str()); InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.Smbios.BoardVersion.c_str());
InputItems[InputItemsCount].ItemType = Decimal; //85 InputItems[InputItemsCount].ItemType = Decimal; //85
InputItems[InputItemsCount++].SValue.SWPrintf("%d", gSettings.ChassisType); InputItems[InputItemsCount++].SValue.SWPrintf("%d", gSettings.Smbios.ChassisType);
InputItems[InputItemsCount].ItemType = ASString; //86 InputItems[InputItemsCount].ItemType = ASString; //86
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.RomVersion.c_str()); InputItems[InputItemsCount++].SValue.SWPrintf("%s", GlobalConfig.RomVersionUsed.c_str());
InputItems[InputItemsCount].ItemType = ASString; //87 InputItems[InputItemsCount].ItemType = ASString; //87
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.ReleaseDate.c_str()); InputItems[InputItemsCount++].SValue.SWPrintf("%s", GlobalConfig.ReleaseDateUsed.c_str());
InputItems[InputItemsCount].ItemType = BoolValue; //88 InputItems[InputItemsCount].ItemType = BoolValue; //88
InputItems[InputItemsCount++].BValue = gSettings.ACPI.SSDT.DoubleFirstState; InputItems[InputItemsCount++].BValue = gSettings.ACPI.SSDT.DoubleFirstState;
@ -408,7 +408,7 @@ void FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = BoolValue; //107 InputItems[InputItemsCount].ItemType = BoolValue; //107
InputItems[InputItemsCount++].BValue = gSettings.Devices.NoDefaultProperties; InputItems[InputItemsCount++].BValue = gSettings.Devices.NoDefaultProperties;
InputItems[InputItemsCount].ItemType = BoolValue; //108 InputItems[InputItemsCount].ItemType = BoolValue; //108
InputItems[InputItemsCount++].BValue = gSettings.KernelPatchesAllowed; InputItems[InputItemsCount++].BValue = GlobalConfig.KernelPatchesAllowed;
InputItems[InputItemsCount].ItemType = Hex; //109 InputItems[InputItemsCount].ItemType = Hex; //109
InputItems[InputItemsCount++].SValue.SWPrintf("%01X", gSettings.Graphics.DualLink); InputItems[InputItemsCount++].SValue.SWPrintf("%01X", gSettings.Graphics.DualLink);
@ -431,7 +431,7 @@ void FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].IValue = 116; InputItems[InputItemsCount++].IValue = 116;
InputItems[InputItemsCount].ItemType = ASString; //117 InputItems[InputItemsCount].ItemType = ASString; //117
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.EfiVersion.c_str()); InputItems[InputItemsCount++].SValue.SWPrintf("%s", GlobalConfig.EfiVersionUsed.c_str());
InputItems[InputItemsCount].ItemType = ASString; //118 InputItems[InputItemsCount].ItemType = ASString; //118
InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.RtVariables.BooterCfgStr.c_str()); InputItems[InputItemsCount++].SValue.SWPrintf("%s", gSettings.RtVariables.BooterCfgStr.c_str());
@ -485,7 +485,7 @@ void ApplyInputs(void)
} }
i++; //2 i++; //2
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
snwprintf(gSettings.BlockKexts, sizeof(gSettings.BlockKexts), "%ls", InputItems[i].SValue.wc_str()); GlobalConfig.BlockKexts = InputItems[i].SValue;
} }
i++; //3 i++; //3
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
@ -556,8 +556,8 @@ void ApplyInputs(void)
} }
i++; //17 i++; //17
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gPlatformFeature = (UINT64)StrHexToUint64(InputItems[i].SValue.wc_str()); gSettings.Smbios.gPlatformFeature = (UINT64)StrHexToUint64(InputItems[i].SValue.wc_str());
DBG("applied PlatformFeature=0x%llX\n", gPlatformFeature); DBG("applied PlatformFeature=0x%llX\n", gSettings.Smbios.gPlatformFeature);
} }
i++; //18 | Download-Fritz: There is no GUI element for BacklightLevel; please revise i++; //18 | Download-Fritz: There is no GUI element for BacklightLevel; please revise
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
@ -628,7 +628,7 @@ void ApplyInputs(void)
i = 44; i = 44;
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.KextPatchesAllowed = InputItems[i].BValue; GlobalConfig.KextPatchesAllowed = InputItems[i].BValue;
GlobalConfig.gBootChanged = TRUE; GlobalConfig.gBootChanged = TRUE;
} }
i++; //45 i++; //45
@ -712,13 +712,13 @@ void ApplyInputs(void)
} }
i++; //62 i++; //62
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gFwFeatures = (UINT32)StrHexToUint64(InputItems[i].SValue.wc_str()); gSettings.Smbios.gFwFeatures = (UINT32)StrHexToUint64(InputItems[i].SValue.wc_str());
DBG("applied FirmwareFeatures=0x%X\n", gFwFeatures); DBG("applied FirmwareFeatures=0x%X\n", gSettings.Smbios.gFwFeatures);
} }
i++; //63 i++; //63
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gFwFeaturesMask = (UINT32)StrHexToUint64(InputItems[i].SValue.wc_str()); gSettings.Smbios.gFwFeaturesMask = (UINT32)StrHexToUint64(InputItems[i].SValue.wc_str());
DBG("applied FirmwareFeaturesMask=0x%X\n", gFwFeaturesMask); DBG("applied FirmwareFeaturesMask=0x%X\n", gSettings.Smbios.gFwFeaturesMask);
} }
i++; //64 i++; //64
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
@ -742,11 +742,11 @@ void ApplyInputs(void)
} }
i++; //68 i++; //68
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.OptionsBits = InputItems[i].IValue; GlobalConfig.OptionsBits = InputItems[i].IValue;
} }
i++; //69 i++; //69
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.FlagsBits = InputItems[i].IValue; GlobalConfig.FlagsBits = InputItems[i].IValue;
} }
@ -784,7 +784,7 @@ void ApplyInputs(void)
i++; //76 i++; //76
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.EnabledCores = (UINT8)StrDecimalToUintn(InputItems[i].SValue.wc_str()); GlobalConfig.EnabledCores = (UINT8)StrDecimalToUintn(InputItems[i].SValue.wc_str());
} }
i++; //77 i++; //77
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
@ -793,50 +793,50 @@ void ApplyInputs(void)
i++; //78 i++; //78
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.ProductName = InputItems[i].SValue; gSettings.Smbios.ProductName = InputItems[i].SValue;
// let's fill all other fields based on this ProductName // let's fill all other fields based on this ProductName
// to serve as default // to serve as default
Model = GetModelFromString(gSettings.ProductName); Model = GetModelFromString(gSettings.Smbios.ProductName);
if (Model != MaxMachineType) { if (Model != MaxMachineType) {
SetDMISettingsForModel(Model, FALSE); SetDMISettingsForModel(gSettings, Model, FALSE);
} }
} }
i++; //79 i++; //79
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.VersionNr = InputItems[i].SValue; gSettings.Smbios.VersionNr = InputItems[i].SValue;
} }
i++; //80 i++; //80
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.SerialNr = InputItems[i].SValue; gSettings.Smbios.SerialNr = InputItems[i].SValue;
} }
i++; //81 i++; //81
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.BoardNumber = InputItems[i].SValue; gSettings.Smbios.BoardNumber = InputItems[i].SValue;
} }
i++; //82 i++; //82
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.BoardSerialNumber = InputItems[i].SValue; gSettings.Smbios.BoardSerialNumber = InputItems[i].SValue;
} }
i++; //83 i++; //83
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.BoardType = (UINT8)(StrDecimalToUintn(InputItems[i].SValue.wc_str()) & 0x0F); gSettings.Smbios.BoardType = (UINT8)(StrDecimalToUintn(InputItems[i].SValue.wc_str()) & 0x0F);
} }
i++; //84 i++; //84
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.BoardVersion = InputItems[i].SValue; gSettings.Smbios.BoardVersion = InputItems[i].SValue;
} }
i++; //85 i++; //85
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.ChassisType = (UINT8)(StrDecimalToUintn(InputItems[i].SValue.wc_str()) & 0x0F); gSettings.Smbios.ChassisType = (UINT8)(StrDecimalToUintn(InputItems[i].SValue.wc_str()) & 0x0F);
} }
i++; //86 i++; //86
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.RomVersion = InputItems[i].SValue; GlobalConfig.RomVersionUsed = InputItems[i].SValue;
} }
i++; //87 i++; //87
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.ReleaseDate = InputItems[i].SValue; GlobalConfig.ReleaseDateUsed = InputItems[i].SValue;
} }
i++; //88 i++; //88
@ -858,7 +858,7 @@ void ApplyInputs(void)
Status = GetUserSettings(dict, gSettings); Status = GetUserSettings(dict, gSettings);
if (gConfigDict[2]) gConfigDict[2]->FreeTag(); if (gConfigDict[2]) gConfigDict[2]->FreeTag();
gConfigDict[2] = dict; gConfigDict[2] = dict;
snwprintf(gSettings.ConfigName, 64, "%ls", ConfigsList[OldChosenConfig]); // GlobalConfig.ConfigName.takeValueFrom(ConfigsList[OldChosenConfig]);
} }
FillInputs(FALSE); FillInputs(FALSE);
NeedSave = FALSE; NeedSave = FALSE;
@ -962,7 +962,7 @@ void ApplyInputs(void)
i++; //108 i++; //108
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.KernelPatchesAllowed = InputItems[i].BValue; GlobalConfig.KernelPatchesAllowed = InputItems[i].BValue;
GlobalConfig.gBootChanged = TRUE; GlobalConfig.gBootChanged = TRUE;
} }
@ -1007,7 +1007,7 @@ void ApplyInputs(void)
} }
i++; //117 i++; //117
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
gSettings.EfiVersion = InputItems[i].SValue; GlobalConfig.EfiVersionUsed = InputItems[i].SValue;
} }
i++; //118 i++; //118
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
@ -1139,7 +1139,7 @@ void HelpRefit(void)
//else { //else {
// HelpMenu.TitleImage.setEmpty(); // HelpMenu.TitleImage.setEmpty();
//} //}
switch (gSettings.GUI.Language) switch (gSettings.GUI.languageCode)
{ {
case russian: case russian:
HelpMenu.AddMenuInfo_f("ESC - Выход из подменю, обновление главного меню"); HelpMenu.AddMenuInfo_f("ESC - Выход из подменю, обновление главного меню");
@ -1999,8 +1999,8 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuSmbios()
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_SMBIOS, "SMBIOS->"_XS8); Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_SMBIOS, "SMBIOS->"_XS8);
SubScreen->AddMenuInfoLine_f("%s", gCPUStructure.BrandString); SubScreen->AddMenuInfoLine_f("%s", gCPUStructure.BrandString);
SubScreen->AddMenuInfoLine_f("%s", gSettings.OEMProduct.c_str()); SubScreen->AddMenuInfoLine_f("%s", GlobalConfig.OEMProductFromSmbios.c_str());
SubScreen->AddMenuInfoLine_f("with board %s", gSettings.OEMBoard.c_str()); SubScreen->AddMenuInfoLine_f("with board %s", GlobalConfig.OEMBoardFromSmbios.c_str());
SubScreen->AddMenuItemInput(78, "Product Name:", TRUE); SubScreen->AddMenuItemInput(78, "Product Name:", TRUE);
SubScreen->AddMenuItemInput(79, "Product Version:", TRUE); SubScreen->AddMenuItemInput(79, "Product Version:", TRUE);