implemented hw.target

Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
SergeySlice 2021-10-08 22:49:07 +03:00
parent 5a57fccb1b
commit ec1f8a6a4a
4 changed files with 18 additions and 5 deletions

View File

@ -243,9 +243,11 @@
<key>BooterConfig</key>
<string>0x28</string>
<key>CsrActiveConfig</key>
<string>0x3E7</string>
<string>0xA85</string>
<key>MLB</key>
<string>C02032109R5DC771H</string>
<string>C02032109R6DC771H</string>
<key>#HWTarget</key>
<string>j160</string>
<key>Block</key>
<array>
<dict>

View File

@ -388,10 +388,16 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
SetNvramVariable(L"flagstate", &gEfiAppleBootGuid, Attributes, 32, &GlobalConfig.flagstate);
}
// Hack for recovery by Asgorath
if (gSettings.RtVariables.CsrActiveConfig != 0xFFFF) {
SetNvramVariable(L"csr-active-config", &gEfiAppleBootGuid, Attributes, sizeof(gSettings.RtVariables.CsrActiveConfig), &gSettings.RtVariables.CsrActiveConfig);
}
if (gSettings.RtVariables.HWTarget.notEmpty()) {
SetNvramXString8(L"BridgeOSHardwareModel", &gEfiAppleNvramGuid, Attributes, gSettings.RtVariables.HWTarget);
} else {
DeleteNvramVariable(L"BridgeOSHardwareModel", &gEfiAppleNvramGuid);
}
/*
if (gSettings.RtVariables.BooterConfig != 0) {
SetNvramVariable(L"bootercfg", &gEfiAppleBootGuid, Attributes, sizeof(gSettings.RtVariables.BooterConfig), &gSettings.RtVariables.BooterConfig);

View File

@ -2260,6 +2260,7 @@ printf("%s", "");
UINT32 CsrActiveConfig = UINT32();
UINT16 BooterConfig = UINT16();
XString8 BooterCfgStr = XString8();
XString8 HWTarget = XString8();
XObjArrayWithTakeValueFromXmlArray<RT_VARIABLES, ConfigPlistClass::RtVariables_Class::Devices_RtVariables_Block> BlockRtVariableArray = XObjArrayWithTakeValueFromXmlArray<RT_VARIABLES, ConfigPlistClass::RtVariables_Class::Devices_RtVariables_Block>();
XBool GetLegacyLanAddress() const {
@ -2277,6 +2278,7 @@ printf("%s", "");
if ( !(CsrActiveConfig == other.CsrActiveConfig) ) return false;
if ( !(BooterConfig == other.BooterConfig) ) return false;
if ( !(BooterCfgStr == other.BooterCfgStr) ) return false;
if ( !(HWTarget == other.HWTarget) ) return false;
if ( !BlockRtVariableArray.isEqual(other.BlockRtVariableArray) ) return false;
return true;
}
@ -2289,6 +2291,7 @@ printf("%s", "");
BooterConfig = configPlist.dgetBooterConfig();
BooterCfgStr = configPlist.dgetBooterCfgStr();
BlockRtVariableArray.takeValueFrom(configPlist.Block);
HWTarget = configPlist.dgetHWTarget();
}
};

View File

@ -135,16 +135,18 @@ protected:
XmlUInt32 CsrActiveConfig = XmlUInt32();
XmlUInt16 BooterConfig = XmlUInt16();
XmlString8AllowEmpty BooterCfg = XmlString8AllowEmpty();
XmlString8AllowEmpty HWTarget = XmlString8AllowEmpty();
public:
XmlArray<Devices_RtVariables_Block> Block = XmlArray<Devices_RtVariables_Block>();
XmlDictField m_fields[6] = {
XmlDictField m_fields[7] = {
{"ROM", ROM},
{"MLB", MLB},
{"CsrActiveConfig", CsrActiveConfig},
{"BooterConfig", BooterConfig},
{"BooterCfg", BooterCfg},
{"Block", Block},
{"HWTarget", HWTarget},
};
virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); };
@ -169,7 +171,7 @@ public:
decltype(CsrActiveConfig)::ValueType dgetCsrActiveConfig() const { return CsrActiveConfig.isDefined() ? CsrActiveConfig.value() : 0xFFFF; }; // 0xFFFF = not set
const decltype(BooterConfig)::ValueType& dgetBooterConfig() const { return BooterConfig.isDefined() ? BooterConfig.value() : BooterConfig.nullValue; };
const decltype(BooterCfg)::ValueType& dgetBooterCfgStr() const { return BooterCfg.isDefined() ? BooterCfg.value() : BooterCfg.nullValue; };
const decltype(HWTarget)::ValueType& dgetHWTarget() const { return HWTarget.isDefined() ? HWTarget.value() : HWTarget.nullValue; };// "j160"_XS8; };
};