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