/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Sun4v Platform specific functions.
*
* called when :
* machine_type == erie
*
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <kstat.h>
#include <fcntl.h>
#include <string.h>
#include <assert.h>
#include <libintl.h>
#include <note.h>
#include <sys/systeminfo.h>
#include <sys/openpromio.h>
#include <sys/sysmacros.h>
#include <picl.h>
#include "picldefs.h"
#include <pdevinfo.h>
#include <display.h>
#include <display_sun4v.h>
#include <libprtdiag.h>
#include "erie.h"
#if !defined(TEXT_DOMAIN)
#endif
/*
* Add all io picl nodes under pci in io list
*/
/* ARGSUSED */
int
{
/* Get the parent node's path - used to determine bus type of child */
sizeof (parent_path));
if (err != PICL_SUCCESS) {
return (err);
}
/* Walk through this node's children */
sizeof (picl_nodehdl_t));
while (err == PICL_SUCCESS) {
/* Get child's class */
sizeof (piclclass))) != PICL_SUCCESS)
return (err);
/* If this node is a pci bus or bridge, get node's sibling */
&nodeh, sizeof (picl_nodehdl_t));
continue;
}
/*
* In order to get certain values, it's necessary
* to search the picl tree. If there's a problem
* with these searches, we'll return the err
*/
!= PICL_SUCCESS)
return (err);
!= PICL_SUCCESS)
return (err);
!= PICL_SUCCESS)
return (err);
/* Print out the data */
/* Print NAC */
/* Print IO Type */
/* Print Slot # */
} else {
}
/* Printf Node Name */
else
/* Print Card Model */
else
log_printf("\n");
/* Grab the next child under parent node and do it again */
sizeof (picl_nodehdl_t));
}
return (PICL_WALK_CONTINUE);
}
/*
* ----------------------------------------------------------------------------
*/
/*
* Add all IO ASIC revisions to list
*/
/* ARGSUSED */
int
{
char *compatible;
/* Get path of this device */
sizeof (path));
if (err != PICL_SUCCESS) {
return (err);
}
/*
* If it's a network dev, then print network info.
* Else if it's not a network dev, check for FIRE ASIC
* Else return PICL_WALK_CONTINUE
*/
OPHIR, 0);
&err);
OPHIR, 1);
&err);
&err);
IOBRIDGE);
&err);
&err);
} else {
return (PICL_WALK_CONTINUE);
}
/* Get first compatible value from picl compatible list */
if (err != PICL_SUCCESS) {
return (err);
}
/* Print nacation */
/* Print Device Path */
/* Print Compatible # */
/* Print Revision */
log_printf("\n");
return (PICL_WALK_CONTINUE);
}
/*
* ----------------------------------------------------------------------------
*/
/*
* Local functions
*/
/*
* This function returns the first picl compatible value
*/
int
{
int err;
char *pval;
if (err != PICL_SUCCESS)
return (err);
return (PICL_FAILURE);
if (err != PICL_SUCCESS) {
return (err);
}
return (PICL_SUCCESS);
}
return (PICL_FAILURE);
/* get first string from table */
if (err != PICL_SUCCESS)
return (err);
if (err != PICL_SUCCESS)
return (err);
if (err != PICL_SUCCESS)
return (err);
return (PICL_FAILURE);
if (err != PICL_SUCCESS) {
return (err);
}
return (PICL_SUCCESS);
}
/*
* This function returns the revision of
* a device.
*/
{
int err;
if (err != PICL_SUCCESS) {
return (0);
}
/*
* If it is not an int, uint or byte array prop, return failure
*/
*ret = PICL_FAILURE;
return (0);
}
case sizeof (int8_t):
return (int8v);
case sizeof (int16_t):
return (int16v);
case sizeof (int32_t):
return (int32v);
case sizeof (int64_t):
return (int64v);
default: /* not supported size */
*ret = PICL_FAILURE;
return (0);
}
}
/*
* This function fills in the bus type for an IO device.
* the pci-x bus. Otherwise, it's on a pci-e bus.
*
*/
void
{
} else {
}
}
/*
* Thie function indicates whether a device is in a pci-e slot
* or if it's on the motherboard. There's only one pci-e slot
* on erie, everything else is on the motherboard.
*
*/
int
{
return (0);
return (NO_SLOT);
}
/*
* This function takes a path to one of the on-board
* network devices and returns the instance# of that
* device.
*
*/
int
{
return (1);
return (3);
return (0);
return (2);
} else {
return (-1);
}
}
/*
* This function gets the path of a node and
* the error code from the picl API
*
*/
int
{
int err;
/* hardware path of this node */
return (err);
}
/*
* This function returns assings the string passed in
* the value of the picl node's name
*
*/
int
{
int err;
char *compatible;
/* Get this node's name */
if (err == PICL_PROPNOTFOUND) {
err = PICL_SUCCESS;
}
/*
* If binding_name is found,
* name will be <nodename>-<binding_name>
*/
&binding_name, sizeof (binding_name));
if (err == PICL_SUCCESS) {
}
/*
* if compatible prop is not found, name will be
* <nodename>-<compatible>
*/
} else if (err == PICL_PROPNOTFOUND) {
if (err == PICL_SUCCESS) {
}
err = PICL_SUCCESS;
} else {
return (err);
}
/* The name was created fine, copy it to name var */
return (err);
}
/*
* This functions assigns the string passed in the
* the value of the picl node's NAC name.
*/
void
int size)
{
int instance;
/* Figure out NAC name and instance, if onboard network node */
"NET", instance);
slot);
} else {
}
}
/*
* This function copies the node's model into model string
*
*/
int
{
int err;
/* Get the model of this node */
if (err == PICL_PROPNOTFOUND) {
err = PICL_SUCCESS;
} else {
}
return (err);
}
/*
* This function copies the node's class into class string
*
*/
int
{
int err;
return (err);
}