/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved.
* Copyright 2015 Joyent, Inc.
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/sysmacros.h>
#include <smbios.h>
#include <alloca.h>
#include <limits.h>
#include <unistd.h>
#include <strings.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <ctype.h>
#define SMBIOS_SUCCESS 0
static const char *g_pname;
static int g_hdr;
static int opt_e;
static int opt_O;
static int opt_s;
static int opt_x;
/*PRINTFLIKE2*/
static void
{
}
/*PRINTFLIKE3*/
static void
{
if (d != NULL)
else
}
static void
{
size_t i;
for (i = 0; i < bits; i++) {
uint_t f = 1 << i;
const char *n;
if (!(flags & f))
continue;
else
}
}
static void
{
size_t i;
for (i = 0; i < bits; i++) {
u_longlong_t f = 1ULL << i;
const char *n;
if (!(flags & f))
continue;
else
}
}
static void
{
switch (id) {
case SMB_ID_NONE:
break;
case SMB_ID_NOTSUP:
break;
default:
}
}
static int
{
int i;
int cnt;
int rv;
const char **oem_str;
if (rv != 0) {
return (-1);
}
if (cnt > 0) {
for (i = 0; i < cnt; i++) {
return (0);
}
}
}
return (-1);
}
static void
{
int i;
for (i = 0; i < sizeof (ep.smbe_format); i++)
}
static void
{
}
static void
{
(void) smbios_info_bios(shp, &b);
if (b.smbb_nxcflags > SMB_BIOSXB_1) {
}
if (b.smbb_nxcflags > SMB_BIOSXB_2) {
}
if (b.smbb_nxcflags > SMB_BIOSXB_BIOS_MIN) {
}
if (b.smbb_nxcflags > SMB_BIOSXB_ECFW_MIN) {
}
}
static void
{
uint_t i;
(void) smbios_info_system(shp, &s);
for (i = 0; i < s.smbs_uuidlen; i++) {
if (i == 3 || i == 5 || i == 7 || i == 9)
}
}
static void
{
int chdl_cnt;
chdl_cnt = b.smbb_contn;
if (chdl_cnt != 0) {
int i, n, cnt;
if (cnt > SMB_CONT_MAX)
return;
for (i = 0; i < n; i++) {
}
}
}
static void
{
int elem_cnt;
elem_cnt = c.smbc_elems;
if (elem_cnt > 0) {
int i, n, cnt;
if (cnt > SMB_CONT_MAX)
return;
for (i = 0; i < n; i++) {
if (type & 0x80) {
/* SMBIOS structrure Type */
" Contained SMBIOS structure Type: %u",
type & 0x80);
} else {
/* SMBIOS Base Board Type */
" Contained SMBIOS Base Board Type: 0x%x",
type);
}
}
}
}
static void
{
if (p.smbp_family2 != 0)
"Populated" : "Not Populated");
if (SMB_PRV_LEGACY(p.smbp_voltage)) {
switch (p.smbp_voltage) {
case SMB_PRV_5V:
break;
case SMB_PRV_33V:
break;
case SMB_PRV_29V:
break;
}
} else {
}
if (p.smbp_corecount != 0) {
else
} else {
}
if (p.smbp_coresenabled != 0) {
} else {
}
} else {
}
if (p.smbp_threadcount != 0) {
p.smbp_threadcount);
} else {
}
} else {
}
if (p.smbp_cflags) {
}
if (p.smbp_clkspeed != 0)
else
if (p.smbp_maxspeed != 0)
else
if (p.smbp_curspeed != 0)
else
}
static void
{
if (c.smba_size != 0)
else
if (c.smba_speed != 0)
else
}
static void
{
}
static void
{
(void) smbios_info_smbios(shp, &e);
return;
}
static void
{
const char *type;
/*
* Bit 7 is always whether or not the device is enabled while bits 0:6
* are the actual device type.
*/
"false");
}
static void
{
int i, argc;
for (i = 0; i < argc; i++)
}
}
static void
{
const char **argv;
int i, argc;
for (i = 0; i < argc; i++)
}
}
static void
{
(void) smbios_info_lang(shp, &l);
}
/*ARGSUSED*/
static void
{
uint32_t i;
switch (ev.smbev_method) {
case SMB_EVM_1x1i_1x1d:
case SMB_EVM_2x1i_1x1d:
case SMB_EVM_1x2i_1x1d:
break;
case SMB_EVM_GPNV:
break;
default:
}
for (i = 0; i < ev.smbev_typec; i++) {
}
}
static void
{
uint8_t x;
"0123456789abcdef\n");
if (col % 4 == 0)
x = *data++;
}
if (col % 4 == 0)
}
}
}
static void
{
}
static void
{
else
else
switch (md.smbmd_size) {
case -1ull:
break;
case 0:
break;
default:
}
else
if (md.smbmd_rank != 0) {
} else {
}
if (md.smbmd_speed != 0)
else
if (md.smbmd_clkspeed != 0)
else
if (md.smbmd_minvolt != 0) {
} else {
}
if (md.smbmd_maxvolt != 0) {
} else {
}
if (md.smbmd_confvolt != 0) {
} else {
}
}
static void
{
}
static void
{
}
static void
{
(void) smbios_info_hwsec(shp, &h);
}
static void
{
(void) smbios_info_boot(shp, &b);
if (b.smbt_size != 0) {
}
}
static void
{
(void) smbios_info_ipmi(shp, &i);
}
static void
{
int i;
return;
ep.smbpe_apicid[i]);
}
}
static void
{
return;
}
static void
{
return;
}
static void
{
return;
}
static void
{
int i;
return;
for (i = 0; i < emd.smbmdeve_ncs; i++) {
}
}
static int
{
const char *s;
return (0); /* skip struct if type doesn't match -t */
return (0); /* skip struct if type is obsolete */
else
else
if (opt_s)
return (0); /* only print header line if -s specified */
}
switch (sp->smbstr_type) {
case SMB_TYPE_BIOS:
break;
case SMB_TYPE_SYSTEM:
break;
case SMB_TYPE_BASEBOARD:
break;
case SMB_TYPE_CHASSIS:
break;
case SMB_TYPE_PROCESSOR:
break;
case SMB_TYPE_CACHE:
break;
case SMB_TYPE_PORT:
break;
case SMB_TYPE_SLOT:
break;
case SMB_TYPE_OBDEVS:
break;
case SMB_TYPE_OEMSTR:
case SMB_TYPE_SYSCONFSTR:
break;
case SMB_TYPE_LANG:
break;
case SMB_TYPE_EVENTLOG:
break;
case SMB_TYPE_MEMARRAY:
break;
case SMB_TYPE_MEMDEVICE:
break;
case SMB_TYPE_MEMARRAYMAP:
break;
case SMB_TYPE_MEMDEVICEMAP:
break;
case SMB_TYPE_SECURITY:
break;
case SMB_TYPE_BOOT:
break;
case SMB_TYPE_IPMIDEV:
break;
case SMB_TYPE_OBDEVEXT:
break;
case SUN_OEM_EXT_PROCESSOR:
break;
case SUN_OEM_EXT_PORT:
break;
case SUN_OEM_PCIEXRC:
break;
case SUN_OEM_EXT_MEMARRAY:
break;
case SUN_OEM_EXT_MEMDEVICE:
break;
default:
hex++;
}
if (hex)
else
return (0);
}
static uint16_t
{
char *p;
errno = 0;
}
}
static uint16_t
{
const char *ts;
uint16_t t;
for (t = 0; t < SMB_TYPE_OEM_LO; t++) {
return (t);
}
/*NOTREACHED*/
}
static int
{
"[-BeOsx] [-i id] [-t type] [-w file] [file]\n\n", g_pname);
"\t-B disable header validation for broken BIOSes\n"
"\t-e display SMBIOS entry point information\n"
"\t-i display only the specified structure\n"
"\t-O display obsolete structure types\n"
"\t-s display only a summary of structure identifiers and types\n"
"\t-t display only the specified structure type\n"
"\t-w write the raw data to the specified file\n"
"\t-x display raw data for structures\n");
return (SMBIOS_USAGE);
}
int
{
int oflags = 0;
char *p;
else
g_pname = p + 1;
switch (c) {
case 'B':
break;
case 'e':
opt_e++;
break;
case 'i':
break;
case 'O':
opt_O++;
break;
case 's':
opt_s++;
break;
case 't':
else
break;
case 'w':
break;
case 'x':
opt_x++;
break;
case 'Z':
break;
default:
}
}
return (SMBIOS_USAGE);
}
}
}
return (SMBIOS_ERROR);
}
g_pname);
err = SMBIOS_ERROR;
err = SMBIOS_ERROR;
}
return (err);
}
if (opt_e) {
return (SMBIOS_SUCCESS);
}
opt_O++; /* -i or -t imply displaying obsolete records */
if (opt_i != -1)
else
if (err != 0) {
return (SMBIOS_ERROR);
}
if (opt_i != -1)
return (SMBIOS_SUCCESS);
}