]>
Commit | Line | Data |
---|---|---|
310b04e6 | 1 | /** @file\r |
2 | This code supports the implementation of the Smbios protocol\r | |
d1102dba | 3 | \r |
70e8c9c3 | 4 | Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.<BR>\r |
9d510e61 | 5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
310b04e6 | 6 | \r |
7 | **/\r | |
8 | \r | |
9 | #ifndef _SMBIOS_DXE_H_\r | |
10 | #define _SMBIOS_DXE_H_\r | |
11 | \r | |
310b04e6 | 12 | #include <PiDxe.h>\r |
13 | \r | |
14 | #include <Protocol/Smbios.h>\r | |
15 | #include <IndustryStandard/SmBios.h>\r | |
16 | #include <Guid/EventGroup.h>\r | |
17 | #include <Guid/SmBios.h>\r | |
18 | #include <Library/DebugLib.h>\r | |
19 | #include <Library/UefiDriverEntryPoint.h>\r | |
20 | #include <Library/UefiLib.h>\r | |
21 | #include <Library/BaseLib.h>\r | |
22 | #include <Library/BaseMemoryLib.h>\r | |
23 | #include <Library/MemoryAllocationLib.h>\r | |
24 | #include <Library/UefiBootServicesTableLib.h>\r | |
9f7d5b46 | 25 | #include <Library/PcdLib.h>\r |
70e8c9c3 ZL |
26 | #include <Library/HobLib.h>\r |
27 | #include <UniversalPayload/SmbiosTable.h>\r | |
310b04e6 | 28 | \r |
1436aea4 | 29 | #define SMBIOS_INSTANCE_SIGNATURE SIGNATURE_32 ('S', 'B', 'i', 's')\r |
310b04e6 | 30 | typedef struct {\r |
1436aea4 MK |
31 | UINT32 Signature;\r |
32 | EFI_HANDLE Handle;\r | |
310b04e6 | 33 | //\r |
34 | // Produced protocol\r | |
35 | //\r | |
1436aea4 | 36 | EFI_SMBIOS_PROTOCOL Smbios;\r |
310b04e6 | 37 | //\r |
38 | // Updates to record list must be locked.\r | |
39 | //\r | |
1436aea4 | 40 | EFI_LOCK DataLock;\r |
310b04e6 | 41 | //\r |
42 | // List of EFI_SMBIOS_ENTRY structures.\r | |
43 | //\r | |
1436aea4 | 44 | LIST_ENTRY DataListHead;\r |
310b04e6 | 45 | //\r |
46 | // List of allocated SMBIOS handle.\r | |
47 | //\r | |
1436aea4 | 48 | LIST_ENTRY AllocatedHandleListHead;\r |
310b04e6 | 49 | } SMBIOS_INSTANCE;\r |
50 | \r | |
51 | #define SMBIOS_INSTANCE_FROM_THIS(this) CR (this, SMBIOS_INSTANCE, Smbios, SMBIOS_INSTANCE_SIGNATURE)\r | |
52 | \r | |
53 | //\r | |
54 | // SMBIOS record Header\r | |
55 | //\r | |
56 | // An SMBIOS internal Record is an EFI_SMBIOS_RECORD_HEADER followed by (RecordSize - HeaderSize) bytes of\r | |
57 | // data. The format of the data is defined by the SMBIOS spec.\r | |
58 | //\r | |
59 | //\r | |
60 | #define EFI_SMBIOS_RECORD_HEADER_VERSION 0x0100\r | |
61 | typedef struct {\r | |
1436aea4 MK |
62 | UINT16 Version;\r |
63 | UINT16 HeaderSize;\r | |
64 | UINTN RecordSize;\r | |
65 | EFI_HANDLE ProducerHandle;\r | |
66 | UINTN NumberOfStrings;\r | |
310b04e6 | 67 | } EFI_SMBIOS_RECORD_HEADER;\r |
68 | \r | |
310b04e6 | 69 | //\r |
70 | // Private data structure to contain the SMBIOS record. One record per\r | |
71 | // structure. SmbiosRecord is a copy of the data passed in and follows RecordHeader .\r | |
72 | //\r | |
73 | #define EFI_SMBIOS_ENTRY_SIGNATURE SIGNATURE_32 ('S', 'r', 'e', 'c')\r | |
74 | typedef struct {\r | |
1436aea4 MK |
75 | UINT32 Signature;\r |
76 | LIST_ENTRY Link;\r | |
77 | EFI_SMBIOS_RECORD_HEADER *RecordHeader;\r | |
78 | UINTN RecordSize;\r | |
e63f3308 EL |
79 | //\r |
80 | // Indicate which table this record is added to.\r | |
81 | //\r | |
1436aea4 MK |
82 | BOOLEAN Smbios32BitTable;\r |
83 | BOOLEAN Smbios64BitTable;\r | |
310b04e6 | 84 | } EFI_SMBIOS_ENTRY;\r |
85 | \r | |
86 | #define SMBIOS_ENTRY_FROM_LINK(link) CR (link, EFI_SMBIOS_ENTRY, Link, EFI_SMBIOS_ENTRY_SIGNATURE)\r | |
87 | \r | |
88 | //\r | |
89 | // Private data to contain the Smbios handle that already allocated.\r | |
90 | //\r | |
91 | #define SMBIOS_HANDLE_ENTRY_SIGNATURE SIGNATURE_32 ('S', 'h', 'r', 'd')\r | |
92 | \r | |
93 | typedef struct {\r | |
94 | UINT32 Signature;\r | |
95 | LIST_ENTRY Link;\r | |
96 | //\r | |
97 | // Filter driver will register what record guid filter should be used.\r | |
98 | //\r | |
99 | EFI_SMBIOS_HANDLE SmbiosHandle;\r | |
310b04e6 | 100 | } SMBIOS_HANDLE_ENTRY;\r |
101 | \r | |
102 | #define SMBIOS_HANDLE_ENTRY_FROM_LINK(link) CR (link, SMBIOS_HANDLE_ENTRY, Link, SMBIOS_HANDLE_ENTRY_SIGNATURE)\r | |
103 | \r | |
104 | typedef struct {\r | |
1436aea4 MK |
105 | EFI_SMBIOS_TABLE_HEADER Header;\r |
106 | UINT8 Tailing[2];\r | |
310b04e6 | 107 | } EFI_SMBIOS_TABLE_END_STRUCTURE;\r |
108 | \r | |
0ddd8553 | 109 | /**\r |
110 | Create Smbios Table and installs the Smbios Table to the System Table.\r | |
d1102dba | 111 | \r |
e63f3308 EL |
112 | @param Smbios32BitTable The flag to update 32-bit table.\r |
113 | @param Smbios64BitTable The flag to update 64-bit table.\r | |
d1102dba | 114 | \r |
0ddd8553 | 115 | **/\r |
116 | VOID\r | |
117 | EFIAPI\r | |
118 | SmbiosTableConstruction (\r | |
1436aea4 MK |
119 | BOOLEAN Smbios32BitTable,\r |
120 | BOOLEAN Smbios64BitTable\r | |
0ddd8553 | 121 | );\r |
122 | \r | |
70e8c9c3 ZL |
123 | /**\r |
124 | Validates a SMBIOS 3.0 table entry point.\r | |
125 | \r | |
126 | @param TableEntry The SmBios table entry to validate.\r | |
127 | @param TableAddress On exit, point to the smbios table addres.\r | |
128 | @param TableMaximumSize On exit, point to the maximum size of the table.\r | |
129 | \r | |
130 | @retval TRUE SMBIOS table entry point is valid.\r | |
131 | @retval FALSE SMBIOS table entry point is malformed.\r | |
132 | \r | |
133 | **/\r | |
134 | STATIC\r | |
135 | BOOLEAN\r | |
136 | IsValidSmbios30Table (\r | |
1436aea4 MK |
137 | IN VOID *TableEntry,\r |
138 | OUT VOID **TableAddress,\r | |
809b5a3d KL |
139 | OUT UINTN *TableMaximumSize,\r |
140 | OUT UINT8 *MajorVersion,\r | |
141 | OUT UINT8 *MinorVersion\r | |
70e8c9c3 ZL |
142 | );\r |
143 | \r | |
144 | /**\r | |
145 | Validates a SMBIOS 2.0 table entry point.\r | |
146 | \r | |
147 | @param TableEntry The SmBios table entry to validate.\r | |
148 | @param TableAddress On exit, point to the smbios table addres.\r | |
149 | @param TableMaximumSize On exit, point to the maximum size of the table.\r | |
150 | \r | |
151 | @retval TRUE SMBIOS table entry point is valid.\r | |
152 | @retval FALSE SMBIOS table entry point is malformed.\r | |
153 | \r | |
154 | **/\r | |
155 | STATIC\r | |
156 | BOOLEAN\r | |
157 | IsValidSmbios20Table (\r | |
1436aea4 MK |
158 | IN VOID *TableEntry,\r |
159 | OUT VOID **TableAddress,\r | |
809b5a3d KL |
160 | OUT UINTN *TableMaximumSize,\r |
161 | OUT UINT8 *MajorVersion,\r | |
162 | OUT UINT8 *MinorVersion\r | |
70e8c9c3 ZL |
163 | );\r |
164 | \r | |
165 | /**\r | |
166 | Validates a SMBIOS table entry point.\r | |
167 | \r | |
168 | @param TableEntry The SmBios table entry to validate.\r | |
169 | @param TableAddress On exit, point to the smbios table addres.\r | |
170 | @param TableMaximumSize On exit, point to the maximum size of the table.\r | |
171 | \r | |
172 | @retval TRUE SMBIOS table entry point is valid.\r | |
173 | @retval FALSE SMBIOS table entry point is malformed.\r | |
174 | \r | |
175 | **/\r | |
176 | typedef\r | |
177 | BOOLEAN\r | |
1436aea4 MK |
178 | (*IS_SMBIOS_TABLE_VALID) (\r |
179 | IN VOID *TableEntry,\r | |
180 | OUT VOID **TableAddress,\r | |
809b5a3d KL |
181 | OUT UINTN *TableMaximumSize,\r |
182 | OUT UINT8 *MajorVersion,\r | |
183 | OUT UINT8 *MinorVersion\r | |
70e8c9c3 ZL |
184 | );\r |
185 | typedef struct {\r | |
1436aea4 MK |
186 | EFI_GUID *Guid;\r |
187 | IS_SMBIOS_TABLE_VALID IsValid;\r | |
70e8c9c3 ZL |
188 | } IS_SMBIOS_TABLE_VALID_ENTRY;\r |
189 | \r | |
310b04e6 | 190 | #endif\r |