mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-12-24 16:27:42 +01:00
Fix DellSmbiosPatch.
This commit is contained in:
parent
914d505aa0
commit
f28e8a2244
@ -537,6 +537,8 @@ SetupDataForOSX(BOOLEAN Hibernate)
|
|||||||
// all current settings
|
// all current settings
|
||||||
XBuffer<UINT8> xb = gSettings.serialize();
|
XBuffer<UINT8> xb = gSettings.serialize();
|
||||||
LogDataHub(&gEfiMiscSubClassGuid, L"Settings", xb.data(), (UINT32)xb.size());
|
LogDataHub(&gEfiMiscSubClassGuid, L"Settings", xb.data(), (UINT32)xb.size());
|
||||||
|
}else{
|
||||||
|
MsgLog("DataHub protocol not located. Smbios not send to datahub\n");
|
||||||
}
|
}
|
||||||
if (!gAppleSmc) {
|
if (!gAppleSmc) {
|
||||||
return;
|
return;
|
||||||
|
@ -65,7 +65,21 @@ UINTN SearchAndReplace(UINT8 *Source, UINT64 SourceSize, const UINT8 *Search, UI
|
|||||||
while ((Source < End) && (NoReplacesRestriction || (MaxReplaces > 0))) {
|
while ((Source < End) && (NoReplacesRestriction || (MaxReplaces > 0))) {
|
||||||
if (CompareMem(Source, Search, SearchSize) == 0) {
|
if (CompareMem(Source, Search, SearchSize) == 0) {
|
||||||
// printf(" found pattern at %llx\n", (UINTN)(Source - Begin));
|
// printf(" found pattern at %llx\n", (UINTN)(Source - Begin));
|
||||||
|
|
||||||
|
DBG("Replace " );
|
||||||
|
for (UINTN Index = 0; Index < SearchSize; ++Index) {
|
||||||
|
DBG("%02X", Search[Index]);
|
||||||
|
}
|
||||||
|
DBG(" by " );
|
||||||
|
|
||||||
|
|
||||||
CopyMem(Source, Replace, SearchSize);
|
CopyMem(Source, Replace, SearchSize);
|
||||||
|
|
||||||
|
|
||||||
|
for (UINTN Index = 0; Index < SearchSize; ++Index) {
|
||||||
|
DBG("%02X", Replace[Index]);
|
||||||
|
}
|
||||||
|
|
||||||
NumReplaces++;
|
NumReplaces++;
|
||||||
MaxReplaces--;
|
MaxReplaces--;
|
||||||
Source += SearchSize;
|
Source += SearchSize;
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "../gui/menu_items/menu_items.h"
|
#include "../gui/menu_items/menu_items.h"
|
||||||
#include "../Platform/plist/plist.h"
|
#include "../Platform/plist/plist.h"
|
||||||
|
#include "../Platform/guid.h"
|
||||||
#include "MacOsVersion.h"
|
#include "MacOsVersion.h"
|
||||||
|
|
||||||
//// SysVariables
|
//// SysVariables
|
||||||
@ -647,12 +648,15 @@ public:
|
|||||||
|
|
||||||
const XString8& getUUID();
|
const XString8& getUUID();
|
||||||
const XString8& getUUID(EFI_GUID* efiGuid);
|
const XString8& getUUID(EFI_GUID* efiGuid);
|
||||||
|
// If CustomUuid is defined, return false by default
|
||||||
|
// If SmUUID is defined, return true by default.
|
||||||
bool ShouldInjectSystemID() {
|
bool ShouldInjectSystemID() {
|
||||||
if ( CustomUuid.notEmpty() ){
|
if ( CustomUuid.notEmpty() && CustomUuid != nullGuid ) {
|
||||||
if ( InjectSystemID_ == 2 ) return false;
|
if ( InjectSystemID_ == 2 ) return false;
|
||||||
else return InjectSystemID_;
|
else return InjectSystemID_;
|
||||||
}
|
}
|
||||||
if ( SmUUID.notEmpty() && InjectSystemID_ == 2 ) return false;
|
if ( SmUUID.isEmpty() || SmUUID == nullGuid ) return false;
|
||||||
|
if ( InjectSystemID_ == 2 ) return true;
|
||||||
return InjectSystemID_;
|
return InjectSystemID_;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -337,6 +337,7 @@ EFI_STATUS UpdateSmbiosString(OUT APPLE_SMBIOS_STRUCTURE_POINTER SmbiosTableN,
|
|||||||
*C2 = 0;
|
*C2 = 0;
|
||||||
*(--C2) = 0; //end of table
|
*(--C2) = 0; //end of table
|
||||||
}
|
}
|
||||||
|
//DBG("UpdateSmbiosString() -> CopyMem %s %lld\n", Buffer.c_str(), BLength);
|
||||||
CopyMem(AString, Buffer.c_str(), BLength);
|
CopyMem(AString, Buffer.c_str(), BLength);
|
||||||
*(AString + BLength) = 0; // not sure there is 0
|
*(AString + BLength) = 0; // not sure there is 0
|
||||||
|
|
||||||
@ -2165,8 +2166,36 @@ void FinalizeSmbios() //continue
|
|||||||
SmbiosEpsNew->IntermediateChecksum = (UINT8)(256 - Checksum8((UINT8*)SmbiosEpsNew + 0x10, SmbiosEpsNew->EntryPointLength - 0x10));
|
SmbiosEpsNew->IntermediateChecksum = (UINT8)(256 - Checksum8((UINT8*)SmbiosEpsNew + 0x10, SmbiosEpsNew->EntryPointLength - 0x10));
|
||||||
SmbiosEpsNew->EntryPointStructureChecksum = 0;
|
SmbiosEpsNew->EntryPointStructureChecksum = 0;
|
||||||
SmbiosEpsNew->EntryPointStructureChecksum = (UINT8)(256 - Checksum8((UINT8*)SmbiosEpsNew, SmbiosEpsNew->EntryPointLength));
|
SmbiosEpsNew->EntryPointStructureChecksum = (UINT8)(256 - Checksum8((UINT8*)SmbiosEpsNew, SmbiosEpsNew->EntryPointLength));
|
||||||
// DBG("SmbiosEpsNew->EntryPointLength = %d\n", SmbiosEpsNew->EntryPointLength);
|
//DBG("SmbiosEpsNew->TableLength = %d\n", SmbiosEpsNew->TableLength);
|
||||||
// DBG("DMI checksum = %d\n", Checksum8((UINT8*)SmbiosEpsNew, SmbiosEpsNew->EntryPointLength));
|
//DBG("SmbiosEpsNew->EntryPointLength = %d\n", SmbiosEpsNew->EntryPointLength);
|
||||||
|
//DBG("SmbiosEpsNew->MaxStructureSize = %d\n", SmbiosEpsNew->MaxStructureSize);
|
||||||
|
//DBG("DMI checksum = %d\n", Checksum8((UINT8*)SmbiosEpsNew, SmbiosEpsNew->EntryPointLength));
|
||||||
|
//XString8 tmpDbg;
|
||||||
|
//XString8 tmptmpDbg;
|
||||||
|
//tmpDbg.dataSized(SmbiosEpsNew->TableLength*3+5*SmbiosEpsNew->TableLength/32+128);
|
||||||
|
//for ( size_t i = 0 ; i < SmbiosEpsNew->TableLength ; ) {
|
||||||
|
// size_t j;
|
||||||
|
// for ( j = 0 ; j < SmbiosEpsNew->TableLength && j < 32 ; j++ ) {
|
||||||
|
//// DBG("%02x ", ((UINT8*)(SmbiosEpsNew+1))[i+j] );
|
||||||
|
// tmptmpDbg.S8Printf("%02x ", ((UINT8*)(SmbiosEpsNew+1))[i+j] );
|
||||||
|
// tmpDbg.strcat(tmptmpDbg);
|
||||||
|
// }
|
||||||
|
//// DBG(" - ");
|
||||||
|
// tmptmpDbg.S8Printf(" - ");
|
||||||
|
// tmpDbg.strcat(tmptmpDbg);
|
||||||
|
// for ( j = 0 ; j < SmbiosEpsNew->TableLength && j < 32 ; j++ ) {
|
||||||
|
// UINT8 c = ((UINT8*)(SmbiosEpsNew+1))[i+j];
|
||||||
|
//// DBG("%c ", c > 32 ? c : '.');
|
||||||
|
// tmptmpDbg.S8Printf("%c", c > 32 ? c : '.');
|
||||||
|
// tmpDbg.strcat(tmptmpDbg);
|
||||||
|
// }
|
||||||
|
//// DBG("\n");
|
||||||
|
// tmptmpDbg.S8Printf("\n");
|
||||||
|
// tmpDbg.strcat(tmptmpDbg);
|
||||||
|
// i += j;
|
||||||
|
//}
|
||||||
|
//DBG("%s", tmpDbg.c_str());
|
||||||
|
//auto foo = SmbiosEpsNew;
|
||||||
|
|
||||||
//
|
//
|
||||||
// syscl: one more step: check if we need remap SMBIOS Table Type 1 Guid
|
// syscl: one more step: check if we need remap SMBIOS Table Type 1 Guid
|
||||||
|
@ -80,9 +80,13 @@
|
|||||||
|
|
||||||
|
|
||||||
#ifndef DEBUG_ALL
|
#ifndef DEBUG_ALL
|
||||||
#define DEBUG_MAIN 1
|
# ifdef DEBUG_ERALY_CRASH
|
||||||
|
# define DEBUG_MAIN 2
|
||||||
|
# else
|
||||||
|
# define DEBUG_MAIN 1
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
#define DEBUG_MAIN DEBUG_ALL
|
# define DEBUG_MAIN DEBUG_ALL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if DEBUG_MAIN == 0
|
#if DEBUG_MAIN == 0
|
||||||
@ -698,6 +702,7 @@ void LOADER_ENTRY::DelegateKernelPatches()
|
|||||||
mOpenCoreConfiguration.Kernel.Patch.ValueSize = sizeof(__typeof_am__(**mOpenCoreConfiguration.Kernel.Patch.Values));
|
mOpenCoreConfiguration.Kernel.Patch.ValueSize = sizeof(__typeof_am__(**mOpenCoreConfiguration.Kernel.Patch.Values));
|
||||||
mOpenCoreConfiguration.Kernel.Patch.Values = (__typeof_am__(*mOpenCoreConfiguration.Kernel.Patch.Values)*)malloc(mOpenCoreConfiguration.Kernel.Patch.AllocCount*sizeof(__typeof_am__(*mOpenCoreConfiguration.Kernel.Patch.Values)));
|
mOpenCoreConfiguration.Kernel.Patch.Values = (__typeof_am__(*mOpenCoreConfiguration.Kernel.Patch.Values)*)malloc(mOpenCoreConfiguration.Kernel.Patch.AllocCount*sizeof(__typeof_am__(*mOpenCoreConfiguration.Kernel.Patch.Values)));
|
||||||
memset(mOpenCoreConfiguration.Kernel.Patch.Values, 0, mOpenCoreConfiguration.Kernel.Patch.AllocCount*sizeof(*mOpenCoreConfiguration.Kernel.Patch.Values));
|
memset(mOpenCoreConfiguration.Kernel.Patch.Values, 0, mOpenCoreConfiguration.Kernel.Patch.AllocCount*sizeof(*mOpenCoreConfiguration.Kernel.Patch.Values));
|
||||||
|
|
||||||
for (size_t kextPatchIdx = 0 ; kextPatchIdx < selectedPathArray.size() ; kextPatchIdx++ )
|
for (size_t kextPatchIdx = 0 ; kextPatchIdx < selectedPathArray.size() ; kextPatchIdx++ )
|
||||||
{
|
{
|
||||||
const KEXT_PATCH& kextPatch = selectedPathArray[kextPatchIdx]; //as well as kernel patches
|
const KEXT_PATCH& kextPatch = selectedPathArray[kextPatchIdx]; //as well as kernel patches
|
||||||
@ -1108,9 +1113,7 @@ DBG("Beginning OC\n");
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef USE_OC_SECTION_PlatformInfo
|
#ifndef USE_OC_SECTION_PlatformInfo
|
||||||
// This is not read by Clover and should always be false. Which is what need if Clover takes care of SmBios
|
mOpenCoreConfiguration.Kernel.Quirks.CustomSmbiosGuid = gSettings.KernelAndKextPatches.KPDELLSMBIOS;
|
||||||
// If SmBios should be delegated to OC, this setting should initialised depending of SMUUID and InjectSystemID, I suppose
|
|
||||||
mOpenCoreConfiguration.Kernel.Quirks.CustomSmbiosGuid = false; //already done by CLover.
|
|
||||||
#endif
|
#endif
|
||||||
mOpenCoreConfiguration.Uefi.Output.ProvideConsoleGop = gSettings.ProvideConsoleGop;
|
mOpenCoreConfiguration.Uefi.Output.ProvideConsoleGop = gSettings.ProvideConsoleGop;
|
||||||
OC_STRING_ASSIGN(mOpenCoreConfiguration.Uefi.Output.Resolution, XString8(GlobalConfig.ScreenResolution).c_str());
|
OC_STRING_ASSIGN(mOpenCoreConfiguration.Uefi.Output.Resolution, XString8(GlobalConfig.ScreenResolution).c_str());
|
||||||
@ -2348,6 +2351,11 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
|||||||
|
|
||||||
ConsoleInHandle = SystemTable->ConsoleInHandle;
|
ConsoleInHandle = SystemTable->ConsoleInHandle;
|
||||||
|
|
||||||
|
#ifdef DEBUG_ERALY_CRASH
|
||||||
|
SystemTable->ConOut->OutputString(SystemTable->ConOut, L"Start");
|
||||||
|
PauseForKey(L"1) press any key\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_ON_SERIAL_PORT
|
#ifdef DEBUG_ON_SERIAL_PORT
|
||||||
SerialPortInitialize();
|
SerialPortInitialize();
|
||||||
#endif
|
#endif
|
||||||
@ -2623,6 +2631,10 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
|||||||
gEmuVariableControl->InstallEmulation(gEmuVariableControl);
|
gEmuVariableControl->InstallEmulation(gEmuVariableControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG_ERALY_CRASH
|
||||||
|
PauseForKey(L"2) press any key\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
DbgHeader("InitScreen");
|
DbgHeader("InitScreen");
|
||||||
|
|
||||||
if (!GlobalConfig.FastBoot) {
|
if (!GlobalConfig.FastBoot) {
|
||||||
|
Loading…
Reference in New Issue
Block a user