/*
* 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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* SUNW,OPL-Enterprise platform ioboard topology enumerator
*/
#include <string.h>
#include <strings.h>
#include <libdevinfo.h>
#include <fm/topo_mod.h>
#include "opl_topo.h"
{ opl_iob_enum, NULL };
&Iobops};
/* OPL model type */
typedef enum {
} opl_model_t;
void
{
/*
* Turn on module debugging output
*/
}
void
{
}
/*
* Checks to see if there's a physical board number property on this
* device node.
*/
static int
{
int val;
return (-1);
pp != DI_PROM_PROP_NIL;
continue;
return (val);
}
}
return (-1);
}
/*
* Creates a map of logical boards to physical location.
*/
static void
int lsb_to_psb[OPL_IOB_MAX])
{
di_node_t n;
int i;
/* Initialize all entries to no mapping */
for (i = 0; i < OPL_IOB_MAX; i++) {
lsb_to_psb[i] = i;
}
/*
* Get LSB-to-PSB (logical-to-physical board) mapping by finding the
* memory controller driver per LSB. The MC driver will have a
* physical-board# property.
*/
n != DI_NODE_NIL;
n = di_drv_next_node(n)) {
/*
* di_bus_addr returned NULL. This can happen during
* node for now.
*/
continue;
}
a = OPL_MC_STR2BA(ba);
lsb = OPL_MC_LSB(a);
/* psb mapping is out of range, skip */
continue;
}
}
}
/*
* Create the ioboard node. Add fru and label properties, and create room
* for child hostbridge nodes.
*
* Only IKKAKU model has different IO topology.
*/
static tnode_t *
{
int err;
return (NULL);
}
/* Create ioboard FMRI */
return (NULL);
}
/* Create node for this ioboard */
return (NULL); /* mod_errno already set */
}
/* Create and add FRU fmri for this ioboard */
if (opl_model == MODEL_IKKAKU)
else
}
/* Add label for this ioboard */
if (opl_model == MODEL_IKKAKU)
else
/* Create range of hostbridges on this ioboard */
return (NULL);
}
return (ion);
}
/*
* get the OPL model name from rootnode property "model"
*/
static int
{
char *bufp;
if (opl_devtree == DI_NODE_NIL ||
return (-1);
(unsigned char **)&bufp) != -1) {
return (0);
} else {
return (-1);
}
}
/*ARGSUSED*/
static int
{
int retval = 0;
/* Validate the name is correct */
return (-1);
}
/* Make sure we don't exceed OPL_IOB_MAX */
if (imax >= OPL_IOB_MAX) {
imax = OPL_IOB_MAX;
}
if (opl_devtree == DI_NODE_NIL) {
return (-1);
}
} else {
}
/*
* Create a mapping from logical board numbers (which are part of
* the device node bus address) to physical board numbers, so we
* can create meaningful fru labels.
*/
/*
* Figure out which boards are installed by finding hostbridges
* with matching bus addresses.
*/
pnode != DI_NODE_NIL;
/* Get the bus address */
return (-1); /* Return if it's not assigned */
}
a = OPL_PX_STR2BA(ba);
lsb = OPL_PX_LSB(a);
/* Map logical system board to physical system board */
}
/* If valid psb, note that this board exists */
}
}
/*
* Now enumerate each existing board Exit loop if retval is
* ever set to non-zero.
*/
/* If this board doesn't contain any hostbridges, skip it */
continue;
}
/* Create node for this ioboard */
"enumeration of ioboard failed: %s\n",
retval = -1;
break;
}
/* Enumerate hostbridges on this ioboard, sets errno */
}
return (retval);
}