TianoCore EDK2 master
Loading...
Searching...
No Matches
EventLogInfo.c
Go to the documentation of this file.
1
10#include "PrintInfo.h"
11#include "QueryTable.h"
12#include "EventLogInfo.h"
13
20VOID
22 IN CONST UINT8 Key,
23 IN CONST UINT8 Option
24 )
25{
26 //
27 // Print prompt
28 //
29 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ACCESS_METHOD), gShellDebug1HiiHandle);
30 PRINT_INFO_OPTION (Key, Option);
31
32 //
33 // Print value info
34 //
35 switch (Key) {
36 case 0:
37 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ONE_EIGHT_BIT), gShellDebug1HiiHandle);
38 break;
39
40 case 1:
41 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TWO_EIGHT_BITS), gShellDebug1HiiHandle);
42 break;
43
44 case 2:
45 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ONE_SIXTEEN_BIT), gShellDebug1HiiHandle);
46 break;
47
48 case 3:
49 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MEM_MAPPED_PHYS), gShellDebug1HiiHandle);
50 break;
51
52 case 4:
53 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_VIA_GENERAL), gShellDebug1HiiHandle);
54 break;
55
56 default:
57 if (Key <= 0x7f) {
58 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_FUTURE_ASSIGN), gShellDebug1HiiHandle);
59 } else {
60 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR_OEM), gShellDebug1HiiHandle);
61 }
62 }
63}
64
71VOID
73 UINT8 Key,
74 UINT8 Option
75 )
76{
77 //
78 // Print prompt
79 //
80 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_STATUS), gShellDebug1HiiHandle);
81 PRINT_INFO_OPTION (Key, Option);
82
83 //
84 // Print value info
85 //
86 if ((Key & 0x01) != 0) {
87 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_VALID), gShellDebug1HiiHandle);
88 } else {
89 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_VALID), gShellDebug1HiiHandle);
90 }
91
92 if ((Key & 0x02) != 0) {
93 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_FULL), gShellDebug1HiiHandle);
94 } else {
95 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_NOT_FULL), gShellDebug1HiiHandle);
96 }
97
98 if ((Key & 0xFC) != 0) {
99 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_RES_BITS_NOT_ZERO), gShellDebug1HiiHandle, Key & 0xFC);
100 }
101}
102
109VOID
111 UINT8 Key,
112 UINT8 Option
113 )
114{
115 //
116 // Print prompt
117 //
118 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER_FORMAT), gShellDebug1HiiHandle);
119 PRINT_INFO_OPTION (Key, Option);
120
121 //
122 // Print value info
123 //
124 if (Key == 0x00) {
125 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_NO_HEADER), gShellDebug1HiiHandle);
126 } else if (Key == 0x01) {
127 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TYPE_LOG_HEADER), gShellDebug1HiiHandle);
128 } else if (Key <= 0x7f) {
129 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_FUTURE), gShellDebug1HiiHandle);
130 } else {
131 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR), gShellDebug1HiiHandle);
132 }
133}
134
141VOID
143 UINT8 Key,
144 UINT8 Option
145 )
146{
147 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER_LEN), gShellDebug1HiiHandle);
148 PRINT_INFO_OPTION (Key, Option);
149
150 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ONE_VAR_D), gShellDebug1HiiHandle, Key & 0x7F);
151
152 //
153 // The most-significant bit of the field specifies
154 // whether (0) or not (1) the record has been read
155 //
156 if ((Key & 0x80) != 0) {
157 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_THIS_RECORD_READ), gShellDebug1HiiHandle);
158 } else {
159 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_THIS_RECORD_NOT_READ), gShellDebug1HiiHandle);
160 }
161}
162
168VOID
170 IN UINT8 *LogHeader
171 )
172{
174
175 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SYSTEM_EVENT_LOG), gShellDebug1HiiHandle);
176
177 //
178 // Print Log Header Type1 Format info
179 //
180 Header = (LOG_HEADER_TYPE1_FORMAT *)(LogHeader);
181
183 -1,
184 -1,
185 NULL,
186 STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_OEM_RESERVED),
187 gShellDebug1HiiHandle,
188 Header->OEMReserved[0],
189 Header->OEMReserved[1],
190 Header->OEMReserved[2],
191 Header->OEMReserved[3],
192 Header->OEMReserved[4]
193 );
194 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_TIME), gShellDebug1HiiHandle, Header->Metw);
195 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_COUNT), gShellDebug1HiiHandle, Header->Meci);
196 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_PREBOOT_ADDRESS), gShellDebug1HiiHandle, Header->CMOSAddress);
197 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_PREBOOT_INDEX), gShellDebug1HiiHandle, Header->CMOSBitIndex);
198 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_CHECKSUM_STARTING_OFF), gShellDebug1HiiHandle, Header->StartingOffset);
199 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_CHECKSUN_BYTE_COUNT), gShellDebug1HiiHandle, Header->ChecksumOffset);
201 -1,
202 -1,
203 NULL,
204 STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_RESERVED),
205 gShellDebug1HiiHandle,
206 Header->OEMReserved[0],
207 Header->OEMReserved[1],
208 Header->OEMReserved[2]
209 );
210 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_HEADER_REVISION), gShellDebug1HiiHandle, Header->HeaderRevision);
211}
212
219VOID
221 UINT8 LogHeaderFormat,
222 UINT8 *LogHeader
223 )
224{
225 //
226 // Print prompt
227 //
228 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER), gShellDebug1HiiHandle);
229
230 //
231 // Print value info
232 //
233 if (LogHeaderFormat == 0x00) {
234 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_NO_HEADER), gShellDebug1HiiHandle);
235 } else if (LogHeaderFormat == 0x01) {
236 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TYPE_LOG_HEADER), gShellDebug1HiiHandle);
238 } else if (LogHeaderFormat <= 0x7f) {
239 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FUTURE_ASSIGN), gShellDebug1HiiHandle);
240 } else {
241 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR), gShellDebug1HiiHandle);
242 }
243}
244
251VOID
253 UINT8 ElVdfType,
254 UINT8 *VarData
255 )
256{
257 UINT16 *Word;
258 UINT32 *Dword;
259
260 //
261 // Display Type Name
262 //
263 DisplaySELVarDataFormatType (ElVdfType, SHOW_DETAIL);
264
265 //
266 // Display Type description
267 //
268 switch (ElVdfType) {
269 case 0:
270 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_NO_STD_FORMAT), gShellDebug1HiiHandle);
271 break;
272
273 case 1:
274 Word = (UINT16 *)(VarData + 1);
275 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SMBIOS_STRUCT_ASSOC), gShellDebug1HiiHandle);
276 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_STRUCT_HANDLE), gShellDebug1HiiHandle, *Word);
277 break;
278
279 case 2:
280 Dword = (UINT32 *)(VarData + 1);
281 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULT_EVENT_COUNTER), gShellDebug1HiiHandle, *Dword);
282 break;
283
284 case 3:
285 Word = (UINT16 *)(VarData + 1);
286 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SMBIOS_STRUCT_ASSOC), gShellDebug1HiiHandle);
287 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_STRUCT_HANDLE), gShellDebug1HiiHandle, *Word);
288 //
289 // Followed by a multiple-event counter
290 //
291 Dword = (UINT32 *)(VarData + 1);
292 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULT_EVENT_COUNTER), gShellDebug1HiiHandle, *Dword);
293 break;
294
295 case 4:
296 Dword = (UINT32 *)(VarData + 1);
297 DisplayPostResultsBitmapDw1 (*Dword, SHOW_DETAIL);
298 Dword++;
299 DisplayPostResultsBitmapDw2 (*Dword, SHOW_DETAIL);
300 break;
301
302 case 5:
303 Dword = (UINT32 *)(VarData + 1);
304 DisplaySELSysManagementTypes (*Dword, SHOW_DETAIL);
305 break;
306
307 case 6:
308 Dword = (UINT32 *)(VarData + 1);
309 DisplaySELSysManagementTypes (*Dword, SHOW_DETAIL);
310 //
311 // Followed by a multiple-event counter
312 //
313 Dword = (UINT32 *)(VarData + 1);
314 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULT_EVENT_COUNTER), gShellDebug1HiiHandle, *Dword);
315 break;
316
317 default:
318 if (ElVdfType <= 0x7F) {
319 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_UNUSED_AVAIL_FOR_ASSIGN), gShellDebug1HiiHandle);
320 } else {
321 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_SYSTEM), gShellDebug1HiiHandle);
322 }
323 }
324}
325
332VOID
334 UINT8 *LogData,
335 UINT16 LogAreaLength
336 )
337{
339 UINT8 ElVdfType;
340 //
341 // Event Log Variable Data Format Types
342 //
343 UINTN Offset;
344
345 //
346 // Print prompt
347 //
348 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SYSTEM_EVENT_LOG_2), gShellDebug1HiiHandle);
349
350 //
351 // Print Log info
352 //
353 Offset = 0;
354 Log = (LOG_RECORD_FORMAT *)LogData;
355 while (Log != NULL && Log->Type != END_OF_LOG && Offset < LogAreaLength) {
356 if (Log != NULL) {
357 //
358 // Display Event Log Record Information
359 //
360 DisplaySELTypes (Log->Type, SHOW_DETAIL);
361 DisplaySELLogHeaderLen (Log->Length, SHOW_DETAIL);
362
363 Offset += Log->Length;
364 //
365 // Display Log Header Date/Time Fields
366 // These fields contain the BCD representation of the date and time
367 // (as read from CMOS) of the occurrence of the event
368 // So Print as hex and represent decimal
369 //
370 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_DATE), gShellDebug1HiiHandle);
371 if ((Log != NULL) && (Log->Year >= 80) && (Log->Year <= 99)) {
372 Print (L"19");
373 } else if ((Log != NULL) && (Log->Year <= 79)) {
374 Print (L"20");
375 } else {
376 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ERROR), gShellDebug1HiiHandle);
377 //
378 // Get a Event Log Record
379 //
380 Log = (LOG_RECORD_FORMAT *)(LogData + Offset);
381 continue;
382 }
383
385 -1,
386 -1,
387 NULL,
388 STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TIME_SIX_VARS),
389 gShellDebug1HiiHandle,
390 Log->Year,
391 Log->Month,
392 Log->Day,
393 Log->Hour,
394 Log->Minute,
395 Log->Second
396 );
397
398 //
399 // Display Variable Data Format
400 //
401 if (Log->Length <= (sizeof (LOG_RECORD_FORMAT) - 1)) {
402 //
403 // Get a Event Log Record
404 //
405 Log = (LOG_RECORD_FORMAT *)(LogData + Offset);
406 continue;
407 }
408
409 ElVdfType = Log->LogVariableData[0];
410 DisplayElVdfInfo (ElVdfType, Log->LogVariableData);
411 //
412 // Get a Event Log Record
413 //
414 Log = (LOG_RECORD_FORMAT *)(LogData + Offset);
415 }
416 }
417}
UINT64 UINTN
VOID DisplaySysEventLogHeaderType1(IN UINT8 *LogHeader)
Definition: EventLogInfo.c:169
VOID DisplaySysEventLogHeader(UINT8 LogHeaderFormat, UINT8 *LogHeader)
Definition: EventLogInfo.c:220
VOID DisplaySysEventLogData(UINT8 *LogData, UINT16 LogAreaLength)
Definition: EventLogInfo.c:333
VOID DisplaySysEventLogHeaderFormat(UINT8 Key, UINT8 Option)
Definition: EventLogInfo.c:110
VOID DisplaySELAccessMethod(IN CONST UINT8 Key, IN CONST UINT8 Option)
Definition: EventLogInfo.c:21
VOID DisplayElVdfInfo(UINT8 ElVdfType, UINT8 *VarData)
Definition: EventLogInfo.c:252
VOID DisplaySELLogHeaderLen(UINT8 Key, UINT8 Option)
Definition: EventLogInfo.c:142
VOID DisplaySELLogStatus(UINT8 Key, UINT8 Option)
Definition: EventLogInfo.c:72
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define IN
Definition: Base.h:279
VOID DisplaySELSysManagementTypes(IN UINT32 SMType, IN UINT8 Option)
Definition: QueryTable.c:4714
VOID DisplaySELVarDataFormatType(IN UINT8 Type, IN UINT8 Option)
Definition: QueryTable.c:4663
VOID DisplayPostResultsBitmapDw2(IN UINT32 Key, IN UINT8 Option)
Definition: QueryTable.c:4697
VOID DisplaySELTypes(IN UINT8 Type, IN UINT8 Option)
Definition: QueryTable.c:4646
VOID DisplayPostResultsBitmapDw1(IN UINT32 Key, IN UINT8 Option)
Definition: QueryTable.c:4680
EFI_STATUS EFIAPI ShellPrintHiiEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR8 *Language OPTIONAL, IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_HII_HANDLE HiiFormatHandle,...)
#define STRING_TOKEN(t)
UINTN EFIAPI Print(IN CONST CHAR16 *Format,...)
Definition: UefiLibPrint.c:113