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]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
25 #pragma ident "%Z%%M% %I% %E% SMI"
38 #include <sys/param.h>
40 #include <sys/types.h>
41 #include <sys/utsname.h>
42 #include <sys/openpromio.h>
43 #include <sys/spitregs.h>
44 #include <sys/cheetahregs.h>
51 #include "pdevinfo_sun4u.h"
52 #include "display_sun4u.h"
53 #include "libprtdiag.h"
56 * Return the operating frequency of a processor in Hertz. This function
57 * requires as input a legal prom node pointer. If a NULL
58 * is passed in or the clock-frequency property does not exist, the
62 get_cpu_freq(Prom_node
*pnode
)
67 /* find the property */
68 if ((prop
= find_prop(pnode
, "clock-frequency")) == NULL
) {
72 if ((value
= (uint_t
*)get_prop_val(prop
)) == NULL
) {
80 * returns the size of the given processors external cache in
81 * bytes. If the properties required to determine this are not
82 * present, then the function returns 0.
85 get_ecache_size(Prom_node
*node
)
87 int *cache_size_p
; /* pointer to number of cache lines */
89 /* find the properties */
90 if (cache_size_p
= (int *)get_prop_val(find_prop(node
,
92 return (*cache_size_p
);
94 if (cache_size_p
= (int *)get_prop_val(find_prop(node
,
96 return (*cache_size_p
);
98 if (cache_size_p
= (int *)get_prop_val(find_prop(node
,
100 return (*cache_size_p
);
108 * This routine is the generic link into displaying CPU and memory info.
109 * It displays the table header, then calls the CPU and memory display
110 * routine for all boards.
113 display_cpu_devices(Sys_tree
*tree
)
118 * Display the table header for CPUs . Then display the CPU
119 * frequency, cache size, and processor revision of all cpus.
122 log_printf("=========================", 0);
123 log_printf(" CPUs ", 0);
124 log_printf("=========================", 0);
127 log_printf(" Run Ecache "
129 log_printf("Brd CPU Module MHz MB "
131 log_printf("--- --- ------- ----- ------ "
134 /* Now display all of the cpus on each board */
135 bnode
= tree
->bd_list
;
136 while (bnode
!= NULL
) {
145 * Display the CPUs present on this board.
148 display_cpus(Board_node
*board
)
153 * display the CPUs' operating frequency, cache size, impl. field
156 for (cpu
= dev_find_type(board
->nodes
, "cpu"); cpu
!= NULL
;
157 cpu
= dev_next_type(cpu
, "cpu")) {
158 uint_t freq
; /* CPU clock frequency */
159 int ecache_size
; /* External cache size */
162 int *mask
, decoded_mask
;
164 mid
= (int *)get_prop_val(find_prop(cpu
, "upa-portid"));
166 mid
= (int *)get_prop_val(find_prop(cpu
, "portid"));
169 freq
= (get_cpu_freq(cpu
) + 500000) / 1000000;
170 ecache_size
= get_ecache_size(cpu
);
171 impl
= (int *)get_prop_val(find_prop(cpu
, "implementation#"));
172 mask
= (int *)get_prop_val(find_prop(cpu
, "mask#"));
174 /* Do not display a failed CPU node */
175 if ((freq
!= 0) && (node_failed(cpu
) == 0)) {
177 display_boardnum(board
->board_num
);
180 log_printf(" %2d ", *mid
, 0);
185 /* Running frequency */
186 log_printf(" %3u ", freq
, 0);
189 if (ecache_size
== 0)
190 log_printf(" %3s ", "N/A", 0);
192 log_printf(" %4.1f ",
193 (float)ecache_size
/ (float)(1<<20),
198 log_printf("%6s ", "N/A", 0);
202 log_printf("%-6s ", "US-I", 0);
205 log_printf("%-6s ", "US-II", 0);
208 log_printf("%-6s ", "US-III", 0);
210 case CHEETAH_PLUS_IMPL
:
211 log_printf("%-7s ", "US-III+", 0);
214 log_printf("%-6s ", "US-IV", 0);
217 log_printf("%-6x ", *impl
, 0);
224 log_printf(" %3s", "N/A", 0);
226 if ((impl
) && IS_CHEETAH(*impl
))
228 REMAP_CHEETAH_MASK(*mask
);
230 decoded_mask
= *mask
;
232 log_printf(" %d.%d", (decoded_mask
>> 4) & 0xf,
233 decoded_mask
& 0xf, 0);
244 log_printf(" %2d ", mid
, 0);