184ab085aSmws /* 284ab085aSmws * CDDL HEADER START 384ab085aSmws * 484ab085aSmws * The contents of this file are subject to the terms of the 5074bb90dSTom Pothier * Common Development and Distribution License (the "License"). 6074bb90dSTom Pothier * You may not use this file except in compliance with the License. 784ab085aSmws * 884ab085aSmws * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 984ab085aSmws * or http://www.opensolaris.org/os/licensing. 1084ab085aSmws * See the License for the specific language governing permissions 1184ab085aSmws * and limitations under the License. 1284ab085aSmws * 1384ab085aSmws * When distributing Covered Code, include this CDDL HEADER in each 1484ab085aSmws * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1584ab085aSmws * If applicable, add the following below this CDDL HEADER, with the 1684ab085aSmws * fields enclosed by brackets "[]" replaced with your own identifying 1784ab085aSmws * information: Portions Copyright [yyyy] [name of copyright owner] 1884ab085aSmws * 1984ab085aSmws * CDDL HEADER END 2084ab085aSmws */ 2184ab085aSmws 2284ab085aSmws /* 234e901881SDale Ghent * Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved. 24*174bc649SRobert Mustacchi * Copyright (c) 2018, Joyent, Inc. 2503f9f63dSTom Pothier * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 2684ab085aSmws * Use is subject to license terms. 2784ab085aSmws */ 2884ab085aSmws 2984ab085aSmws /* 3084ab085aSmws * This header file defines the implementation structures for the SMBIOS access 3184ab085aSmws * library, libsmbios, and an equivalent kernel module. Clients should use 3284ab085aSmws * the <smbios.h> or <sys/smbios.h> header files to access DMTF SMBIOS 3384ab085aSmws * information, NOT these underlying implementation structures from the spec. 3484ab085aSmws * In short, do not user this header file or these routines for any purpose. 3584ab085aSmws */ 3684ab085aSmws 3784ab085aSmws #ifndef _SYS_SMBIOS_IMPL_H 3884ab085aSmws #define _SYS_SMBIOS_IMPL_H 3984ab085aSmws 4084ab085aSmws #include <sys/smbios.h> 4184ab085aSmws #include <sys/sysmacros.h> 4284ab085aSmws 4384ab085aSmws #ifdef _KERNEL 4484ab085aSmws #include <sys/systm.h> 4584ab085aSmws #else 4684ab085aSmws #include <strings.h> 4784ab085aSmws #include <stddef.h> 4884ab085aSmws #endif 4984ab085aSmws 5084ab085aSmws #ifdef __cplusplus 5184ab085aSmws extern "C" { 5284ab085aSmws #endif 5384ab085aSmws 5438d76b18SRobert Mustacchi /* 5538d76b18SRobert Mustacchi * Definitions required to interpret the BIOS type information. 5638d76b18SRobert Mustacchi */ 5738d76b18SRobert Mustacchi #define SMB_BIOSXB_EXTROM 6 5838d76b18SRobert Mustacchi 5938d76b18SRobert Mustacchi #define SMB_BIOS_EXTROM_VALUE_MASK(x) ((x) & 0x3fff) 6038d76b18SRobert Mustacchi #define SMB_BIOS_EXTROM_SHIFT_MASK(x) (((x) & 0xc000) >> 14) 6138d76b18SRobert Mustacchi 6284ab085aSmws #pragma pack(1) 6384ab085aSmws 6484ab085aSmws typedef struct smb_header { 6584ab085aSmws uint8_t smbh_type; /* structure type (SMB_TYPE_* value) */ 6684ab085aSmws uint8_t smbh_len; /* length in bytes of formatted area */ 6784ab085aSmws uint16_t smbh_hdl; /* structure handle */ 6884ab085aSmws } smb_header_t; 6984ab085aSmws 7045807aa8SRobert Mustacchi /* 7145807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_BIOS. 7245807aa8SRobert Mustacchi */ 7384ab085aSmws typedef struct smb_bios { 7484ab085aSmws smb_header_t smbbi_hdr; /* structure header */ 7584ab085aSmws uint8_t smbbi_vendor; /* bios vendor string */ 7684ab085aSmws uint8_t smbbi_version; /* bios version string */ 7784ab085aSmws uint16_t smbbi_segment; /* segment location of bios address */ 7884ab085aSmws uint8_t smbbi_reldate; /* bios release date */ 7984ab085aSmws uint8_t smbbi_romsize; /* bios rom size (64k * (n + 1)) */ 8084ab085aSmws uint64_t smbbi_cflags; /* bios characteristics */ 8184ab085aSmws uint8_t smbbi_xcflags[1]; /* bios characteristics extensions */ 8284ab085aSmws } smb_bios_t; 8384ab085aSmws 8445807aa8SRobert Mustacchi /* 8545807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_SYSTEM. 8645807aa8SRobert Mustacchi */ 8784ab085aSmws typedef struct smb_system { 8884ab085aSmws smb_header_t smbsi_hdr; /* structure header */ 8984ab085aSmws uint8_t smbsi_manufacturer; /* manufacturer */ 9084ab085aSmws uint8_t smbsi_product; /* product name */ 9184ab085aSmws uint8_t smbsi_version; /* version */ 9284ab085aSmws uint8_t smbsi_serial; /* serial number */ 9384ab085aSmws uint8_t smbsi_uuid[16]; /* UUID */ 9484ab085aSmws uint8_t smbsi_wakeup; /* wake-up type */ 9584ab085aSmws uint8_t smbsi_sku; /* SKU number */ 9684ab085aSmws uint8_t smbsi_family; /* family */ 9784ab085aSmws } smb_system_t; 9884ab085aSmws 9945807aa8SRobert Mustacchi /* 10045807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_BASEBOARD. 10145807aa8SRobert Mustacchi */ 10284ab085aSmws typedef struct smb_bboard { 10384ab085aSmws smb_header_t smbbb_hdr; /* structure header */ 10484ab085aSmws uint8_t smbbb_manufacturer; /* manufacturer */ 10584ab085aSmws uint8_t smbbb_product; /* product name */ 10684ab085aSmws uint8_t smbbb_version; /* version */ 10784ab085aSmws uint8_t smbbb_serial; /* serial number */ 10884ab085aSmws uint8_t smbbb_asset; /* asset tag */ 10984ab085aSmws uint8_t smbbb_flags; /* feature flags */ 11084ab085aSmws uint8_t smbbb_location; /* location in chassis */ 11184ab085aSmws uint16_t smbbb_chassis; /* chassis handle */ 11284ab085aSmws uint8_t smbbb_type; /* board type */ 11384ab085aSmws uint8_t smbbb_cn; /* number of contained handles */ 11484ab085aSmws uint16_t smbbb_cv[1]; /* array of contained handles */ 11584ab085aSmws } smb_bboard_t; 11684ab085aSmws 11745807aa8SRobert Mustacchi /* 11845807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_CHASSIS. 11945807aa8SRobert Mustacchi */ 12084ab085aSmws typedef struct smb_chassis { 12184ab085aSmws smb_header_t smbch_hdr; /* structure header */ 12284ab085aSmws uint8_t smbch_manufacturer; /* manufacturer */ 12384ab085aSmws uint8_t smbch_type; /* type */ 12484ab085aSmws uint8_t smbch_version; /* version */ 12584ab085aSmws uint8_t smbch_serial; /* serial number */ 12684ab085aSmws uint8_t smbch_asset; /* asset tag */ 12784ab085aSmws uint8_t smbch_bustate; /* boot-up state */ 12884ab085aSmws uint8_t smbch_psstate; /* power supply state */ 12984ab085aSmws uint8_t smbch_thstate; /* thermal state */ 13084ab085aSmws uint8_t smbch_security; /* security state */ 13184ab085aSmws uint32_t smbch_oemdata; /* OEM-specific data */ 13284ab085aSmws uint8_t smbch_uheight; /* enclosure height */ 13384ab085aSmws uint8_t smbch_cords; /* number of power cords */ 13484ab085aSmws uint8_t smbch_cn; /* number of contained records */ 13584ab085aSmws uint8_t smbch_cm; /* size of contained records */ 13684ab085aSmws uint8_t smbch_cv[1]; /* array of contained records */ 13784ab085aSmws } smb_chassis_t; 13884ab085aSmws 1394e901881SDale Ghent /* WARNING: the argument is evaluated three times! */ 1404e901881SDale Ghent #define SMB_CH_SKU(smbcp) ((char *) \ 1414e901881SDale Ghent (smbcp)->smbch_cv + ((smbcp)->smbch_cn * (smbcp)->smbch_cm)) 14284ab085aSmws #define SMB_CHT_LOCK 0x80 /* lock bit within smbch_type */ 14384ab085aSmws 14445807aa8SRobert Mustacchi /* 14545807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_PROCESSOR. 14645807aa8SRobert Mustacchi */ 14784ab085aSmws typedef struct smb_processor { 14884ab085aSmws smb_header_t smbpr_hdr; /* structure header */ 14984ab085aSmws uint8_t smbpr_socket; /* socket designation */ 15084ab085aSmws uint8_t smbpr_type; /* processor type (see <smbios.h>) */ 15184ab085aSmws uint8_t smbpr_family; /* processor family (see <smbios.h>) */ 15284ab085aSmws uint8_t smbpr_manufacturer; /* manufacturer */ 15384ab085aSmws uint64_t smbpr_cpuid; /* processor cpuid information */ 15484ab085aSmws uint8_t smbpr_version; /* version */ 15584ab085aSmws uint8_t smbpr_voltage; /* voltage */ 15684ab085aSmws uint16_t smbpr_clkspeed; /* external clock speed in MHz */ 15784ab085aSmws uint16_t smbpr_maxspeed; /* maximum speed in MHz */ 15884ab085aSmws uint16_t smbpr_curspeed; /* current speed in MHz */ 15984ab085aSmws uint8_t smbpr_status; /* status (see <smbios.h>) */ 16084ab085aSmws uint8_t smbpr_upgrade; /* upgrade */ 16184ab085aSmws uint16_t smbpr_l1cache; /* L1 cache handle (if any) */ 16284ab085aSmws uint16_t smbpr_l2cache; /* L2 cache handle (if any) */ 16384ab085aSmws uint16_t smbpr_l3cache; /* L3 cache handle (if any) */ 16484ab085aSmws uint8_t smbpr_serial; /* serial number */ 16584ab085aSmws uint8_t smbpr_asset; /* asset tag */ 16684ab085aSmws uint8_t smbpr_part; /* part number */ 1674e901881SDale Ghent uint8_t smbpr_corecount; /* number of cores per socket */ 1684e901881SDale Ghent uint8_t smbpr_coresenabled; /* number of enabled cores per socket */ 1694e901881SDale Ghent uint8_t smbpr_threadcount; /* number of threads per socket */ 1704e901881SDale Ghent uint16_t smbpr_cflags; /* cpu characteristics (see <smbios.h>) */ 1714e901881SDale Ghent uint16_t smbpr_family2; /* processor family2 (see <smbios.h>) */ 1726734c4b0SRobert Mustacchi uint16_t smbpr_corecount2; /* second number of cores per socket */ 1736734c4b0SRobert Mustacchi uint16_t smbpr_coresenabled2; /* second number of enabled cores */ 1746734c4b0SRobert Mustacchi uint16_t smbpr_threadcount2; /* second number of enabled threads */ 17584ab085aSmws } smb_processor_t; 17684ab085aSmws 17745807aa8SRobert Mustacchi /* 17845807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_CACHE. 17945807aa8SRobert Mustacchi */ 18084ab085aSmws typedef struct smb_cache { 18184ab085aSmws smb_header_t smbca_hdr; /* structure header */ 18284ab085aSmws uint8_t smbca_socket; /* socket designation */ 18384ab085aSmws uint16_t smbca_config; /* cache configuration */ 18484ab085aSmws uint16_t smbca_maxsize; /* maximum installed size */ 18584ab085aSmws uint16_t smbca_size; /* installed size */ 18684ab085aSmws uint16_t smbca_stype; /* supported SRAM type */ 18784ab085aSmws uint16_t smbca_ctype; /* current SRAM type */ 18884ab085aSmws uint8_t smbca_speed; /* speed in nanoseconds */ 18984ab085aSmws uint8_t smbca_etype; /* error correction type */ 19084ab085aSmws uint8_t smbca_ltype; /* logical cache type */ 19184ab085aSmws uint8_t smbca_assoc; /* associativity */ 19238d76b18SRobert Mustacchi uint32_t smbca_maxsize2; /* maximum installed size 2 */ 19338d76b18SRobert Mustacchi uint32_t smbca_size2; /* installed size 2 */ 19484ab085aSmws } smb_cache_t; 19584ab085aSmws 196e4586ebfSmws /* 1974e901881SDale Ghent * Convert encoded cache size to bytes: DSP0134 Section 7.8 explains the 198e4586ebfSmws * encoding. The highest bit is 0 for 1k units, 1 for 64k units, and this 199e4586ebfSmws * macro decodes the value into bytes for exporting to our clients. 200e4586ebfSmws */ 201e4586ebfSmws #define SMB_CACHE_SIZE(s) (((s) & 0x8000) ? \ 202e4586ebfSmws ((uint32_t)((s) & 0x7FFF) * 64 * 1024) : ((uint32_t)(s) * 1024)) 20384ab085aSmws 20438d76b18SRobert Mustacchi #define SMB_CACHE_EXT_SIZE(s) (((s) & 0x80000000U) ? \ 20538d76b18SRobert Mustacchi ((uint64_t)((s) & 0x7FFFFFFFULL) * 64ULL * 1024ULL) : \ 20638d76b18SRobert Mustacchi ((uint64_t)(s) * 1024ULL)) 20738d76b18SRobert Mustacchi 20884ab085aSmws #define SMB_CACHE_CFG_MODE(c) (((c) >> 8) & 3) 20984ab085aSmws #define SMB_CACHE_CFG_ENABLED(c) (((c) >> 7) & 1) 21084ab085aSmws #define SMB_CACHE_CFG_LOCATION(c) (((c) >> 5) & 3) 21184ab085aSmws #define SMB_CACHE_CFG_SOCKETED(c) (((c) >> 3) & 1) 21284ab085aSmws #define SMB_CACHE_CFG_LEVEL(c) (((c) & 7) + 1) 21384ab085aSmws 21445807aa8SRobert Mustacchi /* 21545807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_PORT. 21645807aa8SRobert Mustacchi */ 21784ab085aSmws typedef struct smb_port { 21884ab085aSmws smb_header_t smbpo_hdr; /* structure header */ 21984ab085aSmws uint8_t smbpo_iref; /* internal reference designator */ 22084ab085aSmws uint8_t smbpo_itype; /* internal connector type */ 22184ab085aSmws uint8_t smbpo_eref; /* external reference designator */ 22284ab085aSmws uint8_t smbpo_etype; /* external connector type */ 22384ab085aSmws uint8_t smbpo_ptype; /* port type */ 22484ab085aSmws } smb_port_t; 22584ab085aSmws 22645807aa8SRobert Mustacchi /* 22745807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_SLOT. 22845807aa8SRobert Mustacchi */ 229*174bc649SRobert Mustacchi typedef struct smb_slot_peer { 230*174bc649SRobert Mustacchi uint16_t smbspb_group_no; /* segment group number */ 231*174bc649SRobert Mustacchi uint8_t smbspb_bus; /* bus number */ 232*174bc649SRobert Mustacchi uint8_t smbspb_df; /* device/function number */ 233*174bc649SRobert Mustacchi uint8_t smbspb_width; /* electrical width */ 234*174bc649SRobert Mustacchi } smb_slot_peer_t; 235*174bc649SRobert Mustacchi 23684ab085aSmws typedef struct smb_slot { 23784ab085aSmws smb_header_t smbsl_hdr; /* structure header */ 23884ab085aSmws uint8_t smbsl_name; /* reference designation */ 23984ab085aSmws uint8_t smbsl_type; /* slot type */ 24084ab085aSmws uint8_t smbsl_width; /* slot data bus width */ 24184ab085aSmws uint8_t smbsl_usage; /* current usage */ 24284ab085aSmws uint8_t smbsl_length; /* slot length */ 24384ab085aSmws uint16_t smbsl_id; /* slot ID */ 24484ab085aSmws uint8_t smbsl_ch1; /* slot characteristics 1 */ 24584ab085aSmws uint8_t smbsl_ch2; /* slot characteristics 2 */ 24603f9f63dSTom Pothier uint16_t smbsl_sg; /* segment group number */ 24703f9f63dSTom Pothier uint8_t smbsl_bus; /* bus number */ 24803f9f63dSTom Pothier uint8_t smbsl_df; /* device/function number */ 249*174bc649SRobert Mustacchi /* Added in SMBIOS 3.2+ */ 250*174bc649SRobert Mustacchi uint8_t smbsl_dbw; /* Data bus width */ 251*174bc649SRobert Mustacchi uint8_t smbsl_npeers; /* Peer bdf groups */ 252*174bc649SRobert Mustacchi smb_slot_peer_t smbsl_peers[]; /* bifurcation peers */ 25384ab085aSmws } smb_slot_t; 25484ab085aSmws 25545807aa8SRobert Mustacchi /* 25645807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_OBDEVS. 25745807aa8SRobert Mustacchi */ 25884ab085aSmws typedef struct smb_obdev { 25984ab085aSmws uint8_t smbob_type; /* encoded type and enable bit */ 2604e901881SDale Ghent uint8_t smbob_name; /* description string */ 26184ab085aSmws } smb_obdev_t; 26284ab085aSmws 26384ab085aSmws #define SMB_OBT_ENABLED 0x80 /* enable bit within smbob_type */ 26484ab085aSmws 26545807aa8SRobert Mustacchi /* 26645807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_OEMSTR, SMB_TYPE_SYSCONFSTR, 26745807aa8SRobert Mustacchi * and SMB_TYPE_LANG. 26845807aa8SRobert Mustacchi */ 26984ab085aSmws typedef struct smb_strtab { 27084ab085aSmws smb_header_t smbtb_hdr; /* structure header */ 27184ab085aSmws uint8_t smbtb_count; /* number of strings */ 27284ab085aSmws } smb_strtab_t; 27384ab085aSmws 27445807aa8SRobert Mustacchi /* 27545807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_LANG. 27645807aa8SRobert Mustacchi */ 27784ab085aSmws typedef struct smb_lang { 27884ab085aSmws smb_header_t smblang_hdr; /* structure header */ 27984ab085aSmws uint8_t smblang_num; /* number of installed languages */ 28084ab085aSmws uint8_t smblang_flags; /* flags */ 28184ab085aSmws uint8_t smblang_resv[15]; /* reserved for future use */ 28284ab085aSmws uint8_t smblang_cur; /* current language string */ 28384ab085aSmws } smb_lang_t; 28484ab085aSmws 28545807aa8SRobert Mustacchi /* 28645807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_EVENTLOG. 28745807aa8SRobert Mustacchi */ 28884ab085aSmws typedef struct smb_sel { 28984ab085aSmws smb_header_t smbsel_hdr; /* structure header */ 29084ab085aSmws uint16_t smbsel_len; /* log area length */ 29184ab085aSmws uint16_t smbsel_hdroff; /* header offset */ 29284ab085aSmws uint16_t smbsel_dataoff; /* data offset */ 29384ab085aSmws uint8_t smbsel_method; /* access method */ 29484ab085aSmws uint8_t smbsel_status; /* status flags */ 29584ab085aSmws uint32_t smbsel_token; /* change token */ 29684ab085aSmws uint32_t smbsel_addr; /* access method address */ 29784ab085aSmws uint8_t smbsel_format; /* header format */ 29884ab085aSmws uint8_t smbsel_typec; /* number of type descriptors */ 29984ab085aSmws uint8_t smbsel_typesz; /* size of each type descriptor */ 30084ab085aSmws uint8_t smbsel_typev[1]; /* array of type descriptors */ 30184ab085aSmws } smb_sel_t; 30284ab085aSmws 30345807aa8SRobert Mustacchi /* 30445807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_MEMARRAY. 30545807aa8SRobert Mustacchi */ 30684ab085aSmws typedef struct smb_memarray { 30784ab085aSmws smb_header_t smbmarr_hdr; /* structure header */ 30884ab085aSmws uint8_t smbmarr_loc; /* location */ 30984ab085aSmws uint8_t smbmarr_use; /* use */ 31084ab085aSmws uint8_t smbmarr_ecc; /* error detect/correct mechanism */ 31184ab085aSmws uint32_t smbmarr_cap; /* maximum capacity */ 31284ab085aSmws uint16_t smbmarr_err; /* error handle */ 31384ab085aSmws uint16_t smbmarr_ndevs; /* number of slots or sockets */ 3144e901881SDale Ghent uint64_t smbmarr_extcap; /* extended maximum capacity */ 31584ab085aSmws } smb_memarray_t; 31684ab085aSmws 31745807aa8SRobert Mustacchi /* 31845807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_MEMARRAYMAP. 31945807aa8SRobert Mustacchi */ 32084ab085aSmws typedef struct smb_memarrmap { 32184ab085aSmws smb_header_t smbamap_hdr; /* structure header */ 32284ab085aSmws uint32_t smbamap_start; /* starting address in kilobytes */ 32384ab085aSmws uint32_t smbamap_end; /* ending address in kilobytes */ 32484ab085aSmws uint16_t smbamap_array; /* physical memory array handle */ 32584ab085aSmws uint8_t smbamap_width; /* partition width */ 3264e901881SDale Ghent uint64_t smbamap_extstart; /* extended starting address in bytes */ 3274e901881SDale Ghent uint64_t smbamap_extend; /* extended ending address in bytes */ 32884ab085aSmws } smb_memarrmap_t; 32984ab085aSmws 33045807aa8SRobert Mustacchi /* 33145807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_MEMDEVICE. 33245807aa8SRobert Mustacchi */ 33384ab085aSmws typedef struct smb_memdevice { 33484ab085aSmws smb_header_t smbmdev_hdr; /* structure header */ 33584ab085aSmws uint16_t smbmdev_array; /* array handle */ 33684ab085aSmws uint16_t smbmdev_error; /* error handle */ 33784ab085aSmws uint16_t smbmdev_twidth; /* total width */ 33884ab085aSmws uint16_t smbmdev_dwidth; /* data width */ 33984ab085aSmws uint16_t smbmdev_size; /* size in either K or MB */ 34084ab085aSmws uint8_t smbmdev_form; /* form factor */ 34184ab085aSmws uint8_t smbmdev_set; /* device set */ 34284ab085aSmws uint8_t smbmdev_dloc; /* device locator */ 34384ab085aSmws uint8_t smbmdev_bloc; /* bank locator */ 34484ab085aSmws uint8_t smbmdev_type; /* memory type */ 34584ab085aSmws uint16_t smbmdev_flags; /* detail flags */ 34638d76b18SRobert Mustacchi uint16_t smbmdev_speed; /* speed in MT/s */ 34784ab085aSmws uint8_t smbmdev_manufacturer; /* manufacturer */ 34884ab085aSmws uint8_t smbmdev_serial; /* serial number */ 34984ab085aSmws uint8_t smbmdev_asset; /* asset tag */ 35084ab085aSmws uint8_t smbmdev_part; /* part number */ 3514e901881SDale Ghent uint8_t smbmdev_attrs; /* attributes */ 3524e901881SDale Ghent uint32_t smbmdev_extsize; /* extended size */ 3534e901881SDale Ghent uint16_t smbmdev_clkspeed; /* configured clock speed */ 3544e901881SDale Ghent uint16_t smbmdev_minvolt; /* minimum voltage */ 3554e901881SDale Ghent uint16_t smbmdev_maxvolt; /* maximum voltage */ 3564e901881SDale Ghent uint16_t smbmdev_confvolt; /* configured voltage */ 357*174bc649SRobert Mustacchi /* Added in SMBIOS 3.2 */ 358*174bc649SRobert Mustacchi uint8_t smbmdev_memtech; /* memory technology */ 359*174bc649SRobert Mustacchi uint16_t smbmdev_opmode; /* memory operating mode capability */ 360*174bc649SRobert Mustacchi uint8_t smbmdev_fwver; /* firmware version */ 361*174bc649SRobert Mustacchi uint16_t smbmdev_modulemfgid; /* module manufacturer ID */ 362*174bc649SRobert Mustacchi uint16_t smbmdev_moduleprodid; /* module product ID */ 363*174bc649SRobert Mustacchi uint16_t smbmdev_memsysmfgid; /* memory controller manufacturer id */ 364*174bc649SRobert Mustacchi uint16_t smbmdev_memsysprodid; /* memory controller product id */ 365*174bc649SRobert Mustacchi uint64_t smbmdev_nvsize; /* non-volatile memory size */ 366*174bc649SRobert Mustacchi uint64_t smbmdev_volsize; /* volatile memory size */ 367*174bc649SRobert Mustacchi uint64_t smbmdev_cachesize; /* cache size */ 368*174bc649SRobert Mustacchi uint64_t smbmdev_logicalsize; /* logical size */ 36984ab085aSmws } smb_memdevice_t; 37084ab085aSmws 37184ab085aSmws #define SMB_MDS_KBYTES 0x8000 /* size in specified in kilobytes */ 37284ab085aSmws 37345807aa8SRobert Mustacchi /* 37445807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_MEMDEVICEMAP. 37545807aa8SRobert Mustacchi */ 37684ab085aSmws typedef struct smb_memdevmap { 37784ab085aSmws smb_header_t smbdmap_hdr; /* structure header */ 37884ab085aSmws uint32_t smbdmap_start; /* starting address in kilobytes */ 37984ab085aSmws uint32_t smbdmap_end; /* ending address in kilobytes */ 38084ab085aSmws uint16_t smbdmap_device; /* memory device handle */ 38184ab085aSmws uint16_t smbdmap_array; /* memory array mapped address handle */ 38284ab085aSmws uint8_t smbdmap_rpos; /* row position */ 38384ab085aSmws uint8_t smbdmap_ipos; /* interleave position */ 38484ab085aSmws uint8_t smbdmap_idepth; /* interleave depth */ 3854e901881SDale Ghent uint64_t smbdmap_extstart; /* extended starting address */ 3864e901881SDale Ghent uint64_t smbdmap_extend; /* extended ending address */ 38784ab085aSmws } smb_memdevmap_t; 38884ab085aSmws 38945807aa8SRobert Mustacchi /* 39045807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_BATTERY. 39145807aa8SRobert Mustacchi */ 39284ab085aSmws typedef struct smb_battery { 39384ab085aSmws smb_header_t smbbat_hdr; /* structure header */ 39484ab085aSmws uint8_t smbbat_loc; /* location */ 39584ab085aSmws uint8_t smbbat_manufacturer; /* manufacturer */ 39684ab085aSmws uint8_t smbbat_date; /* manufacture date */ 39784ab085aSmws uint8_t smbbat_serial; /* serial number */ 39884ab085aSmws uint8_t smbbat_devname; /* device name */ 39984ab085aSmws uint8_t smbbat_chem; /* device chemistry */ 40084ab085aSmws uint16_t smbbat_cap; /* design capacity in mW hours */ 40184ab085aSmws uint16_t smbbat_volt; /* design voltage in mV */ 40284ab085aSmws uint8_t smbbat_version; /* SBDS version string */ 40384ab085aSmws uint8_t smbbat_err; /* error percentage */ 40484ab085aSmws uint16_t smbbat_ssn; /* SBDS serial number */ 40584ab085aSmws uint16_t smbbat_sdate; /* SBDS manufacture date */ 40684ab085aSmws uint8_t smbbat_schem; /* SBDS chemistry string */ 40784ab085aSmws uint8_t smbbat_mult; /* design capacity multiplier */ 40884ab085aSmws uint32_t smbbat_oemdata; /* OEM-specific data */ 40984ab085aSmws } smb_battery_t; 41084ab085aSmws 41145807aa8SRobert Mustacchi /* 41245807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_SECURITY. 41345807aa8SRobert Mustacchi */ 41484ab085aSmws typedef struct smb_hwsec { 41584ab085aSmws smb_header_t smbhs_hdr; /* structure header */ 41684ab085aSmws uint8_t smbhs_settings; /* settings byte */ 41784ab085aSmws } smb_hwsec_t; 41884ab085aSmws 41984ab085aSmws #define SMB_HWS_PWR_PS(x) (((x) & 0xC0) >> 6) 42084ab085aSmws #define SMB_HWS_KBD_PS(x) (((x) & 0x30) >> 4) 42184ab085aSmws #define SMB_HWS_ADM_PS(x) (((x) & 0x0C) >> 2) 42284ab085aSmws #define SMB_HWS_PAN_PS(x) (((x) & 0x03) >> 0) 42384ab085aSmws 42445807aa8SRobert Mustacchi /* 42545807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_VPROBE. 42645807aa8SRobert Mustacchi */ 42745807aa8SRobert Mustacchi typedef struct smb_vprobe { 42845807aa8SRobert Mustacchi smb_header_t smbvpr_hdr; /* structure header */ 42945807aa8SRobert Mustacchi uint8_t smbvpr_descr; /* description string */ 43045807aa8SRobert Mustacchi uint8_t smbvpr_locstat; /* location and status */ 43145807aa8SRobert Mustacchi uint16_t smbvpr_maxval; /* maximum voltage */ 43245807aa8SRobert Mustacchi uint16_t smbvpr_minval; /* minimum voltage */ 43345807aa8SRobert Mustacchi uint16_t smbvpr_resolution; /* probe resolution */ 43445807aa8SRobert Mustacchi uint16_t smbvpr_tolerance; /* probe tolerance */ 43545807aa8SRobert Mustacchi uint16_t smbvpr_accuracy; /* probe accuracy */ 43645807aa8SRobert Mustacchi uint32_t smbvpr_oem; /* vendor-specific data */ 43745807aa8SRobert Mustacchi uint16_t smbvpr_nominal; /* nominal value */ 43845807aa8SRobert Mustacchi } smb_vprobe_t; 43945807aa8SRobert Mustacchi 44045807aa8SRobert Mustacchi #define SMB_VPROBE_MINLEN 0x14 44145807aa8SRobert Mustacchi #define SMB_VPROBE_NOMINAL_MINLEN 0x16 44245807aa8SRobert Mustacchi 44345807aa8SRobert Mustacchi #define SMB_VPROBE_LOCATION(x) ((x) & 0x1f) 44445807aa8SRobert Mustacchi #define SMB_VPROBE_STATUS(x) (((x) >> 5) & 0x7) 44545807aa8SRobert Mustacchi 44645807aa8SRobert Mustacchi /* 44745807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_COOLDEV. 44845807aa8SRobert Mustacchi */ 44945807aa8SRobert Mustacchi typedef struct smb_cooldev { 45045807aa8SRobert Mustacchi smb_header_t smbcdev_hdr; /* structure header */ 45145807aa8SRobert Mustacchi uint16_t smbcdev_tprobe; /* temperature probe */ 45245807aa8SRobert Mustacchi uint8_t smbcdev_typstat; /* type and status */ 45345807aa8SRobert Mustacchi uint8_t smbcdev_group; /* group identifier */ 45445807aa8SRobert Mustacchi uint32_t smbcdev_oem; /* vendor-specific data */ 45545807aa8SRobert Mustacchi uint16_t smbcdev_nominal; /* nominal value */ 45645807aa8SRobert Mustacchi uint8_t smbcdev_descr; /* description string */ 45745807aa8SRobert Mustacchi } smb_cooldev_t; 45845807aa8SRobert Mustacchi 45945807aa8SRobert Mustacchi #define SMB_COOLDEV_MINLEN 0x0c 46045807aa8SRobert Mustacchi #define SMB_COOLDEV_NOMINAL_MINLEN 0x0e 46145807aa8SRobert Mustacchi #define SMB_COOLDEV_DESCR_MINLEN 0x0f 46245807aa8SRobert Mustacchi 46345807aa8SRobert Mustacchi #define SMB_COOLDEV_TYPE(x) ((x) & 0x1f) 46445807aa8SRobert Mustacchi #define SMB_COOLDEV_STATUS(x) (((x) >> 5) & 0x7) 46545807aa8SRobert Mustacchi 46645807aa8SRobert Mustacchi /* 46745807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_TPROBE. 46845807aa8SRobert Mustacchi */ 46945807aa8SRobert Mustacchi typedef struct smb_tprobe { 47045807aa8SRobert Mustacchi smb_header_t smbtpr_hdr; /* structure header */ 47145807aa8SRobert Mustacchi uint8_t smbtpr_descr; /* description string */ 47245807aa8SRobert Mustacchi uint8_t smbtpr_locstat; /* location and status */ 47345807aa8SRobert Mustacchi uint16_t smbtpr_maxval; /* maximum temperature */ 47445807aa8SRobert Mustacchi uint16_t smbtpr_minval; /* minimum temperature */ 47545807aa8SRobert Mustacchi uint16_t smbtpr_resolution; /* probe resolution */ 47645807aa8SRobert Mustacchi uint16_t smbtpr_tolerance; /* probe tolerance */ 47745807aa8SRobert Mustacchi uint16_t smbtpr_accuracy; /* probe accuracy */ 47845807aa8SRobert Mustacchi uint32_t smbtpr_oem; /* vendor-specific data */ 47945807aa8SRobert Mustacchi uint16_t smbtpr_nominal; /* nominal value */ 48045807aa8SRobert Mustacchi } smb_tprobe_t; 48145807aa8SRobert Mustacchi 48245807aa8SRobert Mustacchi #define SMB_TPROBE_MINLEN 0x14 48345807aa8SRobert Mustacchi #define SMB_TPROBE_NOMINAL_MINLEN 0x16 48445807aa8SRobert Mustacchi 48545807aa8SRobert Mustacchi #define SMB_TPROBE_LOCATION(x) ((x) & 0x1f) 48645807aa8SRobert Mustacchi #define SMB_TPROBE_STATUS(x) (((x) >> 5) & 0x7) 48745807aa8SRobert Mustacchi 48845807aa8SRobert Mustacchi /* 48945807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_IPROBE. 49045807aa8SRobert Mustacchi */ 49145807aa8SRobert Mustacchi typedef struct smb_iprobe { 49245807aa8SRobert Mustacchi smb_header_t smbipr_hdr; /* structure header */ 49345807aa8SRobert Mustacchi uint8_t smbipr_descr; /* description string */ 49445807aa8SRobert Mustacchi uint8_t smbipr_locstat; /* location and status */ 49545807aa8SRobert Mustacchi uint16_t smbipr_maxval; /* maximum current */ 49645807aa8SRobert Mustacchi uint16_t smbipr_minval; /* minimum current */ 49745807aa8SRobert Mustacchi uint16_t smbipr_resolution; /* probe resolution */ 49845807aa8SRobert Mustacchi uint16_t smbipr_tolerance; /* probe tolerance */ 49945807aa8SRobert Mustacchi uint16_t smbipr_accuracy; /* probe accuracy */ 50045807aa8SRobert Mustacchi uint32_t smbipr_oem; /* vendor-specific data */ 50145807aa8SRobert Mustacchi uint16_t smbipr_nominal; /* nominal value */ 50245807aa8SRobert Mustacchi } smb_iprobe_t; 50345807aa8SRobert Mustacchi 50445807aa8SRobert Mustacchi #define SMB_IPROBE_MINLEN 0x14 50545807aa8SRobert Mustacchi #define SMB_IPROBE_NOMINAL_MINLEN 0x16 50645807aa8SRobert Mustacchi 50745807aa8SRobert Mustacchi #define SMB_IPROBE_LOCATION(x) ((x) & 0x1f) 50845807aa8SRobert Mustacchi #define SMB_IPROBE_STATUS(x) (((x) >> 5) & 0x7) 50945807aa8SRobert Mustacchi 51045807aa8SRobert Mustacchi /* 51145807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_BOOT. 51245807aa8SRobert Mustacchi */ 51384ab085aSmws typedef struct smb_boot { 51484ab085aSmws smb_header_t smbbo_hdr; /* structure header */ 51584ab085aSmws uint8_t smbbo_pad[6]; /* reserved for future use */ 51684ab085aSmws uint8_t smbbo_status[1]; /* variable-length status buffer */ 51784ab085aSmws } smb_boot_t; 51884ab085aSmws 51945807aa8SRobert Mustacchi /* 52045807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_IPMIDEV. 52145807aa8SRobert Mustacchi */ 52284ab085aSmws typedef struct smb_ipmi { 52384ab085aSmws smb_header_t smbipm_hdr; /* structure header */ 52484ab085aSmws uint8_t smbipm_type; /* interface type */ 52584ab085aSmws uint8_t smbipm_spec; /* specification revision */ 52684ab085aSmws uint8_t smbipm_i2c; /* i2C slave address */ 52784ab085aSmws uint8_t smbipm_bus; /* NV storage device bus ID */ 52884ab085aSmws uint64_t smbipm_addr; /* base address */ 52984ab085aSmws uint8_t smbipm_info; /* base address modifier/intr info */ 53084ab085aSmws uint8_t smbipm_intr; /* interrupt number */ 53184ab085aSmws } smb_ipmi_t; 53284ab085aSmws 53384ab085aSmws #define SMB_IPM_SPEC_MAJOR(x) (((x) & 0xF0) >> 4) 53484ab085aSmws #define SMB_IPM_SPEC_MINOR(x) ((x) & 0x0F) 53584ab085aSmws 53684ab085aSmws #define SMB_IPM_ADDR_IO 1ULL 53784ab085aSmws 53884ab085aSmws #define SMB_IPM_INFO_REGS(x) (((x) & 0xC0) >> 6) 53984ab085aSmws #define SMB_IPM_INFO_LSB(x) (((x) & 0x10) >> 4) 54084ab085aSmws #define SMB_IPM_INFO_ISPEC(x) (((x) & 0x08) >> 3) 54184ab085aSmws #define SMB_IPM_INFO_IPOL(x) (((x) & 0x02) >> 1) 54284ab085aSmws #define SMB_IPM_INFO_IMODE(x) (((x) & 0x01) >> 0) 54384ab085aSmws 54484ab085aSmws #define SMB_IPM_REGS_1B 0 54584ab085aSmws #define SMB_IPM_REGS_4B 1 54684ab085aSmws #define SMB_IPM_REGS_16B 2 54784ab085aSmws 54884ab085aSmws #define SMB_IPM_IPOL_LO 0 54984ab085aSmws #define SMB_IPM_IPOL_HI 1 55084ab085aSmws 55184ab085aSmws #define SMB_IPM_IMODE_EDGE 0 55284ab085aSmws #define SMB_IPM_IMODE_LEVEL 1 55384ab085aSmws 55445807aa8SRobert Mustacchi /* 55545807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_POWERSUP. 55645807aa8SRobert Mustacchi */ 55784ab085aSmws typedef struct smb_powersup { 55884ab085aSmws smb_header_t smbpsup_hdr; /* structure header */ 55984ab085aSmws uint8_t smbpsup_group; /* group id */ 56084ab085aSmws uint8_t smbpsup_loc; /* location tag */ 56184ab085aSmws uint8_t smbpsup_devname; /* device name */ 56284ab085aSmws uint8_t smbpsup_manufacturer; /* manufacturer */ 56384ab085aSmws uint8_t smbpsup_serial; /* serial number */ 56484ab085aSmws uint8_t smbpsup_asset; /* asset tag */ 56584ab085aSmws uint8_t smbpsup_part; /* part number */ 56684ab085aSmws uint8_t smbpsup_rev; /* revision string */ 56784ab085aSmws uint16_t smbpsup_max; /* max output in milliwatts */ 56884ab085aSmws uint16_t smbpsup_char; /* characteristics */ 56984ab085aSmws uint16_t smbpsup_vprobe; /* voltage probe handle */ 57084ab085aSmws uint16_t smbpsup_cooldev; /* cooling device handle */ 57184ab085aSmws uint16_t smbpsup_iprobe; /* current probe handle */ 57284ab085aSmws } smb_powersup_t; 57384ab085aSmws 5742b9d2074SRobert Mustacchi #define SMB_PSU_CHARS_ISHOT(x) ((x) & 0x01) 5752b9d2074SRobert Mustacchi #define SMB_PSU_CHARS_ISPRES(x) ((x) & 0x02) 5762b9d2074SRobert Mustacchi #define SMB_PSU_CHARS_ISUNPLUG(x) ((x) & 0x04) 5772b9d2074SRobert Mustacchi #define SMB_PSU_CHARS_IVRS(x) (((x) >> 3) & 0xf) 5782b9d2074SRobert Mustacchi #define SMB_PSU_CHARS_STATUS(x) (((x) >> 7) & 0x7) 5792b9d2074SRobert Mustacchi #define SMB_PSU_CHARS_TYPE(x) (((x) >> 10) & 0xf) 5802b9d2074SRobert Mustacchi 58145807aa8SRobert Mustacchi /* 58245807aa8SRobert Mustacchi * SMBIOS implementation structure for SMB_TYPE_OBDEVEXT. 58345807aa8SRobert Mustacchi */ 58403f9f63dSTom Pothier typedef struct smb_obdev_ext { 58503f9f63dSTom Pothier smb_header_t smbobe_hdr; /* structure header */ 58603f9f63dSTom Pothier uint8_t smbobe_name; /* reference designation */ 58703f9f63dSTom Pothier uint8_t smbobe_dtype; /* device type */ 58803f9f63dSTom Pothier uint8_t smbobe_dti; /* device type instance */ 58903f9f63dSTom Pothier uint16_t smbobe_sg; /* segment group number */ 59003f9f63dSTom Pothier uint8_t smbobe_bus; /* bus number */ 59103f9f63dSTom Pothier uint8_t smbobe_df; /* device/function number */ 59203f9f63dSTom Pothier } smb_obdev_ext_t; 59303f9f63dSTom Pothier 59445807aa8SRobert Mustacchi /* 59545807aa8SRobert Mustacchi * SMBIOS implementation structure for SUN_OEM_EXT_PROCESSOR. 59645807aa8SRobert Mustacchi */ 597074bb90dSTom Pothier typedef struct smb_processor_ext { 598074bb90dSTom Pothier smb_header_t smbpre_hdr; /* structure header */ 599074bb90dSTom Pothier uint16_t smbpre_processor; /* processor handle */ 600074bb90dSTom Pothier uint8_t smbpre_fru; /* FRU indicator */ 601074bb90dSTom Pothier uint8_t smbpre_n; /* number of APIC IDs */ 602074bb90dSTom Pothier uint16_t smbpre_apicid[1]; /* strand initial apic id */ 603074bb90dSTom Pothier } smb_processor_ext_t; 604074bb90dSTom Pothier 60545807aa8SRobert Mustacchi /* 60645807aa8SRobert Mustacchi * SMBIOS implementation structure for SUN_OEM_EXT_PORT. 60745807aa8SRobert Mustacchi */ 60803f9f63dSTom Pothier typedef struct smb_port_ext { 60903f9f63dSTom Pothier smb_header_t smbpoe_hdr; /* structure header */ 61003f9f63dSTom Pothier uint16_t smbpoe_chassis; /* chassis handle */ 61103f9f63dSTom Pothier uint16_t smbpoe_port; /* port connector handle */ 61203f9f63dSTom Pothier uint8_t smbpoe_dtype; /* device type */ 61303f9f63dSTom Pothier uint16_t smbpoe_devhdl; /* device handle */ 61403f9f63dSTom Pothier uint8_t smbpoe_phy; /* PHY number */ 61503f9f63dSTom Pothier } smb_port_ext_t; 61603f9f63dSTom Pothier 61745807aa8SRobert Mustacchi /* 61845807aa8SRobert Mustacchi * SMBIOS implementation structure for SUN_OEM_PCIEXRC. 61945807aa8SRobert Mustacchi */ 620074bb90dSTom Pothier typedef struct smb_pciexrc { 621074bb90dSTom Pothier smb_header_t smbpciexrc_hdr; /* structure header */ 622074bb90dSTom Pothier uint16_t smbpciexrc_bboard; /* base board handle */ 623074bb90dSTom Pothier uint16_t smbpciexrc_bdf; /* PCI Bus/Dev/Func */ 624074bb90dSTom Pothier } smb_pciexrc_t; 625074bb90dSTom Pothier 62645807aa8SRobert Mustacchi /* 62745807aa8SRobert Mustacchi * SMBIOS implementation structure for SUN_OEM_EXT_MEMARRAY. 62845807aa8SRobert Mustacchi */ 629074bb90dSTom Pothier typedef struct smb_memarray_ext { 630074bb90dSTom Pothier smb_header_t smbmarre_hdr; /* structure header */ 631074bb90dSTom Pothier uint16_t smbmarre_ma; /* memory array handle */ 632074bb90dSTom Pothier uint16_t smbmarre_component; /* component parent handle */ 633074bb90dSTom Pothier uint16_t smbmarre_bdf; /* PCI bus/dev/funct */ 634074bb90dSTom Pothier } smb_memarray_ext_t; 635074bb90dSTom Pothier 63645807aa8SRobert Mustacchi /* 63745807aa8SRobert Mustacchi * SMBIOS implementation structure for SUN_OEM_EXT_MEMDEVICE. 63845807aa8SRobert Mustacchi */ 639074bb90dSTom Pothier typedef struct smb_memdevice_ext { 640074bb90dSTom Pothier smb_header_t smbmdeve_hdr; /* structure header */ 641074bb90dSTom Pothier uint16_t smbmdeve_mdev; /* memory device handle */ 642074bb90dSTom Pothier uint8_t smbmdeve_dchan; /* DRAM channel */ 643074bb90dSTom Pothier uint8_t smbmdeve_ncs; /* number of chip select */ 644074bb90dSTom Pothier uint8_t smbmdeve_cs[1]; /* chip selects */ 645074bb90dSTom Pothier } smb_memdevice_ext_t; 646074bb90dSTom Pothier 64784ab085aSmws #pragma pack() 64884ab085aSmws 64984ab085aSmws typedef struct smb_struct { 65084ab085aSmws const smb_header_t *smbst_hdr; /* address of raw structure data */ 65184ab085aSmws const uchar_t *smbst_str; /* address of string data (if any) */ 65284ab085aSmws const uchar_t *smbst_end; /* address of 0x0000 ending tag */ 65384ab085aSmws struct smb_struct *smbst_next; /* next structure in hash chain */ 65484ab085aSmws uint16_t *smbst_strtab; /* string index -> offset table */ 65584ab085aSmws uint_t smbst_strtablen; /* length of smbst_strtab */ 65684ab085aSmws } smb_struct_t; 65784ab085aSmws 65884ab085aSmws struct smbios_hdl { 659c325726fSToomas Soome smbios_entry_point_t sh_ent_type; /* structure table entry point type */ 66084ab085aSmws smbios_entry_t sh_ent; /* structure table entry point */ 661c325726fSToomas Soome uint_t sh_ent_stnum; /* number of structure table entries */ 66284ab085aSmws const void *sh_buf; /* structure table buffer */ 66384ab085aSmws size_t sh_buflen; /* size of structure table buffer */ 66484ab085aSmws smb_struct_t *sh_structs; /* array of structure descriptors */ 66584ab085aSmws uint_t sh_nstructs; /* number of active structures */ 66684ab085aSmws smb_struct_t **sh_hash; /* hash bucket array for descriptors */ 66784ab085aSmws uint_t sh_hashlen; /* hash bucket array length */ 66884ab085aSmws int sh_err; /* error code for smbios_errno() */ 66984ab085aSmws int sh_libvers; /* library client abi version */ 67084ab085aSmws int sh_smbvers; /* derived underlying format version */ 67184ab085aSmws uint_t sh_flags; /* miscellaneous flags (see below) */ 67284ab085aSmws }; 67384ab085aSmws 67484ab085aSmws #define SMB_FL_DEBUG 0x1 /* print debug messages for this hdl */ 67584ab085aSmws #define SMB_FL_BUFALLOC 0x2 /* sh_buf was allocated by library */ 676b60ae21dSJonathan Matthew #define SMB_FL_TRUNC 0x4 /* smbios table is truncated */ 67784ab085aSmws 67884ab085aSmws #define SMB_BIOS_DEVICE "/dev/xsvc" /* device w/ BIOS physmem */ 67984ab085aSmws #define SMB_SMBIOS_DEVICE "/dev/smbios" /* device w/ SMBIOS image */ 68084ab085aSmws 68184ab085aSmws #define SMB_RANGE_START 0xF0000 /* start of physical address range */ 68284ab085aSmws #define SMB_RANGE_LIMIT 0xFFFFF /* limit of physical address range */ 683b10a562eSToomas Soome #define SMB_SCAN_STEP 16 /* stepping by paragraph */ 68484ab085aSmws 68545807aa8SRobert Mustacchi #define SMB_MAJMIN(M, m) ((((M) & 0xFF) << 8) | ((m) & 0xFF)) 68684ab085aSmws #define SMB_MAJOR(v) (((v) & 0xFF00) >> 8) 68784ab085aSmws #define SMB_MINOR(v) (((v) & 0x00FF)) 68884ab085aSmws 68984ab085aSmws #define ESMB_BASE 1000 /* base value for libsmbios errnos */ 69084ab085aSmws 69184ab085aSmws enum { 69284ab085aSmws ESMB_NOTFOUND = ESMB_BASE, /* SMBIOS table not found on system */ 69384ab085aSmws ESMB_MAPDEV, /* failed to map SMBIOS table */ 69484ab085aSmws ESMB_NOENT, /* failed to locate structure */ 69584ab085aSmws ESMB_NOMEM, /* failed to allocate memory */ 69684ab085aSmws ESMB_NOHDR, /* failed to read SMBIOS header */ 69784ab085aSmws ESMB_NOSTAB, /* failed to read SMBIOS struct table */ 69884ab085aSmws ESMB_NOINFO, /* no common info for structure */ 69984ab085aSmws ESMB_SHORT, /* buffer length doesn't match header */ 70084ab085aSmws ESMB_CORRUPT, /* buffer struct or len is corrupt */ 70184ab085aSmws ESMB_VERSION, /* version not supported by library */ 70284ab085aSmws ESMB_NOTSUP, /* feature not supported by provider */ 70384ab085aSmws ESMB_HEADER, /* SMBIOS header corrupt or invalid */ 70484ab085aSmws ESMB_OLD, /* SMBIOS version is too old for us */ 70584ab085aSmws ESMB_NEW, /* SMBIOS version is too new for us */ 70684ab085aSmws ESMB_CKSUM, /* SMBIOS header checksum mismatch */ 70784ab085aSmws ESMB_INVAL, /* invalid function call argument */ 70884ab085aSmws ESMB_TYPE, /* structure type mismatch */ 70984ab085aSmws ESMB_UNKNOWN /* unknown error (maximum value tag) */ 71084ab085aSmws }; 71184ab085aSmws 71284ab085aSmws extern const smb_struct_t *smb_lookup_type(smbios_hdl_t *, uint_t); 71384ab085aSmws extern const smb_struct_t *smb_lookup_id(smbios_hdl_t *, uint_t); 71484ab085aSmws extern const char *smb_strptr(const smb_struct_t *, uint_t); 71584ab085aSmws extern int smb_gteq(smbios_hdl_t *, int); 71638d76b18SRobert Mustacchi extern int smb_libgteq(smbios_hdl_t *, int); 71784ab085aSmws 71884ab085aSmws extern int smb_set_errno(smbios_hdl_t *, int); 71984ab085aSmws extern smbios_hdl_t *smb_open_error(smbios_hdl_t *, int *, int); 72084ab085aSmws extern const char *smb_strerror(int); 72184ab085aSmws 72284ab085aSmws extern void *smb_alloc(size_t); 72384ab085aSmws extern void *smb_zalloc(size_t); 72484ab085aSmws extern void smb_free(void *, size_t); 72584ab085aSmws 72684ab085aSmws extern void smb_dprintf(smbios_hdl_t *, const char *, ...); 72784ab085aSmws 72884ab085aSmws extern int _smb_debug; 72984ab085aSmws 7306734c4b0SRobert Mustacchi /* 7316734c4b0SRobert Mustacchi * The following series of structures represent the base versions of public 7326734c4b0SRobert Mustacchi * structures that are used inside by the smbios routines. This allows the 7336734c4b0SRobert Mustacchi * common code to properly know how much it should or should not bzero and how 7346734c4b0SRobert Mustacchi * to handle additions to the spec. Types should only be added here if we need 7356734c4b0SRobert Mustacchi * to extend the public structures in sys/smbios.h due to a change in the spec. 7366734c4b0SRobert Mustacchi * 7376734c4b0SRobert Mustacchi * Types here have the name smb_base_%s which corresponds to smbios_%s. 7386734c4b0SRobert Mustacchi */ 7396734c4b0SRobert Mustacchi typedef struct smb_base_chassis { 7406734c4b0SRobert Mustacchi uint32_t smbbc_oemdata; /* OEM-specific data */ 7416734c4b0SRobert Mustacchi uint8_t smbbc_lock; /* lock present? */ 7426734c4b0SRobert Mustacchi uint8_t smbbc_type; /* type */ 7436734c4b0SRobert Mustacchi uint8_t smbbc_bustate; /* boot-up state */ 7446734c4b0SRobert Mustacchi uint8_t smbbc_psstate; /* power supply state */ 7456734c4b0SRobert Mustacchi uint8_t smbbc_thstate; /* thermal state */ 7466734c4b0SRobert Mustacchi uint8_t smbbc_security; /* security status */ 7476734c4b0SRobert Mustacchi uint8_t smbbc_uheight; /* enclosure height in U's */ 7486734c4b0SRobert Mustacchi uint8_t smbbc_cords; /* number of power cords */ 7496734c4b0SRobert Mustacchi uint8_t smbbc_elems; /* number of element records (n) */ 7506734c4b0SRobert Mustacchi uint8_t smbbc_elemlen; /* length of contained element (m) */ 7516734c4b0SRobert Mustacchi } smb_base_chassis_t; 7526734c4b0SRobert Mustacchi 7536734c4b0SRobert Mustacchi typedef struct smb_base_processor { 7546734c4b0SRobert Mustacchi uint64_t smbbp_cpuid; /* processor cpuid information */ 7556734c4b0SRobert Mustacchi uint32_t smbbp_family; /* processor family */ 7566734c4b0SRobert Mustacchi uint8_t smbbp_type; /* processor type (SMB_PRT_*) */ 7576734c4b0SRobert Mustacchi uint8_t smbbp_voltage; /* voltage (SMB_PRV_*) */ 7586734c4b0SRobert Mustacchi uint8_t smbbp_status; /* status (SMB_PRS_*) */ 7596734c4b0SRobert Mustacchi uint8_t smbbp_upgrade; /* upgrade (SMB_PRU_*) */ 7606734c4b0SRobert Mustacchi uint32_t smbbp_clkspeed; /* external clock speed in MHz */ 7616734c4b0SRobert Mustacchi uint32_t smbbp_maxspeed; /* maximum speed in MHz */ 7626734c4b0SRobert Mustacchi uint32_t smbbp_curspeed; /* current speed in MHz */ 7636734c4b0SRobert Mustacchi id_t smbbp_l1cache; /* L1 cache handle */ 7646734c4b0SRobert Mustacchi id_t smbbp_l2cache; /* L2 cache handle */ 7656734c4b0SRobert Mustacchi id_t smbbp_l3cache; /* L3 cache handle */ 7666734c4b0SRobert Mustacchi } smb_base_processor_t; 7676734c4b0SRobert Mustacchi 7686734c4b0SRobert Mustacchi typedef struct smb_base_memdevice { 7696734c4b0SRobert Mustacchi id_t smbbmd_array; /* handle of physical memory array */ 7706734c4b0SRobert Mustacchi id_t smbbmd_error; /* handle of memory error data */ 7716734c4b0SRobert Mustacchi uint32_t smbbmd_twidth; /* total width in bits including ecc */ 7726734c4b0SRobert Mustacchi uint32_t smbbmd_dwidth; /* data width in bits */ 7736734c4b0SRobert Mustacchi uint64_t smbbmd_size; /* size in bytes (see note above) */ 7746734c4b0SRobert Mustacchi uint8_t smbbmd_form; /* form factor */ 7756734c4b0SRobert Mustacchi uint8_t smbbmd_set; /* set (0x00=none, 0xFF=unknown) */ 7766734c4b0SRobert Mustacchi uint8_t smbbmd_type; /* memory type */ 7776734c4b0SRobert Mustacchi uint8_t smbbmd_pad; /* padding */ 7786734c4b0SRobert Mustacchi uint32_t smbbmd_flags; /* flags (see below) */ 7796734c4b0SRobert Mustacchi uint32_t smbbmd_speed; /* speed in MHz */ 7806734c4b0SRobert Mustacchi const char *smbbmd_dloc; /* physical device locator string */ 7816734c4b0SRobert Mustacchi const char *smbbmd_bloc; /* physical bank locator string */ 7826734c4b0SRobert Mustacchi uint8_t smbbmd_rank; /* rank */ 7836734c4b0SRobert Mustacchi } smb_base_memdevice_t; 7846734c4b0SRobert Mustacchi 78538d76b18SRobert Mustacchi typedef struct smb_base_bios { 78638d76b18SRobert Mustacchi const char *smbbb_vendor; /* bios vendor string */ 78738d76b18SRobert Mustacchi const char *smbbb_version; /* bios version string */ 78838d76b18SRobert Mustacchi const char *smbbb_reldate; /* bios release date */ 78938d76b18SRobert Mustacchi uint32_t smbbb_segment; /* bios address segment location */ 79038d76b18SRobert Mustacchi uint32_t smbbb_romsize; /* bios rom size in bytes */ 79138d76b18SRobert Mustacchi uint32_t smbbb_runsize; /* bios image size in bytes */ 79238d76b18SRobert Mustacchi uint64_t smbbb_cflags; /* bios characteristics */ 79338d76b18SRobert Mustacchi const uint8_t *smbbb_xcflags; /* bios characteristics extensions */ 79438d76b18SRobert Mustacchi size_t smbbb_nxcflags; /* number of smbb_xcflags[] bytes */ 79538d76b18SRobert Mustacchi smbios_version_t smbbb_biosv; /* bios version */ 79638d76b18SRobert Mustacchi smbios_version_t smbbb_ecfwv; /* bios embedded ctrl f/w version */ 79738d76b18SRobert Mustacchi } smb_base_bios_t; 79838d76b18SRobert Mustacchi 79938d76b18SRobert Mustacchi typedef struct smb_base_cache { 80038d76b18SRobert Mustacchi uint32_t smbba_maxsize; /* maximum installed size in bytes */ 80138d76b18SRobert Mustacchi uint32_t smbba_size; /* installed size in bytes */ 80238d76b18SRobert Mustacchi uint16_t smbba_stype; /* supported SRAM types (SMB_CAT_*) */ 80338d76b18SRobert Mustacchi uint16_t smbba_ctype; /* current SRAM type (SMB_CAT_*) */ 80438d76b18SRobert Mustacchi uint8_t smbba_speed; /* speed in nanoseconds */ 80538d76b18SRobert Mustacchi uint8_t smbba_etype; /* error correction type (SMB_CAE_*) */ 80638d76b18SRobert Mustacchi uint8_t smbba_ltype; /* logical cache type (SMB_CAG_*) */ 80738d76b18SRobert Mustacchi uint8_t smbba_assoc; /* associativity (SMB_CAA_*) */ 80838d76b18SRobert Mustacchi uint8_t smbba_level; /* cache level */ 80938d76b18SRobert Mustacchi uint8_t smbba_mode; /* cache mode (SMB_CAM_*) */ 81038d76b18SRobert Mustacchi uint8_t smbba_location; /* cache location (SMB_CAL_*) */ 81138d76b18SRobert Mustacchi uint8_t smbba_flags; /* cache flags (SMB_CAF_*) */ 81238d76b18SRobert Mustacchi } smb_base_cache_t; 8136734c4b0SRobert Mustacchi 814*174bc649SRobert Mustacchi typedef struct smb_base_slot { 815*174bc649SRobert Mustacchi const char *smbbl_name; /* reference designation */ 816*174bc649SRobert Mustacchi uint8_t smbbl_type; /* slot type */ 817*174bc649SRobert Mustacchi uint8_t smbbl_width; /* slot data bus width */ 818*174bc649SRobert Mustacchi uint8_t smbbl_usage; /* current usage */ 819*174bc649SRobert Mustacchi uint8_t smbbl_length; /* slot length */ 820*174bc649SRobert Mustacchi uint16_t smbbl_id; /* slot ID */ 821*174bc649SRobert Mustacchi uint8_t smbbl_ch1; /* slot characteristics 1 */ 822*174bc649SRobert Mustacchi uint8_t smbbl_ch2; /* slot characteristics 2 */ 823*174bc649SRobert Mustacchi uint16_t smbbl_sg; /* segment group number */ 824*174bc649SRobert Mustacchi uint8_t smbbl_bus; /* bus number */ 825*174bc649SRobert Mustacchi uint8_t smbbl_df; /* device/function number */ 826*174bc649SRobert Mustacchi } smb_base_slot_t; 827*174bc649SRobert Mustacchi 82884ab085aSmws #ifdef __cplusplus 82984ab085aSmws } 83084ab085aSmws #endif 83184ab085aSmws 83284ab085aSmws #endif /* _SYS_SMBIOS_IMPL_H */ 833