11708Sstevel /*
21708Sstevel * CDDL HEADER START
31708Sstevel *
41708Sstevel * The contents of this file are subject to the terms of the
5*13019SMichael.Bergknoff@Oracle.COM * Common Development and Distribution License (the "License").
6*13019SMichael.Bergknoff@Oracle.COM * You may not use this file except in compliance with the License.
71708Sstevel *
81708Sstevel * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
91708Sstevel * or http://www.opensolaris.org/os/licensing.
101708Sstevel * See the License for the specific language governing permissions
111708Sstevel * and limitations under the License.
121708Sstevel *
131708Sstevel * When distributing Covered Code, include this CDDL HEADER in each
141708Sstevel * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
151708Sstevel * If applicable, add the following below this CDDL HEADER, with the
161708Sstevel * fields enclosed by brackets "[]" replaced with your own identifying
171708Sstevel * information: Portions Copyright [yyyy] [name of copyright owner]
181708Sstevel *
191708Sstevel * CDDL HEADER END
201708Sstevel */
211708Sstevel /*
22*13019SMichael.Bergknoff@Oracle.COM * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
231708Sstevel */
241708Sstevel
251708Sstevel #include <stdio.h>
261708Sstevel #include <stdlib.h>
271708Sstevel #include <unistd.h>
281708Sstevel #include <ctype.h>
291708Sstevel #include <string.h>
301708Sstevel #include <kvm.h>
311708Sstevel #include <varargs.h>
321708Sstevel #include <time.h>
331708Sstevel #include <dirent.h>
341708Sstevel #include <fcntl.h>
351708Sstevel #include <sys/param.h>
361708Sstevel #include <sys/stat.h>
371708Sstevel #include <sys/types.h>
381708Sstevel #include <sys/utsname.h>
391708Sstevel #include <sys/openpromio.h>
401708Sstevel #include <libintl.h>
411708Sstevel #include <syslog.h>
421708Sstevel #include <sys/dkio.h>
431708Sstevel #include "pdevinfo.h"
441708Sstevel #include "display.h"
451708Sstevel #include "pdevinfo_sun4u.h"
461708Sstevel #include "display_sun4u.h"
471708Sstevel #include "libprtdiag.h"
481708Sstevel
491708Sstevel
501708Sstevel #if !defined(TEXT_DOMAIN)
511708Sstevel #define TEXT_DOMAIN "SYS_TEST"
521708Sstevel #endif
531708Sstevel
541708Sstevel extern int sys_clk;
551708Sstevel
561708Sstevel int
display(Sys_tree * tree,Prom_node * root,struct system_kstat_data * kstats,int syserrlog)571708Sstevel display(Sys_tree *tree,
581708Sstevel Prom_node *root,
591708Sstevel struct system_kstat_data *kstats,
601708Sstevel int syserrlog)
611708Sstevel {
621708Sstevel int exit_code = 0; /* init to all OK */
631708Sstevel void *value; /* used for opaque PROM data */
641708Sstevel struct mem_total memory_total; /* Total memory in system */
651708Sstevel struct grp_info grps; /* Info on all groups in system */
661708Sstevel
671708Sstevel sys_clk = -1; /* System clock freq. (in MHz) */
681708Sstevel
691708Sstevel /*
701708Sstevel * silently check for any types of machine errors
711708Sstevel */
721708Sstevel exit_code = error_check(tree, kstats);
731708Sstevel
741708Sstevel /*
751708Sstevel * Now display the machine's configuration. We do this if we
761708Sstevel * are not logging or exit_code is set (machine is broke).
771708Sstevel */
781708Sstevel if (!logging || exit_code) {
791708Sstevel struct utsname uts_buf;
801708Sstevel
811708Sstevel /*
821708Sstevel * Display system banner
831708Sstevel */
841708Sstevel (void) uname(&uts_buf);
851708Sstevel
86*13019SMichael.Bergknoff@Oracle.COM log_printf(dgettext(TEXT_DOMAIN, "System Configuration: "
87*13019SMichael.Bergknoff@Oracle.COM "Oracle Corporation %s %s\n"), uts_buf.machine,
88*13019SMichael.Bergknoff@Oracle.COM get_prop_val(find_prop(root, "banner-name")), 0);
891708Sstevel
901708Sstevel /* display system clock frequency */
911708Sstevel value = get_prop_val(find_prop(root, "clock-frequency"));
921708Sstevel if (value != NULL) {
931708Sstevel sys_clk = ((*((int *)value)) + 500000) / 1000000;
941708Sstevel log_printf(dgettext(TEXT_DOMAIN, "System clock "
95*13019SMichael.Bergknoff@Oracle.COM "frequency: %d MHz\n"), sys_clk, 0);
961708Sstevel }
971708Sstevel
981708Sstevel /* Display the Memory Size */
991708Sstevel display_memorysize(tree, kstats, &grps, &memory_total);
1001708Sstevel
1011708Sstevel /* Display platform specific configuration info */
1021708Sstevel display_platform_specific_header();
1031708Sstevel
1041708Sstevel /* Display the CPU devices */
1051708Sstevel display_cpu_devices(tree);
1061708Sstevel
1071708Sstevel /* Display the Memory configuration */
1081708Sstevel display_memoryconf(tree, &grps);
1091708Sstevel
1101708Sstevel /* Display all the IO cards. */
1111708Sstevel (void) display_io_devices(tree);
1121708Sstevel
1131708Sstevel
1141708Sstevel /*
1151708Sstevel * Display any Hot plugged, disabled and failed board(s)
1161708Sstevel * where appropriate.
1171708Sstevel */
1181708Sstevel display_hp_fail_fault(tree, kstats);
1191708Sstevel
1201708Sstevel display_diaginfo((syserrlog || (logging && exit_code)),
121*13019SMichael.Bergknoff@Oracle.COM root, tree, kstats);
1221708Sstevel }
1231708Sstevel
1241708Sstevel return (exit_code);
1251708Sstevel }
1261708Sstevel
1271708Sstevel
1281708Sstevel int
error_check(Sys_tree * tree,struct system_kstat_data * kstats)1291708Sstevel error_check(Sys_tree *tree, struct system_kstat_data *kstats)
1301708Sstevel {
1311708Sstevel #ifdef lint
1321708Sstevel tree = tree;
1331708Sstevel kstats = kstats;
1341708Sstevel #endif
1351708Sstevel /*
1361708Sstevel * This function is intentionally empty
1371708Sstevel */
1381708Sstevel return (0);
1391708Sstevel }
1401708Sstevel
1411708Sstevel int
disp_fail_parts(Sys_tree * tree)1421708Sstevel disp_fail_parts(Sys_tree *tree)
1431708Sstevel {
1441708Sstevel #ifdef lint
1451708Sstevel tree = tree;
1461708Sstevel #endif
1471708Sstevel /*
1481708Sstevel * This function is intentionally empty
1491708Sstevel */
1501708Sstevel return (0);
1511708Sstevel }
1521708Sstevel
1531708Sstevel
1541708Sstevel void
display_hp_fail_fault(Sys_tree * tree,struct system_kstat_data * kstats)1551708Sstevel display_hp_fail_fault(Sys_tree *tree, struct system_kstat_data *kstats)
1561708Sstevel {
1571708Sstevel #ifdef lint
1581708Sstevel tree = tree;
1591708Sstevel kstats = kstats;
1601708Sstevel #endif
1611708Sstevel /*
1621708Sstevel * This function is intentionally empty
1631708Sstevel */
1641708Sstevel }
1651708Sstevel
1661708Sstevel void
display_diaginfo(int flag,Prom_node * root,Sys_tree * tree,struct system_kstat_data * kstats)1671708Sstevel display_diaginfo(int flag, Prom_node *root, Sys_tree *tree,
1681708Sstevel struct system_kstat_data *kstats)
1691708Sstevel {
1701708Sstevel #ifdef lint
1711708Sstevel flag = flag;
1721708Sstevel root = root;
1731708Sstevel tree = tree;
1741708Sstevel kstats = kstats;
1751708Sstevel #endif
1761708Sstevel /*
1771708Sstevel * This function is intentionally empty
1781708Sstevel */
1791708Sstevel }
1801708Sstevel
1811708Sstevel
1821708Sstevel void
resolve_board_types(Sys_tree * tree)1831708Sstevel resolve_board_types(Sys_tree *tree)
1841708Sstevel {
1851708Sstevel #ifdef lint
1861708Sstevel tree = tree;
1871708Sstevel #endif
1881708Sstevel /*
1891708Sstevel * This function is intentionally empty
1901708Sstevel */
1911708Sstevel }
1921708Sstevel
1931708Sstevel void
display_boardnum(int num)1941708Sstevel display_boardnum(int num)
1951708Sstevel {
1961708Sstevel log_printf("%2d ", num, 0);
1971708Sstevel }
1981708Sstevel
1991708Sstevel
2001708Sstevel /*
2011708Sstevel * The various platforms can over-ride this function to
2021708Sstevel * return any platform specific configuration information
2031708Sstevel * they may wish to return in addition to the generic output.
2041708Sstevel */
2051708Sstevel void
display_platform_specific_header(void)2061708Sstevel display_platform_specific_header(void)
2071708Sstevel {
2081708Sstevel /*
2091708Sstevel * This function is intentionally empty
2101708Sstevel */
2111708Sstevel }
212