blob: bd7bef57db5d85b307510aa5bd76f609e42bcc35 [file] [log] [blame]
Sven Schnelle164bcfd2011-08-14 20:56:34 +02001#ifndef SMBIOS_H
2#define SMBIOS_H
3
4#include <types.h>
5
6unsigned long smbios_write_tables(unsigned long start);
7int smbios_add_string(char *start, const char *str);
8int smbios_string_table_len(char *start);
9
Duncan Laurie21a78702013-05-23 14:17:05 -070010/* Used by mainboard to add an on-board device */
11int smbios_write_type41(unsigned long *current, int *handle,
12 const char *name, u8 instance, u16 segment,
13 u8 bus, u8 device, u8 function);
14
Gerd Hoffmann06262742013-11-13 13:37:23 +010015const char *smbios_mainboard_manufacturer(void);
16const char *smbios_mainboard_product_name(void);
Duncan Laurie21a78702013-05-23 14:17:05 -070017
Christian Gmeinerac3aa092012-07-25 13:42:40 +020018const char *smbios_mainboard_serial_number(void);
19const char *smbios_mainboard_version(void);
Gerd Hoffmann06262742013-11-13 13:37:23 +010020void smbios_mainboard_set_uuid(u8 *uuid);
Vladimir Serbinenko63acd222014-06-01 00:26:48 +020021const char *smbios_mainboard_bios_version(void);
Vladimir Serbinenkoa71bdc32014-08-30 00:35:39 +020022u8 smbios_mainboard_enclosure_type(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
Kane Chen33faac62014-07-27 12:54:44 -070037typedef enum {
38 MEMORY_FORMFACTOR_OTHER = 0x01,
39 MEMORY_FORMFACTOR_UNKNOWN = 0x02,
40 MEMORY_FORMFACTOR_SIMM = 0x03,
41 MEMORY_FORMFACTOR_SIP = 0x04,
42 MEMORY_FORMFACTOR_CHIP = 0x05,
43 MEMORY_FORMFACTOR_DIP = 0x06,
44 MEMORY_FORMFACTOR_ZIP = 0x07,
45 MEMORY_FORMFACTOR_PROPRIETARY_CARD = 0x08,
46 MEMORY_FORMFACTOR_DIMM = 0x09,
47 MEMORY_FORMFACTOR_TSOP = 0x0a,
48 MEMORY_FORMFACTOR_ROC = 0x0b,
49 MEMORY_FORMFACTOR_RIMM = 0x0c,
50 MEMORY_FORMFACTOR_SODIMM = 0x0d,
51 MEMORY_FORMFACTOR_SRIMM = 0x0e,
52 MEMORY_FORMFACTOR_FBDIMM = 0x0f,
53} smbios_memory_form_factor;
54
Sven Schnelle164bcfd2011-08-14 20:56:34 +020055#define SMBIOS_STATE_SAFE 3
56typedef enum {
57 SMBIOS_BIOS_INFORMATION=0,
58 SMBIOS_SYSTEM_INFORMATION=1,
Vladimir Serbinenko47089f22014-03-02 19:14:44 +010059 SMBIOS_BOARD_INFORMATION=2,
Sven Schnelle164bcfd2011-08-14 20:56:34 +020060 SMBIOS_SYSTEM_ENCLOSURE=3,
61 SMBIOS_PROCESSOR_INFORMATION=4,
62 SMBIOS_CACHE_INFORMATION=7,
63 SMBIOS_SYSTEM_SLOTS=9,
Peter Stugec392b642013-07-06 19:51:12 +020064 SMBIOS_OEM_STRINGS=11,
Duncan Laurie472ec9c2012-06-23 16:13:42 -070065 SMBIOS_EVENT_LOG=15,
Sven Schnelle164bcfd2011-08-14 20:56:34 +020066 SMBIOS_PHYS_MEMORY_ARRAY=16,
67 SMBIOS_MEMORY_DEVICE=17,
68 SMBIOS_MEMORY_ARRAY_MAPPED_ADDRESS=19,
69 SMBIOS_SYSTEM_BOOT_INFORMATION=32,
Stefan Reinauer3d7c6772012-04-02 13:30:10 -070070 SMBIOS_ONBOARD_DEVICES_EXTENDED_INFORMATION=41,
Sven Schnelle164bcfd2011-08-14 20:56:34 +020071 SMBIOS_END_OF_TABLE=127,
72} smbios_struct_type_t;
73
74struct smbios_entry {
75 u8 anchor[4];
76 u8 checksum;
77 u8 length;
78 u8 major_version;
79 u8 minor_version;
80 u16 max_struct_size;
81 u8 entry_point_rev;
82 u8 formwatted_area[5];
83 u8 intermediate_anchor_string[5];
84 u8 intermediate_checksum;
85 u16 struct_table_length;
86 u32 struct_table_address;
87 u16 struct_count;
88 u8 smbios_bcd_revision;
89} __attribute__((packed));
90
91struct smbios_type0 {
92 u8 type;
93 u8 length;
94 u16 handle;
95 u8 vendor;
96 u8 bios_version;
97 u16 bios_start_segment;
98 u8 bios_release_date;
99 u8 bios_rom_size;
100 u64 bios_characteristics;
101 u8 bios_characteristics_ext1;
102 u8 bios_characteristics_ext2;
103 u8 system_bios_major_release;
104 u8 system_bios_minor_release;
105 u8 ec_major_release;
106 u8 ec_minor_release;
107 char eos[2];
108} __attribute__((packed));
109
110struct smbios_type1 {
111 u8 type;
112 u8 length;
113 u16 handle;
114 u8 manufacturer;
115 u8 product_name;
116 u8 version;
117 u8 serial_number;
118 u8 uuid[16];
119 u8 wakeup_type;
120 u8 sku;
121 u8 family;
122 char eos[2];
123} __attribute__((packed));
124
Vladimir Serbinenko47089f22014-03-02 19:14:44 +0100125struct smbios_type2 {
126 u8 type;
127 u8 length;
128 u16 handle;
129 u8 manufacturer;
130 u8 product_name;
131 u8 version;
132 u8 serial_number;
133 char eos[2];
134} __attribute__((packed));
135
Vladimir Serbinenko71c0bf62014-08-27 23:23:14 +0200136enum
137{
138 SMBIOS_ENCLOSURE_DESKTOP = 3,
139 SMBIOS_ENCLOSURE_NOTEBOOK = 9,
140};
141
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200142struct smbios_type3 {
143 u8 type;
144 u8 length;
145 u16 handle;
146 u8 manufacturer;
147 u8 _type;
148 u8 version;
149 u8 serial_number;
150 u8 asset_tag_number;
151 u8 bootup_state;
152 u8 power_supply_state;
153 u8 thermal_state;
154 u8 security_status;
155 u32 oem_defined;
156 u8 height;
157 u8 number_of_power_cords;
158 u8 element_count;
159 u8 element_record_length;
160 char eos[2];
161} __attribute__((packed));
162
163struct smbios_type4 {
164 u8 type;
165 u8 length;
166 u16 handle;
167 u8 socket_designation;
168 u8 processor_type;
169 u8 processor_family;
170 u8 processor_manufacturer;
171 u32 processor_id[2];
172 u8 processor_version;
173 u8 voltage;
174 u16 external_clock;
175 u16 max_speed;
176 u16 current_speed;
177 u8 status;
178 u8 processor_upgrade;
179 u16 l1_cache_handle;
180 u16 l2_cache_handle;
181 u16 l3_cache_handle;
182 u8 serial_number;
183 u8 asset_tag;
184 u8 part_number;
185 u8 core_count;
186 u8 core_enabled;
187 u8 thread_count;
188 u16 processor_characteristics;
189 u16 processor_family2;
190 char eos[2];
191} __attribute__((packed));
192
Peter Stugec392b642013-07-06 19:51:12 +0200193struct smbios_type11 {
194 u8 type;
195 u8 length;
196 u16 handle;
197 u8 count;
198 char eos[2];
199} __attribute__((packed));
200
Duncan Laurie472ec9c2012-06-23 16:13:42 -0700201struct smbios_type15 {
202 u8 type;
203 u8 length;
204 u16 handle;
205 u16 area_length;
206 u16 header_offset;
207 u16 data_offset;
208 u8 access_method;
209 u8 log_status;
210 u32 change_token;
211 u32 address;
212 u8 header_format;
213 u8 log_type_descriptors;
214 u8 log_type_descriptor_length;
215 char eos[2];
216} __attribute__((packed));
217
218enum {
219 SMBIOS_EVENTLOG_ACCESS_METHOD_IO8 = 0,
220 SMBIOS_EVENTLOG_ACCESS_METHOD_IO8X2,
221 SMBIOS_EVENTLOG_ACCESS_METHOD_IO16,
222 SMBIOS_EVENTLOG_ACCESS_METHOD_MMIO32,
223 SMBIOS_EVENTLOG_ACCESS_METHOD_GPNV,
224};
225
226enum {
227 SMBIOS_EVENTLOG_STATUS_VALID = 1, /* Bit 0 */
228 SMBIOS_EVENTLOG_STATUS_FULL = 2, /* Bit 1 */
229};
230
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200231struct smbios_type16 {
232 u8 type;
233 u8 length;
234 u16 handle;
235 u8 location;
236 u8 use;
237 u8 memory_error_correction;
238 u32 maximum_capacity;
239 u16 memory_error_information_handle;
240 u16 number_of_memory_devices;
241 u64 extended_maximum_capacity;
242 char eos[2];
243} __attribute__((packed));
244
245struct smbios_type17 {
246 u8 type;
247 u8 length;
248 u16 handle;
249 u16 phys_memory_array_handle;
250 u16 memory_error_information_handle;
251 u16 total_width;
252 u16 data_width;
253 u16 size;
254 u8 form_factor;
255 u8 device_set;
256 u8 device_locator;
257 u8 bank_locator;
258 u8 memory_type;
259 u16 type_detail;
260 u16 speed;
261 u8 manufacturer;
262 u8 serial_number;
263 u8 asset_tag;
264 u8 part_number;
265 u8 attributes;
266 u16 extended_size;
267 u16 clock_speed;
268
269 char eos[2];
270} __attribute__((packed));
271
272struct smbios_type32 {
273 u8 type;
274 u8 length;
275 u16 handle;
276 u8 reserved[6];
277 u8 boot_status;
278 u8 eos[2];
279} __attribute__((packed));
280
Sven Schnelle6d038762012-07-09 08:52:53 +0200281struct smbios_type38 {
282 u8 type;
283 u8 length;
284 u16 handle;
285 u8 interface_type;
286 u8 ipmi_rev;
287 u8 i2c_slave_addr;
288 u8 nv_storage_addr;
289 u64 base_address;
290 u8 base_address_modifier;
291 u8 irq;
292} __attribute__((packed));
293
Stefan Reinauer3d7c6772012-04-02 13:30:10 -0700294typedef enum {
295 SMBIOS_DEVICE_TYPE_OTHER = 0x01,
296 SMBIOS_DEVICE_TYPE_UNKNOWN,
297 SMBIOS_DEVICE_TYPE_VIDEO,
298 SMBIOS_DEVICE_TYPE_SCSI,
299 SMBIOS_DEVICE_TYPE_ETHERNET,
300 SMBIOS_DEVICE_TYPE_TOKEN_RING,
301 SMBIOS_DEVICE_TYPE_SOUND,
302 SMBIOS_DEVICE_TYPE_PATA,
303 SMBIOS_DEVICE_TYPE_SATA,
304 SMBIOS_DEVICE_TYPE_SAS,
305} smbios_onboard_device_type;
306
307struct smbios_type41 {
308 u8 type;
309 u8 length;
310 u16 handle;
311 u8 reference_designation;
312 u8 device_type: 7;
313 u8 device_status: 1;
314 u8 device_type_instance;
315 u16 segment_group_number;
316 u8 bus_number;
317 u8 function_number: 3;
318 u8 device_number: 5;
319 char eos[2];
320} __attribute__((packed));
321
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200322struct smbios_type127 {
323 u8 type;
324 u8 length;
325 u16 handle;
326 u8 eos[2];
327} __attribute__((packed));
328
329#endif