daktari.c revision e79c98e6c943cb3032f272714ff4ce6137d40394
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or http://www.opensolaris.org/os/licensing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
a1837c6df940f4a4992df53cc52935596ced1b89srivijitha dugganapalli * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
33f5ff17089e3a43e6e730bf80384c233123dbd9Milan Jurik * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Daktari Platform specific functions.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * called when :
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * machine_type == MTYPE_DAKTARI
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#pragma ident "%Z%%M% %I% %E% SMI"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <stdio.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <stdlib.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <unistd.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <kstat.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <string.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <assert.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <libintl.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <note.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/openpromio.h>
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto#include <sys/sysmacros.h>
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto#include <sys/daktari.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto#include <pdevinfo.h>
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte#include <display.h>
7beff157537d14493d525a42d33f0621b0b26217John Forte#include <pdevinfo_sun4u.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <display_sun4u.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <libprtdiag.h>
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte#include <picl.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "workfile.c"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if !defined(TEXT_DOMAIN)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define TEXT_DOMAIN "SYS_TEST"
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto#endif
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto#define DAK_MAX_SLOTS_PER_IO_BD 9
fdcc480a6215c1e81d58d8e7af8c84fd6f1faa50John Forte#define DAK_MAX_DISKS 12
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto#define DAK_MAX_FSP_LEDS 2
fdcc480a6215c1e81d58d8e7af8c84fd6f1faa50John Forte#define DAK_MAX_PS 3
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DAK_MAX_PS_VOLTAGE_SENSORS 4
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DAK_MAX_PS_FAULT_SENSORS 3
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto#define DAK_MAX_FANS 10
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto#ifndef SCHIZO_COMPAT_PROP
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto#define SCHIZO_COMPAT_PROP "pci108e,8001"
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto#endif
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto#define MULTIPLE_BITS_SET(x) ((x)&((x)-1))
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetoextern int print_flag;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * these functions will overlay the symbol table of libprtdiag
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * at runtime (workgroup server systems only)
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto */
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetovoid display_cpu_devices(Sys_tree *tree);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid display_cpus(Board_node *board);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid display_pci(Board_node *board);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid display_io_cards(struct io_card *list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid display_diaginfo(int flag, Prom_node *root, Sys_tree *tree,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto struct system_kstat_data *kstats);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetovoid display_ffb(Board_node *board, int table);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetovoid display_memoryconf(Sys_tree *tree, struct grp_info *grps);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/* local functions */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestatic int disp_envc_status(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int dak_env_print_temps(picl_nodehdl_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int dak_env_print_keyswitch(picl_nodehdl_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int dak_env_print_FSP_LEDS(picl_nodehdl_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int dak_env_print_disk(picl_nodehdl_t);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetostatic int dak_env_print_fans(picl_nodehdl_t);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetostatic int dak_env_print_ps(picl_nodehdl_t);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetostatic void dak_display_hw_revisions(Prom_node *root,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto Board_node *bnode);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetostatic void display_schizo_revisions(Board_node *bdlist);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * Defining the error_check function in order to return the
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * appropriate error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*ARGSUSED0*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteerror_check(Sys_tree *tree, struct system_kstat_data *kstats)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int exit_code = 0; /* init to all OK */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * silently check for any types of machine errors
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_flag = 0;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (disp_fail_parts(tree)) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto /* set exit_code to show failures */
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto exit_code = 1;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto print_flag = 1;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto return (exit_code);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto}
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto/*
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * disp_fail_parts
7beff157537d14493d525a42d33f0621b0b26217John Forte *
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * Display the failed parts in the system. This function looks for
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * the status property in all PROM nodes. On systems where
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * the PROM does not support passing diagnostic information
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * through the device tree, this routine will be silent.
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto */
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetoint
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetodisp_fail_parts(Sys_tree *tree)
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto{
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto int exit_code = 0;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto int system_failed = 0;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto Board_node *bnode = tree->bd_list;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto Prom_node *pnode;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /* go through all of the boards looking for failed units. */
7beff157537d14493d525a42d33f0621b0b26217John Forte while (bnode != NULL) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto /* find failed chips */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte pnode = find_failed_node(bnode->nodes);
4b31676f89e318c11400fc0c4defc802da29222fsrivijitha dugganapalli if ((pnode != NULL) && !system_failed) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto system_failed = 1;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto exit_code = 1;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (print_flag == 0) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto return (exit_code);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, "Failed Field "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Replaceable Units (FRU) in System:\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("=========================="
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "====================\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (pnode != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void *value;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *name; /* node name string */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *type; /* node type string */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *board_type = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte value = get_prop_val(find_prop(pnode, "status"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte name = get_node_name(pnode);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* sanity check of data retrieved from PROM */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((value == NULL) || (name == NULL)) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto pnode = next_failed_node(pnode);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Find the board type of this board */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (bnode->board_type == CPU_BOARD) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte board_type = "CPU";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte board_type = "IO";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, "%s unavailable "
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "on %s Board #%d\n"), name, board_type,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto bnode->board_num);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte log_printf(dgettext(TEXT_DOMAIN,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "\tPROM fault string: %s\n"), value);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf(dgettext(TEXT_DOMAIN,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "\tFailed Field Replaceable Unit is "));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto /*
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * Determine whether FRU is CPU module, system
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * board, or SBus card.
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto */
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if ((name != NULL) && (strstr(name, "sbus"))) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf(dgettext(TEXT_DOMAIN,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "SBus Card %d\n"),
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto get_sbus_slot(pnode));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto } else if (((name = get_node_name(pnode->parent)) !=
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto NULL) && (strstr(name, "pci"))) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf(dgettext(TEXT_DOMAIN,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "PCI Card %d"),
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto get_pci_device(pnode));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto } else if (((type = get_node_type(pnode)) != NULL) &&
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto (strstr(type, "cpu"))) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte log_printf(dgettext(TEXT_DOMAIN, "UltraSPARC "
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte "module Board %d Module %d\n"), 0,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte get_id(pnode));
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte } else {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte log_printf(dgettext(TEXT_DOMAIN,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte "%s board %d\n"), board_type,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte bnode->board_num);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte pnode = next_failed_node(pnode);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte bnode = bnode->next;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (!system_failed) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte log_printf(dgettext(TEXT_DOMAIN,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte "No failures found in System\n"));
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte log_printf("===========================\n\n");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (system_failed)
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (1);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte else
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (0);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte}
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/*ARGSUSED*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_hp_fail_fault(Sys_tree *tree, struct system_kstat_data *kstats)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Display failed units */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) disp_fail_parts(tree);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*ARGSUSED*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_memoryconf(Sys_tree *tree, struct grp_info *grps)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Board_node *bnode = tree->bd_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "========================= Memory Configuration"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " ===============================\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\n Logical Logical"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Logical "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\n MC Bank Bank Bank"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " DIMM Interleave Interleaved"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\n Brd ID num size "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Status Size "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Factor with"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\n---- --- ---- ------ "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "----------- ------ "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "---------- -----------"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (bnode != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (get_us3_mem_regs(bnode)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\nFailed to get memory information.\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bnode = bnode->next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Display what we have found */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_us3_banks();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_cpu_devices(Sys_tree *tree)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Board_node *bnode;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Display the table header for CPUs . Then display the CPU
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * frequency, cache size, and processor revision of all cpus.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "========================="
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " CPUs "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "==============================================="
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Run E$ CPU CPU \n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Brd CPU MHz MB Impl. Mask \n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "--- ----- ---- ---- ------- ---- \n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Now display all of the cpus on each board */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bnode = tree->bd_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (bnode == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "CPU Board list was NULL\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (bnode != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_cpus(bnode);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bnode = bnode->next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Display the CPUs present on this board.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_cpus(Board_node *board)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Prom_node *cpu;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto uint_t freq; /* CPU clock frequency */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int ecache_size; /* External cache size */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int *l3_shares;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int *mid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int *impl;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int *mask;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int *coreid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char fru_prev = 'X'; /* Valid frus are 'A','B','C','D' */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int mid_prev;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int ecache_size_prev = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char fru_name;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * display the CPUs' operating frequency, cache size, impl. field
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and mask revision.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (cpu = dev_find_type(board->nodes, "cpu"); cpu != NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cpu = dev_next_type(cpu, "cpu")) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mid = (int *)get_prop_val(find_prop(cpu, "portid"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mid == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mid = (int *)get_prop_val(find_prop(cpu, "cpuid"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte freq = DAK_CLK_FREQ_TO_MHZ(get_cpu_freq(cpu));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ecache_size = get_ecache_size(cpu);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte impl = (int *)get_prop_val(find_prop(cpu, "implementation#"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mask = (int *)get_prop_val(find_prop(cpu, "mask#"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l3_shares = (int *)get_prop_val(find_prop(cpu,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "l3-cache-sharing"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Do not display a failed CPU node */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((impl == NULL) || (freq == 0) || (node_failed(cpu)))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto /* Board number */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fru_name = (char)('A' + DAK_GETSLOT(*mid));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (CPU_IMPL_IS_CMP(*impl)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte coreid = (int *)get_prop_val(find_prop(cpu, "reg"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (coreid == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((fru_prev == 'X') ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((fru_prev != 'X') &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (fru_name != fru_prev))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fru_prev = fru_name;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mid_prev = *mid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ecache_size_prev = ecache_size;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Some CMP chips have a split E$,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * so the size for both cores is added
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * together to get the total size for
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the chip.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Still, other CMP chips have E$ (L3)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * which is logically shared, so the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * total size is equal to the core size.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((l3_shares == NULL) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((l3_shares != NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MULTIPLE_BITS_SET(*l3_shares))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ecache_size += ecache_size_prev;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ecache_size_prev = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fru_prev = 'X';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
5c8cac22647b12e79982cf052e5df46dc7402bd5tim szeto log_printf("%2c", fru_name);
5c8cac22647b12e79982cf052e5df46dc7402bd5tim szeto
5c8cac22647b12e79982cf052e5df46dc7402bd5tim szeto /* CPU Module ID */
5c8cac22647b12e79982cf052e5df46dc7402bd5tim szeto if (CPU_IMPL_IS_CMP(*impl)) {
5c8cac22647b12e79982cf052e5df46dc7402bd5tim szeto log_printf("%3d,%3d", mid_prev, *mid, 0);
5c8cac22647b12e79982cf052e5df46dc7402bd5tim szeto } else
5c8cac22647b12e79982cf052e5df46dc7402bd5tim szeto log_printf(" %d ", *mid);
5c8cac22647b12e79982cf052e5df46dc7402bd5tim szeto
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Running frequency */
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf(" %4u ", freq);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Ecache size */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ecache_size == 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, "%3s "),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "N/A");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("%4.1f ",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (float)ecache_size / (float)(1<<20));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Implementation */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (impl == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, "%s "),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "N/A");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (IS_CHEETAH(*impl))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("%7s", "US-III ", 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (IS_CHEETAH_PLUS(*impl))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("%7s", "US-III+", 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (IS_JAGUAR(*impl))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("%7s", "US-IV ", 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (IS_PANTHER(*impl))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("%7s", "US-IV+ ", 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("%-7x", *impl, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* CPU Mask */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mask == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, " %3s "),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "N/A");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, " %2d.%d"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*mask >> 4) & 0xf, *mask & 0xf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf("\n");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto}
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto/*
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * display_pci
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * Display all the PCI IO cards on this board.
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto */
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetovoid
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetodisplay_pci(Board_node *board)
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto{
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto struct io_card *card_list = NULL;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto struct io_card card;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto void *value;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto Prom_node *pci;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Prom_node *card_node;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *slot_name_arr[DAK_MAX_SLOTS_PER_IO_BD] = {NULL};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef DEBUG
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int slot_name_bits;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (board == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte memset(&card, 0, sizeof (struct io_card));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Initialize all the common information */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte card.display = TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte card.board = board->board_num;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Search for each pci instance, then find/display all nodes under
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * each instance node found.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (pci = dev_find_node_by_compat(board->nodes, SCHIZO_COMPAT_PROP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pci != NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pci = dev_next_node_by_compat(pci, SCHIZO_COMPAT_PROP)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(card.bus_type, MAXSTRLEN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dgettext(TEXT_DOMAIN, "PCI"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get slot-name properties from parent node and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * store them in an array.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte value = (char *)get_prop_val(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte find_prop(pci, "slot-names"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (value != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef DEBUG
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* save the 4 byte bitmask */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte slot_name_bits = *(int *)value;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* array starts after first int */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte slot_name_arr[0] = (char *)value + sizeof (int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 1; i < DAK_MAX_SLOTS_PER_IO_BD; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte slot_name_arr[i] = (char *)slot_name_arr[i - 1]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte + strlen(slot_name_arr[i - 1]) +1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Search for Children of this node ie. Cards.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Note: any of these cards can be a pci-bridge
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * that itself has children. If we find a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * pci-bridge we need to handle it specially.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte card_node = pci->child;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Generate the list of pci cards on pci instance: pci */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fill_pci_card_list(pci, card_node, &card, &card_list,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte slot_name_arr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* end-for */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_io_cards(card_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free_io_cards(card_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto/*
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * Print out all the io cards in the list. Also print the column
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * headers if told to do so.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_io_cards(struct io_card *list)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte static int banner = 0; /* Have we printed the column headings? */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct io_card *p;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (list == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (banner == FALSE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Bus Max\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " IO Port Bus Freq Bus Dev,"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Brd Type ID Side Slot MHz Freq "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Func State Name "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Model\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* ---------Brd IO Port Bus Slot Bus Max Dev Stat */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "---- ---- ---- ---- ---- ---- ---- ----"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " ----- "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "-------------------------------- "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "----------------------\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte banner = TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (p = list; p != NULL; p = p -> next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, "I/O "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("%-4s ", p->bus_type);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("%-3d ", p->schizo_portid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("%c ", p->pci_bus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("%-1s ", p->slot_str);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("%-3d ", p->freq);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (p->pci_bus) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 'A':
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, " 66 "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 'B':
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, " 33 "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, " - "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("%-1d,%-1d ", p->dev_no, p->func_no);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("%-5s ", p->status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("%-32.32s", p->name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strlen(p->name) > 32)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, "+ "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, " "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("%-22.22s", p->model);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strlen(p->model) > 22)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, "+"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef DEBUG
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, "%s "), p->notes);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * display_ffb
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * There are no FFB's on a Daktari, however in the generic library,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the display_ffb() function is implemented so we have to define an
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * empty function here.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ARGSUSED */
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetovoid
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetodisplay_ffb(Board_node *board, int table)
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto{}
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ----------------------------------------------------------------------------
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ARGSUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_diaginfo(int flag, Prom_node *root, Sys_tree *tree,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct system_kstat_data *kstats)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* NOTE(ARGUNUSED(kstats)) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Now display the last powerfail time and the fatal hardware
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * reset information. We do this under a couple of conditions.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * First if the user asks for it. The second is if the user
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * told us to do logging, and we found a system failure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * display time of latest powerfail. Not all systems
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * have this capability. For those that do not, this
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * is just a no-op.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte disp_powerfail(root);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) disp_envc_status();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* platform_disp_prom_version(tree); */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dak_display_hw_revisions(root, tree->bd_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * local functions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * disp_envc_status
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This routine displays the environmental status passed up from
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * device drivers via the envlibobj.so library.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This is a Daktari specific environmental information display routine.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisp_envc_status()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int err;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *system = "SYSTEM";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte picl_nodehdl_t system_node, root;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = picl_initialize();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != PICL_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "picl_initialize failed\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s\nCannot display environmental status\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte picl_strerror(err));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = picl_get_root(&root);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = find_child_device(root, system, &system_node);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != PICL_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "picl_get_node_by_path for the SYSTEM node "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "failed\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s\nCannot display environmental status\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte picl_strerror(err));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "========================= "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Environmental Status "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "========================="
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dak_env_print_temps(system_node);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dak_env_print_keyswitch(system_node);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dak_env_print_FSP_LEDS(system_node);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dak_env_print_disk(system_node);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dak_env_print_fans(system_node);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dak_env_print_ps(system_node);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) picl_shutdown();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedak_env_print_ps(picl_nodehdl_t system_node)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i, r, fail, err = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t number;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char name[PICL_PROPNAMELEN_MAX];
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto picl_nodehdl_t *ps;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto picl_nodehdl_t *ps_fail[DAK_MAX_PS_FAULT_SENSORS];
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto picl_nodehdl_t *ps_I_sensor[DAK_MAX_PS_VOLTAGE_SENSORS];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t volts[DAK_MAX_PS_VOLTAGE_SENSORS];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char fault_state
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte [DAK_MAX_PS_FAULT_SENSORS][PICL_PROPNAMELEN_MAX];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char ps_state[PICL_PROPNAMELEN_MAX];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Printing out the Power Supply Heading information */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Power Supplies:\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "---------------\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Current Drain:\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Supply Status Fan Fail Temp Fail CS Fail "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "3.3V 5V 12V 48V\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "------ ------------ -------- --------- "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "------- ---- -- --- ---\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = fill_device_array_from_id(system_node, "PSVC_PS", &number,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &ps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != PICL_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "failed in fill_device_array_from_id for PS\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s\n"), picl_strerror(err));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Printing out the Power Supply Status information */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < DAK_MAX_PS; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Re initialize the fail variable so that if
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * one power supply fails, they don't all do also.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fail = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = picl_get_propval_by_name(ps[i], PICL_PROP_NAME, name,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PICL_PROPNAMELEN_MAX);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != PICL_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = picl_get_propval_by_name(ps[i], "State", ps_state,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PICL_PROPNAMELEN_MAX);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != PICL_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Error getting ps[%d]'s state: %s"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i, picl_strerror(err));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = fill_device_array_from_id(ps[i], "PSVC_DEV_FAULT_SENSOR",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &number, &ps_fail[i]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != PICL_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "failed to get present PS fault sensors\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s\n"), picl_strerror(err));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = fill_device_array_from_id(ps[i], "PSVC_PS_I_SENSOR",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &number, &ps_I_sensor[i]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err != PICL_SUCCESS) && (err != PICL_INVALIDHANDLE)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "failed to get present PS I sensors\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s\n"), picl_strerror(err));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("%s", name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If the AC cord is unplugged, then the power supply
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * sensors will have unreliable values. In this case,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * skip to the next power supply.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcmp(ps_state, "HOTPLUGGED") == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " UNPLUGGED\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (r = 0; r < DAK_MAX_PS_FAULT_SENSORS; r++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = picl_get_propval_by_name(ps_fail[i][r], "State",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fault_state[r], PICL_PROPNAMELEN_MAX);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err == PICL_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fail =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strcmp(fault_state[r], "OFF")
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte + fail;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "picl_get_propval_by_name for ps "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "fault state failed\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s\n"), picl_strerror(err));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (r = 0; r < DAK_MAX_PS_VOLTAGE_SENSORS; r++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = picl_get_propval_by_name(ps_I_sensor[i][r],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "AtoDSensorValue", &volts[r],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (int32_t));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (fail != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " FAIL "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (r = 0; r < DAK_MAX_PS_FAULT_SENSORS; r++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, " %-4s"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fault_state[r]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, " GOOD "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (r = 0; r < DAK_MAX_PS_FAULT_SENSORS; r++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, " "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (r = 0; r < DAK_MAX_PS_VOLTAGE_SENSORS; r++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, " %2d"), volts[r]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedak_env_print_fans(picl_nodehdl_t system_node)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i, err = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t number, fan_speed;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte picl_nodehdl_t *fans;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto char name[PICL_PROPNAMELEN_MAX];
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto char enabled[PICL_PROPNAMELEN_MAX];
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto err = fill_device_array_from_id(system_node, "PSVC_FAN", &number,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &fans);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != PICL_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "failed in fill_device_array_from_id "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "for FAN\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s\n"), picl_strerror(err));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "=================================\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, "Fan Bank :\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, "----------\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, "Bank Speed "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Status Fan State\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, " ( RPMS )"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " \n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, "---- --------"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " --------- ---------\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < DAK_MAX_FANS; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char fan_state[PICL_PROPNAMELEN_MAX];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fan_speed = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = picl_get_propval_by_name(fans[i], PICL_PROP_NAME, name,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PICL_PROPNAMELEN_MAX);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err == PICL_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, "%16-s"), name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = picl_get_propval_by_name(fans[i], "Fan-speed",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &fan_speed, sizeof (int32_t));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err != PICL_SUCCESS) && (err != PICL_INVALIDHANDLE)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "failed in picl_get_propval_by_name for "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "fan speed\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s\n"), picl_strerror(err));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((strcmp(name, "CPU0_PRIM_FAN") != 0) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (strcmp(name, "CPU1_PRIM_FAN") != 0)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = picl_get_propval_by_name(fans[i], "Fan-switch",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte enabled, PICL_PROPNAMELEN_MAX);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err != PICL_SUCCESS) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (err != PICL_INVALIDHANDLE)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "failed in picl_get_propval_by_name for"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " fan enabled/disabled\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s\n"), picl_strerror(err));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Display the fan's speed and whether or not
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * it's enabled.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcmp(enabled, "ON") == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\t %4d [ENABLED]"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fan_speed);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\t 0 [DISABLED]"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Display the fan's speed */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, "\t %4d"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fan_speed);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " [ENABLED]"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = picl_get_propval_by_name(fans[i], "State", fan_state,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PICL_PROPNAMELEN_MAX);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != PICL_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "picl_get_propval_by_name failed: %s"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte picl_strerror(err));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, "\t %s\n"), fan_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "=================================\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedak_env_print_disk(picl_nodehdl_t system_node)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i, err;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t number;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte picl_nodehdl_t *disks;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte picl_nodehdl_t disk_slots[DAK_MAX_DISKS];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte picl_nodehdl_t disk_fault_leds[DAK_MAX_DISKS];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte picl_nodehdl_t disk_remove_leds[DAK_MAX_DISKS];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char led_state[PICL_PROPNAMELEN_MAX];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char name[PICL_PROPNAMELEN_MAX];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = fill_device_array_from_id(system_node, "PSVC_DISK", &number,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto &disks);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != PICL_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "failed in fill_device_array_from_id for "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "DISK\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s\n"), picl_strerror(err));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Disk Status:\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " Presence Fault LED Remove LED\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < DAK_MAX_DISKS; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = picl_get_propval_by_name(disks[i], PICL_PROP_NAME, name,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PICL_PROPNAMELEN_MAX);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto switch (err) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto case PICL_SUCCESS:
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf(dgettext(TEXT_DOMAIN, "DISK %2d: [%7s]"),
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto i, "PRESENT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PICL_INVALIDHANDLE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, "DISK %2d: [%7s]"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i, "EMPTY");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Failed picl_get_propval_by_name for "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "disk %d with %s\n"), i, picl_strerror(err));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = fill_device_from_id(disks[i], "PSVC_PARENT",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &(disk_slots[i]));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (err) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PICL_SUCCESS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PICL_INVALIDHANDLE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "failed in fill_device_from_id for disk "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "slot\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s\n"), picl_strerror(err));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = fill_device_from_id(disk_slots[i], "PSVC_SLOT_FAULT_LED",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &disk_fault_leds[i]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != PICL_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "failed in fill_device_from_id for disk slot "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "fault led\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s\n"), picl_strerror(err));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = picl_get_propval_by_name(disk_fault_leds[i],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "State", led_state, PICL_PROPNAMELEN_MAX);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err == PICL_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, " [%3s]"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte led_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "picl_get_propval_by_name for fault led_state"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " failed\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s\n"), picl_strerror(err));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = fill_device_from_id(disk_slots[i], "PSVC_SLOT_REMOVE_LED",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &disk_remove_leds[i]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != PICL_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "failed in fill_device_from_id for disk slot "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "remove led\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s\n"), picl_strerror(err));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = picl_get_propval_by_name(disk_remove_leds[i],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "State", led_state, PICL_PROPNAMELEN_MAX);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err == PICL_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " [%3s]"), led_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "picl_get_propval_by_name for remove"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " led_state failed\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s\n"), picl_strerror(err));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf("\n");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto return (err);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedak_env_print_FSP_LEDS(picl_nodehdl_t system_node)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i, err = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t number;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte picl_nodehdl_t *fsp_leds;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char led_state[PICL_PROPNAMELEN_MAX];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = fill_device_array_from_id(system_node, "PSVC_FSP_LED", &number,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &fsp_leds);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != PICL_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "failed in fill_device_array_from_id for "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "FSP_LED\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s\n"), picl_strerror(err));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "System LED Status:\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " GEN FAULT REMOVE\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < DAK_MAX_FSP_LEDS; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = picl_get_propval_by_name(fsp_leds[i], "State",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte led_state, PICL_PROPNAMELEN_MAX);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != PICL_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "picl_get_propval_by_name for led_state"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " failed\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s\n"), picl_strerror(err));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " [%3s]"), led_state);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf("\n\n");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf(dgettext(TEXT_DOMAIN,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto " DISK FAULT "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN, "POWER FAULT\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 2; i < 4; i++) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto err = picl_get_propval_by_name(fsp_leds[i], "State",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte led_state, PICL_PROPNAMELEN_MAX);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (err != PICL_SUCCESS) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "picl_get_propval_by_name for led_state"
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto " failed\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s\n"), picl_strerror(err));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf(dgettext(TEXT_DOMAIN, " [%3s]"),
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto led_state);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf("\n\n");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " LEFT THERMAL FAULT "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "RIGHT THERMAL FAULT\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 4; i < 6; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = picl_get_propval_by_name(fsp_leds[i], "State",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte led_state, PICL_PROPNAMELEN_MAX);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != PICL_SUCCESS) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "picl_get_propval_by_name for led_state "
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "failed\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s\n"), picl_strerror(err));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto return (err);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf(dgettext(TEXT_DOMAIN, " [%3s]"),
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto led_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("\n\n");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " LEFT DOOR "
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "RIGHT DOOR\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 6; i < 8; i++) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto err = picl_get_propval_by_name(fsp_leds[i], "State",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte led_state, PICL_PROPNAMELEN_MAX);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err != PICL_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "picl_get_propval_by_name for led_state"
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto " failed\n"
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "%s\n"), picl_strerror(err));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf(dgettext(TEXT_DOMAIN, " [%3s]"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte led_state);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("\n\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "=================================\n"));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf("\n");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto return (err);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto}
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetoint
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetodak_env_print_keyswitch(picl_nodehdl_t system_node)
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto{
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto int err = 0;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto picl_nodehdl_t *keyswitch;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto int32_t number;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto char ks_pos[PICL_PROPNAMELEN_MAX];
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto err = fill_device_array_from_id(system_node, "PSVC_KEYSWITCH", &number,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto &keyswitch);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (err != PICL_SUCCESS) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf(dgettext(TEXT_DOMAIN,
2f624233c43c1f4fe0d930648d6ece6fffe7aa49Nattuvetty Bhavyan "failed in fill_device_array_from_id for "
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto " PSVC_KEYSWITCH\n"
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "%s\n"), picl_strerror(err));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto return (err);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto err = picl_get_propval_by_name(keyswitch[0], "State", ks_pos,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto PICL_PROPNAMELEN_MAX);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (err != PICL_SUCCESS) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf(dgettext(TEXT_DOMAIN,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "picl_get_propval_by_name for keyswitch state "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "failed\n"
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "%s\n"), picl_strerror(err));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf(dgettext(TEXT_DOMAIN,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "Front Status Panel:\n"
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "-------------------\n"
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "Keyswitch position: "
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "%s\n"), ks_pos);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf("\n");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto return (err);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto}
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetoint
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetodak_env_print_temps(picl_nodehdl_t system_node)
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto{
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto int i;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto int err;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto picl_nodehdl_t *system_ts_nodes;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto int32_t temp;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto int32_t number;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto char label[PICL_PROPNAMELEN_MAX];
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto char state[PICL_PROPNAMELEN_MAX];
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto char *p;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto err = fill_device_array_from_id(system_node, "PSVC_TS", &number,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto &system_ts_nodes);
2f624233c43c1f4fe0d930648d6ece6fffe7aa49Nattuvetty Bhavyan if (err != PICL_SUCCESS) {
2f624233c43c1f4fe0d930648d6ece6fffe7aa49Nattuvetty Bhavyan return (err);
2f624233c43c1f4fe0d930648d6ece6fffe7aa49Nattuvetty Bhavyan }
2f624233c43c1f4fe0d930648d6ece6fffe7aa49Nattuvetty Bhavyan
2f624233c43c1f4fe0d930648d6ece6fffe7aa49Nattuvetty Bhavyan log_printf(dgettext(TEXT_DOMAIN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "System Temperatures (Celsius):\n"
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "-------------------------------\n"
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "Device\t\tTemperature\tStatus\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "---------------------------------------\n"));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto for (i = 0; i < number; i++) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto err = picl_get_propval_by_name(system_ts_nodes[i],
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "State", state, sizeof (state));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (err != PICL_SUCCESS) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (err == PICL_INVALIDHANDLE) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto strcpy(state, "n/a");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto } else {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf("%s\n", picl_strerror(err));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto return (err);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto err = picl_get_propval_by_name(system_ts_nodes[i],
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto PICL_PROP_NAME, label, PICL_PROPNAMELEN_MAX);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (err != PICL_SUCCESS) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (err == PICL_INVALIDHANDLE)
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto /* This FRU isn't present. Skip it. */
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto continue;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf("%s\n", picl_strerror(err));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto return (err);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto /*
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * The names in the tree are like "CPU0_DIE_TEMPERATURE_SENSOR".
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * All we want to print is up to the first underscore.
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto */
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto p = strchr(label, '_');
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (p != NULL)
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto *p = '\0';
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto err = picl_get_propval_by_name(system_ts_nodes[i],
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "Temperature", &temp, sizeof (temp));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (err != PICL_SUCCESS) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf("%s\n", picl_strerror(err));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto return (err);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf("%s\t\t%3d\t\t%s\n", label, temp, state);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf(dgettext(TEXT_DOMAIN,
2f624233c43c1f4fe0d930648d6ece6fffe7aa49Nattuvetty Bhavyan "\n=================================\n\n"));
2f624233c43c1f4fe0d930648d6ece6fffe7aa49Nattuvetty Bhavyan
2f624233c43c1f4fe0d930648d6ece6fffe7aa49Nattuvetty Bhavyan return (PICL_SUCCESS);
2f624233c43c1f4fe0d930648d6ece6fffe7aa49Nattuvetty Bhavyan}
2f624233c43c1f4fe0d930648d6ece6fffe7aa49Nattuvetty Bhavyan
2f624233c43c1f4fe0d930648d6ece6fffe7aa49Nattuvetty Bhavyanstatic void
2f624233c43c1f4fe0d930648d6ece6fffe7aa49Nattuvetty Bhavyandak_display_hw_revisions(Prom_node *root, Board_node *bdlist)
2f624233c43c1f4fe0d930648d6ece6fffe7aa49Nattuvetty Bhavyan{
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto Prom_node *pnode;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto char *value;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf(dgettext(TEXT_DOMAIN, "\n"
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "========================= HW Revisions "
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "=======================================\n\n"));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf(dgettext(TEXT_DOMAIN,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "System PROM revisions:\n"
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "----------------------\n"));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto pnode = dev_find_node(root, "openprom");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (pnode != NULL) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto value = (char *)get_prop_val(find_prop(pnode, "version"));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf(value);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf(dgettext(TEXT_DOMAIN, "\n\n"
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "IO ASIC revisions:\n"
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "------------------\n"
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto " Port\n"
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "Model ID Status Version\n"
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "-------- ---- ------ -------\n"));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto display_schizo_revisions(bdlist);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto}
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetostatic void
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetodisplay_schizo_revisions(Board_node *bdlist)
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto{
fdcc480a6215c1e81d58d8e7af8c84fd6f1faa50John Forte Prom_node *pnode;
fdcc480a6215c1e81d58d8e7af8c84fd6f1faa50John Forte int *int_val;
fdcc480a6215c1e81d58d8e7af8c84fd6f1faa50John Forte int portid;
fdcc480a6215c1e81d58d8e7af8c84fd6f1faa50John Forte int prev_portid = -1;
fdcc480a6215c1e81d58d8e7af8c84fd6f1faa50John Forte char *status_a = NULL;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto char *status_b = NULL;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto int revision;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto#ifdef DEBUG
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto uint32_t a_notes, b_notes;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto#endif
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto int pci_bus;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto Board_node *bnode;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto bnode = bdlist;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto while (bnode != NULL) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto /*
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * search this board node for all Schizos
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto */
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto for (pnode = dev_find_node_by_compat(bnode->nodes,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto SCHIZO_COMPAT_PROP); pnode != NULL;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto pnode = dev_next_node_by_compat(pnode,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto SCHIZO_COMPAT_PROP)) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto /*
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * get the reg property to determine
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * whether we are looking at side A or B
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto */
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto int_val = (int *)get_prop_val
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto (find_prop(pnode, "reg"));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (int_val != NULL) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto int_val ++; /* second integer in array */
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto pci_bus = ((*int_val) & 0x7f0000);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto /* get portid */
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto int_val = (int *)get_prop_val
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto (find_prop(pnode, "portid"));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (int_val == NULL)
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto continue;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto portid = *int_val;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto /*
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * If this is a new portid and it is PCI bus B,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * we skip onto the PCI bus A.
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto */
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if ((portid != prev_portid) && (pci_bus == 0x700000)) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto prev_portid = portid;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto /* status */
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto status_b = (char *)get_prop_val
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto (find_prop(pnode, "status"));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto#ifdef DEBUG
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto b_notes = pci_bus;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue; /* skip to the next schizo */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto /*
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * This must be side A of the same Schizo.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gather all its props and display them.
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto */
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto#ifdef DEBUG
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto a_notes = pci_bus;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto prev_portid = portid;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto int_val = (int *)get_prop_val
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto (find_prop(pnode, "version#"));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (int_val != NULL)
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto revision = *int_val;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto revision = -1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status_a = (char *)get_prop_val(find_prop
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (pnode, "status"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf(dgettext(TEXT_DOMAIN, "Schizo "));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf(dgettext(TEXT_DOMAIN, "%-3d "), portid, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf((status_a == NULL && status_b == NULL) ?
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto dgettext(TEXT_DOMAIN, " ok ") :
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto dgettext(TEXT_DOMAIN, " fail "));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf(dgettext(TEXT_DOMAIN, " %4d "),
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto revision);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto#ifdef DEBUG
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto log_printf(" 0x%x 0x%x", a_notes, b_notes);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte log_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto bnode = bnode->next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte