/*
* 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 <strings.h>
#include <umem.h>
#include <fm/topo_mod.h>
#include <fm/fmd_fmri.h>
#include <cpu_mdesc.h>
/*
* This enumerator creates cpu-schemed nodes for each strand found in the
* sun4v Physical Rource Inventory (PRI).
* Each node export four methods present(), expand() replaced() and unusable().
*
*/
/* Forward declaration */
topo_instance_t, void *, void *);
nvlist_t **);
nvlist_t **);
nvlist_t **);
nvlist_t **);
{ cpu_enum, cpu_release };
&cpu_ops };
{ NULL }
};
static void *
{
}
static void
{
}
static int
{
int rc = 0;
return (1);
if (version == CPU_SCHEME_VERSION0) {
&int_serial)) == 0) {
*serial = int_serial;
}
} else {
&str_serial)) == 0) {
if (str_serial == end)
rc = 1;
}
}
return (rc);
}
int
{
if (getenv("TOPOPLATFORMCPUDBG"))
return (-1);
return (-1);
}
return (-1);
}
return (0);
}
void
{
}
/*ARGSUSED*/
static int
{
/*
* Get the physical cpuid
*/
}
/*
* Find the cpuid entry
* If the input nvl contains a serial number, the cpu is identified
* by a tuple <cpuid, cpuserial>
* Otherwise, the cpu is identified by the <cpuid>.
*/
else
present = 1;
}
/* return the present status */
nvlist_free(*out);
}
return (0);
}
/*ARGSUSED*/
static int
{
/*
* Get the physical cpuid
*/
}
/*
* Find the cpuid entry
* If the input nvl contains a serial number, the cpu is identified
* by a tuple <cpuid, cpuserial>
* Otherwise, the cpu is identified by the <cpuid>.
*/
else
}
/* return the replaced status */
nvlist_free(*out);
}
return (0);
}
/*ARGSUSED*/
static int
{
int rc;
}
/* Find the cpuid entry */
return (-1);
return (-1);
else {
mcmp->cpumap_serialno)) != 0) {
}
}
mcmp->cpumap_chipidx >= 0 &&
int len;
char *str;
/* part number + dash number */
/* fru name */
/* fru serial */
}
return (0);
}
/*ARGSUSED*/
static int
{
int status;
}
/*
* Check the cpu presence
*/
else
present = 1;
}
if (present == 0) {
}
}
/* return the unusable status */
nvlist_free(*out);
}
return (0);
}
static nvlist_t *
{
int err;
return (NULL);
if (err != 0) {
return (NULL);
}
return (fmri);
}
static tnode_t *
{
int cpu_mask = 0;
"Unable to make nvlist for %s bind: %s.\n",
return (NULL);
}
"topo_node_bind (%s%d/%s%d) failed: %s\n",
name, i,
return (NULL);
}
return (ntn);
}
/*ARGSUSED*/
static int
{
int i;
int nerr = 0;
int pid;
/*
*/
}
return (-1);
return (-1);
}
/*
* Create the cpu nodes
*/
/* physical cpuid */
"failed to create a cpu=%d node: %s\n",
nerr++;
continue;
}
}
if (nerr != 0)
return (0);
}
/*ARGSUSED*/
static int
{
return (-1);
}
return (0);
}
/*ARGSUSED*/
static void
{
}