8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / lib / libprtdiag / common / display_sun4u.c
bloba68246600fb7548cea07b639b4c3fd607bd09d96
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <unistd.h>
28 #include <ctype.h>
29 #include <string.h>
30 #include <kvm.h>
31 #include <varargs.h>
32 #include <time.h>
33 #include <dirent.h>
34 #include <fcntl.h>
35 #include <sys/param.h>
36 #include <sys/stat.h>
37 #include <sys/types.h>
38 #include <sys/utsname.h>
39 #include <sys/openpromio.h>
40 #include <libintl.h>
41 #include <syslog.h>
42 #include <sys/dkio.h>
43 #include "pdevinfo.h"
44 #include "display.h"
45 #include "pdevinfo_sun4u.h"
46 #include "display_sun4u.h"
47 #include "libprtdiag.h"
50 #if !defined(TEXT_DOMAIN)
51 #define TEXT_DOMAIN "SYS_TEST"
52 #endif
54 extern int sys_clk;
56 int
57 display(Sys_tree *tree,
58 Prom_node *root,
59 struct system_kstat_data *kstats,
60 int syserrlog)
62 int exit_code = 0; /* init to all OK */
63 void *value; /* used for opaque PROM data */
64 struct mem_total memory_total; /* Total memory in system */
65 struct grp_info grps; /* Info on all groups in system */
67 sys_clk = -1; /* System clock freq. (in MHz) */
70 * silently check for any types of machine errors
72 exit_code = error_check(tree, kstats);
75 * Now display the machine's configuration. We do this if we
76 * are not logging or exit_code is set (machine is broke).
78 if (!logging || exit_code) {
79 struct utsname uts_buf;
82 * Display system banner
84 (void) uname(&uts_buf);
86 log_printf(dgettext(TEXT_DOMAIN, "System Configuration: "
87 "Oracle Corporation %s %s\n"), uts_buf.machine,
88 get_prop_val(find_prop(root, "banner-name")), 0);
90 /* display system clock frequency */
91 value = get_prop_val(find_prop(root, "clock-frequency"));
92 if (value != NULL) {
93 sys_clk = ((*((int *)value)) + 500000) / 1000000;
94 log_printf(dgettext(TEXT_DOMAIN, "System clock "
95 "frequency: %d MHz\n"), sys_clk, 0);
98 /* Display the Memory Size */
99 display_memorysize(tree, kstats, &grps, &memory_total);
101 /* Display platform specific configuration info */
102 display_platform_specific_header();
104 /* Display the CPU devices */
105 display_cpu_devices(tree);
107 /* Display the Memory configuration */
108 display_memoryconf(tree, &grps);
110 /* Display all the IO cards. */
111 (void) display_io_devices(tree);
115 * Display any Hot plugged, disabled and failed board(s)
116 * where appropriate.
118 display_hp_fail_fault(tree, kstats);
120 display_diaginfo((syserrlog || (logging && exit_code)),
121 root, tree, kstats);
124 return (exit_code);
129 error_check(Sys_tree *tree, struct system_kstat_data *kstats)
131 #ifdef lint
132 tree = tree;
133 kstats = kstats;
134 #endif
136 * This function is intentionally empty
138 return (0);
142 disp_fail_parts(Sys_tree *tree)
144 #ifdef lint
145 tree = tree;
146 #endif
148 * This function is intentionally empty
150 return (0);
154 void
155 display_hp_fail_fault(Sys_tree *tree, struct system_kstat_data *kstats)
157 #ifdef lint
158 tree = tree;
159 kstats = kstats;
160 #endif
162 * This function is intentionally empty
166 void
167 display_diaginfo(int flag, Prom_node *root, Sys_tree *tree,
168 struct system_kstat_data *kstats)
170 #ifdef lint
171 flag = flag;
172 root = root;
173 tree = tree;
174 kstats = kstats;
175 #endif
177 * This function is intentionally empty
182 void
183 resolve_board_types(Sys_tree *tree)
185 #ifdef lint
186 tree = tree;
187 #endif
189 * This function is intentionally empty
193 void
194 display_boardnum(int num)
196 log_printf("%2d ", num, 0);
201 * The various platforms can over-ride this function to
202 * return any platform specific configuration information
203 * they may wish to return in addition to the generic output.
205 void
206 display_platform_specific_header(void)
209 * This function is intentionally empty