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