xref: /titanic_51/usr/src/uts/common/sys/smbios.h (revision 58dbc5075c2263a035b497f4bb080ab9bfb6aab4)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*
28  * This header file defines the interfaces available from the SMBIOS access
29  * library, libsmbios, and an equivalent kernel module.  This API can be used
30  * to access DMTF SMBIOS data from a device, file, or raw memory buffer.
31  * This is NOT yet a public interface, although it may eventually become one in
32  * the fullness of time after we gain more experience with the interfaces.
33  *
34  * In the meantime, be aware that any program linked with this API in this
35  * release of Solaris is almost guaranteed to break in the next release.
36  *
37  * In short, do not user this header file or these routines for any purpose.
38  */
39 
40 #ifndef	_SYS_SMBIOS_H
41 #define	_SYS_SMBIOS_H
42 
43 #include <sys/types.h>
44 
45 #ifdef	__cplusplus
46 extern "C" {
47 #endif
48 
49 /*
50  * SMBIOS Structure Table Entry Point.  See DSP0134 2.1.1 for more information.
51  * The structure table entry point is located by searching for the anchor.
52  */
53 #pragma pack(1)
54 
55 typedef struct smbios_entry {
56 	char smbe_eanchor[4];		/* anchor tag (SMB_ENTRY_EANCHOR) */
57 	uint8_t smbe_ecksum;		/* checksum of entry point structure */
58 	uint8_t smbe_elen;		/* length in bytes of entry point */
59 	uint8_t smbe_major;		/* major version of the SMBIOS spec */
60 	uint8_t smbe_minor;		/* minor version of the SMBIOS spec */
61 	uint16_t smbe_maxssize;		/* maximum size in bytes of a struct */
62 	uint8_t smbe_revision;		/* entry point structure revision */
63 	uint8_t smbe_format[5];		/* entry point revision-specific data */
64 	char smbe_ianchor[5];		/* intermed. tag (SMB_ENTRY_IANCHOR) */
65 	uint8_t smbe_icksum;		/* intermed. checksum */
66 	uint16_t smbe_stlen;		/* length in bytes of structure table */
67 	uint32_t smbe_staddr;		/* physical addr of structure table */
68 	uint16_t smbe_stnum;		/* number of structure table entries */
69 	uint8_t smbe_bcdrev;		/* BCD value representing DMI version */
70 } smbios_entry_t;
71 
72 #pragma pack()
73 
74 #define	SMB_ENTRY_EANCHOR	"_SM_"	/* structure table entry point anchor */
75 #define	SMB_ENTRY_EANCHORLEN	4	/* length of entry point anchor */
76 #define	SMB_ENTRY_IANCHOR	"_DMI_"	/* intermediate anchor string */
77 #define	SMB_ENTRY_IANCHORLEN	5	/* length of intermediate anchor */
78 #define	SMB_ENTRY_MAXLEN	255	/* maximum length of entry point */
79 
80 /*
81  * Structure type codes.  The comments next to each type include an (R) note to
82  * indicate a structure that is required as of SMBIOS v2.3 and an (O) note to
83  * indicate a structure that is obsolete as of SMBIOS v2.3.
84  */
85 #define	SMB_TYPE_BIOS		0	/* BIOS information (R) */
86 #define	SMB_TYPE_SYSTEM		1	/* system information (R) */
87 #define	SMB_TYPE_BASEBOARD	2	/* base board */
88 #define	SMB_TYPE_CHASSIS	3	/* system enclosure or chassis (R) */
89 #define	SMB_TYPE_PROCESSOR	4	/* processor (R) */
90 #define	SMB_TYPE_MEMCTL		5	/* memory controller (O) */
91 #define	SMB_TYPE_MEMMOD		6	/* memory module (O) */
92 #define	SMB_TYPE_CACHE		7	/* processor cache (R) */
93 #define	SMB_TYPE_PORT		8	/* port connector */
94 #define	SMB_TYPE_SLOT		9	/* upgradeable system slot (R) */
95 #define	SMB_TYPE_OBDEVS		10	/* on-board devices */
96 #define	SMB_TYPE_OEMSTR		11	/* OEM string table */
97 #define	SMB_TYPE_SYSCONFSTR	12	/* system configuration string table */
98 #define	SMB_TYPE_LANG		13	/* BIOS language information */
99 #define	SMB_TYPE_GROUP		14	/* group associations */
100 #define	SMB_TYPE_EVENTLOG	15	/* system event log */
101 #define	SMB_TYPE_MEMARRAY	16	/* physical memory array (R) */
102 #define	SMB_TYPE_MEMDEVICE	17	/* memory device (R) */
103 #define	SMB_TYPE_MEMERR32	18	/* 32-bit memory error information */
104 #define	SMB_TYPE_MEMARRAYMAP	19	/* memory array mapped address (R) */
105 #define	SMB_TYPE_MEMDEVICEMAP	20	/* memory device mapped address (R) */
106 #define	SMB_TYPE_POINTDEV	21	/* built-in pointing device */
107 #define	SMB_TYPE_BATTERY	22	/* portable battery */
108 #define	SMB_TYPE_RESET		23	/* system reset settings */
109 #define	SMB_TYPE_SECURITY	24	/* hardware security settings */
110 #define	SMB_TYPE_POWERCTL	25	/* system power controls */
111 #define	SMB_TYPE_VPROBE		26	/* voltage probe */
112 #define	SMB_TYPE_COOLDEV	27	/* cooling device */
113 #define	SMB_TYPE_TPROBE		28	/* temperature probe */
114 #define	SMB_TYPE_IPROBE		29	/* current probe */
115 #define	SMB_TYPE_OOBRA		30	/* out-of-band remote access facility */
116 #define	SMB_TYPE_BIS		31	/* boot integrity services */
117 #define	SMB_TYPE_BOOT		32	/* system boot status (R) */
118 #define	SMB_TYPE_MEMERR64	33	/* 64-bit memory error information */
119 #define	SMB_TYPE_MGMTDEV	34	/* management device */
120 #define	SMB_TYPE_MGMTDEVCP	35	/* management device component */
121 #define	SMB_TYPE_MGMTDEVDATA	36	/* management device threshold data */
122 #define	SMB_TYPE_MEMCHAN	37	/* memory channel */
123 #define	SMB_TYPE_IPMIDEV	38	/* IPMI device information */
124 #define	SMB_TYPE_POWERSUP	39	/* system power supply */
125 #define	SMB_TYPE_INACTIVE	126	/* inactive table entry */
126 #define	SMB_TYPE_EOT		127	/* end of table */
127 
128 #define	SMB_TYPE_OEM_LO		128	/* start of OEM-specific type range */
129 #define	SUN_OEM_EXT_PROCESSOR	132	/* processor extended info */
130 #define	SUN_OEM_PCIEXRC		138	/* PCIE RootComplex/RootPort info */
131 #define	SUN_OEM_EXT_MEMARRAY	144	/* phys memory array extended info */
132 #define	SUN_OEM_EXT_MEMDEVICE	145	/* memory device extended info */
133 #define	SMB_TYPE_OEM_HI		256	/* end of OEM-specific type range */
134 
135 /*
136  * OEM string indicating "Platform Resource Management Specification"
137  * compliance.
138  */
139 #define	SMB_PRMS1	"SUNW-PRMS-1"
140 
141 /*
142  * Some default values set by BIOS vendor
143  */
144 #define	SMB_DEFAULT1	"To Be Filled By O.E.M."
145 #define	SMB_DEFAULT2	"Not Available"
146 
147 /*
148  * SMBIOS Common Information.  These structures do not correspond to anything
149  * in the SMBIOS specification, but allow library clients to more easily read
150  * information that is frequently encoded into the various SMBIOS structures.
151  */
152 typedef struct smbios_info {
153 	const char *smbi_manufacturer;	/* manufacturer */
154 	const char *smbi_product;	/* product name */
155 	const char *smbi_version;	/* version */
156 	const char *smbi_serial;	/* serial number */
157 	const char *smbi_asset;		/* asset tag */
158 	const char *smbi_location;	/* location tag */
159 	const char *smbi_part;		/* part number */
160 } smbios_info_t;
161 
162 typedef struct smbios_version {
163 	uint8_t smbv_major;		/* version major number */
164 	uint8_t smbv_minor;		/* version minor number */
165 } smbios_version_t;
166 
167 #define	SMB_CONT_BYTE	1		/* contained elements are byte size */
168 #define	SMB_CONT_WORD	2		/* contained elements are word size */
169 #define	SMB_CONT_MAX	255		/* maximum contained objects */
170 
171 /*
172  * SMBIOS Bios Information.  See DSP0134 Section 3.3.1 for more information.
173  * smbb_romsize is converted from the implementation format into bytes.
174  */
175 typedef struct smbios_bios {
176 	const char *smbb_vendor;	/* bios vendor string */
177 	const char *smbb_version;	/* bios version string */
178 	const char *smbb_reldate;	/* bios release date */
179 	uint32_t smbb_segment;		/* bios address segment location */
180 	uint32_t smbb_romsize;		/* bios rom size in bytes */
181 	uint32_t smbb_runsize;		/* bios image size in bytes */
182 	uint64_t smbb_cflags;		/* bios characteristics */
183 	const uint8_t *smbb_xcflags;	/* bios characteristics extensions */
184 	size_t smbb_nxcflags;		/* number of smbb_xcflags[] bytes */
185 	smbios_version_t smbb_biosv;	/* bios version */
186 	smbios_version_t smbb_ecfwv;	/* bios embedded ctrl f/w version */
187 } smbios_bios_t;
188 
189 #define	SMB_BIOSFL_RSV0		0x00000001	/* reserved bit zero */
190 #define	SMB_BIOSFL_RSV1		0x00000002	/* reserved bit one */
191 #define	SMB_BIOSFL_UNKNOWN	0x00000004	/* unknown */
192 #define	SMB_BIOSFL_BCNOTSUP	0x00000008	/* BIOS chars not supported */
193 #define	SMB_BIOSFL_ISA		0x00000010	/* ISA is supported */
194 #define	SMB_BIOSFL_MCA		0x00000020	/* MCA is supported */
195 #define	SMB_BIOSFL_EISA		0x00000040	/* EISA is supported */
196 #define	SMB_BIOSFL_PCI		0x00000080	/* PCI is supported */
197 #define	SMB_BIOSFL_PCMCIA	0x00000100	/* PCMCIA is supported */
198 #define	SMB_BIOSFL_PLUGNPLAY	0x00000200	/* Plug and Play is supported */
199 #define	SMB_BIOSFL_APM		0x00000400	/* APM is supported */
200 #define	SMB_BIOSFL_FLASH	0x00000800	/* BIOS is Flash Upgradeable */
201 #define	SMB_BIOSFL_SHADOW	0x00001000	/* BIOS shadowing is allowed */
202 #define	SMB_BIOSFL_VLVESA	0x00002000	/* VL-VESA is supported */
203 #define	SMB_BIOSFL_ESCD		0x00004000	/* ESCD support is available */
204 #define	SMB_BIOSFL_CDBOOT	0x00008000	/* Boot from CD is supported */
205 #define	SMB_BIOSFL_SELBOOT	0x00010000	/* Selectable Boot supported */
206 #define	SMB_BIOSFL_ROMSOCK	0x00020000	/* BIOS ROM is socketed */
207 #define	SMB_BIOSFL_PCMBOOT	0x00040000	/* Boot from PCMCIA supported */
208 #define	SMB_BIOSFL_EDD		0x00080000	/* EDD Spec is supported */
209 #define	SMB_BIOSFL_NEC9800	0x00100000	/* int 0x13 NEC 9800 floppy */
210 #define	SMB_BIOSFL_TOSHIBA	0x00200000	/* int 0x13 Toshiba floppy */
211 #define	SMB_BIOSFL_525_360K	0x00400000	/* int 0x13 5.25" 360K floppy */
212 #define	SMB_BIOSFL_525_12M	0x00800000	/* int 0x13 5.25" 1.2M floppy */
213 #define	SMB_BIOSFL_35_720K	0x01000000	/* int 0x13 3.5" 720K floppy */
214 #define	SMB_BIOSFL_35_288M	0x02000000	/* int 0x13 3.5" 2.88M floppy */
215 #define	SMB_BIOSFL_I5_PRINT	0x04000000	/* int 0x5 print screen svcs */
216 #define	SMB_BIOSFL_I9_KBD	0x08000000	/* int 0x9 8042 keyboard svcs */
217 #define	SMB_BIOSFL_I14_SER	0x10000000	/* int 0x14 serial svcs */
218 #define	SMB_BIOSFL_I17_PRINTER	0x20000000	/* int 0x17 printer svcs */
219 #define	SMB_BIOSFL_I10_CGA	0x40000000	/* int 0x10 CGA svcs */
220 #define	SMB_BIOSFL_NEC_PC98	0x80000000	/* NEC PC-98 */
221 
222 #define	SMB_BIOSXB_1		0	/* bios extension byte 1 (3.3.1.2.1) */
223 #define	SMB_BIOSXB_2		1	/* bios extension byte 2 (3.3.1.2.2) */
224 #define	SMB_BIOSXB_BIOS_MAJ	2	/* bios major version */
225 #define	SMB_BIOSXB_BIOS_MIN	3	/* bios minor version */
226 #define	SMB_BIOSXB_ECFW_MAJ	4	/* extended ctlr f/w major version */
227 #define	SMB_BIOSXB_ECFW_MIN	5	/* extended ctlr f/w minor version */
228 
229 #define	SMB_BIOSXB1_ACPI	0x01	/* ACPI is supported */
230 #define	SMB_BIOSXB1_USBL	0x02	/* USB legacy is supported */
231 #define	SMB_BIOSXB1_AGP		0x04	/* AGP is supported */
232 #define	SMB_BIOSXB1_I20		0x08	/* I2O boot is supported */
233 #define	SMB_BIOSXB1_LS120	0x10	/* LS-120 boot is supported */
234 #define	SMB_BIOSXB1_ATZIP	0x20	/* ATAPI ZIP drive boot is supported */
235 #define	SMB_BIOSXB1_1394	0x40	/* 1394 boot is supported */
236 #define	SMB_BIOSXB1_SMBAT	0x80	/* Smart Battery is supported */
237 
238 #define	SMB_BIOSXB2_BBOOT	0x01	/* BIOS Boot Specification supported */
239 #define	SMB_BIOSXB2_FKNETSVC	0x02	/* F-key Network Svc boot supported */
240 #define	SMB_BIOSXB2_ETCDIST	0x04	/* Enable Targeted Content Distrib. */
241 
242 /*
243  * SMBIOS Bios Information.  See DSP0134 Section 3.3.2 for more information.
244  * The current set of smbs_wakeup values is defined after the structure.
245  */
246 typedef struct smbios_system {
247 	const uint8_t *smbs_uuid;	/* UUID byte array */
248 	uint8_t smbs_uuidlen;		/* UUID byte array length */
249 	uint8_t smbs_wakeup;		/* wake-up event */
250 	const char *smbs_sku;		/* SKU number */
251 	const char *smbs_family;	/* family */
252 } smbios_system_t;
253 
254 #define	SMB_WAKEUP_RSV0		0x00	/* reserved */
255 #define	SMB_WAKEUP_OTHER	0x01	/* other */
256 #define	SMB_WAKEUP_UNKNOWN	0x02	/* unknown */
257 #define	SMB_WAKEUP_APM		0x03	/* APM timer */
258 #define	SMB_WAKEUP_MODEM	0x04	/* modem ring */
259 #define	SMB_WAKEUP_LAN		0x05	/* LAN remote */
260 #define	SMB_WAKEUP_SWITCH	0x06	/* power switch */
261 #define	SMB_WAKEUP_PCIPME	0x07	/* PCI PME# */
262 #define	SMB_WAKEUP_AC		0x08	/* AC power restored */
263 
264 /*
265  * SMBIOS Base Board description.  See DSP0134 Section 3.3.3 for more
266  * information.  smbb_flags and smbb_type definitions are below.
267  */
268 typedef struct smbios_bboard {
269 	id_t smbb_chassis;		/* chassis containing this board */
270 	uint8_t smbb_flags;		/* flags (see below) */
271 	uint8_t smbb_type;		/* board type (see below) */
272 	uint8_t smbb_contn;		/* number of contained object hdls */
273 } smbios_bboard_t;
274 
275 #define	SMB_BBFL_MOTHERBOARD	0x01	/* board is a motherboard */
276 #define	SMB_BBFL_NEEDAUX	0x02	/* auxiliary card or daughter req'd */
277 #define	SMB_BBFL_REMOVABLE	0x04	/* board is removable */
278 #define	SMB_BBFL_REPLACABLE	0x08	/* board is field-replacable */
279 #define	SMB_BBFL_HOTSWAP	0x10	/* board is hot-swappable */
280 
281 #define	SMB_BBT_UNKNOWN		0x1	/* unknown */
282 #define	SMB_BBT_OTHER		0x2	/* other */
283 #define	SMB_BBT_SBLADE		0x3	/* server blade */
284 #define	SMB_BBT_CSWITCH		0x4	/* connectivity switch */
285 #define	SMB_BBT_SMM		0x5	/* system management module */
286 #define	SMB_BBT_PROC		0x6	/* processor module */
287 #define	SMB_BBT_IO		0x7	/* i/o module */
288 #define	SMB_BBT_MEM		0x8	/* memory module */
289 #define	SMB_BBT_DAUGHTER	0x9	/* daughterboard */
290 #define	SMB_BBT_MOTHER		0xA	/* motherboard */
291 #define	SMB_BBT_PROCMEM		0xB	/* processor/memory module */
292 #define	SMB_BBT_PROCIO		0xC	/* processor/i/o module */
293 #define	SMB_BBT_INTER		0xD	/* interconnect board */
294 
295 /*
296  * SMBIOS Chassis description.  See DSP0134 Section 3.3.4 for more information.
297  * We move the lock bit of the type field into smbc_lock for easier processing.
298  */
299 typedef struct smbios_chassis {
300 	uint32_t smbc_oemdata;		/* OEM-specific data */
301 	uint8_t smbc_lock;		/* lock present? */
302 	uint8_t smbc_type;		/* type */
303 	uint8_t smbc_bustate;		/* boot-up state */
304 	uint8_t smbc_psstate;		/* power supply state */
305 	uint8_t smbc_thstate;		/* thermal state */
306 	uint8_t smbc_security;		/* security status */
307 	uint8_t smbc_uheight;		/* enclosure height in U's */
308 	uint8_t smbc_cords;		/* number of power cords */
309 	uint8_t smbc_elems;		/* number of element records (n) */
310 	uint8_t smbc_elemlen;		/* length of contained element (m) */
311 } smbios_chassis_t;
312 
313 #define	SMB_CHT_OTHER		0x01	/* other */
314 #define	SMB_CHT_UNKNOWN		0x02	/* unknown */
315 #define	SMB_CHT_DESKTOP		0x03	/* desktop */
316 #define	SMB_CHT_LPDESKTOP	0x04	/* low-profile desktop */
317 #define	SMB_CHT_PIZZA		0x05	/* pizza box */
318 #define	SMB_CHT_MINITOWER	0x06	/* mini-tower */
319 #define	SMB_CHT_TOWER		0x07	/* tower */
320 #define	SMB_CHT_PORTABLE	0x08	/* portable */
321 #define	SMB_CHT_LAPTOP		0x09	/* laptop */
322 #define	SMB_CHT_NOTEBOOK	0x0A	/* notebook */
323 #define	SMB_CHT_HANDHELD	0x0B	/* hand-held */
324 #define	SMB_CHT_DOCK		0x0C	/* docking station */
325 #define	SMB_CHT_ALLIN1		0x0D	/* all-in-one */
326 #define	SMB_CHT_SUBNOTE		0x0E	/* sub-notebook */
327 #define	SMB_CHT_SPACESAVE	0x0F	/* space-saving */
328 #define	SMB_CHT_LUNCHBOX	0x10	/* lunchbox */
329 #define	SMB_CHT_MAIN		0x11	/* main server chassis */
330 #define	SMB_CHT_EXPANSION	0x12	/* expansion chassis */
331 #define	SMB_CHT_SUB		0x13	/* sub-chassis */
332 #define	SMB_CHT_BUS		0x14	/* bus expansion chassis */
333 #define	SMB_CHT_PERIPHERAL	0x15	/* peripheral chassis */
334 #define	SMB_CHT_RAID		0x16	/* raid chassis */
335 #define	SMB_CHT_RACK		0x17	/* rack mount chassis */
336 #define	SMB_CHT_SEALED		0x18	/* sealed case pc */
337 #define	SMB_CHT_MULTI		0x19	/* multi-system chassis */
338 #define	SMB_CHT_CPCI		0x1A	/* compact PCI */
339 #define	SMB_CHT_ATCA		0x1B	/* advanced TCA */
340 #define	SMB_CHT_BLADE		0x1C	/* blade */
341 #define	SMB_CHT_BLADEENC	0x1D	/* blade enclosure */
342 
343 #define	SMB_CHST_OTHER		0x01	/* other */
344 #define	SMB_CHST_UNKNOWN	0x02	/* unknown */
345 #define	SMB_CHST_SAFE		0x03	/* safe */
346 #define	SMB_CHST_WARNING	0x04	/* warning */
347 #define	SMB_CHST_CRITICAL	0x05	/* critical */
348 #define	SMB_CHST_NONREC		0x06	/* non-recoverable */
349 
350 #define	SMB_CHSC_OTHER		0x01	/* other */
351 #define	SMB_CHSC_UNKNOWN	0x02	/* unknown */
352 #define	SMB_CHSC_NONE		0x03	/* none */
353 #define	SMB_CHSC_EILOCK		0x04	/* external interface locked out */
354 #define	SMB_CHSC_EIENAB		0x05	/* external interface enabled */
355 
356 /*
357  * SMBIOS Processor description.  See DSP0134 Section 3.3.5 for more details.
358  * If the L1, L2, or L3 cache handle is -1, the cache information is unknown.
359  * If the handle refers to something of size 0, that type of cache is absent.
360  *
361  * NOTE: Although SMBIOS exports a 64-bit CPUID result, this value should not
362  * be used for any purpose other than BIOS debugging.  Solaris itself computes
363  * its own CPUID value and applies knowledge of additional errata and processor
364  * specific CPUID variations, so this value should not be used for anything.
365  */
366 typedef struct smbios_processor {
367 	uint64_t smbp_cpuid;		/* processor cpuid information */
368 	uint32_t smbp_family;		/* processor family */
369 	uint8_t smbp_type;		/* processor type (SMB_PRT_*) */
370 	uint8_t smbp_voltage;		/* voltage (SMB_PRV_*) */
371 	uint8_t smbp_status;		/* status (SMB_PRS_*) */
372 	uint8_t smbp_upgrade;		/* upgrade (SMB_PRU_*) */
373 	uint32_t smbp_clkspeed;		/* external clock speed in MHz */
374 	uint32_t smbp_maxspeed;		/* maximum speed in MHz */
375 	uint32_t smbp_curspeed;		/* current speed in MHz */
376 	id_t smbp_l1cache;		/* L1 cache handle */
377 	id_t smbp_l2cache;		/* L2 cache handle */
378 	id_t smbp_l3cache;		/* L3 cache handle */
379 } smbios_processor_t;
380 
381 #define	SMB_PRT_OTHER		0x01	/* other */
382 #define	SMB_PRT_UNKNOWN		0x02	/* unknown */
383 #define	SMB_PRT_CENTRAL		0x03	/* central processor */
384 #define	SMB_PRT_MATH		0x04	/* math processor */
385 #define	SMB_PRT_DSP		0x05	/* DSP processor */
386 #define	SMB_PRT_VIDEO		0x06	/* video processor */
387 
388 #define	SMB_PRV_LEGACY(v)	(!((v) & 0x80))	/* legacy voltage mode */
389 #define	SMB_PRV_FIXED(v)	((v) & 0x80)	/* fixed voltage mode */
390 
391 #define	SMB_PRV_5V		0x01	/* 5V is supported */
392 #define	SMB_PRV_33V		0x02	/* 3.3V is supported */
393 #define	SMB_PRV_29V		0x04	/* 2.9V is supported */
394 
395 #define	SMB_PRV_VOLTAGE(v)	((v) & 0x7f)
396 
397 #define	SMB_PRSTATUS_PRESENT(s)	((s) & 0x40)	/* socket is populated */
398 #define	SMB_PRSTATUS_STATUS(s)	((s) & 0x07)	/* status (see below) */
399 
400 #define	SMB_PRS_UNKNOWN		0x0	/* unknown */
401 #define	SMB_PRS_ENABLED		0x1	/* enabled */
402 #define	SMB_PRS_BDISABLED	0x2	/* disabled in bios user setup */
403 #define	SMB_PRS_PDISABLED	0x3	/* disabled in bios from post error */
404 #define	SMB_PRS_IDLE		0x4	/* waiting to be enabled */
405 #define	SMB_PRS_OTHER		0x7	/* other */
406 
407 #define	SMB_PRU_OTHER		0x01	/* other */
408 #define	SMB_PRU_UNKNOWN		0x02	/* unknown */
409 #define	SMB_PRU_DAUGHTER	0x03	/* daughter board */
410 #define	SMB_PRU_ZIF		0x04	/* ZIF socket */
411 #define	SMB_PRU_PIGGY		0x05	/* replaceable piggy back */
412 #define	SMB_PRU_NONE		0x06	/* none */
413 #define	SMB_PRU_LIF		0x07	/* LIF socket */
414 #define	SMB_PRU_SLOT1		0x08	/* slot 1 */
415 #define	SMB_PRU_SLOT2		0x09	/* slot 2 */
416 #define	SMB_PRU_370PIN		0x0A	/* 370-pin socket */
417 #define	SMB_PRU_SLOTA		0x0B	/* slot A */
418 #define	SMB_PRU_SLOTM		0x0C	/* slot M */
419 #define	SMB_PRU_423		0x0D	/* socket 423 */
420 #define	SMB_PRU_A		0x0E	/* socket A (socket 462) */
421 #define	SMB_PRU_478		0x0F	/* socket 478 */
422 #define	SMB_PRU_754		0x10	/* socket 754 */
423 #define	SMB_PRU_940		0x11	/* socket 940 */
424 #define	SMB_PRU_939		0x12	/* socket 939 */
425 #define	SMB_PRU_MPGA604		0x13	/* mPGA604 */
426 #define	SMB_PRU_LGA771		0x14	/* LGA771 */
427 #define	SMB_PRU_LGA775		0x15	/* LGA775 */
428 #define	SMB_PRU_S1		0x16	/* socket S1 */
429 #define	SMB_PRU_AM2		0x17	/* socket AM2 */
430 #define	SMB_PRU_F		0x18	/* socket F */
431 
432 #define	SMB_PRF_OTHER		0x01	/* other */
433 #define	SMB_PRF_UNKNOWN		0x02	/* unknown */
434 #define	SMB_PRF_8086		0x03	/* 8086 */
435 #define	SMB_PRF_80286		0x04	/* 80286 */
436 #define	SMB_PRF_I386		0x05	/* Intel 386 */
437 #define	SMB_PRF_I486		0x06	/* Intel 486 */
438 #define	SMB_PRF_8087		0x07	/* 8087 */
439 #define	SMB_PRF_80287		0x08	/* 80287 */
440 #define	SMB_PRF_80387		0x09	/* 80387 */
441 #define	SMB_PRF_80487		0x0A	/* 80487 */
442 #define	SMB_PRF_PENTIUM		0x0B	/* Pentium Family */
443 #define	SMB_PRF_PENTIUMPRO	0x0C	/* Pentium Pro */
444 #define	SMB_PRF_PENTIUMII	0x0D	/* Pentium II */
445 #define	SMB_PRF_PENTIUM_MMX	0x0E	/* Pentium w/ MMX */
446 #define	SMB_PRF_CELERON		0x0F	/* Celeron */
447 #define	SMB_PRF_PENTIUMII_XEON	0x10	/* Pentium II Xeon */
448 #define	SMB_PRF_PENTIUMIII	0x11	/* Pentium III */
449 #define	SMB_PRF_M1		0x12	/* M1 */
450 #define	SMB_PRF_M2		0x13	/* M2 */
451 #define	SMB_PRF_DURON		0x18	/* AMD Duron */
452 #define	SMB_PRF_K5		0x19	/* K5 */
453 #define	SMB_PRF_K6		0x1A	/* K6 */
454 #define	SMB_PRF_K6_2		0x1B	/* K6-2 */
455 #define	SMB_PRF_K6_3		0x1C	/* K6-3 */
456 #define	SMB_PRF_ATHLON		0x1D	/* Athlon */
457 #define	SMB_PRF_2900		0x1E	/* AMD 2900 */
458 #define	SMB_PRF_K6_2PLUS	0x1F	/* K6-2+ */
459 #define	SMB_PRF_PPC		0x20	/* PowerPC */
460 #define	SMB_PRF_PPC_601		0x21	/* PowerPC 601 */
461 #define	SMB_PRF_PPC_603		0x22	/* PowerPC 603 */
462 #define	SMB_PRF_PPC_603PLUS	0x23	/* PowerPC 603+ */
463 #define	SMB_PRF_PPC_604		0x24	/* PowerPC 604 */
464 #define	SMB_PRF_PPC_620		0x25	/* PowerPC 620 */
465 #define	SMB_PRF_PPC_704		0x26	/* PowerPC x704 */
466 #define	SMB_PRF_PPC_750		0x27	/* PowerPC 750 */
467 #define	SMB_PRF_ALPHA		0x30	/* Alpha */
468 #define	SMB_PRF_ALPHA_21064	0x31	/* Alpha 21064 */
469 #define	SMB_PRF_ALPHA_21066	0x32	/* Alpha 21066 */
470 #define	SMB_PRF_ALPHA_21164	0x33	/* Alpha 21164 */
471 #define	SMB_PRF_ALPHA_21164PC	0x34	/* Alpha 21164PC */
472 #define	SMB_PRF_ALPHA_21164A	0x35	/* Alpha 21164a */
473 #define	SMB_PRF_ALPHA_21264	0x36	/* Alpha 21264 */
474 #define	SMB_PRF_ALPHA_21364	0x37	/* Alpha 21364 */
475 #define	SMB_PRF_MIPS		0x40	/* MIPS */
476 #define	SMB_PRF_MIPS_R4000	0x41	/* MIPS R4000 */
477 #define	SMB_PRF_MIPS_R4200	0x42	/* MIPS R4200 */
478 #define	SMB_PRF_MIPS_R4400	0x43	/* MIPS R4400 */
479 #define	SMB_PRF_MIPS_R4600	0x44	/* MIPS R4600 */
480 #define	SMB_PRF_MIPS_R10000	0x45	/* MIPS R10000 */
481 #define	SMB_PRF_SPARC		0x50	/* SPARC */
482 #define	SMB_PRF_SUPERSPARC	0x51	/* SuperSPARC */
483 #define	SMB_PRF_MICROSPARCII	0x52	/* microSPARC II */
484 #define	SMB_PRF_MICROSPARCIIep	0x53	/* microSPARC IIep */
485 #define	SMB_PRF_ULTRASPARC	0x54	/* UltraSPARC */
486 #define	SMB_PRF_USII		0x55	/* UltraSPARC II */
487 #define	SMB_PRF_USIIi		0x56	/* UltraSPARC IIi */
488 #define	SMB_PRF_USIII		0x57	/* UltraSPARC III */
489 #define	SMB_PRF_USIIIi		0x58	/* UltraSPARC IIIi */
490 #define	SMB_PRF_68040		0x60	/* 68040 */
491 #define	SMB_PRF_68XXX		0x61	/* 68XXX */
492 #define	SMB_PRF_68000		0x62	/* 68000 */
493 #define	SMB_PRF_68010		0x63	/* 68010 */
494 #define	SMB_PRF_68020		0x64	/* 68020 */
495 #define	SMB_PRF_68030		0x65	/* 68030 */
496 #define	SMB_PRF_HOBBIT		0x70	/* Hobbit */
497 #define	SMB_PRF_TM5000		0x78	/* Crusoe TM5000 */
498 #define	SMB_PRF_TM3000		0x79	/* Crusoe TM3000 */
499 #define	SMB_PRF_TM8000		0x7A	/* Efficeon TM8000 */
500 #define	SMB_PRF_WEITEK		0x80	/* Weitek */
501 #define	SMB_PRF_ITANIC		0x82	/* Itanium */
502 #define	SMB_PRF_ATHLON64	0x83	/* Athlon64 */
503 #define	SMB_PRF_OPTERON		0x84	/* Opteron */
504 #define	SMB_PRF_PA		0x90	/* PA-RISC */
505 #define	SMB_PRF_PA8500		0x91	/* PA-RISC 8500 */
506 #define	SMB_PRF_PA8000		0x92	/* PA-RISC 8000 */
507 #define	SMB_PRF_PA7300LC	0x93	/* PA-RISC 7300LC */
508 #define	SMB_PRF_PA7200		0x94	/* PA-RISC 7200 */
509 #define	SMB_PRF_PA7100LC	0x95	/* PA-RISC 7100LC */
510 #define	SMB_PRF_PA7100		0x96	/* PA-RISC 7100 */
511 #define	SMB_PRF_V30		0xA0	/* V30 */
512 #define	SMB_PRF_PENTIUMIII_XEON	0xB0	/* Pentium III Xeon */
513 #define	SMB_PRF_PENTIUMIII_SS	0xB1	/* Pentium III with SpeedStep */
514 #define	SMB_PRF_P4		0xB2	/* Pentium 4 */
515 #define	SMB_PRF_XEON		0xB3	/* Intel Xeon */
516 #define	SMB_PRF_AS400		0xB4	/* AS400 */
517 #define	SMB_PRF_XEON_MP		0xB5	/* Intel Xeon MP */
518 #define	SMB_PRF_ATHLON_XP	0xB6	/* AMD Athlon XP */
519 #define	SMB_PRF_ATHLON_MP	0xB7	/* AMD Athlon MP */
520 #define	SMB_PRF_ITANIC2		0xB8	/* Itanium 2 */
521 #define	SMB_PRF_PENTIUM_M	0xB9	/* Pentium M */
522 #define	SMB_PRF_CELERON_D	0xBA	/* Celeron D */
523 #define	SMB_PRF_PENTIUM_D	0xBB	/* Pentium D */
524 #define	SMB_PRF_PENTIUM_EE	0xBC	/* Pentium Extreme Edition */
525 #define	SMB_PRF_CORE		0xBD	/* Intel Core */
526 #define	SMB_PRF_CORE2		0xBF	/* Intel Core 2 */
527 #define	SMB_PRF_IBM390		0xC8	/* IBM 390 */
528 #define	SMB_PRF_G4		0xC9	/* G4 */
529 #define	SMB_PRF_G5		0xCA	/* G5 */
530 #define	SMB_PRF_ESA390		0xCB	/* ESA390 */
531 #define	SMB_PRF_ZARCH		0xCC	/* z/Architecture */
532 #define	SMB_PRF_C7M		0xD2	/* VIA C7-M */
533 #define	SMB_PRF_C7D		0xD3	/* VIA C7-D */
534 #define	SMB_PRF_C7		0xD4	/* VIA C7 */
535 #define	SMB_PRF_EDEN		0xD5	/* VIA Eden */
536 #define	SMB_PRF_I860		0xFA	/* i860 */
537 #define	SMB_PRF_I960		0xFB	/* i960 */
538 #define	SMB_PRF_SH3		0x104	/* SH-3 */
539 #define	SMB_PRF_SH4		0x105	/* SH-4 */
540 #define	SMB_PRF_ARM		0x118	/* ARM */
541 #define	SMB_PRF_SARM		0x119	/* StrongARM */
542 #define	SMB_PRF_6X86		0x12C	/* 6x86 */
543 #define	SMB_PRF_MEDIAGX		0x12D	/* MediaGX */
544 #define	SMB_PRF_MII		0x12E	/* MII */
545 #define	SMB_PRF_WINCHIP		0x140	/* WinChip */
546 #define	SMB_PRF_DSP		0x15E	/* DSP */
547 #define	SMB_PRF_VIDEO		0x1F4	/* Video Processor */
548 
549 /*
550  * SMBIOS Cache Information.  See DSP0134 Section 3.3.8 for more information.
551  * If smba_size is zero, this indicates the specified cache is not present.
552  */
553 typedef struct smbios_cache {
554 	uint32_t smba_maxsize;		/* maximum installed size in bytes */
555 	uint32_t smba_size;		/* installed size in bytes */
556 	uint16_t smba_stype;		/* supported SRAM types (SMB_CAT_*) */
557 	uint16_t smba_ctype;		/* current SRAM type (SMB_CAT_*) */
558 	uint8_t smba_speed;		/* speed in nanoseconds */
559 	uint8_t smba_etype;		/* error correction type (SMB_CAE_*) */
560 	uint8_t smba_ltype;		/* logical cache type (SMB_CAG_*) */
561 	uint8_t smba_assoc;		/* associativity (SMB_CAA_*) */
562 	uint8_t smba_level;		/* cache level */
563 	uint8_t smba_mode;		/* cache mode (SMB_CAM_*) */
564 	uint8_t smba_location;		/* cache location (SMB_CAL_*) */
565 	uint8_t smba_flags;		/* cache flags (SMB_CAF_*) */
566 } smbios_cache_t;
567 
568 #define	SMB_CAT_OTHER		0x0001		/* other */
569 #define	SMB_CAT_UNKNOWN		0x0002		/* unknown */
570 #define	SMB_CAT_NONBURST	0x0004		/* non-burst */
571 #define	SMB_CAT_BURST		0x0008		/* burst */
572 #define	SMB_CAT_PBURST		0x0010		/* pipeline burst */
573 #define	SMB_CAT_SYNC		0x0020		/* synchronous */
574 #define	SMB_CAT_ASYNC		0x0040		/* asynchronous */
575 
576 #define	SMB_CAE_OTHER		0x01		/* other */
577 #define	SMB_CAE_UNKNOWN		0x02		/* unknown */
578 #define	SMB_CAE_NONE		0x03		/* none */
579 #define	SMB_CAE_PARITY		0x04		/* parity */
580 #define	SMB_CAE_SBECC		0x05		/* single-bit ECC */
581 #define	SMB_CAE_MBECC		0x06		/* multi-bit ECC */
582 
583 #define	SMB_CAG_OTHER		0x01		/* other */
584 #define	SMB_CAG_UNKNOWN		0x02		/* unknown */
585 #define	SMB_CAG_INSTR		0x03		/* instruction */
586 #define	SMB_CAG_DATA		0x04		/* data */
587 #define	SMB_CAG_UNIFIED		0x05		/* unified */
588 
589 #define	SMB_CAA_OTHER		0x01		/* other */
590 #define	SMB_CAA_UNKNOWN		0x02		/* unknown */
591 #define	SMB_CAA_DIRECT		0x03		/* direct mapped */
592 #define	SMB_CAA_2WAY		0x04		/* 2-way set associative */
593 #define	SMB_CAA_4WAY		0x05		/* 4-way set associative */
594 #define	SMB_CAA_FULL		0x06		/* fully associative */
595 #define	SMB_CAA_8WAY		0x07		/* 8-way set associative */
596 #define	SMB_CAA_16WAY		0x08		/* 16-way set associative */
597 
598 #define	SMB_CAM_WT		0x00		/* write-through */
599 #define	SMB_CAM_WB		0x01		/* write-back */
600 #define	SMB_CAM_VARY		0x02		/* varies by address */
601 #define	SMB_CAM_UNKNOWN		0x03		/* unknown */
602 
603 #define	SMB_CAL_INTERNAL	0x00		/* internal */
604 #define	SMB_CAL_EXTERNAL	0x01		/* external */
605 #define	SMB_CAL_RESERVED	0x02		/* reserved */
606 #define	SMB_CAL_UNKNOWN		0x03		/* unknown */
607 
608 #define	SMB_CAF_ENABLED		0x01		/* enabled at boot time */
609 #define	SMB_CAF_SOCKETED	0x02		/* cache is socketed */
610 
611 /*
612  * SMBIOS Port Information.  See DSP0134 Section 3.3.9 for more information.
613  * The internal reference designator string is also mapped to the location.
614  */
615 typedef struct smbios_port {
616 	const char *smbo_iref;	/* internal reference designator */
617 	const char *smbo_eref;	/* external reference designator */
618 	uint8_t smbo_itype;	/* internal connector type (SMB_POC_*) */
619 	uint8_t smbo_etype;	/* external connector type (SMB_POC_*) */
620 	uint8_t smbo_ptype;	/* port type (SMB_POT_*) */
621 	uint8_t smbo_pad;	/* padding */
622 } smbios_port_t;
623 
624 #define	SMB_POC_NONE		0x00		/* none */
625 #define	SMB_POC_CENT		0x01		/* Centronics */
626 #define	SMB_POC_MINICENT	0x02		/* Mini-Centronics */
627 #define	SMB_POC_PROPRIETARY	0x03		/* proprietary */
628 #define	SMB_POC_DB25M		0x04		/* DB-25 pin male */
629 #define	SMB_POC_DB25F		0x05		/* DB-25 pin female */
630 #define	SMB_POC_DB15M		0x06		/* DB-15 pin male */
631 #define	SMB_POC_DB15F		0x07		/* DB-15 pin female */
632 #define	SMB_POC_DB9M		0x08		/* DB-9 pin male */
633 #define	SMB_POC_DB9F		0x09		/* DB-9 pin female */
634 #define	SMB_POC_RJ11		0x0A		/* RJ-11 */
635 #define	SMB_POC_RJ45		0x0B		/* RJ-45 */
636 #define	SMB_POC_MINISCSI	0x0C		/* 50-pin MiniSCSI */
637 #define	SMB_POC_MINIDIN		0x0D		/* Mini-DIN */
638 #define	SMB_POC_MICRODIN	0x0E		/* Micro-DIN */
639 #define	SMB_POC_PS2		0x0F		/* PS/2 */
640 #define	SMB_POC_IR		0x10		/* Infrared */
641 #define	SMB_POC_HPHIL		0x11		/* HP-HIL */
642 #define	SMB_POC_USB		0x12		/* USB */
643 #define	SMB_POC_SSA		0x13		/* SSA SCSI */
644 #define	SMB_POC_DIN8M		0x14		/* Circular DIN-8 male */
645 #define	SMB_POC_DIN8F		0x15		/* Circular DIN-8 female */
646 #define	SMB_POC_OBIDE		0x16		/* on-board IDE */
647 #define	SMB_POC_OBFLOPPY	0x17		/* on-board floppy */
648 #define	SMB_POC_DI9		0x18		/* 9p dual inline (p10 cut) */
649 #define	SMB_POC_DI25		0x19		/* 25p dual inline (p26 cut) */
650 #define	SMB_POC_DI50		0x1A		/* 50p dual inline */
651 #define	SMB_POC_DI68		0x1B		/* 68p dual inline */
652 #define	SMB_POC_CDROM		0x1C		/* on-board sound from CDROM */
653 #define	SMB_POC_MINI14		0x1D		/* Mini-Centronics Type 14 */
654 #define	SMB_POC_MINI26		0x1E		/* Mini-Centronics Type 26 */
655 #define	SMB_POC_MINIJACK	0x1F		/* Mini-jack (headphones) */
656 #define	SMB_POC_BNC		0x20		/* BNC */
657 #define	SMB_POC_1394		0x21		/* 1394 */
658 #define	SMB_POC_PC98		0xA0		/* PC-98 */
659 #define	SMB_POC_PC98HR		0xA1		/* PC-98Hireso */
660 #define	SMB_POC_PCH98		0xA2		/* PC-H98 */
661 #define	SMB_POC_PC98NOTE	0xA3		/* PC-98Note */
662 #define	SMB_POC_PC98FULL	0xA4		/* PC-98Full */
663 #define	SMB_POC_OTHER		0xFF		/* other */
664 
665 #define	SMB_POT_NONE		0x00		/* none */
666 #define	SMB_POT_PP_XTAT		0x01		/* Parallel Port XT/AT compat */
667 #define	SMB_POT_PP_PS2		0x02		/* Parallel Port PS/2 */
668 #define	SMB_POT_PP_ECP		0x03		/* Parallel Port ECP */
669 #define	SMB_POT_PP_EPP		0x04		/* Parallel Port EPP */
670 #define	SMB_POT_PP_ECPEPP	0x05		/* Parallel Port ECP/EPP */
671 #define	SMB_POT_SP_XTAT		0x06		/* Serial Port XT/AT compat */
672 #define	SMB_POT_SP_16450	0x07		/* Serial Port 16450 compat */
673 #define	SMB_POT_SP_16550	0x08		/* Serial Port 16550 compat */
674 #define	SMB_POT_SP_16550A	0x09		/* Serial Port 16550A compat */
675 #define	SMB_POT_SCSI		0x0A		/* SCSI port */
676 #define	SMB_POT_MIDI		0x0B		/* MIDI port */
677 #define	SMB_POT_JOYSTICK	0x0C		/* Joystick port */
678 #define	SMB_POT_KEYBOARD	0x0D		/* Keyboard port */
679 #define	SMB_POT_MOUSE		0x0E		/* Mouse port */
680 #define	SMB_POT_SSA		0x0F		/* SSA SCSI */
681 #define	SMB_POT_USB		0x10		/* USB */
682 #define	SMB_POT_FIREWIRE	0x11		/* FireWrite (IEEE P1394) */
683 #define	SMB_POT_PCMII		0x12		/* PCMCIA Type II */
684 #define	SMB_POT_PCMIIa		0x13		/* PCMCIA Type II (alternate) */
685 #define	SMB_POT_PCMIII		0x14		/* PCMCIA Type III */
686 #define	SMB_POT_CARDBUS		0x15		/* Cardbus */
687 #define	SMB_POT_ACCESS		0x16		/* Access Bus Port */
688 #define	SMB_POT_SCSI2		0x17		/* SCSI II */
689 #define	SMB_POT_SCSIW		0x18		/* SCSI Wide */
690 #define	SMB_POT_PC98		0x19		/* PC-98 */
691 #define	SMB_POT_PC98HR		0x1A		/* PC-98Hireso */
692 #define	SMB_POT_PCH98		0x1B		/* PC-H98 */
693 #define	SMB_POT_VIDEO		0x1C		/* Video port */
694 #define	SMB_POT_AUDIO		0x1D		/* Audio port */
695 #define	SMB_POT_MODEM		0x1E		/* Modem port */
696 #define	SMB_POT_NETWORK		0x1F		/* Network port */
697 #define	SMB_POT_SATA		0x20		/* SATA */
698 #define	SMB_POT_SAS		0x21		/* SAS */
699 #define	SMB_POT_8251		0xA0		/* 8251 compatible */
700 #define	SMB_POT_8251F		0xA1		/* 8251 FIFO compatible */
701 #define	SMB_POT_OTHER		0xFF		/* other */
702 
703 /*
704  * SMBIOS Slot Information.  See DSP0134 Section 3.3.10 for more information.
705  * See DSP0134 3.3.10.5 for how to interpret the value of smbl_id.
706  */
707 typedef struct smbios_slot {
708 	const char *smbl_name;		/* reference designation */
709 	uint8_t smbl_type;		/* slot type */
710 	uint8_t smbl_width;		/* slot data bus width */
711 	uint8_t smbl_usage;		/* current usage */
712 	uint8_t smbl_length;		/* slot length */
713 	uint16_t smbl_id;		/* slot ID */
714 	uint8_t smbl_ch1;		/* slot characteristics 1 */
715 	uint8_t smbl_ch2;		/* slot characteristics 2 */
716 } smbios_slot_t;
717 
718 #define	SMB_SLT_OTHER		0x01	/* other */
719 #define	SMB_SLT_UNKNOWN		0x02	/* unknown */
720 #define	SMB_SLT_ISA		0x03	/* ISA */
721 #define	SMB_SLT_MCA		0x04	/* MCA */
722 #define	SMB_SLT_EISA		0x05	/* EISA */
723 #define	SMB_SLT_PCI		0x06	/* PCI */
724 #define	SMB_SLT_PCMCIA		0x07	/* PCMCIA */
725 #define	SMB_SLT_VLVESA		0x08	/* VL-VESA */
726 #define	SMB_SLT_PROPRIETARY	0x09	/* proprietary */
727 #define	SMB_SLT_PROC		0x0A	/* processor card slot */
728 #define	SMB_SLT_MEM		0x0B	/* proprietary memory card slot */
729 #define	SMB_SLT_IOR		0x0C	/* I/O riser card slot */
730 #define	SMB_SLT_NUBUS		0x0D	/* NuBus */
731 #define	SMB_SLT_PCI66		0x0E	/* PCI (66MHz capable) */
732 #define	SMB_SLT_AGP		0x0F	/* AGP */
733 #define	SMB_SLT_AGP2X		0x10	/* AGP 2X */
734 #define	SMB_SLT_AGP4X		0x11	/* AGP 4X */
735 #define	SMB_SLT_PCIX		0x12	/* PCI-X */
736 #define	SMB_SLT_AGP8X		0x13	/* AGP 8X */
737 #define	SMB_SLT_PC98_C20	0xA0	/* PC-98/C20 */
738 #define	SMB_SLT_PC98_C24	0xA1	/* PC-98/C24 */
739 #define	SMB_SLT_PC98_E		0xA2	/* PC-98/E */
740 #define	SMB_SLT_PC98_LB		0xA3	/* PC-98/Local Bus */
741 #define	SMB_SLT_PC98_C		0xA4	/* PC-98/Card */
742 #define	SMB_SLT_PCIE		0xA5	/* PCI Express */
743 #define	SMB_SLT_PCIE1		0xA6	/* PCI Express x1 */
744 #define	SMB_SLT_PCIE2		0xA7	/* PCI Express x2 */
745 #define	SMB_SLT_PCIE4		0xA8	/* PCI Express x4 */
746 #define	SMB_SLT_PCIE8		0xA9	/* PCI Express x8 */
747 #define	SMB_SLT_PCIE16		0xAA	/* PCI Express x16 */
748 
749 #define	SMB_SLW_OTHER		0x01	/* other */
750 #define	SMB_SLW_UNKNOWN		0x02	/* unknown */
751 #define	SMB_SLW_8		0x03	/* 8 bit */
752 #define	SMB_SLW_16		0x04	/* 16 bit */
753 #define	SMB_SLW_32		0x05	/* 32 bit */
754 #define	SMB_SLW_64		0x06	/* 64 bit */
755 #define	SMB_SLW_128		0x07	/* 128 bit */
756 #define	SMB_SLW_1X		0x08	/* 1x or x1 */
757 #define	SMB_SLW_2X		0x09	/* 2x or x2 */
758 #define	SMB_SLW_4X		0x0A	/* 4x or x4 */
759 #define	SMB_SLW_8X		0x0B	/* 8x or x8 */
760 #define	SMB_SLW_12X		0x0C	/* 12x or x12 */
761 #define	SMB_SLW_16X		0x0D	/* 16x or x16 */
762 #define	SMB_SLW_32X		0x0E	/* 32x or x32 */
763 
764 #define	SMB_SLU_OTHER		0x01	/* other */
765 #define	SMB_SLU_UNKNOWN		0x02	/* unknown */
766 #define	SMB_SLU_AVAIL		0x03	/* available */
767 #define	SMB_SLU_INUSE		0x04	/* in use */
768 
769 #define	SMB_SLL_OTHER		0x01	/* other */
770 #define	SMB_SLL_UNKNOWN		0x02	/* unknown */
771 #define	SMB_SLL_SHORT		0x03	/* short length */
772 #define	SMB_SLL_LONG		0x04	/* long length */
773 
774 #define	SMB_SLCH1_UNKNOWN	0x01	/* characteristics unknown */
775 #define	SMB_SLCH1_5V		0x02	/* provides 5.0V */
776 #define	SMB_SLCH1_33V		0x04	/* provides 3.3V */
777 #define	SMB_SLCH1_SHARED	0x08	/* opening shared with other slot */
778 #define	SMB_SLCH1_PC16		0x10	/* slot supports PC Card-16 */
779 #define	SMB_SLCH1_PCCB		0x20	/* slot supports CardBus */
780 #define	SMB_SLCH1_PCZV		0x40	/* slot supports Zoom Video */
781 #define	SMB_SLCH1_PCMRR		0x80	/* slot supports Modem Ring Resume */
782 
783 #define	SMB_SLCH2_PME		0x01	/* slot supports PME# signal */
784 #define	SMB_SLCH2_HOTPLUG	0x02	/* slot supports hot-plug devices */
785 #define	SMB_SLCH2_SMBUS		0x04	/* slot supports SMBus signal */
786 
787 /*
788  * SMBIOS On-Board Device Information.  See DSP0134 Section 3.3.11 for more
789  * information.  Any number of on-board device sections may be present, each
790  * containing one or more records.  The smbios_info_obdevs() function permits
791  * the caller to retrieve one or more of the records from a given section.
792  */
793 typedef struct smbios_obdev {
794 	const char *smbd_name;		/* description string for this device */
795 	uint8_t smbd_type;		/* type code (SMB_OBT_*) */
796 	uint8_t smbd_enabled;		/* boolean (device is enabled) */
797 } smbios_obdev_t;
798 
799 #define	SMB_OBT_OTHER		0x01	/* other */
800 #define	SMB_OBT_UNKNOWN		0x02	/* unknown */
801 #define	SMB_OBT_VIDEO		0x03	/* video */
802 #define	SMB_OBT_SCSI		0x04	/* scsi */
803 #define	SMB_OBT_ETHERNET	0x05	/* ethernet */
804 #define	SMB_OBT_TOKEN		0x06	/* token ring */
805 #define	SMB_OBT_SOUND		0x07	/* sound */
806 #define	SMB_OBT_PATA		0x08	/* pata */
807 #define	SMB_OBT_SATA		0x09	/* sata */
808 #define	SMB_OBT_SAS		0x0A	/* sas */
809 
810 /*
811  * SMBIOS BIOS Language Information.  See DSP0134 Section 3.3.14 for more
812  * information.  The smbios_info_strtab() function can be applied using a
813  * count of smbla_num to retrieve the other possible language settings.
814  */
815 typedef struct smbios_lang {
816 	const char *smbla_cur;		/* current language setting */
817 	uint_t smbla_fmt;		/* language name format (see below) */
818 	uint_t smbla_num;		/* number of installed languages */
819 } smbios_lang_t;
820 
821 #define	SMB_LFMT_LONG	0		/* <ISO639>|<ISO3166>|Encoding Method */
822 #define	SMB_LFMT_SHORT	1		/* <ISO930><ISO3166> */
823 
824 /*
825  * SMBIOS System Event Log Information.  See DSP0134 Section 3.3.16 for more
826  * information.  Accessing the event log itself requires additional interfaces.
827  */
828 typedef struct smbios_evtype {
829 	uint8_t smbevt_ltype;		/* log type */
830 	uint8_t smbevt_dtype;		/* variable data format type */
831 } smbios_evtype_t;
832 
833 typedef struct smbios_evlog {
834 	size_t smbev_size;		/* size in bytes of log area */
835 	size_t smbev_hdr;		/* offset or index of header */
836 	size_t smbev_data;		/* offset or index of data */
837 	uint8_t smbev_method;		/* data access method (see below) */
838 	uint8_t smbev_flags;		/* flags (see below) */
839 	uint8_t smbev_format;		/* log header format (see below) */
840 	uint8_t smbev_pad;		/* padding */
841 	uint32_t smbev_token;		/* data update change token */
842 	union {
843 		struct {
844 			uint16_t evi_iaddr; /* index address */
845 			uint16_t evi_daddr; /* data address */
846 		} eva_io;		/* i/o address for SMB_EVM_XxY */
847 		uint32_t eva_addr;	/* address for SMB_EVM_MEM32 */
848 		uint16_t eva_gpnv;	/* handle for SMB_EVM_GPNV */
849 	} smbev_addr;
850 	uint32_t smbev_typec;		/* number of type descriptors */
851 	const smbios_evtype_t *smbev_typev; /* type descriptor array */
852 } smbios_evlog_t;
853 
854 #define	SMB_EVM_1x1i_1x1d	0	/* I/O: 1 1b idx port, 1 1b data port */
855 #define	SMB_EVM_2x1i_1x1d	1	/* I/O: 2 1b idx port, 1 1b data port */
856 #define	SMB_EVM_1x2i_1x1d	2	/* I/O: 1 2b idx port, 1 1b data port */
857 #define	SMB_EVM_MEM32		3	/* Memory-Mapped 32-bit Physical Addr */
858 #define	SMB_EVM_GPNV		4	/* GP Non-Volatile API Access */
859 
860 #define	SMB_EVFL_VALID		0x1	/* log area valid */
861 #define	SMB_EVFL_FULL		0x2	/* log area full */
862 
863 #define	SMB_EVHF_NONE		0	/* no log headers used */
864 #define	SMB_EVHF_F1		1	/* DMTF log header type 1 */
865 
866 /*
867  * SMBIOS Physical Memory Array Information.  See DSP0134 Section 3.3.17 for
868  * more information.  This describes a collection of physical memory devices.
869  */
870 typedef struct smbios_memarray {
871 	uint8_t smbma_location;		/* physical device location */
872 	uint8_t smbma_use;		/* physical device functional purpose */
873 	uint8_t smbma_ecc;		/* error detect/correct mechanism */
874 	uint8_t smbma_pad0;		/* padding */
875 	uint32_t smbma_pad1;		/* padding */
876 	uint32_t smbma_ndevs;		/* number of slots or sockets */
877 	id_t smbma_err;			/* handle of error (if any) */
878 	uint64_t smbma_size;		/* maximum capacity in bytes */
879 } smbios_memarray_t;
880 
881 #define	SMB_MAL_OTHER		0x01	/* other */
882 #define	SMB_MAL_UNKNOWN		0x02	/* unknown */
883 #define	SMB_MAL_SYSMB		0x03	/* system board or motherboard */
884 #define	SMB_MAL_ISA		0x04	/* ISA add-on card */
885 #define	SMB_MAL_EISA		0x05	/* EISA add-on card */
886 #define	SMB_MAL_PCI		0x06	/* PCI add-on card */
887 #define	SMB_MAL_MCA		0x07	/* MCA add-on card */
888 #define	SMB_MAL_PCMCIA		0x08	/* PCMCIA add-on card */
889 #define	SMB_MAL_PROP		0x09	/* proprietary add-on card */
890 #define	SMB_MAL_NUBUS		0x0A	/* NuBus */
891 #define	SMB_MAL_PC98C20		0xA0	/* PC-98/C20 add-on card */
892 #define	SMB_MAL_PC98C24		0xA1	/* PC-98/C24 add-on card */
893 #define	SMB_MAL_PC98E		0xA2	/* PC-98/E add-on card */
894 #define	SMB_MAL_PC98LB		0xA3	/* PC-98/Local bus add-on card */
895 
896 #define	SMB_MAU_OTHER		0x01	/* other */
897 #define	SMB_MAU_UNKNOWN		0x02	/* unknown */
898 #define	SMB_MAU_SYSTEM		0x03	/* system memory */
899 #define	SMB_MAU_VIDEO		0x04	/* video memory */
900 #define	SMB_MAU_FLASH		0x05	/* flash memory */
901 #define	SMB_MAU_NVRAM		0x06	/* non-volatile RAM */
902 #define	SMB_MAU_CACHE		0x07	/* cache memory */
903 
904 #define	SMB_MAE_OTHER		0x01	/* other */
905 #define	SMB_MAE_UNKNOWN		0x02	/* unknown */
906 #define	SMB_MAE_NONE		0x03	/* none */
907 #define	SMB_MAE_PARITY		0x04	/* parity */
908 #define	SMB_MAE_SECC		0x05	/* single-bit ECC */
909 #define	SMB_MAE_MECC		0x06	/* multi-bit ECC */
910 #define	SMB_MAE_CRC		0x07	/* CRC */
911 
912 /*
913  * SMBIOS Memory Device Information.  See DSP0134 Section 3.3.18 for more
914  * information.  One or more of these structures are associated with each
915  * smbios_memarray_t.  A structure is present even for unpopulated sockets.
916  * Unknown values are set to -1.  A smbmd_size of 0 indicates unpopulated.
917  * WARNING: Some BIOSes appear to export the *maximum* size of the device
918  * that can appear in the corresponding socket as opposed to the current one.
919  */
920 typedef struct smbios_memdevice {
921 	id_t smbmd_array;		/* handle of physical memory array */
922 	id_t smbmd_error;		/* handle of memory error data */
923 	uint32_t smbmd_twidth;		/* total width in bits including ecc */
924 	uint32_t smbmd_dwidth;		/* data width in bits */
925 	uint64_t smbmd_size;		/* size in bytes (see note above) */
926 	uint8_t smbmd_form;		/* form factor */
927 	uint8_t smbmd_set;		/* set (0x00=none, 0xFF=unknown) */
928 	uint8_t smbmd_type;		/* memory type */
929 	uint8_t smbmd_pad;		/* padding */
930 	uint32_t smbmd_flags;		/* flags (see below) */
931 	uint32_t smbmd_speed;		/* speed in nanoseconds */
932 	const char *smbmd_dloc;		/* physical device locator string */
933 	const char *smbmd_bloc;		/* physical bank locator string */
934 } smbios_memdevice_t;
935 
936 #define	SMB_MDFF_OTHER		0x01	/* other */
937 #define	SMB_MDFF_UNKNOWN	0x02	/* unknown */
938 #define	SMB_MDFF_SIMM		0x03	/* SIMM */
939 #define	SMB_MDFF_SIP		0x04	/* SIP */
940 #define	SMB_MDFF_CHIP		0x05	/* chip */
941 #define	SMB_MDFF_DIP		0x06	/* DIP */
942 #define	SMB_MDFF_ZIP		0x07	/* ZIP */
943 #define	SMB_MDFF_PROP		0x08	/* proprietary card */
944 #define	SMB_MDFF_DIMM		0x09	/* DIMM */
945 #define	SMB_MDFF_TSOP		0x0A	/* TSOP */
946 #define	SMB_MDFF_CHIPROW	0x0B	/* row of chips */
947 #define	SMB_MDFF_RIMM		0x0C	/* RIMM */
948 #define	SMB_MDFF_SODIMM		0x0D	/* SODIMM */
949 #define	SMB_MDFF_SRIMM		0x0E	/* SRIMM */
950 #define	SMB_MDFF_FBDIMM		0x0F	/* FBDIMM */
951 
952 #define	SMB_MDT_OTHER		0x01	/* other */
953 #define	SMB_MDT_UNKNOWN		0x02	/* unknown */
954 #define	SMB_MDT_DRAM		0x03	/* DRAM */
955 #define	SMB_MDT_EDRAM		0x04	/* EDRAM */
956 #define	SMB_MDT_VRAM		0x05	/* VRAM */
957 #define	SMB_MDT_SRAM		0x06	/* SRAM */
958 #define	SMB_MDT_RAM		0x07	/* RAM */
959 #define	SMB_MDT_ROM		0x08	/* ROM */
960 #define	SMB_MDT_FLASH		0x09	/* FLASH */
961 #define	SMB_MDT_EEPROM		0x0A	/* EEPROM */
962 #define	SMB_MDT_FEPROM		0x0B	/* FEPROM */
963 #define	SMB_MDT_EPROM		0x0C	/* EPROM */
964 #define	SMB_MDT_CDRAM		0x0D	/* CDRAM */
965 #define	SMB_MDT_3DRAM		0x0E	/* 3DRAM */
966 #define	SMB_MDT_SDRAM		0x0F	/* SDRAM */
967 #define	SMB_MDT_SGRAM		0x10	/* SGRAM */
968 #define	SMB_MDT_RDRAM		0x11	/* RDRAM */
969 #define	SMB_MDT_DDR		0x12	/* DDR */
970 #define	SMB_MDT_DDR2		0x13	/* DDR2 */
971 #define	SMB_MDT_DDR2FBDIMM	0x14	/* DDR2 FBDIMM */
972 
973 #define	SMB_MDF_OTHER		0x0002	/* other */
974 #define	SMB_MDF_UNKNOWN		0x0004	/* unknown */
975 #define	SMB_MDF_FASTPG		0x0008	/* fast-paged */
976 #define	SMB_MDF_STATIC		0x0010	/* static column */
977 #define	SMB_MDF_PSTATIC		0x0020	/* pseudo-static */
978 #define	SMB_MDF_RAMBUS		0x0040	/* RAMBUS */
979 #define	SMB_MDF_SYNC		0x0080	/* synchronous */
980 #define	SMB_MDF_CMOS		0x0100	/* CMOS */
981 #define	SMB_MDF_EDO		0x0200	/* EDO */
982 #define	SMB_MDF_WDRAM		0x0400	/* Window DRAM */
983 #define	SMB_MDF_CDRAM		0x0800	/* Cache DRAM */
984 #define	SMB_MDF_NV		0x1000	/* non-volatile */
985 
986 /*
987  * SMBIOS Memory Array Mapped Address.  See DSP0134 Section 3.3.20 for more
988  * information.  We convert start/end addresses into addr/size for convenience.
989  */
990 typedef struct smbios_memarrmap {
991 	id_t smbmam_array;		/* physical memory array handle */
992 	uint32_t smbmam_width;		/* number of devices that form a row */
993 	uint64_t smbmam_addr;		/* physical address of mapping */
994 	uint64_t smbmam_size;		/* size in bytes of address range */
995 } smbios_memarrmap_t;
996 
997 /*
998  * SMBIOS Memory Device Mapped Address.  See DSP0134 Section 3.3.21 for more
999  * information.  We convert start/end addresses into addr/size for convenience.
1000  */
1001 typedef struct smbios_memdevmap {
1002 	id_t smbmdm_device;		/* memory device handle */
1003 	id_t smbmdm_arrmap;		/* memory array mapped address handle */
1004 	uint64_t smbmdm_addr;		/* physical address of mapping */
1005 	uint64_t smbmdm_size;		/* size in bytes of address range */
1006 	uint8_t smbmdm_rpos;		/* partition row position */
1007 	uint8_t smbmdm_ipos;		/* interleave position */
1008 	uint8_t smbmdm_idepth;		/* interleave data depth */
1009 } smbios_memdevmap_t;
1010 
1011 /*
1012  * SMBIOS Hardware Security Settings.  See DSP0134 Section 3.3.25 for more
1013  * information.  Only one such record will be present in the SMBIOS.
1014  */
1015 typedef struct smbios_hwsec {
1016 	uint8_t smbh_pwr_ps;		/* power-on password status */
1017 	uint8_t smbh_kbd_ps;		/* keyboard password status */
1018 	uint8_t smbh_adm_ps;		/* administrator password status */
1019 	uint8_t smbh_pan_ps;		/* front panel reset status */
1020 } smbios_hwsec_t;
1021 
1022 #define	SMB_HWSEC_PS_DISABLED	0x00	/* password disabled */
1023 #define	SMB_HWSEC_PS_ENABLED	0x01	/* password enabled */
1024 #define	SMB_HWSEC_PS_NOTIMPL	0x02	/* password not implemented */
1025 #define	SMB_HWSEC_PS_UNKNOWN	0x03	/* password status unknown */
1026 
1027 /*
1028  * SMBIOS System Boot Information.  See DSP0134 Section 3.3.33 for more
1029  * information.  The contents of the data varies by type and is undocumented
1030  * from the perspective of DSP0134 -- it seems to be left as vendor-specific.
1031  * The (D) annotation next to SMB_BOOT_* below indicates possible data payload.
1032  */
1033 typedef struct smbios_boot {
1034 	uint8_t smbt_status;		/* boot status code (see below) */
1035 	const void *smbt_data;		/* data buffer specific to status */
1036 	size_t smbt_size;		/* size of smbt_data buffer in bytes */
1037 } smbios_boot_t;
1038 
1039 #define	SMB_BOOT_NORMAL		0	/* no errors detected */
1040 #define	SMB_BOOT_NOMEDIA	1	/* no bootable media */
1041 #define	SMB_BOOT_OSFAIL		2	/* normal o/s failed to load */
1042 #define	SMB_BOOT_FWHWFAIL	3	/* firmware-detected hardware failure */
1043 #define	SMB_BOOT_OSHWFAIL	4	/* o/s-detected hardware failure */
1044 #define	SMB_BOOT_USERREQ	5	/* user-requested boot (keystroke) */
1045 #define	SMB_BOOT_SECURITY	6	/* system security violation */
1046 #define	SMB_BOOT_PREVREQ	7	/* previously requested image (D) */
1047 #define	SMB_BOOT_WATCHDOG	8	/* watchdog initiated reboot */
1048 #define	SMB_BOOT_RESV_LO	9	/* low end of reserved range */
1049 #define	SMB_BOOT_RESV_HI	127	/* high end of reserved range */
1050 #define	SMB_BOOT_OEM_LO		128	/* low end of OEM-specific range */
1051 #define	SMB_BOOT_OEM_HI		191	/* high end of OEM-specific range */
1052 #define	SMB_BOOT_PROD_LO	192	/* low end of product-specific range */
1053 #define	SMB_BOOT_PROD_HI	255	/* high end of product-specific range */
1054 
1055 /*
1056  * SMBIOS IPMI Device Information.  See DSP0134 Section 3.3.39 and also
1057  * Appendix C1 of the IPMI specification for more information on this record.
1058  */
1059 typedef struct smbios_ipmi {
1060 	uint_t smbip_type;		/* BMC interface type */
1061 	smbios_version_t smbip_vers;	/* BMC's IPMI specification version */
1062 	uint32_t smbip_i2c;		/* BMC I2C bus slave address */
1063 	uint32_t smbip_bus;		/* bus ID of NV storage device, or -1 */
1064 	uint64_t smbip_addr;		/* BMC base address */
1065 	uint32_t smbip_flags;		/* flags (see below) */
1066 	uint16_t smbip_intr;		/* interrupt number (or zero if none) */
1067 	uint16_t smbip_regspacing;	/* i/o space register spacing (bytes) */
1068 } smbios_ipmi_t;
1069 
1070 #define	SMB_IPMI_T_UNKNOWN	0x00	/* unknown */
1071 #define	SMB_IPMI_T_KCS		0x01	/* KCS: Keyboard Controller Style */
1072 #define	SMB_IPMI_T_SMIC		0x02	/* SMIC: Server Mgmt Interface Chip */
1073 #define	SMB_IPMI_T_BT		0x03	/* BT: Block Transfer */
1074 #define	SMB_IPMI_T_SSIF		0x04	/* SSIF: SMBus System Interface */
1075 
1076 #define	SMB_IPMI_F_IOADDR	0x01	/* base address is in i/o space */
1077 #define	SMB_IPMI_F_INTRSPEC	0x02	/* intr information is specified */
1078 #define	SMB_IPMI_F_INTRHIGH	0x04	/* intr active high (else low) */
1079 #define	SMB_IPMI_F_INTREDGE	0x08	/* intr is edge triggered (else lvl) */
1080 
1081 /*
1082  * SMBIOS OEM-specific (Type 132) Processor Extended Information.
1083  */
1084 typedef struct smbios_processor_ext {
1085 	uint16_t smbpe_processor;	/* extending processor handle */
1086 	uint8_t smbpe_fru;		/* FRU indicaor */
1087 	uint8_t smbpe_n;		/* number of APIC IDs */
1088 	uint16_t *smbpe_apicid;		/* strand Inital APIC IDs */
1089 } smbios_processor_ext_t;
1090 
1091 /*
1092  * SMBIOS OEM-specific (Type 138) PCI-Express RC/RP Information.
1093  */
1094 typedef struct smbios_pciexrc {
1095 	uint16_t smbpcie_bb;		/* base board handle */
1096 	uint16_t smbpcie_bdf;		/* Bus/Dev/Funct (PCI) */
1097 } smbios_pciexrc_t;
1098 
1099 /*
1100  * SMBIOS OEM-specific (Type 144) Memory Array Extended Information.
1101  */
1102 typedef struct smbios_memarray_ext {
1103 	uint16_t smbmae_ma;		/* memory array handle */
1104 	uint16_t smbmae_comp;		/* component parent handle */
1105 	uint16_t smbmae_bdf;		/* Bus/Dev/Funct (PCI) */
1106 } smbios_memarray_ext_t;
1107 
1108 /*
1109  * SMBIOS OEM-specific (Type 145) Memory Device Extended Information.
1110  */
1111 typedef struct smbios_memdevice_ext {
1112 	uint16_t smbmdeve_md;		/* memory device handle */
1113 	uint8_t smbmdeve_drch;		/* DRAM channel */
1114 	uint8_t smbmdeve_ncs;		/* number of chip selects */
1115 	uint8_t *smbmdeve_cs;		/* array of chip select numbers */
1116 } smbios_memdevice_ext_t;
1117 
1118 /*
1119  * SMBIOS Interfaces.  An SMBIOS image can be opened by either providing a file
1120  * pathname, device pathname, file descriptor, or raw memory buffer.  Once an
1121  * image is opened the functions below can be used to iterate over the various
1122  * structures and convert the underlying data representation into the simpler
1123  * data structures described earlier in this header file.  The SMB_VERSION
1124  * constant specified when opening an image indicates the version of the ABI
1125  * the caller expects and the DMTF SMBIOS version the client can understand.
1126  * The library will then map older or newer data structures to that as needed.
1127  */
1128 
1129 #define	SMB_VERSION_23	0x0203		/* SMBIOS encoding for DMTF spec 2.3 */
1130 #define	SMB_VERSION_24	0x0204		/* SMBIOS encoding for DMTF spec 2.4 */
1131 #define	SMB_VERSION	SMB_VERSION_24	/* SMBIOS latest version definitions */
1132 
1133 #define	SMB_O_NOCKSUM	0x1		/* do not verify header checksums */
1134 #define	SMB_O_NOVERS	0x2		/* do not verify header versions */
1135 #define	SMB_O_ZIDS	0x4		/* strip out identification numbers */
1136 #define	SMB_O_MASK	0x7		/* mask of valid smbios_*open flags */
1137 
1138 #define	SMB_ID_NOTSUP	0xFFFE		/* structure is not supported by BIOS */
1139 #define	SMB_ID_NONE	0xFFFF		/* structure is a null reference */
1140 
1141 #define	SMB_ERR		(-1)		/* id_t value indicating error */
1142 
1143 typedef struct smbios_hdl smbios_hdl_t;
1144 
1145 typedef struct smbios_struct {
1146 	id_t smbstr_id;			/* structure ID handle */
1147 	uint_t smbstr_type;		/* structure type */
1148 	const void *smbstr_data;	/* structure data */
1149 	size_t smbstr_size;		/* structure size */
1150 } smbios_struct_t;
1151 
1152 typedef int smbios_struct_f(smbios_hdl_t *,
1153     const smbios_struct_t *, void *);
1154 
1155 extern smbios_hdl_t *smbios_open(const char *, int, int, int *);
1156 extern smbios_hdl_t *smbios_fdopen(int, int, int, int *);
1157 extern smbios_hdl_t *smbios_bufopen(const smbios_entry_t *,
1158     const void *, size_t, int, int, int *);
1159 
1160 extern const void *smbios_buf(smbios_hdl_t *);
1161 extern size_t smbios_buflen(smbios_hdl_t *);
1162 
1163 extern void smbios_checksum(smbios_hdl_t *, smbios_entry_t *);
1164 extern int smbios_write(smbios_hdl_t *, int);
1165 extern void smbios_close(smbios_hdl_t *);
1166 
1167 extern int smbios_errno(smbios_hdl_t *);
1168 extern const char *smbios_errmsg(int);
1169 
1170 extern int smbios_lookup_id(smbios_hdl_t *, id_t, smbios_struct_t *);
1171 extern int smbios_lookup_type(smbios_hdl_t *, uint_t, smbios_struct_t *);
1172 extern int smbios_iter(smbios_hdl_t *, smbios_struct_f *, void *);
1173 
1174 extern void smbios_info_smbios(smbios_hdl_t *, smbios_entry_t *);
1175 extern int smbios_info_common(smbios_hdl_t *, id_t, smbios_info_t *);
1176 extern int smbios_info_contains(smbios_hdl_t *, id_t, uint_t, id_t *);
1177 extern id_t smbios_info_bios(smbios_hdl_t *, smbios_bios_t *);
1178 extern id_t smbios_info_system(smbios_hdl_t *, smbios_system_t *);
1179 extern int smbios_info_bboard(smbios_hdl_t *, id_t, smbios_bboard_t *);
1180 extern int smbios_info_chassis(smbios_hdl_t *, id_t, smbios_chassis_t *);
1181 extern int smbios_info_processor(smbios_hdl_t *, id_t, smbios_processor_t *);
1182 extern int smbios_info_extprocessor(smbios_hdl_t *, id_t,
1183     smbios_processor_ext_t *);
1184 extern int smbios_info_cache(smbios_hdl_t *, id_t, smbios_cache_t *);
1185 extern int smbios_info_port(smbios_hdl_t *, id_t, smbios_port_t *);
1186 extern int smbios_info_slot(smbios_hdl_t *, id_t, smbios_slot_t *);
1187 extern int smbios_info_obdevs(smbios_hdl_t *, id_t, int, smbios_obdev_t *);
1188 extern int smbios_info_strtab(smbios_hdl_t *, id_t, int, const char *[]);
1189 extern id_t smbios_info_lang(smbios_hdl_t *, smbios_lang_t *);
1190 extern id_t smbios_info_eventlog(smbios_hdl_t *, smbios_evlog_t *);
1191 extern int smbios_info_memarray(smbios_hdl_t *, id_t, smbios_memarray_t *);
1192 extern int smbios_info_extmemarray(smbios_hdl_t *, id_t,
1193     smbios_memarray_ext_t *);
1194 extern int smbios_info_memarrmap(smbios_hdl_t *, id_t, smbios_memarrmap_t *);
1195 extern int smbios_info_memdevice(smbios_hdl_t *, id_t, smbios_memdevice_t *);
1196 extern int smbios_info_extmemdevice(smbios_hdl_t *, id_t,
1197     smbios_memdevice_ext_t *);
1198 extern int smbios_info_memdevmap(smbios_hdl_t *, id_t, smbios_memdevmap_t *);
1199 extern id_t smbios_info_hwsec(smbios_hdl_t *, smbios_hwsec_t *);
1200 extern id_t smbios_info_boot(smbios_hdl_t *, smbios_boot_t *);
1201 extern id_t smbios_info_ipmi(smbios_hdl_t *, smbios_ipmi_t *);
1202 extern int smbios_info_pciexrc(smbios_hdl_t *, id_t, smbios_pciexrc_t *);
1203 
1204 extern const char *smbios_psn(smbios_hdl_t *);
1205 extern const char *smbios_csn(smbios_hdl_t *);
1206 
1207 #ifndef _KERNEL
1208 /*
1209  * The smbios_*_desc() and smbios_*_name() interfaces can be used for utilities
1210  * such as smbios(1M) that wish to decode SMBIOS fields for humans.  The _desc
1211  * functions return the comment string next to the #defines listed above, and
1212  * the _name functions return the appropriate #define identifier itself.
1213  */
1214 extern const char *smbios_bboard_flag_desc(uint_t);
1215 extern const char *smbios_bboard_flag_name(uint_t);
1216 extern const char *smbios_bboard_type_desc(uint_t);
1217 
1218 extern const char *smbios_bios_flag_desc(uint64_t);
1219 extern const char *smbios_bios_flag_name(uint64_t);
1220 
1221 extern const char *smbios_bios_xb1_desc(uint_t);
1222 extern const char *smbios_bios_xb1_name(uint_t);
1223 extern const char *smbios_bios_xb2_desc(uint_t);
1224 extern const char *smbios_bios_xb2_name(uint_t);
1225 
1226 extern const char *smbios_boot_desc(uint_t);
1227 
1228 extern const char *smbios_cache_assoc_desc(uint_t);
1229 extern const char *smbios_cache_ctype_desc(uint_t);
1230 extern const char *smbios_cache_ctype_name(uint_t);
1231 extern const char *smbios_cache_ecc_desc(uint_t);
1232 extern const char *smbios_cache_flag_desc(uint_t);
1233 extern const char *smbios_cache_flag_name(uint_t);
1234 extern const char *smbios_cache_loc_desc(uint_t);
1235 extern const char *smbios_cache_logical_desc(uint_t);
1236 extern const char *smbios_cache_mode_desc(uint_t);
1237 
1238 extern const char *smbios_chassis_state_desc(uint_t);
1239 extern const char *smbios_chassis_type_desc(uint_t);
1240 
1241 extern const char *smbios_evlog_flag_desc(uint_t);
1242 extern const char *smbios_evlog_flag_name(uint_t);
1243 extern const char *smbios_evlog_format_desc(uint_t);
1244 extern const char *smbios_evlog_method_desc(uint_t);
1245 
1246 extern const char *smbios_ipmi_flag_name(uint_t);
1247 extern const char *smbios_ipmi_flag_desc(uint_t);
1248 extern const char *smbios_ipmi_type_desc(uint_t);
1249 
1250 extern const char *smbios_hwsec_desc(uint_t);
1251 
1252 extern const char *smbios_memarray_loc_desc(uint_t);
1253 extern const char *smbios_memarray_use_desc(uint_t);
1254 extern const char *smbios_memarray_ecc_desc(uint_t);
1255 
1256 extern const char *smbios_memdevice_form_desc(uint_t);
1257 extern const char *smbios_memdevice_type_desc(uint_t);
1258 extern const char *smbios_memdevice_flag_name(uint_t);
1259 extern const char *smbios_memdevice_flag_desc(uint_t);
1260 
1261 extern const char *smbios_port_conn_desc(uint_t);
1262 extern const char *smbios_port_type_desc(uint_t);
1263 
1264 extern const char *smbios_processor_family_desc(uint_t);
1265 extern const char *smbios_processor_status_desc(uint_t);
1266 extern const char *smbios_processor_type_desc(uint_t);
1267 extern const char *smbios_processor_upgrade_desc(uint_t);
1268 
1269 extern const char *smbios_slot_type_desc(uint_t);
1270 extern const char *smbios_slot_width_desc(uint_t);
1271 extern const char *smbios_slot_usage_desc(uint_t);
1272 extern const char *smbios_slot_length_desc(uint_t);
1273 extern const char *smbios_slot_ch1_desc(uint_t);
1274 extern const char *smbios_slot_ch1_name(uint_t);
1275 extern const char *smbios_slot_ch2_desc(uint_t);
1276 extern const char *smbios_slot_ch2_name(uint_t);
1277 
1278 extern const char *smbios_type_desc(uint_t);
1279 extern const char *smbios_type_name(uint_t);
1280 
1281 extern const char *smbios_system_wakeup_desc(uint_t);
1282 #endif /* !_KERNEL */
1283 
1284 #ifdef _KERNEL
1285 /*
1286  * For SMBIOS clients within the kernel itself, ksmbios is used to refer to
1287  * the kernel's current snapshot of the SMBIOS, if one exists, and the
1288  * ksmbios_flags tunable is the set of flags for use with smbios_open().
1289  */
1290 extern smbios_hdl_t *ksmbios;
1291 extern int ksmbios_flags;
1292 #endif /* _KERNEL */
1293 
1294 #ifdef	__cplusplus
1295 }
1296 #endif
1297 
1298 #endif	/* _SYS_SMBIOS_H */
1299