mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-12 09:54:36 +01:00
implement ExtendedFeatures
Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
parent
537884c7bd
commit
f0a20247e9
@ -995,6 +995,12 @@
|
||||
<string>Apple Inc.</string>
|
||||
<key>#FirmwareFeatures</key>
|
||||
<string>0xC0001403</string>
|
||||
<key>#FirmwareFeaturesMask</key>
|
||||
<string>0xFFFFFFFF</string>
|
||||
<key>#ExtendedFirmwareFeatures</key>
|
||||
<string>0x8FE001403</string>
|
||||
<key>#ExtendedFirmwareFeaturesMask</key>
|
||||
<string>0xFFFFFFFFFF</string>
|
||||
<key>#PlatformFeature</key>
|
||||
<string>0x00</string>
|
||||
<key>#Trust</key>
|
||||
@ -1003,8 +1009,6 @@
|
||||
<string>C0225060SAMF651AX</string>
|
||||
<key>#BiosVendor</key>
|
||||
<string>Apple Inc.</string>
|
||||
<key>#FirmwareFeaturesMask</key>
|
||||
<string>0xFFFFFFFF</string>
|
||||
<key>#BoardManufacturer</key>
|
||||
<string>Apple Inc.</string>
|
||||
<key>#BoardType</key>
|
||||
|
@ -173,6 +173,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
//
|
||||
#define FW_FEATURE_DISABLE_BOOTSCRIPT_WORKAROUND 0x80000000U // 31
|
||||
|
||||
//
|
||||
// Supports large BaseSystem. Checked by patchd. Required by macOS 12.
|
||||
//
|
||||
#define FW_FEATURE_SUPPORTS_LARGE_BASESYSTEM 0x800000000U // 35
|
||||
|
||||
//
|
||||
// OEM Platform Feature Information - Platform feature bits
|
||||
// These bits are exposed via APPLE_SMBIOS_TABLE_TYPE133 FirmwareFeatures:
|
||||
|
@ -271,13 +271,24 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
|
||||
sizeof(gSettings.Smbios.FirmwareFeatures),
|
||||
&gSettings.Smbios.FirmwareFeatures);
|
||||
|
||||
// Download-Fritz: Should be added to SMBIOS or at least to some other config section
|
||||
AddNvramVariable(L"FirmwareFeaturesMask",
|
||||
SetNvramVariable(L"FirmwareFeaturesMask",
|
||||
&gEfiAppleNvramGuid,
|
||||
Attributes,
|
||||
sizeof(gSettings.Smbios.FirmwareFeaturesMask),
|
||||
&gSettings.Smbios.FirmwareFeaturesMask);
|
||||
|
||||
SetNvramVariable(L"ExtendedFirmwareFeatures",
|
||||
&gEfiAppleNvramGuid,
|
||||
Attributes,
|
||||
sizeof(gSettings.Smbios.ExtendedFirmwareFeatures),
|
||||
&gSettings.Smbios.ExtendedFirmwareFeatures);
|
||||
|
||||
SetNvramVariable(L"ExtendedFirmwareFeaturesMask",
|
||||
&gEfiAppleNvramGuid,
|
||||
Attributes,
|
||||
sizeof(gSettings.Smbios.ExtendedFirmwareFeaturesMask),
|
||||
&gSettings.Smbios.ExtendedFirmwareFeaturesMask);
|
||||
|
||||
// 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.Smbios.BoardNumber);
|
||||
|
||||
|
@ -2465,6 +2465,8 @@ printf("%s", "");
|
||||
|
||||
UINT32 FirmwareFeatures = UINT32();
|
||||
UINT32 FirmwareFeaturesMask = UINT32();
|
||||
UINT64 ExtendedFirmwareFeatures = UINT64();
|
||||
UINT64 ExtendedFirmwareFeaturesMask = UINT64();
|
||||
RamSlotInfoArrayClass RamSlotInfoArray = RamSlotInfoArrayClass();
|
||||
SlotDeviceArrayClass SlotDevices = SlotDeviceArrayClass();
|
||||
|
||||
@ -2512,6 +2514,8 @@ printf("%s", "");
|
||||
|
||||
if ( !(FirmwareFeatures == other.FirmwareFeatures) ) return false;
|
||||
if ( !(FirmwareFeaturesMask == other.FirmwareFeaturesMask) ) return false;
|
||||
if ( !(ExtendedFirmwareFeatures == other.ExtendedFirmwareFeatures) ) return false;
|
||||
if ( !(ExtendedFirmwareFeaturesMask == other.ExtendedFirmwareFeaturesMask) ) return false;
|
||||
if ( !RamSlotInfoArray.isEqual(other.RamSlotInfoArray) ) return false;
|
||||
if ( !SlotDevices.isEqual(other.SlotDevices) ) return false;
|
||||
|
||||
@ -2557,9 +2561,11 @@ printf("%s", "");
|
||||
gPlatformFeature = configPlist.dgetgPlatformFeature();
|
||||
// PatchTableType11
|
||||
NoRomInfo = configPlist.dgetNoRomInfo();
|
||||
|
||||
//SMBIOS TYPE128
|
||||
FirmwareFeatures = configPlist.dgetFirmwareFeatures();
|
||||
FirmwareFeaturesMask = configPlist.dgetFirmwareFeaturesMask();
|
||||
ExtendedFirmwareFeatures = configPlist.dgetExtendedFirmwareFeatures();
|
||||
ExtendedFirmwareFeaturesMask = configPlist.dgetExtendedFirmwareFeaturesMask();
|
||||
RamSlotInfoArray.takeValueFrom(configPlist.Memory);
|
||||
SlotDevices.takeValueFrom(configPlist.Slots);
|
||||
}
|
||||
|
@ -134,6 +134,8 @@ void SmbiosFillPatchingValues(bool _SetTable132, uint8_t pEnabledCores, uint16_t
|
||||
smbiosInjectedSetting.gPlatformFeature = globalSettings.Smbios.gPlatformFeature;
|
||||
smbiosInjectedSetting.FirmwareFeatures = globalSettings.Smbios.FirmwareFeatures;
|
||||
smbiosInjectedSetting.FirmwareFeaturesMask = globalSettings.Smbios.FirmwareFeaturesMask;
|
||||
smbiosInjectedSetting.ExtendedFirmwareFeatures = globalSettings.Smbios.ExtendedFirmwareFeatures;
|
||||
smbiosInjectedSetting.ExtendedFirmwareFeaturesMask = globalSettings.Smbios.ExtendedFirmwareFeaturesMask;
|
||||
smbiosInjectedSetting.Attribute = globalSettings.Smbios.Attribute;
|
||||
|
||||
smbiosInjectedSetting.KPDELLSMBIOS = globalSettings.KernelAndKextPatches.KPDELLSMBIOS;
|
||||
|
@ -707,6 +707,56 @@ uint32_t GetFwFeatures(MACHINE_TYPES Model)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint64_t GetExtFwFeatures(MACHINE_TYPES Model)
|
||||
{
|
||||
// FirmwareFeatures for 12+
|
||||
switch ( Model )
|
||||
{
|
||||
case MacBookPro131:
|
||||
case MacBookPro132:
|
||||
case MacBookPro141:
|
||||
case MacBookPro142:
|
||||
case iMac171:
|
||||
case iMac181:
|
||||
case iMac182:
|
||||
case iMac183:
|
||||
return 0x8FC0FE176ull;
|
||||
break;
|
||||
case MacBook91:
|
||||
case MacBook101:
|
||||
case MacBookPro133:
|
||||
case MacBookPro143:
|
||||
return 0x8FC0FE17Eull;
|
||||
break;
|
||||
case MacBookPro121:
|
||||
case MacBookPro151:
|
||||
case MacBookPro152:
|
||||
case MacBookPro153:
|
||||
case MacBookPro154:
|
||||
case MacBookPro161:
|
||||
case MacBookAir81:
|
||||
case MacBookAir82:
|
||||
case iMac161:
|
||||
case iMac162:
|
||||
return 0x8FC0FE137ull;
|
||||
break;
|
||||
case MacBook61:
|
||||
case MacBook71:
|
||||
case MacBook81:
|
||||
return 0x8FC0FE13Full;
|
||||
break;
|
||||
default:
|
||||
return (uint64_t)GetFwFeatures(Model); //unknown - use oem SMBIOS value to be default
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t GetExtFwFeaturesMask(MACHINE_TYPES Model)
|
||||
{
|
||||
return (uint64_t)GetFwFeaturesMaskFromModel(Model) + 0xFF00000000ull;
|
||||
}
|
||||
|
||||
bool GetMobile(MACHINE_TYPES Model)
|
||||
{
|
||||
// Mobile: the battery tab in Energy Saver
|
||||
@ -1196,6 +1246,8 @@ void SetDMISettingsForModel(MACHINE_TYPES Model, SETTINGS_DATA* settingsData, RE
|
||||
settingsData->Smbios.ChassisAssetTag = ApplePlatformData[Model].chassisAsset;
|
||||
settingsData->Smbios.FirmwareFeatures = GetFwFeatures(Model);
|
||||
settingsData->Smbios.FirmwareFeaturesMask = GetFwFeaturesMaskFromModel(Model);
|
||||
settingsData->Smbios.ExtendedFirmwareFeatures = GetExtFwFeatures(Model);
|
||||
settingsData->Smbios.ExtendedFirmwareFeaturesMask = GetExtFwFeaturesMask(Model);
|
||||
settingsData->Smbios.gPlatformFeature = GetPlatformFeature(Model);
|
||||
if ((Model > MacPro31) && (Model < MacPro71)) {
|
||||
settingsData->Smbios.BoardType = BaseBoardTypeProcessorMemoryModule; //0xB;
|
||||
|
@ -201,6 +201,8 @@ XString8 GetReleaseDate (MACHINE_TYPES Model);
|
||||
uint8_t GetChassisTypeFromModel(MACHINE_TYPES Model);
|
||||
uint32_t GetFwFeaturesMaskFromModel(MACHINE_TYPES Model);
|
||||
uint32_t GetFwFeatures(MACHINE_TYPES Model);
|
||||
uint64_t GetExtFwFeatures(MACHINE_TYPES Model);
|
||||
uint64_t GetExtFwFeaturesMask(MACHINE_TYPES Model);
|
||||
bool GetMobile(MACHINE_TYPES Model);
|
||||
UINT64 GetPlatformFeature(MACHINE_TYPES Model);
|
||||
void getRBr(MACHINE_TYPES Model, UINT32 CPUModel, bool isMobile, char RBr[8]);
|
||||
|
@ -1982,6 +1982,8 @@ void PatchTableType128(const SmbiosInjectedSettings& smbiosSettings)
|
||||
// set firmware-features mask
|
||||
newSmbiosTable.Type128->FirmwareFeaturesMask = smbiosSettings.FirmwareFeaturesMask;
|
||||
|
||||
newSmbiosTable.Type128->ExtendedFirmwareFeatures = (uint32_t)(smbiosSettings.ExtendedFirmwareFeatures >> 32);
|
||||
newSmbiosTable.Type128->ExtendedFirmwareFeaturesMask = (uint32_t)(smbiosSettings.ExtendedFirmwareFeaturesMask >> 32);
|
||||
/**
|
||||
* TODO: I have an idea that region should be the same as Efivar.bin
|
||||
* @author Slice
|
||||
|
@ -201,6 +201,8 @@ class SmbiosInjectedSettings
|
||||
uint64_t gPlatformFeature = 0;
|
||||
uint32_t FirmwareFeatures = 0;
|
||||
uint32_t FirmwareFeaturesMask = 0;
|
||||
uint64_t ExtendedFirmwareFeatures = 0;
|
||||
uint64_t ExtendedFirmwareFeaturesMask = 0;
|
||||
int8_t Attribute = 0;
|
||||
|
||||
bool KPDELLSMBIOS = 0;
|
||||
|
@ -666,6 +666,10 @@ void ConfigManager::FillSmbiosWithDefaultValue(MACHINE_TYPES Model, const Smbios
|
||||
if ( smbiosDictClass.getChassisAssetTag().isDefined() ) gSettings.Smbios.ChassisAssetTag = smbiosDictClass.getChassisAssetTag().value();
|
||||
if ( smbiosDictClass.getFirmwareFeatures().isDefined() ) gSettings.Smbios.FirmwareFeatures = smbiosDictClass.getFirmwareFeatures().value();
|
||||
if ( smbiosDictClass.getFirmwareFeaturesMask().isDefined() ) gSettings.Smbios.FirmwareFeaturesMask = smbiosDictClass.getFirmwareFeaturesMask().value();
|
||||
|
||||
//ExtendedFirmwareFeatures
|
||||
if ( smbiosDictClass.getExtendedFirmwareFeatures().isDefined() ) gSettings.Smbios.ExtendedFirmwareFeatures = smbiosDictClass.getExtendedFirmwareFeatures().value();
|
||||
if ( smbiosDictClass.getExtendedFirmwareFeaturesMask().isDefined() ) gSettings.Smbios.ExtendedFirmwareFeaturesMask = smbiosDictClass.getExtendedFirmwareFeaturesMask().value();
|
||||
if ( smbiosDictClass.getPlatformFeature().isDefined() ) gSettings.Smbios.gPlatformFeature = smbiosDictClass.getPlatformFeature().value();
|
||||
if ( smbiosDictClass.getBoardType().isDefined() ) gSettings.Smbios.BoardType = smbiosDictClass.getBoardType().value();
|
||||
if ( smbiosDictClass.getChassisType().isDefined() ) gSettings.Smbios.ChassisType = smbiosDictClass.getChassisType().value();
|
||||
|
@ -367,11 +367,13 @@ public:
|
||||
|
||||
XmlUInt32 FirmwareFeatures = XmlUInt32(); // gFwFeatures
|
||||
XmlUInt32 FirmwareFeaturesMask = XmlUInt32();
|
||||
XmlUInt64 ExtendedFirmwareFeatures = XmlUInt64(); // gFwFeatures
|
||||
XmlUInt64 ExtendedFirmwareFeaturesMask = XmlUInt64();
|
||||
public:
|
||||
MemoryDictClass Memory = MemoryDictClass();
|
||||
SlotDeviceArrayClass Slots = SlotDeviceArrayClass();
|
||||
|
||||
XmlDictField m_fields[29] = {
|
||||
XmlDictField m_fields[31] = { //31
|
||||
{"Trust", Trust},
|
||||
{"MemoryRank", MemoryRank},
|
||||
{"Memory", Memory},
|
||||
@ -383,6 +385,8 @@ public:
|
||||
{"EfiVersion", EfiVersion},
|
||||
{"FirmwareFeatures", FirmwareFeatures},
|
||||
{"FirmwareFeaturesMask", FirmwareFeaturesMask},
|
||||
{"ExtendedFirmwareFeatures", ExtendedFirmwareFeatures},
|
||||
{"ExtendedFirmwareFeaturesMask", ExtendedFirmwareFeaturesMask},
|
||||
{"PlatformFeature", PlatformFeature},
|
||||
{"BiosVendor", BiosVendor},
|
||||
{"Manufacturer", Manufacturer},
|
||||
@ -449,6 +453,8 @@ public:
|
||||
const decltype(EfiVersion)& getEfiVersion() const { return EfiVersion; }
|
||||
const decltype(FirmwareFeatures)& getFirmwareFeatures() const { return FirmwareFeatures; }
|
||||
const decltype(FirmwareFeaturesMask)& getFirmwareFeaturesMask() const { return FirmwareFeaturesMask; }
|
||||
const decltype(ExtendedFirmwareFeatures)& getExtendedFirmwareFeatures() const { return ExtendedFirmwareFeatures; }
|
||||
const decltype(ExtendedFirmwareFeaturesMask)& getExtendedFirmwareFeaturesMask() const { return ExtendedFirmwareFeaturesMask; }
|
||||
const decltype(PlatformFeature)& getPlatformFeature() const { return PlatformFeature; }
|
||||
const decltype(BiosVendor)& getBiosVendor() const { return BiosVendor; }
|
||||
const decltype(Manufacturer)& getManufacturer() const { return Manufacturer; }
|
||||
@ -627,6 +633,14 @@ public:
|
||||
decltype(FirmwareFeaturesMask)::ValueType dgetFirmwareFeaturesMask() const {
|
||||
if ( FirmwareFeaturesMask.isDefined() ) return FirmwareFeaturesMask.value();
|
||||
return GetFwFeaturesMaskFromModel(dgetModel());
|
||||
};
|
||||
decltype(ExtendedFirmwareFeatures)::ValueType dgetExtendedFirmwareFeatures() const {
|
||||
if ( ExtendedFirmwareFeatures.isDefined() ) return ExtendedFirmwareFeatures.value();
|
||||
return GetExtFwFeatures(dgetModel());
|
||||
};
|
||||
decltype(ExtendedFirmwareFeaturesMask)::ValueType dgetExtendedFirmwareFeaturesMask() const {
|
||||
if ( ExtendedFirmwareFeaturesMask.isDefined() ) return ExtendedFirmwareFeaturesMask.value();
|
||||
return GetExtFwFeaturesMask(dgetModel());
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -451,6 +451,11 @@ void FillInputs(BOOLEAN New)
|
||||
InputItems[InputItemsCount].ItemType = BoolValue; //124
|
||||
InputItems[InputItemsCount++].BValue = gSettings.ACPI.FixHeaders;
|
||||
|
||||
InputItems[InputItemsCount].ItemType = Hex; //125
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("0x%016llX", gSettings.Smbios.ExtendedFirmwareFeatures);
|
||||
InputItems[InputItemsCount].ItemType = Hex; //126
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("0x%016llX", gSettings.Smbios.ExtendedFirmwareFeaturesMask);
|
||||
|
||||
|
||||
|
||||
//menu for drop table
|
||||
@ -1074,7 +1079,16 @@ void ApplyInputs(void)
|
||||
gSettings.ACPI.FixHeaders = InputItems[i].BValue;
|
||||
DBG("applied gSettings.ACPI.FixHeaders=%s\n", gSettings.ACPI.FixHeaders ? "Y" : "N" );
|
||||
}
|
||||
|
||||
i++; //125
|
||||
if (InputItems[i].Valid) {
|
||||
gSettings.Smbios.ExtendedFirmwareFeatures = StrHexToUint64(InputItems[i].SValue.wc_str());
|
||||
DBG("applied ExtendedFirmwareFeatures=0x%llX\n", gSettings.Smbios.ExtendedFirmwareFeatures);
|
||||
}
|
||||
i++; //126
|
||||
if (InputItems[i].Valid) {
|
||||
gSettings.Smbios.ExtendedFirmwareFeaturesMask = StrHexToUint64(InputItems[i].SValue.wc_str());
|
||||
DBG("applied ExtendedFirmwareFeaturesMask=0x%llX\n", gSettings.Smbios.ExtendedFirmwareFeaturesMask);
|
||||
}
|
||||
|
||||
if (NeedSave) {
|
||||
ApplySettings();
|
||||
@ -2025,6 +2039,8 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuSmbios()
|
||||
SubScreen->AddMenuItemInput(87, "ROM Release Date:", TRUE);
|
||||
SubScreen->AddMenuItemInput(62, "FirmwareFeatures:", TRUE);
|
||||
SubScreen->AddMenuItemInput(63, "FirmwareFeaturesMask:", TRUE);
|
||||
SubScreen->AddMenuItemInput(125, "ExtendedFirmwareFeatures:", TRUE);
|
||||
SubScreen->AddMenuItemInput(126, "ExtendedFirmwareFeaturesMask:", TRUE);
|
||||
SubScreen->AddMenuItemInput(17, "PlatformFeature:", TRUE);
|
||||
SubScreen->AddMenuItemInput(117, "EFI Version:", TRUE);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user