Prints a log message to memory buffer. @param Timing TRUE to prepend timing to log. @param DebugMode DebugMode will be passed to Callback function if it is set. @param Format The format string for the debug message to print. @param Marker VA_LIST with variable arguments for Format. **/
| 493 | |
| 494 | **/ |
| 495 | VOID |
| 496 | EFIAPI |
| 497 | MemLogfVA ( |
| 498 | IN CONST BOOLEAN Timing, |
| 499 | IN CONST INTN DebugMode, |
| 500 | IN CONST CHAR8 *Format, |
| 501 | IN VA_LIST Marker |
| 502 | ) |
| 503 | { |
| 504 | EFI_STATUS Status; |
| 505 | |
| 506 | if (Format == NULL) { |
| 507 | return; |
| 508 | } |
| 509 | |
| 510 | if (mMemLog == NULL) { |
| 511 | Status = MemLogInit (); |
| 512 | if (EFI_ERROR(Status)) { |
| 513 | return; |
| 514 | } |
| 515 | } |
| 516 | |
| 517 | // |
| 518 | // Add log to buffer |
| 519 | // |
| 520 | UINTN LastMessage = mMemLog->Cursor - mMemLog->Buffer; |
| 521 | |
| 522 | vprintf_with_callback_timestamp_emitcr(Format, Marker, transmitS8Printf, NULL, &printfNewline, 1, 1); |
| 523 | size_t DataWritten = mMemLog->Cursor - mMemLog->Buffer - LastMessage; |
| 524 | |
| 525 | // |
| 526 | // Pass this last message to callback if defined |
| 527 | // |
| 528 | if (mMemLog->Callback != NULL) { |
| 529 | mMemLog->Callback(DebugMode, mMemLog->Buffer + LastMessage); |
| 530 | } |
| 531 | |
| 532 | // |
| 533 | // Check driver debug mask value and global mask |
| 534 | // |
| 535 | if ((DebugMode & GetDebugPrintErrorLevel ()) == 0) { |
| 536 | return; |
| 537 | } |
| 538 | // |
| 539 | // Write to standard debug device also |
| 540 | // |
| 541 | // Jief : use SerialPortWrite instead of DebugPrint to avoid 256 chars message length limitation. |
| 542 | SerialPortWrite((UINT8*)(mMemLog->Buffer + LastMessage), DataWritten); |
| 543 | // DebugPrint(DEBUG_INFO, "%a", LastMessage); |
| 544 | } |
| 545 | |
| 546 | /** |
| 547 | Prints a log to message memory buffer. |
no test coverage detected