xref: /illumos-gate/usr/src/uts/common/sys/smbios_impl.h (revision 49f72993927fbcc8093ddd143715f814931de21a)
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 2015 OmniTI Computer Consulting, Inc.  All rights reserved.
24  * Copyright (c) 2018, Joyent, Inc.
25  * Copyright 2024 Oxide Computer Company
26  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
27  * Use is subject to license terms.
28  */
29 
30 /*
31  * This header file defines the implementation structures for the SMBIOS access
32  * library, libsmbios, and an equivalent kernel module.  Clients should use
33  * the <smbios.h> or <sys/smbios.h> header files to access DMTF SMBIOS
34  * information, NOT these underlying implementation structures from the spec.
35  * In short, do not user this header file or these routines for any purpose.
36  */
37 
38 #ifndef	_SYS_SMBIOS_IMPL_H
39 #define	_SYS_SMBIOS_IMPL_H
40 
41 #include <sys/smbios.h>
42 #include <sys/sysmacros.h>
43 
44 #ifdef _KERNEL
45 #include <sys/systm.h>
46 #else
47 #include <strings.h>
48 #include <stddef.h>
49 #endif
50 
51 #ifdef	__cplusplus
52 extern "C" {
53 #endif
54 
55 /*
56  * Definitions required to interpret the BIOS type information.
57  */
58 #define	SMB_BIOSXB_EXTROM	6
59 
60 #define	SMB_BIOS_EXTROM_VALUE_MASK(x)	((x) & 0x3fff)
61 #define	SMB_BIOS_EXTROM_SHIFT_MASK(x)	(((x) & 0xc000) >> 14)
62 
63 #pragma pack(1)
64 
65 typedef struct smb_header {
66 	uint8_t smbh_type;		/* structure type (SMB_TYPE_* value) */
67 	uint8_t smbh_len;		/* length in bytes of formatted area */
68 	uint16_t smbh_hdl;		/* structure handle */
69 } smb_header_t;
70 
71 /*
72  * SMBIOS implementation structure for SMB_TYPE_BIOS.
73  */
74 typedef struct smb_bios {
75 	smb_header_t smbbi_hdr;		/* structure header */
76 	uint8_t smbbi_vendor;		/* bios vendor string */
77 	uint8_t smbbi_version;		/* bios version string */
78 	uint16_t smbbi_segment;		/* segment location of bios address */
79 	uint8_t smbbi_reldate;		/* bios release date */
80 	uint8_t smbbi_romsize;		/* bios rom size (64k * (n + 1)) */
81 	uint64_t smbbi_cflags;		/* bios characteristics */
82 	uint8_t smbbi_xcflags[1];	/* bios characteristics extensions */
83 } smb_bios_t;
84 
85 /*
86  * SMBIOS implementation structure for SMB_TYPE_SYSTEM.
87  */
88 typedef struct smb_system {
89 	smb_header_t smbsi_hdr;		/* structure header */
90 	uint8_t smbsi_manufacturer;	/* manufacturer */
91 	uint8_t smbsi_product;		/* product name */
92 	uint8_t smbsi_version;		/* version */
93 	uint8_t smbsi_serial;		/* serial number */
94 	uint8_t smbsi_uuid[16];		/* UUID */
95 	uint8_t smbsi_wakeup;		/* wake-up type */
96 	uint8_t smbsi_sku;		/* SKU number */
97 	uint8_t smbsi_family;		/* family */
98 } smb_system_t;
99 
100 /*
101  * SMBIOS implementation structure for SMB_TYPE_BASEBOARD.
102  */
103 typedef struct smb_bboard {
104 	smb_header_t smbbb_hdr;		/* structure header */
105 	uint8_t smbbb_manufacturer;	/* manufacturer */
106 	uint8_t smbbb_product;		/* product name */
107 	uint8_t smbbb_version;		/* version */
108 	uint8_t smbbb_serial;		/* serial number */
109 	uint8_t smbbb_asset;		/* asset tag */
110 	uint8_t smbbb_flags;		/* feature flags */
111 	uint8_t smbbb_location;		/* location in chassis */
112 	uint16_t smbbb_chassis;		/* chassis handle */
113 	uint8_t smbbb_type;		/* board type */
114 	uint8_t smbbb_cn;		/* number of contained handles */
115 	uint16_t smbbb_cv[1];		/* array of contained handles */
116 } smb_bboard_t;
117 
118 /*
119  * SMBIOS implementation structure for SMB_TYPE_CHASSIS.
120  */
121 typedef struct smb_chassis {
122 	smb_header_t smbch_hdr;		/* structure header */
123 	uint8_t smbch_manufacturer;	/* manufacturer */
124 	uint8_t smbch_type;		/* type */
125 	uint8_t smbch_version;		/* version */
126 	uint8_t smbch_serial;		/* serial number */
127 	uint8_t smbch_asset;		/* asset tag */
128 	uint8_t smbch_bustate;		/* boot-up state */
129 	uint8_t smbch_psstate;		/* power supply state */
130 	uint8_t smbch_thstate;		/* thermal state */
131 	uint8_t smbch_security;		/* security state */
132 	uint32_t smbch_oemdata;		/* OEM-specific data */
133 	uint8_t smbch_uheight;		/* enclosure height */
134 	uint8_t smbch_cords;		/* number of power cords */
135 	uint8_t smbch_cn;		/* number of contained records */
136 	uint8_t smbch_cm;		/* size of contained records */
137 	uint8_t smbch_cv[];		/* array of contained records */
138 } smb_chassis_t;
139 
140 #define	SMB_CHT_LOCK	0x80		/* lock bit within smbch_type */
141 
142 typedef struct smb_chassis_entry {
143 	uint8_t	smbce_type;		/* Containing Element and Type */
144 	uint8_t	smbce_min;		/* minimum number of elt */
145 	uint8_t	smbce_max;		/* minimum number of elt */
146 } smb_chassis_entry_t;
147 
148 #define	SMB_CHE_TYPE_IS_SMB(x)	(((x) & 0x80) ==  0x80)
149 #define	SMB_CHE_TYPE_TYPE(x)	(((x) & 0x7f))
150 
151 /*
152  * SMBIOS implementation structure for SMB_TYPE_PROCESSOR.
153  */
154 typedef struct smb_processor {
155 	smb_header_t smbpr_hdr;		/* structure header */
156 	uint8_t smbpr_socket;		/* socket designation */
157 	uint8_t smbpr_type;		/* processor type (see <smbios.h>) */
158 	uint8_t smbpr_family;		/* processor family (see <smbios.h>) */
159 	uint8_t smbpr_manufacturer;	/* manufacturer */
160 	uint64_t smbpr_cpuid;		/* processor cpuid information */
161 	uint8_t smbpr_version;		/* version */
162 	uint8_t smbpr_voltage;		/* voltage */
163 	uint16_t smbpr_clkspeed;	/* external clock speed in MHz */
164 	uint16_t smbpr_maxspeed;	/* maximum speed in MHz */
165 	uint16_t smbpr_curspeed;	/* current speed in MHz */
166 	uint8_t smbpr_status;		/* status (see <smbios.h>) */
167 	uint8_t smbpr_upgrade;		/* upgrade */
168 	uint16_t smbpr_l1cache;		/* L1 cache handle (if any) */
169 	uint16_t smbpr_l2cache;		/* L2 cache handle (if any) */
170 	uint16_t smbpr_l3cache;		/* L3 cache handle (if any) */
171 	uint8_t smbpr_serial;		/* serial number */
172 	uint8_t smbpr_asset;		/* asset tag */
173 	uint8_t smbpr_part;		/* part number */
174 	uint8_t smbpr_corecount;	/* number of cores per socket */
175 	uint8_t smbpr_coresenabled;	/* number of enabled cores per socket */
176 	uint8_t smbpr_threadcount;	/* number of threads per socket */
177 	uint16_t smbpr_cflags;	/* cpu characteristics (see <smbios.h>) */
178 	uint16_t smbpr_family2;		/* processor family2 (see <smbios.h>) */
179 	uint16_t smbpr_corecount2;	/* second number of cores per socket */
180 	uint16_t smbpr_coresenabled2;	/* second number of enabled cores */
181 	uint16_t smbpr_threadcount2;	/* second number of enabled threads */
182 	uint16_t smbpr_threaden;	/* enabled thread count */
183 	uint8_t smbpr_socktype;		/* socket type string */
184 } smb_processor_t;
185 
186 /*
187  * SMBIOS implementation structure for SMB_TYPE_CACHE.
188  */
189 typedef struct smb_cache {
190 	smb_header_t smbca_hdr;		/* structure header */
191 	uint8_t smbca_socket;		/* socket designation */
192 	uint16_t smbca_config;		/* cache configuration */
193 	uint16_t smbca_maxsize;		/* maximum installed size */
194 	uint16_t smbca_size;		/* installed size */
195 	uint16_t smbca_stype;		/* supported SRAM type */
196 	uint16_t smbca_ctype;		/* current SRAM type */
197 	uint8_t smbca_speed;		/* speed in nanoseconds */
198 	uint8_t smbca_etype;		/* error correction type */
199 	uint8_t smbca_ltype;		/* logical cache type */
200 	uint8_t smbca_assoc;		/* associativity */
201 	uint32_t smbca_maxsize2;	/* maximum installed size 2 */
202 	uint32_t smbca_size2;		/* installed size 2 */
203 } smb_cache_t;
204 
205 /*
206  * Convert encoded cache size to bytes: DSP0134 Section 7.8 explains the
207  * encoding.  The highest bit is 0 for 1k units, 1 for 64k units, and this
208  * macro decodes the value into bytes for exporting to our clients.
209  */
210 #define	SMB_CACHE_SIZE(s)	(((s) & 0x8000) ? \
211 	((uint32_t)((s) & 0x7FFF) * 64 * 1024) : ((uint32_t)(s) * 1024))
212 
213 #define	SMB_CACHE_EXT_SIZE(s)	(((s) & 0x80000000U) ?	\
214 	((uint64_t)((s) & 0x7FFFFFFFULL) * 64ULL * 1024ULL) :	\
215 	((uint64_t)(s) * 1024ULL))
216 
217 #define	SMB_CACHE_CFG_MODE(c)		(((c) >> 8) & 3)
218 #define	SMB_CACHE_CFG_ENABLED(c)	(((c) >> 7) & 1)
219 #define	SMB_CACHE_CFG_LOCATION(c)	(((c) >> 5) & 3)
220 #define	SMB_CACHE_CFG_SOCKETED(c)	(((c) >> 3) & 1)
221 #define	SMB_CACHE_CFG_LEVEL(c)		(((c) & 7) + 1)
222 
223 /*
224  * SMBIOS implementation structure for SMB_TYPE_PORT.
225  */
226 typedef struct smb_port {
227 	smb_header_t smbpo_hdr;		/* structure header */
228 	uint8_t smbpo_iref;		/* internal reference designator */
229 	uint8_t smbpo_itype;		/* internal connector type */
230 	uint8_t smbpo_eref;		/* external reference designator */
231 	uint8_t smbpo_etype;		/* external connector type */
232 	uint8_t smbpo_ptype;		/* port type */
233 } smb_port_t;
234 
235 /*
236  * SMBIOS implementation structure for SMB_TYPE_SLOT.
237  */
238 typedef struct smb_slot_peer {
239 	uint16_t smbspb_group_no;	/* segment group number */
240 	uint8_t smbspb_bus;		/* bus number */
241 	uint8_t smbspb_df;		/* device/function number */
242 	uint8_t smbspb_width;		/* electrical width */
243 } smb_slot_peer_t;
244 
245 typedef struct smb_slot {
246 	smb_header_t smbsl_hdr;		/* structure header */
247 	uint8_t smbsl_name;		/* reference designation */
248 	uint8_t smbsl_type;		/* slot type */
249 	uint8_t smbsl_width;		/* slot data bus width */
250 	uint8_t smbsl_usage;		/* current usage */
251 	uint8_t smbsl_length;		/* slot length */
252 	uint16_t smbsl_id;		/* slot ID */
253 	uint8_t smbsl_ch1;		/* slot characteristics 1 */
254 	uint8_t smbsl_ch2;		/* slot characteristics 2 */
255 	uint16_t smbsl_sg;		/* segment group number */
256 	uint8_t smbsl_bus;		/* bus number */
257 	uint8_t smbsl_df;		/* device/function number */
258 	/* Added in SMBIOS 3.2+ */
259 	uint8_t	smbsl_dbw;		/* Data bus width */
260 	uint8_t	smbsl_npeers;		/* Peer bdf groups */
261 	smb_slot_peer_t smbsl_peers[];	/* bifurcation peers */
262 	/* There are later additions in 3.4+, see smbios_slot_cont_t */
263 } smb_slot_t;
264 
265 /*
266  * After the variable number of smbsl_peers, the smbios_slot has continued in
267  * size and has the following members defined as of version 3.4. These occur
268  * starting at byte 14 + 5 * smbsl_npeers.
269  */
270 typedef struct smb_slot_cont {
271 	uint8_t smbsl_info;		/* slot info */
272 	uint8_t smbsl_pwidth;		/* slot physical width */
273 	uint16_t smbsl_pitch;		/* slot pitch */
274 	/* Added in SMBIOS 3.5 */
275 	uint8_t smbsl_height;		/* slot height */
276 } smb_slot_cont_t;
277 
278 /*
279  * The first byte that the smb_slot_cont_t is defined to start at. Note, this
280  * was originally indicated to be 0x14 in the SMBIOS 3.4 specification. This has
281  * been noted as an errata. Right now we assume that most things have the
282  * updated behavior in SMBIOS 3.5. However, if we encounter things in the wild
283  * that have the other offset then we will need to condition this on 3.4.
284  */
285 #define	SMB_SLOT_CONT_START	0x13
286 
287 /*
288  * SMBIOS implementation structure for SMB_TYPE_OBDEVS.
289  */
290 typedef struct smb_obdev {
291 	uint8_t smbob_type;		/* encoded type and enable bit */
292 	uint8_t smbob_name;		/* description string */
293 } smb_obdev_t;
294 
295 #define	SMB_OBT_ENABLED		0x80	/* enable bit within smbob_type */
296 
297 /*
298  * SMBIOS implementation structure for SMB_TYPE_OEMSTR, SMB_TYPE_SYSCONFSTR,
299  * and SMB_TYPE_LANG.
300  */
301 typedef struct smb_strtab {
302 	smb_header_t smbtb_hdr;		/* structure header */
303 	uint8_t smbtb_count;		/* number of strings */
304 } smb_strtab_t;
305 
306 /*
307  * SMBIOS implementation structure for SMB_TYPE_LANG.
308  */
309 typedef struct smb_lang {
310 	smb_header_t smblang_hdr;	/* structure header */
311 	uint8_t smblang_num;		/* number of installed languages */
312 	uint8_t smblang_flags;		/* flags */
313 	uint8_t smblang_resv[15];	/* reserved for future use */
314 	uint8_t smblang_cur;		/* current language string */
315 } smb_lang_t;
316 
317 /*
318  * SMBIOS implementation structure for SMB_TYPE_EVENTLOG.
319  */
320 typedef struct smb_sel {
321 	smb_header_t smbsel_hdr;	/* structure header */
322 	uint16_t smbsel_len;		/* log area length */
323 	uint16_t smbsel_hdroff;		/* header offset */
324 	uint16_t smbsel_dataoff;	/* data offset */
325 	uint8_t smbsel_method;		/* access method */
326 	uint8_t smbsel_status;		/* status flags */
327 	uint32_t smbsel_token;		/* change token */
328 	uint32_t smbsel_addr;		/* access method address */
329 	uint8_t smbsel_format;		/* header format */
330 	uint8_t smbsel_typec;		/* number of type descriptors */
331 	uint8_t smbsel_typesz;		/* size of each type descriptor */
332 	uint8_t smbsel_typev[1];	/* array of type descriptors */
333 } smb_sel_t;
334 
335 /*
336  * SMBIOS implementation structure for SMB_TYPE_MEMARRAY.
337  */
338 typedef struct smb_memarray {
339 	smb_header_t smbmarr_hdr;	/* structure header */
340 	uint8_t smbmarr_loc;		/* location */
341 	uint8_t smbmarr_use;		/* use */
342 	uint8_t smbmarr_ecc;		/* error detect/correct mechanism */
343 	uint32_t smbmarr_cap;		/* maximum capacity */
344 	uint16_t smbmarr_err;		/* error handle */
345 	uint16_t smbmarr_ndevs;		/* number of slots or sockets */
346 	uint64_t smbmarr_extcap;	/* extended maximum capacity */
347 } smb_memarray_t;
348 
349 /*
350  * SMBIOS implementation structure for SMB_TYPE_MEMARRAYMAP.
351  */
352 typedef struct smb_memarrmap {
353 	smb_header_t smbamap_hdr;	/* structure header */
354 	uint32_t smbamap_start;		/* starting address in kilobytes */
355 	uint32_t smbamap_end;		/* ending address in kilobytes */
356 	uint16_t smbamap_array;		/* physical memory array handle */
357 	uint8_t smbamap_width;		/* partition width */
358 	uint64_t smbamap_extstart;	/* extended starting address in bytes */
359 	uint64_t smbamap_extend;	/* extended ending address in bytes */
360 } smb_memarrmap_t;
361 
362 /*
363  * SMBIOS implementation structure for SMB_TYPE_MEMDEVICE.
364  */
365 typedef struct smb_memdevice {
366 	smb_header_t smbmdev_hdr;	/* structure header */
367 	uint16_t smbmdev_array;		/* array handle */
368 	uint16_t smbmdev_error;		/* error handle */
369 	uint16_t smbmdev_twidth;	/* total width */
370 	uint16_t smbmdev_dwidth;	/* data width */
371 	uint16_t smbmdev_size;		/* size in either K or MB */
372 	uint8_t smbmdev_form;		/* form factor */
373 	uint8_t smbmdev_set;		/* device set */
374 	uint8_t smbmdev_dloc;		/* device locator */
375 	uint8_t smbmdev_bloc;		/* bank locator */
376 	uint8_t smbmdev_type;		/* memory type */
377 	uint16_t smbmdev_flags;		/* detail flags */
378 	uint16_t smbmdev_speed;		/* speed in MT/s */
379 	uint8_t smbmdev_manufacturer;	/* manufacturer */
380 	uint8_t smbmdev_serial;		/* serial number */
381 	uint8_t smbmdev_asset;		/* asset tag */
382 	uint8_t smbmdev_part;		/* part number */
383 	uint8_t smbmdev_attrs;		/* attributes */
384 	uint32_t smbmdev_extsize;	/* extended size */
385 	uint16_t smbmdev_clkspeed;	/* configured clock speed */
386 	uint16_t smbmdev_minvolt;	/* minimum voltage */
387 	uint16_t smbmdev_maxvolt;	/* maximum voltage */
388 	uint16_t smbmdev_confvolt;	/* configured voltage */
389 	/* Added in SMBIOS 3.2 */
390 	uint8_t smbmdev_memtech;	/* memory technology */
391 	uint16_t smbmdev_opmode;	/* memory operating mode capability */
392 	uint8_t smbmdev_fwver;		/* firmware version */
393 	uint16_t smbmdev_modulemfgid;	/* module manufacturer ID */
394 	uint16_t smbmdev_moduleprodid;	/* module product ID */
395 	uint16_t smbmdev_memsysmfgid;	/* memory controller manufacturer id */
396 	uint16_t smbmdev_memsysprodid;	/* memory controller product id */
397 	uint64_t smbmdev_nvsize;	/* non-volatile memory size */
398 	uint64_t smbmdev_volsize;	/* volatile memory size */
399 	uint64_t smbmdev_cachesize;	/* cache size */
400 	uint64_t smbmdev_logicalsize;	/* logical size */
401 	/* Added in SMBIOS 3.3 */
402 	uint32_t smbmdev_extspeed;	/* Extended device speed */
403 	uint32_t smbmdev_extclkspeed;	/* Extended clock speed */
404 	/* Added in SMBIOS 3.7 */
405 	uint16_t smbmdev_pmic0mfgid;	/* PMIC0 Manufacturer ID */
406 	uint16_t smbmdev_pmic0rev;	/* PMIC0 Revision */
407 	uint16_t smbmdev_rcdmfgid;	/* RCD Manufacturer ID */
408 	uint16_t smbmdev_rcdrev;	/* RCD Revision */
409 } smb_memdevice_t;
410 
411 #define	SMB_MDS_KBYTES		0x8000	/* size in specified in kilobytes */
412 
413 /*
414  * SMBIOS implementation structure for SMB_TYPE_MEMDEVICEMAP.
415  */
416 typedef struct smb_memdevmap {
417 	smb_header_t smbdmap_hdr;	/* structure header */
418 	uint32_t smbdmap_start;		/* starting address in kilobytes */
419 	uint32_t smbdmap_end;		/* ending address in kilobytes */
420 	uint16_t smbdmap_device;	/* memory device handle */
421 	uint16_t smbdmap_array;		/* memory array mapped address handle */
422 	uint8_t smbdmap_rpos;		/* row position */
423 	uint8_t smbdmap_ipos;		/* interleave position */
424 	uint8_t smbdmap_idepth;		/* interleave depth */
425 	uint64_t smbdmap_extstart;	/* extended starting address */
426 	uint64_t smbdmap_extend;	/* extended ending address */
427 } smb_memdevmap_t;
428 
429 typedef struct smb_pointdev {
430 	smb_header_t smbpdev_hdr;	/* structure header */
431 	uint8_t smbpdev_type;		/* device type */
432 	uint8_t smbpdev_iface;		/* device interface */
433 	uint8_t smbpdev_nbuttons;	/* number of buttons */
434 } smb_pointdev_t;
435 
436 /*
437  * SMBIOS implementation structure for SMB_TYPE_BATTERY.
438  */
439 typedef struct smb_battery {
440 	smb_header_t smbbat_hdr;	/* structure header */
441 	uint8_t smbbat_loc;		/* location */
442 	uint8_t smbbat_manufacturer;	/* manufacturer */
443 	uint8_t smbbat_date;		/* manufacture date */
444 	uint8_t smbbat_serial;		/* serial number */
445 	uint8_t smbbat_devname;		/* device name */
446 	uint8_t smbbat_chem;		/* device chemistry */
447 	uint16_t smbbat_cap;		/* design capacity in mW hours */
448 	uint16_t smbbat_volt;		/* design voltage in mV */
449 	uint8_t smbbat_version;		/* SBDS version string */
450 	uint8_t smbbat_err;		/* error percentage */
451 	uint16_t smbbat_ssn;		/* SBDS serial number */
452 	uint16_t smbbat_sdate;		/* SBDS manufacture date */
453 	uint8_t smbbat_schem;		/* SBDS chemistry string */
454 	uint8_t smbbat_mult;		/* design capacity multiplier */
455 	uint32_t smbbat_oemdata;	/* OEM-specific data */
456 } smb_battery_t;
457 
458 /*
459  * SMBIOS implementation structure for SMB_TYPE_SECURITY.
460  */
461 typedef struct smb_hwsec {
462 	smb_header_t smbhs_hdr;		/* structure header */
463 	uint8_t smbhs_settings;		/* settings byte */
464 } smb_hwsec_t;
465 
466 #define	SMB_HWS_PWR_PS(x)	(((x) & 0xC0) >> 6)
467 #define	SMB_HWS_KBD_PS(x)	(((x) & 0x30) >> 4)
468 #define	SMB_HWS_ADM_PS(x)	(((x) & 0x0C) >> 2)
469 #define	SMB_HWS_PAN_PS(x)	(((x) & 0x03) >> 0)
470 
471 /*
472  * SMBIOS implementation structure for SMB_TYPE_VPROBE.
473  */
474 typedef struct smb_vprobe {
475 	smb_header_t smbvpr_hdr;	/* structure header */
476 	uint8_t smbvpr_descr;		/* description string */
477 	uint8_t smbvpr_locstat;		/* location and status */
478 	uint16_t smbvpr_maxval;		/* maximum voltage */
479 	uint16_t smbvpr_minval;		/* minimum voltage */
480 	uint16_t smbvpr_resolution;	/* probe resolution */
481 	uint16_t smbvpr_tolerance;	/* probe tolerance */
482 	uint16_t smbvpr_accuracy;	/* probe accuracy */
483 	uint32_t smbvpr_oem;		/* vendor-specific data */
484 	uint16_t smbvpr_nominal;	/* nominal value */
485 } smb_vprobe_t;
486 
487 #define	SMB_VPROBE_MINLEN		0x14
488 #define	SMB_VPROBE_NOMINAL_MINLEN	0x16
489 
490 #define	SMB_VPROBE_LOCATION(x)	((x) & 0x1f)
491 #define	SMB_VPROBE_STATUS(x)	(((x) >> 5) & 0x7)
492 
493 /*
494  * SMBIOS implementation structure for SMB_TYPE_COOLDEV.
495  */
496 typedef struct smb_cooldev {
497 	smb_header_t smbcdev_hdr;	/* structure header */
498 	uint16_t smbcdev_tprobe;	/* temperature probe */
499 	uint8_t smbcdev_typstat;	/* type and status */
500 	uint8_t smbcdev_group;		/* group identifier */
501 	uint32_t smbcdev_oem;		/* vendor-specific data */
502 	uint16_t smbcdev_nominal;	/* nominal value */
503 	uint8_t smbcdev_descr;		/* description string */
504 } smb_cooldev_t;
505 
506 #define	SMB_COOLDEV_MINLEN		0x0c
507 #define	SMB_COOLDEV_NOMINAL_MINLEN	0x0e
508 #define	SMB_COOLDEV_DESCR_MINLEN	0x0f
509 
510 #define	SMB_COOLDEV_TYPE(x)	((x) & 0x1f)
511 #define	SMB_COOLDEV_STATUS(x)	(((x) >> 5) & 0x7)
512 
513 /*
514  * SMBIOS implementation structure for SMB_TYPE_TPROBE.
515  */
516 typedef struct smb_tprobe {
517 	smb_header_t smbtpr_hdr;	/* structure header */
518 	uint8_t smbtpr_descr;		/* description string */
519 	uint8_t smbtpr_locstat;		/* location and status */
520 	uint16_t smbtpr_maxval;		/* maximum temperature */
521 	uint16_t smbtpr_minval;		/* minimum temperature */
522 	uint16_t smbtpr_resolution;	/* probe resolution */
523 	uint16_t smbtpr_tolerance;	/* probe tolerance */
524 	uint16_t smbtpr_accuracy;	/* probe accuracy */
525 	uint32_t smbtpr_oem;		/* vendor-specific data */
526 	uint16_t smbtpr_nominal;	/* nominal value */
527 } smb_tprobe_t;
528 
529 #define	SMB_TPROBE_MINLEN		0x14
530 #define	SMB_TPROBE_NOMINAL_MINLEN	0x16
531 
532 #define	SMB_TPROBE_LOCATION(x)	((x) & 0x1f)
533 #define	SMB_TPROBE_STATUS(x)	(((x) >> 5) & 0x7)
534 
535 /*
536  * SMBIOS implementation structure for SMB_TYPE_IPROBE.
537  */
538 typedef struct smb_iprobe {
539 	smb_header_t smbipr_hdr;	/* structure header */
540 	uint8_t smbipr_descr;		/* description string */
541 	uint8_t smbipr_locstat;		/* location and status */
542 	uint16_t smbipr_maxval;		/* maximum current */
543 	uint16_t smbipr_minval;		/* minimum current */
544 	uint16_t smbipr_resolution;	/* probe resolution */
545 	uint16_t smbipr_tolerance;	/* probe tolerance */
546 	uint16_t smbipr_accuracy;	/* probe accuracy */
547 	uint32_t smbipr_oem;		/* vendor-specific data */
548 	uint16_t smbipr_nominal;	/* nominal value */
549 } smb_iprobe_t;
550 
551 #define	SMB_IPROBE_MINLEN		0x14
552 #define	SMB_IPROBE_NOMINAL_MINLEN	0x16
553 
554 #define	SMB_IPROBE_LOCATION(x)	((x) & 0x1f)
555 #define	SMB_IPROBE_STATUS(x)	(((x) >> 5) & 0x7)
556 
557 /*
558  * SMBIOS implementation structure for SMB_TYPE_BOOT.
559  */
560 typedef struct smb_boot {
561 	smb_header_t smbbo_hdr;		/* structure header */
562 	uint8_t smbbo_pad[6];		/* reserved for future use */
563 	uint8_t smbbo_status[1];	/* variable-length status buffer */
564 } smb_boot_t;
565 
566 /*
567  * SMBIOS implementation structure for SMB_TYPE_IPMIDEV.
568  */
569 typedef struct smb_ipmi {
570 	smb_header_t smbipm_hdr;	/* structure header */
571 	uint8_t smbipm_type;		/* interface type */
572 	uint8_t smbipm_spec;		/* specification revision */
573 	uint8_t smbipm_i2c;		/* i2C slave address */
574 	uint8_t smbipm_bus;		/* NV storage device bus ID */
575 	uint64_t smbipm_addr;		/* base address */
576 	uint8_t smbipm_info;		/* base address modifier/intr info */
577 	uint8_t smbipm_intr;		/* interrupt number */
578 } smb_ipmi_t;
579 
580 #define	SMB_IPM_SPEC_MAJOR(x)	(((x) & 0xF0) >> 4)
581 #define	SMB_IPM_SPEC_MINOR(x)	((x) & 0x0F)
582 
583 #define	SMB_IPM_ADDR_IO		1ULL
584 
585 #define	SMB_IPM_INFO_REGS(x)	(((x) & 0xC0) >> 6)
586 #define	SMB_IPM_INFO_LSB(x)	(((x) & 0x10) >> 4)
587 #define	SMB_IPM_INFO_ISPEC(x)	(((x) & 0x08) >> 3)
588 #define	SMB_IPM_INFO_IPOL(x)	(((x) & 0x02) >> 1)
589 #define	SMB_IPM_INFO_IMODE(x)	(((x) & 0x01) >> 0)
590 
591 #define	SMB_IPM_REGS_1B		0
592 #define	SMB_IPM_REGS_4B		1
593 #define	SMB_IPM_REGS_16B	2
594 
595 #define	SMB_IPM_IPOL_LO		0
596 #define	SMB_IPM_IPOL_HI		1
597 
598 #define	SMB_IPM_IMODE_EDGE	0
599 #define	SMB_IPM_IMODE_LEVEL	1
600 
601 /*
602  * SMBIOS implementation structure for SMB_TYPE_POWERSUP.
603  */
604 typedef struct smb_powersup {
605 	smb_header_t smbpsup_hdr;	/* structure header */
606 	uint8_t smbpsup_group;		/* group id */
607 	uint8_t smbpsup_loc;		/* location tag */
608 	uint8_t smbpsup_devname;	/* device name */
609 	uint8_t smbpsup_manufacturer;	/* manufacturer */
610 	uint8_t smbpsup_serial;		/* serial number */
611 	uint8_t smbpsup_asset;		/* asset tag */
612 	uint8_t smbpsup_part;		/* part number */
613 	uint8_t smbpsup_rev;		/* revision string */
614 	uint16_t smbpsup_max;		/* max output in milliwatts */
615 	uint16_t smbpsup_char;		/* characteristics */
616 	uint16_t smbpsup_vprobe;	/* voltage probe handle */
617 	uint16_t smbpsup_cooldev;	/* cooling device handle */
618 	uint16_t smbpsup_iprobe;	/* current probe handle */
619 } smb_powersup_t;
620 
621 #define	SMB_PSU_CHARS_ISHOT(x)		((x) & 0x01)
622 #define	SMB_PSU_CHARS_ISPRES(x)		((x) & 0x02)
623 #define	SMB_PSU_CHARS_ISUNPLUG(x)	((x) & 0x04)
624 #define	SMB_PSU_CHARS_IVRS(x)		(((x) >> 3) & 0xf)
625 #define	SMB_PSU_CHARS_STATUS(x)		(((x) >> 7) & 0x7)
626 #define	SMB_PSU_CHARS_TYPE(x)		(((x) >> 10) & 0xf)
627 
628 /*
629  * SMBIOS implementation structure for SMB_TYPE_ADDINFO.
630  */
631 typedef struct smb_addinfo {
632 	smb_header_t smbai_hdr;
633 	uint8_t smbai_nents;
634 	uint8_t smbai_data[];
635 } smb_addinfo_t;
636 
637 /*
638  * This contains the additional information entry. There are in theory n of
639  * these in the smbai_data[] member of the additional information structure
640  * above. The offset here is to the referenced handle.
641  */
642 typedef struct smb_addinfo_ent {
643 	uint8_t smbaie_len;
644 	uint16_t smbaie_rhdl;
645 	uint8_t smbaie_off;
646 	uint8_t smbaie_str;
647 	uint8_t smbaie_val[];
648 } smb_addinfo_ent_t;
649 
650 /*
651  * SMBIOS implementation structure for SMB_TYPE_OBDEVEXT.
652  */
653 typedef struct smb_obdev_ext {
654 	smb_header_t smbobe_hdr;	/* structure header */
655 	uint8_t smbobe_name;		/* reference designation */
656 	uint8_t smbobe_dtype;		/* device type */
657 	uint8_t smbobe_dti;		/* device type instance */
658 	uint16_t smbobe_sg;		/* segment group number */
659 	uint8_t smbobe_bus;		/* bus number */
660 	uint8_t smbobe_df;		/* device/function number */
661 } smb_obdev_ext_t;
662 
663 /*
664  * SMBIOS implementation structure for SMB_TYPE_PROCESSOR_INFO
665  */
666 typedef struct smb_processor_info {
667 	smb_header_t smbpai_hdr;	/* structure handle */
668 	uint16_t smbpai_proc;		/* processor handle */
669 	uint8_t smbpai_len;		/* length of processor specific data */
670 	uint8_t smbpai_type;		/* processor type */
671 	uint8_t smbpai_data[];		/* processor-specific block */
672 } smb_processor_info_t;
673 
674 typedef struct smb_processor_info_riscv {
675 	uint16_t smbpairv_vers;		/* structure revision */
676 	uint8_t smbpairv_len;		/* length of structure */
677 	uint8_t smbpairv_hartid[16];	/* id of the hart */
678 	uint8_t smbpairv_boot;		/* boot hart */
679 	uint8_t smbpairv_vendid[16];	/* machine vendor id */
680 	uint8_t smbpairv_archid[16];	/* arch vendor id */
681 	uint8_t smbpairv_machid[16];	/* machine impl id */
682 	uint32_t smbpairv_isa;		/* supported ISA */
683 	uint8_t smbpairv_privlvl;		/* supported privilege levels */
684 	uint8_t smbpairv_metdi[16];	/* Machine exception trap delegation */
685 	uint8_t smbpairv_mitdi[16];	/* Machine interrupt trap delegation */
686 	uint8_t smbpairv_xlen;		/* Register width */
687 	uint8_t smbpairv_mxlen;		/* Machine register width */
688 	uint8_t smbpairv_rsvd;		/* Reserved */
689 	uint8_t smbpairv_sxlen;		/* Supervisor register width */
690 	uint8_t smbpairv_uxlen;		/* User register width */
691 } smb_processor_info_riscv_t;
692 
693 /*
694  * SMBIOS implementation structure for SMBIOS_TYPE_FWINFO.
695  */
696 typedef struct smb_fwinfo {
697 	smb_header_t smbfwii_hdr;	/* structure handle */
698 	uint8_t smbfwii_name;		/* Firmware component name */
699 	uint8_t smbfwii_vers;		/* Firmware version */
700 	uint8_t smbfwii_vers_fmt;	/* Version format */
701 	uint8_t smbfwii_id;		/* Firmware ID */
702 	uint8_t smbfwii_id_fmt;		/* Firmware ID format */
703 	uint8_t smbfwii_reldate;	/* Release Date */
704 	uint8_t smbfwii_mfg;		/* Manufacturer */
705 	uint8_t smbfwii_lsv;		/* Lowest supported version */
706 	uint64_t smbfwii_imgsz;		/* Image size */
707 	uint16_t smbfwii_chars;		/* Characteristics */
708 	uint8_t smbfwii_state;		/* State */
709 	uint8_t smbfwii_ncomps;		/* Number of associated components */
710 	uint16_t smbfwii_comps[];	/* Variable handles */
711 } smb_fwinfo_t;
712 
713 /*
714  * SMBIOS implementation structure for SMBIOS_TYPE_STRPROP.
715  */
716 typedef struct smb_strprop {
717 	smb_header_t smbstrp_hdr;	/* structure handle */
718 	uint16_t smbstrp_prop_id;	/* string property ID */
719 	uint8_t smbstrp_prop_val;	/* string property value */
720 	uint16_t smbstrp_phdl;		/* parent handle */
721 } smb_strprop_t;
722 
723 /*
724  * SMBIOS implementation structure for SUN_OEM_EXT_PROCESSOR.
725  */
726 typedef struct smb_processor_ext {
727 	smb_header_t smbpre_hdr;	/* structure header */
728 	uint16_t smbpre_processor;	/* processor handle */
729 	uint8_t smbpre_fru;		/* FRU indicator */
730 	uint8_t smbpre_n;		/* number of APIC IDs */
731 	uint16_t smbpre_apicid[1];	/* strand initial apic id */
732 } smb_processor_ext_t;
733 
734 /*
735  * SMBIOS implementation structure for SUN_OEM_EXT_PORT.
736  */
737 typedef struct smb_port_ext {
738 	smb_header_t smbpoe_hdr;	/* structure header */
739 	uint16_t smbpoe_chassis;	/* chassis handle */
740 	uint16_t smbpoe_port;		/* port connector handle */
741 	uint8_t smbpoe_dtype;		/* device type */
742 	uint16_t smbpoe_devhdl;		/* device handle */
743 	uint8_t smbpoe_phy;		/* PHY number */
744 } smb_port_ext_t;
745 
746 /*
747  * SMBIOS implementation structure for SUN_OEM_PCIEXRC.
748  */
749 typedef struct smb_pciexrc {
750 	smb_header_t smbpciexrc_hdr;	/* structure header */
751 	uint16_t smbpciexrc_bboard;	/* base board handle */
752 	uint16_t smbpciexrc_bdf;	/* PCI Bus/Dev/Func */
753 } smb_pciexrc_t;
754 
755 /*
756  * SMBIOS implementation structure for SUN_OEM_EXT_MEMARRAY.
757  */
758 typedef struct smb_memarray_ext {
759 	smb_header_t smbmarre_hdr;	/* structure header */
760 	uint16_t smbmarre_ma;		/* memory array handle */
761 	uint16_t smbmarre_component;	/* component parent handle */
762 	uint16_t smbmarre_bdf;		/* PCI bus/dev/funct */
763 } smb_memarray_ext_t;
764 
765 /*
766  * SMBIOS implementation structure for SUN_OEM_EXT_MEMDEVICE.
767  */
768 typedef struct smb_memdevice_ext {
769 	smb_header_t smbmdeve_hdr;	/* structure header */
770 	uint16_t smbmdeve_mdev;		/* memory device handle */
771 	uint8_t smbmdeve_dchan;		/* DRAM channel */
772 	uint8_t smbmdeve_ncs;		/* number of chip select */
773 	uint8_t smbmdeve_cs[];		/* chip selects */
774 } smb_memdevice_ext_t;
775 
776 #pragma pack()
777 
778 typedef struct smb_struct {
779 	const smb_header_t *smbst_hdr;	/* address of raw structure data */
780 	const uchar_t *smbst_str;	/* address of string data (if any) */
781 	const uchar_t *smbst_end;	/* address of 0x0000 ending tag */
782 	struct smb_struct *smbst_next;	/* next structure in hash chain */
783 	uint16_t *smbst_strtab;		/* string index -> offset table */
784 	uint_t smbst_strtablen;		/* length of smbst_strtab */
785 } smb_struct_t;
786 
787 struct smbios_hdl {
788 	smbios_entry_point_t sh_ent_type; /* structure table entry point type */
789 	smbios_entry_t sh_ent;		/* structure table entry point */
790 	uint_t sh_ent_stnum;		/* number of structure table entries */
791 	const void *sh_buf;		/* structure table buffer */
792 	size_t sh_buflen;		/* size of structure table buffer */
793 	smb_struct_t *sh_structs;	/* array of structure descriptors */
794 	uint_t sh_nstructs;		/* number of active structures */
795 	smb_struct_t **sh_hash;		/* hash bucket array for descriptors */
796 	uint_t sh_hashlen;		/* hash bucket array length */
797 	int sh_err;			/* error code for smbios_errno() */
798 	int sh_libvers;			/* library client abi version */
799 	int sh_smbvers;			/* derived underlying format version */
800 	uint_t sh_flags;		/* miscellaneous flags (see below) */
801 };
802 
803 #define	SMB_FL_DEBUG	0x1		/* print debug messages for this hdl */
804 #define	SMB_FL_BUFALLOC	0x2		/* sh_buf was allocated by library */
805 #define	SMB_FL_TRUNC	0x4		/* smbios table is truncated */
806 
807 #define	SMB_BIOS_DEVICE		"/dev/xsvc"	/* device w/ BIOS physmem */
808 #define	SMB_SMBIOS_DEVICE	"/dev/smbios"	/* device w/ SMBIOS image */
809 
810 #define	SMB_RANGE_START	0xF0000		/* start of physical address range */
811 #define	SMB_RANGE_LIMIT	0xFFFFF		/* limit of physical address range */
812 #define	SMB_SCAN_STEP	16		/* stepping by paragraph */
813 
814 #define	SMB_MAJMIN(M, m)	((((M) & 0xFF) << 8) | ((m) & 0xFF))
815 #define	SMB_MAJOR(v)		(((v) & 0xFF00) >> 8)
816 #define	SMB_MINOR(v)		(((v) & 0x00FF))
817 
818 #define	ESMB_BASE	1000		/* base value for libsmbios errnos */
819 
820 enum {
821 	ESMB_NOTFOUND = ESMB_BASE,	/* SMBIOS table not found on system */
822 	ESMB_MAPDEV,			/* failed to map SMBIOS table */
823 	ESMB_NOENT,			/* failed to locate structure */
824 	ESMB_NOMEM,			/* failed to allocate memory */
825 	ESMB_NOHDR,			/* failed to read SMBIOS header */
826 	ESMB_NOSTAB,			/* failed to read SMBIOS struct table */
827 	ESMB_NOINFO,			/* no common info for structure */
828 	ESMB_SHORT,			/* buffer length doesn't match header */
829 	ESMB_CORRUPT,			/* buffer struct or len is corrupt */
830 	ESMB_VERSION,			/* version not supported by library */
831 	ESMB_NOTSUP,			/* feature not supported by provider */
832 	ESMB_HEADER,			/* SMBIOS header corrupt or invalid */
833 	ESMB_OLD,			/* SMBIOS version is too old for us */
834 	ESMB_NEW,			/* SMBIOS version is too new for us */
835 	ESMB_CKSUM,			/* SMBIOS header checksum mismatch */
836 	ESMB_INVAL,			/* invalid function call argument */
837 	ESMB_TYPE,			/* structure type mismatch */
838 	ESMB_UNKNOWN,			/* unknown error */
839 	ESMB_REQVAL			/* invalid requested value */
840 };
841 
842 extern const smb_struct_t *smb_lookup_type(smbios_hdl_t *, uint_t);
843 extern const smb_struct_t *smb_lookup_id(smbios_hdl_t *, uint_t);
844 extern const char *smb_strptr(const smb_struct_t *, uint_t);
845 extern boolean_t smb_gteq(smbios_hdl_t *, int);
846 extern boolean_t smb_libgteq(smbios_hdl_t *, int);
847 
848 extern int smb_set_errno(smbios_hdl_t *, int);
849 extern smbios_hdl_t *smb_open_error(smbios_hdl_t *, int *, int);
850 extern const char *smb_strerror(int);
851 
852 extern void *smb_alloc(size_t);
853 extern void *smb_zalloc(size_t);
854 extern void smb_free(void *, size_t);
855 
856 extern void smb_dprintf(smbios_hdl_t *, const char *, ...);
857 
858 extern int _smb_debug;
859 
860 /*
861  * The following series of structures represent the base versions of public
862  * structures that are used inside by the smbios routines. This allows the
863  * common code to properly know how much it should or should not bzero and how
864  * to handle additions to the spec. Types should only be added here if we need
865  * to extend the public structures in sys/smbios.h due to a change in the spec.
866  *
867  * Types here have the name smb_base_%s which corresponds to smbios_%s.
868  */
869 typedef struct smb_base_chassis {
870 	uint32_t smbbc_oemdata;		/* OEM-specific data */
871 	uint8_t smbbc_lock;		/* lock present? */
872 	uint8_t smbbc_type;		/* type */
873 	uint8_t smbbc_bustate;		/* boot-up state */
874 	uint8_t smbbc_psstate;		/* power supply state */
875 	uint8_t smbbc_thstate;		/* thermal state */
876 	uint8_t smbbc_security;		/* security status */
877 	uint8_t smbbc_uheight;		/* enclosure height in U's */
878 	uint8_t smbbc_cords;		/* number of power cords */
879 	uint8_t smbbc_elems;		/* number of element records (n) */
880 	uint8_t smbbc_elemlen;		/* length of contained element (m) */
881 } smb_base_chassis_t;
882 
883 typedef struct smb_base_processor {
884 	uint64_t smbbp_cpuid;		/* processor cpuid information */
885 	uint32_t smbbp_family;		/* processor family */
886 	uint8_t smbbp_type;		/* processor type (SMB_PRT_*) */
887 	uint8_t smbbp_voltage;		/* voltage (SMB_PRV_*) */
888 	uint8_t smbbp_status;		/* status (SMB_PRS_*) */
889 	uint8_t smbbp_upgrade;		/* upgrade (SMB_PRU_*) */
890 	uint32_t smbbp_clkspeed;	/* external clock speed in MHz */
891 	uint32_t smbbp_maxspeed;	/* maximum speed in MHz */
892 	uint32_t smbbp_curspeed;	/* current speed in MHz */
893 	id_t smbbp_l1cache;		/* L1 cache handle */
894 	id_t smbbp_l2cache;		/* L2 cache handle */
895 	id_t smbbp_l3cache;		/* L3 cache handle */
896 } smb_base_processor_t;
897 
898 typedef struct smb_base_memdevice {
899 	id_t smbbmd_array;		/* handle of physical memory array */
900 	id_t smbbmd_error;		/* handle of memory error data */
901 	uint32_t smbbmd_twidth;		/* total width in bits including ecc */
902 	uint32_t smbbmd_dwidth;		/* data width in bits */
903 	uint64_t smbbmd_size;		/* size in bytes (see note above) */
904 	uint8_t smbbmd_form;		/* form factor */
905 	uint8_t smbbmd_set;		/* set (0x00=none, 0xFF=unknown) */
906 	uint8_t smbbmd_type;		/* memory type */
907 	uint8_t smbbmd_pad;		/* padding */
908 	uint32_t smbbmd_flags;		/* flags (see below) */
909 	uint32_t smbbmd_speed;		/* speed in MHz */
910 	const char *smbbmd_dloc;	/* physical device locator string */
911 	const char *smbbmd_bloc;	/* physical bank locator string */
912 	uint8_t smbbmd_rank;		/* rank */
913 } smb_base_memdevice_t;
914 
915 typedef struct smb_base_bios {
916 	const char *smbbb_vendor;	/* bios vendor string */
917 	const char *smbbb_version;	/* bios version string */
918 	const char *smbbb_reldate;	/* bios release date */
919 	uint32_t smbbb_segment;		/* bios address segment location */
920 	uint32_t smbbb_romsize;		/* bios rom size in bytes */
921 	uint32_t smbbb_runsize;		/* bios image size in bytes */
922 	uint64_t smbbb_cflags;		/* bios characteristics */
923 	const uint8_t *smbbb_xcflags;	/* bios characteristics extensions */
924 	size_t smbbb_nxcflags;		/* number of smbb_xcflags[] bytes */
925 	smbios_version_t smbbb_biosv;	/* bios version */
926 	smbios_version_t smbbb_ecfwv;	/* bios embedded ctrl f/w version */
927 } smb_base_bios_t;
928 
929 typedef struct smb_base_cache {
930 	uint32_t smbba_maxsize;		/* maximum installed size in bytes */
931 	uint32_t smbba_size;		/* installed size in bytes */
932 	uint16_t smbba_stype;		/* supported SRAM types (SMB_CAT_*) */
933 	uint16_t smbba_ctype;		/* current SRAM type (SMB_CAT_*) */
934 	uint8_t smbba_speed;		/* speed in nanoseconds */
935 	uint8_t smbba_etype;		/* error correction type (SMB_CAE_*) */
936 	uint8_t smbba_ltype;		/* logical cache type (SMB_CAG_*) */
937 	uint8_t smbba_assoc;		/* associativity (SMB_CAA_*) */
938 	uint8_t smbba_level;		/* cache level */
939 	uint8_t smbba_mode;		/* cache mode (SMB_CAM_*) */
940 	uint8_t smbba_location;		/* cache location (SMB_CAL_*) */
941 	uint8_t smbba_flags;		/* cache flags (SMB_CAF_*) */
942 } smb_base_cache_t;
943 
944 typedef struct smb_base_slot {
945 	const char *smbbl_name;		/* reference designation */
946 	uint8_t smbbl_type;		/* slot type */
947 	uint8_t smbbl_width;		/* slot data bus width */
948 	uint8_t smbbl_usage;		/* current usage */
949 	uint8_t smbbl_length;		/* slot length */
950 	uint16_t smbbl_id;		/* slot ID */
951 	uint8_t smbbl_ch1;		/* slot characteristics 1 */
952 	uint8_t smbbl_ch2;		/* slot characteristics 2 */
953 	uint16_t smbbl_sg;		/* segment group number */
954 	uint8_t smbbl_bus;		/* bus number */
955 	uint8_t smbbl_df;		/* device/function number */
956 } smb_base_slot_t;
957 
958 /*
959  * Prior to reivison 3.5 of the library and interface we had embedded a 256 byte
960  * string for the SKU into here rather than pointing to constant data. This,
961  * combined withe bugs in the implementation, generally led to strings with
962  * garbage. As part of fixing this with the 3.5 support, we moved the struct to
963  * ve more inline with everything else.
964  */
965 typedef struct smb_chassis_pre35 {
966 	uint32_t smbc_oemdata;		/* OEM-specific data */
967 	uint8_t smbc_lock;		/* lock present? */
968 	uint8_t smbc_type;		/* type */
969 	uint8_t smbc_bustate;		/* boot-up state */
970 	uint8_t smbc_psstate;		/* power supply state */
971 	uint8_t smbc_thstate;		/* thermal state */
972 	uint8_t smbc_security;		/* security status */
973 	uint8_t smbc_uheight;		/* enclosure height in U's */
974 	uint8_t smbc_cords;		/* number of power cords */
975 	uint8_t smbc_elems;		/* number of element records (n) */
976 	uint8_t smbc_elemlen;		/* length of contained element (m) */
977 	char smbc_sku[256];
978 } smb_chassis_pre35_t;
979 
980 #ifdef	__cplusplus
981 }
982 #endif
983 
984 #endif	/* _SYS_SMBIOS_IMPL_H */
985