51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * CDDL HEADER START
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * The contents of this file are subject to the terms of the
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * Common Development and Distribution License (the "License").
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * You may not use this file except in compliance with the License.
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * See the License for the specific language governing permissions
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * and limitations under the License.
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * When distributing Covered Code, include this CDDL HEADER in each
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * If applicable, add the following below this CDDL HEADER, with the
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * fields enclosed by brackets "[]" replaced with your own identifying
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * information: Portions Copyright [yyyy] [name of copyright owner]
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * CDDL HEADER END
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * Use is subject to license terms.
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * Sun4v Platform specific functions.
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * called when :
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * machine_type == monza
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter#pragma ident "%Z%%M% %I% %E% SMI"
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * These functions will overlay the symbol table of libprtdiag
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * at runtime
51b564aca190d2a430104dded1983d3a1fff66e2mcwaltervoid sun4v_display_diaginfo(int flag, Prom_node *root, picl_nodehdl_t plafh);
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * local functions
51b564aca190d2a430104dded1983d3a1fff66e2mcwalterstatic void sun4v_display_hw_revisions(Prom_node *root, picl_nodehdl_t plafh);
51b564aca190d2a430104dded1983d3a1fff66e2mcwalterstatic int monza_pci_callback(picl_nodehdl_t pcih, void *args);
51b564aca190d2a430104dded1983d3a1fff66e2mcwalterstatic int monza_get_first_compatible_value(picl_nodehdl_t nodeh,
51b564aca190d2a430104dded1983d3a1fff66e2mcwalterstatic int64_t monza_get_int_propval(picl_nodehdl_t modh, char *prop_name,
51b564aca190d2a430104dded1983d3a1fff66e2mcwaltermonza_get_bus_type(char *path, struct io_card *card)
51b564aca190d2a430104dded1983d3a1fff66e2mcwaltermonza_get_slot_number(char *path, struct io_card *card)
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter if (strncmp(path, MONZA_NETWORK_0, strlen(MONZA_NETWORK_0)) == 0) {
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter return (0);
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter } else if (strncmp(path, MONZA_NETWORK_1, strlen(MONZA_NETWORK_1))
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter return (1);
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter } else if (strncmp(path, MONZA_NETWORK_2, strlen(MONZA_NETWORK_2))
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter return (2);
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter } else if (strncmp(path, MONZA_ENET_2, strlen(MONZA_ENET_2))
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter return (2);
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter } else if (strncmp(path, MONZA_NETWORK_3, strlen(MONZA_NETWORK_3))
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter return (3);
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter } else if (strncmp(path, MONZA_ENET_3, strlen(MONZA_ENET_3))
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter return (3);
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter } else if (strncmp(path, MONZA_NETWORK_4, strlen(MONZA_NETWORK_4))
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter return (4);
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter } else if (strncmp(path, MONZA_NETWORK_5, strlen(MONZA_NETWORK_5))
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter return (5);
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter } else if (strncmp(path, MONZA_N2_XAUI0, strlen(MONZA_N2_XAUI0))
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter return (0);
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter } else if (strncmp(path, MONZA_N2_XAUI1, strlen(MONZA_N2_XAUI1))
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter return (1);
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter return (-1);
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * add all io devices under pci in io list
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter/* ARGSUSED */
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter err = picl_get_propval_by_name(pcih, PICL_PROP_DEVFS_PATH, parent_path,
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * Walk through the children
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter err = picl_get_propval_by_name(pcih, PICL_PROP_CHILD, &nodeh,
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter err = picl_get_propval_by_name(nodeh, PICL_PROP_CLASSNAME,
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * Skip PCI and PCIEX devices because they will be processed
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * later in the picl tree walk.
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter err = picl_get_propval_by_name(nodeh, PICL_PROP_PEER,
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter err = picl_get_propval_by_name(nodeh, PICL_PROP_DEVFS_PATH,
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter (void) strlcpy(pci_card.notes, path, sizeof (pci_card.notes));
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter err = picl_get_propval_by_name(nodeh, PICL_PROP_NAME, &name,
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter err = picl_get_propval_by_name(nodeh, PICL_PROP_NAME, &name,
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter /* Figure NAC name */
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * Get the name of this card. If binding_name is found,
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * name will be <nodename>-<binding_name>
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter err = picl_get_propval_by_name(nodeh, PICL_PROP_BINDING_NAME,
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * if compatible prop is found, name will be
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * <nodename>-<compatible>
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter (void) strlcpy(pci_card.name, name, sizeof (pci_card.name));
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter /* Get the model of this card */
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter err = picl_get_propval_by_name(nodeh, OBP_PROP_MODEL,
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter (void) strlcpy(pci_card.model, model, sizeof (pci_card.model));
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter /* Print NAC name */
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter /* Print IO Type */
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter /* Print Slot # */
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter /* Print Parent Path */
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter /* Printf Card Name */
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter /* Print Card Model */
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter err = picl_get_propval_by_name(nodeh, PICL_PROP_PEER, &nodeh,
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * display_pci
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * Display all the PCI IO cards on this board.
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter static int banner = FALSE; /* Have we printed the column headings? */
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter log_printf(dgettext(TEXT_DOMAIN, " IO Configuration "), 0);
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter log_printf(fmt, "Location", "Type", "Slot", "Path",
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter "---------------------------------------------",
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter /* Get platform name, if that fails, use monza name by default */
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter if (sysinfo(SI_PLATFORM, platbuf, sizeof (platbuf)) == -1) {
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter (void) picl_walk_tree_by_class(plafh, PCIEX, PCIEX, monza_pci_callback);
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter (void) picl_walk_tree_by_class(plafh, PCI, PCI, monza_pci_callback);
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter/* ARGSUSED */
51b564aca190d2a430104dded1983d3a1fff66e2mcwaltersun4v_display_diaginfo(int flag, Prom_node *root, picl_nodehdl_t plafh)
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter /* NOTE(ARGUNUSED(kstats)) */
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * Now display the last powerfail time and the fatal hardware
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * reset information. We do this under a couple of conditions.
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * First if the user asks for it. The second is if the user
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * told us to do logging, and we found a system failure.
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * display time of latest powerfail. Not all systems
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * have this capability. For those that do not, this
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * is just a no-op.
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter /* platform_disp_prom_version(tree); */
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * local functions
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * add all io devices under pci in io list
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter/* ARGSUSED */
51b564aca190d2a430104dded1983d3a1fff66e2mcwaltermonza_hw_rev_callback(picl_nodehdl_t pcih, void *args)
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter err = picl_get_propval_by_name(pcih, PICL_PROP_DEVFS_PATH, path,
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter if ((strncmp(path, MONZA_NETWORK_0, strlen(MONZA_NETWORK_0)) == 0) ||
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter (strncmp(path, MONZA_NETWORK_1, strlen(MONZA_NETWORK_1)) == 0)) {
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter revision = monza_get_int_propval(pcih, OBP_PROP_REVISION_ID,
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter if ((strncmp(path, MONZA_NETWORK_2, strlen(MONZA_NETWORK_2)) == 0) ||
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter (strncmp(path, MONZA_NETWORK_3, strlen(MONZA_NETWORK_3)) == 0)) {
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter revision = monza_get_int_propval(pcih, OBP_PROP_REVISION_ID,
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter if ((strncmp(path, MONZA_ENET_2, strlen(MONZA_ENET_2)) == 0) ||
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter (strncmp(path, MONZA_ENET_3, strlen(MONZA_ENET_3)) == 0)) {
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter revision = monza_get_int_propval(pcih, OBP_PROP_REVISION_ID,
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter if ((strncmp(path, MONZA_NETWORK_4, strlen(MONZA_NETWORK_4)) == 0) ||
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter (strncmp(path, MONZA_NETWORK_5, strlen(MONZA_NETWORK_5)) == 0)) {
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter revision = monza_get_int_propval(pcih, OBP_PROP_REVISION_ID,
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter (void) snprintf(NAC, sizeof (NAC), "%s/%s", RTM, AMC);
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter revision = monza_get_int_propval(pcih, OBP_PROP_REVISION_ID,
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter (void) snprintf(NAC, sizeof (NAC), "%s/%s", MOTHERBOARD,
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter revision = monza_get_int_propval(pcih, OBP_PROP_REVISION_ID,
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter err = monza_get_first_compatible_value(pcih, &compatible);
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter /* Print NAC name */
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter /* Print Device Path */
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter /* Print Compatible # */
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter /* Print Revision */
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter/*ARGSUSED*/
51b564aca190d2a430104dded1983d3a1fff66e2mcwaltersun4v_display_hw_revisions(Prom_node *root, picl_nodehdl_t plafh)
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter "========================= HW Revisions "
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter "=======================================\n\n"));
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter "System PROM revisions:\n"
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter "----------------------\n"));
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter value = (char *)get_prop_val(find_prop(pnode, "version"));
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter "IO ASIC revisions:\n"
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter "------------------\n"));
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter log_printf(fmt, "Location", "Path", "Device", "Revision\n", 0);
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter "----------------------------------------",
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter "------------------------------",
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter "---------\n", 0);
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter /* Get platform name, if that fails, use monza name by default */
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter if (sysinfo(SI_PLATFORM, platbuf, sizeof (platbuf)) == -1) {
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * return the first compatible value
51b564aca190d2a430104dded1983d3a1fff66e2mcwaltermonza_get_first_compatible_value(picl_nodehdl_t nodeh, char **outbuf)
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter err = picl_get_propinfo_by_name(nodeh, OBP_PROP_COMPATIBLE,
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter /* get first string from table */
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter err = picl_get_propval(rowproph, pval, pinfo.size);
51b564aca190d2a430104dded1983d3a1fff66e2mcwaltermonza_get_int_propval(picl_nodehdl_t modh, char *prop_name, int *ret)
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter err = picl_get_propinfo_by_name(modh, prop_name, &pinfo, &proph);
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter return (0);
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter * If it is not an int, uint or byte array prop, return failure
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter return (0);
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter case sizeof (int8_t):
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter err = picl_get_propval(proph, &int8v, sizeof (int8v));
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter case sizeof (int16_t):
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter err = picl_get_propval(proph, &int16v, sizeof (int16v));
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter case sizeof (int32_t):
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter err = picl_get_propval(proph, &int32v, sizeof (int32v));
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter case sizeof (int64_t):
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter err = picl_get_propval(proph, &int64v, sizeof (int64v));
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter default: /* not supported size */
51b564aca190d2a430104dded1983d3a1fff66e2mcwalter return (0);