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