smbios_impl.h revision 6734c4b0468cc77a7871a5dd5c23a5562557d64c
/*
* 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 2015 OmniTI Computer Consulting, Inc. All rights reserved.
* Copyright 2015 Joyent, Inc.
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* This header file defines the implementation structures for the SMBIOS access
* library, libsmbios, and an equivalent kernel module. Clients should use
* information, NOT these underlying implementation structures from the spec.
* In short, do not user this header file or these routines for any purpose.
*/
#ifndef _SYS_SMBIOS_IMPL_H
#define _SYS_SMBIOS_IMPL_H
#include <sys/sysmacros.h>
#ifdef _KERNEL
#else
#include <strings.h>
#include <stddef.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#pragma pack(1)
typedef struct smb_header {
} smb_header_t;
typedef struct smb_bios {
} smb_bios_t;
typedef struct smb_system {
} smb_system_t;
typedef struct smb_bboard {
} smb_bboard_t;
typedef struct smb_chassis {
/* WARNING: the argument is evaluated three times! */
#define SMB_CH_SKU(smbcp) ((char *) \
typedef struct smb_processor {
typedef struct smb_cache {
} smb_cache_t;
/*
* Convert encoded cache size to bytes: DSP0134 Section 7.8 explains the
* encoding. The highest bit is 0 for 1k units, 1 for 64k units, and this
* macro decodes the value into bytes for exporting to our clients.
*/
#define SMB_CACHE_SIZE(s) (((s) & 0x8000) ? \
typedef struct smb_port {
} smb_port_t;
typedef struct smb_slot {
} smb_slot_t;
typedef struct smb_obdev {
} smb_obdev_t;
typedef struct smb_strtab {
} smb_strtab_t;
typedef struct smb_lang {
} smb_lang_t;
typedef struct smb_sel {
} smb_sel_t;
typedef struct smb_memarray {
typedef struct smb_memarrmap {
typedef struct smb_memdevice {
typedef struct smb_memdevmap {
typedef struct smb_battery {
typedef struct smb_hwsec {
} smb_hwsec_t;
#define SMB_HWS_PAN_PS(x) (((x) & 0x03) >> 0)
typedef struct smb_boot {
} smb_boot_t;
typedef struct smb_ipmi {
} smb_ipmi_t;
#define SMB_IPM_SPEC_MINOR(x) ((x) & 0x0F)
#define SMB_IPM_ADDR_IO 1ULL
#define SMB_IPM_INFO_IMODE(x) (((x) & 0x01) >> 0)
#define SMB_IPM_REGS_1B 0
#define SMB_IPM_REGS_4B 1
#define SMB_IPM_REGS_16B 2
#define SMB_IPM_IPOL_LO 0
#define SMB_IPM_IPOL_HI 1
#define SMB_IPM_IMODE_EDGE 0
#define SMB_IPM_IMODE_LEVEL 1
typedef struct smb_powersup {
typedef struct smb_obdev_ext {
typedef struct smb_processor_ext {
typedef struct smb_port_ext {
typedef struct smb_pciexrc {
typedef struct smb_memarray_ext {
typedef struct smb_memdevice_ext {
#pragma pack()
typedef struct smb_struct {
} smb_struct_t;
struct smbios_hdl {
const void *sh_buf; /* structure table buffer */
int sh_err; /* error code for smbios_errno() */
int sh_libvers; /* library client abi version */
int sh_smbvers; /* derived underlying format version */
};
#define SMB_MINOR(v) (((v) & 0x00FF))
enum {
ESMB_MAPDEV, /* failed to map SMBIOS table */
ESMB_NOENT, /* failed to locate structure */
ESMB_NOMEM, /* failed to allocate memory */
ESMB_NOHDR, /* failed to read SMBIOS header */
ESMB_NOSTAB, /* failed to read SMBIOS struct table */
ESMB_NOINFO, /* no common info for structure */
ESMB_SHORT, /* buffer length doesn't match header */
ESMB_CORRUPT, /* buffer struct or len is corrupt */
ESMB_VERSION, /* version not supported by library */
ESMB_NOTSUP, /* feature not supported by provider */
ESMB_HEADER, /* SMBIOS header corrupt or invalid */
ESMB_OLD, /* SMBIOS version is too old for us */
ESMB_NEW, /* SMBIOS version is too new for us */
ESMB_CKSUM, /* SMBIOS header checksum mismatch */
ESMB_INVAL, /* invalid function call argument */
ESMB_TYPE, /* structure type mismatch */
ESMB_UNKNOWN /* unknown error (maximum value tag) */
};
extern int smb_gteq(smbios_hdl_t *, int);
extern int smb_set_errno(smbios_hdl_t *, int);
extern const char *smb_strerror(int);
extern void *smb_zalloc(size_t);
extern void smb_dprintf(smbios_hdl_t *, const char *, ...);
extern int _smb_debug;
/*
* The following series of structures represent the base versions of public
* structures that are used inside by the smbios routines. This allows the
* common code to properly know how much it should or should not bzero and how
* to handle additions to the spec. Types should only be added here if we need
*
* Types here have the name smb_base_%s which corresponds to smbios_%s.
*/
typedef struct smb_base_chassis {
typedef struct smb_base_processor {
typedef struct smb_base_memdevice {
const char *smbbmd_dloc; /* physical device locator string */
const char *smbbmd_bloc; /* physical bank locator string */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SMBIOS_IMPL_H */