/*
* 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.
*/
/*
*
* Cherrystone platform-specific functions
*
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <kstat.h>
#include <string.h>
#include <assert.h>
#include <libintl.h>
#include <note.h>
#include <syslog.h>
#include <sys/openpromio.h>
#include <sys/sysmacros.h>
#include <pdevinfo.h>
#include <display.h>
#include <pdevinfo_sun4u.h>
#include <display_sun4u.h>
#include <picl.h>
#include <sys/cheetahregs.h>
#include <sys/cherrystone.h>
#include "workfile.c"
/*
* these functions will overlay the symbol table of libprtdiag
* at runtime (workgroup server systems only)
*/
struct system_kstat_data *kstats);
/* local functions */
static void disp_envc_status(void);
static int print_temps(picl_nodehdl_t);
static int print_keyswitch(picl_nodehdl_t);
static int print_FSP_LEDS(picl_nodehdl_t);
static int print_disk(picl_nodehdl_t);
static int print_fans(picl_nodehdl_t);
static int print_ps(picl_nodehdl_t);
Board_node *bnode);
void
{
"\n========================= CPUs "
"===============================================\n\n"
" Run E$ CPU CPU \n"
"Brd CPU MHz MB Impl. Mask \n"
"--- ----- ---- ---- ------- ---- \n"));
}
log_printf("\n");
}
void
{
int ecache_size;
int *l3_shares;
int *mid;
int *impl;
int *mask;
int *coreid;
int mid_prev;
int ecache_size_prev = 0;
char fru_name;
/*
* display the CPUs' operating frequency, cache size, impl. field
* and mask revision.
*/
/* Do not display a failed CPU node */
continue;
if (CPU_IMPL_IS_CMP(*impl)) {
continue;
}
if ((fru_prev == 'X') ||
((fru_prev != 'X') &&
continue;
} else {
/*
* Some CMP chips have a split E$,
* so the size for both cores is added
* together to get the total size for
* the chip.
*
* Still, other CMP chips have E$ (L3)
* which is logically shared, so the
* total size is equal to the core size.
*/
MULTIPLE_BITS_SET(*l3_shares))) {
}
ecache_size_prev = 0;
fru_prev = 'X';
}
}
/* CPU Module ID */
if (CPU_IMPL_IS_CMP(*impl)) {
} else
/* Running frequency */
if (ecache_size == 0)
log_printf(" N/A ");
else
log_printf(" %4.1f ",
/* Implementation */
} else {
if (IS_CHEETAH(*impl))
"US-III "));
else if (IS_CHEETAH_PLUS(*impl))
"US-III+ "));
"US-IV "));
else if (IS_PANTHER(*impl))
"US-IV+ "));
else
}
/* CPU Mask */
} else {
}
}
}
/*ARGSUSED0*/
void
{
"========================= Memory Configuration"
" ===============================\n\n"
" Logical Logical Logical\n"
" MC Bank Bank Bank DIMM "
"Interleave Interleaved\n"
"Brd ID num size Status Size "
"Factor with\n"
"--- --- ---- ------ ----------- ------ "
"---------- -----------"));
if (get_us3_mem_regs(bnode)) {
"\nFailed to get memory information.\n"));
return;
}
}
/* Display what we have found */
}
/*ARGSUSED3*/
void
struct system_kstat_data *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.
*/
}
return;
}
/*
* display_pci
* Display all the PCI IO cards on this board.
*/
void
{
void *value;
int i;
return;
/* Initialize all the common information */
/*
* each instance node found.
*/
/*
* Get slot-name properties from parent node and
* store them in an array.
*/
value = (char *)get_prop_val(
/* array starts after first int */
slot_name_arr[0] = (char *)value + sizeof (int);
for (i = 1; i < NUM_PCI_SLOTS; i++) {
}
}
/*
* Search for Children of this node ie. Cards.
* Note: any of these cards can be a pci-bridge
* that itself has children. If we find a
* pci-bridge we need to handle it specially.
*/
/* Generate the list of pci cards on pci instance: pci */
} /* end-for */
" Bus Max\n"
" IO Port Bus Freq Bus Dev,\n"
"Type ID Side Slot MHz Freq Func State "
"Name Model"
#ifdef DEBUG
" Notes"
#endif
"\n"
"---- ---- ---- ---- ---- ---- ---- ----- "
"-------------------------------- "
#ifdef DEBUG
"---------------------- "
#endif
"----------------------\n"));
}
}
/*
* Print out all the io cards in the list. Also print the column
* headers if told to do so.
*/
void
{
struct io_card *p;
"%-4s %-3d %c %-1s %-3d"),
switch (p->pci_bus) {
case 'A':
break;
case 'B':
break;
default:
assert(0);
break;
}
"%-1d,%-1d %-5s %-32.32s"),
else
#ifdef DEBUG
#endif
log_printf("\n");
}
}
/*ARGSUSED*/
void
{
/* NOP, since there are no FFB's on this platform. */
}
/*
* local functions
*/
static void
{
int err;
"\n"
"========================= Environmental Status "
"=========================\n\n"));
err = picl_initialize();
if (err != PICL_SUCCESS) {
goto err_out;
}
if (err != PICL_SUCCESS) {
goto err_out;
}
if (err != PICL_SUCCESS) {
goto err_out;
}
if (err != PICL_SUCCESS)
goto err_out;
return;
"\nEnvironmental reporting error: %s\n"),
picl_strerror(err));
}
static int
{
int i, j, err = 0;
"Power Supplies:\n"
"---------------\n"
"\n"
"Supply Status Fault Fan Fail Temp Fail\n"
"------ ------------ -------- --------- ---------\n"));
if (err != PICL_SUCCESS) {
return (err);
}
for (i = 0; i < MAX_PS; i++) {
if (err != PICL_SUCCESS)
continue;
if (err != PICL_SUCCESS) {
return (err);
}
log_printf("\n");
continue;
}
&number, &ps_fail_sensor);
if (err != PICL_SUCCESS) {
return (err);
}
log_printf(" ");
for (j = 0; j < MAX_PS_SENSORS; j++) {
if (err != PICL_SUCCESS) {
if (err == PICL_FAILURE) {
break;
}
return (err);
}
}
log_printf("\n");
}
"\n=================================\n\n"));
return (PICL_SUCCESS);
}
static int
{
int i, err;
&fans);
if (err != PICL_SUCCESS) {
return (err);
}
"\n=================================\n\n"
"Fan Status:\n"
"-----------\n\n"
"Fan Tray Fan RPM Status\n"
"----------- ---- ----- ----------\n"));
for (i = 0; i < MAX_FANS; i++) {
if (err != PICL_SUCCESS)
continue;
if (err != PICL_SUCCESS)
continue;
if (err != PICL_SUCCESS)
continue;
if (err != PICL_SUCCESS) {
return (err);
}
if (err != PICL_SUCCESS) {
return (err);
}
}
"\n=================================\n\n"));
return (PICL_SUCCESS);
}
static int
{
int i, err;
&disks);
if (err != PICL_SUCCESS) {
return (err);
}
"Disk Status:\n"
"------------\n"));
for (i = 0; i < MAX_DISKS; i++) {
switch (err) {
case PICL_SUCCESS:
"DISK %d: [%3s]\n"), i, state);
break;
case PICL_INVALIDHANDLE:
"DISK %d: [ NOT PRESENT ]\n"), i);
break;
default:
return (err);
}
}
return (PICL_SUCCESS);
}
static int
{
int err;
&fsp_led);
if (err != PICL_SUCCESS) {
return (err);
}
if (err != PICL_SUCCESS) {
return (err);
}
if (err != PICL_SUCCESS) {
return (err);
}
"System LED Status:\n\n"
" LOCATOR FAULT POWER\n"
" ------- ------- -------\n"
" [%3s] [%3s] [ ON]"),
"\n\n=================================\n\n"));
return (err);
}
static int
{
int err;
&keyswitch);
if (err != PICL_SUCCESS) {
return (err);
}
if (err != PICL_SUCCESS) {
return (err);
}
"Front Status Panel:\n"
"-------------------\n"
"Keyswitch position: %s\n\n"), ks_pos);
return (err);
}
static int
{
int i;
int err;
char *p;
if (err != PICL_SUCCESS) {
return (err);
}
"System Temperatures (Celsius):\n"
"-------------------------------\n"
"Device\t\tTemperature\tStatus\n"
"---------------------------------------\n"));
for (i = 0; i < number; i++) {
if (err != PICL_SUCCESS) {
if (err == PICL_INVALIDHANDLE) {
} else {
return (err);
}
}
if (err != PICL_SUCCESS) {
if (err == PICL_INVALIDHANDLE)
/* This FRU isn't present. Skip it. */
continue;
return (err);
}
/*
* The names in the tree are like "CPU0_DIE_TEMPERATURE_SENSOR".
* All we want to print is up to the first underscore.
*/
if (p != NULL)
*p = '\0';
if (err != PICL_SUCCESS) {
return (err);
}
}
"\n=================================\n\n"));
return (PICL_SUCCESS);
}
static void
{
char *value;
"========================= HW Revisions "
"=======================================\n\n"));
"System PROM revisions:\n"
"----------------------\n"));
}
"IO ASIC revisions:\n"
"------------------\n"
" Port\n"
"Model ID Status Version\n"
"-------- ---- ------ -------\n"));
}
static void
{
int *int_val;
int portid;
int revision;
#ifdef DEBUG
#endif
int pci_bus;
/*
* search this board node for all Schizos
*/
/*
* get the reg property to determine
* whether we are looking at side A or B
*/
int_val = (int *)get_prop_val
int_val ++; /* second integer in array */
}
/* get portid */
int_val = (int *)get_prop_val
continue;
/*
* If this is a new portid and it is PCI bus B,
* we skip onto the PCI bus A.
*/
/* status */
status_b = (char *)get_prop_val
#ifdef DEBUG
#endif
continue; /* skip to the next schizo */
}
/*
* This must be side A of the same Schizo.
* Gather all its props and display them.
*/
#ifdef DEBUG
#endif
int_val = (int *)get_prop_val
else
revision = -1;
(pnode, "status"));
revision);
#ifdef DEBUG
#endif
log_printf("\n");
}
}
}