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