1 /** @file
2 Header file for the SmbiosMisc Driver.
3 
4 Copyright (c) 2013-2015 Intel Corporation.
5 
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 
17 #ifndef _SMBIOS_MISC_H
18 #define _SMBIOS_MISC_H
19 
20 #include "MiscDevicePath.h"
21 #include <Library/UefiBootServicesTableLib.h>
22 #include <Library/PrintLib.h>
23 
24 ///
25 /// Reference SMBIOS 2.6, chapter 3.1.3.
26 /// Each text string is limited to 64 significant characters due to system MIF limitations.
27 ///
28 #define SMBIOS_STRING_MAX_LENGTH        64
29 #define SMBIOS_PORT_CONNECTOR_MAX_NUM   14
30 
31 typedef struct {
32   CHAR16   PortInternalConnectorDesignator[SMBIOS_STRING_MAX_LENGTH];
33   CHAR16   PortExternalConnectorDesignator[SMBIOS_STRING_MAX_LENGTH];
34   UINT8    PortInternalConnectorType;
35   UINT8    PortExternalConnectorType;
36   UINT8    PortType;
37 } SMBIOS_PORT_CONNECTOR_DESIGNATOR;
38 
39 typedef struct {
40   UINT8                             SMBIOSConnectorNumber;
41   SMBIOS_PORT_CONNECTOR_DESIGNATOR  SMBIOSPortConnector[SMBIOS_PORT_CONNECTOR_MAX_NUM];
42 } SMBIOS_PORT_CONNECTOR_DESIGNATOR_COFNIG;
43 
44 #define SMBIOS_SYSTEM_SLOT_MAX_NUM  14
45 
46 typedef struct {
47   CHAR16    SlotDesignation[SMBIOS_STRING_MAX_LENGTH];
48   UINT8     SlotType;
49   UINT8     SlotDataBusWidth;
50   UINT8     SlotUsage;
51   UINT8     SlotLength;
52   UINT16    SlotId;
53   UINT32    SlotCharacteristics;
54 } SMBIOS_SLOT_DESIGNATION;
55 
56 typedef struct {
57   UINT8                    SMBIOSSystemSlotNumber;
58   SMBIOS_SLOT_DESIGNATION  SMBIOSSystemSlot[SMBIOS_SYSTEM_SLOT_MAX_NUM];
59 } SMBIOS_SLOT_COFNIG;
60 
61 //
62 // Data table entry update function.
63 //
64 typedef EFI_STATUS (EFIAPI EFI_MISC_SMBIOS_DATA_FUNCTION) (
65   IN  VOID                 *RecordData,
66   IN  EFI_SMBIOS_PROTOCOL  *Smbios
67   );
68 
69 
70 //
71 // Data table entry definition.
72 //
73 typedef struct {
74   //
75   // intermediat input data for SMBIOS record
76   //
77   VOID                              *RecordData;
78   EFI_MISC_SMBIOS_DATA_FUNCTION     *Function;
79 } EFI_MISC_SMBIOS_DATA_TABLE;
80 
81 //
82 // Data Table extern definitions.
83 //
84 #define MISC_SMBIOS_DATA_TABLE_POINTER(NAME1) \
85    & NAME1 ## Data
86 
87 //
88 // Data Table extern definitions.
89 //
90 #define MISC_SMBIOS_DATA_TABLE_EXTERNS(NAME1, NAME2) \
91 extern NAME1 NAME2 ## Data
92 
93 //
94 // Data and function Table extern definitions.
95 //
96 #define MISC_SMBIOS_TABLE_EXTERNS(NAME1, NAME2, NAME3) \
97 extern NAME1 NAME2 ## Data; \
98 extern EFI_MISC_SMBIOS_DATA_FUNCTION NAME3 ## Function
99 
100 
101 //
102 // Data Table entries
103 //
104 
105 #define MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(NAME1, NAME2) \
106 { \
107   & NAME1 ## Data, \
108   & NAME2 ## Function \
109 }
110 
111 
112 //
113 // Global definition macros.
114 //
115 #define MISC_SMBIOS_TABLE_DATA(NAME1, NAME2) \
116   NAME1 NAME2 ## Data
117 
118 #define MISC_SMBIOS_TABLE_FUNCTION(NAME2) \
119   EFI_STATUS EFIAPI NAME2 ## Function( \
120   IN  VOID                  *RecordData, \
121   IN  EFI_SMBIOS_PROTOCOL   *Smbios \
122   )
123 
124 
125 // Data Table Array
126 //
127 extern EFI_MISC_SMBIOS_DATA_TABLE   mSmbiosMiscDataTable[];
128 
129 //
130 // Data Table Array Entries
131 //
132 extern UINTN                        mSmbiosMiscDataTableEntries;
133 extern EFI_HII_HANDLE               mHiiHandle;
134 //
135 // Prototypes
136 //
137 EFI_STATUS
138 PiSmbiosMiscEntryPoint (
139   IN EFI_HANDLE         ImageHandle,
140   IN EFI_SYSTEM_TABLE   *SystemTable
141   );
142 
143 #endif
144