Restore correct loading order ConfigManager::LoadConfig().

This commit is contained in:
jief666 2021-07-01 18:03:15 +03:00
parent 57f8ce7cde
commit 4e995a05e3
3 changed files with 22 additions and 22 deletions

View File

@ -249,6 +249,7 @@ void EFIAPI MemLogCallback(IN INTN DebugMode, IN CHAR8 *LastMessage)
}
if ((DebugMode >= 1) && gSettings.Boot.DebugLog) {
SuspendMemLogCallback smc;
SaveMessageToDebugLogFile(LastMessage);
}
}

View File

@ -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)
@ -886,7 +886,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 +900,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;

View File

@ -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));
// DBG("SelfVolumeRootDir = %lld\n", uintptr_t(SelfVolumeRootDir));
#endif
// find the current directory
@ -69,8 +69,8 @@ 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());
// 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 +87,7 @@ 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());
// DBG("SelfDirPath = %ls\n", CloverDirFullPath.wc_str());
#endif
Status = SelfVolumeRootDir->Open(SelfVolumeRootDir, CloverDirPtr, CloverDirFullPath.wc_str(), EFI_FILE_MODE_READ, 0);
@ -96,8 +96,8 @@ 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));
// EFI_FILE* CloverDir = *CloverDirPtr;
// DBG("CloverDir = %lld\n", uintptr_t(CloverDir));
#endif
return EFI_SUCCESS;