/*
* 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 == monza
*
*/
#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 "monza.h"
#if !defined(TEXT_DOMAIN)
#endif
/*
* These functions will overlay the symbol table of libprtdiag
* at runtime
*/
/*
* local functions
*/
char **outbuf);
int *ret);
static void
{
} else {
}
}
static void
{
} else {
}
}
static int
{
return (0);
== 0) {
return (1);
== 0) {
return (2);
== 0) {
return (2);
== 0) {
return (3);
== 0) {
return (3);
== 0) {
return (4);
== 0) {
return (5);
== 0) {
return (0);
== 0) {
return (1);
} else {
return (-1);
}
}
/*
* add all io devices under pci in io list
*/
/* ARGSUSED */
static int
{
char *compatible;
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);
/*
* Skip PCI and PCIEX devices because they will be processed
* later in the picl tree walk.
*/
&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);
else
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. 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);
}
/*
* display_pci
* Display all the PCI IO cards on this board.
*/
void
{
log_printf("\n", 0);
log_printf("=========================", 0);
log_printf("=========================", 0);
log_printf("\n", 0);
log_printf("\n", 0);
log_printf("\n", 0);
"Name", "Model", 0);
log_printf("\n");
"---------------------------------------------",
"-------------------------", "---------", 0);
log_printf("\n");
}
/* Get platform name, if that fails, use monza name by default */
}
}
/* ARGSUSED */
void
{
/* NOTE(ARGUNUSED(kstats)) */
/*
* Now display the last powerfail time and the fatal hardware
* reset information. We do this under a couple of conditions.
* First if the user asks for it. The second is if the user
* told us to do logging, and we found a system failure.
*/
if (flag) {
/*
* display time of latest powerfail. Not all systems
* have this capability. For those that do not, this
* is just a no-op.
*/
/* platform_disp_prom_version(tree); */
}
}
/*
* local functions
*/
/*
* add all io devices under pci in io list
*/
/* ARGSUSED */
static int
{
char *compatible;
int device_found;
device_found = 0;
sizeof (path));
if (err != PICL_SUCCESS) {
return (err);
}
device_found = 1;
MOTHERBOARD, OPHIR, 0);
&err);
}
device_found = 1;
&err);
}
device_found = 1;
&err);
}
device_found = 1;
&err);
}
device_found = 1;
}
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);
}
/*ARGSUSED*/
static void
{
char *value;
"========================= HW Revisions "
"=======================================\n\n"));
"System PROM revisions:\n"
"----------------------\n"));
}
"IO ASIC revisions:\n"
"------------------\n"));
"----------------------------------------",
"------------------------------",
"---------\n", 0);
/* Get platform name, if that fails, use monza name by default */
}
}
/*
* 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);
}
}