xref: /onnv-gate/usr/src/uts/common/sys/smbios_impl.h (revision 437:76c202dd62bf)
1*437Smws /*
2*437Smws  * CDDL HEADER START
3*437Smws  *
4*437Smws  * The contents of this file are subject to the terms of the
5*437Smws  * Common Development and Distribution License, Version 1.0 only
6*437Smws  * (the "License").  You may not use this file except in compliance
7*437Smws  * with the License.
8*437Smws  *
9*437Smws  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*437Smws  * or http://www.opensolaris.org/os/licensing.
11*437Smws  * See the License for the specific language governing permissions
12*437Smws  * and limitations under the License.
13*437Smws  *
14*437Smws  * When distributing Covered Code, include this CDDL HEADER in each
15*437Smws  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*437Smws  * If applicable, add the following below this CDDL HEADER, with the
17*437Smws  * fields enclosed by brackets "[]" replaced with your own identifying
18*437Smws  * information: Portions Copyright [yyyy] [name of copyright owner]
19*437Smws  *
20*437Smws  * CDDL HEADER END
21*437Smws  */
22*437Smws 
23*437Smws /*
24*437Smws  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
25*437Smws  * Use is subject to license terms.
26*437Smws  */
27*437Smws 
28*437Smws /*
29*437Smws  * This header file defines the implementation structures for the SMBIOS access
30*437Smws  * library, libsmbios, and an equivalent kernel module.  Clients should use
31*437Smws  * the <smbios.h> or <sys/smbios.h> header files to access DMTF SMBIOS
32*437Smws  * information, NOT these underlying implementation structures from the spec.
33*437Smws  * In short, do not user this header file or these routines for any purpose.
34*437Smws  */
35*437Smws 
36*437Smws #ifndef	_SYS_SMBIOS_IMPL_H
37*437Smws #define	_SYS_SMBIOS_IMPL_H
38*437Smws 
39*437Smws #pragma ident	"%Z%%M%	%I%	%E% SMI"
40*437Smws 
41*437Smws #include <sys/smbios.h>
42*437Smws #include <sys/sysmacros.h>
43*437Smws 
44*437Smws #ifdef _KERNEL
45*437Smws #include <sys/systm.h>
46*437Smws #else
47*437Smws #include <strings.h>
48*437Smws #include <stddef.h>
49*437Smws #endif
50*437Smws 
51*437Smws #ifdef	__cplusplus
52*437Smws extern "C" {
53*437Smws #endif
54*437Smws 
55*437Smws #pragma pack(1)
56*437Smws 
57*437Smws typedef struct smb_header {
58*437Smws 	uint8_t smbh_type;		/* structure type (SMB_TYPE_* value) */
59*437Smws 	uint8_t smbh_len;		/* length in bytes of formatted area */
60*437Smws 	uint16_t smbh_hdl;		/* structure handle */
61*437Smws } smb_header_t;
62*437Smws 
63*437Smws typedef struct smb_bios {
64*437Smws 	smb_header_t smbbi_hdr;		/* structure header */
65*437Smws 	uint8_t smbbi_vendor;		/* bios vendor string */
66*437Smws 	uint8_t smbbi_version;		/* bios version string */
67*437Smws 	uint16_t smbbi_segment;		/* segment location of bios address */
68*437Smws 	uint8_t smbbi_reldate;		/* bios release date */
69*437Smws 	uint8_t smbbi_romsize;		/* bios rom size (64k * (n + 1)) */
70*437Smws 	uint64_t smbbi_cflags;		/* bios characteristics */
71*437Smws 	uint8_t smbbi_xcflags[1];	/* bios characteristics extensions */
72*437Smws } smb_bios_t;
73*437Smws 
74*437Smws typedef struct smb_system {
75*437Smws 	smb_header_t smbsi_hdr;		/* structure header */
76*437Smws 	uint8_t smbsi_manufacturer;	/* manufacturer */
77*437Smws 	uint8_t smbsi_product;		/* product name */
78*437Smws 	uint8_t smbsi_version;		/* version */
79*437Smws 	uint8_t smbsi_serial;		/* serial number */
80*437Smws 	uint8_t smbsi_uuid[16];		/* UUID */
81*437Smws 	uint8_t smbsi_wakeup;		/* wake-up type */
82*437Smws 	uint8_t smbsi_sku;		/* SKU number */
83*437Smws 	uint8_t smbsi_family;		/* family */
84*437Smws } smb_system_t;
85*437Smws 
86*437Smws typedef struct smb_bboard {
87*437Smws 	smb_header_t smbbb_hdr;		/* structure header */
88*437Smws 	uint8_t smbbb_manufacturer;	/* manufacturer */
89*437Smws 	uint8_t smbbb_product;		/* product name */
90*437Smws 	uint8_t smbbb_version;		/* version */
91*437Smws 	uint8_t smbbb_serial;		/* serial number */
92*437Smws 	uint8_t smbbb_asset;		/* asset tag */
93*437Smws 	uint8_t smbbb_flags;		/* feature flags */
94*437Smws 	uint8_t smbbb_location;		/* location in chassis */
95*437Smws 	uint16_t smbbb_chassis;		/* chassis handle */
96*437Smws 	uint8_t smbbb_type;		/* board type */
97*437Smws 	uint8_t smbbb_cn;		/* number of contained handles */
98*437Smws 	uint16_t smbbb_cv[1];		/* array of contained handles */
99*437Smws } smb_bboard_t;
100*437Smws 
101*437Smws typedef struct smb_chassis {
102*437Smws 	smb_header_t smbch_hdr;		/* structure header */
103*437Smws 	uint8_t smbch_manufacturer;	/* manufacturer */
104*437Smws 	uint8_t smbch_type;		/* type */
105*437Smws 	uint8_t smbch_version;		/* version */
106*437Smws 	uint8_t smbch_serial;		/* serial number */
107*437Smws 	uint8_t smbch_asset;		/* asset tag */
108*437Smws 	uint8_t smbch_bustate;		/* boot-up state */
109*437Smws 	uint8_t smbch_psstate;		/* power supply state */
110*437Smws 	uint8_t smbch_thstate;		/* thermal state */
111*437Smws 	uint8_t smbch_security;		/* security state */
112*437Smws 	uint32_t smbch_oemdata;		/* OEM-specific data */
113*437Smws 	uint8_t smbch_uheight;		/* enclosure height */
114*437Smws 	uint8_t smbch_cords;		/* number of power cords */
115*437Smws 	uint8_t smbch_cn;		/* number of contained records */
116*437Smws 	uint8_t smbch_cm;		/* size of contained records */
117*437Smws 	uint8_t smbch_cv[1];		/* array of contained records */
118*437Smws } smb_chassis_t;
119*437Smws 
120*437Smws #define	SMB_CHT_LOCK	0x80		/* lock bit within smbch_type */
121*437Smws 
122*437Smws typedef struct smb_processor {
123*437Smws 	smb_header_t smbpr_hdr;		/* structure header */
124*437Smws 	uint8_t smbpr_socket;		/* socket designation */
125*437Smws 	uint8_t smbpr_type;		/* processor type (see <smbios.h>) */
126*437Smws 	uint8_t smbpr_family;		/* processor family (see <smbios.h>) */
127*437Smws 	uint8_t smbpr_manufacturer;	/* manufacturer */
128*437Smws 	uint64_t smbpr_cpuid;		/* processor cpuid information */
129*437Smws 	uint8_t smbpr_version;		/* version */
130*437Smws 	uint8_t smbpr_voltage;		/* voltage */
131*437Smws 	uint16_t smbpr_clkspeed;	/* external clock speed in MHz */
132*437Smws 	uint16_t smbpr_maxspeed;	/* maximum speed in MHz */
133*437Smws 	uint16_t smbpr_curspeed;	/* current speed in MHz */
134*437Smws 	uint8_t smbpr_status;		/* status (see <smbios.h>) */
135*437Smws 	uint8_t smbpr_upgrade;		/* upgrade */
136*437Smws 	uint16_t smbpr_l1cache;		/* L1 cache handle (if any) */
137*437Smws 	uint16_t smbpr_l2cache;		/* L2 cache handle (if any) */
138*437Smws 	uint16_t smbpr_l3cache;		/* L3 cache handle (if any) */
139*437Smws 	uint8_t smbpr_serial;		/* serial number */
140*437Smws 	uint8_t smbpr_asset;		/* asset tag */
141*437Smws 	uint8_t smbpr_part;		/* part number */
142*437Smws } smb_processor_t;
143*437Smws 
144*437Smws typedef struct smb_cache {
145*437Smws 	smb_header_t smbca_hdr;		/* structure header */
146*437Smws 	uint8_t smbca_socket;		/* socket designation */
147*437Smws 	uint16_t smbca_config;		/* cache configuration */
148*437Smws 	uint16_t smbca_maxsize;		/* maximum installed size */
149*437Smws 	uint16_t smbca_size;		/* installed size */
150*437Smws 	uint16_t smbca_stype;		/* supported SRAM type */
151*437Smws 	uint16_t smbca_ctype;		/* current SRAM type */
152*437Smws 	uint8_t smbca_speed;		/* speed in nanoseconds */
153*437Smws 	uint8_t smbca_etype;		/* error correction type */
154*437Smws 	uint8_t smbca_ltype;		/* logical cache type */
155*437Smws 	uint8_t smbca_assoc;		/* associativity */
156*437Smws } smb_cache_t;
157*437Smws 
158*437Smws #define	SMB_CACHE_SIZE(s)	\
159*437Smws 	(((s) & 0x8000) ? (((s) & 0x7FFF) << 1) : (s))
160*437Smws 
161*437Smws #define	SMB_CACHE_CFG_MODE(c)		(((c) >> 8) & 3)
162*437Smws #define	SMB_CACHE_CFG_ENABLED(c)	(((c) >> 7) & 1)
163*437Smws #define	SMB_CACHE_CFG_LOCATION(c)	(((c) >> 5) & 3)
164*437Smws #define	SMB_CACHE_CFG_SOCKETED(c)	(((c) >> 3) & 1)
165*437Smws #define	SMB_CACHE_CFG_LEVEL(c)		(((c) & 7) + 1)
166*437Smws 
167*437Smws typedef struct smb_port {
168*437Smws 	smb_header_t smbpo_hdr;		/* structure header */
169*437Smws 	uint8_t smbpo_iref;		/* internal reference designator */
170*437Smws 	uint8_t smbpo_itype;		/* internal connector type */
171*437Smws 	uint8_t smbpo_eref;		/* external reference designator */
172*437Smws 	uint8_t smbpo_etype;		/* external connector type */
173*437Smws 	uint8_t smbpo_ptype;		/* port type */
174*437Smws } smb_port_t;
175*437Smws 
176*437Smws typedef struct smb_slot {
177*437Smws 	smb_header_t smbsl_hdr;		/* structure header */
178*437Smws 	uint8_t smbsl_name;		/* reference designation */
179*437Smws 	uint8_t smbsl_type;		/* slot type */
180*437Smws 	uint8_t smbsl_width;		/* slot data bus width */
181*437Smws 	uint8_t smbsl_usage;		/* current usage */
182*437Smws 	uint8_t smbsl_length;		/* slot length */
183*437Smws 	uint16_t smbsl_id;		/* slot ID */
184*437Smws 	uint8_t smbsl_ch1;		/* slot characteristics 1 */
185*437Smws 	uint8_t smbsl_ch2;		/* slot characteristics 2 */
186*437Smws } smb_slot_t;
187*437Smws 
188*437Smws typedef struct smb_obdev {
189*437Smws 	uint8_t smbob_type;		/* encoded type and enable bit */
190*437Smws 	uint8_t smbob_name;		/* descriptiong string */
191*437Smws } smb_obdev_t;
192*437Smws 
193*437Smws #define	SMB_OBT_ENABLED		0x80	/* enable bit within smbob_type */
194*437Smws 
195*437Smws typedef struct smb_strtab {
196*437Smws 	smb_header_t smbtb_hdr;		/* structure header */
197*437Smws 	uint8_t smbtb_count;		/* number of strings */
198*437Smws } smb_strtab_t;
199*437Smws 
200*437Smws typedef struct smb_lang {
201*437Smws 	smb_header_t smblang_hdr;	/* structure header */
202*437Smws 	uint8_t smblang_num;		/* number of installed languages */
203*437Smws 	uint8_t smblang_flags;		/* flags */
204*437Smws 	uint8_t smblang_resv[15];	/* reserved for future use */
205*437Smws 	uint8_t smblang_cur;		/* current language string */
206*437Smws } smb_lang_t;
207*437Smws 
208*437Smws typedef struct smb_sel {
209*437Smws 	smb_header_t smbsel_hdr;	/* structure header */
210*437Smws 	uint16_t smbsel_len;		/* log area length */
211*437Smws 	uint16_t smbsel_hdroff;		/* header offset */
212*437Smws 	uint16_t smbsel_dataoff;	/* data offset */
213*437Smws 	uint8_t smbsel_method;		/* access method */
214*437Smws 	uint8_t smbsel_status;		/* status flags */
215*437Smws 	uint32_t smbsel_token;		/* change token */
216*437Smws 	uint32_t smbsel_addr;		/* access method address */
217*437Smws 	uint8_t smbsel_format;		/* header format */
218*437Smws 	uint8_t smbsel_typec;		/* number of type descriptors */
219*437Smws 	uint8_t smbsel_typesz;		/* size of each type descriptor */
220*437Smws 	uint8_t smbsel_typev[1];	/* array of type descriptors */
221*437Smws } smb_sel_t;
222*437Smws 
223*437Smws typedef struct smb_memarray {
224*437Smws 	smb_header_t smbmarr_hdr;	/* structure header */
225*437Smws 	uint8_t smbmarr_loc;		/* location */
226*437Smws 	uint8_t smbmarr_use;		/* use */
227*437Smws 	uint8_t smbmarr_ecc;		/* error detect/correct mechanism */
228*437Smws 	uint32_t smbmarr_cap;		/* maximum capacity */
229*437Smws 	uint16_t smbmarr_err;		/* error handle */
230*437Smws 	uint16_t smbmarr_ndevs;		/* number of slots or sockets */
231*437Smws } smb_memarray_t;
232*437Smws 
233*437Smws typedef struct smb_memarrmap {
234*437Smws 	smb_header_t smbamap_hdr;	/* structure header */
235*437Smws 	uint32_t smbamap_start;		/* starting address in kilobytes */
236*437Smws 	uint32_t smbamap_end;		/* ending address in kilobytes */
237*437Smws 	uint16_t smbamap_array;		/* physical memory array handle */
238*437Smws 	uint8_t smbamap_width;		/* partition width */
239*437Smws } smb_memarrmap_t;
240*437Smws 
241*437Smws typedef struct smb_memdevice {
242*437Smws 	smb_header_t smbmdev_hdr;	/* structure header */
243*437Smws 	uint16_t smbmdev_array;		/* array handle */
244*437Smws 	uint16_t smbmdev_error;		/* error handle */
245*437Smws 	uint16_t smbmdev_twidth;	/* total width */
246*437Smws 	uint16_t smbmdev_dwidth;	/* data width */
247*437Smws 	uint16_t smbmdev_size;		/* size in either K or MB */
248*437Smws 	uint8_t smbmdev_form;		/* form factor */
249*437Smws 	uint8_t smbmdev_set;		/* device set */
250*437Smws 	uint8_t smbmdev_dloc;		/* device locator */
251*437Smws 	uint8_t smbmdev_bloc;		/* bank locator */
252*437Smws 	uint8_t smbmdev_type;		/* memory type */
253*437Smws 	uint16_t smbmdev_flags;		/* detail flags */
254*437Smws 	uint16_t smbmdev_speed;		/* speed in MHz */
255*437Smws 	uint8_t smbmdev_manufacturer;	/* manufacturer */
256*437Smws 	uint8_t smbmdev_serial;		/* serial number */
257*437Smws 	uint8_t smbmdev_asset;		/* asset tag */
258*437Smws 	uint8_t smbmdev_part;		/* part number */
259*437Smws } smb_memdevice_t;
260*437Smws 
261*437Smws #define	SMB_MDS_KBYTES		0x8000	/* size in specified in kilobytes */
262*437Smws 
263*437Smws typedef struct smb_memdevmap {
264*437Smws 	smb_header_t smbdmap_hdr;	/* structure header */
265*437Smws 	uint32_t smbdmap_start;		/* starting address in kilobytes */
266*437Smws 	uint32_t smbdmap_end;		/* ending address in kilobytes */
267*437Smws 	uint16_t smbdmap_device;	/* memory device handle */
268*437Smws 	uint16_t smbdmap_array;		/* memory array mapped address handle */
269*437Smws 	uint8_t smbdmap_rpos;		/* row position */
270*437Smws 	uint8_t smbdmap_ipos;		/* interleave position */
271*437Smws 	uint8_t smbdmap_idepth;		/* interleave depth */
272*437Smws } smb_memdevmap_t;
273*437Smws 
274*437Smws typedef struct smb_battery {
275*437Smws 	smb_header_t smbbat_hdr;	/* structure header */
276*437Smws 	uint8_t smbbat_loc;		/* location */
277*437Smws 	uint8_t smbbat_manufacturer;	/* manufacturer */
278*437Smws 	uint8_t smbbat_date;		/* manufacture date */
279*437Smws 	uint8_t smbbat_serial;		/* serial number */
280*437Smws 	uint8_t smbbat_devname;		/* device name */
281*437Smws 	uint8_t smbbat_chem;		/* device chemistry */
282*437Smws 	uint16_t smbbat_cap;		/* design capacity in mW hours */
283*437Smws 	uint16_t smbbat_volt;		/* design voltage in mV */
284*437Smws 	uint8_t smbbat_version;		/* SBDS version string */
285*437Smws 	uint8_t smbbat_err;		/* error percentage */
286*437Smws 	uint16_t smbbat_ssn;		/* SBDS serial number */
287*437Smws 	uint16_t smbbat_sdate;		/* SBDS manufacture date */
288*437Smws 	uint8_t smbbat_schem;		/* SBDS chemistry string */
289*437Smws 	uint8_t smbbat_mult;		/* design capacity multiplier */
290*437Smws 	uint32_t smbbat_oemdata;	/* OEM-specific data */
291*437Smws } smb_battery_t;
292*437Smws 
293*437Smws typedef struct smb_hwsec {
294*437Smws 	smb_header_t smbhs_hdr;		/* structure header */
295*437Smws 	uint8_t smbhs_settings;		/* settings byte */
296*437Smws } smb_hwsec_t;
297*437Smws 
298*437Smws #define	SMB_HWS_PWR_PS(x)	(((x) & 0xC0) >> 6)
299*437Smws #define	SMB_HWS_KBD_PS(x)	(((x) & 0x30) >> 4)
300*437Smws #define	SMB_HWS_ADM_PS(x)	(((x) & 0x0C) >> 2)
301*437Smws #define	SMB_HWS_PAN_PS(x)	(((x) & 0x03) >> 0)
302*437Smws 
303*437Smws typedef struct smb_boot {
304*437Smws 	smb_header_t smbbo_hdr;		/* structure header */
305*437Smws 	uint8_t smbbo_pad[6];		/* reserved for future use */
306*437Smws 	uint8_t smbbo_status[1];	/* variable-length status buffer */
307*437Smws } smb_boot_t;
308*437Smws 
309*437Smws typedef struct smb_ipmi {
310*437Smws 	smb_header_t smbipm_hdr;	/* structure header */
311*437Smws 	uint8_t smbipm_type;		/* interface type */
312*437Smws 	uint8_t smbipm_spec;		/* specification revision */
313*437Smws 	uint8_t smbipm_i2c;		/* i2C slave address */
314*437Smws 	uint8_t smbipm_bus;		/* NV storage device bus ID */
315*437Smws 	uint64_t smbipm_addr;		/* base address */
316*437Smws 	uint8_t smbipm_info;		/* base address modifier/intr info */
317*437Smws 	uint8_t smbipm_intr;		/* interrupt number */
318*437Smws } smb_ipmi_t;
319*437Smws 
320*437Smws #define	SMB_IPM_SPEC_MAJOR(x)	(((x) & 0xF0) >> 4)
321*437Smws #define	SMB_IPM_SPEC_MINOR(x)	((x) & 0x0F)
322*437Smws 
323*437Smws #define	SMB_IPM_ADDR_IO		1ULL
324*437Smws 
325*437Smws #define	SMB_IPM_INFO_REGS(x)	(((x) & 0xC0) >> 6)
326*437Smws #define	SMB_IPM_INFO_LSB(x)	(((x) & 0x10) >> 4)
327*437Smws #define	SMB_IPM_INFO_ISPEC(x)	(((x) & 0x08) >> 3)
328*437Smws #define	SMB_IPM_INFO_IPOL(x)	(((x) & 0x02) >> 1)
329*437Smws #define	SMB_IPM_INFO_IMODE(x)	(((x) & 0x01) >> 0)
330*437Smws 
331*437Smws #define	SMB_IPM_REGS_1B		0
332*437Smws #define	SMB_IPM_REGS_4B		1
333*437Smws #define	SMB_IPM_REGS_16B	2
334*437Smws 
335*437Smws #define	SMB_IPM_IPOL_LO		0
336*437Smws #define	SMB_IPM_IPOL_HI		1
337*437Smws 
338*437Smws #define	SMB_IPM_IMODE_EDGE	0
339*437Smws #define	SMB_IPM_IMODE_LEVEL	1
340*437Smws 
341*437Smws typedef struct smb_powersup {
342*437Smws 	smb_header_t smbpsup_hdr;	/* structure header */
343*437Smws 	uint8_t smbpsup_group;		/* group id */
344*437Smws 	uint8_t smbpsup_loc;		/* location tag */
345*437Smws 	uint8_t smbpsup_devname;	/* device name */
346*437Smws 	uint8_t smbpsup_manufacturer;	/* manufacturer */
347*437Smws 	uint8_t smbpsup_serial;		/* serial number */
348*437Smws 	uint8_t smbpsup_asset;		/* asset tag */
349*437Smws 	uint8_t smbpsup_part;		/* part number */
350*437Smws 	uint8_t smbpsup_rev;		/* revision string */
351*437Smws 	uint16_t smbpsup_max;		/* max output in milliwatts */
352*437Smws 	uint16_t smbpsup_char;		/* characteristics */
353*437Smws 	uint16_t smbpsup_vprobe;	/* voltage probe handle */
354*437Smws 	uint16_t smbpsup_cooldev;	/* cooling device handle */
355*437Smws 	uint16_t smbpsup_iprobe;	/* current probe handle */
356*437Smws } smb_powersup_t;
357*437Smws 
358*437Smws #pragma pack()
359*437Smws 
360*437Smws typedef struct smb_struct {
361*437Smws 	const smb_header_t *smbst_hdr;	/* address of raw structure data */
362*437Smws 	const uchar_t *smbst_str;	/* address of string data (if any) */
363*437Smws 	const uchar_t *smbst_end;	/* address of 0x0000 ending tag */
364*437Smws 	struct smb_struct *smbst_next; 	/* next structure in hash chain */
365*437Smws 	uint16_t *smbst_strtab;		/* string index -> offset table */
366*437Smws 	uint_t smbst_strtablen;		/* length of smbst_strtab */
367*437Smws } smb_struct_t;
368*437Smws 
369*437Smws struct smbios_hdl {
370*437Smws 	smbios_entry_t sh_ent;		/* structure table entry point */
371*437Smws 	const void *sh_buf;		/* structure table buffer */
372*437Smws 	size_t sh_buflen;		/* size of structure table buffer */
373*437Smws 	smb_struct_t *sh_structs;	/* array of structure descriptors */
374*437Smws 	uint_t sh_nstructs;		/* number of active structures */
375*437Smws 	smb_struct_t **sh_hash;		/* hash bucket array for descriptors */
376*437Smws 	uint_t sh_hashlen;		/* hash bucket array length */
377*437Smws 	int sh_err;			/* error code for smbios_errno() */
378*437Smws 	int sh_libvers;			/* library client abi version */
379*437Smws 	int sh_smbvers;			/* derived underlying format version */
380*437Smws 	uint_t sh_flags;		/* miscellaneous flags (see below) */
381*437Smws };
382*437Smws 
383*437Smws #define	SMB_FL_DEBUG	0x1		/* print debug messages for this hdl */
384*437Smws #define	SMB_FL_BUFALLOC	0x2		/* sh_buf was allocated by library */
385*437Smws 
386*437Smws #define	SMB_BIOS_DEVICE		"/dev/xsvc"	/* device w/ BIOS physmem */
387*437Smws #define	SMB_SMBIOS_DEVICE	"/dev/smbios"	/* device w/ SMBIOS image */
388*437Smws 
389*437Smws #define	SMB_RANGE_START	0xF0000		/* start of physical address range */
390*437Smws #define	SMB_RANGE_LIMIT	0xFFFFF		/* limit of physical address range */
391*437Smws 
392*437Smws #define	SMB_MAJMIN(M, m)	((((M) & 0xFF) << 16) | ((m) & 0xFF))
393*437Smws #define	SMB_MAJOR(v)		(((v) & 0xFF00) >> 8)
394*437Smws #define	SMB_MINOR(v)		(((v) & 0x00FF))
395*437Smws 
396*437Smws #define	ESMB_BASE	1000		/* base value for libsmbios errnos */
397*437Smws 
398*437Smws enum {
399*437Smws 	ESMB_NOTFOUND = ESMB_BASE,	/* SMBIOS table not found on system */
400*437Smws 	ESMB_MAPDEV,			/* failed to map SMBIOS table */
401*437Smws 	ESMB_NOENT,			/* failed to locate structure */
402*437Smws 	ESMB_NOMEM,			/* failed to allocate memory */
403*437Smws 	ESMB_NOHDR,			/* failed to read SMBIOS header */
404*437Smws 	ESMB_NOSTAB,			/* failed to read SMBIOS struct table */
405*437Smws 	ESMB_NOINFO,			/* no common info for structure */
406*437Smws 	ESMB_SHORT,			/* buffer length doesn't match header */
407*437Smws 	ESMB_CORRUPT,			/* buffer struct or len is corrupt */
408*437Smws 	ESMB_VERSION,			/* version not supported by library */
409*437Smws 	ESMB_NOTSUP,			/* feature not supported by provider */
410*437Smws 	ESMB_HEADER,			/* SMBIOS header corrupt or invalid */
411*437Smws 	ESMB_OLD,			/* SMBIOS version is too old for us */
412*437Smws 	ESMB_NEW,			/* SMBIOS version is too new for us */
413*437Smws 	ESMB_CKSUM,			/* SMBIOS header checksum mismatch */
414*437Smws 	ESMB_INVAL,			/* invalid function call argument */
415*437Smws 	ESMB_TYPE,			/* structure type mismatch */
416*437Smws 	ESMB_UNKNOWN			/* unknown error (maximum value tag) */
417*437Smws };
418*437Smws 
419*437Smws extern const smb_struct_t *smb_lookup_type(smbios_hdl_t *, uint_t);
420*437Smws extern const smb_struct_t *smb_lookup_id(smbios_hdl_t *, uint_t);
421*437Smws extern const char *smb_strptr(const smb_struct_t *, uint_t);
422*437Smws extern int smb_gteq(smbios_hdl_t *, int);
423*437Smws 
424*437Smws extern int smb_set_errno(smbios_hdl_t *, int);
425*437Smws extern smbios_hdl_t *smb_open_error(smbios_hdl_t *, int *, int);
426*437Smws extern const char *smb_strerror(int);
427*437Smws 
428*437Smws extern void *smb_alloc(size_t);
429*437Smws extern void *smb_zalloc(size_t);
430*437Smws extern void smb_free(void *, size_t);
431*437Smws 
432*437Smws extern void smb_dprintf(smbios_hdl_t *, const char *, ...);
433*437Smws 
434*437Smws extern int _smb_debug;
435*437Smws 
436*437Smws #ifdef	__cplusplus
437*437Smws }
438*437Smws #endif
439*437Smws 
440*437Smws #endif	/* _SYS_SMBIOS_IMPL_H */
441