| 73 | STATIC |
| 74 | EFI_STATUS |
| 75 | EFIAPI |
| 76 | AppleDebugLogPrint ( |
| 77 | IN CONST CHAR8 *Message |
| 78 | ) |
| 79 | { |
| 80 | OC_LOG_PROTOCOL *OcLog; |
| 81 | EFI_STATUS Status; |
| 82 | UINTN Length; |
| 83 | CHAR8 *NewLinePos; |
| 84 | APPLE_PERF_ENTRY *Entry; |
| 85 | UINT32 Index; |
| 86 | |
| 87 | if (!mAppleDebugLogEnable) { |
| 88 | return FALSE; |
| 89 | } |
| 90 | |
| 91 | OcLog = InternalGetOcLog (); |
| 92 | if (OcLog == NULL) { |
| 93 | return EFI_NOT_FOUND; |
| 94 | } |
| 95 | |
| 96 | // |
| 97 | // Flush perf data. |
| 98 | // |
| 99 | if (mApplePerfBuffer != NULL |
| 100 | && mApplePerfBuffer->Signature == APPLE_PERF_DATA_SIGNATURE |
| 101 | && mApplePerfBuffer->NumberOfEntries > mApplePerfDumped) { |
| 102 | Entry = APPLE_PERF_FIRST_ENTRY (mApplePerfBuffer); |
| 103 | |
| 104 | for (Index = 0; Index < mApplePerfBuffer->NumberOfEntries; ++Index) { |
| 105 | if (Index == mApplePerfDumped) { |
| 106 | AppleDebugLogPrintToOcLog ( |
| 107 | OcLog, |
| 108 | "EBPF: [%u ms] %a\n", |
| 109 | (UINT32) Entry->TimestampMs, |
| 110 | Entry->EntryData |
| 111 | ); |
| 112 | ++mApplePerfDumped; |
| 113 | } |
| 114 | Entry = APPLE_PERF_NEXT_ENTRY (Entry); |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | // |
| 119 | // Concatenate with the previous message. |
| 120 | // |
| 121 | Status = AsciiStrCatS ( |
| 122 | mCurrentBuffer, |
| 123 | sizeof (mCurrentBuffer) - 1, |
| 124 | Message |
| 125 | ); |
| 126 | if (EFI_ERROR(Status)) { |
| 127 | Length = AsciiStrLen (mCurrentBuffer); |
| 128 | |
| 129 | if (Length > 0) { |
| 130 | // |
| 131 | // Flush the previous message. |
| 132 | // |
nothing calls this directly
no test coverage detected