pelton.c revision 087113e1a972d4b6246cf32a83c330968117b93e
/*
* 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 == pelton
*
*/
#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 "pelton.h"
#if !defined(TEXT_DOMAIN)
#define TEXT_DOMAIN "SYS_TEST"
#endif
/* local functions */
char **outbuf);
int *ret);
static void
{
} else {
}
}
/*
* 'path' is the device-path of the *parent* of the IO card ('card').
*
* Compare the prefix of the string representing the device-path with
* the strings representing the platform's Slots.
*
* Note that string for PEL_PCIX_SLOT1 is a prefix of PEL_PCIX_SLOT2's
* string. Since we want to match the longest possible substring of
* 'path', compare SLOT2 before comparing SLOT1.
*/
static void
{
} else {
}
}
static int
pelton_get_network_instance(char *path)
{
strlen(PEL_NETWORK_1_PATH)) == 0) {
return (1);
strlen(PEL_NETWORK_3_PATH)) == 0) {
return (3);
strlen(PEL_NETWORK_0_PATH)) == 0) {
return (0);
strlen(PEL_NETWORK_2_PATH)) == 0) {
return (2);
} else {
return (-1);
}
}
/*
* add all io devices under pci in io list
*/
/* ARGSUSED */
int
{
int err = PICL_SUCCESS;
char parent_path[MAXSTRLEN];
char piclclass[PICL_CLASSNAMELEN_MAX];
char *compatible;
char binding_name[MAXSTRLEN];
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;
}
if (err != PICL_SUCCESS) {
return (err);
}
sizeof (name));
if (err == PICL_PROPNOTFOUND)
else if (err != PICL_SUCCESS)
return (err);
/* Figure NAC name */
"NET", instance);
} else {
} else {
}
}
/*
* Get the name of this card. Iif 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);
}
/*
* local functions
*/
/*
* add all io devices under pci in io list
*/
/* ARGSUSED */
int
{
int err = PICL_SUCCESS;
char device_path[MAXSTRLEN];
char *compatible;
int device_found;
device_found = 0;
sizeof (path));
if (err != PICL_SUCCESS) {
return (err);
}
device_found = 1;
0);
&err);
}
device_found = 1;
1);
&err);
}
device_found = 1;
"IO-BRIDGE");
&err);
}
device_found = 1;
&err);
}
device_found = 1;
&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);
}
/*
* 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);
}
}