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