xref: /titanic_50/usr/src/lib/libprtdiag/common/display_sun4u.c (revision 33f2fefd46350ca5992567761c46a5b70f864340)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1999-2000 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <unistd.h>
32 #include <ctype.h>
33 #include <string.h>
34 #include <kvm.h>
35 #include <varargs.h>
36 #include <time.h>
37 #include <dirent.h>
38 #include <fcntl.h>
39 #include <sys/param.h>
40 #include <sys/stat.h>
41 #include <sys/types.h>
42 #include <sys/utsname.h>
43 #include <sys/openpromio.h>
44 #include <libintl.h>
45 #include <syslog.h>
46 #include <sys/dkio.h>
47 #include "pdevinfo.h"
48 #include "display.h"
49 #include "pdevinfo_sun4u.h"
50 #include "display_sun4u.h"
51 #include "libprtdiag.h"
52 
53 
54 #if !defined(TEXT_DOMAIN)
55 #define	TEXT_DOMAIN	"SYS_TEST"
56 #endif
57 
58 extern	int sys_clk;
59 
60 int
61 display(Sys_tree *tree,
62 	Prom_node *root,
63 	struct system_kstat_data *kstats,
64 	int syserrlog)
65 {
66 	int exit_code = 0;	/* init to all OK */
67 	void *value;		/* used for opaque PROM data */
68 	struct mem_total memory_total;	/* Total memory in system */
69 	struct grp_info grps;	/* Info on all groups in system */
70 
71 	sys_clk = -1;  /* System clock freq. (in MHz) */
72 
73 	/*
74 	 * silently check for any types of machine errors
75 	 */
76 	exit_code = error_check(tree, kstats);
77 
78 	/*
79 	 * Now display the machine's configuration. We do this if we
80 	 * are not logging or exit_code is set (machine is broke).
81 	 */
82 	if (!logging || exit_code) {
83 		struct utsname uts_buf;
84 
85 		/*
86 		 * Display system banner
87 		 */
88 		(void) uname(&uts_buf);
89 
90 		log_printf(
91 			dgettext(TEXT_DOMAIN, "System Configuration:  "
92 				"Sun Microsystems  %s %s\n"), uts_buf.machine,
93 					get_prop_val(find_prop(root,
94 					"banner-name")), 0);
95 
96 		/* display system clock frequency */
97 		value = get_prop_val(find_prop(root, "clock-frequency"));
98 		if (value != NULL) {
99 			sys_clk = ((*((int *)value)) + 500000) / 1000000;
100 			log_printf(dgettext(TEXT_DOMAIN, "System clock "
101 				"frequency: %d MHz\n"), sys_clk, 0);
102 		}
103 
104 		/* Display the Memory Size */
105 		display_memorysize(tree, kstats, &grps, &memory_total);
106 
107 		/* Display platform specific configuration info */
108 		display_platform_specific_header();
109 
110 		/* Display the CPU devices */
111 		display_cpu_devices(tree);
112 
113 		/* Display the Memory configuration */
114 		display_memoryconf(tree, &grps);
115 
116 		/* Display all the IO cards. */
117 		(void) display_io_devices(tree);
118 
119 
120 		/*
121 		 * Display any Hot plugged, disabled and failed board(s)
122 		 * where appropriate.
123 		 */
124 		display_hp_fail_fault(tree, kstats);
125 
126 		display_diaginfo((syserrlog || (logging && exit_code)),
127 			root, tree, kstats);
128 	}
129 
130 	return (exit_code);
131 }
132 
133 
134 int
135 error_check(Sys_tree *tree, struct system_kstat_data *kstats)
136 {
137 #ifdef	lint
138 	tree = tree;
139 	kstats = kstats;
140 #endif
141 	/*
142 	 * This function is intentionally empty
143 	 */
144 	return (0);
145 }
146 
147 int
148 disp_fail_parts(Sys_tree *tree)
149 {
150 #ifdef	lint
151 	tree = tree;
152 #endif
153 	/*
154 	 * This function is intentionally empty
155 	 */
156 	return (0);
157 }
158 
159 
160 void
161 display_hp_fail_fault(Sys_tree *tree, struct system_kstat_data *kstats)
162 {
163 #ifdef	lint
164 	tree = tree;
165 	kstats = kstats;
166 #endif
167 	/*
168 	 * This function is intentionally empty
169 	 */
170 }
171 
172 void
173 display_diaginfo(int flag, Prom_node *root, Sys_tree *tree,
174 			struct system_kstat_data *kstats)
175 {
176 #ifdef	lint
177 	flag = flag;
178 	root = root;
179 	tree = tree;
180 	kstats = kstats;
181 #endif
182 	/*
183 	 * This function is intentionally empty
184 	 */
185 }
186 
187 
188 void
189 resolve_board_types(Sys_tree *tree)
190 {
191 #ifdef	lint
192 	tree = tree;
193 #endif
194 	/*
195 	 * This function is intentionally empty
196 	 */
197 }
198 
199 void
200 display_boardnum(int num)
201 {
202 	log_printf("%2d   ", num, 0);
203 }
204 
205 
206 /*
207  * The various platforms can over-ride this function to
208  * return any platform specific configuration information
209  * they may wish to return in addition to the generic output.
210  */
211 void
212 display_platform_specific_header(void)
213 {
214 	/*
215 	 * This function is intentionally empty
216 	 */
217 }
218