DebugMode is not same for DBG()

check AudioList is empty

Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
SergeySlice 2021-03-28 17:02:56 +03:00
parent 6d37682c03
commit 072a0a5d26
5 changed files with 28 additions and 13 deletions

View File

@ -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

View File

@ -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);
//

View File

@ -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;

View File

@ -35,6 +35,7 @@ extern "C" {
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/DebugPrintErrorLevelLib.h>
#include <Library/DevicePathLib.h>
#include <Uefi/UefiInternalFormRepresentation.h>
#include <Protocol/SimpleTextIn.h>

View File

@ -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);