smbios_impl.h revision 03f9f63d24f0494b7d47b927090ad9045e396402
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * CDDL HEADER START
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * The contents of this file are subject to the terms of the
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * Common Development and Distribution License (the "License").
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * You may not use this file except in compliance with the License.
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * See the License for the specific language governing permissions
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * and limitations under the License.
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * When distributing Covered Code, include this CDDL HEADER in each
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * If applicable, add the following below this CDDL HEADER, with the
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * fields enclosed by brackets "[]" replaced with your own identifying
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * information: Portions Copyright [yyyy] [name of copyright owner]
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * CDDL HEADER END
03f9f63d24f0494b7d47b927090ad9045e396402Tom Pothier * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * Use is subject to license terms.
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * This header file defines the implementation structures for the SMBIOS access
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * library, libsmbios, and an equivalent kernel module. Clients should use
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * the <smbios.h> or <sys/smbios.h> header files to access DMTF SMBIOS
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * information, NOT these underlying implementation structures from the spec.
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * In short, do not user this header file or these routines for any purpose.
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwsextern "C" {
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwstypedef struct smb_header {
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws uint8_t smbh_type; /* structure type (SMB_TYPE_* value) */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws uint8_t smbh_len; /* length in bytes of formatted area */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwstypedef struct smb_bios {
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws uint16_t smbbi_segment; /* segment location of bios address */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws uint8_t smbbi_romsize; /* bios rom size (64k * (n + 1)) */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws uint8_t smbbi_xcflags[1]; /* bios characteristics extensions */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwstypedef struct smb_system {
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwstypedef struct smb_bboard {
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwstypedef struct smb_chassis {
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws#define SMB_CHT_LOCK 0x80 /* lock bit within smbch_type */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwstypedef struct smb_processor {
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws uint8_t smbpr_type; /* processor type (see <smbios.h>) */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws uint8_t smbpr_family; /* processor family (see <smbios.h>) */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws uint16_t smbpr_clkspeed; /* external clock speed in MHz */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwstypedef struct smb_cache {
e4586ebf2f01666696316c178da243993b1a0c04mws * Convert encoded cache size to bytes: DSP0134 Section 3.3.8 explains the
e4586ebf2f01666696316c178da243993b1a0c04mws * encoding. The highest bit is 0 for 1k units, 1 for 64k units, and this
e4586ebf2f01666696316c178da243993b1a0c04mws * macro decodes the value into bytes for exporting to our clients.
e4586ebf2f01666696316c178da243993b1a0c04mws ((uint32_t)((s) & 0x7FFF) * 64 * 1024) : ((uint32_t)(s) * 1024))
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwstypedef struct smb_port {
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwstypedef struct smb_slot {
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwstypedef struct smb_obdev {
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws#define SMB_OBT_ENABLED 0x80 /* enable bit within smbob_type */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwstypedef struct smb_strtab {
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwstypedef struct smb_lang {
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws uint8_t smblang_num; /* number of installed languages */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwstypedef struct smb_sel {
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws uint8_t smbsel_typesz; /* size of each type descriptor */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws uint8_t smbsel_typev[1]; /* array of type descriptors */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwstypedef struct smb_memarray {
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws uint8_t smbmarr_ecc; /* error detect/correct mechanism */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws uint16_t smbmarr_ndevs; /* number of slots or sockets */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwstypedef struct smb_memarrmap {
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws uint32_t smbamap_start; /* starting address in kilobytes */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws uint16_t smbamap_array; /* physical memory array handle */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwstypedef struct smb_memdevice {
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws#define SMB_MDS_KBYTES 0x8000 /* size in specified in kilobytes */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwstypedef struct smb_memdevmap {
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws uint32_t smbdmap_start; /* starting address in kilobytes */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws uint16_t smbdmap_array; /* memory array mapped address handle */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwstypedef struct smb_battery {
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwstypedef struct smb_hwsec {
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwstypedef struct smb_boot {
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws uint8_t smbbo_status[1]; /* variable-length status buffer */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwstypedef struct smb_ipmi {
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws uint8_t smbipm_info; /* base address modifier/intr info */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwstypedef struct smb_powersup {
03f9f63d24f0494b7d47b927090ad9045e396402Tom Pothiertypedef struct smb_obdev_ext {
03f9f63d24f0494b7d47b927090ad9045e396402Tom Pothier uint8_t smbobe_name; /* reference designation */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothiertypedef struct smb_processor_ext {
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier uint16_t smbpre_processor; /* processor handle */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier uint16_t smbpre_apicid[1]; /* strand initial apic id */
03f9f63d24f0494b7d47b927090ad9045e396402Tom Pothiertypedef struct smb_port_ext {
03f9f63d24f0494b7d47b927090ad9045e396402Tom Pothier uint16_t smbpoe_port; /* port connector handle */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothiertypedef struct smb_pciexrc {
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier smb_header_t smbpciexrc_hdr; /* structure header */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier uint16_t smbpciexrc_bboard; /* base board handle */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothiertypedef struct smb_memarray_ext {
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier smb_header_t smbmarre_hdr; /* structure header */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier uint16_t smbmarre_component; /* component parent handle */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothiertypedef struct smb_memdevice_ext {
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier smb_header_t smbmdeve_hdr; /* structure header */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier uint16_t smbmdeve_mdev; /* memory device handle */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier uint8_t smbmdeve_ncs; /* number of chip select */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwstypedef struct smb_struct {
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws const smb_header_t *smbst_hdr; /* address of raw structure data */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws const uchar_t *smbst_str; /* address of string data (if any) */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws const uchar_t *smbst_end; /* address of 0x0000 ending tag */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws struct smb_struct *smbst_next; /* next structure in hash chain */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws uint16_t *smbst_strtab; /* string index -> offset table */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws smbios_entry_t sh_ent; /* structure table entry point */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws smb_struct_t *sh_structs; /* array of structure descriptors */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws smb_struct_t **sh_hash; /* hash bucket array for descriptors */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws#define SMB_FL_DEBUG 0x1 /* print debug messages for this hdl */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws#define SMB_FL_BUFALLOC 0x2 /* sh_buf was allocated by library */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws#define SMB_BIOS_DEVICE "/dev/xsvc" /* device w/ BIOS physmem */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws#define SMB_SMBIOS_DEVICE "/dev/smbios" /* device w/ SMBIOS image */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws#define SMB_RANGE_START 0xF0000 /* start of physical address range */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws#define SMB_RANGE_LIMIT 0xFFFFF /* limit of physical address range */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws#define SMB_MAJMIN(M, m) ((((M) & 0xFF) << 16) | ((m) & 0xFF))
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws#define ESMB_BASE 1000 /* base value for libsmbios errnos */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws ESMB_NOTFOUND = ESMB_BASE, /* SMBIOS table not found on system */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwsextern const smb_struct_t *smb_lookup_type(smbios_hdl_t *, uint_t);
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwsextern const smb_struct_t *smb_lookup_id(smbios_hdl_t *, uint_t);
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwsextern const char *smb_strptr(const smb_struct_t *, uint_t);
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwsextern smbios_hdl_t *smb_open_error(smbios_hdl_t *, int *, int);
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwsextern const char *smb_strerror(int);
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwsextern void smb_dprintf(smbios_hdl_t *, const char *, ...);
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws#endif /* _SYS_SMBIOS_IMPL_H */