Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeySlice committed Jan 16, 2024
2 parents 68244b9 + 8697e93 commit 7e3ffed
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 22 deletions.
22 changes: 14 additions & 8 deletions rEFIt_UEFI/Platform/cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,14 @@ void GetCPUProperties (void)

DBG(" The CPU%s supported SSE4.1\n", (gCPUStructure.Features & CPUID_FEATURE_SSE4_1)?"":" not");
DBG(" The CPU%s supported RDRAND\n", (gCPUStructure.Features & CPUID_FEATURE_RDRAND)?"":" not");
/* Pack CPU Family and Model */
if (gCPUStructure.Family == 0x0f) {
gCPUStructure.Family += gCPUStructure.Extfamily;
}


// /* Pack CPU Family -> We can't do that, or else we'll give a wrong to OC. */
// if (gCPUStructure.Family == 0x0f) {
// gCPUStructure.Family += gCPUStructure.Extfamily;
// }

/* Pack Model */
gCPUStructure.Model += (gCPUStructure.Extmodel << 4);

/* get BrandString (if supported) */
Expand Down Expand Up @@ -710,7 +714,7 @@ void GetCPUProperties (void)
gCPUStructure.TSCFrequency = MultU64x32(gCPUStructure.CurrentSpeed, Mega); //MHz -> Hz
DBG("CurrentSpeed: %llu\n", DivU64x32(gCPUStructure.TSCFrequency, Mega));

switch (gCPUStructure.Family)
switch (gCPUStructure.Family + gCPUStructure.Extfamily)
{

//if(gCPUStructure.Extfamily == 0x00 /* K8 */)
Expand Down Expand Up @@ -1169,8 +1173,10 @@ void GetCPUProperties (void)
}
gCPUStructure.MaxSpeed = (UINT32)(DivU64x32(MultU64x64(gCPUStructure.FSBFrequency, gCPUStructure.MaxRatio), Mega * 10)); //kHz->MHz

// DBG("Vendor/Model/Stepping: 0x%X/0x%X/0x%X\n", gCPUStructure.Vendor, gCPUStructure.Model, gCPUStructure.Stepping);
// DBG("Family/ExtFamily: 0x%X/0x%X\n", gCPUStructure.Family, gCPUStructure.Extfamily);
#ifdef JIEF_DEBUG
DBG("Vendor=0x%X Model=0x%X Stepping: 0x%X\n", gCPUStructure.Vendor, gCPUStructure.Model, gCPUStructure.Stepping);
DBG("Family=0x%X ExtFamily=0x%X\n", gCPUStructure.Family, gCPUStructure.Extfamily);
#endif
DBG("MaxDiv/MinDiv: %d.%d/%d\n", gCPUStructure.MaxRatio/10, gCPUStructure.MaxRatio%10 , gCPUStructure.MinRatio/10);
DBG("Turbo: %d/%d/%d/%d\n", gCPUStructure.Turbo4/10, gCPUStructure.Turbo3/10, gCPUStructure.Turbo2/10, gCPUStructure.Turbo1/10);
DBG("Features: 0x%llX\n",gCPUStructure.Features);
Expand Down Expand Up @@ -1689,7 +1695,7 @@ void FillOCCpuInfo(OC_CPU_INFO* CpuInfo)
CpuInfo->Hypervisor = gSettings.CPU.QEMU;
CpuInfo->Type = (UINT8)gCPUStructure.Type;
CpuInfo->Family = (UINT8)gCPUStructure.Family;
CpuInfo->Model = (UINT8)gCPUStructure.Model;
CpuInfo->Model = (UINT8)gCPUStructure.Model - (gCPUStructure.Extmodel << 4);
CpuInfo->ExtModel = (UINT8)gCPUStructure.Extmodel;
CpuInfo->ExtFamily = (UINT8)gCPUStructure.Extfamily;
CpuInfo->Stepping = (UINT8)gCPUStructure.Stepping;
Expand Down
7 changes: 7 additions & 0 deletions rEFIt_UEFI/PlatformEFI/BootLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ static UINTN GetDebugLogFile()

if ( debugLogFileName.isEmpty() )
{
EFI_FILE_PROTOCOL *miscDirHandle;

Status = CloverDir.Open(&CloverDir, &miscDirHandle, L"misc", EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, EFI_FILE_DIRECTORY);
if ( !EFI_ERROR(Status) ) {
miscDirHandle->Close(miscDirHandle);
}

debugLogFileName = S8Printf("misc\\%04d-%02d-%02d_%02d-%02d_%ls.log", Now.Year, Now.Month, Now.Day, Now.Hour, Now.Minute, self.getCloverEfiFileNameOrNull().wc_str());
Status = CloverDir.Open(&CloverDir, &LogFile, debugLogFileName.wc_str(), EFI_FILE_MODE_READ, 0);
if ( !EFI_ERROR(Status) ) LogFile->Close(LogFile); // DO NOT modify Status here.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ class KernelAndKextPatches_Class : public XmlDict
}

const XString8& dgetName() const { return Name.isDefined() ? Name.value() : NullXString8; };
XString8 dgetLabel() const override { return Comment.isDefined() ? S8Printf("%s (%s)", Name.value().c_str(), Comment.value().c_str()) : S8Printf("%s (NoLabel)", Name.value().c_str()); };
// XString8 dgetLabel() const override { return Comment.isDefined() ? S8Printf("%s (%s)", Name.value().c_str(), Comment.value().c_str()) : S8Printf("%s (NoLabel)", Name.value().c_str()); };
XString8 dgetLabel() const override { return Comment.isDefined() ? Comment.value().c_str() : "NoLabel"_XS8; };
XBool dgetIsPlistPatch() const { return InfoPlistPatch.isDefined() ? InfoPlistPatch.value() : XBool(false); };

