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