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