Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions CloverPackage/CloverV2/EFI/CLOVER/config-sample.plist
Original file line number Diff line number Diff line change
Expand Up @@ -751,8 +751,6 @@
<true/>
<key>AppleRTC</key>
<false/>
<key>BlockSkywalk</key>
<false/>
<key>BootPatches</key>
<array>
<dict>
Expand Down Expand Up @@ -785,6 +783,29 @@
<false/>
<key>KernelPm</key>
<false/>
<key>KextsToBlock</key>
<array>
<dict>
<key>Comment</key>
<string>Allow IOSkywalk Downgrade</string>
<key>Disabled</key>
<false/>
<key>MatchOS</key>
<string>14.x,15.x,26.x</string>
<key>Name</key>
<string>com.apple.iokit.IOSkywalkFamily</string>
</dict>
<dict>
<key>Comment</key>
<string>Allow Block AppleEthernetRL</string>
<key>Disabled</key>
<true/>
<key>MatchOS</key>
<string>25.x,26.x</string>
<key>Name</key>
<string>com.apple.driver.AppleEthernetRL</string>
</dict>
</array>
<key>KernelToPatch</key>
<array>
<dict>
Expand Down
4 changes: 1 addition & 3 deletions rEFIt_UEFI/Platform/AcpiPatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -687,9 +687,7 @@ void PreCleanupRSDT()
}

//REVIEW: really?
// Если адрес RSDT < адреса XSDT и хвост RSDT наползает на XSDT, то подрезаем хвост RSDT до начала XSDT
// English: If the RSDT address of the XSDT address and the tail of the RSDT crawls onto the XSDT, then we
// trim the RSDT tail before the XSDT starts
// If RSDT address < XSDT address and RSDT tail overlaps with XSDT, then trim RSDT tail to the start of XSDT
if ((UINTN)Rsdt < (UINTN)Xsdt && (UINTN)Rsdt + Rsdt->Header.Length > (UINTN)Xsdt) {
UINTN v = ((UINTN)Xsdt - (UINTN)Rsdt) & ~3;
Rsdt->Header.Length = (UINT32)v;
Expand Down
40 changes: 40 additions & 0 deletions rEFIt_UEFI/Platform/KERNEL_AND_KEXT_PATCHES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,46 @@ XBool ABSTRACT_PATCH::IsPatchEnabled(const MacOsVersion& CurrOS)
return ret;
}

XBool KEXT_TO_BLOCK::ShouldBlock(const MacOsVersion& CurrOS) const
{
if (Disabled || !MenuItem.BValue || Name.isEmpty()) {
return false;
}

XString8 matchOS = MatchOS;
matchOS.trim();
if (matchOS.isEmpty()) {
return true;
}

XString8 matchOSLower = matchOS;
matchOSLower.lowerAscii();
if (matchOSLower == "all"_XS8) {
return true;
}

if (CurrOS.isEmpty()) {
return false;
}

XString8Array mos = Split<XString8Array>(matchOS, ","_XS8).trimEachString();
for (size_t i = 0; i < mos.size(); ++i) {
if (mos[i].isEmpty()) {
continue;
}
XString8 entryLower = mos[i];
entryLower.lowerAscii();
if (entryLower == "all"_XS8) {
return true;
}
if (CurrOS.match(mos[i])) {
return true;
}
}

return false;
}


//
//XBool KERNEL_AND_KEXT_PATCHES::IsPatchEnabledByBuildNumber(const XString8& Build)
Expand Down
44 changes: 40 additions & 4 deletions rEFIt_UEFI/Platform/KERNEL_AND_KEXT_PATCHES.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,42 @@ class BOOT_PATCH : public ABSTRACT_PATCH
}
};

class KEXT_TO_BLOCK
{
public:
XString8 Comment = XString8();
XBool Disabled = XBool();
XString8 MatchOS = XString8();
XString8 Name = XString8();
INPUT_ITEM MenuItem = INPUT_ITEM();
XString8 Label = XString8();

#if __cplusplus > 201703L
XBool operator == (const KEXT_TO_BLOCK&) const = default;
#endif
XBool isEqual(const KEXT_TO_BLOCK& other) const
{
if ( !(Comment == other.Comment ) ) return false;
if ( !(Disabled == other.Disabled ) ) return false;
if ( !(MatchOS == other.MatchOS ) ) return false;
if ( !(Name == other.Name ) ) return false;
if ( MenuItem != other.MenuItem ) return false;
if ( !(Label == other.Label ) ) return false;
return true;
}
void takeValueFrom(const ConfigPlistClass::KernelAndKextPatches_Class::KernelAndKextPatches_KextsToBlock_Class& other)
{
Comment = other.dgetComment();
Disabled = other.dgetDisabled();
MatchOS = other.dgetMatchOS();
Name = other.dgetName();
MenuItem.BValue = !other.dgetDisabled();
Label = Comment.notEmpty() ? Comment : Name;
}

XBool ShouldBlock(const MacOsVersion& CurrOS) const;
};

