/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/processor.h>
#include <fm/fmd_fmri.h>
#include <strings.h>
#include <errno.h>
#include <kstat.h>
/*
* The scheme plugin for cpu FMRIs.
*/
{
int err;
char *str;
return (fmd_fmri_set_errno(EINVAL));
return (fmd_fmri_set_errno(EINVAL));
}
else
return (len);
}
/*
* Determine if a cpuid is present.
*/
/*ARGSUSED*/
static int
{
#ifdef sparc
/*
* For SPARC, use kstats to see if the cpuid is present.
* Note that this may need to change for sun4v.
*/
return (-1); /* errno is set for us */
(void) kstat_close(kc);
#else /* sparc */
/*
* For x64, just return true.
*/
return (1);
#endif /* sparc */
}
static int
{
int i;
return (-1); /* errno is set for us */
(void) kstat_close(kc);
return (fmd_fmri_set_errno(ENOENT));
}
(void) kstat_close(kc);
return (fmd_fmri_set_errno(oserr));
}
(void) kstat_close(kc);
return (0);
}
}
(void) kstat_close(kc);
return (fmd_fmri_set_errno(ENOENT));
}
static int
{
int err;
return (err);
}
static int
{
}
int
{
return (fmd_fmri_set_errno(EINVAL));
/*
* If the cpu-scheme topology exports this method expand(), invoke it.
*/
return (fmd_fmri_set_errno(EINVAL));
if (err != ETOPO_METHOD_NOTSUP)
return (rc);
if (version == CPU_SCHEME_VERSION0) {
&serialid)) != 0) {
return (fmd_fmri_set_errno(rc));
return (-1); /* errno is set for us */
serialid)) != 0)
return (fmd_fmri_set_errno(rc));
}
} else if (version == CPU_SCHEME_VERSION1) {
&serstr)) != 0) {
return (fmd_fmri_set_errno(rc));
return (0); /* Serial number is optional */
serbuf)) != 0)
return (fmd_fmri_set_errno(rc));
}
} else {
return (fmd_fmri_set_errno(EINVAL));
}
return (0);
}
int
{
return (fmd_fmri_set_errno(EINVAL));
/*
* If the cpu-scheme topology exports this method present(), invoke it.
*/
return (fmd_fmri_set_errno(EINVAL));
if (err != ETOPO_METHOD_NOTSUP)
return (rc);
if (version == CPU_SCHEME_VERSION0) {
&nvlserid) != 0)
return (fmd_fmri_set_errno(EINVAL));
} else if (version == CPU_SCHEME_VERSION1) {
&nvlserstr)) != 0)
return (fmd_fmri_set_errno(EINVAL));
/*
* If serial id is not available, just check if the cpuid
* is present.
*/
return (cpu_cpuid_present(cpuid));
} else {
return (fmd_fmri_set_errno(EINVAL));
}
}
int
{
return (fmd_fmri_set_errno(EINVAL));
/*
* If the cpu-scheme topology exports this method replaced(), invoke it.
*/
return (fmd_fmri_set_errno(EINVAL));
if (err != ETOPO_METHOD_NOTSUP)
return (rc);
if (version == CPU_SCHEME_VERSION0) {
&nvlserid) != 0)
return (fmd_fmri_set_errno(EINVAL));
FMD_OBJ_STATE_NOT_PRESENT : -1);
} else if (version == CPU_SCHEME_VERSION1) {
&nvlserstr)) != 0)
return (fmd_fmri_set_errno(EINVAL));
/*
* If serial id is not available, just check if the cpuid
* is present.
*/
if (cpu_cpuid_present(cpuid))
return (FMD_OBJ_STATE_UNKNOWN);
else
return (FMD_OBJ_STATE_NOT_PRESENT);
} else {
return (fmd_fmri_set_errno(EINVAL));
}
}
int
{
return (fmd_fmri_set_errno(EINVAL));
/*
* If the cpu-scheme topology exports this method unusable(), invoke it.
*/
return (fmd_fmri_set_errno(EINVAL));
if (err != ETOPO_METHOD_NOTSUP)
return (rc);
}
int
{
return (0);
return (0);
return (0);
return (0);
return (0);
return (0);
if (erversion == CPU_SCHEME_VERSION0) {
&erserint) != 0)
return (0);
&eeserint) != 0)
return (0);
return (0);
} else if (erversion == CPU_SCHEME_VERSION1) {
/* Serial ID is an optional element */
&erserstr);
&eeserstr);
return (0);
/*
* Serial IDs not found in both container, containee
*/
return (1);
if (ret1 != 0)
return (0);
/*
* Found Serial Ids in both container and containee.
* Check if they are same.
*/
return (0);
return (0);
}
return (1);
}