smbios.h revision 03f9f63d24f0494b7d47b927090ad9045e396402
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* This header file defines the interfaces available from the SMBIOS access
* library, libsmbios, and an equivalent kernel module. This API can be used
* to access DMTF SMBIOS data from a device, file, or raw memory buffer.
* This is NOT yet a public interface, although it may eventually become one in
* the fullness of time after we gain more experience with the interfaces.
*
* In the meantime, be aware that any program linked with this API in this
* release of Solaris is almost guaranteed to break in the next release.
*
* In short, do not user this header file or these routines for any purpose.
*/
#ifndef _SYS_SMBIOS_H
#define _SYS_SMBIOS_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* SMBIOS Structure Table Entry Point. See DSP0134 2.1.1 for more information.
* The structure table entry point is located by searching for the anchor.
*/
#pragma pack(1)
typedef struct smbios_entry {
#pragma pack()
/*
* Structure type codes. The comments next to each type include an (R) note to
* indicate a structure that is required as of SMBIOS v2.3 and an (O) note to
* indicate a structure that is obsolete as of SMBIOS v2.3.
*/
#define SMB_TYPE_BIOS 0 /* BIOS information (R) */
/*
* OEM string indicating "Platform Resource Management Specification"
* compliance.
*/
#define SMB_PRMS1 "SUNW-PRMS-1"
/*
* Some default values set by BIOS vendor
*/
#define SMB_DEFAULT1 "To Be Filled By O.E.M."
#define SMB_DEFAULT2 "Not Available"
/*
* SMBIOS Common Information. These structures do not correspond to anything
* in the SMBIOS specification, but allow library clients to more easily read
* information that is frequently encoded into the various SMBIOS structures.
*/
typedef struct smbios_info {
const char *smbi_manufacturer; /* manufacturer */
const char *smbi_product; /* product name */
const char *smbi_version; /* version */
const char *smbi_serial; /* serial number */
const char *smbi_asset; /* asset tag */
const char *smbi_location; /* location tag */
const char *smbi_part; /* part number */
typedef struct smbios_version {
/*
* SMBIOS Bios Information. See DSP0134 Section 3.3.1 for more information.
* smbb_romsize is converted from the implementation format into bytes.
*/
typedef struct smbios_bios {
const char *smbb_vendor; /* bios vendor string */
const char *smbb_version; /* bios version string */
const char *smbb_reldate; /* bios release date */
#define SMB_BIOSXB_1 0 /* bios extension byte 1 (3.3.1.2.1) */
/*
* SMBIOS Bios Information. See DSP0134 Section 3.3.2 for more information.
* The current set of smbs_wakeup values is defined after the structure.
*/
typedef struct smbios_system {
const char *smbs_sku; /* SKU number */
const char *smbs_family; /* family */
/*
* SMBIOS Base Board description. See DSP0134 Section 3.3.3 for more
* information. smbb_flags and smbb_type definitions are below.
*/
typedef struct smbios_bboard {
/*
* SMBIOS Chassis description. See DSP0134 Section 3.3.4 for more information.
* We move the lock bit of the type field into smbc_lock for easier processing.
*/
typedef struct smbios_chassis {
/*
* SMBIOS Processor description. See DSP0134 Section 3.3.5 for more details.
* If the L1, L2, or L3 cache handle is -1, the cache information is unknown.
* If the handle refers to something of size 0, that type of cache is absent.
*
* NOTE: Although SMBIOS exports a 64-bit CPUID result, this value should not
* be used for any purpose other than BIOS debugging. Solaris itself computes
* its own CPUID value and applies knowledge of additional errata and processor
* specific CPUID variations, so this value should not be used for anything.
*/
typedef struct smbios_processor {
#define SMB_PRV_VOLTAGE(v) ((v) & 0x7f)
/*
* SMBIOS Cache Information. See DSP0134 Section 3.3.8 for more information.
* If smba_size is zero, this indicates the specified cache is not present.
*/
typedef struct smbios_cache {
/*
* SMBIOS Port Information. See DSP0134 Section 3.3.9 for more information.
* The internal reference designator string is also mapped to the location.
*/
typedef struct smbios_port {
const char *smbo_iref; /* internal reference designator */
const char *smbo_eref; /* external reference designator */
/*
* SMBIOS Slot Information. See DSP0134 Section 3.3.10 for more information.
* See DSP0134 3.3.10.5 for how to interpret the value of smbl_id.
*/
typedef struct smbios_slot {
const char *smbl_name; /* reference designation */
/*
* SMBIOS On-Board Device Information. See DSP0134 Section 3.3.11 for more
* information. Any number of on-board device sections may be present, each
* containing one or more records. The smbios_info_obdevs() function permits
* the caller to retrieve one or more of the records from a given section.
*/
typedef struct smbios_obdev {
const char *smbd_name; /* description string for this device */
/*
* SMBIOS BIOS Language Information. See DSP0134 Section 3.3.14 for more
* information. The smbios_info_strtab() function can be applied using a
* count of smbla_num to retrieve the other possible language settings.
*/
typedef struct smbios_lang {
const char *smbla_cur; /* current language setting */
#define SMB_LFMT_LONG 0 /* <ISO639>|<ISO3166>|Encoding Method */
/*
* SMBIOS System Event Log Information. See DSP0134 Section 3.3.16 for more
* information. Accessing the event log itself requires additional interfaces.
*/
typedef struct smbios_evtype {
typedef struct smbios_evlog {
union {
struct {
} eva_io; /* i/o address for SMB_EVM_XxY */
} smbev_addr;
#define SMB_EVM_1x1i_1x1d 0 /* I/O: 1 1b idx port, 1 1b data port */
#define SMB_EVHF_NONE 0 /* no log headers used */
/*
* SMBIOS Physical Memory Array Information. See DSP0134 Section 3.3.17 for
* more information. This describes a collection of physical memory devices.
*/
typedef struct smbios_memarray {
/*
* SMBIOS Memory Device Information. See DSP0134 Section 3.3.18 for more
* information. One or more of these structures are associated with each
* smbios_memarray_t. A structure is present even for unpopulated sockets.
* Unknown values are set to -1. A smbmd_size of 0 indicates unpopulated.
* WARNING: Some BIOSes appear to export the *maximum* size of the device
* that can appear in the corresponding socket as opposed to the current one.
*/
typedef struct smbios_memdevice {
const char *smbmd_dloc; /* physical device locator string */
const char *smbmd_bloc; /* physical bank locator string */
/*
* SMBIOS Memory Array Mapped Address. See DSP0134 Section 3.3.20 for more
*/
typedef struct smbios_memarrmap {
/*
* SMBIOS Memory Device Mapped Address. See DSP0134 Section 3.3.21 for more
*/
typedef struct smbios_memdevmap {
/*
* SMBIOS Hardware Security Settings. See DSP0134 Section 3.3.25 for more
* information. Only one such record will be present in the SMBIOS.
*/
typedef struct smbios_hwsec {
/*
* SMBIOS System Boot Information. See DSP0134 Section 3.3.33 for more
* information. The contents of the data varies by type and is undocumented
* from the perspective of DSP0134 -- it seems to be left as vendor-specific.
* The (D) annotation next to SMB_BOOT_* below indicates possible data payload.
*/
typedef struct smbios_boot {
const void *smbt_data; /* data buffer specific to status */
#define SMB_BOOT_NORMAL 0 /* no errors detected */
/*
* SMBIOS IPMI Device Information. See DSP0134 Section 3.3.39 and also
* Appendix C1 of the IPMI specification for more information on this record.
*/
typedef struct smbios_ipmi {
/*
* SMBIOS Onboard Devices Extended Information. See DSP0134 Section 3.3.42
* for more information.
*/
typedef struct smbios_obdev_ext {
const char *smboe_name; /* reference designation */
/*
* SMBIOS OEM-specific (Type 132) Processor Extended Information.
*/
typedef struct smbios_processor_ext {
/*
* SMBIOS OEM-specific (Type 136) Port Extended Information.
*/
typedef struct smbios_port_ext {
/*
*/
typedef struct smbios_pciexrc {
/*
* SMBIOS OEM-specific (Type 144) Memory Array Extended Information.
*/
typedef struct smbios_memarray_ext {
/*
* SMBIOS OEM-specific (Type 145) Memory Device Extended Information.
*/
typedef struct smbios_memdevice_ext {
/*
* SMBIOS Interfaces. An SMBIOS image can be opened by either providing a file
* pathname, device pathname, file descriptor, or raw memory buffer. Once an
* image is opened the functions below can be used to iterate over the various
* structures and convert the underlying data representation into the simpler
* data structures described earlier in this header file. The SMB_VERSION
* constant specified when opening an image indicates the version of the ABI
* the caller expects and the DMTF SMBIOS version the client can understand.
* The library will then map older or newer data structures to that as needed.
*/
typedef struct smbios_hdl smbios_hdl_t;
typedef struct smbios_struct {
const void *smbstr_data; /* structure data */
typedef int smbios_struct_f(smbios_hdl_t *,
const smbios_struct_t *, void *);
extern smbios_hdl_t *smbios_open(const char *, int, int, int *);
extern smbios_hdl_t *smbios_fdopen(int, int, int, int *);
const void *, size_t, int, int, int *);
extern const void *smbios_buf(smbios_hdl_t *);
extern int smbios_write(smbios_hdl_t *, int);
extern void smbios_close(smbios_hdl_t *);
extern int smbios_errno(smbios_hdl_t *);
extern const char *smbios_errmsg(int);
extern const char *smbios_psn(smbios_hdl_t *);
extern const char *smbios_csn(smbios_hdl_t *);
#ifndef _KERNEL
/*
* The smbios_*_desc() and smbios_*_name() interfaces can be used for utilities
* such as smbios(1M) that wish to decode SMBIOS fields for humans. The _desc
* functions return the comment string next to the #defines listed above, and
* the _name functions return the appropriate #define identifier itself.
*/
extern const char *smbios_bboard_flag_desc(uint_t);
extern const char *smbios_bboard_flag_name(uint_t);
extern const char *smbios_bboard_type_desc(uint_t);
extern const char *smbios_bios_flag_desc(uint64_t);
extern const char *smbios_bios_flag_name(uint64_t);
extern const char *smbios_bios_xb1_desc(uint_t);
extern const char *smbios_bios_xb1_name(uint_t);
extern const char *smbios_bios_xb2_desc(uint_t);
extern const char *smbios_bios_xb2_name(uint_t);
extern const char *smbios_boot_desc(uint_t);
extern const char *smbios_cache_assoc_desc(uint_t);
extern const char *smbios_cache_ctype_desc(uint_t);
extern const char *smbios_cache_ctype_name(uint_t);
extern const char *smbios_cache_ecc_desc(uint_t);
extern const char *smbios_cache_flag_desc(uint_t);
extern const char *smbios_cache_flag_name(uint_t);
extern const char *smbios_cache_loc_desc(uint_t);
extern const char *smbios_cache_logical_desc(uint_t);
extern const char *smbios_cache_mode_desc(uint_t);
extern const char *smbios_chassis_state_desc(uint_t);
extern const char *smbios_chassis_type_desc(uint_t);
extern const char *smbios_evlog_flag_desc(uint_t);
extern const char *smbios_evlog_flag_name(uint_t);
extern const char *smbios_evlog_format_desc(uint_t);
extern const char *smbios_evlog_method_desc(uint_t);
extern const char *smbios_ipmi_flag_name(uint_t);
extern const char *smbios_ipmi_flag_desc(uint_t);
extern const char *smbios_ipmi_type_desc(uint_t);
extern const char *smbios_hwsec_desc(uint_t);
extern const char *smbios_memarray_loc_desc(uint_t);
extern const char *smbios_memarray_use_desc(uint_t);
extern const char *smbios_memarray_ecc_desc(uint_t);
extern const char *smbios_memdevice_form_desc(uint_t);
extern const char *smbios_memdevice_type_desc(uint_t);
extern const char *smbios_memdevice_flag_name(uint_t);
extern const char *smbios_memdevice_flag_desc(uint_t);
extern const char *smbios_port_conn_desc(uint_t);
extern const char *smbios_port_type_desc(uint_t);
extern const char *smbios_processor_family_desc(uint_t);
extern const char *smbios_processor_status_desc(uint_t);
extern const char *smbios_processor_type_desc(uint_t);
extern const char *smbios_processor_upgrade_desc(uint_t);
extern const char *smbios_slot_type_desc(uint_t);
extern const char *smbios_slot_width_desc(uint_t);
extern const char *smbios_slot_usage_desc(uint_t);
extern const char *smbios_slot_length_desc(uint_t);
extern const char *smbios_slot_ch1_desc(uint_t);
extern const char *smbios_slot_ch1_name(uint_t);
extern const char *smbios_slot_ch2_desc(uint_t);
extern const char *smbios_slot_ch2_name(uint_t);
extern const char *smbios_type_desc(uint_t);
extern const char *smbios_type_name(uint_t);
extern const char *smbios_system_wakeup_desc(uint_t);
#endif /* !_KERNEL */
#ifdef _KERNEL
/*
* For SMBIOS clients within the kernel itself, ksmbios is used to refer to
* the kernel's current snapshot of the SMBIOS, if one exists, and the
* ksmbios_flags tunable is the set of flags for use with smbios_open().
*/
extern smbios_hdl_t *ksmbios;
extern int ksmbios_flags;
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SMBIOS_H */