mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-23 11:35:19 +01:00
Merge branch 'CloverHackyColor:master' into master
This commit is contained in:
commit
1e2fc06666
@ -141,8 +141,7 @@ void *GetNvramVariable(
|
||||
XString8 GetNvramVariableAsXString8(
|
||||
IN CONST CHAR16 *VariableName,
|
||||
IN EFI_GUID *VendorGuid,
|
||||
OUT UINT32 *Attributes OPTIONAL,
|
||||
OUT UINTN *DataSize OPTIONAL)
|
||||
OUT UINT32 *Attributes OPTIONAL)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
XString8 returnValue;
|
||||
@ -166,9 +165,6 @@ XString8 GetNvramVariableAsXString8(
|
||||
returnValue.setEmpty();
|
||||
}
|
||||
}
|
||||
if (DataSize != NULL) {
|
||||
*DataSize = IntDataSize;
|
||||
}
|
||||
returnValue.dataSized(IntDataSize+1)[IntDataSize] = 0;
|
||||
returnValue.updateSize();
|
||||
return returnValue;
|
||||
@ -334,6 +330,39 @@ IsDeletableVariable (
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef JIEF_DEBUG
|
||||
EFI_STATUS
|
||||
DumpNvram()
|
||||
{
|
||||
EFI_STATUS Status = EFI_NOT_FOUND;
|
||||
EFI_GUID Guid;
|
||||
XStringW Name = L""_XSW;
|
||||
UINTN Size;
|
||||
|
||||
DbgHeader("DumpNvram");
|
||||
|
||||
ZeroMem (&Guid, sizeof(Guid));
|
||||
|
||||
do {
|
||||
Size = Name.sizeInBytes();
|
||||
Status = gRT->GetNextVariableName(&Size, Name.dataSized(Size+1), &Guid);
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
Status = gRT->GetNextVariableName (&Size, Name.dataSized(Size+1), &Guid);
|
||||
}
|
||||
|
||||
if ( !EFI_ERROR(Status) ) {
|
||||
XString8 s = GetNvramVariableAsXString8(Name.wc_str(), &Guid, NULL);
|
||||
DBG("NVRAM : %s,%ls = '%s'\n", GuidLEToXString8(Guid).c_str(), Name.wc_str(), s.c_str());
|
||||
}else if ( Status != EFI_NOT_FOUND ) {
|
||||
DBG("GetNextVariableName returns '%s'\n", efiStrError(Status));
|
||||
break;
|
||||
}
|
||||
} while( Status != EFI_NOT_FOUND );
|
||||
return Status;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Reset Native NVRAM by vit9696, reworked and implemented by Sherlocks
|
||||
EFI_STATUS
|
||||
ResetNativeNvram ()
|
||||
|
@ -35,8 +35,7 @@ void
|
||||
XString8 GetNvramVariableAsXString8(
|
||||
IN CONST CHAR16 *VariableName,
|
||||
IN EFI_GUID *VendorGuid,
|
||||
OUT UINT32 *Attributes OPTIONAL,
|
||||
OUT UINTN *DataSize OPTIONAL
|
||||
OUT UINT32 *Attributes OPTIONAL
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
@ -119,4 +118,10 @@ RemoveStartupDiskVolume (void);
|
||||
UINT64
|
||||
GetEfiTimeInMs (IN EFI_TIME *T);
|
||||
|
||||
#ifdef JIEF_DEBUG
|
||||
EFI_STATUS DumpNvram();
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif /* PLATFORM_NVRAM_H_ */
|
||||
|
@ -79,7 +79,7 @@ static EFI_FILE_PROTOCOL* gLogFile = NULL;
|
||||
int g_OpeningLogFile = 0;
|
||||
|
||||
|
||||
// Avoid debug looping. TO be able to call DBG from inside function that DBG calls, we need to suspend callback to avoid a loop.
|
||||
// Avoid debug looping. To be able to call DBG from inside function that DBG calls, we need to suspend callback to avoid a loop.
|
||||
// Just instanciante this, the destructor will restore the callback.
|
||||
class SuspendMemLogCallback
|
||||
{
|
||||
@ -249,6 +249,7 @@ void EFIAPI MemLogCallback(IN INTN DebugMode, IN CHAR8 *LastMessage)
|
||||
}
|
||||
|
||||
if ((DebugMode >= 1) && gSettings.Boot.DebugLog) {
|
||||
SuspendMemLogCallback smc;
|
||||
SaveMessageToDebugLogFile(LastMessage);
|
||||
}
|
||||
}
|
||||
|
@ -548,7 +548,7 @@ return Status;
|
||||
}
|
||||
|
||||
/*
|
||||
* Load a plist into configPlist global object, "transfer" the settings into gSettings and call afterGetUserSettings()
|
||||
* Load a plist into configPlist global object
|
||||
* ConfName : name of the file, without .plist extension. File will be searched in OEM or main folder
|
||||
*/
|
||||
EFI_STATUS ConfigManager::LoadConfigPlist(const XStringW& ConfName)
|
||||
@ -559,7 +559,7 @@ EFI_STATUS ConfigManager::LoadConfigPlist(const XStringW& ConfName)
|
||||
}
|
||||
|
||||
/*
|
||||
* Load a plist into smbiosPlist global object, "transfer" the settings into gSettings and call afterGetUserSettings()
|
||||
* Load a plist into smbiosPlist global object
|
||||
* ConfName : name of the file, without .plist extension. File will be searched in OEM or main folder
|
||||
*/
|
||||
EFI_STATUS ConfigManager::LoadSMBIOSPlist(const XStringW& ConfName)
|
||||
@ -740,9 +740,6 @@ void ConfigManager::applySettings() const
|
||||
|
||||
}
|
||||
//gSettings.CPU.Turbo = gCPUStructure.Turbo;
|
||||
if (configPlist.CPU.dgetSavingMode() != 0xFF) { //means not set
|
||||
gSettings.CPU.SavingMode = configPlist.CPU.dgetSavingMode();
|
||||
}
|
||||
if ( gCPUStructure.Model >= CPU_MODEL_SKYLAKE_D )
|
||||
{
|
||||
if ( !configPlist.CPU.getUseARTFreq().isDefined() )
|
||||
@ -886,7 +883,7 @@ EFI_STATUS ConfigManager::LoadConfig(const XStringW& ConfName)
|
||||
EFI_STATUS Status = LoadConfigPlist(ConfName);
|
||||
if ( EFI_ERROR(Status) ) {
|
||||
DBG("LoadConfigPlist return %s. Config not loaded\n", efiStrError(Status));
|
||||
return Status;
|
||||
//return Status; // Let's try to continue with default values.
|
||||
}
|
||||
|
||||
/*Status = */ LoadSMBIOSPlist(L"smbios"_XSW); // we don't need Status. If not loaded correctly, smbiosPlist is !defined and will be ignored by AssignOldNewSettings()
|
||||
@ -900,19 +897,18 @@ EFI_STATUS ConfigManager::LoadConfig(const XStringW& ConfName)
|
||||
Model = GetDefaultModel();
|
||||
}
|
||||
|
||||
// if ( !EFI_ERROR(Status) ) {
|
||||
// gSettings.takeValueFrom(configPlist);
|
||||
// TODO improve this (avoid to delete settings to re-import them !)
|
||||
// restore default value for SMBIOS (delete values from configPlist)
|
||||
SetDMISettingsForModel(Model, &gSettings, &GlobalConfig);
|
||||
// import values from configPlist if they are defined
|
||||
FillSmbiosWithDefaultValue(Model, configPlist.getSMBIOS());
|
||||
if ( smbiosPlist.SMBIOS.isDefined() ) {
|
||||
// import values from smbiosPlist if they are defined
|
||||
FillSmbiosWithDefaultValue(Model, smbiosPlist.SMBIOS);
|
||||
}
|
||||
// }
|
||||
gSettings.takeValueFrom(configPlist);
|
||||
if ( !EFI_ERROR(Status) ) {
|
||||
gSettings.takeValueFrom(configPlist); // if load failed, keep default value.
|
||||
}
|
||||
// TODO improve this (avoid to delete settings to re-import them !)
|
||||
// restore default value for SMBIOS (delete values from configPlist)
|
||||
SetDMISettingsForModel(Model, &gSettings, &GlobalConfig);
|
||||
// import values from configPlist if they are defined
|
||||
FillSmbiosWithDefaultValue(Model, configPlist.getSMBIOS());
|
||||
if ( smbiosPlist.SMBIOS.isDefined() ) {
|
||||
// import values from smbiosPlist if they are defined
|
||||
FillSmbiosWithDefaultValue(Model, smbiosPlist.SMBIOS);
|
||||
}
|
||||
|
||||
applySettings();
|
||||
return Status;
|
||||
@ -1014,7 +1010,7 @@ EFI_STATUS ConfigManager::InitialisePlatform()
|
||||
|
||||
GetCPUProperties();
|
||||
DiscoverDevices();
|
||||
// GetMacAddress(&gConf.LanCardArrayNonConst);
|
||||
|
||||
//SavingMode
|
||||
|
||||
if ( g_SmbiosDiscoveredSettings.EnabledCores ) {
|
||||
@ -1026,45 +1022,13 @@ EFI_STATUS ConfigManager::InitialisePlatform()
|
||||
selfOem.initialize("config"_XS8, gFirmwareClover, GlobalConfig.OEMBoardFromSmbios, GlobalConfig.OEMProductFromSmbios, (INT32)(DivU64x32(gCPUStructure.CPUFrequency, Mega)), gConf.LanCardArray);
|
||||
Status = gConf.LoadConfig(L"config"_XSW);
|
||||
|
||||
GlobalConfig.C3Latency = gSettings.ACPI.SSDT._C3Latency;
|
||||
GlobalConfig.KPKernelPm = gSettings.KernelAndKextPatches._KPKernelPm;
|
||||
|
||||
for ( size_t idx = 0 ; idx < GfxPropertiesArrayNonConst.size() ; ++idx ) {
|
||||
GfxPropertiesArrayNonConst[idx].LoadVBios = gSettings.Graphics.LoadVBios;
|
||||
}
|
||||
|
||||
// /* populate GfxPropertiesArrayNonConst */
|
||||
// GfxPropertiesArrayNonConst.setEmpty();
|
||||
// for ( size_t idx = 0 ; idx < m_Discoverer.GfxPropertiesArray.size() ; ++idx ) {
|
||||
// GfxProperties* gfx = new GfxProperties;
|
||||
// *gfx = GfxPropertiesArray[idx];
|
||||
// (*gfx).LoadVBios = gSettings.Graphics.LoadVBios;
|
||||
// GfxPropertiesArrayNonConst.AddReference(gfx, true);
|
||||
// }
|
||||
//
|
||||
// /* populate HdaPropertiesArrayNonConst */
|
||||
// HdaPropertiesArrayNonConst.setEmpty();
|
||||
// for ( size_t idx = 0 ; idx < m_Discoverer.HdaPropertiesArray.size() ; ++idx ) {
|
||||
// HdaProperties* hda = new HdaProperties;
|
||||
// *hda = HdaPropertiesArray[idx];
|
||||
// HdaPropertiesArrayNonConst.AddReference(hda, true);
|
||||
// }
|
||||
//
|
||||
// /* populate LanCardArrayNonConst */
|
||||
// LanCardArrayNonConst.setEmpty();
|
||||
// GetUEFIMacAddress();
|
||||
//// if ( LanCardArrayNonConst.size() == 0 /*&& gSettings.RtVariables.GetLegacyLanAddress()*/ ) {
|
||||
// for ( size_t idx = 0 ; idx < m_Discoverer.LanCardArray.size() ; ++idx ) {
|
||||
// if ( !LanCardArrayNonConst.containsMacAddress(m_Discoverer.LanCardArray[idx].Mac)) {
|
||||
// LanCardClass* lan = new LanCardClass;
|
||||
// memcpy(&lan->MacAddress, m_Discoverer.LanCardArray[idx].Mac, sizeof(lan->MacAddress));
|
||||
// LanCardArrayNonConst.AddReference(lan, true);
|
||||
// }
|
||||
// }
|
||||
//// }
|
||||
|
||||
// // Why this overrides ? Should we remove the setting from config.plist ?
|
||||
// gSettings.GUI.Mouse.PointerEnabled = TRUE;
|
||||
// gSettings.GUI.Mouse.PointerSpeed = 2;
|
||||
// gSettings.GUI.Mouse.DoubleClickTime = 500; //TODO - make it constant as nobody change it
|
||||
|
||||
if (gSettings.Devices.Audio.ResetHDA) ResetHDA();
|
||||
|
||||
#ifdef ENABLE_SECURE_BOOT
|
||||
|
@ -21,7 +21,7 @@
|
||||
#define DBG(...) DebugLog(DEBUG_SELF, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
EFI_STATUS Self::__initialize(EFI_HANDLE SelfImageHandle, EFI_LOADED_IMAGE** SelfLoadedImagePtr, EFI_SIMPLE_FILE_SYSTEM_PROTOCOL** SelfSimpleVolumePtr, EFI_FILE** SelfVolumeRootDirPtr, XStringW* CloverDirFullPathPtr, XStringW* efiFileNamePtr, EFI_FILE** CloverDirPtr)
|
||||
EFI_STATUS Self::__initialize(bool debugMsg, EFI_HANDLE SelfImageHandle, EFI_LOADED_IMAGE** SelfLoadedImagePtr, EFI_SIMPLE_FILE_SYSTEM_PROTOCOL** SelfSimpleVolumePtr, EFI_FILE** SelfVolumeRootDirPtr, XStringW* CloverDirFullPathPtr, XStringW* efiFileNamePtr, EFI_FILE** CloverDirPtr)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
@ -51,7 +51,7 @@ EFI_STATUS Self::__initialize(EFI_HANDLE SelfImageHandle, EFI_LOADED_IMAGE** Sel
|
||||
EFI_FILE* SelfVolumeRootDir = *SelfVolumeRootDirPtr;
|
||||
|
||||
#ifdef JIEF_DEBUG
|
||||
DBG("SelfVolumeRootDir = %lld\n", uintptr_t(SelfVolumeRootDir));
|
||||
if ( debugMsg ) DBG("SelfVolumeRootDir = %lld\n", uintptr_t(SelfVolumeRootDir));
|
||||
#endif
|
||||
|
||||
// find the current directory
|
||||
@ -69,8 +69,10 @@ EFI_STATUS Self::__initialize(EFI_HANDLE SelfImageHandle, EFI_LOADED_IMAGE** Sel
|
||||
|
||||
*efiFileNamePtr = CloverDirFullPath.basename();
|
||||
#ifdef JIEF_DEBUG
|
||||
XStringW& efiFileName = *efiFileNamePtr;
|
||||
DBG("efiFileName=%ls\n", efiFileName.wc_str());
|
||||
if ( debugMsg ) {
|
||||
XStringW& efiFileName = *efiFileNamePtr;
|
||||
DBG("efiFileName=%ls\n", efiFileName.wc_str());
|
||||
}
|
||||
#endif
|
||||
|
||||
// History : if this Clover was started as BootX64.efi, redirect to /EFI/CLOVER
|
||||
@ -87,7 +89,9 @@ EFI_STATUS Self::__initialize(EFI_HANDLE SelfImageHandle, EFI_LOADED_IMAGE** Sel
|
||||
if ( i != SIZE_T_MAX && i > 0 ) CloverDirFullPath.deleteCharsAtPos(i, SIZE_T_MAX); // keep getCloverDir() in sync !
|
||||
|
||||
#ifdef JIEF_DEBUG
|
||||
DBG("SelfDirPath = %ls\n", CloverDirFullPath.wc_str());
|
||||
if ( debugMsg ) {
|
||||
DBG("SelfDirPath = %ls\n", CloverDirFullPath.wc_str());
|
||||
}
|
||||
#endif
|
||||
|
||||
Status = SelfVolumeRootDir->Open(SelfVolumeRootDir, CloverDirPtr, CloverDirFullPath.wc_str(), EFI_FILE_MODE_READ, 0);
|
||||
@ -96,8 +100,10 @@ EFI_STATUS Self::__initialize(EFI_HANDLE SelfImageHandle, EFI_LOADED_IMAGE** Sel
|
||||
return RETURN_LOAD_ERROR;
|
||||
}
|
||||
#ifdef JIEF_DEBUG
|
||||
EFI_FILE* CloverDir = *CloverDirPtr;
|
||||
DBG("CloverDir = %lld\n", uintptr_t(CloverDir));
|
||||
if ( debugMsg ) {
|
||||
EFI_FILE* CloverDir = *CloverDirPtr;
|
||||
DBG("CloverDir = %lld\n", uintptr_t(CloverDir));
|
||||
}
|
||||
#endif
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@ -111,7 +117,7 @@ const EFI_FILE_PROTOCOL* Self::getCloverDirAndEfiFileName(EFI_HANDLE ImageHandle
|
||||
XStringW CloverDirFullPath; // full path of folder containing this efi.
|
||||
EFI_FILE* CloverDir; // opened folder containing this efi
|
||||
|
||||
/*EFI_STATUS Status = */__initialize(ImageHandle, &SelfLoadedImage, &SelfSimpleVolume, &SelfVolumeRootDir, &CloverDirFullPath, efiFileName, &CloverDir);
|
||||
/*EFI_STATUS Status = */__initialize(false, ImageHandle, &SelfLoadedImage, &SelfSimpleVolume, &SelfVolumeRootDir, &CloverDirFullPath, efiFileName, &CloverDir);
|
||||
if ( efiFileName->isEmpty() ) {
|
||||
if ( CloverDir != NULL ) CloverDir->Close(CloverDir);
|
||||
return NULL;
|
||||
@ -143,7 +149,7 @@ EFI_STATUS Self::_initialize()
|
||||
{
|
||||
// EFI_STATUS Status;
|
||||
|
||||
/*Status = */__initialize(m_SelfImageHandle, &m_SelfLoadedImage, &m_SelfSimpleVolume, &m_SelfVolumeRootDir, &m_CloverDirFullPath, &m_efiFileName, &m_CloverDir);
|
||||
/*Status = */__initialize(true, m_SelfImageHandle, &m_SelfLoadedImage, &m_SelfSimpleVolume, &m_SelfVolumeRootDir, &m_CloverDirFullPath, &m_efiFileName, &m_CloverDir);
|
||||
if ( m_SelfLoadedImage == NULL ) log_technical_bug("Cannot get SelfLoadedImage");
|
||||
if ( m_SelfLoadedImage->DeviceHandle == NULL ) log_technical_bug("m_SelfLoadedImage->DeviceHandle == NULL");
|
||||
if ( m_SelfSimpleVolume == NULL ) log_technical_bug("Cannot get m_SelfSimpleVolume");
|
||||
|
@ -20,7 +20,7 @@ class Self
|
||||
{
|
||||
// Class method, usable even without any instance of Self.
|
||||
protected:
|
||||
static EFI_STATUS __initialize(EFI_HANDLE m_SelfImageHandle, EFI_LOADED_IMAGE** m_SelfLoadedImage, EFI_SIMPLE_FILE_SYSTEM_PROTOCOL** m_SelfSimpleVolumePtr, EFI_FILE** m_SelfVolumeRootDirPtr, XStringW* m_CloverDirFullPathPtr, XStringW* m_efiFileNamePtr, EFI_FILE** m_CloverDirPtr);
|
||||
static EFI_STATUS __initialize(bool debugMsg, EFI_HANDLE m_SelfImageHandle, EFI_LOADED_IMAGE** m_SelfLoadedImage, EFI_SIMPLE_FILE_SYSTEM_PROTOCOL** m_SelfSimpleVolumePtr, EFI_FILE** m_SelfVolumeRootDirPtr, XStringW* m_CloverDirFullPathPtr, XStringW* m_efiFileNamePtr, EFI_FILE** m_CloverDirPtr);
|
||||
public:
|
||||
static const EFI_FILE_PROTOCOL* getCloverDirAndEfiFileName(EFI_HANDLE ImageHandle, XStringW* efiFileName);
|
||||
|
||||
|
@ -921,7 +921,7 @@ public:
|
||||
}
|
||||
void updateSize() {
|
||||
#ifdef XSTRING_CACHING_OF_SIZE
|
||||
super::__m_size = 0;
|
||||
super::__m_size = 0; // Jief, TODO
|
||||
#endif
|
||||
}
|
||||
//
|
||||
|
@ -2878,6 +2878,11 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
|
||||
gConf.InitialisePlatform();
|
||||
// DBG("5: GlobalConfig.C3Latency=%x\n", GlobalConfig.C3Latency);
|
||||
|
||||
#ifdef JIEF_DEBUG
|
||||
DumpNvram();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* saving debug.log works from here
|
||||
*/
|
||||
@ -2955,8 +2960,6 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
GetListOfConfigs();
|
||||
}
|
||||
// DBG("0: GlobalConfig.C3Latency=%x\n", gSettings.ACPI.SSDT._C3Latency);
|
||||
GlobalConfig.C3Latency = gSettings.ACPI.SSDT._C3Latency;
|
||||
GlobalConfig.KPKernelPm = gSettings.KernelAndKextPatches._KPKernelPm;
|
||||
// DBG("0: gSettings.CPU.SavingMode=%x\n", gSettings.CPU.SavingMode);
|
||||
// ThemeX.FillByEmbedded(); //init XTheme before EarlyUserSettings
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user