niu.c revision 335777d1b181cad304c5ec02288dad96b5e00a52
/*
* 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 <string.h>
#include <fm/topo_mod.h>
#include <libdevinfo.h>
#include <limits.h>
#include <sys/systeminfo.h>
#include <assert.h>
#include <stdlib.h>
/*
* niu.c
* sun4v specific niu enumerators
*/
#ifdef __cplusplus
extern "C" {
#endif
#define NIU_VERSION TOPO_VERSION
#define NIUFN_MAX 2
topo_instance_t, void *, void *);
static const topo_modops_t niu_ops =
const topo_modinfo_t niu_info =
static const topo_pgroup_info_t io_pgroup =
/*ARGSUSED*/
void
{
/*
* Turn on module debugging output
*/
return; /* mod errno already set */
}
}
void
{
}
static int
{
char *path;
int err, e;
}
if (e != 0)
return (0);
}
/*ARGSUSED*/
static int
{
char *dnm;
int err;
return (0);
if (topo_prop_set_string(tn,
return (0);
}
/*ARGSUSED*/
static int
{
char *dnm;
int err;
return (0);
== NULL)
return (0); /* driver maybe detached, return success */
&err) < 0) {
}
return (0);
}
static tnode_t *
{
int err;
"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);
}
mod);
mod);
}
return (ntn);
}
static int
{
char *path;
int e;
"dev:///%s fmri creation failed.\n", path);
return (-1);
}
} else {
TOPO_PROP_RESOURCE, &fmri, &e) < 0)
return (topo_mod_seterrno(mod, e));
}
return (topo_mod_seterrno(mod, e));
}
return (0);
}
/*ARGSUSED*/
static tnode_t *
{
int err;
return (NULL);
}
/* inherit FRU from parent */
/* inherit parent's label */
}
/* set ASRU */
return (ntn);
}
/*ARGSUSED*/
static tnode_t *
{
int err;
return (NULL);
/* inherit FRU from parent */
/* inherit parent's label */
/* set ASRU */
"failed: %s\n",
return (NULL); /* mod_errno already set */
}
return (ntn);
}
/*
*/
static int
{
*inst = (topo_instance_t)0;
rval = -1;
DI_PROP_REG, &intp);
}
if (rval < 0) {
DI_PROP_REG, &intp);
if (rval < 0)
return (-1);
}
return (0);
}
static int
{
"Currently only know how to enumerate %s components.\n",
NIUFN);
return (0);
}
while (sib != DI_NODE_NIL) {
"instance failed.\n", NIUFN);
continue;
}
== NULL) {
return (-1);
}
if (topo_mod_enumerate(mod,
}
}
return (0);
}
static topo_mod_t *
{
}
return (rp);
}
/*ARGSUSED*/
static int
{
"Currently only know how to enumerate %s components.\n",
NIU);
return (0);
}
return (-1);
}
/*
* Load XAUI Enum
*/
return (-1);
if (dnode != DI_NODE_NIL) {
return (-1); /* mod_errno already set */
}
0, NIUFN_MAX) < 0) {
"failed: %s\n",
return (-1); /* mod_errno already set */
}
"failed %s\n",
}
}
"Currently only know how to enumerate one niu "
"components.\n");
return (0);
}