xaui.c revision 4df55fde49134f9735f84011f23a767c75e393c7
/*
* 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 <fm/topo_mod.h>
#include <assert.h>
#include <sys/systeminfo.h>
#include "xaui.h"
/*
* xaui.c
* sun4v specific xaui enumerators
*/
#ifdef __cplusplus
extern "C" {
#endif
#define XAUI_VERSION TOPO_VERSION
topo_instance_t, void *, void *);
static const topo_modops_t xaui_ops =
const topo_modinfo_t xaui_info =
static const topo_pgroup_info_t xaui_auth_pgroup = {
1
};
static int freeprilabel = 0;
static int ispci = 0;
/*ARGSUSED*/
void
{
/*
* Turn on module debugging output
*/
return; /* mod errno already set */
}
}
void
{
}
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);
}
}
return (ntn);
}
static int
{
int err, e;
}
if (e < 0)
return (0);
}
static void *
{
}
static void
{
}
static char *
{
int i = 0;
int rv;
char *devfs_path;
char *path;
char *freebuf;
char *token;
char *lastp;
/*
* There are two ways to get here:
* 1. niu enum - private data is the di_node_t for this xaui
* - instance is the ethernet function number
* device path looks like: /niu@80/network@0:nxge@0
* PRI path looks like: /@80/@0
*
* 2. pcibus enum - private data is the parent tnode_t
* - instance is the pci function number
* device path looks like: /pci@500/pci@0/pci@8/network@0:nxge0
* PRI path looks like: /@500/@0/@8/@0
*
* PRI path for pciex is /@Bus/@Dev/@Func/@Instance
*
* The parent topo_node for xaui is pciexfn; check to see if the
* private data is a topo_node by looking for the "pciexfn" name.
*/
if (ispci == 1) {
/* coming from pcibus */
/* PCI Func tnode */
} else {
/* coming from niu */
}
if (dnode == DI_NODE_NIL) {
return (NULL);
}
/* get device path */
if (devfs_path == NULL) {
return (NULL);
}
/* alloc enough space to hold the path */
return (NULL);
}
if (ispci == 1) {
/*
* devfs path for pciexfn looks like
*
* Strip "/pci@" chars from path and add /@Instance
*/
NULL) {
if (++i < MAX_PCIADDR_DEPTH) {
} else {
return (NULL);
}
}
} else {
return (NULL);
}
/* path: addresses + '/@' + '/@instance' (0/1) + '\0' */
if (rv < 0) {
return (NULL);
}
} else {
/* need to strip "/niu@" chars from path and add /@Instance */
/* path: address + '/@' + '/@instance' (0/1) + '\0' */
if (rv < 0) {
return (NULL);
}
}
/* cleanup */
for (i = 0; i < MAX_PCIADDR_DEPTH; i++) {
}
}
/* should return something like /@500/@0/@8/@0 or /@80/@0 */
return (path);
}
static int
char **labelp)
{
int i;
char *path;
/* Get device path minus the device names */
return (-1);
}
return (-1);
}
if ((type & LDOM_TYPE_CONTROL) != 0) {
} else {
}
if (bufsize < 1) {
return (-1);
}
return (-1);
}
return (-1);
}
if (ncomp <= 0) {
return (-1);
}
for (i = 0; i < ncomp; i++) {
/*
* Look for type == "io", topo-hc-name == "xaui";
* match "path" md property.
*/
/* check node path */
/* this is the node, grab the label */
&pstr) == 0) {
/* need to free this later */
freeprilabel = 1;
break;
}
}
}
}
}
return (0);
}
static int
{
int err;
int i, p;
if (Phyxaui_Names == NULL)
return (-1);
if (topo_prop_get_string(node,
}
/*
* Trim SUNW, from the platform name
*/
else
++pp;
for (p = 0; p < Phyxaui_Names->psn_nplats; p++) {
pp) != 0)
continue;
i++) {
break;
}
}
break;
}
}
if (freeprilabel == 1) {
}
}
if (freeprilabel == 1) {
}
}
return (0);
}
/*ARGSUSED*/
static tnode_t *
{
int e;
return (NULL);
}
/* when coming from pcibus: private data == parent tnode */
ispci = 1;
}
ispci = 0;
/* set ASRU to resource fmri */
TOPO_PROP_RESOURCE, &fmri, &e) == 0)
0, XFP_MAX) < 0) {
"failed: %s\n",
return (NULL); /* mod_errno already set */
}
return (ntn);
}
static topo_mod_t *
{
}
return (rp);
}
/*ARGSUSED*/
static int
{
"Currently only know how to enumerate %s components.\n",
XAUI);
return (0);
}
xaui_mod_hdl = mod;
/*
* Load XFP enum
*/
return (-1);
return (-1);
/* set the private data to be the instance number of niufn */
if (topo_mod_enumerate(mod,
}
return (0);
}