implement tscsync

Signed-off-by: Сергей Исаков <slice@Sergejs-Mac-Pro.local>
This commit is contained in:
Сергей Исаков 2022-10-06 22:14:54 +03:00
parent 70a37b142c
commit e56b549dca
5 changed files with 24 additions and 5 deletions

View File

@ -1043,6 +1043,8 @@
<true/>
<key>ThirdPartyDrives</key>
<false/>
<key>TscSyncTimeout</key>
<integer>0</integer>
<key>XhciPortLimit</key>
<false/>
</dict>

View File

@ -2114,6 +2114,7 @@ printf("%s", "");
XBool SyncRuntimePermissions = false;
int8_t ResizeAppleGpuBars = 0; // 0 is NOT the default value if not set in config.plist. Default value if not set is returned by dgetResizeAppleGpuBars()
XBool ForceOcWriteFlash = false;
uint32_t TscSyncTimeout = 0;
#if __cplusplus > 201703L
XBool operator == (const OcBooterQuirksClass&) const = default;
@ -2139,6 +2140,7 @@ printf("%s", "");
if ( !(SignalAppleOS == other.SignalAppleOS) ) return false;
if ( !(SyncRuntimePermissions == other.SyncRuntimePermissions) ) return false;
if ( !(ForceOcWriteFlash == other.ForceOcWriteFlash) ) return false;
if ( !(TscSyncTimeout == other.TscSyncTimeout) ) return false;
return true;
}
void takeValueFrom(const ConfigPlistClass::Quirks_Class::OcBooterQuirks_Class& other)
@ -2162,6 +2164,7 @@ printf("%s", "");
SignalAppleOS = other.dgetSignalAppleOS();
SyncRuntimePermissions = other.dgetSyncRuntimePermissions();
ForceOcWriteFlash = other.dgetForceOcWriteFlash();
TscSyncTimeout = other.dgetTscSyncTimeout();
}
};

View File

@ -105,6 +105,7 @@ public:
XmlBool SignalAppleOS = XmlBool();
XmlBool SyncRuntimePermissions = XmlBool();
XmlBool ForceOcWriteFlash = XmlBool();
XmlUInt32 TscSyncTimeout = XmlUInt32();
XBool dgetAvoidRuntimeDefrag() const { return parent.isDefined() ? AvoidRuntimeDefrag.isDefined() ? AvoidRuntimeDefrag.value() : XBool(true) : XBool(false); }; // TODO: different default value if section is not defined
XBool dgetDevirtualiseMmio() const { return DevirtualiseMmio.isDefined() ? DevirtualiseMmio.value() : DevirtualiseMmio.nullValue; };
@ -125,6 +126,7 @@ public:
XBool dgetSyncRuntimePermissions() const { return parent.isDefined() ? SyncRuntimePermissions.isDefined() ? SyncRuntimePermissions.value() : XBool(true) : XBool(false); }; // TODO: different default value if section is not defined
int8_t dgetResizeAppleGpuBars() const { return parent.isDefined() && ResizeAppleGpuBars.isDefined() ? ResizeAppleGpuBars.value() : -1; };
XBool dgetForceOcWriteFlash() const { return ForceOcWriteFlash.isDefined() ? ForceOcWriteFlash.value() : XBool(false); };
uint32_t dgetTscSyncTimeout() const { return TscSyncTimeout.isDefined() ? TscSyncTimeout.value() : 0; };
OcBooterQuirks_Class(const Quirks_Class& _parent) : parent(_parent) {}
};
XmlArray<Quirks_MmioWhitelist_Class> MmioWhitelist = XmlArray<Quirks_MmioWhitelist_Class>();
@ -136,7 +138,7 @@ public:
OcKernelQuirks_Class OcKernelQuirks;
OcBooterQuirks_Class OcBooterQuirks;
XmlDictField m_fields[34] = {
XmlDictField m_fields[35] = {
{"AvoidRuntimeDefrag", OcBooterQuirks.AvoidRuntimeDefrag},
{"DevirtualiseMmio", OcBooterQuirks.DevirtualiseMmio},
{"DisableSingleUser", OcBooterQuirks.DisableSingleUser},
@ -156,6 +158,7 @@ public:
{"SetupVirtualMap", OcBooterQuirks.SetupVirtualMap},
{"SignalAppleOS", OcBooterQuirks.SignalAppleOS},
{"SyncRuntimePermissions", OcBooterQuirks.SyncRuntimePermissions},
{"TscSyncTimeout", OcBooterQuirks.TscSyncTimeout},
{"MmioWhitelist", MmioWhitelist},
{"FuzzyMatch", FuzzyMatch},
{"KernelCache", KernelCache},

View File

@ -1029,8 +1029,9 @@ void LOADER_ENTRY::StartLoader()
FillOCCpuInfo(&mOpenCoreCpuInfo);
//test
if (gSettings.Quirks.OcBooterQuirks.SignalAppleOS) mOpenCoreConfiguration.Uefi.Quirks.TscSyncTimeout = 750000;
else mOpenCoreConfiguration.Uefi.Quirks.TscSyncTimeout = 0;
// if (gSettings.Quirks.OcBooterQuirks.TscSyncTimeout) mOpenCoreConfiguration.Uefi.Quirks.TscSyncTimeout = gSettings.Quirks.OcBooterQuirks.TscSyncTimeout;
// else mOpenCoreConfiguration.Uefi.Quirks.TscSyncTimeout = 0;
mOpenCoreConfiguration.Uefi.Quirks.TscSyncTimeout = gSettings.Quirks.OcBooterQuirks.TscSyncTimeout;
// if OC is NOT initialized with OcMain, we need the following
// OcLoadBooterUefiSupport(&mOpenCoreConfiguration);

View File

@ -143,7 +143,7 @@ void FillInputs(XBool New)
UINTN InputItemsCount = 0;
if (New) {
// InputItems = (__typeof__(InputItems))A_llocateZeroPool(130 * sizeof(INPUT_ITEM)); //XXX
InputItems = new INPUT_ITEM[130];
InputItems = new INPUT_ITEM[132];
}
InputItems[InputItemsCount].ItemType = ASString; //0
@ -467,6 +467,9 @@ void FillInputs(XBool New)
InputItems[InputItemsCount].ItemType = BoolValue; //129
InputItems[InputItemsCount++].BValue = gResetSMC;
InputItems[InputItemsCount].ItemType = Decimal; //130
InputItems[InputItemsCount++].SValue.SWPrintf("%08d", gSettings.Quirks.OcBooterQuirks.TscSyncTimeout);
//menu for drop table
@ -1132,7 +1135,12 @@ void ApplyInputs(void)
gResetSMC = false;
}
}
i++; //130
if (InputItems[i].Valid) {
INTN Minus = 0;
gSettings.Quirks.OcBooterQuirks.TscSyncTimeout = StrDecimalToUintn(InputItems[i].SValue.data(Minus));
DBG("set TscSyncTimeout=%d\n", gSettings.Quirks.OcBooterQuirks.TscSyncTimeout);
}
if (NeedSave) {
ApplySettings();
@ -2574,6 +2582,8 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuQuirks()
SubScreen->AddMenuItemInput(127, "ResizeAppleGpuBars:", true);
SubScreen->AddMenuCheck("SetupVirtualMap", QUIRK_VIRT, 101);
SubScreen->AddMenuCheck("SyncRuntimePermissions", QUIRK_PERM, 101);
SubScreen->AddMenuItemInput(130, "TscSyncTimeout:", true);
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
ModifyTitles(Entry);