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 - 2012, 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
21typedef 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**/
64UINT8
65QueryTable (
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/**
74  Display the structure type information.
75
76  @param[in] Key      The key of the structure.
77  @param[in] Option   The optional information.
78**/
79VOID
80DisplayStructureTypeInfo (
81  IN UINT8 Key,
82  IN UINT8 Option
83  );
84
85/**
86  Display System Information (Type 1) Type.
87
88  @param[in] Type           The key of the structure.
89  @param[in] Option         The optional information.
90**/
91VOID
92DisplaySystemWakeupType (
93  IN UINT8 Type,
94  IN UINT8 Option
95  );
96
97/**
98  Display Base Board (Type 2) Feature Flags.
99
100  @param[in] FeatureFlags   The key of the structure.
101  @param[in] Option         The optional information.
102**/
103VOID
104DisplayBaseBoardFeatureFlags (
105  IN UINT8 FeatureFlags,
106  IN UINT8 Option
107  );
108
109/**
110  Display Base Board (Type 2) Board Type.
111
112  @param[in] Type           The key of the structure.
113  @param[in] Option         The optional information.
114**/
115VOID
116DisplayBaseBoardBoardType(
117  IN UINT8 Type,
118  IN UINT8 Option
119  );
120
121/**
122  Display System Enclosure (Type 3) Enclosure Type.
123
124  @param[in] Type           The key of the structure.
125  @param[in] Option         The optional information.
126**/
127VOID
128DisplaySystemEnclosureType (
129  IN UINT8 Type,
130  IN UINT8 Option
131  );
132
133/**
134  Display System Enclosure (Type 3) Enclosure Status.
135
136  @param[in] Status         The key of the structure.
137  @param[in] Option         The optional information.
138**/
139VOID
140DisplaySystemEnclosureStatus (
141  IN UINT8 Status,
142  IN UINT8 Option
143  );
144
145/**
146  Display System Enclosure (Type 3) Security Status.
147
148  @param[in] Status         The key of the structure.
149  @param[in] Option         The optional information.
150**/
151VOID
152DisplaySESecurityStatus (
153  IN UINT8 Status,
154  IN UINT8 Option
155  )
156;
157
158/**
159  Display Processor Information (Type 4) Type.
160
161  @param[in] Type           The key of the structure.
162  @param[in] Option         The optional information.
163**/
164VOID
165DisplayProcessorType (
166  IN UINT8 Type,
167  IN UINT8 Option
168  );
169
170/**
171  Display Processor Information (Type 4) Upgrade.
172
173  @param[in] Upgrade        The key of the structure.
174  @param[in] Option         The optional information.
175**/
176VOID
177DisplayProcessorUpgrade (
178  IN UINT8 Upgrade,
179  IN UINT8 Option
180  );
181
182/**
183  Display Processor Information (Type 4) Characteristics.
184
185  @param[in] Type           The key of the structure.
186  @param[in] Option         The optional information.
187**/
188VOID
189DisplayProcessorCharacteristics (
190  IN UINT16 Type,
191  IN UINT8 Option
192  );
193
194/**
195  Display Memory Controller Information (Type 5) method.
196
197  @param[in] Method         The key of the structure.
198  @param[in] Option         The optional information.
199**/
200VOID
201DisplayMcErrorDetectMethod (
202  IN UINT8 Method,
203  IN UINT8 Option
204  );
205
206/**
207  Display Memory Controller Information (Type 5) Capability.
208
209  @param[in] Capability     The key of the structure.
210  @param[in] Option         The optional information.
211**/
212VOID
213DisplayMcErrorCorrectCapability (
214  IN UINT8 Capability,
215  IN UINT8 Option
216  );
217
218/**
219  Display Memory Controller Information (Type 5) Support.
220
221  @param[in] Support        The key of the structure.
222  @param[in] Option         The optional information.
223**/
224VOID
225DisplayMcInterleaveSupport (
226  IN UINT8 Support,
227  IN UINT8 Option
228  );
229
230/**
231  Display Memory Controller Information (Type 5) speeds.
232
233  @param[in] Speed          The key of the structure.
234  @param[in] Option         The optional information.
235**/
236VOID
237DisplayMcMemorySpeeds (
238  IN UINT16  Speed,
239  IN UINT8   Option
240  );
241
242/**
243  Display Memory Controller Information (Type 5) voltage.
244
245  @param[in] Voltage        The key of the structure.
246  @param[in] Option         The optional information.
247**/
248VOID
249DisplayMemoryModuleVoltage (
250  IN UINT8 Voltage,
251  IN UINT8 Option
252  );
253
254/**
255  Display Memory Module Information (Type 6) type.
256
257  @param[in] Type           The key of the structure.
258  @param[in] Option         The optional information.
259**/
260VOID
261DisplayMmMemoryType (
262  IN UINT16  Type,
263  IN UINT8   Option
264  );
265
266/**
267  Display Memory Module Information (Type 6) status.
268
269  @param[in] Status         The key of the structure.
270  @param[in] Option         The optional information.
271**/
272VOID
273DisplayMmErrorStatus (
274  IN UINT8 Status,
275  IN UINT8 Option
276  );
277
278/**
279  Display Cache Information (Type 7) SRAM Type.
280
281  @param[in] Type           The key of the structure.
282  @param[in] Option         The optional information.
283**/
284VOID
285DisplayCacheSRAMType (
286  IN UINT16  Type,
287  IN UINT8   Option
288  );
289
290/**
291  Display Cache Information (Type 7) correcting Type.
292
293  @param[in] Type           The key of the structure.
294  @param[in] Option         The optional information.
295**/
296VOID
297DisplayCacheErrCorrectingType (
298  IN UINT8 Type,
299  IN UINT8 Option
300  );
301
302/**
303  Display Cache Information (Type 7) Type.
304
305  @param[in] Type           The key of the structure.
306  @param[in] Option         The optional information.
307**/
308VOID
309DisplayCacheSystemCacheType (
310  IN UINT8 Type,
311  IN UINT8 Option
312  );
313
314/**
315  Display Cache Information (Type 7) Associativity.
316
317  @param[in] Associativity  The key of the structure.
318  @param[in] Option         The optional information.
319**/
320VOID
321DisplayCacheAssociativity (
322  IN UINT8 Associativity,
323  IN UINT8 Option
324  );
325
326/**
327  Display Port Connector Information  (Type 8) type.
328
329  @param[in] Type       The key of the structure.
330  @param[in] Option     The optional information.
331**/
332VOID
333DisplayPortConnectorType (
334  IN UINT8 Type,
335  IN UINT8 Option
336  );
337
338/**
339  Display Port Connector Information  (Type 8) port type.
340
341  @param[in] Type       The key of the structure.
342  @param[in] Option     The optional information.
343**/
344VOID
345DisplayPortType (
346  IN UINT8 Type,
347  IN UINT8 Option
348  );
349
350/**
351  Display System Slots (Type 9) slot type.
352
353  @param[in] Type       The key of the structure.
354  @param[in] Option     The optional information.
355**/
356VOID
357DisplaySystemSlotType (
358  IN UINT8 Type,
359  IN UINT8 Option
360  );
361
362/**
363  Display System Slots (Type 9) data bus width.
364
365  @param[in] Width      The key of the structure.
366  @param[in] Option     The optional information.
367**/
368VOID
369DisplaySystemSlotDataBusWidth (
370  IN UINT8 Width,
371  IN UINT8 Option
372  );
373
374/**
375  Display System Slots (Type 9) usage information.
376
377  @param[in] Usage      The key of the structure.
378  @param[in] Option     The optional information.
379**/
380VOID
381DisplaySystemSlotCurrentUsage (
382  IN UINT8 Usage,
383  IN UINT8 Option
384  );
385
386/**
387  Display System Slots (Type 9) slot length.
388
389  @param[in] Length     The key of the structure.
390  @param[in] Option     The optional information.
391**/
392VOID
393DisplaySystemSlotLength (
394  IN UINT8 Length,
395  IN UINT8 Option
396  );
397
398/**
399  Display System Slots (Type 9) characteristics.
400
401  @param[in] Chara1     The key of the structure.
402  @param[in] Option     The optional information.
403**/
404VOID
405DisplaySlotCharacteristics1 (
406  IN UINT8 Chara1,
407  IN UINT8 Option
408  );
409
410/**
411  Display System Slots (Type 9) characteristics.
412
413  @param[in] Chara2     The key of the structure.
414  @param[in] Option     The optional information.
415**/
416VOID
417DisplaySlotCharacteristics2 (
418  IN UINT8 Chara2,
419  IN UINT8 Option
420  );
421
422/**
423  Display On Board Devices Information (Type 10) types.
424
425  @param[in] Type       The key of the structure.
426  @param[in] Option     The optional information.
427**/
428VOID
429DisplayOnboardDeviceTypes (
430  IN UINT8 Type,
431  IN UINT8 Option
432  );
433
434/**
435  Display System Event Log (Type 15) types.
436
437  @param[in] Type       The key of the structure.
438  @param[in] Option     The optional information.
439**/
440VOID
441DisplaySELTypes (
442  IN UINT8 Type,
443  IN UINT8 Option
444  );
445
446/**
447  Display System Event Log (Type 15) format type.
448
449  @param[in] Type       The key of the structure.
450  @param[in] Option     The optional information.
451**/
452VOID
453DisplaySELVarDataFormatType (
454  IN UINT8 Type,
455  IN UINT8 Option
456  );
457
458/**
459  Display System Event Log (Type 15) dw1.
460
461  @param[in] Key        The key of the structure.
462  @param[in] Option     The optional information.
463**/
464VOID
465DisplayPostResultsBitmapDw1 (
466  IN UINT32  Key,
467  IN UINT8   Option
468  );
469
470/**
471  Display System Event Log (Type 15) dw2.
472
473  @param[in] Key        The key of the structure.
474  @param[in] Option     The optional information.
475**/
476VOID
477DisplayPostResultsBitmapDw2 (
478  IN UINT32  Key,
479  IN UINT8   Option
480  );
481
482/**
483  Display System Event Log (Type 15) type.
484
485  @param[in] SMType     The key of the structure.
486  @param[in] Option     The optional information.
487**/
488VOID
489DisplaySELSysManagementTypes (
490  IN UINT32  SMType,
491  IN UINT8   Option
492  );
493
494/**
495  Display Physical Memory Array (Type 16) Location.
496
497  @param[in] Location   The key of the structure.
498  @param[in] Option     The optional information.
499**/
500VOID
501DisplayPMALocation (
502  IN UINT8 Location,
503  IN UINT8 Option
504  );
505
506/**
507  Display Physical Memory Array (Type 16) Use.
508
509  @param[in] Use        The key of the structure.
510  @param[in] Option     The optional information.
511**/
512VOID
513DisplayPMAUse (
514  IN UINT8 Use,
515  IN UINT8 Option
516  );
517
518/**
519  Display Physical Memory Array (Type 16) Types.
520
521  @param[in] Type       The key of the structure.
522  @param[in] Option     The optional information.
523**/
524VOID
525DisplayPMAErrorCorrectionTypes (
526  IN UINT8 Type,
527  IN UINT8 Option
528  );
529
530/**
531  Display Memory Device (Type 17) form factor.
532
533  @param[in] FormFactor The key of the structure.
534  @param[in] Option     The optional information.
535**/
536VOID
537DisplayMemoryDeviceFormFactor (
538  IN UINT8 FormFactor,
539  IN UINT8 Option
540  );
541
542/**
543  Display Memory Device (Type 17) type.
544
545  @param[in] Type     The key of the structure.
546  @param[in] Option   The optional information.
547**/
548VOID
549DisplayMemoryDeviceType (
550  IN UINT8 Type,
551  IN UINT8 Option
552  );
553
554/**
555  Display Memory Device (Type 17) details.
556
557  @param[in] Para     The key of the structure.
558  @param[in] Option   The optional information.
559**/
560VOID
561DisplayMemoryDeviceTypeDetail (
562  IN UINT16  Para,
563  IN UINT8   Option
564  );
565
566/**
567  Display 32-bit Memory Error Information (Type 18) type.
568
569  @param[in] ErrorType  The key of the structure.
570  @param[in] Option     The optional information.
571**/
572VOID
573DisplayMemoryErrorType (
574  IN UINT8 ErrorType,
575  IN UINT8 Option
576  );
577
578/**
579  Display 32-bit Memory Error Information (Type 18) error granularity.
580
581  @param[in] Granularity  The key of the structure.
582  @param[in] Option       The optional information.
583**/
584VOID
585DisplayMemoryErrorGranularity (
586  IN UINT8 Granularity,
587  IN UINT8 Option
588  );
589
590/**
591  Display 32-bit Memory Error Information (Type 18) error information.
592
593  @param[in] Operation  The key of the structure.
594  @param[in] Option     The optional information.
595**/
596VOID
597DisplayMemoryErrorOperation (
598  IN UINT8 Operation,
599  IN UINT8 Option
600  );
601
602/**
603  Display Built-in Pointing Device (Type 21) type information.
604
605  @param[in] Type     The key of the structure.
606  @param[in] Option   The optional information.
607**/
608VOID
609DisplayPointingDeviceType (
610  IN UINT8 Type,
611  IN UINT8 Option
612  );
613
614/**
615  Display Built-in Pointing Device (Type 21) information.
616
617  @param[in] Interface  The key of the structure.
618  @param[in] Option     The optional information.
619**/
620VOID
621DisplayPointingDeviceInterface (
622  IN UINT8   Interface,
623  IN UINT8   Option
624  );
625
626/**
627  Display Portable Battery  (Type 22) information.
628
629  @param[in] Key      The key of the structure.
630  @param[in] Option   The optional information.
631**/
632VOID
633DisplayPBDeviceChemistry (
634  IN UINT8 Key,
635  IN UINT8 Option
636  );
637
638/**
639  Display Voltage Probe (Type 26) location information.
640
641  @param[in] Key      The key of the structure.
642  @param[in] Option   The optional information.
643**/
644VOID
645DisplayVPLocation (
646  IN UINT8 Key,
647  IN UINT8 Option
648  );
649
650/**
651  Display Voltage Probe (Type 26) status ype information.
652
653  @param[in] Key      The key of the structure.
654  @param[in] Option   The optional information.
655**/
656VOID
657DisplayVPStatus (
658  IN UINT8 Key,
659  IN UINT8 Option
660  );
661
662/**
663  Display Cooling (Type 27) status information.
664
665  @param[in] Key      The key of the structure.
666  @param[in] Option   The optional information.
667**/
668VOID
669DisplayCoolingDeviceStatus (
670  IN UINT8 Key,
671  IN UINT8 Option
672  );
673
674/**
675  Display Cooling (Type 27) type information.
676
677  @param[in] Key      The key of the structure.
678  @param[in] Option   The optional information.
679**/
680VOID
681DisplayCoolingDeviceType (
682  IN UINT8 Key,
683  IN UINT8 Option
684  );
685
686/**
687  Display Temperature Probe (Type 28) status information.
688
689  @param[in] Key      The key of the structure.
690  @param[in] Option   The optional information.
691**/
692VOID
693DisplayTemperatureProbeStatus (
694  IN UINT8 Key,
695  IN UINT8 Option
696  );
697
698/**
699  Display Temperature Probe  (Type 28) location information.
700
701  @param[in] Key      The key of the structure.
702  @param[in] Option   The optional information.
703**/
704VOID
705DisplayTemperatureProbeLoc (
706  IN UINT8 Key,
707  IN UINT8 Option
708  );
709
710/**
711  Display Electrical Current Probe (Type 29)  status information.
712
713  @param[in] Key      The key of the structure.
714  @param[in] Option   The optional information.
715**/
716VOID
717DisplayECPStatus (
718  IN UINT8 Key,
719  IN UINT8 Option
720  );
721
722/**
723  Display Electrical Current Probe (Type 29) location information.
724
725  @param[in] Key      The key of the structure.
726  @param[in] Option   The optional information.
727**/
728VOID
729DisplayECPLoc (
730  IN UINT8 Key,
731  IN UINT8 Option
732  );
733
734/**
735  Display Management Device (Type 34) Type.
736
737  @param[in] Key      The key of the structure.
738  @param[in] Option   The optional information.
739**/
740VOID
741DisplayMDType (
742  IN UINT8 Key,
743  IN UINT8 Option
744  );
745
746/**
747  Display Management Device (Type 34) Address Type.
748
749  @param[in] Key      The key of the structure.
750  @param[in] Option   The optional information.
751**/
752VOID
753DisplayMDAddressType (
754  IN UINT8 Key,
755  IN UINT8 Option
756  );
757
758/**
759  Display Memory Channel (Type 37) information.
760
761  @param[in] Key      The key of the structure.
762  @param[in] Option   The optional information.
763**/
764VOID
765DisplayMemoryChannelType (
766  IN UINT8 Key,
767  IN UINT8 Option
768  );
769
770/**
771  Display IPMI Device Information (Type 38) information.
772
773  @param[in] Key      The key of the structure.
774  @param[in] Option   The optional information.
775**/
776VOID
777DisplayIPMIDIBMCInterfaceType (
778  IN UINT8 Key,
779  IN UINT8 Option
780  );
781
782#endif
783