iPXE
smbios.h
Go to the documentation of this file.
1 #ifndef _IPXE_SMBIOS_H
2 #define _IPXE_SMBIOS_H
3 
4 /** @file
5  *
6  * System Management BIOS
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 #include <stdint.h>
13 #include <ipxe/api.h>
14 #include <config/general.h>
15 #include <ipxe/uaccess.h>
16 
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 )
26 
27 /* Include all architecture-independent SMBIOS API headers */
28 #include <ipxe/efi/efi_smbios.h>
30 
31 /* Include all architecture-dependent SMBIOS API headers */
32 #include <bits/smbios.h>
33 
34 /** Signature for SMBIOS entry point */
35 #define SMBIOS_SIGNATURE \
36  ( ( '_' << 0 ) + ( 'S' << 8 ) + ( 'M' << 16 ) + ( '_' << 24 ) )
37 
38 /**
39  * SMBIOS entry point
40  *
41  * This is the single table which describes the list of SMBIOS
42  * structures. It is located by scanning through the BIOS segment.
43  */
44 struct smbios_entry {
45  /** Signature
46  *
47  * Must be equal to SMBIOS_SIGNATURE
48  */
50  /** Checksum */
52  /** Length */
54  /** Major version */
56  /** Minor version */
58  /** Maximum structure size */
60  /** Entry point revision */
62  /** Formatted area */
64  /** DMI Signature */
66  /** DMI checksum */
68  /** Structure table length */
70  /** Structure table address */
72  /** Number of SMBIOS structures */
74  /** BCD revision */
76 } __attribute__ (( packed ));
77 
78 /** An SMBIOS structure header */
79 struct smbios_header {
80  /** Type */
82  /** Length */
84  /** Handle */
86 } __attribute__ (( packed ));
87 
88 /** SMBIOS structure descriptor */
90  /** Copy of SMBIOS structure header */
92  /** Offset of structure within SMBIOS */
93  size_t offset;
94  /** Length of strings section */
95  size_t strings_len;
96 };
97 
98 /** SMBIOS system information structure */
100  /** SMBIOS structure header */
102  /** Manufacturer string */
104  /** Product string */
106  /** Version string */
108  /** Serial number string */
110  /** UUID */
112  /** Wake-up type */
114 } __attribute__ (( packed ));
115 
116 /** SMBIOS system information structure type */
117 #define SMBIOS_TYPE_SYSTEM_INFORMATION 1
118 
119 /** SMBIOS base board information structure */
121  /** SMBIOS structure header */
123  /** Manufacturer string */
125  /** Product string */
127  /** Version string */
129  /** Serial number string */
131 } __attribute__ (( packed ));
132 
133 /** SMBIOS base board information structure type */
134 #define SMBIOS_TYPE_BASE_BOARD_INFORMATION 2
135 
136 /** SMBIOS enclosure information structure */
138  /** SMBIOS structure header */
140  /** Manufacturer string */
142  /** Type string */
144  /** Version string */
146  /** Serial number string */
148  /** Asset tag */
150 } __attribute__ (( packed ));
151 
152 /** SMBIOS enclosure information structure type */
153 #define SMBIOS_TYPE_ENCLOSURE_INFORMATION 3
154 
155 /** SMBIOS OEM strings structure type */
156 #define SMBIOS_TYPE_OEM_STRINGS 11
157 
158 /**
159  * SMBIOS entry point descriptor
160  *
161  * This contains the information from the SMBIOS entry point that we
162  * care about.
163  */
164 struct smbios {
165  /** Start of SMBIOS structures */
167  /** Length of SMBIOS structures */
168  size_t len;
169  /** Number of SMBIOS structures */
170  unsigned int count;
171  /** SMBIOS version */
173 };
174 
175 /**
176  * Calculate SMBIOS version
177  *
178  * @v major Major version
179  * @v minor Minor version
180  * @ret version SMBIOS version
181  */
182 #define SMBIOS_VERSION( major, minor ) ( ( (major) << 8 ) | (minor) )
183 
184 extern int find_smbios ( struct smbios *smbios );
185 extern int find_smbios_entry ( userptr_t start, size_t len,
186  struct smbios_entry *entry );
187 extern int find_smbios_structure ( unsigned int type, unsigned int instance,
188  struct smbios_structure *structure );
189 extern int read_smbios_structure ( struct smbios_structure *structure,
190  void *data, size_t len );
191 extern int read_smbios_string ( struct smbios_structure *structure,
192  unsigned int index,
193  void *data, size_t len );
194 extern int smbios_version ( void );
195 
196 #endif /* _IPXE_SMBIOS_H */
uint16_t max
Maximum structure size.
Definition: smbios.h:59
uint32_t signature
Signature.
Definition: smbios.h:49
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
struct smbios_header header
SMBIOS structure header.
Definition: smbios.h:122
size_t strings_len
Length of strings section.
Definition: smbios.h:95
unsigned short uint16_t
Definition: stdint.h:11
uint8_t serial
Serial number string.
Definition: smbios.h:147
uint8_t asset_tag
Asset tag.
Definition: smbios.h:149
uint8_t wakeup
Wake-up type.
Definition: smbios.h:113
iPXE internal APIs
uint8_t dmi_checksum
DMI checksum.
Definition: smbios.h:67
unsigned int count
Number of SMBIOS structures.
Definition: smbios.h:170
uint8_t version
Version string.
Definition: smbios.h:128
iPXE SMBIOS API for EFI
A universally unique ID.
Definition: uuid.h:15
uint8_t product
Product string.
Definition: smbios.h:105
uint8_t revision
Entry point revision.
Definition: smbios.h:61
size_t len
Length of SMBIOS structures.
Definition: smbios.h:168
SMBIOS entry point descriptor.
Definition: smbios.h:164
struct smbios_header header
Copy of SMBIOS structure header.
Definition: smbios.h:91
int smbios_version(void)
Get SMBIOS version.
Definition: smbios.c:242
uint8_t manufacturer
Manufacturer string.
Definition: smbios.h:124
int find_smbios(struct smbios *smbios)
uint8_t manufacturer
Manufacturer string.
Definition: smbios.h:141
uint8_t serial
Serial number string.
Definition: smbios.h:130
Access to external ("user") memory.
uint8_t serial
Serial number string.
Definition: smbios.h:109
uint16_t version
SMBIOS version.
Definition: smbios.h:172
struct smbios_header header
SMBIOS structure header.
Definition: smbios.h:101
uint8_t len
Length.
Definition: smbios.h:19
uint32_t start
Starting offset.
Definition: netvsc.h:12
uint8_t checksum
Checksum.
Definition: smbios.h:51
uint8_t len
Length.
Definition: smbios.h:83
uint16_t smbios_len
Structure table length.
Definition: smbios.h:69
uint8_t type
Type string.
Definition: smbios.h:143
SMBIOS entry point.
Definition: smbios.h:44
uint32_t smbios_address
Structure table address.
Definition: smbios.h:71
uint8_t dmi_signature[5]
DMI Signature.
Definition: smbios.h:65
uint8_t version
Version string.
Definition: smbios.h:145
int find_smbios_structure(unsigned int type, unsigned int instance, struct smbios_structure *structure)
Find specific structure type within SMBIOS.
Definition: smbios.c:118
iPXE SMBIOS API for Linux
union aes_table_entry entry[256]
Table entries, indexed by S(N)
Definition: aes.c:26
struct smbios_structure __attribute__
uint8_t bcd_revision
BCD revision.
Definition: smbios.h:75
uint8_t version
Version string.
Definition: smbios.h:107
unsigned char uint8_t
Definition: stdint.h:10
uint8_t type
Type.
Definition: smbios.h:12
int read_smbios_structure(struct smbios_structure *structure, void *data, size_t len)
Copy SMBIOS structure.
Definition: smbios.c:184
uint8_t formatted[5]
Formatted area.
Definition: smbios.h:63
unsigned int uint32_t
Definition: stdint.h:12
uint16_t smbios_count
Number of SMBIOS structures.
Definition: smbios.h:73
uint8_t minor
Minor version.
Definition: smbios.h:57
int find_smbios_entry(userptr_t start, size_t len, struct smbios_entry *entry)
Scan for SMBIOS entry point structure.
Definition: smbios.c:52
int read_smbios_string(struct smbios_structure *structure, unsigned int index, void *data, size_t len)
Find indexed string within SMBIOS structure.
Definition: smbios.c:204
An SMBIOS structure header.
Definition: smbios.h:79
SMBIOS system information structure.
Definition: smbios.h:99
struct smbios_header header
SMBIOS structure header.
Definition: smbios.h:139
uint8_t type
Type.
Definition: smbios.h:81
General configuration.
uint16_t handle
Handle.
Definition: smbios.h:85
userptr_t address
Start of SMBIOS structures.
Definition: smbios.h:166
uint8_t manufacturer
Manufacturer string.
Definition: smbios.h:103
uint8_t len
Length.
Definition: smbios.h:53
struct arbelprm_port_state_change_st data
Message.
Definition: arbel.h:12
uint8_t product
Product string.
Definition: smbios.h:126
SMBIOS base board information structure.
Definition: smbios.h:120
uint64_t index
Index of the first segment within the content.
Definition: pccrc.h:21
x86-specific SMBIOS API implementations
uint8_t major
Major version.
Definition: smbios.h:55
SMBIOS structure descriptor.
Definition: smbios.h:89
size_t offset
Offset of structure within SMBIOS.
Definition: smbios.h:93
SMBIOS enclosure information structure.
Definition: smbios.h:137
unsigned long userptr_t
A pointer to a user buffer.
Definition: uaccess.h:33