blob: 7c41c42fad3c0a20f8b2f4395927ad790e52535b [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
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200118struct smbios_type3 {
119 u8 type;
120 u8 length;
121 u16 handle;
122 u8 manufacturer;
123 u8 _type;
124 u8 version;
125 u8 serial_number;
126 u8 asset_tag_number;
127 u8 bootup_state;
128 u8 power_supply_state;
129 u8 thermal_state;
130 u8 security_status;
131 u32 oem_defined;
132 u8 height;
133 u8 number_of_power_cords;
134 u8 element_count;
135 u8 element_record_length;
136 char eos[2];
137} __attribute__((packed));
138
139struct smbios_type4 {
140 u8 type;
141 u8 length;
142 u16 handle;
143 u8 socket_designation;
144 u8 processor_type;
145 u8 processor_family;
146 u8 processor_manufacturer;
147 u32 processor_id[2];
148 u8 processor_version;
149 u8 voltage;
150 u16 external_clock;
151 u16 max_speed;
152 u16 current_speed;
153 u8 status;
154 u8 processor_upgrade;
155 u16 l1_cache_handle;
156 u16 l2_cache_handle;
157 u16 l3_cache_handle;
158 u8 serial_number;
159 u8 asset_tag;
160 u8 part_number;
161 u8 core_count;
162 u8 core_enabled;
163 u8 thread_count;
164 u16 processor_characteristics;
165 u16 processor_family2;
166 char eos[2];
167} __attribute__((packed));
168
Peter Stugec392b642013-07-06 19:51:12 +0200169struct smbios_type11 {
170 u8 type;
171 u8 length;
172 u16 handle;
173 u8 count;
174 char eos[2];
175} __attribute__((packed));
176
Duncan Laurie472ec9c2012-06-23 16:13:42 -0700177struct smbios_type15 {
178 u8 type;
179 u8 length;
180 u16 handle;
181 u16 area_length;
182 u16 header_offset;
183 u16 data_offset;
184 u8 access_method;
185 u8 log_status;
186 u32 change_token;
187 u32 address;
188 u8 header_format;
189 u8 log_type_descriptors;
190 u8 log_type_descriptor_length;
191 char eos[2];
192} __attribute__((packed));
193
194enum {
195 SMBIOS_EVENTLOG_ACCESS_METHOD_IO8 = 0,
196 SMBIOS_EVENTLOG_ACCESS_METHOD_IO8X2,
197 SMBIOS_EVENTLOG_ACCESS_METHOD_IO16,
198 SMBIOS_EVENTLOG_ACCESS_METHOD_MMIO32,
199 SMBIOS_EVENTLOG_ACCESS_METHOD_GPNV,
200};
201
202enum {
203 SMBIOS_EVENTLOG_STATUS_VALID = 1, /* Bit 0 */
204 SMBIOS_EVENTLOG_STATUS_FULL = 2, /* Bit 1 */
205};
206
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200207struct smbios_type16 {
208 u8 type;
209 u8 length;
210 u16 handle;
211 u8 location;
212 u8 use;
213 u8 memory_error_correction;
214 u32 maximum_capacity;
215 u16 memory_error_information_handle;
216 u16 number_of_memory_devices;
217 u64 extended_maximum_capacity;
218 char eos[2];
219} __attribute__((packed));
220
221struct smbios_type17 {
222 u8 type;
223 u8 length;
224 u16 handle;
225 u16 phys_memory_array_handle;
226 u16 memory_error_information_handle;
227 u16 total_width;
228 u16 data_width;
229 u16 size;
230 u8 form_factor;
231 u8 device_set;
232 u8 device_locator;
233 u8 bank_locator;
234 u8 memory_type;
235 u16 type_detail;
236 u16 speed;
237 u8 manufacturer;
238 u8 serial_number;
239 u8 asset_tag;
240 u8 part_number;
241 u8 attributes;
242 u16 extended_size;
243 u16 clock_speed;
244
245 char eos[2];
246} __attribute__((packed));
247
248struct smbios_type32 {
249 u8 type;
250 u8 length;
251 u16 handle;
252 u8 reserved[6];
253 u8 boot_status;
254 u8 eos[2];
255} __attribute__((packed));
256
Sven Schnelle6d038762012-07-09 08:52:53 +0200257struct smbios_type38 {
258 u8 type;
259 u8 length;
260 u16 handle;
261 u8 interface_type;
262 u8 ipmi_rev;
263 u8 i2c_slave_addr;
264 u8 nv_storage_addr;
265 u64 base_address;
266 u8 base_address_modifier;
267 u8 irq;
268} __attribute__((packed));
269
Stefan Reinauer3d7c6772012-04-02 13:30:10 -0700270typedef enum {
271 SMBIOS_DEVICE_TYPE_OTHER = 0x01,
272 SMBIOS_DEVICE_TYPE_UNKNOWN,
273 SMBIOS_DEVICE_TYPE_VIDEO,
274 SMBIOS_DEVICE_TYPE_SCSI,
275 SMBIOS_DEVICE_TYPE_ETHERNET,
276 SMBIOS_DEVICE_TYPE_TOKEN_RING,
277 SMBIOS_DEVICE_TYPE_SOUND,
278 SMBIOS_DEVICE_TYPE_PATA,
279 SMBIOS_DEVICE_TYPE_SATA,
280 SMBIOS_DEVICE_TYPE_SAS,
281} smbios_onboard_device_type;
282
283struct smbios_type41 {
284 u8 type;
285 u8 length;
286 u16 handle;
287 u8 reference_designation;
288 u8 device_type: 7;
289 u8 device_status: 1;
290 u8 device_type_instance;
291 u16 segment_group_number;
292 u8 bus_number;
293 u8 function_number: 3;
294 u8 device_number: 5;
295 char eos[2];
296} __attribute__((packed));
297
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200298struct smbios_type127 {
299 u8 type;
300 u8 length;
301 u16 handle;
302 u8 eos[2];
303} __attribute__((packed));
304
305#endif