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