smbios: add support for onboard devices extended information
[coreboot.git] / src / include / smbios.h
1 #ifndef SMBIOS_H
2 #define SMBIOS_H
3
4 #include <types.h>
5
6 unsigned long smbios_write_tables(unsigned long start);
7 int smbios_add_string(char *start, const char *str);
8 int 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
24 typedef 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,
35         SMBIOS_ONBOARD_DEVICES_EXTENDED_INFORMATION=41,
36         SMBIOS_END_OF_TABLE=127,
37 } smbios_struct_type_t;
38
39 struct 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
56 struct 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
75 struct 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
90 struct 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
111 struct 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
141 struct 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
155 struct 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
182 struct 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
191 typedef enum {
192         SMBIOS_DEVICE_TYPE_OTHER = 0x01,
193         SMBIOS_DEVICE_TYPE_UNKNOWN,
194         SMBIOS_DEVICE_TYPE_VIDEO,
195         SMBIOS_DEVICE_TYPE_SCSI,
196         SMBIOS_DEVICE_TYPE_ETHERNET,
197         SMBIOS_DEVICE_TYPE_TOKEN_RING,
198         SMBIOS_DEVICE_TYPE_SOUND,
199         SMBIOS_DEVICE_TYPE_PATA,
200         SMBIOS_DEVICE_TYPE_SATA,
201         SMBIOS_DEVICE_TYPE_SAS,
202 } smbios_onboard_device_type;
203
204 struct smbios_type41 {
205         u8 type;
206         u8 length;
207         u16 handle;
208         u8 reference_designation;
209         u8 device_type: 7;
210         u8 device_status: 1;
211         u8 device_type_instance;
212         u16 segment_group_number;
213         u8 bus_number;
214         u8 function_number: 3;
215         u8 device_number: 5;
216         char eos[2];
217 } __attribute__((packed));
218
219 struct smbios_type127 {
220         u8 type;
221         u8 length;
222         u16 handle;
223         u8 eos[2];
224 } __attribute__((packed));
225
226 #endif