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