]> git.proxmox.com Git - mirror_edk2.git/blame - ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.h
pointer verification (not NULL) and buffer overrun fixes.
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / SmbiosView / QueryTable.h
CommitLineData
5d73d92f 1/** @file\r
2 Build a table, each item is (key, info) pair.\r
3 and give a interface of query a string out of a table.\r
4\r
33c031ee 5 Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>\r
5d73d92f 6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef _SMBIOS_QUERY_TABLE_H\r
17#define _SMBIOS_QUERY_TABLE_H\r
18\r
19#define QUERY_TABLE_UNFOUND 0xFF\r
20\r
21typedef struct TABLE_ITEM {\r
22 UINT16 Key;\r
23 CHAR16 *Info;\r
24} TABLE_ITEM;\r
25\r
26//\r
27// Print info by option\r
28//\r
29#define PRINT_INFO_OPTION(Value, Option) \\r
30 do { \\r
31 if (Option == SHOW_NONE) { \\r
32 return ; \\r
33 } \\r
34 if (Option < SHOW_DETAIL) { \\r
35 Print (L"0x%x\n", Value); \\r
36 return ; \\r
37 } \\r
38 } while (0);\r
39\r
33c031ee 40/**\r
41 Given a table and a Key, return the responding info.\r
42\r
43 Notes:\r
44 Table[Index].Key is change from UINT8 to UINT16,\r
45 in order to deal with "0xaa - 0xbb".\r
46\r
47 For example:\r
48 DisplaySELVariableDataFormatTypes(UINT8 Type, UINT8 Option)\r
49 has a item:\r
50 "0x07-0x7F, Unused"\r
51 Now define Key = 0x7F07, that is to say: High = 0x7F, Low = 0x07.\r
52 Then all the Key Value between Low and High gets the same string\r
53 L"Unused".\r
54\r
55 @param[in] Table The begin address of table.\r
56 @param[in] Number The number of table items.\r
57 @param[in] Key The query Key.\r
58 @param[in,out] Info Input as empty buffer; output as data buffer.\r
59 @param[in] InfoLen The max number of characters for Info.\r
60\r
61 @return the found Key and Info is valid.\r
62 @retval QUERY_TABLE_UNFOUND and Info should be NULL.\r
63**/\r
5d73d92f 64UINT8\r
65QueryTable (\r
66 IN TABLE_ITEM *Table,\r
67 IN UINTN Number,\r
68 IN UINT8 Key,\r
33c031ee 69 IN OUT CHAR16 *Info,\r
70 IN UINTN InfoLen\r
5d73d92f 71 );\r
72\r
73VOID\r
74PrintBitsInfo (\r
75 IN TABLE_ITEM *Table,\r
76 IN UINTN Number,\r
77 IN UINT32 Bits\r
78 );\r
79\r
80//\r
81// Display the element detail information\r
82//\r
83VOID\r
84DisplayStructureTypeInfo (\r
85 UINT8 Key,\r
86 UINT8 Option\r
87 );\r
88\r
89//\r
90// System Information (Type 1)\r
91//\r
92VOID\r
93DisplaySystemWakeupType (\r
94 UINT8 Type,\r
95 UINT8 Option\r
96 );\r
97\r
98//\r
99// System Enclosure (Type 3)\r
100//\r
101VOID\r
102DisplaySystemEnclosureType (\r
103 UINT8 Type,\r
104 UINT8 Option\r
105 );\r
106VOID\r
107DisplaySystemEnclosureStatus (\r
108 UINT8 Status,\r
109 UINT8 Option\r
110 );\r
111VOID\r
112DisplaySESecurityStatus (\r
113 UINT8 Status,\r
114 UINT8 Option\r
115 );\r
116\r
117//\r
118// Processor Information (Type 4)\r
119//\r
120VOID\r
121DisplayProcessorType (\r
122 UINT8 Type,\r
123 UINT8 Option\r
124 );\r
125VOID\r
126DisplayProcessorUpgrade (\r
127 UINT8 Upgrade,\r
128 UINT8 Option\r
129 );\r
130\r
131//\r
132// Memory Controller Information (Type 5)\r
133//\r
134VOID\r
135DisplayMcErrorDetectMethod (\r
136 UINT8 Method,\r
137 UINT8 Option\r
138 );\r
139VOID\r
140DisplayMcErrorCorrectCapability (\r
141 UINT8 Capability,\r
142 UINT8 Option\r
143 );\r
144VOID\r
145DisplayMcInterleaveSupport (\r
146 UINT8 Support,\r
147 UINT8 Option\r
148 );\r
149VOID\r
150DisplayMcMemorySpeeds (\r
151 UINT16 Speed,\r
152 UINT8 Option\r
153 );\r
154VOID\r
155DisplayMemoryModuleVoltage (\r
156 UINT8 Voltage,\r
157 UINT8 Option\r
158 );\r
159\r
160//\r
161// Memory Module Information (Type 6)\r
162//\r
163VOID\r
164DisplayMmMemoryType (\r
165 UINT16 Type,\r
166 UINT8 Option\r
167 );\r
168VOID\r
169DisplayMmErrorStatus (\r
170 UINT8 Status,\r
171 UINT8 Option\r
172 );\r
173\r
174//\r
175// Cache Information (Type 7)\r
176//\r
177VOID\r
178DisplayCacheSRAMType (\r
179 UINT16 Type,\r
180 UINT8 Option\r
181 );\r
182VOID\r
183DisplayCacheErrCorrectingType (\r
184 UINT8 Type,\r
185 UINT8 Option\r
186 );\r
187VOID\r
188DisplayCacheSystemCacheType (\r
189 UINT8 Type,\r
190 UINT8 Option\r
191 );\r
192VOID\r
193DisplayCacheAssociativity (\r
194 UINT8 Associativity,\r
195 UINT8 Option\r
196 );\r
197\r
198//\r
199// Port Connector Information (Type 8)\r
200//\r
201VOID\r
202DisplayPortConnectorType (\r
203 UINT8 Type,\r
204 UINT8 Option\r
205 );\r
206VOID\r
207DisplayPortType (\r
208 UINT8 Type,\r
209 UINT8 Option\r
210 );\r
211\r
212//\r
213// System Slots (Type 9)\r
214//\r
215VOID\r
216DisplaySystemSlotType (\r
217 UINT8 Type,\r
218 UINT8 Option\r
219 );\r
220VOID\r
221DisplaySystemSlotDataBusWidth (\r
222 UINT8 Width,\r
223 UINT8 Option\r
224 );\r
225VOID\r
226DisplaySystemSlotCurrentUsage (\r
227 UINT8 Usage,\r
228 UINT8 Option\r
229 );\r
230VOID\r
231DisplaySystemSlotLength (\r
232 UINT8 Length,\r
233 UINT8 Option\r
234 );\r
235VOID\r
236DisplaySlotCharacteristics1 (\r
237 UINT8 Chara1,\r
238 UINT8 Option\r
239 );\r
240VOID\r
241DisplaySlotCharacteristics2 (\r
242 UINT8 Chara2,\r
243 UINT8 Option\r
244 );\r
245\r
246//\r
247// On Board Devices Information (Type 10)\r
248//\r
249VOID\r
250DisplayOnboardDeviceTypes (\r
251 UINT8 Type,\r
252 UINT8 Option\r
253 );\r
254\r
255//\r
256// System Event Log (Type 15)\r
257//\r
258VOID\r
259DisplaySELTypes (\r
260 UINT8 Type,\r
261 UINT8 Option\r
262 );\r
263VOID\r
264DisplaySELVarDataFormatType (\r
265 UINT8 Type,\r
266 UINT8 Option\r
267 );\r
268VOID\r
269DisplayPostResultsBitmapDw1 (\r
270 UINT32 Key,\r
271 UINT8 Option\r
272 );\r
273VOID\r
274DisplayPostResultsBitmapDw2 (\r
275 UINT32 Key,\r
276 UINT8 Option\r
277 );\r
278VOID\r
279DisplaySELSysManagementTypes (\r
280 UINT32 SMType,\r
281 UINT8 Option\r
282 );\r
283\r
284//\r
285// Physical Memory Array (Type 16)\r
286//\r
287VOID\r
288DisplayPMALocation (\r
289 UINT8 Location,\r
290 UINT8 Option\r
291 );\r
292VOID\r
293DisplayPMAUse (\r
294 UINT8 Use,\r
295 UINT8 Option\r
296 );\r
297VOID\r
298DisplayPMAErrorCorrectionTypes (\r
299 UINT8 Type,\r
300 UINT8 Option\r
301 );\r
302\r
303//\r
304// Memory Device (Type 17)\r
305//\r
306VOID\r
307DisplayMemoryDeviceFormFactor (\r
308 UINT8 FormFactor,\r
309 UINT8 Option\r
310 );\r
311VOID\r
312DisplayMemoryDeviceType (\r
313 UINT8 Type,\r
314 UINT8 Option\r
315 );\r
316VOID\r
317DisplayMemoryDeviceTypeDetail (\r
318 UINT16 Parameter,\r
319 UINT8 Option\r
320 );\r
321\r
322//\r
323// 32-bit Memory Error Information (Type 18)\r
324//\r
325VOID\r
326DisplayMemoryErrorType (\r
327 UINT8 ErrorType,\r
328 UINT8 Option\r
329 );\r
330VOID\r
331DisplayMemoryErrorGranularity (\r
332 UINT8 Granularity,\r
333 UINT8 Option\r
334 );\r
335VOID\r
336DisplayMemoryErrorOperation (\r
337 UINT8 Operation,\r
338 UINT8 Option\r
339 );\r
340\r
341//\r
342// Memory Array Mapped Address (Type 19)\r
343// Memory Device Mapped Address (Type 20)\r
344//\r
345// Built-in Pointing Device (Type 21)\r
346//\r
347VOID\r
348DisplayPointingDeviceType (\r
349 UINT8 Type,\r
350 UINT8 Option\r
351 );\r
352VOID\r
353DisplayPointingDeviceInterface (\r
354 UINT8 Interface,\r
355 UINT8 Option\r
356 );\r
357\r
358//\r
359// Portable Battery (Type 22)\r
360//\r
361VOID\r
362DisplayPBDeviceChemistry (\r
363 UINT8 Key,\r
364 UINT8 Option\r
365 );\r
366\r
367//\r
368// Voltage Probe (Type 26)\r
369//\r
370VOID\r
371DisplayVPLocation (\r
372 UINT8 Key,\r
373 UINT8 Option\r
374 );\r
375VOID\r
376DisplayVPStatus (\r
377 UINT8 Key,\r
378 UINT8 Option\r
379 );\r
380\r
381//\r
382// Voltage Probe (Type 27)\r
383//\r
384VOID\r
385DisplayCoolingDeviceStatus (\r
386 UINT8 Key,\r
387 UINT8 Option\r
388 );\r
389VOID\r
390DisplayCoolingDeviceType (\r
391 UINT8 Key,\r
392 UINT8 Option\r
393 );\r
394\r
395//\r
396// Temperature Probe (Type 28)\r
397//\r
398VOID\r
399DisplayTemperatureProbeStatus (\r
400 UINT8 Key,\r
401 UINT8 Option\r
402 );\r
403VOID\r
404DisplayTemperatureProbeLoc (\r
405 UINT8 Key,\r
406 UINT8 Option\r
407 );\r
408\r
409//\r
410// Electrical Current Probe (Type 29)\r
411//\r
412VOID\r
413DisplayECPStatus (\r
414 UINT8 Key,\r
415 UINT8 Option\r
416 );\r
417VOID\r
418DisplayECPLoc (\r
419 UINT8 Key,\r
420 UINT8 Option\r
421 );\r
422\r
423//\r
424// Management Device (Type 34)\r
425//\r
426VOID\r
427DisplayMDType (\r
428 UINT8 Key,\r
429 UINT8 Option\r
430 );\r
431VOID\r
432DisplayMDAddressType (\r
433 UINT8 Key,\r
434 UINT8 Option\r
435 );\r
436\r
437//\r
438// Memory Channel (Type 37)\r
439//\r
440VOID\r
441DisplayMemoryChannelType (\r
442 UINT8 Key,\r
443 UINT8 Option\r
444 );\r
445\r
446//\r
447// IPMI Device Information (Type 38)\r
448//\r
449VOID\r
450DisplayIPMIDIBMCInterfaceType (\r
451 UINT8 Key,\r
452 UINT8 Option\r
453 );\r
454\r
455#endif\r