From 072a0a5d26a2064561840ef1ef7ce976fdc200f9 Mon Sep 17 00:00:00 2001 From: SergeySlice Date: Sun, 28 Mar 2021 17:02:56 +0300 Subject: [PATCH] DebugMode is not same for DBG() check AudioList is empty Signed-off-by: SergeySlice --- Clover.dsc | 1 + Library/MemLogLibDefault/MemLogLib.c | 13 +++++++++---- rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp | 17 +++++++++++------ rEFIt_UEFI/include/Efi.h | 1 + rEFIt_UEFI/refit/main.cpp | 9 ++++++--- 5 files changed, 28 insertions(+), 13 deletions(-) diff --git a/Clover.dsc b/Clover.dsc index c38b12f68..e39f57fde 100644 --- a/Clover.dsc +++ b/Clover.dsc @@ -167,6 +167,7 @@ # Our libs # MemLogLib|Library/MemLogLibDefault/MemLogLibDefault.inf + VideoBiosPatchLib|Library/VideoBiosPatchLib/VideoBiosPatchLib.inf WaveLib|Library/WaveLib/WaveLib.inf HdaDevicesLib|Library/HdaDevicesLib/HdaDevicesLib.inf diff --git a/Library/MemLogLibDefault/MemLogLib.c b/Library/MemLogLibDefault/MemLogLib.c index 80eb706bf..eef1f2d4f 100644 --- a/Library/MemLogLibDefault/MemLogLib.c +++ b/Library/MemLogLibDefault/MemLogLib.c @@ -541,20 +541,25 @@ MemLogfVA ( #else vprintf_with_callback_timestamp_emitcr(Format, Marker, transmitS8Printf, NULL, &printfNewline, Timing, 1); #endif + +#ifdef DEBUG_ON_SERIAL_PORT size_t DataWritten = mMemLog->Cursor - mMemLog->Buffer - LastMessage; - +#endif // // Check driver debug mask value and global mask // - if ((DebugMode & GetDebugPrintErrorLevel ()) == 0) { - return; - } +// DebugMode is not same as PrintErrorLevel +// if ((DebugMode & GetDebugPrintErrorLevel ()) == 0) { +// return; +// } // // Write to standard debug device also // // Jief : use SerialPortWrite instead of DebugPrint to avoid 256 chars message length limitation. // Jief : do this before CallBack to preserve order of messages sent from inside callback. +#ifdef DEBUG_ON_SERIAL_PORT SerialPortWrite((UINT8*)(mMemLog->Buffer + LastMessage), DataWritten); +#endif // DebugPrint(DEBUG_INFO, "%a", LastMessage); // diff --git a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp index 26cc3e014..234728a7c 100644 --- a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp +++ b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp @@ -961,17 +961,22 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN OUT INTN *DefaultEntryIndex, OUT REFI break; */ case SCAN_F7: +// DBG("scan_f7\n"); + if (AudioList.isEmpty()) break; +// DBG("not empty\n"); if (OldChosenAudio >= AudioList.size()) { OldChosenAudio = 0; //security correction } - Status = gBS->HandleProtocol(AudioList[OldChosenAudio].Handle, &gEfiAudioIoProtocolGuid, (void**)&AudioIo); - DBG("open %llu audio handle status=%s\n", OldChosenAudio, efiStrError(Status)); - if (!EFI_ERROR(Status)) { - StartupSoundPlay(&self.getCloverDir(), NULL); //play embedded sound - } +// DBG("OldChosenAudio=%llu\n", OldChosenAudio); + Status = gBS->HandleProtocol(AudioList[OldChosenAudio].Handle, &gEfiAudioIoProtocolGuid, (void**)&AudioIo); + DBG("open %llu audio handle status=%s\n", OldChosenAudio, efiStrError(Status)); + if (!EFI_ERROR(Status)) { + StartupSoundPlay(&self.getCloverDir(), NULL); //play embedded sound + } + break; case SCAN_F8: - // testSVG(); + testSVG(); SaveHdaDumpBin(); SaveHdaDumpTxt(); break; diff --git a/rEFIt_UEFI/include/Efi.h b/rEFIt_UEFI/include/Efi.h index 58e9de281..f7d5cfadb 100644 --- a/rEFIt_UEFI/include/Efi.h +++ b/rEFIt_UEFI/include/Efi.h @@ -35,6 +35,7 @@ extern "C" { #include #include #include +#include #include #include #include diff --git a/rEFIt_UEFI/refit/main.cpp b/rEFIt_UEFI/refit/main.cpp index 166b8d2af..ddeae4a53 100644 --- a/rEFIt_UEFI/refit/main.cpp +++ b/rEFIt_UEFI/refit/main.cpp @@ -2808,8 +2808,11 @@ RefitMain (IN EFI_HANDLE ImageHandle, // XString8 msg = S8Printf("CloverX64 : Image base = 0x%llX\n", (uintptr_t)LoadedImage->ImageBase); // do not change, it's used by grep to feed the debugger // SerialPortWrite((UINT8*)msg.c_str(), msg.length()); // } - if ( !EFI_ERROR(Status) ) DBG("CloverX64 : Image base = 0x%llX\n", (uintptr_t)LoadedImage->ImageBase); // do not change, it's used by grep to feed the debugger - + if ( !EFI_ERROR(Status) ) { + DBG("CloverX64 : Image base = 0x%llX\n", (uintptr_t)LoadedImage->ImageBase); // do not change, it's used by grep to feed the debugger + } else { + DBG("CloverX64 : Image base = 0\n"); + } #ifdef JIEF_DEBUG gBS->Stall(2500000); // to give time to gdb to connect // PauseForKey(L"press\n"); @@ -3144,7 +3147,7 @@ RefitMain (IN EFI_HANDLE ImageHandle, if (gCPUStructure.TSCCalibr > 200000000ULL) { //200MHz gCPUStructure.TSCFrequency = gCPUStructure.TSCCalibr; } - + DBG("print error level mask = %x\n", GetDebugPrintErrorLevel() ); gCPUStructure.CPUFrequency = gCPUStructure.TSCFrequency; gCPUStructure.FSBFrequency = DivU64x32(MultU64x32(gCPUStructure.CPUFrequency, 10), (gCPUStructure.MaxRatio == 0) ? 1 : gCPUStructure.MaxRatio);