smbios.h
Go to the documentation of this file.00001 #ifndef _GPXE_SMBIOS_H
00002 #define _GPXE_SMBIOS_H
00003
00004
00005
00006
00007
00008
00009
00010 FILE_LICENCE ( GPL2_OR_LATER );
00011
00012 #include <stdint.h>
00013 #include <gpxe/api.h>
00014 #include <config/general.h>
00015 #include <gpxe/uaccess.h>
00016
00017
00018
00019
00020
00021
00022
00023
00024 #define PROVIDE_SMBIOS( _subsys, _api_func, _func ) \
00025 PROVIDE_SINGLE_API ( SMBIOS_PREFIX_ ## _subsys, _api_func, _func )
00026
00027
00028 #include <gpxe/efi/efi_smbios.h>
00029
00030
00031 #include <bits/smbios.h>
00032
00033
00034 #define SMBIOS_SIGNATURE \
00035 ( ( '_' << 0 ) + ( 'S' << 8 ) + ( 'M' << 16 ) + ( '_' << 24 ) )
00036
00037
00038
00039
00040
00041
00042
00043 struct smbios_entry {
00044
00045
00046
00047
00048 uint32_t signature;
00049
00050 uint8_t checksum;
00051
00052 uint8_t len;
00053
00054 uint8_t major;
00055
00056 uint8_t minor;
00057
00058 uint16_t max;
00059
00060 uint8_t revision;
00061
00062 uint8_t formatted[5];
00063
00064 uint8_t dmi_signature[5];
00065
00066 uint8_t dmi_checksum;
00067
00068 uint16_t smbios_len;
00069
00070 uint32_t smbios_address;
00071
00072 uint16_t smbios_count;
00073
00074 uint8_t bcd_revision;
00075 } __attribute__ (( packed ));
00076
00077
00078 struct smbios_header {
00079
00080 uint8_t type;
00081
00082 uint8_t len;
00083
00084 uint16_t handle;
00085 } __attribute__ (( packed ));
00086
00087
00088 struct smbios_structure {
00089
00090 struct smbios_header header;
00091
00092 size_t offset;
00093
00094 size_t strings_len;
00095 };
00096
00097
00098 struct smbios_system_information {
00099
00100 struct smbios_header header;
00101
00102 uint8_t manufacturer;
00103
00104 uint8_t product;
00105
00106 uint8_t version;
00107
00108 uint8_t serial;
00109
00110 uint8_t uuid[16];
00111
00112 uint8_t wakeup;
00113 } __attribute__ (( packed ));
00114
00115
00116 #define SMBIOS_TYPE_SYSTEM_INFORMATION 1
00117
00118
00119 struct smbios_enclosure_information {
00120
00121 struct smbios_header header;
00122
00123 uint8_t manufacturer;
00124
00125 uint8_t type;
00126
00127 uint8_t version;
00128
00129 uint8_t serial;
00130
00131 uint8_t asset_tag;
00132 } __attribute__ (( packed ));
00133
00134
00135 #define SMBIOS_TYPE_ENCLOSURE_INFORMATION 3
00136
00137
00138
00139
00140
00141
00142
00143 struct smbios {
00144
00145 userptr_t address;
00146
00147 size_t len;
00148
00149 unsigned int count;
00150 };
00151
00152 extern int find_smbios ( struct smbios *smbios );
00153 extern int find_smbios_structure ( unsigned int type,
00154 struct smbios_structure *structure );
00155 extern int read_smbios_structure ( struct smbios_structure *structure,
00156 void *data, size_t len );
00157 extern int read_smbios_string ( struct smbios_structure *structure,
00158 unsigned int index,
00159 void *data, size_t len );
00160
00161 #endif