84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws/*
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * CDDL HEADER START
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws *
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * The contents of this file are subject to the terms of the
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * Common Development and Distribution License, Version 1.0 only
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * (the "License"). You may not use this file except in compliance
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * with the License.
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws *
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * or http://www.opensolaris.org/os/licensing.
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * See the License for the specific language governing permissions
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * and limitations under the License.
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws *
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * When distributing Covered Code, include this CDDL HEADER in each
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * If applicable, add the following below this CDDL HEADER, with the
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * fields enclosed by brackets "[]" replaced with your own identifying
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * information: Portions Copyright [yyyy] [name of copyright owner]
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws *
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * CDDL HEADER END
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws/*
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws * Use is subject to license terms.
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws#pragma ident "%Z%%M% %I% %E% SMI"
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws#include <sys/smbios_impl.h>
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwsstatic const char *const _smb_errlist[] = {
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws "System does not export an SMBIOS table", /* ESMB_NOTFOUND */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws "Failed to map SMBIOS table", /* ESMB_MAPDEV */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws "Failed to locate specified structure", /* ESMB_NOENT */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws "Failed to allocate memory", /* ESMB_NOMEM */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws "Failed to read SMBIOS entry point", /* ESMB_NOHDR */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws "Failed to read SMBIOS structure table", /* ESMB_NOSTAB */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws "Generic info not available for structure", /* ESMB_NOINFO */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws "Structure table is shorter than expected", /* ESMB_SHORT */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws "SMBIOS data structure is corrupted", /* ESMB_CORRUPT */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws "Requested library version is not supported", /* ESMB_VERSION */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws "Structure type is not supported by this BIOS", /* ESMB_NOTSUP */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws "Header is not a valid SMBIOS entry point", /* ESMB_HEADER */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws "SMBIOS format is too old for processing", /* ESMB_OLD */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws "SMBIOS format is new and not yet supported", /* ESMB_NEW */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws "SMBIOS header checksum mismatch", /* ESMB_CKSUM */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws "Invalid argument specified in library call", /* ESMB_INVAL */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws "Structure is not of the expected type", /* ESMB_TYPE */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws "Unknown SMBIOS error" /* ESMB_UNKNOWN */
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws};
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwsstatic const int _smb_nerr = sizeof (_smb_errlist) / sizeof (_smb_errlist[0]);
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwsconst char *
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwssmbios_errmsg(int error)
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws{
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws const char *str;
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws if (error >= ESMB_BASE && (error - ESMB_BASE) < _smb_nerr)
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws str = _smb_errlist[error - ESMB_BASE];
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws else
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws str = smb_strerror(error);
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws return (str ? str : "Unknown error");
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws}
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwsint
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwssmbios_errno(smbios_hdl_t *shp)
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws{
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws return (shp->sh_err);
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws}
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwsint
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mwssmb_set_errno(smbios_hdl_t *shp, int error)
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws{
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws shp->sh_err = error;
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws return (SMB_ERR);
84ab085a13f931bc78e7415e7ce921dbaa14fcb3mws}