blob: ebe167ef20892bf7de43aad59fb486d572fc76e0 [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
Gerd Hoffmann06262742013-11-13 13:37:23 +010011const char *smbios_mainboard_manufacturer(void);
12const char *smbios_mainboard_product_name(void);
Christian Gmeinerac3aa092012-07-25 13:42:40 +020013const char *smbios_mainboard_serial_number(void);
14const char *smbios_mainboard_version(void);
Gerd Hoffmann06262742013-11-13 13:37:23 +010015void smbios_mainboard_set_uuid(u8 *uuid);
Christian Gmeinerac3aa092012-07-25 13:42:40 +020016
Sven Schnelle164bcfd2011-08-14 20:56:34 +020017#define BIOS_CHARACTERISTICS_PCI_SUPPORTED (1 << 7)
18#define BIOS_CHARACTERISTICS_PC_CARD (1 << 8)
19#define BIOS_CHARACTERISTICS_PNP (1 << 9)
20#define BIOS_CHARACTERISTICS_APM (1 << 10)
21#define BIOS_CHARACTERISTICS_UPGRADEABLE (1 << 11)
22#define BIOS_CHARACTERISTICS_SHADOW (1 << 12)
23#define BIOS_CHARACTERISTICS_BOOT_FROM_CD (1 << 15)
24#define BIOS_CHARACTERISTICS_SELECTABLE_BOOT (1 << 16)
25#define BIOS_CHARACTERISTICS_BIOS_SOCKETED (1 << 17)
26
27#define BIOS_EXT1_CHARACTERISTICS_ACPI (1 << 0)
28#define BIOS_EXT2_CHARACTERISTICS_TARGET (1 << 2)
29
30#define SMBIOS_STATE_SAFE 3
31typedef enum {
32 SMBIOS_BIOS_INFORMATION=0,
33 SMBIOS_SYSTEM_INFORMATION=1,
34 SMBIOS_SYSTEM_ENCLOSURE=3,
35 SMBIOS_PROCESSOR_INFORMATION=4,
36 SMBIOS_CACHE_INFORMATION=7,
37 SMBIOS_SYSTEM_SLOTS=9,
Peter Stugec392b642013-07-06 19:51:12 +020038 SMBIOS_OEM_STRINGS=11,
Duncan Laurie472ec9c2012-06-23 16:13:42 -070039 SMBIOS_EVENT_LOG=15,
Sven Schnelle164bcfd2011-08-14 20:56:34 +020040 SMBIOS_PHYS_MEMORY_ARRAY=16,
41 SMBIOS_MEMORY_DEVICE=17,
42 SMBIOS_MEMORY_ARRAY_MAPPED_ADDRESS=19,
43 SMBIOS_SYSTEM_BOOT_INFORMATION=32,
Stefan Reinauer3d7c6772012-04-02 13:30:10 -070044 SMBIOS_ONBOARD_DEVICES_EXTENDED_INFORMATION=41,
Sven Schnelle164bcfd2011-08-14 20:56:34 +020045 SMBIOS_END_OF_TABLE=127,
46} smbios_struct_type_t;
47
48struct smbios_entry {
49 u8 anchor[4];
50 u8 checksum;
51 u8 length;
52 u8 major_version;
53 u8 minor_version;
54 u16 max_struct_size;
55 u8 entry_point_rev;
56 u8 formwatted_area[5];
57 u8 intermediate_anchor_string[5];
58 u8 intermediate_checksum;
59 u16 struct_table_length;
60 u32 struct_table_address;
61 u16 struct_count;
62 u8 smbios_bcd_revision;
63} __attribute__((packed));
64
65struct smbios_type0 {
66 u8 type;
67 u8 length;
68 u16 handle;
69 u8 vendor;
70 u8 bios_version;
71 u16 bios_start_segment;
72 u8 bios_release_date;
73 u8 bios_rom_size;
74 u64 bios_characteristics;
75 u8 bios_characteristics_ext1;
76 u8 bios_characteristics_ext2;
77 u8 system_bios_major_release;
78 u8 system_bios_minor_release;
79 u8 ec_major_release;
80 u8 ec_minor_release;
81 char eos[2];
82} __attribute__((packed));
83
84struct smbios_type1 {
85 u8 type;
86 u8 length;
87 u16 handle;
88 u8 manufacturer;
89 u8 product_name;
90 u8 version;
91 u8 serial_number;
92 u8 uuid[16];
93 u8 wakeup_type;
94 u8 sku;
95 u8 family;
96 char eos[2];
97} __attribute__((packed));
98
99struct smbios_type3 {
100 u8 type;
101 u8 length;
102 u16 handle;
103 u8 manufacturer;
104 u8 _type;
105 u8 version;
106 u8 serial_number;
107 u8 asset_tag_number;
108 u8 bootup_state;
109 u8 power_supply_state;
110 u8 thermal_state;
111 u8 security_status;
112 u32 oem_defined;
113 u8 height;
114 u8 number_of_power_cords;
115 u8 element_count;
116 u8 element_record_length;
117 char eos[2];
118} __attribute__((packed));
119
120struct smbios_type4 {
121 u8 type;
122 u8 length;
123 u16 handle;
124 u8 socket_designation;
125 u8 processor_type;
126 u8 processor_family;
127 u8 processor_manufacturer;
128 u32 processor_id[2];
129 u8 processor_version;
130 u8 voltage;
131 u16 external_clock;
132 u16 max_speed;
133 u16 current_speed;
134 u8 status;
135 u8 processor_upgrade;
136 u16 l1_cache_handle;
137 u16 l2_cache_handle;
138 u16 l3_cache_handle;
139 u8 serial_number;
140 u8 asset_tag;
141 u8 part_number;
142 u8 core_count;
143 u8 core_enabled;
144 u8 thread_count;
145 u16 processor_characteristics;
146 u16 processor_family2;
147 char eos[2];
148} __attribute__((packed));
149
Peter Stugec392b642013-07-06 19:51:12 +0200150struct smbios_type11 {
151 u8 type;
152 u8 length;
153 u16 handle;
154 u8 count;
155 char eos[2];
156} __attribute__((packed));
157
Duncan Laurie472ec9c2012-06-23 16:13:42 -0700158struct smbios_type15 {
159 u8 type;
160 u8 length;
161 u16 handle;
162 u16 area_length;
163 u16 header_offset;
164 u16 data_offset;
165 u8 access_method;
166 u8 log_status;
167 u32 change_token;
168 u32 address;
169 u8 header_format;
170 u8 log_type_descriptors;
171 u8 log_type_descriptor_length;
172 char eos[2];
173} __attribute__((packed));
174
175enum {
176 SMBIOS_EVENTLOG_ACCESS_METHOD_IO8 = 0,
177 SMBIOS_EVENTLOG_ACCESS_METHOD_IO8X2,
178 SMBIOS_EVENTLOG_ACCESS_METHOD_IO16,
179 SMBIOS_EVENTLOG_ACCESS_METHOD_MMIO32,
180 SMBIOS_EVENTLOG_ACCESS_METHOD_GPNV,
181};
182
183enum {
184 SMBIOS_EVENTLOG_STATUS_VALID = 1, /* Bit 0 */
185 SMBIOS_EVENTLOG_STATUS_FULL = 2, /* Bit 1 */
186};
187
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200188struct smbios_type16 {
189 u8 type;
190 u8 length;
191 u16 handle;
192 u8 location;
193 u8 use;
194 u8 memory_error_correction;
195 u32 maximum_capacity;
196 u16 memory_error_information_handle;
197 u16 number_of_memory_devices;
198 u64 extended_maximum_capacity;
199 char eos[2];
200} __attribute__((packed));
201
202struct smbios_type17 {
203 u8 type;
204 u8 length;
205 u16 handle;
206 u16 phys_memory_array_handle;
207 u16 memory_error_information_handle;
208 u16 total_width;
209 u16 data_width;
210 u16 size;
211 u8 form_factor;
212 u8 device_set;
213 u8 device_locator;
214 u8 bank_locator;
215 u8 memory_type;
216 u16 type_detail;
217 u16 speed;
218 u8 manufacturer;
219 u8 serial_number;
220 u8 asset_tag;
221 u8 part_number;
222 u8 attributes;
223 u16 extended_size;
224 u16 clock_speed;
225
226 char eos[2];
227} __attribute__((packed));
228
229struct smbios_type32 {
230 u8 type;
231 u8 length;
232 u16 handle;
233 u8 reserved[6];
234 u8 boot_status;
235 u8 eos[2];
236} __attribute__((packed));
237
Sven Schnelle6d038762012-07-09 08:52:53 +0200238struct smbios_type38 {
239 u8 type;
240 u8 length;
241 u16 handle;
242 u8 interface_type;
243 u8 ipmi_rev;
244 u8 i2c_slave_addr;
245 u8 nv_storage_addr;
246 u64 base_address;
247 u8 base_address_modifier;
248 u8 irq;
249} __attribute__((packed));
250
Stefan Reinauer3d7c6772012-04-02 13:30:10 -0700251typedef enum {
252 SMBIOS_DEVICE_TYPE_OTHER = 0x01,
253 SMBIOS_DEVICE_TYPE_UNKNOWN,
254 SMBIOS_DEVICE_TYPE_VIDEO,
255 SMBIOS_DEVICE_TYPE_SCSI,
256 SMBIOS_DEVICE_TYPE_ETHERNET,
257 SMBIOS_DEVICE_TYPE_TOKEN_RING,
258 SMBIOS_DEVICE_TYPE_SOUND,
259 SMBIOS_DEVICE_TYPE_PATA,
260 SMBIOS_DEVICE_TYPE_SATA,
261 SMBIOS_DEVICE_TYPE_SAS,
262} smbios_onboard_device_type;
263
264struct smbios_type41 {
265 u8 type;
266 u8 length;
267 u16 handle;
268 u8 reference_designation;
269 u8 device_type: 7;
270 u8 device_status: 1;
271 u8 device_type_instance;
272 u16 segment_group_number;
273 u8 bus_number;
274 u8 function_number: 3;
275 u8 device_number: 5;
276 char eos[2];
277} __attribute__((packed));
278
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200279struct smbios_type127 {
280 u8 type;
281 u8 length;
282 u16 handle;
283 u8 eos[2];
284} __attribute__((packed));
285
286#endif