/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Sun4v Platform specific functions.
*
* called when :
* machine_type == StPaul
*
*/
#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 "stpaul.h"
/* prototypes for local functions */
static int stpaul_get_network_instance(char *path);
static int stpaul_get_usb_instance(char *path);
char **outbuf);
int *ret);
/* ARGSUSED */
int
{
char *compatible;
char pn_type;
sizeof (parent_path));
if (err != PICL_SUCCESS)
return (err);
/* Walk through the children */
sizeof (picl_nodehdl_t));
while (err == PICL_SUCCESS) {
if (err != PICL_SUCCESS)
return (err);
&nodeh, sizeof (picl_nodehdl_t));
continue;
}
&nodeh, sizeof (picl_nodehdl_t));
continue;
}
if (err != PICL_SUCCESS)
return (err);
sizeof (name));
if (err == PICL_PROPNOTFOUND)
else if (err != PICL_SUCCESS)
return (err);
/* Figure NAC name */
} else {
} else {
}
}
/* Special case for USB */
if (instance != -1)
}
if (pn_type == SPL_PEM_TYPE)
else if (pn_type == SPL_NEM_TYPE)
}
/*
* Get the name of this card. If binding_name is found,
* name will be <nodename>-<binding_name>
*/
&binding_name, sizeof (binding_name));
if (err == PICL_PROPNOTFOUND) {
/*
* if compatible prop is found, name will be
* <nodename>-<compatible>
*/
&compatible);
if (err == PICL_SUCCESS) {
} else if (err != PICL_PROPNOTFOUND)
return (err);
} else if (err != PICL_SUCCESS)
return (err);
}
/* Get the model of this card */
if (err == PICL_PROPNOTFOUND)
else if (err != PICL_SUCCESS)
return (err);
/* Print NAC name */
/* Print IO Type */
/* Print Slot # */
/* Print Parent Path */
/* Printf Card Name */
else
/* Print Card Model */
else
log_printf("\n");
sizeof (picl_nodehdl_t));
}
return (PICL_WALK_CONTINUE);
}
/* ARGSUSED */
int
{
char *compatible;
int device_found = 0;
sizeof (path));
if (err != PICL_SUCCESS)
return (err);
/* usb is special as a child of PCIE2PCI bridge */
sizeof (picl_nodehdl_t));
if (err != PICL_SUCCESS)
return (err);
sizeof (name));
if (err != PICL_SUCCESS)
return (err);
if (err != PICL_SUCCESS)
return (err);
}
}
device_found = 1;
OPHIR, 0);
&err);
}
device_found = 1;
USB_TAG, 0);
&err);
}
device_found = 1;
"IO-BRIDGE");
&err);
}
device_found = 1;
SWITCH_A);
&err);
}
device_found = 1;
SWITCH_B);
&err);
}
device_found = 1;
&err);
}
device_found = 1;
&err);
}
if (device_found == 1) {
/* Print NAC name */
/* Print Device Path */
else
/* Print Compatible # */
if (err == PICL_SUCCESS) {
} else
/* Print Revision */
log_printf("\n");
}
return (PICL_WALK_CONTINUE);
}
static void
{
} else {
}
}
static void
{
} else {
}
}
static int
{
strlen(SPL_NETWORK_1_PATH)) == 0)
return (1);
strlen(SPL_NETWORK_0_PATH)) == 0)
return (0);
else
return (-1);
}
static int
{
return (2);
return (1);
return (0);
else
return (-1);
}
static int
{
*type = SPL_PEM_TYPE;
return (1);
*type = SPL_PEM_TYPE;
return (0);
*type = SPL_NEM_TYPE;
return (1);
*type = SPL_NEM_TYPE;
return (0);
} else
return (-1);
}
/*
* return the first compatible value
*/
static 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);
}
static int64_t
{
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);
}
}