/*
* 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 == ontario
*
*/
#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 "ontario.h"
#include "erie.h"
#include "pelton.h"
#include "stpaul.h"
#include "huron.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
{
int err;
/*
* PCIX_SLOT0 and PCIX_SLOT1 are actually the same path so
* use the unit address to distinguish the slot number.
*/
if (err == PICL_SUCCESS) {
if (ua[0] == '2') {
} else if (ua[0] == '1') {
}
}
} else {
}
}
static int
{
return (1);
return (3);
return (0);
return (2);
} 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);
/* 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 ontario name by default */
}
/*
* Call functions based on appropriate platform
*/
strlen(ONTARIO_PLATFORM)) == 0) ||
strlen(ONTARIO_PLATFORM2)) == 0)) {
"pciex", ontario_pci_callback);
"pci", ontario_pci_callback);
strlen(PELTON_PLATFORM))) == 0) {
"pciex", pelton_pci_callback);
"pci", pelton_pci_callback);
strlen(STPAUL_PLATFORM))) == 0) {
"pciex", stpaul_pci_callback);
"niu", huron_pci_callback);
"pciex", huron_pci_callback);
} else {
}
}
/*
* ----------------------------------------------------------------------------
*/
/* 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;
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);
}
/*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 ontario name by default */
}
/*
* Walk tree based on platform
*/
strlen(ONTARIO_PLATFORM))) == 0) {
"pciex", ontario_hw_rev_callback);
"pci", ontario_hw_rev_callback);
"network", ontario_hw_rev_callback);
strlen(PELTON_PLATFORM))) == 0) {
"pciex", pelton_hw_rev_callback);
"pci", pelton_hw_rev_callback);
"network", pelton_hw_rev_callback);
strlen(STPAUL_PLATFORM))) == 0) {
"pciex", stpaul_hw_rev_callback);
"pci", stpaul_hw_rev_callback);
"network", stpaul_hw_rev_callback);
"pciex", huron_hw_rev_callback);
"niu", huron_hw_rev_callback);
"network", huron_hw_rev_callback);
} else {
}
}
/*
* 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);
}
}