smbios.h

Go to the documentation of this file.
00001 #ifndef _GPXE_SMBIOS_H
00002 #define _GPXE_SMBIOS_H
00003 
00004 /** @file
00005  *
00006  * System Management BIOS
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  * Provide an SMBIOS API implementation
00019  *
00020  * @v _prefix           Subsystem prefix
00021  * @v _api_func         API function
00022  * @v _func             Implementing function
00023  */
00024 #define PROVIDE_SMBIOS( _subsys, _api_func, _func ) \
00025         PROVIDE_SINGLE_API ( SMBIOS_PREFIX_ ## _subsys, _api_func, _func )
00026 
00027 /* Include all architecture-independent SMBIOS API headers */
00028 #include <gpxe/efi/efi_smbios.h>
00029 
00030 /* Include all architecture-dependent SMBIOS API headers */
00031 #include <bits/smbios.h>
00032 
00033 /** Signature for SMBIOS entry point */
00034 #define SMBIOS_SIGNATURE \
00035         ( ( '_' << 0 ) + ( 'S' << 8 ) + ( 'M' << 16 ) + ( '_' << 24 ) )
00036 
00037 /**
00038  * SMBIOS entry point
00039  *
00040  * This is the single table which describes the list of SMBIOS
00041  * structures.  It is located by scanning through the BIOS segment.
00042  */
00043 struct smbios_entry {
00044         /** Signature
00045          *
00046          * Must be equal to SMBIOS_SIGNATURE
00047          */
00048         uint32_t signature;
00049         /** Checksum */
00050         uint8_t checksum;
00051         /** Length */
00052         uint8_t len;
00053         /** Major version */
00054         uint8_t major;
00055         /** Minor version */
00056         uint8_t minor;
00057         /** Maximum structure size */
00058         uint16_t max;
00059         /** Entry point revision */
00060         uint8_t revision;
00061         /** Formatted area */
00062         uint8_t formatted[5];
00063         /** DMI Signature */
00064         uint8_t dmi_signature[5];
00065         /** DMI checksum */
00066         uint8_t dmi_checksum;
00067         /** Structure table length */
00068         uint16_t smbios_len;
00069         /** Structure table address */
00070         uint32_t smbios_address;
00071         /** Number of SMBIOS structures */
00072         uint16_t smbios_count;
00073         /** BCD revision */
00074         uint8_t bcd_revision;
00075 } __attribute__ (( packed ));
00076 
00077 /** An SMBIOS structure header */
00078 struct smbios_header {
00079         /** Type */
00080         uint8_t type;
00081         /** Length */
00082         uint8_t len;
00083         /** Handle */
00084         uint16_t handle;
00085 } __attribute__ (( packed ));
00086 
00087 /** SMBIOS structure descriptor */
00088 struct smbios_structure {
00089         /** Copy of SMBIOS structure header */
00090         struct smbios_header header;
00091         /** Offset of structure within SMBIOS */
00092         size_t offset;
00093         /** Length of strings section */
00094         size_t strings_len;
00095 };
00096 
00097 /** SMBIOS system information structure */
00098 struct smbios_system_information {
00099         /** SMBIOS structure header */
00100         struct smbios_header header;
00101         /** Manufacturer string */
00102         uint8_t manufacturer;
00103         /** Product string */
00104         uint8_t product;
00105         /** Version string */
00106         uint8_t version;
00107         /** Serial number string */
00108         uint8_t serial;
00109         /** UUID */
00110         uint8_t uuid[16];
00111         /** Wake-up type */
00112         uint8_t wakeup;
00113 } __attribute__ (( packed ));
00114 
00115 /** SMBIOS system information structure type */
00116 #define SMBIOS_TYPE_SYSTEM_INFORMATION 1
00117 
00118 /** SMBIOS enclosure information structure */
00119 struct smbios_enclosure_information {
00120         /** SMBIOS structure header */
00121         struct smbios_header header;
00122         /** Manufacturer string */
00123         uint8_t manufacturer;
00124         /** Type string */
00125         uint8_t type;
00126         /** Version string */
00127         uint8_t version;
00128         /** Serial number string */
00129         uint8_t serial;
00130         /** Asset tag */
00131         uint8_t asset_tag;
00132 } __attribute__ (( packed ));
00133 
00134 /** SMBIOS enclosure information structure type */
00135 #define SMBIOS_TYPE_ENCLOSURE_INFORMATION 3
00136 
00137 /**
00138  * SMBIOS entry point descriptor
00139  *
00140  * This contains the information from the SMBIOS entry point that we
00141  * care about.
00142  */
00143 struct smbios {
00144         /** Start of SMBIOS structures */
00145         userptr_t address;
00146         /** Length of SMBIOS structures */
00147         size_t len;
00148         /** Number of SMBIOS structures */
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 /* _GPXE_SMBIOS_H */

Generated on Tue Apr 6 20:01:08 2010 for gPXE by  doxygen 1.5.7.1