cpu.c revision 80ab886d233f514d54c2a6bdeb9fdfd951bd6881
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <errno.h>
#include <kstat.h>
#include <limits.h>
#include <strings.h>
#include <unistd.h>
#include <fm/topo_mod.h>
#include <topo_error.h>
typedef struct cpu_node {
} cpu_node_t;
topo_instance_t, void *);
nvlist_t **);
nvlist_t **);
nvlist_t **);
nvlist_t **);
nvlist_t **);
nvlist_t **);
nvlist_t **);
#define CPU_VERSION TOPO_VERSION
static const topo_method_t cpu_methods[] = {
{ NULL }
};
static const topo_modinfo_t cpu_info =
void
{
return;
return;
}
return;
}
return;
}
}
void
{
}
static int
{
return (-1);
} else {
}
return (ksp->ks_instance);
}
/*ARGSUSED*/
static int
{
int i;
char *s, sbuf[21];
for (i = 0; i <= cpuip->cn_ncpustats; i++) {
continue;
"device_ID")) != NULL) {
s = sbuf;
} else {
s = NULL;
}
continue;
}
return (0);
}
/*ARGSUSED*/
static int
{
return (-1); /* mod_errno set */
}
}
static void
{
}
{
int rc;
char *serstr;
if (version == CPU_SCHEME_VERSION0) {
!= 0)
return (0);
(u_longlong_t)serint));
} else if (version == CPU_SCHEME_VERSION1) {
return (0);
/*
* Serial number is an optional element
*/
&serstr)) != 0)
FM_FMRI_CPU_ID, cpuid));
else
return (0);
else
serstr));
} else {
return (0);
}
}
/*ARGSUSED*/
static int
{
char *name;
if (version > TOPO_METH_NVL2STR_VERSION)
}
}
return (0);
}
/*ARGSUSED*/
static int
{
int err;
if (version > TOPO_METH_STR2NVL_VERSION)
/* We're expecting a string version of a cpu scheme FMRI */
if (s == NULL)
++s;
if (*(s = end) == '/') {
s = strchr(s, '=');
++s;
serial = s;
}
serial);
if (err != 0) {
}
return (0);
}
/*ARGSUSED*/
static int
{
}
/*ARGSUSED*/
static int
{
}
/*ARGSUSED*/
static int
{
}
/*ARGSUSED*/
static int
{
}
static nvlist_t *
{
int err;
return (NULL);
}
if (s != NULL)
if (err != 0) {
return (NULL);
}
return (fmri);
}
/*ARGSUSED*/
static int
{
int rc;
else
}
return (0);
}