blob: a5716b38a58ea6eb4f98a2ec615a8c5f50556201 [file] [log] [blame]
Sven Schnelle164bcfd2011-08-14 20:56:34 +02001#ifndef SMBIOS_H
2#define SMBIOS_H
3
4#include <types.h>
5
Peter Stugec392b642013-07-06 19:51:12 +02006int smbios_write_type11(unsigned long *current, int handle, const char **oem_strings, int count);
Sven Schnelle164bcfd2011-08-14 20:56:34 +02007unsigned long smbios_write_tables(unsigned long start);
8int smbios_add_string(char *start, const char *str);
9int smbios_string_table_len(char *start);
10
Duncan Laurie21a78702013-05-23 14:17:05 -070011/* Used by mainboard to add an on-board device */
12int smbios_write_type41(unsigned long *current, int *handle,
13 const char *name, u8 instance, u16 segment,
14 u8 bus, u8 device, u8 function);
15
Gerd Hoffmann06262742013-11-13 13:37:23 +010016const char *smbios_mainboard_manufacturer(void);
17const char *smbios_mainboard_product_name(void);
Duncan Laurie21a78702013-05-23 14:17:05 -070018
Christian Gmeinerac3aa092012-07-25 13:42:40 +020019const char *smbios_mainboard_serial_number(void);
20const char *smbios_mainboard_version(void);
Gerd Hoffmann06262742013-11-13 13:37:23 +010021void smbios_mainboard_set_uuid(u8 *uuid);
Vladimir Serbinenko63acd222014-06-01 00:26:48 +020022const char *smbios_mainboard_bios_version(void);
Christian Gmeinerac3aa092012-07-25 13:42:40 +020023
Sven Schnelle164bcfd2011-08-14 20:56:34 +020024#define BIOS_CHARACTERISTICS_PCI_SUPPORTED (1 << 7)
25#define BIOS_CHARACTERISTICS_PC_CARD (1 << 8)
26#define BIOS_CHARACTERISTICS_PNP (1 << 9)
27#define BIOS_CHARACTERISTICS_APM (1 << 10)
28#define BIOS_CHARACTERISTICS_UPGRADEABLE (1 << 11)
29#define BIOS_CHARACTERISTICS_SHADOW (1 << 12)
30#define BIOS_CHARACTERISTICS_BOOT_FROM_CD (1 << 15)
31#define BIOS_CHARACTERISTICS_SELECTABLE_BOOT (1 << 16)
32#define BIOS_CHARACTERISTICS_BIOS_SOCKETED (1 << 17)
33
34#define BIOS_EXT1_CHARACTERISTICS_ACPI (1 << 0)
35#define BIOS_EXT2_CHARACTERISTICS_TARGET (1 << 2)
36
37#define SMBIOS_STATE_SAFE 3
38typedef enum {
39 SMBIOS_BIOS_INFORMATION=0,
40 SMBIOS_SYSTEM_INFORMATION=1,
Vladimir Serbinenko47089f22014-03-02 19:14:44 +010041 SMBIOS_BOARD_INFORMATION=2,
Sven Schnelle164bcfd2011-08-14 20:56:34 +020042 SMBIOS_SYSTEM_ENCLOSURE=3,
43 SMBIOS_PROCESSOR_INFORMATION=4,
44 SMBIOS_CACHE_INFORMATION=7,
45 SMBIOS_SYSTEM_SLOTS=9,
Peter Stugec392b642013-07-06 19:51:12 +020046 SMBIOS_OEM_STRINGS=11,
Duncan Laurie472ec9c2012-06-23 16:13:42 -070047 SMBIOS_EVENT_LOG=15,
Sven Schnelle164bcfd2011-08-14 20:56:34 +020048 SMBIOS_PHYS_MEMORY_ARRAY=16,
49 SMBIOS_MEMORY_DEVICE=17,
50 SMBIOS_MEMORY_ARRAY_MAPPED_ADDRESS=19,
51 SMBIOS_SYSTEM_BOOT_INFORMATION=32,
Stefan Reinauer3d7c6772012-04-02 13:30:10 -070052 SMBIOS_ONBOARD_DEVICES_EXTENDED_INFORMATION=41,
Sven Schnelle164bcfd2011-08-14 20:56:34 +020053 SMBIOS_END_OF_TABLE=127,
54} smbios_struct_type_t;
55
56struct smbios_entry {
57 u8 anchor[4];
58 u8 checksum;
59 u8 length;
60 u8 major_version;
61 u8 minor_version;
62 u16 max_struct_size;
63 u8 entry_point_rev;
64 u8 formwatted_area[5];
65 u8 intermediate_anchor_string[5];
66 u8 intermediate_checksum;
67 u16 struct_table_length;
68 u32 struct_table_address;
69 u16 struct_count;
70 u8 smbios_bcd_revision;
71} __attribute__((packed));
72
73struct smbios_type0 {
74 u8 type;
75 u8 length;
76 u16 handle;
77 u8 vendor;
78 u8 bios_version;
79 u16 bios_start_segment;
80 u8 bios_release_date;
81 u8 bios_rom_size;
82 u64 bios_characteristics;
83 u8 bios_characteristics_ext1;
84 u8 bios_characteristics_ext2;
85 u8 system_bios_major_release;
86 u8 system_bios_minor_release;
87 u8 ec_major_release;
88 u8 ec_minor_release;
89 char eos[2];
90} __attribute__((packed));
91
92struct smbios_type1 {
93 u8 type;
94 u8 length;
95 u16 handle;
96 u8 manufacturer;
97 u8 product_name;
98 u8 version;
99 u8 serial_number;
100 u8 uuid[16];
101 u8 wakeup_type;
102 u8 sku;
103 u8 family;
104 char eos[2];
105} __attribute__((packed));
106
Vladimir Serbinenko47089f22014-03-02 19:14:44 +0100107struct smbios_type2 {
108 u8 type;
109 u8 length;
110 u16 handle;
111 u8 manufacturer;
112 u8 product_name;
113 u8 version;
114 u8 serial_number;
115 char eos[2];
116} __attribute__((packed));
117
Vladimir Serbinenko71c0bf62014-08-27 23:23:14 +0200118enum
119{
120 SMBIOS_ENCLOSURE_DESKTOP = 3,
121 SMBIOS_ENCLOSURE_NOTEBOOK = 9,
122};
123
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200124struct smbios_type3 {
125 u8 type;
126 u8 length;
127 u16 handle;
128 u8 manufacturer;
129 u8 _type;
130 u8 version;
131 u8 serial_number;
132 u8 asset_tag_number;
133 u8 bootup_state;
134 u8 power_supply_state;
135 u8 thermal_state;
136 u8 security_status;
137 u32 oem_defined;
138 u8 height;
139 u8 number_of_power_cords;
140 u8 element_count;
141 u8 element_record_length;
142 char eos[2];
143} __attribute__((packed));
144
145struct smbios_type4 {
146 u8 type;
147 u8 length;
148 u16 handle;
149 u8 socket_designation;
150 u8 processor_type;
151 u8 processor_family;
152 u8 processor_manufacturer;
153 u32 processor_id[2];
154 u8 processor_version;
155 u8 voltage;
156 u16 external_clock;
157 u16 max_speed;
158 u16 current_speed;
159 u8 status;
160 u8 processor_upgrade;
161 u16 l1_cache_handle;
162 u16 l2_cache_handle;
163 u16 l3_cache_handle;
164 u8 serial_number;
165 u8 asset_tag;
166 u8 part_number;
167 u8 core_count;
168 u8 core_enabled;
169 u8 thread_count;
170 u16 processor_characteristics;
171 u16 processor_family2;
172 char eos[2];
173} __attribute__((packed));
174
Peter Stugec392b642013-07-06 19:51:12 +0200175struct smbios_type11 {
176 u8 type;
177 u8 length;
178 u16 handle;
179 u8 count;
180 char eos[2];
181} __attribute__((packed));
182
Duncan Laurie472ec9c2012-06-23 16:13:42 -0700183struct smbios_type15 {
184 u8 type;
185 u8 length;
186 u16 handle;
187 u16 area_length;
188 u16 header_offset;
189 u16 data_offset;
190 u8 access_method;
191 u8 log_status;
192 u32 change_token;
193 u32 address;
194 u8 header_format;
195 u8 log_type_descriptors;
196 u8 log_type_descriptor_length;
197 char eos[2];
198} __attribute__((packed));
199
200enum {
201 SMBIOS_EVENTLOG_ACCESS_METHOD_IO8 = 0,
202 SMBIOS_EVENTLOG_ACCESS_METHOD_IO8X2,
203 SMBIOS_EVENTLOG_ACCESS_METHOD_IO16,
204 SMBIOS_EVENTLOG_ACCESS_METHOD_MMIO32,
205 SMBIOS_EVENTLOG_ACCESS_METHOD_GPNV,
206};
207
208enum {
209 SMBIOS_EVENTLOG_STATUS_VALID = 1, /* Bit 0 */
210 SMBIOS_EVENTLOG_STATUS_FULL = 2, /* Bit 1 */
211};
212
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200213struct smbios_type16 {
214 u8 type;
215 u8 length;
216 u16 handle;
217 u8 location;
218 u8 use;
219 u8 memory_error_correction;
220 u32 maximum_capacity;
221 u16 memory_error_information_handle;
222 u16 number_of_memory_devices;
223 u64 extended_maximum_capacity;
224 char eos[2];
225} __attribute__((packed));
226
227struct smbios_type17 {
228 u8 type;
229 u8 length;
230 u16 handle;
231 u16 phys_memory_array_handle;
232 u16 memory_error_information_handle;
233 u16 total_width;
234 u16 data_width;
235 u16 size;
236 u8 form_factor;
237 u8 device_set;
238 u8 device_locator;
239 u8 bank_locator;
240 u8 memory_type;
241 u16 type_detail;
242 u16 speed;
243 u8 manufacturer;
244 u8 serial_number;
245 u8 asset_tag;
246 u8 part_number;
247 u8 attributes;
248 u16 extended_size;
249 u16 clock_speed;
250
251 char eos[2];
252} __attribute__((packed));
253
254struct smbios_type32 {
255 u8 type;
256 u8 length;
257 u16 handle;
258 u8 reserved[6];
259 u8 boot_status;
260 u8 eos[2];
261} __attribute__((packed));
262
Sven Schnelle6d038762012-07-09 08:52:53 +0200263struct smbios_type38 {
264 u8 type;
265 u8 length;
266 u16 handle;
267 u8 interface_type;
268 u8 ipmi_rev;
269 u8 i2c_slave_addr;
270 u8 nv_storage_addr;
271 u64 base_address;
272 u8 base_address_modifier;
273 u8 irq;
274} __attribute__((packed));
275
Stefan Reinauer3d7c6772012-04-02 13:30:10 -0700276typedef enum {
277 SMBIOS_DEVICE_TYPE_OTHER = 0x01,
278 SMBIOS_DEVICE_TYPE_UNKNOWN,
279 SMBIOS_DEVICE_TYPE_VIDEO,
280 SMBIOS_DEVICE_TYPE_SCSI,
281 SMBIOS_DEVICE_TYPE_ETHERNET,
282 SMBIOS_DEVICE_TYPE_TOKEN_RING,
283 SMBIOS_DEVICE_TYPE_SOUND,
284 SMBIOS_DEVICE_TYPE_PATA,
285 SMBIOS_DEVICE_TYPE_SATA,
286 SMBIOS_DEVICE_TYPE_SAS,
287} smbios_onboard_device_type;
288
289struct smbios_type41 {
290 u8 type;
291 u8 length;
292 u16 handle;
293 u8 reference_designation;
294 u8 device_type: 7;
295 u8 device_status: 1;
296 u8 device_type_instance;
297 u16 segment_group_number;
298 u8 bus_number;
299 u8 function_number: 3;
300 u8 device_number: 5;
301 char eos[2];
302} __attribute__((packed));
303
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200304struct smbios_type127 {
305 u8 type;
306 u8 length;
307 u16 handle;
308 u8 eos[2];
309} __attribute__((packed));
310
311#endif