xref: /titanic_51/usr/src/lib/libprtdiag/inc/pdevinfo_sun4u.h (revision 03831d35f7499c87d51205817c93e9a8d42c4bae)
1*03831d35Sstevel /*
2*03831d35Sstevel  * CDDL HEADER START
3*03831d35Sstevel  *
4*03831d35Sstevel  * The contents of this file are subject to the terms of the
5*03831d35Sstevel  * Common Development and Distribution License, Version 1.0 only
6*03831d35Sstevel  * (the "License").  You may not use this file except in compliance
7*03831d35Sstevel  * with the License.
8*03831d35Sstevel  *
9*03831d35Sstevel  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*03831d35Sstevel  * or http://www.opensolaris.org/os/licensing.
11*03831d35Sstevel  * See the License for the specific language governing permissions
12*03831d35Sstevel  * and limitations under the License.
13*03831d35Sstevel  *
14*03831d35Sstevel  * When distributing Covered Code, include this CDDL HEADER in each
15*03831d35Sstevel  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*03831d35Sstevel  * If applicable, add the following below this CDDL HEADER, with the
17*03831d35Sstevel  * fields enclosed by brackets "[]" replaced with your own identifying
18*03831d35Sstevel  * information: Portions Copyright [yyyy] [name of copyright owner]
19*03831d35Sstevel  *
20*03831d35Sstevel  * CDDL HEADER END
21*03831d35Sstevel  */
22*03831d35Sstevel /*
23*03831d35Sstevel  * Copyright (c) 1999 by Sun Microsystems, Inc.
24*03831d35Sstevel  * All rights reserved.
25*03831d35Sstevel  */
26*03831d35Sstevel 
27*03831d35Sstevel #ifndef	_PDEVINFO_SUN4U_H
28*03831d35Sstevel #define	_PDEVINFO_SUN4U_H
29*03831d35Sstevel 
30*03831d35Sstevel #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*03831d35Sstevel 
32*03831d35Sstevel #include <sys/obpdefs.h>
33*03831d35Sstevel #include <sys/fhc.h>
34*03831d35Sstevel #include <sys/sysctrl.h>
35*03831d35Sstevel #include <sys/environ.h>
36*03831d35Sstevel #include <sys/envctrl_gen.h>
37*03831d35Sstevel #include <sys/envctrl_ue250.h>
38*03831d35Sstevel #include <sys/envctrl_ue450.h>
39*03831d35Sstevel #include <sys/simmstat.h>
40*03831d35Sstevel #include <sys/ac.h>
41*03831d35Sstevel #include <sys/sram.h>
42*03831d35Sstevel #include <reset_info.h>
43*03831d35Sstevel 
44*03831d35Sstevel #ifdef	__cplusplus
45*03831d35Sstevel extern "C" {
46*03831d35Sstevel #endif
47*03831d35Sstevel 
48*03831d35Sstevel #define	UNIX	"unix"
49*03831d35Sstevel 
50*03831d35Sstevel /* Define names of nodes to search for */
51*03831d35Sstevel #define	CPU_NAME	"SUNW,UltraSPARC"
52*03831d35Sstevel #define	SBUS_NAME	"sbus"
53*03831d35Sstevel #define	PCI_NAME	"pci"
54*03831d35Sstevel #define	FFB_NAME	"SUNW,ffb"
55*03831d35Sstevel #define	AFB_NAME	"SUNW,afb"
56*03831d35Sstevel 
57*03831d35Sstevel struct mem_stat_data {
58*03831d35Sstevel 	enum ac_bank_status status;	/* bank status values */
59*03831d35Sstevel 	enum ac_bank_condition condition;	/* bank conditions */
60*03831d35Sstevel };
61*03831d35Sstevel 
62*03831d35Sstevel struct bd_kstat_data {
63*03831d35Sstevel 	u_longlong_t 	ac_memctl;	/* Memctl register contents */
64*03831d35Sstevel 	u_longlong_t 	ac_memdecode[2]; /* memory decode registers . */
65*03831d35Sstevel 	int	ac_kstats_ok;	/* successful kstat read occurred */
66*03831d35Sstevel 	uint_t	fhc_bsr;	/* FHC Board Status Register */
67*03831d35Sstevel 	uint_t	fhc_csr;	/* FHC Control Status Register */
68*03831d35Sstevel 	int	fhc_kstats_ok;	/* successful kstat read occurred */
69*03831d35Sstevel 	uchar_t	simm_status[SIMM_COUNT];	/* SIMM status */
70*03831d35Sstevel 	int	simmstat_kstats_ok;	/* successful read occurred */
71*03831d35Sstevel 	struct temp_stats tempstat;
72*03831d35Sstevel 	int	temp_kstat_ok;
73*03831d35Sstevel 	struct	mem_stat_data	mem_stat[2];	/* raw kstat bank information */
74*03831d35Sstevel 	int	ac_memstat_ok;	/* successful read of memory status */
75*03831d35Sstevel };
76*03831d35Sstevel 
77*03831d35Sstevel /*
78*03831d35Sstevel  * Hot plug info structure. If a hotplug kstat is found, the bd_info
79*03831d35Sstevel  * structure from the kstat is filled in the the hp_info structure
80*03831d35Sstevel  * is marked OK.
81*03831d35Sstevel  */
82*03831d35Sstevel struct hp_info {
83*03831d35Sstevel 	struct bd_info bd_info;
84*03831d35Sstevel 	int kstat_ok;
85*03831d35Sstevel };
86*03831d35Sstevel 
87*03831d35Sstevel /* Environmental info for Tazmo */
88*03831d35Sstevel struct envctrl_kstat_data {
89*03831d35Sstevel 	envctrl_ps_t ps_kstats[MAX_DEVS];  /* kstats for powersupplies */
90*03831d35Sstevel 	envctrl_fan_t fan_kstats[MAX_DEVS]; /* kstats for fans */
91*03831d35Sstevel 	envctrl_encl_t encl_kstats[MAX_DEVS]; /* kstats for enclosure */
92*03831d35Sstevel };
93*03831d35Sstevel 
94*03831d35Sstevel /* Environmental info for Javelin */
95*03831d35Sstevel struct envctrltwo_kstat_data {
96*03831d35Sstevel 	envctrl_ps2_t ps_kstats[MAX_DEVS];	/* kstats for powersupplies */
97*03831d35Sstevel 	int num_ps_kstats;
98*03831d35Sstevel 	envctrl_fan_t fan_kstats[MAX_DEVS]; /* kstats for fans */
99*03831d35Sstevel 	int num_fan_kstats;
100*03831d35Sstevel 	envctrl_encl_t encl_kstats[MAX_DEVS]; /* kstats for enclosure */
101*03831d35Sstevel 	int num_encl_kstats;
102*03831d35Sstevel 	envctrl_temp_t temp_kstats[MAX_DEVS]; /* kstats for temperatures */
103*03831d35Sstevel 	int num_temp_kstats;
104*03831d35Sstevel 	envctrl_disk_t disk_kstats[MAX_DEVS]; /* kstats for disks */
105*03831d35Sstevel 	int num_disk_kstats;
106*03831d35Sstevel };
107*03831d35Sstevel 
108*03831d35Sstevel struct system_kstat_data {
109*03831d35Sstevel 	uchar_t	sysctrl;	/* sysctrl register contents */
110*03831d35Sstevel 	uchar_t	sysstat1;	/* system status1 register contents. */
111*03831d35Sstevel 	uchar_t	sysstat2;	/* system status2 register contents. */
112*03831d35Sstevel 	uchar_t ps_shadow[SYS_PS_COUNT];	/* power supply shadow */
113*03831d35Sstevel 	int	psstat_kstat_ok;
114*03831d35Sstevel 	uchar_t	clk_freq2;	/* clock frequency register 2 contents */
115*03831d35Sstevel 	uchar_t	fan_status;	/* shadow fan status */
116*03831d35Sstevel 	uchar_t	keysw_status;	/* status of the key switch */
117*03831d35Sstevel 	enum power_state power_state;	/* redundant power state */
118*03831d35Sstevel 	uchar_t	clk_ver;	/* clock version register */
119*03831d35Sstevel 	int	sys_kstats_ok;	/* successful kstat read occurred */
120*03831d35Sstevel 	struct temp_stats tempstat;
121*03831d35Sstevel 	int	temp_kstat_ok;
122*03831d35Sstevel 	struct reset_info reset_info;
123*03831d35Sstevel 	int	reset_kstats_ok;	/* kstat read OK */
124*03831d35Sstevel 	struct bd_kstat_data bd_ksp_list[MAX_BOARDS];
125*03831d35Sstevel 	struct hp_info hp_info[MAX_BOARDS];
126*03831d35Sstevel 	struct ft_list *ft_array;	/* fault array */
127*03831d35Sstevel 	int	nfaults;		/* number of faults in fault array */
128*03831d35Sstevel 	int	ft_kstat_ok;		/* Fault kstats OK */
129*03831d35Sstevel 	struct envctrl_kstat_data env_data;  /* environment data for Tazmo */
130*03831d35Sstevel 	int	envctrl_kstat_ok;
131*03831d35Sstevel 	struct envctrltwo_kstat_data envc_data;  /* environ data for Javelin */
132*03831d35Sstevel 	int	envctrltwo_kstat_ok;
133*03831d35Sstevel };
134*03831d35Sstevel 
135*03831d35Sstevel /* Description of a single memory group */
136*03831d35Sstevel struct grp {
137*03831d35Sstevel 	int valid;			/* active memory group present */
138*03831d35Sstevel 	u_longlong_t  base;		/* Phyiscal base of group */
139*03831d35Sstevel 	uint_t size;			/* size in bytes */
140*03831d35Sstevel 	uint_t curr_size;		/* current size in bytes */
141*03831d35Sstevel 	int board;			/* board number */
142*03831d35Sstevel 	enum board_type type;		/* board type */
143*03831d35Sstevel 	int group;			/* group # on board (0 or 1) */
144*03831d35Sstevel 	int factor;			/* interleave factor (0,2,4,8,16) */
145*03831d35Sstevel 	int speed;			/* Memory speed (in ns) */
146*03831d35Sstevel 	char groupid;			/* Alpha tag for group ID */
147*03831d35Sstevel 	enum ac_bank_status status;	/* bank status values */
148*03831d35Sstevel 	enum ac_bank_condition condition;	/* bank conditions */
149*03831d35Sstevel };
150*03831d35Sstevel 
151*03831d35Sstevel #define	MAX_GROUPS	32
152*03831d35Sstevel #define	MAXSTRLEN	256
153*03831d35Sstevel 
154*03831d35Sstevel /* Array of all possible groups in the system. */
155*03831d35Sstevel struct grp_info {
156*03831d35Sstevel 	struct grp grp[MAX_GROUPS];
157*03831d35Sstevel };
158*03831d35Sstevel 
159*03831d35Sstevel /* A memory interleave structure */
160*03831d35Sstevel struct inter_grp {
161*03831d35Sstevel 	u_longlong_t base;	/* Physical base of group */
162*03831d35Sstevel 	int valid;
163*03831d35Sstevel 	int count;
164*03831d35Sstevel 	char groupid;
165*03831d35Sstevel };
166*03831d35Sstevel 
167*03831d35Sstevel /* Array of all possible memory interleave structures */
168*03831d35Sstevel struct mem_inter {
169*03831d35Sstevel 	struct inter_grp i_grp[MAX_GROUPS];
170*03831d35Sstevel };
171*03831d35Sstevel 
172*03831d35Sstevel /* FFB info structure */
173*03831d35Sstevel struct ffbinfo {
174*03831d35Sstevel 	int board;
175*03831d35Sstevel 	int upa_id;
176*03831d35Sstevel 	char *dev;
177*03831d35Sstevel 	struct ffbinfo *next;
178*03831d35Sstevel };
179*03831d35Sstevel 
180*03831d35Sstevel /* FFB strap reg union */
181*03831d35Sstevel union strap_un {
182*03831d35Sstevel 	struct {
183*03831d35Sstevel 		uint_t	unused:24;
184*03831d35Sstevel 		uint_t	afb_flag:1;
185*03831d35Sstevel 		uint_t	major_rev:2;
186*03831d35Sstevel 		uint_t	board_rev:2;
187*03831d35Sstevel 		uint_t	board_mem:1;
188*03831d35Sstevel 		uint_t	cbuf:1;
189*03831d35Sstevel 		uint_t	bbuf:1;
190*03831d35Sstevel 	} fld;
191*03831d35Sstevel 	uint_t ffb_strap_bits;
192*03831d35Sstevel };
193*03831d35Sstevel 
194*03831d35Sstevel /* known values for manufacturer's JED code */
195*03831d35Sstevel #define	MANF_BROOKTREE	214
196*03831d35Sstevel #define	MANF_MITSUBISHI	28
197*03831d35Sstevel 
198*03831d35Sstevel /* FFB mnufacturer union */
199*03831d35Sstevel union manuf {
200*03831d35Sstevel 	struct {
201*03831d35Sstevel 		uint_t version:4;	/* version of part number */
202*03831d35Sstevel 		uint_t partno:16;	/* part number */
203*03831d35Sstevel 		uint_t manf:11;		/* manufacturer's JED code */
204*03831d35Sstevel 		uint_t one:1;		/* always set to '1' */
205*03831d35Sstevel 	} fld;
206*03831d35Sstevel 	uint_t encoded_id;
207*03831d35Sstevel };
208*03831d35Sstevel 
209*03831d35Sstevel #define	FFBIOC		('F' << 8)
210*03831d35Sstevel #define	FFB_SYS_INFO	(FFBIOC| 80)
211*03831d35Sstevel 
212*03831d35Sstevel struct ffb_sys_info {
213*03831d35Sstevel 	unsigned int	ffb_strap_bits;	/* ffb_strapping register	*/
214*03831d35Sstevel #define	FFB_B_BUFF	0x01		/* B buffer present		*/
215*03831d35Sstevel #define	FFB_C_BUFF	0x02		/* C buffer present		*/
216*03831d35Sstevel #define	FB_TYPE_AFB	0x80		/* AFB or FFB			*/
217*03831d35Sstevel 	unsigned int	fbc_version;	/* revision of FBC chip		*/
218*03831d35Sstevel 	unsigned int	dac_version;	/* revision of DAC chip		*/
219*03831d35Sstevel 	unsigned int	fbram_version;	/* revision of FBRAMs chip	*/
220*03831d35Sstevel 	unsigned int	flags;		/* miscellaneous flags		*/
221*03831d35Sstevel #define	FFB_KSIM	0x00000001	/* kernel simulator		*/
222*03831d35Sstevel #define	FFB_PAGE_FILL_BUG 0x00000002	/* FBRAM has page fill bug	*/
223*03831d35Sstevel 	unsigned int	afb_nfloats;	/* no. of Float asics in AFB	*/
224*03831d35Sstevel 	unsigned int	pad[58];	/* padding for AFB chips & misc. */
225*03831d35Sstevel };
226*03831d35Sstevel 
227*03831d35Sstevel int get_id(Prom_node *);
228*03831d35Sstevel 
229*03831d35Sstevel #ifdef	__cplusplus
230*03831d35Sstevel }
231*03831d35Sstevel #endif
232*03831d35Sstevel 
233*03831d35Sstevel #endif	/* _PDEVINFO_SUN4U_H */
234