class KERNEL_AND_KEXT_PATCHES
{
public:
Expand All @@ -194,19 +230,19 @@ class KERNEL_AND_KEXT_PATCHES
XBool KPPanicNoKextDump = XBool();
XBool _KPAppleIntelCPUPM = XBool();
XBool KPAppleRTC = XBool();
XBool BlockSkywalk = XBool();
XBool EightApple = XBool();
XBool KPDELLSMBIOS = XBool(); // Dell SMBIOS patch
UINT32 FakeCPUID = UINT32();
XString8 KPATIConnectorsController = XString8();
XBuffer<UINT8> KPATIConnectorsData = XBuffer<UINT8>();
XBuffer<UINT8> KPATIConnectorsPatch = XBuffer<UINT8>();
XStringWArray ForceKextsToLoad/* = XStringWArray()*/;
XObjArrayWithTakeValueFromXmlArray<KEXT_TO_BLOCK, ConfigPlistClass::KernelAndKextPatches_Class::KernelAndKextPatches_KextsToBlock_Class> KextsToBlock/* = XObjArrayWithTakeValueFromXmlArray<KEXT_TO_BLOCK>()*/;
XObjArrayWithTakeValueFromXmlArray<KEXT_PATCH, ConfigPlistClass::KernelAndKextPatches_Class::KernelAndKextPatches_KextsToPatch_Class> KextPatches/* = XObjArrayWithTakeValueFromXmlArray<KEXT_PATCH>()*/;
XObjArrayWithTakeValueFromXmlArray<KERNEL_PATCH, ConfigPlistClass::KernelAndKextPatches_Class::KernelAndKextPatches_KernelToPatch_Class> KernelPatches/* = XObjArrayWithTakeValueFromXmlArray<KERNEL_PATCH>()*/;
XObjArrayWithTakeValueFromXmlArray<BOOT_PATCH, ConfigPlistClass::KernelAndKextPatches_Class::KernelAndKextPatches_BootPatch_Class> BootPatches/* = XObjArrayWithTakeValueFromXmlArray<BOOT_PATCH>()*/;

KERNEL_AND_KEXT_PATCHES() : ForceKextsToLoad(), KextPatches(), KernelPatches(), BootPatches() {}
KERNEL_AND_KEXT_PATCHES() : ForceKextsToLoad(), KextsToBlock(), KextPatches(), KernelPatches(), BootPatches() {}

#if __cplusplus > 201703L
XBool operator == (const KERNEL_AND_KEXT_PATCHES&) const = default;
Expand All @@ -221,13 +257,13 @@ class KERNEL_AND_KEXT_PATCHES
if ( !(_KPAppleIntelCPUPM == other._KPAppleIntelCPUPM ) ) return false;
if ( !(KPAppleRTC == other.KPAppleRTC ) ) return false;
if ( !(EightApple == other.EightApple ) ) return false;
if ( !(BlockSkywalk == other.BlockSkywalk ) ) return false;
if ( !(KPDELLSMBIOS == other.KPDELLSMBIOS ) ) return false;
if ( !(FakeCPUID == other.FakeCPUID ) ) return false;
if ( !(KPATIConnectorsController == other.KPATIConnectorsController ) ) return false;
if ( !(KPATIConnectorsData == other.KPATIConnectorsData ) ) return false;
if ( !(KPATIConnectorsPatch == other.KPATIConnectorsPatch ) ) return false;
if ( !(ForceKextsToLoad == other.ForceKextsToLoad ) ) return false;
if ( !KextsToBlock.isEqual(other.KextsToBlock) ) return false;
if ( !KextPatches.isEqual(other.KextPatches) ) return false;
if ( !KernelPatches.isEqual(other.KernelPatches) ) return false;
if ( !BootPatches.isEqual(other.BootPatches) ) return false;
Expand All @@ -242,14 +278,14 @@ class KERNEL_AND_KEXT_PATCHES
KPPanicNoKextDump = other.dgetKPPanicNoKextDump();
_KPAppleIntelCPUPM = other.dget_KPAppleIntelCPUPM();
KPAppleRTC = other.dgetKPAppleRTC();
BlockSkywalk = other.dgetBlockSkywalk();
EightApple = other.dgetEightApple();
KPDELLSMBIOS = other.dgetKPDELLSMBIOS();
FakeCPUID = other.dgetFakeCPUID();
KPATIConnectorsController = other.dgetKPATIConnectorsController();
KPATIConnectorsData = other.dgetKPATIConnectorsData();
KPATIConnectorsPatch = other.dgetKPATIConnectorsPatch();
ForceKextsToLoad = other.dgetForceKextsToLoad();
KextsToBlock.takeValueFrom(other.KextsToBlock);
KextPatches.takeValueFrom(other.KextsToPatch);
KernelPatches.takeValueFrom(other.KernelToPatch);
BootPatches.takeValueFrom(other.BootPatches);
Expand Down
25 changes: 18 additions & 7 deletions rEFIt_UEFI/Platform/cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1159,12 +1159,13 @@ void GetCPUProperties (void)
tmpU = gCPUStructure.FSBFrequency;
DBG("Corrected FSBFrequency = %llu MHz\n", DivU64x32(tmpU, Mega));

if ((gCPUStructure.Vendor == CPU_VENDOR_INTEL) && (gCPUStructure.Model == CPU_MODEL_NEHALEM)) {
if ((gCPUStructure.Vendor == CPU_VENDOR_INTEL) &&
((gCPUStructure.Model == CPU_MODEL_NEHALEM) || (gCPUStructure.Model == CPU_MODEL_NEHALEM_EX) ||
(gCPUStructure.Model == CPU_MODEL_WESTMERE) || (gCPUStructure.Model == CPU_MODEL_WESTMERE_EX))) {
//Slice - for Nehalem we can do more calculation as in Cham
// but this algo almost always wrong
//
// thanks to dgobe for i3/i5/i7 bus speed detection
// TODO: consider more Nehalem based CPU(?) ex. CPU_MODEL_NEHALEM_EX, CPU_MODEL_WESTMERE, CPU_MODEL_WESTMERE_EX
// info: https://en.wikipedia.org/wiki/List_of_Intel_Xeon_microprocessors#Nehalem-based_Xeons
qpimult = 2; //init
/* Scan PCI BUS For QPI Frequency */
Expand Down Expand Up @@ -1612,7 +1613,11 @@ MacModel GetDefaultModel()
case CPU_MODEL_ICELAKE_A:
case CPU_MODEL_ICELAKE_C:
case CPU_MODEL_ICELAKE_D:
case CPU_MODEL_ALDERLAKE_ULT: //???
case CPU_MODEL_TIGERLAKE_C:
case CPU_MODEL_TIGERLAKE_D:
case CPU_MODEL_ALDERLAKE_ULT:
case CPU_MODEL_RAPTORLAKE_B:
case CPU_MODEL_METEORLAKE:
case CPU_MODEL_ARROWLAKE_U:
DefaultType = MacBookPro161;
break;
Expand Down Expand Up @@ -1725,16 +1730,22 @@ MacModel GetDefaultModel()
case CPU_MODEL_BROADWELL_E5:
DefaultType = MacPro61;
break;
case CPU_MODEL_ALDERLAKE:

case CPU_MODEL_RAPTORLAKE_B:
case CPU_MODEL_COMETLAKE_S:
if ( gCPUStructure.BrandString.contains("i9") ) {
DefaultType = iMac202;
break;
}
DefaultType = iMac201;
break;
case CPU_MODEL_ROCKETLAKE:
DefaultType = iMac201;
break;
case CPU_MODEL_ALDERLAKE:
case CPU_MODEL_RAPTORLAKE:
case CPU_MODEL_METEORLAKE:
case CPU_MODEL_ARROWLAKE:
case CPU_MODEL_ARROWLAKE_X:

case CPU_MODEL_RAPTORLAKE_B:
DefaultType = MacPro71;
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion rEFIt_UEFI/Platform/device_inject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ DevPropDevice *devprop_add_device_pci(DevPropString *StringBuf, pci_dt_t *PciDt,
return NULL;
}

//просмотреть StringBuf->entries[] в поисках такого же девайса
// scan StringBuf->entries[] for the same device
//SameDevice(DevPropDevice* D1, DevPropDevice* D2)

if (!DevicePath && (PciDt != 0)) {
Expand Down
2 changes: 1 addition & 1 deletion rEFIt_UEFI/Platform/platformdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ UINT64 GetPlatformFeature(MacModel Model)
case MacBookAir82:
case MacBookAir91:
return 0x1A; //3A;
// 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 character "2" = 0x32 != 0x02. Don't use ioreg, so that not to be confused. Use dmidecode dump.
default:
return 0xFFFF; // disabled
}
Expand Down
Loading
Loading