blob: 7912ba151f2787c9da5904383a639bb1899ecedf [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,
31 SMBIOS_PHYS_MEMORY_ARRAY=16,
32 SMBIOS_MEMORY_DEVICE=17,
33 SMBIOS_MEMORY_ARRAY_MAPPED_ADDRESS=19,
34 SMBIOS_SYSTEM_BOOT_INFORMATION=32,
Stefan Reinauer3d7c6772012-04-02 13:30:10 -070035 SMBIOS_ONBOARD_DEVICES_EXTENDED_INFORMATION=41,
Sven Schnelle164bcfd2011-08-14 20:56:34 +020036 SMBIOS_END_OF_TABLE=127,
37} smbios_struct_type_t;
38
39struct smbios_entry {
40 u8 anchor[4];
41 u8 checksum;
42 u8 length;
43 u8 major_version;
44 u8 minor_version;
45 u16 max_struct_size;
46 u8 entry_point_rev;
47 u8 formwatted_area[5];
48 u8 intermediate_anchor_string[5];
49 u8 intermediate_checksum;
50 u16 struct_table_length;
51 u32 struct_table_address;
52 u16 struct_count;
53 u8 smbios_bcd_revision;
54} __attribute__((packed));
55
56struct smbios_type0 {
57 u8 type;
58 u8 length;
59 u16 handle;
60 u8 vendor;
61 u8 bios_version;
62 u16 bios_start_segment;
63 u8 bios_release_date;
64 u8 bios_rom_size;
65 u64 bios_characteristics;
66 u8 bios_characteristics_ext1;
67 u8 bios_characteristics_ext2;
68 u8 system_bios_major_release;
69 u8 system_bios_minor_release;
70 u8 ec_major_release;
71 u8 ec_minor_release;
72 char eos[2];
73} __attribute__((packed));
74
75struct smbios_type1 {
76 u8 type;
77 u8 length;
78 u16 handle;
79 u8 manufacturer;
80 u8 product_name;
81 u8 version;
82 u8 serial_number;
83 u8 uuid[16];
84 u8 wakeup_type;
85 u8 sku;
86 u8 family;
87 char eos[2];
88} __attribute__((packed));
89
90struct smbios_type3 {
91 u8 type;
92 u8 length;
93 u16 handle;
94 u8 manufacturer;
95 u8 _type;
96 u8 version;
97 u8 serial_number;
98 u8 asset_tag_number;
99 u8 bootup_state;
100 u8 power_supply_state;
101 u8 thermal_state;
102 u8 security_status;
103 u32 oem_defined;
104 u8 height;
105 u8 number_of_power_cords;
106 u8 element_count;
107 u8 element_record_length;
108 char eos[2];
109} __attribute__((packed));
110
111struct smbios_type4 {
112 u8 type;
113 u8 length;
114 u16 handle;
115 u8 socket_designation;
116 u8 processor_type;
117 u8 processor_family;
118 u8 processor_manufacturer;
119 u32 processor_id[2];
120 u8 processor_version;
121 u8 voltage;
122 u16 external_clock;
123 u16 max_speed;
124 u16 current_speed;
125 u8 status;
126 u8 processor_upgrade;
127 u16 l1_cache_handle;
128 u16 l2_cache_handle;
129 u16 l3_cache_handle;
130 u8 serial_number;
131 u8 asset_tag;
132 u8 part_number;
133 u8 core_count;
134 u8 core_enabled;
135 u8 thread_count;
136 u16 processor_characteristics;
137 u16 processor_family2;
138 char eos[2];
139} __attribute__((packed));
140
141struct smbios_type16 {
142 u8 type;
143 u8 length;
144 u16 handle;
145 u8 location;
146 u8 use;
147 u8 memory_error_correction;
148 u32 maximum_capacity;
149 u16 memory_error_information_handle;
150 u16 number_of_memory_devices;
151 u64 extended_maximum_capacity;
152 char eos[2];
153} __attribute__((packed));
154
155struct smbios_type17 {
156 u8 type;
157 u8 length;
158 u16 handle;
159 u16 phys_memory_array_handle;
160 u16 memory_error_information_handle;
161 u16 total_width;
162 u16 data_width;
163 u16 size;
164 u8 form_factor;
165 u8 device_set;
166 u8 device_locator;
167 u8 bank_locator;
168 u8 memory_type;
169 u16 type_detail;
170 u16 speed;
171 u8 manufacturer;
172 u8 serial_number;
173 u8 asset_tag;
174 u8 part_number;
175 u8 attributes;
176 u16 extended_size;
177 u16 clock_speed;
178
179 char eos[2];
180} __attribute__((packed));
181
182struct smbios_type32 {
183 u8 type;
184 u8 length;
185 u16 handle;
186 u8 reserved[6];
187 u8 boot_status;
188 u8 eos[2];
189} __attribute__((packed));
190
Sven Schnelle6d038762012-07-09 08:52:53 +0200191struct smbios_type38 {
192 u8 type;
193 u8 length;
194 u16 handle;
195 u8 interface_type;
196 u8 ipmi_rev;
197 u8 i2c_slave_addr;
198 u8 nv_storage_addr;
199 u64 base_address;
200 u8 base_address_modifier;
201 u8 irq;
202} __attribute__((packed));
203
Stefan Reinauer3d7c6772012-04-02 13:30:10 -0700204typedef enum {
205 SMBIOS_DEVICE_TYPE_OTHER = 0x01,
206 SMBIOS_DEVICE_TYPE_UNKNOWN,
207 SMBIOS_DEVICE_TYPE_VIDEO,
208 SMBIOS_DEVICE_TYPE_SCSI,
209 SMBIOS_DEVICE_TYPE_ETHERNET,
210 SMBIOS_DEVICE_TYPE_TOKEN_RING,
211 SMBIOS_DEVICE_TYPE_SOUND,
212 SMBIOS_DEVICE_TYPE_PATA,
213 SMBIOS_DEVICE_TYPE_SATA,
214 SMBIOS_DEVICE_TYPE_SAS,
215} smbios_onboard_device_type;
216
217struct smbios_type41 {
218 u8 type;
219 u8 length;
220 u16 handle;
221 u8 reference_designation;
222 u8 device_type: 7;
223 u8 device_status: 1;
224 u8 device_type_instance;
225 u16 segment_group_number;
226 u8 bus_number;
227 u8 function_number: 3;
228 u8 device_number: 5;
229 char eos[2];
230} __attribute__((packed));
231
Sven Schnelle164bcfd2011-08-14 20:56:34 +0200232struct smbios_type127 {
233 u8 type;
234 u8 length;
235 u16 handle;
236 u8 eos[2];
237} __attribute__((packed));
238
239#endif