iPXE
smbios.h
Go to the documentation of this file.
1#ifndef _IPXE_SMBIOS_H
2#define _IPXE_SMBIOS_H
4/** @file
5 *
6 * System Management BIOS
7 *
8 */
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11FILE_SECBOOT ( PERMITTED );
13#include <stdint.h>
14#include <ipxe/api.h>
15#include <config/general.h>
17/**
18 * Provide an SMBIOS API implementation
19 *
20 * @v _prefix Subsystem prefix
21 * @v _api_func API function
22 * @v _func Implementing function
23 */
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 */
29#include <ipxe/efi/efi_smbios.h>
31
32/* Include all architecture-dependent SMBIOS API headers */
33#include <bits/smbios.h>
34
35/** Signature for 32-bit SMBIOS entry point */
36#define SMBIOS_SIGNATURE \
37 ( ( '_' << 0 ) + ( 'S' << 8 ) + ( 'M' << 16 ) + ( '_' << 24 ) )
38
39/** Signature for 64-bit SMBIOS entry point */
40#define SMBIOS3_SIGNATURE \
41 ( ( '_' << 0 ) + ( 'S' << 8 ) + ( 'M' << 16 ) + ( '3' << 24 ) )
42
43/**
44 * SMBIOS 32-bit entry point
45 *
46 * This is the 32-bit version of the table which describes the list of
47 * SMBIOS structures. It may be located by scanning through the BIOS
48 * segment or via an EFI configuration table.
49 */
51 /** Signature
52 *
53 * Must be equal to SMBIOS_SIGNATURE
54 */
56 /** Checksum */
58 /** Length */
60 /** Major version */
62 /** Minor version */
64 /** Maximum structure size */
66 /** Entry point revision */
68 /** Formatted area */
70 /** DMI Signature */
72 /** DMI checksum */
74 /** Structure table length */
76 /** Structure table address */
78 /** Number of SMBIOS structures */
80 /** BCD revision */
82} __attribute__ (( packed ));
83
84/**
85 * SMBIOS 64-bit entry point
86 *
87 * This is the 64-bit version of the table which describes the list of
88 * SMBIOS structures. It may be located by scanning through the BIOS
89 * segment or via an EFI configuration table.
90 */
92 /** Signature
93 *
94 * Must be equal to SMBIOS3_SIGNATURE
95 */
97 /** Signature extra byte */
99 /** Checksum */
101 /** Length */
103 /** Major version */
105 /** Minor version */
107 /** Documentation revision */
109 /** Entry point revision */
111 /** Reserved */
113 /** Structure table length */
115 /** Structure table address */
117} __attribute__ (( packed ));
118
119/** An SMBIOS structure header */
121 /** Type */
123 /** Length */
125 /** Handle */
127} __attribute__ (( packed ));
128
129/** SMBIOS system information structure */
131 /** SMBIOS structure header */
133 /** Manufacturer string */
135 /** Product string */
137 /** Version string */
139 /** Serial number string */
141 /** UUID */
143 /** Wake-up type */
145} __attribute__ (( packed ));
146
147/** SMBIOS system information structure type */
148#define SMBIOS_TYPE_SYSTEM_INFORMATION 1
149
150/** SMBIOS base board information structure */
152 /** SMBIOS structure header */
154 /** Manufacturer string */
156 /** Product string */
158 /** Version string */
160 /** Serial number string */
162} __attribute__ (( packed ));
163
164/** SMBIOS base board information structure type */
165#define SMBIOS_TYPE_BASE_BOARD_INFORMATION 2
166
167/** SMBIOS enclosure information structure */
169 /** SMBIOS structure header */
171 /** Manufacturer string */
173 /** Type string */
175 /** Version string */
177 /** Serial number string */
179 /** Asset tag */
181} __attribute__ (( packed ));
182
183/** SMBIOS enclosure information structure type */
184#define SMBIOS_TYPE_ENCLOSURE_INFORMATION 3
185
186/** SMBIOS OEM strings structure type */
187#define SMBIOS_TYPE_OEM_STRINGS 11
188
189/** SMBIOS end of table type */
190#define SMBIOS_TYPE_END 127
191
192/**
193 * SMBIOS entry point descriptor
194 *
195 * This contains the information from the SMBIOS entry point that we
196 * care about.
197 */
198struct smbios {
199 /** Start of SMBIOS structures */
200 const void *address;
201 /** Length of SMBIOS structures */
202 size_t len;
203 /** Number of SMBIOS structures */
204 unsigned int count;
205 /** SMBIOS version */
208
209/**
210 * Calculate SMBIOS version
211 *
212 * @v major Major version
213 * @v minor Minor version
214 * @ret version SMBIOS version
215 */
216#define SMBIOS_VERSION( major, minor ) ( ( (major) << 8 ) | (minor) )
217
218extern int find_smbios ( struct smbios *smbios );
219extern const struct smbios_entry * find_smbios_entry ( const void *start,
220 size_t len );
221extern const struct smbios3_entry * find_smbios3_entry ( const void *start,
222 size_t len );
223extern const struct smbios_header * smbios_structure ( unsigned int type,
224 unsigned int instance );
225extern const char * smbios_string ( const struct smbios_header *header,
226 unsigned int index );
227extern int smbios_version ( void );
228extern void smbios_clear ( void );
229
230#endif /* _IPXE_SMBIOS_H */
iPXE internal APIs
unsigned short uint16_t
Definition stdint.h:11
unsigned int uint32_t
Definition stdint.h:12
unsigned long long uint64_t
Definition stdint.h:13
unsigned char uint8_t
Definition stdint.h:10
long index
Definition bigint.h:65
x86-specific SMBIOS API implementations
ring len
Length.
Definition dwmac.h:226
iPXE SMBIOS API for EFI
uint32_t type
Operating system type.
Definition ena.h:1
struct ena_llq_option header
Header locations.
Definition ena.h:5
General configuration.
uint32_t start
Starting offset.
Definition netvsc.h:1
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
struct smbios __attribute__
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
const struct smbios_entry * find_smbios_entry(const void *start, size_t len)
Scan for SMBIOS 32-bit entry point structure.
Definition smbios.c:70
void smbios_clear(void)
Clear SMBIOS entry point descriptor.
Definition smbios.c:301
int find_smbios(struct smbios *smbios)
const struct smbios3_entry * find_smbios3_entry(const void *start, size_t len)
Scan for SMBIOS 64-bit entry point structure.
Definition smbios.c:116
const struct smbios_header * smbios_structure(unsigned int type, unsigned int instance)
Find specific structure type within SMBIOS.
Definition smbios.c:183
const char * smbios_string(const struct smbios_header *header, unsigned int index)
Get indexed string within SMBIOS structure.
Definition smbios.c:252
int smbios_version(void)
Get SMBIOS version.
Definition smbios.c:285
iPXE SMBIOS API for Linux
Null SMBIOS API.
SMBIOS 64-bit entry point.
Definition smbios.h:91
uint8_t major
Major version.
Definition smbios.h:104
uint8_t len
Length.
Definition smbios.h:102
uint8_t reserved
Reserved.
Definition smbios.h:112
uint64_t smbios_address
Structure table address.
Definition smbios.h:116
uint8_t minor
Minor version.
Definition smbios.h:106
uint8_t checksum
Checksum.
Definition smbios.h:100
uint32_t signature
Signature.
Definition smbios.h:96
uint32_t smbios_len
Structure table length.
Definition smbios.h:114
uint8_t revision
Entry point revision.
Definition smbios.h:110
uint8_t docrev
Documentation revision.
Definition smbios.h:108
uint8_t extra
Signature extra byte.
Definition smbios.h:98
SMBIOS base board information structure.
Definition smbios.h:151
uint8_t serial
Serial number string.
Definition smbios.h:161
uint8_t product
Product string.
Definition smbios.h:157
uint8_t manufacturer
Manufacturer string.
Definition smbios.h:155
struct smbios_header header
SMBIOS structure header.
Definition smbios.h:153
uint8_t version
Version string.
Definition smbios.h:159
SMBIOS enclosure information structure.
Definition smbios.h:168
uint8_t serial
Serial number string.
Definition smbios.h:178
uint8_t manufacturer
Manufacturer string.
Definition smbios.h:172
uint8_t type
Type string.
Definition smbios.h:174
struct smbios_header header
SMBIOS structure header.
Definition smbios.h:170
uint8_t version
Version string.
Definition smbios.h:176
uint8_t asset_tag
Asset tag.
Definition smbios.h:180
SMBIOS 32-bit entry point.
Definition smbios.h:50
uint32_t smbios_address
Structure table address.
Definition smbios.h:77
uint8_t bcd_revision
BCD revision.
Definition smbios.h:81
uint8_t minor
Minor version.
Definition smbios.h:63
uint32_t signature
Signature.
Definition smbios.h:55
uint16_t max
Maximum structure size.
Definition smbios.h:65
uint16_t smbios_count
Number of SMBIOS structures.
Definition smbios.h:79
uint16_t smbios_len
Structure table length.
Definition smbios.h:75
uint8_t major
Major version.
Definition smbios.h:61
uint8_t checksum
Checksum.
Definition smbios.h:57
uint8_t formatted[5]
Formatted area.
Definition smbios.h:69
uint8_t dmi_signature[5]
DMI Signature.
Definition smbios.h:71
uint8_t revision
Entry point revision.
Definition smbios.h:67
uint8_t dmi_checksum
DMI checksum.
Definition smbios.h:73
uint8_t len
Length.
Definition smbios.h:59
An SMBIOS structure header.
Definition smbios.h:120
uint16_t handle
Handle.
Definition smbios.h:126
uint8_t len
Length.
Definition smbios.h:124
uint8_t type
Type.
Definition smbios.h:122
SMBIOS system information structure.
Definition smbios.h:130
uint8_t serial
Serial number string.
Definition smbios.h:140
uint8_t version
Version string.
Definition smbios.h:138
uint8_t wakeup
Wake-up type.
Definition smbios.h:144
uint8_t uuid[16]
UUID.
Definition smbios.h:142
uint8_t product
Product string.
Definition smbios.h:136
uint8_t manufacturer
Manufacturer string.
Definition smbios.h:134
struct smbios_header header
SMBIOS structure header.
Definition smbios.h:132
SMBIOS entry point descriptor.
Definition smbios.h:198
size_t len
Length of SMBIOS structures.
Definition smbios.h:202
unsigned int count
Number of SMBIOS structures.
Definition smbios.h:204
uint16_t version
SMBIOS version.
Definition smbios.h:206
const void * address
Start of SMBIOS structures.
Definition smbios.h:200