a1d4bfcc |
1 | /** @file\r |
5d73d92f |
2 | Module for clarifying the content of the smbios structure element info.\r |
3 | \r |
a1d4bfcc |
4 | Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved. <BR>\r |
5d73d92f |
5 | This program and the accompanying materials\r |
6 | are licensed and made available under the terms and conditions of the BSD License\r |
7 | which accompanies this distribution. The full text of the license may be found at\r |
8 | http://opensource.org/licenses/bsd-license.php\r |
9 | \r |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r |
12 | \r |
13 | **/\r |
14 | \r |
8a765da2 |
15 | #include "UefiShellDebug1CommandsLib.h"\r |
5d73d92f |
16 | #include "PrintInfo.h"\r |
17 | #include "QueryTable.h"\r |
18 | #include "EventLogInfo.h"\r |
19 | \r |
20 | /**\r |
21 | Function to display system event log access information.\r |
22 | \r |
23 | @param[in] Key Additional information to print.\r |
24 | @param[in] Option Whether to print the additional information.\r |
25 | **/\r |
26 | VOID\r |
5d73d92f |
27 | DisplaySELAccessMethod (\r |
28 | IN CONST UINT8 Key,\r |
29 | IN CONST UINT8 Option\r |
30 | )\r |
31 | {\r |
32 | //\r |
33 | // Print prompt\r |
34 | //\r |
35 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ACCESS_METHOD), gShellDebug1HiiHandle);\r |
36 | PRINT_INFO_OPTION (Key, Option);\r |
37 | \r |
38 | //\r |
39 | // Print value info\r |
40 | //\r |
41 | switch (Key) {\r |
42 | case 0:\r |
43 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ONE_EIGHT_BIT), gShellDebug1HiiHandle);\r |
44 | break;\r |
45 | \r |
46 | case 1:\r |
47 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TWO_EIGHT_BITS), gShellDebug1HiiHandle);\r |
48 | break;\r |
49 | \r |
50 | case 2:\r |
51 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ONE_SIXTEEN_BIT), gShellDebug1HiiHandle);\r |
52 | break;\r |
53 | \r |
54 | case 3:\r |
55 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MEM_MAPPED_PHYS), gShellDebug1HiiHandle);\r |
56 | break;\r |
57 | \r |
58 | case 4:\r |
59 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_VIA_GENERAL), gShellDebug1HiiHandle);\r |
60 | break;\r |
61 | \r |
62 | default:\r |
63 | if (Key <= 0x7f) {\r |
64 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_FUTURE_ASSIGN), gShellDebug1HiiHandle);\r |
65 | } else {\r |
66 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR_OEM), gShellDebug1HiiHandle);\r |
67 | }\r |
68 | }\r |
69 | }\r |
70 | \r |
71 | /**\r |
72 | Function to display system event log status information.\r |
73 | \r |
74 | @param[in] Key Additional information to print.\r |
75 | @param[in] Option Whether to print the additional information.\r |
76 | **/\r |
77 | VOID\r |
5d73d92f |
78 | DisplaySELLogStatus (\r |
79 | UINT8 Key,\r |
80 | UINT8 Option\r |
81 | )\r |
82 | {\r |
83 | //\r |
84 | // Print prompt\r |
85 | //\r |
86 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_STATUS), gShellDebug1HiiHandle);\r |
87 | PRINT_INFO_OPTION (Key, Option);\r |
88 | \r |
89 | //\r |
90 | // Print value info\r |
91 | //\r |
92 | if ((Key & 0x01) != 0) {\r |
93 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_VALID), gShellDebug1HiiHandle);\r |
94 | } else {\r |
95 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_VALID), gShellDebug1HiiHandle);\r |
96 | }\r |
97 | \r |
98 | if ((Key & 0x02) != 0) {\r |
99 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_FULL), gShellDebug1HiiHandle);\r |
100 | } else {\r |
101 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_NOT_FULL), gShellDebug1HiiHandle);\r |
102 | }\r |
103 | \r |
104 | if ((Key & 0xFC) != 0) {\r |
105 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_RES_BITS_NOT_ZERO), gShellDebug1HiiHandle, Key & 0xFC);\r |
106 | }\r |
107 | }\r |
108 | \r |
109 | /**\r |
110 | Function to display system event log header format information.\r |
111 | \r |
112 | @param[in] Key Additional information to print.\r |
113 | @param[in] Option Whether to print the additional information.\r |
114 | **/\r |
115 | VOID\r |
5d73d92f |
116 | DisplaySysEventLogHeaderFormat (\r |
117 | UINT8 Key,\r |
118 | UINT8 Option\r |
119 | )\r |
120 | {\r |
121 | //\r |
122 | // Print prompt\r |
123 | //\r |
124 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER_FORMAT), gShellDebug1HiiHandle);\r |
125 | PRINT_INFO_OPTION (Key, Option);\r |
126 | \r |
127 | //\r |
128 | // Print value info\r |
129 | //\r |
130 | if (Key == 0x00) {\r |
131 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_NO_HEADER), gShellDebug1HiiHandle);\r |
132 | } else if (Key == 0x01) {\r |
133 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TYPE_LOG_HEADER), gShellDebug1HiiHandle);\r |
134 | } else if (Key <= 0x7f) {\r |
135 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_FUTURE), gShellDebug1HiiHandle);\r |
136 | } else {\r |
137 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR), gShellDebug1HiiHandle);\r |
138 | }\r |
139 | }\r |
140 | \r |
a1d4bfcc |
141 | /**\r |
142 | Display the header information for SEL log items.\r |
143 | \r |
144 | @param[in] Key The information key.\r |
145 | @param[in] Option The option index.\r |
146 | **/\r |
5d73d92f |
147 | VOID\r |
148 | DisplaySELLogHeaderLen (\r |
149 | UINT8 Key,\r |
150 | UINT8 Option\r |
151 | )\r |
152 | {\r |
153 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER_LEN), gShellDebug1HiiHandle);\r |
154 | PRINT_INFO_OPTION (Key, Option);\r |
155 | \r |
156 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ONE_VAR_D), gShellDebug1HiiHandle, Key & 0x7F);\r |
157 | \r |
158 | //\r |
159 | // The most-significant bit of the field specifies\r |
160 | // whether (0) or not (1) the record has been read\r |
161 | //\r |
162 | if ((Key & 0x80) != 0) {\r |
163 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_THIS_RECORD_READ), gShellDebug1HiiHandle);\r |
164 | } else {\r |
165 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_THIS_RECORD_NOT_READ), gShellDebug1HiiHandle);\r |
166 | }\r |
167 | }\r |
168 | \r |
a1d4bfcc |
169 | /**\r |
170 | Display the header information for type 1 items.\r |
171 | \r |
172 | @param[in] LogHeader The buffer with the information.\r |
173 | **/\r |
5d73d92f |
174 | VOID\r |
175 | DisplaySysEventLogHeaderType1 (\r |
a1d4bfcc |
176 | IN UINT8 *LogHeader\r |
5d73d92f |
177 | )\r |
178 | {\r |
179 | LOG_HEADER_TYPE1_FORMAT *Header;\r |
180 | \r |
181 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SYSTEM_EVENT_LOG), gShellDebug1HiiHandle);\r |
182 | \r |
183 | //\r |
184 | // Print Log Header Type1 Format info\r |
185 | //\r |
186 | Header = (LOG_HEADER_TYPE1_FORMAT *) (LogHeader);\r |
187 | \r |
188 | ShellPrintHiiEx(-1,-1,NULL,\r |
189 | STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_OEM_RESERVED),\r |
190 | gShellDebug1HiiHandle,\r |
191 | Header->OEMReserved[0],\r |
192 | Header->OEMReserved[1],\r |
193 | Header->OEMReserved[2],\r |
194 | Header->OEMReserved[3],\r |
195 | Header->OEMReserved[4]\r |
196 | );\r |
a1d4bfcc |
197 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_TIME), gShellDebug1HiiHandle, Header->Metw);\r |
198 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_COUNT), gShellDebug1HiiHandle, Header->Meci);\r |
5d73d92f |
199 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_PREBOOT_ADDRESS), gShellDebug1HiiHandle, Header->CMOSAddress);\r |
200 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_PREBOOT_INDEX), gShellDebug1HiiHandle, Header->CMOSBitIndex);\r |
201 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_CHECKSUM_STARTING_OFF), gShellDebug1HiiHandle, Header->StartingOffset);\r |
202 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_CHECKSUN_BYTE_COUNT), gShellDebug1HiiHandle, Header->ChecksumOffset);\r |
203 | ShellPrintHiiEx(-1,-1,NULL,\r |
204 | STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_RESERVED),\r |
205 | gShellDebug1HiiHandle,\r |
206 | Header->OEMReserved[0],\r |
207 | Header->OEMReserved[1],\r |
208 | Header->OEMReserved[2]\r |
209 | );\r |
210 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_HEADER_REVISION), gShellDebug1HiiHandle, Header->HeaderRevision);\r |
211 | }\r |
212 | \r |
213 | /**\r |
214 | Function to display system event log header information.\r |
215 | \r |
216 | @param[in] LogHeaderFormat Format identifier.\r |
217 | @param[in] LogHeader Format informcation.\r |
218 | **/\r |
219 | VOID\r |
5d73d92f |
220 | DisplaySysEventLogHeader (\r |
221 | UINT8 LogHeaderFormat,\r |
222 | UINT8 *LogHeader\r |
223 | )\r |
224 | {\r |
225 | //\r |
226 | // Print prompt\r |
227 | //\r |
228 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER), gShellDebug1HiiHandle);\r |
229 | \r |
230 | //\r |
231 | // Print value info\r |
232 | //\r |
233 | if (LogHeaderFormat == 0x00) {\r |
234 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_NO_HEADER), gShellDebug1HiiHandle);\r |
235 | } else if (LogHeaderFormat == 0x01) {\r |
236 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TYPE_LOG_HEADER), gShellDebug1HiiHandle);\r |
237 | DisplaySysEventLogHeaderType1 (LogHeader);\r |
238 | } else if (LogHeaderFormat <= 0x7f) {\r |
239 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FUTURE_ASSIGN), gShellDebug1HiiHandle);\r |
240 | } else {\r |
241 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR), gShellDebug1HiiHandle);\r |
242 | }\r |
243 | }\r |
244 | \r |
a1d4bfcc |
245 | /**\r |
246 | Display the El Vdf information.\r |
247 | \r |
248 | @param[in] ElVdfType The information type.\r |
249 | @param[in] VarData The information buffer.\r |
250 | **/\r |
5d73d92f |
251 | VOID\r |
252 | DisplayElVdfInfo (\r |
253 | UINT8 ElVdfType,\r |
254 | UINT8 *VarData\r |
255 | )\r |
256 | {\r |
257 | UINT16 *Word;\r |
258 | UINT32 *Dword;\r |
259 | \r |
260 | //\r |
261 | // Display Type Name\r |
262 | //\r |
263 | DisplaySELVarDataFormatType (ElVdfType, SHOW_DETAIL);\r |
264 | \r |
265 | //\r |
266 | // Display Type description\r |
267 | //\r |
268 | switch (ElVdfType) {\r |
269 | case 0:\r |
270 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_NO_STD_FORMAT), gShellDebug1HiiHandle);\r |
271 | break;\r |
272 | \r |
273 | case 1:\r |
274 | Word = (UINT16 *) (VarData + 1);\r |
275 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SMBIOS_STRUCT_ASSOC), gShellDebug1HiiHandle);\r |
276 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_STRUCT_HANDLE), gShellDebug1HiiHandle, *Word);\r |
277 | break;\r |
278 | \r |
279 | case 2:\r |
280 | Dword = (UINT32 *) (VarData + 1);\r |
281 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULT_EVENT_COUNTER), gShellDebug1HiiHandle, *Dword);\r |
282 | break;\r |
283 | \r |
284 | case 3:\r |
285 | Word = (UINT16 *) (VarData + 1);\r |
286 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SMBIOS_STRUCT_ASSOC), gShellDebug1HiiHandle);\r |
287 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_STRUCT_HANDLE), gShellDebug1HiiHandle, *Word);\r |
288 | //\r |
289 | // Followed by a multiple-event counter\r |
290 | //\r |
291 | Dword = (UINT32 *) (VarData + 1);\r |
292 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULT_EVENT_COUNTER), gShellDebug1HiiHandle, *Dword);\r |
293 | break;\r |
294 | \r |
295 | case 4:\r |
296 | Dword = (UINT32 *) (VarData + 1);\r |
297 | DisplayPostResultsBitmapDw1 (*Dword, SHOW_DETAIL);\r |
298 | Dword++;\r |
299 | DisplayPostResultsBitmapDw2 (*Dword, SHOW_DETAIL);\r |
300 | break;\r |
301 | \r |
302 | case 5:\r |
303 | Dword = (UINT32 *) (VarData + 1);\r |
304 | DisplaySELSysManagementTypes (*Dword, SHOW_DETAIL);\r |
305 | break;\r |
306 | \r |
307 | case 6:\r |
308 | Dword = (UINT32 *) (VarData + 1);\r |
309 | DisplaySELSysManagementTypes (*Dword, SHOW_DETAIL);\r |
310 | //\r |
311 | // Followed by a multiple-event counter\r |
312 | //\r |
313 | Dword = (UINT32 *) (VarData + 1);\r |
314 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULT_EVENT_COUNTER), gShellDebug1HiiHandle, *Dword);\r |
315 | break;\r |
316 | \r |
317 | default:\r |
318 | if (ElVdfType <= 0x7F) {\r |
319 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_UNUSED_AVAIL_FOR_ASSIGN), gShellDebug1HiiHandle);\r |
320 | } else {\r |
321 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_SYSTEM), gShellDebug1HiiHandle);\r |
322 | }\r |
323 | }\r |
324 | }\r |
325 | \r |
326 | /**\r |
327 | Function to display system event log data.\r |
328 | \r |
329 | @param[in] LogData The data information.\r |
330 | @param[in] LogAreaLength Length of the data.\r |
331 | **/\r |
332 | VOID\r |
5d73d92f |
333 | DisplaySysEventLogData (\r |
334 | UINT8 *LogData,\r |
335 | UINT16 LogAreaLength\r |
336 | )\r |
337 | {\r |
338 | LOG_RECORD_FORMAT *Log;\r |
339 | UINT8 ElVdfType;\r |
340 | //\r |
341 | // Event Log Variable Data Format Types\r |
342 | //\r |
343 | UINTN Offset;\r |
344 | \r |
345 | //\r |
346 | // Print prompt\r |
347 | //\r |
348 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SYSTEM_EVENT_LOG_2), gShellDebug1HiiHandle);\r |
349 | \r |
350 | //\r |
351 | // Print Log info\r |
352 | //\r |
353 | Offset = 0;\r |
354 | Log = (LOG_RECORD_FORMAT *) LogData;\r |
33c031ee |
355 | while (Log != NULL && Log->Type != END_OF_LOG && Offset < LogAreaLength) {\r |
5d73d92f |
356 | //\r |
357 | // Get a Event Log Record\r |
358 | //\r |
359 | Log = (LOG_RECORD_FORMAT *) (LogData + Offset);\r |
360 | \r |
33c031ee |
361 | if (Log != NULL) {\r |
362 | //\r |
363 | // Display Event Log Record Information\r |
364 | //\r |
365 | DisplaySELVarDataFormatType (Log->Type, SHOW_DETAIL);\r |
366 | DisplaySELLogHeaderLen (Log->Length, SHOW_DETAIL);\r |
367 | \r |
368 | Offset += Log->Length;\r |
369 | //\r |
370 | // Display Log Header Date/Time Fields\r |
371 | // These fields contain the BCD representation of the date and time\r |
372 | // (as read from CMOS) of the occurrence of the event\r |
373 | // So Print as hex and represent decimal\r |
374 | //\r |
375 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_DATE), gShellDebug1HiiHandle);\r |
376 | if (Log != NULL && Log->Year >= 80 && Log->Year <= 99) {\r |
377 | Print (L"19");\r |
378 | } else if (Log != NULL && Log->Year <= 79) {\r |
379 | Print (L"20");\r |
380 | } else {\r |
381 | ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ERROR), gShellDebug1HiiHandle);\r |
382 | continue;\r |
383 | }\r |
384 | \r |
385 | ShellPrintHiiEx(-1,-1,NULL,\r |
386 | STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TIME_SIX_VARS),\r |
387 | gShellDebug1HiiHandle,\r |
388 | Log->Year,\r |
389 | Log->Month,\r |
390 | Log->Day,\r |
391 | Log->Hour,\r |
392 | Log->Minute,\r |
393 | Log->Second\r |
394 | );\r |
395 | \r |
396 | //\r |
397 | // Display Variable Data Format\r |
398 | //\r |
399 | if (Log->Length <= (sizeof (LOG_RECORD_FORMAT) - 1)) {\r |
400 | continue;\r |
401 | }\r |
402 | \r |
403 | ElVdfType = Log->LogVariableData[0];\r |
404 | DisplayElVdfInfo (ElVdfType, Log->LogVariableData);\r |
5d73d92f |
405 | }\r |
5d73d92f |
406 | }\r |
407 | }\r |