xref: /linux/arch/mips/include/asm/sn/sn0/hubpi.h (revision e5451c8f8330e03ad3cfa16048b4daf961af434f)
1*384740dcSRalf Baechle /*
2*384740dcSRalf Baechle  * This file is subject to the terms and conditions of the GNU General Public
3*384740dcSRalf Baechle  * License.  See the file "COPYING" in the main directory of this archive
4*384740dcSRalf Baechle  * for more details.
5*384740dcSRalf Baechle  *
6*384740dcSRalf Baechle  * Derived from IRIX <sys/SN/SN0/hubpi.h>, revision 1.28.
7*384740dcSRalf Baechle  *
8*384740dcSRalf Baechle  * Copyright (C) 1992 - 1997, 1999 Silicon Graphics, Inc.
9*384740dcSRalf Baechle  * Copyright (C) 1999 by Ralf Baechle
10*384740dcSRalf Baechle  */
11*384740dcSRalf Baechle #ifndef _ASM_SN_SN0_HUBPI_H
12*384740dcSRalf Baechle #define _ASM_SN_SN0_HUBPI_H
13*384740dcSRalf Baechle 
14*384740dcSRalf Baechle #include <linux/types.h>
15*384740dcSRalf Baechle 
16*384740dcSRalf Baechle /*
17*384740dcSRalf Baechle  * Hub I/O interface registers
18*384740dcSRalf Baechle  *
19*384740dcSRalf Baechle  * All registers in this file are subject to change until Hub chip tapeout.
20*384740dcSRalf Baechle  * All register "addresses" are actually offsets.  Use the LOCAL_HUB
21*384740dcSRalf Baechle  * or REMOTE_HUB macros to synthesize an actual address
22*384740dcSRalf Baechle  */
23*384740dcSRalf Baechle 
24*384740dcSRalf Baechle #define PI_BASE			0x000000
25*384740dcSRalf Baechle 
26*384740dcSRalf Baechle /* General protection and control registers */
27*384740dcSRalf Baechle 
28*384740dcSRalf Baechle #define PI_CPU_PROTECT		0x000000 /* CPU Protection		    */
29*384740dcSRalf Baechle #define PI_PROT_OVERRD		0x000008 /* Clear CPU Protection bit	    */
30*384740dcSRalf Baechle #define PI_IO_PROTECT		0x000010 /* Interrupt Pending Protection    */
31*384740dcSRalf Baechle #define PI_REGION_PRESENT	0x000018 /* Indicates whether region exists */
32*384740dcSRalf Baechle #define PI_CPU_NUM		0x000020 /* CPU Number ID		    */
33*384740dcSRalf Baechle #define PI_CALIAS_SIZE		0x000028 /* Cached Alias Size		    */
34*384740dcSRalf Baechle #define PI_MAX_CRB_TIMEOUT	0x000030 /* Maximum Timeout for CRB	    */
35*384740dcSRalf Baechle #define PI_CRB_SFACTOR		0x000038 /* Scale factor for CRB timeout    */
36*384740dcSRalf Baechle 
37*384740dcSRalf Baechle /* CALIAS values */
38*384740dcSRalf Baechle #define PI_CALIAS_SIZE_0	0
39*384740dcSRalf Baechle #define PI_CALIAS_SIZE_4K	1
40*384740dcSRalf Baechle #define PI_CALIAS_SIZE_8K	2
41*384740dcSRalf Baechle #define PI_CALIAS_SIZE_16K	3
42*384740dcSRalf Baechle #define PI_CALIAS_SIZE_32K	4
43*384740dcSRalf Baechle #define PI_CALIAS_SIZE_64K	5
44*384740dcSRalf Baechle #define PI_CALIAS_SIZE_128K	6
45*384740dcSRalf Baechle #define PI_CALIAS_SIZE_256K	7
46*384740dcSRalf Baechle #define PI_CALIAS_SIZE_512K	8
47*384740dcSRalf Baechle #define PI_CALIAS_SIZE_1M	9
48*384740dcSRalf Baechle #define PI_CALIAS_SIZE_2M	10
49*384740dcSRalf Baechle #define PI_CALIAS_SIZE_4M	11
50*384740dcSRalf Baechle #define PI_CALIAS_SIZE_8M	12
51*384740dcSRalf Baechle #define PI_CALIAS_SIZE_16M	13
52*384740dcSRalf Baechle #define PI_CALIAS_SIZE_32M	14
53*384740dcSRalf Baechle #define PI_CALIAS_SIZE_64M	15
54*384740dcSRalf Baechle 
55*384740dcSRalf Baechle /* Processor control and status checking */
56*384740dcSRalf Baechle 
57*384740dcSRalf Baechle #define PI_CPU_PRESENT_A	0x000040 /* CPU Present A		    */
58*384740dcSRalf Baechle #define PI_CPU_PRESENT_B	0x000048 /* CPU Present B		    */
59*384740dcSRalf Baechle #define PI_CPU_ENABLE_A		0x000050 /* CPU Enable A		    */
60*384740dcSRalf Baechle #define PI_CPU_ENABLE_B		0x000058 /* CPU Enable B		    */
61*384740dcSRalf Baechle #define PI_REPLY_LEVEL		0x000060 /* Reply Level			    */
62*384740dcSRalf Baechle #define PI_HARDRESET_BIT	0x020068 /* Bit cleared by s/w on SR	    */
63*384740dcSRalf Baechle #define PI_NMI_A		0x000070 /* NMI to CPU A		    */
64*384740dcSRalf Baechle #define PI_NMI_B		0x000078 /* NMI to CPU B		    */
65*384740dcSRalf Baechle #define PI_NMI_OFFSET		(PI_NMI_B - PI_NMI_A)
66*384740dcSRalf Baechle #define PI_SOFTRESET		0x000080 /* Softreset (to both CPUs)	    */
67*384740dcSRalf Baechle 
68*384740dcSRalf Baechle /* Regular Interrupt register checking.	 */
69*384740dcSRalf Baechle 
70*384740dcSRalf Baechle #define PI_INT_PEND_MOD		0x000090 /* Write to set pending ints	    */
71*384740dcSRalf Baechle #define PI_INT_PEND0		0x000098 /* Read to get pending ints	    */
72*384740dcSRalf Baechle #define PI_INT_PEND1		0x0000a0 /* Read to get pending ints	    */
73*384740dcSRalf Baechle #define PI_INT_MASK0_A		0x0000a8 /* Interrupt Mask 0 for CPU A	    */
74*384740dcSRalf Baechle #define PI_INT_MASK1_A		0x0000b0 /* Interrupt Mask 1 for CPU A	    */
75*384740dcSRalf Baechle #define PI_INT_MASK0_B		0x0000b8 /* Interrupt Mask 0 for CPU B	    */
76*384740dcSRalf Baechle #define PI_INT_MASK1_B		0x0000c0 /* Interrupt Mask 1 for CPU B	    */
77*384740dcSRalf Baechle 
78*384740dcSRalf Baechle #define PI_INT_MASK_OFFSET	0x10	 /* Offset from A to B		    */
79*384740dcSRalf Baechle 
80*384740dcSRalf Baechle /* Crosscall interrupts */
81*384740dcSRalf Baechle 
82*384740dcSRalf Baechle #define PI_CC_PEND_SET_A	0x0000c8 /* CC Interrupt Pending Set, CPU A */
83*384740dcSRalf Baechle #define PI_CC_PEND_SET_B	0x0000d0 /* CC Interrupt Pending Set, CPU B */
84*384740dcSRalf Baechle #define PI_CC_PEND_CLR_A	0x0000d8 /* CC Interrupt Pending Clr, CPU A */
85*384740dcSRalf Baechle #define PI_CC_PEND_CLR_B	0x0000e0 /* CC Interrupt Pending Clr, CPU B */
86*384740dcSRalf Baechle #define PI_CC_MASK		0x0000e8 /* CC Interrupt mask		    */
87*384740dcSRalf Baechle 
88*384740dcSRalf Baechle #define PI_INT_SET_OFFSET	0x08	 /* Offset from A to B		    */
89*384740dcSRalf Baechle 
90*384740dcSRalf Baechle /* Realtime Counter and Profiler control registers */
91*384740dcSRalf Baechle 
92*384740dcSRalf Baechle #define PI_RT_COUNT		0x030100 /* Real Time Counter		    */
93*384740dcSRalf Baechle #define PI_RT_COMPARE_A		0x000108 /* Real Time Compare A		    */
94*384740dcSRalf Baechle #define PI_RT_COMPARE_B		0x000110 /* Real Time Compare B		    */
95*384740dcSRalf Baechle #define PI_PROFILE_COMPARE	0x000118 /* L5 int to both cpus when == RTC */
96*384740dcSRalf Baechle #define PI_RT_PEND_A		0x000120 /* Set if RT int for A pending	    */
97*384740dcSRalf Baechle #define PI_RT_PEND_B		0x000128 /* Set if RT int for B pending	    */
98*384740dcSRalf Baechle #define PI_PROF_PEND_A		0x000130 /* Set if Prof int for A pending   */
99*384740dcSRalf Baechle #define PI_PROF_PEND_B		0x000138 /* Set if Prof int for B pending   */
100*384740dcSRalf Baechle #define PI_RT_EN_A		0x000140 /* RT int for CPU A enable	    */
101*384740dcSRalf Baechle #define PI_RT_EN_B		0x000148 /* RT int for CPU B enable	    */
102*384740dcSRalf Baechle #define PI_PROF_EN_A		0x000150 /* PROF int for CPU A enable	    */
103*384740dcSRalf Baechle #define PI_PROF_EN_B		0x000158 /* PROF int for CPU B enable	    */
104*384740dcSRalf Baechle #define PI_RT_LOCAL_CTRL	0x000160 /* RT control register		    */
105*384740dcSRalf Baechle #define PI_RT_FILTER_CTRL	0x000168 /* GCLK Filter control register    */
106*384740dcSRalf Baechle 
107*384740dcSRalf Baechle #define PI_COUNT_OFFSET		0x08	 /* A to B offset for all counts    */
108*384740dcSRalf Baechle 
109*384740dcSRalf Baechle /* Built-In Self Test support */
110*384740dcSRalf Baechle 
111*384740dcSRalf Baechle #define PI_BIST_WRITE_DATA	0x000200 /* BIST write data		    */
112*384740dcSRalf Baechle #define PI_BIST_READ_DATA	0x000208 /* BIST read data		    */
113*384740dcSRalf Baechle #define PI_BIST_COUNT_TARG	0x000210 /* BIST Count and Target	    */
114*384740dcSRalf Baechle #define PI_BIST_READY		0x000218 /* BIST Ready indicator	    */
115*384740dcSRalf Baechle #define PI_BIST_SHIFT_LOAD	0x000220 /* BIST control		    */
116*384740dcSRalf Baechle #define PI_BIST_SHIFT_UNLOAD	0x000228 /* BIST control		    */
117*384740dcSRalf Baechle #define PI_BIST_ENTER_RUN	0x000230 /* BIST control		    */
118*384740dcSRalf Baechle 
119*384740dcSRalf Baechle /* Graphics control registers */
120*384740dcSRalf Baechle 
121*384740dcSRalf Baechle #define PI_GFX_PAGE_A		0x000300 /* Graphics page A		    */
122*384740dcSRalf Baechle #define PI_GFX_CREDIT_CNTR_A	0x000308 /* Graphics credit counter A	    */
123*384740dcSRalf Baechle #define PI_GFX_BIAS_A		0x000310 /* Graphics bias A		    */
124*384740dcSRalf Baechle #define PI_GFX_INT_CNTR_A	0x000318 /* Graphics interrupt counter A    */
125*384740dcSRalf Baechle #define PI_GFX_INT_CMP_A	0x000320 /* Graphics interrupt comparator A */
126*384740dcSRalf Baechle #define PI_GFX_PAGE_B		0x000328 /* Graphics page B		    */
127*384740dcSRalf Baechle #define PI_GFX_CREDIT_CNTR_B	0x000330 /* Graphics credit counter B	    */
128*384740dcSRalf Baechle #define PI_GFX_BIAS_B		0x000338 /* Graphics bias B		    */
129*384740dcSRalf Baechle #define PI_GFX_INT_CNTR_B	0x000340 /* Graphics interrupt counter B    */
130*384740dcSRalf Baechle #define PI_GFX_INT_CMP_B	0x000348 /* Graphics interrupt comparator B */
131*384740dcSRalf Baechle 
132*384740dcSRalf Baechle #define PI_GFX_OFFSET		(PI_GFX_PAGE_B - PI_GFX_PAGE_A)
133*384740dcSRalf Baechle #define PI_GFX_PAGE_ENABLE	0x0000010000000000LL
134*384740dcSRalf Baechle 
135*384740dcSRalf Baechle /* Error and timeout registers */
136*384740dcSRalf Baechle #define PI_ERR_INT_PEND		0x000400 /* Error Interrupt Pending	    */
137*384740dcSRalf Baechle #define PI_ERR_INT_MASK_A	0x000408 /* Error Interrupt mask for CPU A  */
138*384740dcSRalf Baechle #define PI_ERR_INT_MASK_B	0x000410 /* Error Interrupt mask for CPU B  */
139*384740dcSRalf Baechle #define PI_ERR_STACK_ADDR_A	0x000418 /* Error stack address for CPU A   */
140*384740dcSRalf Baechle #define PI_ERR_STACK_ADDR_B	0x000420 /* Error stack address for CPU B   */
141*384740dcSRalf Baechle #define PI_ERR_STACK_SIZE	0x000428 /* Error Stack Size		    */
142*384740dcSRalf Baechle #define PI_ERR_STATUS0_A	0x000430 /* Error Status 0A		    */
143*384740dcSRalf Baechle #define PI_ERR_STATUS0_A_RCLR	0x000438 /* Error Status 0A clear on read   */
144*384740dcSRalf Baechle #define PI_ERR_STATUS1_A	0x000440 /* Error Status 1A		    */
145*384740dcSRalf Baechle #define PI_ERR_STATUS1_A_RCLR	0x000448 /* Error Status 1A clear on read   */
146*384740dcSRalf Baechle #define PI_ERR_STATUS0_B	0x000450 /* Error Status 0B		    */
147*384740dcSRalf Baechle #define PI_ERR_STATUS0_B_RCLR	0x000458 /* Error Status 0B clear on read   */
148*384740dcSRalf Baechle #define PI_ERR_STATUS1_B	0x000460 /* Error Status 1B		    */
149*384740dcSRalf Baechle #define PI_ERR_STATUS1_B_RCLR	0x000468 /* Error Status 1B clear on read   */
150*384740dcSRalf Baechle #define PI_SPOOL_CMP_A		0x000470 /* Spool compare for CPU A	    */
151*384740dcSRalf Baechle #define PI_SPOOL_CMP_B		0x000478 /* Spool compare for CPU B	    */
152*384740dcSRalf Baechle #define PI_CRB_TIMEOUT_A	0x000480 /* Timed out CRB entries for A	    */
153*384740dcSRalf Baechle #define PI_CRB_TIMEOUT_B	0x000488 /* Timed out CRB entries for B	    */
154*384740dcSRalf Baechle #define PI_SYSAD_ERRCHK_EN	0x000490 /* Enables SYSAD error checking    */
155*384740dcSRalf Baechle #define PI_BAD_CHECK_BIT_A	0x000498 /* Force SYSAD check bit error	    */
156*384740dcSRalf Baechle #define PI_BAD_CHECK_BIT_B	0x0004a0 /* Force SYSAD check bit error	    */
157*384740dcSRalf Baechle #define PI_NACK_CNT_A		0x0004a8 /* Consecutive NACK counter	    */
158*384740dcSRalf Baechle #define PI_NACK_CNT_B		0x0004b0 /*	"	" for CPU B	    */
159*384740dcSRalf Baechle #define PI_NACK_CMP		0x0004b8 /* NACK count compare		    */
160*384740dcSRalf Baechle #define PI_STACKADDR_OFFSET	(PI_ERR_STACK_ADDR_B - PI_ERR_STACK_ADDR_A)
161*384740dcSRalf Baechle #define PI_ERRSTAT_OFFSET	(PI_ERR_STATUS0_B - PI_ERR_STATUS0_A)
162*384740dcSRalf Baechle #define PI_RDCLR_OFFSET		(PI_ERR_STATUS0_A_RCLR - PI_ERR_STATUS0_A)
163*384740dcSRalf Baechle 
164*384740dcSRalf Baechle /* Bits in PI_ERR_INT_PEND */
165*384740dcSRalf Baechle #define PI_ERR_SPOOL_CMP_B	0x00000001	/* Spool end hit high water */
166*384740dcSRalf Baechle #define PI_ERR_SPOOL_CMP_A	0x00000002
167*384740dcSRalf Baechle #define PI_ERR_SPUR_MSG_B	0x00000004	/* Spurious message intr.   */
168*384740dcSRalf Baechle #define PI_ERR_SPUR_MSG_A	0x00000008
169*384740dcSRalf Baechle #define PI_ERR_WRB_TERR_B	0x00000010	/* WRB TERR		    */
170*384740dcSRalf Baechle #define PI_ERR_WRB_TERR_A	0x00000020
171*384740dcSRalf Baechle #define PI_ERR_WRB_WERR_B	0x00000040	/* WRB WERR		    */
172*384740dcSRalf Baechle #define PI_ERR_WRB_WERR_A	0x00000080
173*384740dcSRalf Baechle #define PI_ERR_SYSSTATE_B	0x00000100	/* SysState parity error    */
174*384740dcSRalf Baechle #define PI_ERR_SYSSTATE_A	0x00000200
175*384740dcSRalf Baechle #define PI_ERR_SYSAD_DATA_B	0x00000400	/* SysAD data parity error  */
176*384740dcSRalf Baechle #define PI_ERR_SYSAD_DATA_A	0x00000800
177*384740dcSRalf Baechle #define PI_ERR_SYSAD_ADDR_B	0x00001000	/* SysAD addr parity error  */
178*384740dcSRalf Baechle #define PI_ERR_SYSAD_ADDR_A	0x00002000
179*384740dcSRalf Baechle #define PI_ERR_SYSCMD_DATA_B	0x00004000	/* SysCmd data parity error */
180*384740dcSRalf Baechle #define PI_ERR_SYSCMD_DATA_A	0x00008000
181*384740dcSRalf Baechle #define PI_ERR_SYSCMD_ADDR_B	0x00010000	/* SysCmd addr parity error */
182*384740dcSRalf Baechle #define PI_ERR_SYSCMD_ADDR_A	0x00020000
183*384740dcSRalf Baechle #define PI_ERR_BAD_SPOOL_B	0x00040000	/* Error spooling to memory */
184*384740dcSRalf Baechle #define PI_ERR_BAD_SPOOL_A	0x00080000
185*384740dcSRalf Baechle #define PI_ERR_UNCAC_UNCORR_B	0x00100000	/* Uncached uncorrectable   */
186*384740dcSRalf Baechle #define PI_ERR_UNCAC_UNCORR_A	0x00200000
187*384740dcSRalf Baechle #define PI_ERR_SYSSTATE_TAG_B	0x00400000	/* SysState tag parity error */
188*384740dcSRalf Baechle #define PI_ERR_SYSSTATE_TAG_A	0x00800000
189*384740dcSRalf Baechle #define PI_ERR_MD_UNCORR	0x01000000	/* Must be cleared in MD    */
190*384740dcSRalf Baechle 
191*384740dcSRalf Baechle #define PI_ERR_CLEAR_ALL_A	0x00aaaaaa
192*384740dcSRalf Baechle #define PI_ERR_CLEAR_ALL_B	0x00555555
193*384740dcSRalf Baechle 
194*384740dcSRalf Baechle 
195*384740dcSRalf Baechle /*
196*384740dcSRalf Baechle  * The following three macros define all possible error int pends.
197*384740dcSRalf Baechle  */
198*384740dcSRalf Baechle 
199*384740dcSRalf Baechle #define PI_FATAL_ERR_CPU_A	(PI_ERR_SYSSTATE_TAG_A	| \
200*384740dcSRalf Baechle 				 PI_ERR_BAD_SPOOL_A	| \
201*384740dcSRalf Baechle 				 PI_ERR_SYSCMD_ADDR_A	| \
202*384740dcSRalf Baechle 				 PI_ERR_SYSCMD_DATA_A	| \
203*384740dcSRalf Baechle 				 PI_ERR_SYSAD_ADDR_A	| \
204*384740dcSRalf Baechle 				 PI_ERR_SYSAD_DATA_A	| \
205*384740dcSRalf Baechle 				 PI_ERR_SYSSTATE_A)
206*384740dcSRalf Baechle 
207*384740dcSRalf Baechle #define PI_MISC_ERR_CPU_A	(PI_ERR_UNCAC_UNCORR_A	| \
208*384740dcSRalf Baechle 				 PI_ERR_WRB_WERR_A	| \
209*384740dcSRalf Baechle 				 PI_ERR_WRB_TERR_A	| \
210*384740dcSRalf Baechle 				 PI_ERR_SPUR_MSG_A	| \
211*384740dcSRalf Baechle 				 PI_ERR_SPOOL_CMP_A)
212*384740dcSRalf Baechle 
213*384740dcSRalf Baechle #define PI_FATAL_ERR_CPU_B	(PI_ERR_SYSSTATE_TAG_B	| \
214*384740dcSRalf Baechle 				 PI_ERR_BAD_SPOOL_B	| \
215*384740dcSRalf Baechle 				 PI_ERR_SYSCMD_ADDR_B	| \
216*384740dcSRalf Baechle 				 PI_ERR_SYSCMD_DATA_B	| \
217*384740dcSRalf Baechle 				 PI_ERR_SYSAD_ADDR_B	| \
218*384740dcSRalf Baechle 				 PI_ERR_SYSAD_DATA_B	| \
219*384740dcSRalf Baechle 				 PI_ERR_SYSSTATE_B)
220*384740dcSRalf Baechle 
221*384740dcSRalf Baechle #define PI_MISC_ERR_CPU_B	(PI_ERR_UNCAC_UNCORR_B	| \
222*384740dcSRalf Baechle 				 PI_ERR_WRB_WERR_B	| \
223*384740dcSRalf Baechle 				 PI_ERR_WRB_TERR_B	| \
224*384740dcSRalf Baechle 				 PI_ERR_SPUR_MSG_B	| \
225*384740dcSRalf Baechle 				 PI_ERR_SPOOL_CMP_B)
226*384740dcSRalf Baechle 
227*384740dcSRalf Baechle #define PI_ERR_GENERIC	(PI_ERR_MD_UNCORR)
228*384740dcSRalf Baechle 
229*384740dcSRalf Baechle /*
230*384740dcSRalf Baechle  * Error types for PI_ERR_STATUS0_[AB] and error stack:
231*384740dcSRalf Baechle  * Use the write types if WRBRRB is 1 else use the read types
232*384740dcSRalf Baechle  */
233*384740dcSRalf Baechle 
234*384740dcSRalf Baechle /* Fields in PI_ERR_STATUS0_[AB] */
235*384740dcSRalf Baechle #define PI_ERR_ST0_TYPE_MASK	0x0000000000000007
236*384740dcSRalf Baechle #define PI_ERR_ST0_TYPE_SHFT	0
237*384740dcSRalf Baechle #define PI_ERR_ST0_REQNUM_MASK	0x0000000000000038
238*384740dcSRalf Baechle #define PI_ERR_ST0_REQNUM_SHFT	3
239*384740dcSRalf Baechle #define PI_ERR_ST0_SUPPL_MASK	0x000000000001ffc0
240*384740dcSRalf Baechle #define PI_ERR_ST0_SUPPL_SHFT	6
241*384740dcSRalf Baechle #define PI_ERR_ST0_CMD_MASK	0x0000000001fe0000
242*384740dcSRalf Baechle #define PI_ERR_ST0_CMD_SHFT	17
243*384740dcSRalf Baechle #define PI_ERR_ST0_ADDR_MASK	0x3ffffffffe000000
244*384740dcSRalf Baechle #define PI_ERR_ST0_ADDR_SHFT	25
245*384740dcSRalf Baechle #define PI_ERR_ST0_OVERRUN_MASK 0x4000000000000000
246*384740dcSRalf Baechle #define PI_ERR_ST0_OVERRUN_SHFT 62
247*384740dcSRalf Baechle #define PI_ERR_ST0_VALID_MASK	0x8000000000000000
248*384740dcSRalf Baechle #define PI_ERR_ST0_VALID_SHFT	63
249*384740dcSRalf Baechle 
250*384740dcSRalf Baechle /* Fields in PI_ERR_STATUS1_[AB] */
251*384740dcSRalf Baechle #define PI_ERR_ST1_SPOOL_MASK	0x00000000001fffff
252*384740dcSRalf Baechle #define PI_ERR_ST1_SPOOL_SHFT	0
253*384740dcSRalf Baechle #define PI_ERR_ST1_TOUTCNT_MASK 0x000000001fe00000
254*384740dcSRalf Baechle #define PI_ERR_ST1_TOUTCNT_SHFT 21
255*384740dcSRalf Baechle #define PI_ERR_ST1_INVCNT_MASK	0x0000007fe0000000
256*384740dcSRalf Baechle #define PI_ERR_ST1_INVCNT_SHFT	29
257*384740dcSRalf Baechle #define PI_ERR_ST1_CRBNUM_MASK	0x0000038000000000
258*384740dcSRalf Baechle #define PI_ERR_ST1_CRBNUM_SHFT	39
259*384740dcSRalf Baechle #define PI_ERR_ST1_WRBRRB_MASK	0x0000040000000000
260*384740dcSRalf Baechle #define PI_ERR_ST1_WRBRRB_SHFT	42
261*384740dcSRalf Baechle #define PI_ERR_ST1_CRBSTAT_MASK 0x001ff80000000000
262*384740dcSRalf Baechle #define PI_ERR_ST1_CRBSTAT_SHFT 43
263*384740dcSRalf Baechle #define PI_ERR_ST1_MSGSRC_MASK	0xffe0000000000000
264*384740dcSRalf Baechle #define PI_ERR_ST1_MSGSRC_SHFT	53
265*384740dcSRalf Baechle 
266*384740dcSRalf Baechle /* Fields in the error stack */
267*384740dcSRalf Baechle #define PI_ERR_STK_TYPE_MASK	0x0000000000000003
268*384740dcSRalf Baechle #define PI_ERR_STK_TYPE_SHFT	0
269*384740dcSRalf Baechle #define PI_ERR_STK_SUPPL_MASK	0x0000000000000038
270*384740dcSRalf Baechle #define PI_ERR_STK_SUPPL_SHFT	3
271*384740dcSRalf Baechle #define PI_ERR_STK_REQNUM_MASK	0x00000000000001c0
272*384740dcSRalf Baechle #define PI_ERR_STK_REQNUM_SHFT	6
273*384740dcSRalf Baechle #define PI_ERR_STK_CRBNUM_MASK	0x0000000000000e00
274*384740dcSRalf Baechle #define PI_ERR_STK_CRBNUM_SHFT	9
275*384740dcSRalf Baechle #define PI_ERR_STK_WRBRRB_MASK	0x0000000000001000
276*384740dcSRalf Baechle #define PI_ERR_STK_WRBRRB_SHFT	12
277*384740dcSRalf Baechle #define PI_ERR_STK_CRBSTAT_MASK 0x00000000007fe000
278*384740dcSRalf Baechle #define PI_ERR_STK_CRBSTAT_SHFT 13
279*384740dcSRalf Baechle #define PI_ERR_STK_CMD_MASK	0x000000007f800000
280*384740dcSRalf Baechle #define PI_ERR_STK_CMD_SHFT	23
281*384740dcSRalf Baechle #define PI_ERR_STK_ADDR_MASK	0xffffffff80000000
282*384740dcSRalf Baechle #define PI_ERR_STK_ADDR_SHFT	31
283*384740dcSRalf Baechle 
284*384740dcSRalf Baechle /* Error type in the error status or stack on Read CRBs */
285*384740dcSRalf Baechle #define PI_ERR_RD_PRERR		1
286*384740dcSRalf Baechle #define PI_ERR_RD_DERR		2
287*384740dcSRalf Baechle #define PI_ERR_RD_TERR		3
288*384740dcSRalf Baechle 
289*384740dcSRalf Baechle /* Error type in the error status or stack on Write CRBs */
290*384740dcSRalf Baechle #define PI_ERR_WR_WERR		0
291*384740dcSRalf Baechle #define PI_ERR_WR_PWERR		1
292*384740dcSRalf Baechle #define PI_ERR_WR_TERR		3
293*384740dcSRalf Baechle 
294*384740dcSRalf Baechle /* Read or Write CRB in error status or stack */
295*384740dcSRalf Baechle #define PI_ERR_RRB	0
296*384740dcSRalf Baechle #define PI_ERR_WRB	1
297*384740dcSRalf Baechle #define PI_ERR_ANY_CRB	2
298*384740dcSRalf Baechle 
299*384740dcSRalf Baechle /* Address masks in the error status and error stack are not the same */
300*384740dcSRalf Baechle #define ERR_STK_ADDR_SHFT	7
301*384740dcSRalf Baechle #define ERR_STAT0_ADDR_SHFT	3
302*384740dcSRalf Baechle 
303*384740dcSRalf Baechle #define PI_MIN_STACK_SIZE 4096	/* For figuring out the size to set */
304*384740dcSRalf Baechle #define PI_STACK_SIZE_SHFT	12	/* 4k */
305*384740dcSRalf Baechle 
306*384740dcSRalf Baechle #define ERR_STACK_SIZE_BYTES(_sz) \
307*384740dcSRalf Baechle        ((_sz) ? (PI_MIN_STACK_SIZE << ((_sz) - 1)) : 0)
308*384740dcSRalf Baechle 
309*384740dcSRalf Baechle #ifndef __ASSEMBLY__
310*384740dcSRalf Baechle /*
311*384740dcSRalf Baechle  * format of error stack and error status registers.
312*384740dcSRalf Baechle  */
313*384740dcSRalf Baechle 
314*384740dcSRalf Baechle struct err_stack_format {
315*384740dcSRalf Baechle 	u64	sk_addr	   : 33,   /* address */
316*384740dcSRalf Baechle 		sk_cmd	   :  8,   /* message command */
317*384740dcSRalf Baechle 		sk_crb_sts : 10,   /* status from RRB or WRB */
318*384740dcSRalf Baechle 		sk_rw_rb   :  1,   /* RRB == 0, WRB == 1 */
319*384740dcSRalf Baechle 		sk_crb_num :  3,   /* WRB (0 to 7) or RRB (0 to 4) */
320*384740dcSRalf Baechle 		sk_t5_req  :  3,   /* RRB T5 request number */
321*384740dcSRalf Baechle 		sk_suppl   :  3,   /* lowest 3 bit of supplemental */
322*384740dcSRalf Baechle 		sk_err_type:  3;   /* error type	*/
323*384740dcSRalf Baechle };
324*384740dcSRalf Baechle 
325*384740dcSRalf Baechle typedef union pi_err_stack {
326*384740dcSRalf Baechle 	u64	pi_stk_word;
327*384740dcSRalf Baechle 	struct	err_stack_format pi_stk_fmt;
328*384740dcSRalf Baechle } pi_err_stack_t;
329*384740dcSRalf Baechle 
330*384740dcSRalf Baechle struct err_status0_format {
331*384740dcSRalf Baechle 	u64	s0_valid   :  1,   /* Valid */
332*384740dcSRalf Baechle 		s0_ovr_run :  1,   /* Overrun, spooled to memory */
333*384740dcSRalf Baechle 		s0_addr	   : 37,   /* address */
334*384740dcSRalf Baechle 		s0_cmd	   :  8,   /* message command */
335*384740dcSRalf Baechle 		s0_supl	   : 11,   /* message supplemental field */
336*384740dcSRalf Baechle 		s0_t5_req  :  3,   /* RRB T5 request number */
337*384740dcSRalf Baechle 		s0_err_type:  3;   /* error type */
338*384740dcSRalf Baechle };
339*384740dcSRalf Baechle 
340*384740dcSRalf Baechle typedef union pi_err_stat0 {
341*384740dcSRalf Baechle 	u64	pi_stat0_word;
342*384740dcSRalf Baechle 	struct err_status0_format pi_stat0_fmt;
343*384740dcSRalf Baechle } pi_err_stat0_t;
344*384740dcSRalf Baechle 
345*384740dcSRalf Baechle struct err_status1_format {
346*384740dcSRalf Baechle 	u64	s1_src	   : 11,   /* message source */
347*384740dcSRalf Baechle 		s1_crb_sts : 10,   /* status from RRB or WRB */
348*384740dcSRalf Baechle 		s1_rw_rb   :  1,   /* RRB == 0, WRB == 1 */
349*384740dcSRalf Baechle 		s1_crb_num :  3,   /* WRB (0 to 7) or RRB (0 to 4) */
350*384740dcSRalf Baechle 		s1_inval_cnt:10,   /* signed invalidate counter RRB */
351*384740dcSRalf Baechle 		s1_to_cnt  :  8,   /* crb timeout counter */
352*384740dcSRalf Baechle 		s1_spl_cnt : 21;   /* number spooled to memory */
353*384740dcSRalf Baechle };
354*384740dcSRalf Baechle 
355*384740dcSRalf Baechle typedef union pi_err_stat1 {
356*384740dcSRalf Baechle 	u64	pi_stat1_word;
357*384740dcSRalf Baechle 	struct err_status1_format pi_stat1_fmt;
358*384740dcSRalf Baechle } pi_err_stat1_t;
359*384740dcSRalf Baechle 
360*384740dcSRalf Baechle typedef u64	rtc_time_t;
361*384740dcSRalf Baechle 
362*384740dcSRalf Baechle #endif /* !__ASSEMBLY__ */
363*384740dcSRalf Baechle 
364*384740dcSRalf Baechle 
365*384740dcSRalf Baechle /* Bits in PI_SYSAD_ERRCHK_EN */
366*384740dcSRalf Baechle #define PI_SYSAD_ERRCHK_ECCGEN	0x01	/* Enable ECC generation	    */
367*384740dcSRalf Baechle #define PI_SYSAD_ERRCHK_QUALGEN 0x02	/* Enable data quality signal gen.  */
368*384740dcSRalf Baechle #define PI_SYSAD_ERRCHK_SADP	0x04	/* Enable SysAD parity checking	    */
369*384740dcSRalf Baechle #define PI_SYSAD_ERRCHK_CMDP	0x08	/* Enable SysCmd parity checking    */
370*384740dcSRalf Baechle #define PI_SYSAD_ERRCHK_STATE	0x10	/* Enable SysState parity checking  */
371*384740dcSRalf Baechle #define PI_SYSAD_ERRCHK_QUAL	0x20	/* Enable data quality checking	    */
372*384740dcSRalf Baechle #define PI_SYSAD_CHECK_ALL	0x3f	/* Generate and check all signals.  */
373*384740dcSRalf Baechle 
374*384740dcSRalf Baechle /* Interrupt pending bits on R10000 */
375*384740dcSRalf Baechle 
376*384740dcSRalf Baechle #define HUB_IP_PEND0		0x0400
377*384740dcSRalf Baechle #define HUB_IP_PEND1_CC		0x0800
378*384740dcSRalf Baechle #define HUB_IP_RT		0x1000
379*384740dcSRalf Baechle #define HUB_IP_PROF		0x2000
380*384740dcSRalf Baechle #define HUB_IP_ERROR		0x4000
381*384740dcSRalf Baechle #define HUB_IP_MASK		0x7c00
382*384740dcSRalf Baechle 
383*384740dcSRalf Baechle /* PI_RT_LOCAL_CTRL mask and shift definitions */
384*384740dcSRalf Baechle 
385*384740dcSRalf Baechle #define PRLC_USE_INT_SHFT	16
386*384740dcSRalf Baechle #define PRLC_USE_INT_MASK	(UINT64_CAST 1 << 16)
387*384740dcSRalf Baechle #define PRLC_USE_INT		(UINT64_CAST 1 << 16)
388*384740dcSRalf Baechle #define PRLC_GCLK_SHFT		15
389*384740dcSRalf Baechle #define PRLC_GCLK_MASK		(UINT64_CAST 1 << 15)
390*384740dcSRalf Baechle #define PRLC_GCLK		(UINT64_CAST 1 << 15)
391*384740dcSRalf Baechle #define PRLC_GCLK_COUNT_SHFT	8
392*384740dcSRalf Baechle #define PRLC_GCLK_COUNT_MASK	(UINT64_CAST 0x7f << 8)
393*384740dcSRalf Baechle #define PRLC_MAX_COUNT_SHFT	1
394*384740dcSRalf Baechle #define PRLC_MAX_COUNT_MASK	(UINT64_CAST 0x7f << 1)
395*384740dcSRalf Baechle #define PRLC_GCLK_EN_SHFT	0
396*384740dcSRalf Baechle #define PRLC_GCLK_EN_MASK	(UINT64_CAST 1)
397*384740dcSRalf Baechle #define PRLC_GCLK_EN		(UINT64_CAST 1)
398*384740dcSRalf Baechle 
399*384740dcSRalf Baechle /* PI_RT_FILTER_CTRL mask and shift definitions */
400*384740dcSRalf Baechle 
401*384740dcSRalf Baechle /*
402*384740dcSRalf Baechle  * Bits for NACK_CNT_A/B and NACK_CMP
403*384740dcSRalf Baechle  */
404*384740dcSRalf Baechle #define PI_NACK_CNT_EN_SHFT	20
405*384740dcSRalf Baechle #define PI_NACK_CNT_EN_MASK	0x100000
406*384740dcSRalf Baechle #define PI_NACK_CNT_MASK	0x0fffff
407*384740dcSRalf Baechle #define PI_NACK_CNT_MAX		0x0fffff
408*384740dcSRalf Baechle 
409*384740dcSRalf Baechle #endif /* _ASM_SN_SN0_HUBPI_H */
410