6 * System Management BIOS
10 FILE_LICENCE ( GPL2_OR_LATER );
14 #include <config/general.h>
15 #include <ipxe/uaccess.h>
18 * Provide an SMBIOS API implementation
20 * @v _prefix Subsystem prefix
21 * @v _api_func API function
22 * @v _func Implementing function
24 #define PROVIDE_SMBIOS( _subsys, _api_func, _func ) \
25 PROVIDE_SINGLE_API ( SMBIOS_PREFIX_ ## _subsys, _api_func, _func )
27 /* Include all architecture-independent SMBIOS API headers */
28 #include <ipxe/efi/efi_smbios.h>
29 #include <ipxe/linux/linux_smbios.h>
31 /* Include all architecture-dependent SMBIOS API headers */
32 #include <bits/smbios.h>
34 /** Signature for SMBIOS entry point */
35 #define SMBIOS_SIGNATURE \
36 ( ( '_' << 0 ) + ( 'S' << 8 ) + ( 'M' << 16 ) + ( '_' << 24 ) )
41 * This is the single table which describes the list of SMBIOS
42 * structures. It is located by scanning through the BIOS segment.
47 * Must be equal to SMBIOS_SIGNATURE
58 /** Maximum structure size */
60 /** Entry point revision */
65 uint8_t dmi_signature[5];
68 /** Structure table length */
70 /** Structure table address */
71 uint32_t smbios_address;
72 /** Number of SMBIOS structures */
73 uint16_t smbios_count;
76 } __attribute__ (( packed ));
78 /** An SMBIOS structure header */
79 struct smbios_header {
86 } __attribute__ (( packed ));
88 /** SMBIOS structure descriptor */
89 struct smbios_structure {
90 /** Copy of SMBIOS structure header */
91 struct smbios_header header;
92 /** Offset of structure within SMBIOS */
94 /** Length of strings section */
98 /** SMBIOS system information structure */
99 struct smbios_system_information {
100 /** SMBIOS structure header */
101 struct smbios_header header;
102 /** Manufacturer string */
103 uint8_t manufacturer;
104 /** Product string */
106 /** Version string */
108 /** Serial number string */
114 } __attribute__ (( packed ));
116 /** SMBIOS system information structure type */
117 #define SMBIOS_TYPE_SYSTEM_INFORMATION 1
119 /** SMBIOS base board information structure */
120 struct smbios_base_board_information {
121 /** SMBIOS structure header */
122 struct smbios_header header;
123 /** Manufacturer string */
124 uint8_t manufacturer;
125 /** Product string */
127 /** Version string */
129 /** Serial number string */
131 } __attribute__ (( packed ));
133 /** SMBIOS base board information structure type */
134 #define SMBIOS_TYPE_BASE_BOARD_INFORMATION 2
136 /** SMBIOS enclosure information structure */
137 struct smbios_enclosure_information {
138 /** SMBIOS structure header */
139 struct smbios_header header;
140 /** Manufacturer string */
141 uint8_t manufacturer;
144 /** Version string */
146 /** Serial number string */
150 } __attribute__ (( packed ));
152 /** SMBIOS enclosure information structure type */
153 #define SMBIOS_TYPE_ENCLOSURE_INFORMATION 3
156 * SMBIOS entry point descriptor
158 * This contains the information from the SMBIOS entry point that we
162 /** Start of SMBIOS structures */
164 /** Length of SMBIOS structures */
166 /** Number of SMBIOS structures */
168 /** SMBIOS version */
173 * Calculate SMBIOS version
175 * @v major Major version
176 * @v minor Minor version
177 * @ret version SMBIOS version
179 #define SMBIOS_VERSION( major, minor ) ( ( (major) << 8 ) | (minor) )
181 extern int find_smbios ( struct smbios *smbios );
182 extern int find_smbios_entry ( userptr_t start, size_t len,
183 struct smbios_entry *entry );
184 extern int find_smbios_structure ( unsigned int type, unsigned int instance,
185 struct smbios_structure *structure );
186 extern int read_smbios_structure ( struct smbios_structure *structure,
187 void *data, size_t len );
188 extern int read_smbios_string ( struct smbios_structure *structure,
190 void *data, size_t len );
191 extern int smbios_version ( void );
193 #endif /* _IPXE_SMBIOS_H */