03831d35f7499c87d51205817c93e9a8d42c4baestevel * CDDL HEADER START
03831d35f7499c87d51205817c93e9a8d42c4baestevel * The contents of this file are subject to the terms of the
2983dda76a6d296fdb560c88114fe41caad1b84fMichael Bergknoff * Common Development and Distribution License (the "License").
2983dda76a6d296fdb560c88114fe41caad1b84fMichael Bergknoff * You may not use this file except in compliance with the License.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
03831d35f7499c87d51205817c93e9a8d42c4baestevel * See the License for the specific language governing permissions
03831d35f7499c87d51205817c93e9a8d42c4baestevel * and limitations under the License.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * When distributing Covered Code, include this CDDL HEADER in each
03831d35f7499c87d51205817c93e9a8d42c4baestevel * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * If applicable, add the following below this CDDL HEADER, with the
03831d35f7499c87d51205817c93e9a8d42c4baestevel * fields enclosed by brackets "[]" replaced with your own identifying
03831d35f7499c87d51205817c93e9a8d42c4baestevel * information: Portions Copyright [yyyy] [name of copyright owner]
03831d35f7499c87d51205817c93e9a8d42c4baestevel * CDDL HEADER END
2983dda76a6d296fdb560c88114fe41caad1b84fMichael Bergknoff * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * This program prints the diagnostics of Sanibel system. It
03831d35f7499c87d51205817c93e9a8d42c4baestevel * also prints other miscellaneous information about watchdog, temperature
03831d35f7499c87d51205817c93e9a8d42c4baestevel * of CPU sensor, firmware versions of SMC and, micro controller role
03831d35f7499c87d51205817c93e9a8d42c4baestevel * etc. The basic sources of output is PICL, and SMC.
03831d35f7499c87d51205817c93e9a8d42c4baestevel/* includes */
03831d35f7499c87d51205817c93e9a8d42c4baestevel/* #defines for the PICL library API usage and local static variables */
03831d35f7499c87d51205817c93e9a8d42c4baestevel/* #defines for the SMC and IPMI commands */
03831d35f7499c87d51205817c93e9a8d42c4baestevel/* SMC driver */
03831d35f7499c87d51205817c93e9a8d42c4baestevel/* Constants */
03831d35f7499c87d51205817c93e9a8d42c4baestevel/* #defines for local usage */
03831d35f7499c87d51205817c93e9a8d42c4baestevel/* static global variables */
03831d35f7499c87d51205817c93e9a8d42c4baestevel/* function declarations used in this program */
03831d35f7499c87d51205817c93e9a8d42c4baestevelint do_prominfo(int syserrlog, char *pname, int log_flag, int prt_flag);
03831d35f7499c87d51205817c93e9a8d42c4baestevelstatic uint32_t pd_prt_cpci_condition(picl_nodehdl_t nodeh);
03831d35f7499c87d51205817c93e9a8d42c4baestevelstatic uint32_t pd_check_location_parent(picl_nodehdl_t nodeh);
03831d35f7499c87d51205817c93e9a8d42c4baestevelpicldiag_get_uint_propval(picl_nodehdl_t modh, char *prop_name, int *ret);
03831d35f7499c87d51205817c93e9a8d42c4baestevelstatic int picldiag_get_clock_freq(picl_nodehdl_t modh, uint32_t *freq);
03831d35f7499c87d51205817c93e9a8d42c4baestevelstatic int display_system_clock(picl_nodehdl_t plafh);
03831d35f7499c87d51205817c93e9a8d42c4baestevel * return the value of the uint prop
03831d35f7499c87d51205817c93e9a8d42c4baestevelpicldiag_get_uint_propval(picl_nodehdl_t modh, char *prop_name, int *ret)
03831d35f7499c87d51205817c93e9a8d42c4baestevel err = picl_get_propinfo_by_name(modh, prop_name, &pinfo, &proph);
03831d35f7499c87d51205817c93e9a8d42c4baestevel return (0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel * If it is not an int or uint prop, return failure
2983dda76a6d296fdb560c88114fe41caad1b84fMichael Bergknoff (pinfo.type != PICL_PTYPE_UNSIGNED_INT)) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel return (0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* uint prop */
03831d35f7499c87d51205817c93e9a8d42c4baestevel case sizeof (uint8_t):
03831d35f7499c87d51205817c93e9a8d42c4baestevel err = picl_get_propval(proph, &uint8v, sizeof (uint8v));
03831d35f7499c87d51205817c93e9a8d42c4baestevel case sizeof (uint16_t):
03831d35f7499c87d51205817c93e9a8d42c4baestevel err = picl_get_propval(proph, &uint16v, sizeof (uint16v));
03831d35f7499c87d51205817c93e9a8d42c4baestevel case sizeof (uint32_t):
03831d35f7499c87d51205817c93e9a8d42c4baestevel err = picl_get_propval(proph, &uint32v, sizeof (uint32v));
03831d35f7499c87d51205817c93e9a8d42c4baestevel case sizeof (uint64_t):
03831d35f7499c87d51205817c93e9a8d42c4baestevel err = picl_get_propval(proph, &uint64v, sizeof (uint64v));
03831d35f7499c87d51205817c93e9a8d42c4baestevel default: /* not supported size */
03831d35f7499c87d51205817c93e9a8d42c4baestevel return (0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel * get the clock frequency
03831d35f7499c87d51205817c93e9a8d42c4baestevelpicldiag_get_clock_freq(picl_nodehdl_t modh, uint32_t *freq)
03831d35f7499c87d51205817c93e9a8d42c4baestevel clk_freq = picldiag_get_uint_propval(modh, OBP_PROP_CLOCK_FREQ, &err);
03831d35f7499c87d51205817c93e9a8d42c4baestevel * display the clock frequency
2983dda76a6d296fdb560c88114fe41caad1b84fMichael Bergknoff "System clock frequency: %d MHZ\n"), system_clk);
03831d35f7499c87d51205817c93e9a8d42c4baestevel * get the value by the property name of the string prop
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Caller must free the outbuf
03831d35f7499c87d51205817c93e9a8d42c4baestevelpicldiag_get_string_propval(picl_nodehdl_t modh, char *prop_name, char **outbuf)
03831d35f7499c87d51205817c93e9a8d42c4baestevel err = picl_get_propinfo_by_name(modh, prop_name, &pinfo, &proph);
03831d35f7499c87d51205817c93e9a8d42c4baestevel * If it is not a string prop, return NULL
03831d35f7499c87d51205817c93e9a8d42c4baestevel err = picl_get_propval(proph, prop_value, pinfo.size);
03831d35f7499c87d51205817c93e9a8d42c4baestevel * display platform banner
03831d35f7499c87d51205817c93e9a8d42c4baestevel * get PICL_PROP_MACHINE and PICL_PROP_BANNER_NAME
2983dda76a6d296fdb560c88114fe41caad1b84fMichael Bergknoff "System Configuration: Oracle Corporation "), 0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel err = picldiag_get_string_propval(plafh, PICL_PROP_MACHINE,
03831d35f7499c87d51205817c93e9a8d42c4baestevel err = picldiag_get_string_propval(plafh, OBP_PROP_BANNER_NAME,
03831d35f7499c87d51205817c93e9a8d42c4baestevel * search children to get the node by the nodename
03831d35f7499c87d51205817c93e9a8d42c4baestevelpicldiag_get_node_by_name(picl_nodehdl_t rooth, char *name,
03831d35f7499c87d51205817c93e9a8d42c4baestevel err = picl_get_propval_by_name(rooth, PICL_PROP_CHILD, &childh,
03831d35f7499c87d51205817c93e9a8d42c4baestevel err = picl_get_propval_by_name(childh, PICL_PROP_NAME,
03831d35f7499c87d51205817c93e9a8d42c4baestevel err = picl_get_propval_by_name(childh, PICL_PROP_PEER,
03831d35f7499c87d51205817c93e9a8d42c4baestevel err = picl_get_propval_by_name(childh, PICL_PROP_PEER,
03831d35f7499c87d51205817c93e9a8d42c4baestevel * This routine is invoked when prtdiag starts execution. It prints
03831d35f7499c87d51205817c93e9a8d42c4baestevel * system configuration, memory size, initializes PICL and acts as
03831d35f7499c87d51205817c93e9a8d42c4baestevel * a driver routine for prtdiag output for Snowbird.
03831d35f7499c87d51205817c93e9a8d42c4baestevel/* ARGSUSED */
03831d35f7499c87d51205817c93e9a8d42c4baesteveldo_prominfo(int syserrlog, char *pname, int log_flag, int prt_flag)
03831d35f7499c87d51205817c93e9a8d42c4baestevel struct mem_total memory_total; /* total memory in system */
03831d35f7499c87d51205817c93e9a8d42c4baestevel log_printf("prtdiag: failed to initialize the PICL\n", 0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ((status = picl_get_root(&rooth)) != PICL_SUCCESS) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel status = picldiag_get_node_by_name(rooth, PICL_NODE_PLATFORM, &plafh);
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* display the memory Size */
03831d35f7499c87d51205817c93e9a8d42c4baestevel display_memorysize(tree, kstats, &grps, &memory_total);
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ((pd_smc_fd = open(PD_SMC_DRV_PATH, O_RDWR)) == -1)
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ((status = pd_check_for_snowbird()) != PD_SUCCESS)
03831d35f7499c87d51205817c93e9a8d42c4baestevel * This routine prints out the platform name.
03831d35f7499c87d51205817c93e9a8d42c4baestevel if (sysinfo(SI_PLATFORM, si_platform, sizeof (si_platform)) == -1) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* is it a Snowbird? */
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Driver routine for satellite specific output. This is also used by
03831d35f7499c87d51205817c93e9a8d42c4baestevel * host driver routine as all satellite information is printed by host.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * It also prints some host specific information for formatting purposes
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ((status = pd_check_cpu_health()) != PD_SUCCESS) {
2983dda76a6d296fdb560c88114fe41caad1b84fMichael Bergknoff "\n %11s Other Miscellaneous Information \n",
2983dda76a6d296fdb560c88114fe41caad1b84fMichael Bergknoff "%12s ------------------------------- \n",
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ((status = pd_get_role_information()) != PD_SUCCESS) {
2983dda76a6d296fdb560c88114fe41caad1b84fMichael Bergknoff "IPMI Response Notification\t\tEnabled\n", 0);
2983dda76a6d296fdb560c88114fe41caad1b84fMichael Bergknoff "IPMI Response Notification\t\tDisabled\n", 0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ((status = pd_query_SMC_firmware_version()) != PD_SUCCESS) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ((status = pd_check_tty_debug_mode()) != PD_SUCCESS) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ((status = pd_get_message_flags()) != PD_SUCCESS) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ((status = pd_query_watchdog_state()) != PD_SUCCESS) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ((status = pd_get_sensor_reading()) != PD_SUCCESS) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ((status = pd_get_sensor_threshold()) != PD_SUCCESS) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel * This routine prints the mode in which SMC is running. It uses the
03831d35f7499c87d51205817c93e9a8d42c4baestevel * response from SMC global enables to determine the mode
03831d35f7499c87d51205817c93e9a8d42c4baestevel/* This routine prints SMC f/w version */
03831d35f7499c87d51205817c93e9a8d42c4baestevel smc_init_smc_msg(&req_pkt, SMC_QUERY_FIRMWARE_VERSION,
03831d35f7499c87d51205817c93e9a8d42c4baestevel log_printf("SMC f/w version is\t\t\t%d.%d.%d\n", ver, rev, bldrev, 0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel * This routine checks CPU's health by using SMC self test results command
03831d35f7499c87d51205817c93e9a8d42c4baestevel * It acts as driver routine for printing cPCI slot information
03831d35f7499c87d51205817c93e9a8d42c4baestevel smc_init_smc_msg(&req_pkt, SMC_GET_SMC_SELF_TEST_RESULT,
03831d35f7499c87d51205817c93e9a8d42c4baestevel * This routine decodes error message for CPU failures and prints details
03831d35f7499c87d51205817c93e9a8d42c4baestevel * of the failure
03831d35f7499c87d51205817c93e9a8d42c4baestevel * This routine walks PICL tree by "Location" class and calls prt_slot_info
03831d35f7499c87d51205817c93e9a8d42c4baestevel * routine to print the slot information
03831d35f7499c87d51205817c93e9a8d42c4baestevel/*ARGSUSED*/
03831d35f7499c87d51205817c93e9a8d42c4baestevel if (picl_walk_tree_by_class(nodeh, PICL_CLASS_LOCATION,
2983dda76a6d296fdb560c88114fe41caad1b84fMichael Bergknoff (void *)c_args, pd_prt_slot_info) != PICL_SUCCESS) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel/*ARGSUSED*/
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* if not immediate child of "chassis" node, ignore it */
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* get the label on the location */
03831d35f7499c87d51205817c93e9a8d42c4baestevel if (picl_get_propinfo(proph, &propinfo) != PICL_SUCCESS)
03831d35f7499c87d51205817c93e9a8d42c4baestevel valbuf = (char *) malloc(sizeof (char) * (propinfo.size));
03831d35f7499c87d51205817c93e9a8d42c4baestevel if (picl_get_propval(proph, (void *)valbuf, propinfo.size)
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* get the slot type for the location */
03831d35f7499c87d51205817c93e9a8d42c4baestevel if (picl_get_prop_by_name(nodeh, PICL_PROP_SLOT_TYPE,
03831d35f7499c87d51205817c93e9a8d42c4baestevel if (picl_get_propinfo(proph, & propinfo) != PICL_SUCCESS)
03831d35f7499c87d51205817c93e9a8d42c4baestevel valbuf = (char *) malloc(sizeof (char) * (propinfo.size));
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* For Snowbird no unit number is present on the label */
2983dda76a6d296fdb560c88114fe41caad1b84fMichael Bergknoff &childh, sizeof (childh)) == PICL_SUCCESS) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* For Snowbird auto configuration is always enabled */
03831d35f7499c87d51205817c93e9a8d42c4baestevel log_printf("%31s auto-config = enabled\n", PD_BLANK, 0);
2983dda76a6d296fdb560c88114fe41caad1b84fMichael Bergknoff "\n %19s FRU Information \n",
2983dda76a6d296fdb560c88114fe41caad1b84fMichael Bergknoff "%11s ------------------------------------------------\n",
2983dda76a6d296fdb560c88114fe41caad1b84fMichael Bergknoff "FRU FRU FRU Miscellaneous\n"), 0);
2983dda76a6d296fdb560c88114fe41caad1b84fMichael Bergknoff "Type Unit# Present Information\n"), 0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel log_printf(" --------------------------------\n", 0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel if (picl_get_propval_by_name(nodeh, PICL_PROP_PARENT,
2983dda76a6d296fdb560c88114fe41caad1b84fMichael Bergknoff &parenth, sizeof (parenth)) != PICL_SUCCESS) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel prop_name = (char *) malloc(sizeof (char) * PICL_PROPNAMELEN_MAX);
03831d35f7499c87d51205817c93e9a8d42c4baestevel if (picl_get_propval_by_name(parenth, PICL_PROP_NAME, (void *)prop_name,
03831d35f7499c87d51205817c93e9a8d42c4baestevel/*ARGSUSED*/
03831d35f7499c87d51205817c93e9a8d42c4baestevel if (picl_walk_tree_by_class(nodehandle, PICL_CLASS_WATCHDOG_TIMER,
2983dda76a6d296fdb560c88114fe41caad1b84fMichael Bergknoff (void *)c_args, pd_check_wd_state) != PICL_SUCCESS)
03831d35f7499c87d51205817c93e9a8d42c4baestevel/*ARGSUSED*/
03831d35f7499c87d51205817c93e9a8d42c4baestevel prop_name = (char *) malloc(sizeof (char) * PICL_PROPNAMELEN_MAX);
2983dda76a6d296fdb560c88114fe41caad1b84fMichael Bergknoff (void *)prop_name, PICL_PROPNAMELEN_MAX) != PICL_SUCCESS) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ((picl_get_propinfo(proph, &propinfo)) != PICL_SUCCESS) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel valbuf = (char *) malloc(sizeof (char) * (propinfo.size));
2983dda76a6d296fdb560c88114fe41caad1b84fMichael Bergknoff "UltraSPARC Host Role\t\t\t"), 0);
2983dda76a6d296fdb560c88114fe41caad1b84fMichael Bergknoff "System Board Computer (SBC)\n"), 0);
2983dda76a6d296fdb560c88114fe41caad1b84fMichael Bergknoff "Standby System Board Computer (Standby SBC)\n"), 0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel "Alternate System Board Computer (Alternate SBC)\n"), 0);
2983dda76a6d296fdb560c88114fe41caad1b84fMichael Bergknoff "Satellite Board Computer (SAT)\n"), 0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel log_printf("Messages Available in queue Recieving\n", 0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel log_printf("No messages in queue for Recieving\n", 0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel log_printf("Reset Mode\t\t\t\t%x \n", rsp_pkt.data[2], 0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel log_printf("\nCPU Node Temperature Information\n", PD_BLANK, 0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel log_printf("--------------------------------\n", PD_BLANK, 0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel log_printf("Temperature Reading: %d\n\n", rsp_pkt.data[0], 0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel log_printf("High Power-Off Threshold %9s", PD_BLANK, 0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel log_printf("High Shutdown Threshold %10s", PD_BLANK, 0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel log_printf("High Warning Threshold %11s", PD_BLANK, 0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel log_printf("Low Power Off Threshold %10s", PD_BLANK, 0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel log_printf("Low Shutdown Threshold %11s", PD_BLANK, 0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel log_printf("Low Warning Threshold %12s", PD_BLANK, 0);
03831d35f7499c87d51205817c93e9a8d42c4baestevel if (picl_get_prop_by_name(nodeh, PICL_PROP_CONDITION,
03831d35f7499c87d51205817c93e9a8d42c4baestevel if (picl_get_propinfo(proph, &propinfo) != PICL_SUCCESS) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel valbuf = (char *) malloc(sizeof (char) * (propinfo.size));
03831d35f7499c87d51205817c93e9a8d42c4baestevel log_printf("%29s Condition : %s\n", PD_BLANK, valbuf, 0);