2 This code supports the implementation of the Smbios protocol
4 Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #define _SMBIOS_DXE_H_
14 #include <Protocol/Smbios.h>
15 #include <IndustryStandard/SmBios.h>
16 #include <Guid/EventGroup.h>
17 #include <Guid/SmBios.h>
18 #include <Library/DebugLib.h>
19 #include <Library/UefiDriverEntryPoint.h>
20 #include <Library/UefiLib.h>
21 #include <Library/BaseLib.h>
22 #include <Library/BaseMemoryLib.h>
23 #include <Library/MemoryAllocationLib.h>
24 #include <Library/UefiBootServicesTableLib.h>
25 #include <Library/PcdLib.h>
26 #include <Library/HobLib.h>
27 #include <UniversalPayload/SmbiosTable.h>
29 #define SMBIOS_INSTANCE_SIGNATURE SIGNATURE_32 ('S', 'B', 'i', 's')
36 EFI_SMBIOS_PROTOCOL Smbios
;
38 // Updates to record list must be locked.
42 // List of EFI_SMBIOS_ENTRY structures.
44 LIST_ENTRY DataListHead
;
46 // List of allocated SMBIOS handle.
48 LIST_ENTRY AllocatedHandleListHead
;
51 #define SMBIOS_INSTANCE_FROM_THIS(this) CR (this, SMBIOS_INSTANCE, Smbios, SMBIOS_INSTANCE_SIGNATURE)
54 // SMBIOS record Header
56 // An SMBIOS internal Record is an EFI_SMBIOS_RECORD_HEADER followed by (RecordSize - HeaderSize) bytes of
57 // data. The format of the data is defined by the SMBIOS spec.
60 #define EFI_SMBIOS_RECORD_HEADER_VERSION 0x0100
65 EFI_HANDLE ProducerHandle
;
66 UINTN NumberOfStrings
;
67 } EFI_SMBIOS_RECORD_HEADER
;
70 // Private data structure to contain the SMBIOS record. One record per
71 // structure. SmbiosRecord is a copy of the data passed in and follows RecordHeader .
73 #define EFI_SMBIOS_ENTRY_SIGNATURE SIGNATURE_32 ('S', 'r', 'e', 'c')
77 EFI_SMBIOS_RECORD_HEADER
*RecordHeader
;
80 // Indicate which table this record is added to.
82 BOOLEAN Smbios32BitTable
;
83 BOOLEAN Smbios64BitTable
;
86 #define SMBIOS_ENTRY_FROM_LINK(link) CR (link, EFI_SMBIOS_ENTRY, Link, EFI_SMBIOS_ENTRY_SIGNATURE)
89 // Private data to contain the Smbios handle that already allocated.
91 #define SMBIOS_HANDLE_ENTRY_SIGNATURE SIGNATURE_32 ('S', 'h', 'r', 'd')
97 // Filter driver will register what record guid filter should be used.
99 EFI_SMBIOS_HANDLE SmbiosHandle
;
100 } SMBIOS_HANDLE_ENTRY
;
102 #define SMBIOS_HANDLE_ENTRY_FROM_LINK(link) CR (link, SMBIOS_HANDLE_ENTRY, Link, SMBIOS_HANDLE_ENTRY_SIGNATURE)
105 EFI_SMBIOS_TABLE_HEADER Header
;
107 } EFI_SMBIOS_TABLE_END_STRUCTURE
;
110 Create Smbios Table and installs the Smbios Table to the System Table.
112 @param Smbios32BitTable The flag to update 32-bit table.
113 @param Smbios64BitTable The flag to update 64-bit table.
118 SmbiosTableConstruction (
119 BOOLEAN Smbios32BitTable
,
120 BOOLEAN Smbios64BitTable
124 Validates a SMBIOS 3.0 table entry point.
126 @param TableEntry The SmBios table entry to validate.
127 @param TableAddress On exit, point to the smbios table addres.
128 @param TableMaximumSize On exit, point to the maximum size of the table.
130 @retval TRUE SMBIOS table entry point is valid.
131 @retval FALSE SMBIOS table entry point is malformed.
136 IsValidSmbios30Table (
138 OUT VOID
**TableAddress
,
139 OUT UINTN
*TableMaximumSize
,
140 OUT UINT8
*MajorVersion
,
141 OUT UINT8
*MinorVersion
145 Validates a SMBIOS 2.0 table entry point.
147 @param TableEntry The SmBios table entry to validate.
148 @param TableAddress On exit, point to the smbios table addres.
149 @param TableMaximumSize On exit, point to the maximum size of the table.
151 @retval TRUE SMBIOS table entry point is valid.
152 @retval FALSE SMBIOS table entry point is malformed.
157 IsValidSmbios20Table (
159 OUT VOID
**TableAddress
,
160 OUT UINTN
*TableMaximumSize
,
161 OUT UINT8
*MajorVersion
,
162 OUT UINT8
*MinorVersion
166 Validates a SMBIOS table entry point.
168 @param TableEntry The SmBios table entry to validate.
169 @param TableAddress On exit, point to the smbios table addres.
170 @param TableMaximumSize On exit, point to the maximum size of the table.
172 @retval TRUE SMBIOS table entry point is valid.
173 @retval FALSE SMBIOS table entry point is malformed.
178 (*IS_SMBIOS_TABLE_VALID
) (
180 OUT VOID
**TableAddress
,
181 OUT UINTN
*TableMaximumSize
,
182 OUT UINT8
*MajorVersion
,
183 OUT UINT8
*MinorVersion
187 IS_SMBIOS_TABLE_VALID IsValid
;
188 } IS_SMBIOS_TABLE_VALID_ENTRY
;