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