move self initialisation up

Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
SergeySlice 2021-03-21 17:08:47 +03:00
parent 977f3e2e72
commit c93da72714
4 changed files with 24 additions and 14 deletions

View File

@ -75,7 +75,7 @@ then
./qemu_portable/qemu-system-x86_64 \
-L qemu_portable \
-m 2048 \
-cpu core2duo \
-cpu Penryn \
-bios ./bios.bin-1.13.0 \
-machine q35 \
-device ahci,id=ahi \

View File

@ -208,12 +208,6 @@ static UINTN GetDebugLogFile()
EFI_FILE_PROTOCOL *RootDir;
EFI_FILE_PROTOCOL *LogFile;
EFI_TIME Now;
Status = gRT->GetTime(&Now, NULL);
if ( debugLogFileName.isEmpty() ) {
debugLogFileName = S8Printf("misc\\%d-%d-%d_%d-%d_%ls.log", Now.Year, Now.Month, Now.Day, Now.Hour, Now.Minute, self.getCloverEfiFileName().wc_str());
}
// get RootDir from device we are loaded from
Status = gBS->HandleProtocol(gImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &LoadedImage);
if (EFI_ERROR(Status)) {
@ -386,12 +380,29 @@ void EFIAPI DebugLog(IN INTN DebugMode, IN CONST CHAR8 *FormatString, ...)
MemLogfVA(TRUE, DebugMode, FormatString, Marker);
VA_END(Marker);
}
#if NEW_LOG
void InitBooterLog(void)
{
SetMemLogCallback(MemLogCallback);
}
#else
void InitBooterLog(void)
{
EFI_TIME Now;
EFI_STATUS Status;
Status = gRT->GetTime(&Now, NULL);
if (!EFI_ERROR(Status)) {
debugLogFileName = SWPrintf("misc\\%d-%d-%d_%d-%d-%d_%ls.log", Now.Year, Now.Month, Now.Day, Now.Hour, Now.Minute, Now.Second, self.getCloverEfiFileName().wc_str());
} else {
debugLogFileName = L"misc\\debug.log"_XSW;
}
SetMemLogCallback(MemLogCallback);
}
#endif
EFI_STATUS SetupBooterLog(BOOLEAN AllowGrownSize)
{
EFI_STATUS Status = EFI_SUCCESS;
@ -434,7 +445,6 @@ EFI_STATUS SaveBooterLog(const EFI_FILE* BaseDir OPTIONAL, IN CONST CHAR16 *File
return egSaveFile(BaseDir, FileName, (UINT8*)MemLogBuffer, MemLogLen);
}
void DbgHeader(CONST CHAR8 *str)
{
CHAR8 strLog[50];

View File

@ -1008,7 +1008,7 @@ void LOADER_ENTRY::AddDefaultMenu()
}
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
// SubScreen->AddMenuEntry(&MenuEntryReturn, false); //one-way ticket to avoid confusion
// DBG(" Added '%ls': OSType='%d', OSVersion='%s'\n",Title,LoaderType,OSVersion);
}

View File

@ -2714,6 +2714,10 @@ RefitMain (IN EFI_HANDLE ImageHandle,
gRT->GetTime(&Now, NULL);
Status = InitRefitLib(gImageHandle);
if (EFI_ERROR(Status))
return Status;
// firmware detection
gFirmwareClover = StrCmp(gST->FirmwareVendor, L"CLOVER") == 0;
if (!gFirmwareRevision) {
@ -2740,10 +2744,6 @@ RefitMain (IN EFI_HANDLE ImageHandle,
Status = InitRefitLib(gImageHandle);
if (EFI_ERROR(Status))
return Status;
//dumping SETTING structure
// if you change something in Platform.h, please uncomment and test that all offsets
// are natural aligned i.e. pointers are 8 bytes aligned