MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / NVRAMDebugLog

Function NVRAMDebugLog

MemoryFix/OsxAptioFixDrv/NVRAMDebug.c:44–83  ·  view source on GitHub ↗

Appends given data to the log and writes it to NVRAM variable. */

Source from the content-addressed store, hash-verified

42
43/** Appends given data to the log and writes it to NVRAM variable. */
44EFI_STATUS EFIAPI
45NVRAMDebugLog(CHAR8 *Format, ...)
46{
47 EFI_STATUS Status;
48 VA_LIST Marker;
49 UINTN DataSize;
50 UINTN DataWritten;
51
52 if (DebugLogBufferPtr == NULL) {
53 // init pointer to the buffer start
54 DebugLogBufferPtr = DebugLogBuffer;
55 }
56 DataSize = DEBUG_LOG_SIZE - (DebugLogBufferPtr - DebugLogBuffer);
57
58 if (DataSize < 2) {
59 return EFI_BUFFER_TOO_SMALL;
60 }
61
62 // add text to buffer
63 VA_START (Marker, Format);
64 DataWritten = AsciiVSPrint(DebugLogBufferPtr, DataSize, Format, Marker);
65 VA_END (Marker);
66
67 DebugLogBufferPtr += DataWritten;
68
69 // delete prev value
70 //Status = gRT->SetVariable(L"DebugLog", &gEfiNVRAMDebugVarGuid,
71 // EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
72 // 0, DebugLogBuffer);
73 // write new value
74 Status = gRT->SetVariable(
75 DEBUG_LOG_NVRAM_VAR_NAME,
76 &gEfiNVRAMDebugVarGuid,
77 EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
78 DebugLogBufferPtr - DebugLogBuffer,
79 DebugLogBuffer
80 );
81
82 return Status;
83}

Callers

nothing calls this directly

Calls 1

AsciiVSPrintFunction · 0.50

Tested by

no test coverage detected