// override because of different defaultvalue
Expand Down
23 changes: 11 additions & 12 deletions rEFIt_UEFI/refit/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,11 +711,10 @@ size_t setKextAtPos(XObjArray<SIDELOAD_KEXT>* kextArrayPtr, const XString8& kext

for (size_t kextIdx = 0 ; kextIdx < kextArray.size() ; kextIdx++ ) {
if ( kextArray[kextIdx].FileName.contains(kextName) ) {
#ifdef JIEF_DEBUG
if ( pos >= kextArray.size() ) panic("pos >= kextArray.size()");
#else
//it is impossible
#endif
if ( pos >= kextArray.size() ) {
log_technical_bug("pos >= kextArray.size()");
return kextArray.size() - 1 ; // If we're here, kextArray.size() is at least 1
}
if ( pos == kextIdx ) return pos+1;
if ( pos > kextIdx ) pos -= 1;
SIDELOAD_KEXT* kextToMove = &kextArray[kextIdx];
Expand Down Expand Up @@ -829,16 +828,16 @@ void debugStartImageWithOC()
void LOADER_ENTRY::DelegateKernelPatches()
{
XObjArray<ABSTRACT_KEXT_OR_KERNEL_PATCH> selectedPathArray;
for (size_t kextPatchIdx = 0 ; kextPatchIdx < KernelAndKextPatches.KextPatches.size() ; kextPatchIdx++ )
{
if ( KernelAndKextPatches.KextPatches[kextPatchIdx].MenuItem.BValue )
selectedPathArray.AddReference(&KernelAndKextPatches.KextPatches[kextPatchIdx], false);
}
for (size_t kernelPatchIdx = 0 ; kernelPatchIdx < KernelAndKextPatches.KernelPatches.size() ; kernelPatchIdx++ )
{
if ( KernelAndKextPatches.KernelPatches[kernelPatchIdx].MenuItem.BValue )
selectedPathArray.AddReference(&KernelAndKextPatches.KernelPatches[kernelPatchIdx], false);
}
for (size_t kextPatchIdx = 0 ; kextPatchIdx < KernelAndKextPatches.KextPatches.size() ; kextPatchIdx++ )
{
if ( KernelAndKextPatches.KextPatches[kextPatchIdx].MenuItem.BValue )
selectedPathArray.AddReference(&KernelAndKextPatches.KextPatches[kextPatchIdx], false);
}
mOpenCoreConfiguration.Kernel.Patch.Count = (UINT32)selectedPathArray.size();
mOpenCoreConfiguration.Kernel.Patch.AllocCount = mOpenCoreConfiguration.Kernel.Patch.Count;
mOpenCoreConfiguration.Kernel.Patch.ValueSize = sizeof(__typeof_am__(**mOpenCoreConfiguration.Kernel.Patch.Values));
Expand Down Expand Up @@ -1193,14 +1192,14 @@ void LOADER_ENTRY::StartLoader()
size_t pos = setKextAtPos(&kextArray, "Lilu.kext"_XS8, 0);
pos = setKextAtPos(&kextArray, "VirtualSMC.kext"_XS8, pos);
pos = setKextAtPos(&kextArray, "FakeSMC.kext"_XS8, pos);
pos = setKextAtPos(&kextArray, "WhateverGreen.kext"_XS8, pos);
// pos = setKextAtPos(&kextArray, "vecLib.kext"_XS8, pos);
// pos = setKextAtPos(&kextArray, "IOAudioFamily.kext"_XS8, pos);
pos = setKextAtPos(&kextArray, "IOSkywalkFamily.kext"_XS8, pos);
pos = setKextAtPos(&kextArray, "FakePCIID.kext"_XS8, pos);
pos = setKextAtPos(&kextArray, "FakePCIID_XHCIMux.kext"_XS8, pos);
pos = setKextAtPos(&kextArray, "AMDRyzenCPUPowerManagement.kext"_XS8, pos);
pos = setKextAtPos(&kextArray, "SMCAMDProcessor.kext"_XS8, pos);
pos = setKextAtPos(&kextArray, "WhateverGreen.kext"_XS8, pos);
pos = setKextAtPos(&kextArray, "AppleALC.kext"_XS8, pos);
// pos = setKextAtPos(&kextArray, "IntelMausi.kext"_XS8, pos); // not needed special order?
pos = setKextAtPos(&kextArray, "SMCProcessor.kext"_XS8, pos);
Expand All @@ -1216,10 +1215,10 @@ void LOADER_ENTRY::StartLoader()
pos = setKextAtPos(&kextArray, "BrcmPatchRAM2.kext"_XS8, pos);
pos = setKextAtPos(&kextArray, "BrcmPatchRAM3.kext"_XS8, pos);
pos = setKextAtPos(&kextArray, "IO80211FamilyLegacy.kext"_XS8, pos);
pos = setKextAtPos(&kextArray, "AirPortBrcmNIC.kext"_XS8, pos);
pos = setKextAtPos(&kextArray, "HS80211Family.kext"_XS8, pos);
pos = setKextAtPos(&kextArray, "corecaptureElCap.kext"_XS8, pos);
pos = setKextAtPos(&kextArray, "IO80211ElCap.kext"_XS8, pos);
pos = setKextAtPos(&kextArray, "IO80211ElCap\\Contents\\Plugins\\AirPortAtheros40.kext"_XS8, pos);
pos = setKextAtPos(&kextArray, "AirPortAtheros40.kext"_XS8, pos);

for (size_t kextIdx = 0 ; kextIdx < kextArray.size() ; kextIdx++ ) {
Expand Down

0 comments on commit 7e3ffed

Please sign in to comment.