f13d6217db157412970739a713f9f2047503c42b
[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_END_OF_TABLE=127,
36 } smbios_struct_type_t;
37
38 struct smbios_entry {
39         u8 anchor[4];
40         u8 checksum;
41         u8 length;
42         u8 major_version;
43         u8 minor_version;
44         u16 max_struct_size;
45         u8 entry_point_rev;
46         u8 formwatted_area[5];
47         u8 intermediate_anchor_string[5];
48         u8 intermediate_checksum;
49         u16 struct_table_length;
50         u32 struct_table_address;
51         u16 struct_count;
52         u8 smbios_bcd_revision;
53 } __attribute__((packed));
54
55 struct smbios_type0 {
56         u8 type;
57         u8 length;
58         u16 handle;
59         u8 vendor;
60         u8 bios_version;
61         u16 bios_start_segment;
62         u8 bios_release_date;
63         u8 bios_rom_size;
64         u64 bios_characteristics;
65         u8 bios_characteristics_ext1;
66         u8 bios_characteristics_ext2;
67         u8 system_bios_major_release;
68         u8 system_bios_minor_release;
69         u8 ec_major_release;
70         u8 ec_minor_release;
71         char eos[2];
72 } __attribute__((packed));
73
74 struct smbios_type1 {
75         u8 type;
76         u8 length;
77         u16 handle;
78         u8 manufacturer;
79         u8 product_name;
80         u8 version;
81         u8 serial_number;
82         u8 uuid[16];
83         u8 wakeup_type;
84         u8 sku;
85         u8 family;
86         char eos[2];
87 } __attribute__((packed));
88
89 struct smbios_type3 {
90         u8 type;
91         u8 length;
92         u16 handle;
93         u8 manufacturer;
94         u8 _type;
95         u8 version;
96         u8 serial_number;
97         u8 asset_tag_number;
98         u8 bootup_state;
99         u8 power_supply_state;
100         u8 thermal_state;
101         u8 security_status;
102         u32 oem_defined;
103         u8 height;
104         u8 number_of_power_cords;
105         u8 element_count;
106         u8 element_record_length;
107         char eos[2];
108 } __attribute__((packed));
109
110 struct smbios_type4 {
111         u8 type;
112         u8 length;
113         u16 handle;
114         u8 socket_designation;
115         u8 processor_type;
116         u8 processor_family;
117         u8 processor_manufacturer;
118         u32 processor_id[2];
119         u8 processor_version;
120         u8 voltage;
121         u16 external_clock;
122         u16 max_speed;
123         u16 current_speed;
124         u8 status;
125         u8 processor_upgrade;
126         u16 l1_cache_handle;
127         u16 l2_cache_handle;
128         u16 l3_cache_handle;
129         u8 serial_number;
130         u8 asset_tag;
131         u8 part_number;
132         u8 core_count;
133         u8 core_enabled;
134         u8 thread_count;
135         u16 processor_characteristics;
136         u16 processor_family2;
137         char eos[2];
138 } __attribute__((packed));
139
140 struct smbios_type16 {
141         u8 type;
142         u8 length;
143         u16 handle;
144         u8 location;
145         u8 use;
146         u8 memory_error_correction;
147         u32 maximum_capacity;
148         u16 memory_error_information_handle;
149         u16 number_of_memory_devices;
150         u64 extended_maximum_capacity;
151         char eos[2];
152 } __attribute__((packed));
153
154 struct smbios_type17 {
155         u8 type;
156         u8 length;
157         u16 handle;
158         u16 phys_memory_array_handle;
159         u16 memory_error_information_handle;
160         u16 total_width;
161         u16 data_width;
162         u16 size;
163         u8 form_factor;
164         u8 device_set;
165         u8 device_locator;
166         u8 bank_locator;
167         u8 memory_type;
168         u16 type_detail;
169         u16 speed;
170         u8 manufacturer;
171         u8 serial_number;
172         u8 asset_tag;
173         u8 part_number;
174         u8 attributes;
175         u16 extended_size;
176         u16 clock_speed;
177
178         char eos[2];
179 } __attribute__((packed));
180
181 struct smbios_type32 {
182         u8 type;
183         u8 length;
184         u16 handle;
185         u8 reserved[6];
186         u8 boot_status;
187         u8 eos[2];
188 } __attribute__((packed));
189
190 struct smbios_type127 {
191         u8 type;
192         u8 length;
193         u16 handle;
194         u8 eos[2];
195 } __attribute__((packed));
196
197 #endif