diff options
| author | Michael Brown | 2008-12-05 00:09:48 +0100 |
|---|---|---|
| committer | Michael Brown | 2008-12-05 00:19:12 +0100 |
| commit | 29480dd7159190b91cca17298a87425a58826d32 (patch) | |
| tree | 8fc1e70c689ab20d6ec7e85955a88a03a09354fa /src/include | |
| parent | [efi] Allow use of EFI configuration tables (diff) | |
| download | ipxe-29480dd7159190b91cca17298a87425a58826d32.tar.gz ipxe-29480dd7159190b91cca17298a87425a58826d32.tar.xz ipxe-29480dd7159190b91cca17298a87425a58826d32.zip | |
[efi] Use EFI-native mechanism for accessing SMBIOS table
EFI provides a copy of the SMBIOS table accessible via the EFI system
table, which we should use instead of manually scanning through the
F000:0000 segment.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/gpxe/efi/Guid/SmBios.h | 34 | ||||
| -rw-r--r-- | src/include/gpxe/efi/efi_smbios.h | 16 | ||||
| -rw-r--r-- | src/include/gpxe/errfile.h | 3 | ||||
| -rw-r--r-- | src/include/gpxe/smbios.h | 140 |
4 files changed, 193 insertions, 0 deletions
diff --git a/src/include/gpxe/efi/Guid/SmBios.h b/src/include/gpxe/efi/Guid/SmBios.h new file mode 100644 index 000000000..c6c7f776e --- /dev/null +++ b/src/include/gpxe/efi/Guid/SmBios.h @@ -0,0 +1,34 @@ +/** @file + GUIDs used to locate the SMBIOS tables in the UEFI 2.0 system table. + + This GUID in the system table is the only legal way to search for and + locate the SMBIOS tables. Do not search the 0xF0000 segment to find SMBIOS + tables. + + Copyright (c) 2006, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + @par Revision Reference: + GUIDs defined in UEFI 2.0 spec. + +**/ + +#ifndef __SMBIOS_GUID_H__ +#define __SMBIOS_GUID_H__ + +#define EFI_SMBIOS_TABLE_GUID \ + { \ + 0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ + } + +#define SMBIOS_TABLE_GUID EFI_SMBIOS_TABLE_GUID + +extern EFI_GUID gEfiSmbiosTableGuid; + +#endif diff --git a/src/include/gpxe/efi/efi_smbios.h b/src/include/gpxe/efi/efi_smbios.h new file mode 100644 index 000000000..df947de56 --- /dev/null +++ b/src/include/gpxe/efi/efi_smbios.h @@ -0,0 +1,16 @@ +#ifndef _GPXE_EFI_SMBIOS_H +#define _GPXE_EFI_SMBIOS_H + +/** @file + * + * gPXE SMBIOS API for EFI + * + */ + +#ifdef SMBIOS_EFI +#define SMBIOS_PREFIX_efi +#else +#define SMBIOS_PREFIX_efi __efi_ +#endif + +#endif /* _GPXE_EFI_SMBIOS_H */ diff --git a/src/include/gpxe/errfile.h b/src/include/gpxe/errfile.h index a3d6d37b8..6b7f3a4bf 100644 --- a/src/include/gpxe/errfile.h +++ b/src/include/gpxe/errfile.h @@ -164,6 +164,9 @@ #define ERRFILE_iscsiboot ( ERRFILE_OTHER | 0x000f0000 ) #define ERRFILE_efi_pci ( ERRFILE_OTHER | 0x00100000 ) #define ERRFILE_efi_snp ( ERRFILE_OTHER | 0x00110000 ) +#define ERRFILE_smbios ( ERRFILE_OTHER | 0x00120000 ) +#define ERRFILE_smbios_settings ( ERRFILE_OTHER | 0x00130000 ) +#define ERRFILE_efi_smbios ( ERRFILE_OTHER | 0x00140000 ) /** @} */ diff --git a/src/include/gpxe/smbios.h b/src/include/gpxe/smbios.h new file mode 100644 index 000000000..2b0fcbd10 --- /dev/null +++ b/src/include/gpxe/smbios.h @@ -0,0 +1,140 @@ +#ifndef _GPXE_SMBIOS_H +#define _GPXE_SMBIOS_H + +/** @file + * + * System Management BIOS + * + */ + +#include <stdint.h> +#include <gpxe/api.h> +#include <config/general.h> +#include <gpxe/uaccess.h> + +/** + * Provide an SMBIOS API implementation + * + * @v _prefix Subsystem prefix + * @v _api_func API function + * @v _func Implementing function + */ +#define PROVIDE_SMBIOS( _subsys, _api_func, _func ) \ + PROVIDE_SINGLE_API ( SMBIOS_PREFIX_ ## _subsys, _api_func, _func ) + +/* Include all architecture-independent SMBIOS API headers */ +#include <gpxe/efi/efi_smbios.h> + +/* Include all architecture-dependent SMBIOS API headers */ +#include <bits/smbios.h> + +/** Signature for SMBIOS entry point */ +#define SMBIOS_SIGNATURE \ + ( ( '_' << 0 ) + ( 'S' << 8 ) + ( 'M' << 16 ) + ( '_' << 24 ) ) + +/** + * SMBIOS entry point + * + * This is the single table which describes the list of SMBIOS + * structures. It is located by scanning through the BIOS segment. + */ +struct smbios_entry { + /** Signature + * + * Must be equal to SMBIOS_SIGNATURE + */ + uint32_t signature; + /** Checksum */ + uint8_t checksum; + /** Length */ + uint8_t len; + /** Major version */ + uint8_t major; + /** Minor version */ + uint8_t minor; + /** Maximum structure size */ + uint16_t max; + /** Entry point revision */ + uint8_t revision; + /** Formatted area */ + uint8_t formatted[5]; + /** DMI Signature */ + uint8_t dmi_signature[5]; + /** DMI checksum */ + uint8_t dmi_checksum; + /** Structure table length */ + uint16_t smbios_len; + /** Structure table address */ + uint32_t smbios_address; + /** Number of SMBIOS structures */ + uint16_t smbios_count; + /** BCD revision */ + uint8_t bcd_revision; +} __attribute__ (( packed )); + +/** An SMBIOS structure header */ +struct smbios_header { + /** Type */ + uint8_t type; + /** Length */ + uint8_t len; + /** Handle */ + uint16_t handle; +} __attribute__ (( packed )); + +/** SMBIOS structure descriptor */ +struct smbios_structure { + /** Copy of SMBIOS structure header */ + struct smbios_header header; + /** Offset of structure within SMBIOS */ + size_t offset; + /** Length of strings section */ + size_t strings_len; +}; + +/** SMBIOS system information structure */ +struct smbios_system_information { + /** SMBIOS structure header */ + struct smbios_header header; + /** Manufacturer string */ + uint8_t manufacturer; + /** Product string */ + uint8_t product; + /** Version string */ + uint8_t version; + /** Serial number string */ + uint8_t serial; + /** UUID */ + uint8_t uuid[16]; + /** Wake-up type */ + uint8_t wakeup; +} __attribute__ (( packed )); + +/** SMBIOS system information structure type */ +#define SMBIOS_TYPE_SYSTEM_INFORMATION 1 + +/** + * SMBIOS entry point descriptor + * + * This contains the information from the SMBIOS entry point that we + * care about. + */ +struct smbios { + /** Start of SMBIOS structures */ + userptr_t address; + /** Length of SMBIOS structures */ + size_t len; + /** Number of SMBIOS structures */ + unsigned int count; +}; + +extern int find_smbios ( struct smbios *smbios ); +extern int find_smbios_structure ( unsigned int type, + struct smbios_structure *structure ); +extern int read_smbios_structure ( struct smbios_structure *structure, + void *data, size_t len ); +extern int read_smbios_string ( struct smbios_structure *structure, + unsigned int index, + void *data, size_t len ); + +#endif /* _GPXE_SMBIOS_H */ |
