xref: /OK3568_Linux_fs/kernel/arch/mips/include/asm/sn/sn0/hubio.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * This file is subject to the terms and conditions of the GNU General Public
3*4882a593Smuzhiyun  * License.  See the file "COPYING" in the main directory of this archive
4*4882a593Smuzhiyun  * for more details.
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * Derived from IRIX <sys/SN/SN0/hubio.h>, Revision 1.80.
7*4882a593Smuzhiyun  *
8*4882a593Smuzhiyun  * Copyright (C) 1992 - 1997, 1999 Silicon Graphics, Inc.
9*4882a593Smuzhiyun  * Copyright (C) 1999 by Ralf Baechle
10*4882a593Smuzhiyun  */
11*4882a593Smuzhiyun #ifndef _ASM_SGI_SN_SN0_HUBIO_H
12*4882a593Smuzhiyun #define _ASM_SGI_SN_SN0_HUBIO_H
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun /*
15*4882a593Smuzhiyun  * Hub I/O interface registers
16*4882a593Smuzhiyun  *
17*4882a593Smuzhiyun  * All registers in this file are subject to change until Hub chip tapeout.
18*4882a593Smuzhiyun  * In general, the longer software name should be used when available.
19*4882a593Smuzhiyun  */
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun /*
22*4882a593Smuzhiyun  * Slightly friendlier names for some common registers.
23*4882a593Smuzhiyun  * The hardware definitions follow.
24*4882a593Smuzhiyun  */
25*4882a593Smuzhiyun #define IIO_WIDGET		IIO_WID	     /* Widget identification */
26*4882a593Smuzhiyun #define IIO_WIDGET_STAT		IIO_WSTAT    /* Widget status register */
27*4882a593Smuzhiyun #define IIO_WIDGET_CTRL		IIO_WCR	     /* Widget control register */
28*4882a593Smuzhiyun #define IIO_WIDGET_TOUT		IIO_WRTO     /* Widget request timeout */
29*4882a593Smuzhiyun #define IIO_WIDGET_FLUSH	IIO_WTFR     /* Widget target flush */
30*4882a593Smuzhiyun #define IIO_PROTECT		IIO_ILAPR    /* IO interface protection */
31*4882a593Smuzhiyun #define IIO_PROTECT_OVRRD	IIO_ILAPO    /* IO protect override */
32*4882a593Smuzhiyun #define IIO_OUTWIDGET_ACCESS	IIO_IOWA     /* Outbound widget access */
33*4882a593Smuzhiyun #define IIO_INWIDGET_ACCESS	IIO_IIWA     /* Inbound widget access */
34*4882a593Smuzhiyun #define IIO_INDEV_ERR_MASK	IIO_IIDEM    /* Inbound device error mask */
35*4882a593Smuzhiyun #define IIO_LLP_CSR		IIO_ILCSR    /* LLP control and status */
36*4882a593Smuzhiyun #define IIO_LLP_LOG		IIO_ILLR     /* LLP log */
37*4882a593Smuzhiyun #define IIO_XTALKCC_TOUT	IIO_IXCC     /* Xtalk credit count timeout*/
38*4882a593Smuzhiyun #define IIO_XTALKTT_TOUT	IIO_IXTT     /* Xtalk tail timeout */
39*4882a593Smuzhiyun #define IIO_IO_ERR_CLR		IIO_IECLR    /* IO error clear */
40*4882a593Smuzhiyun #define IIO_BTE_CRB_CNT		IIO_IBCN     /* IO BTE CRB count */
41*4882a593Smuzhiyun 
42*4882a593Smuzhiyun #define IIO_LLP_CSR_IS_UP		0x00002000
43*4882a593Smuzhiyun #define IIO_LLP_CSR_LLP_STAT_MASK	0x00003000
44*4882a593Smuzhiyun #define IIO_LLP_CSR_LLP_STAT_SHFT	12
45*4882a593Smuzhiyun 
46*4882a593Smuzhiyun /* key to IIO_PROTECT_OVRRD */
47*4882a593Smuzhiyun #define IIO_PROTECT_OVRRD_KEY	0x53474972756c6573ull	/* "SGIrules" */
48*4882a593Smuzhiyun 
49*4882a593Smuzhiyun /* BTE register names */
50*4882a593Smuzhiyun #define IIO_BTE_STAT_0		IIO_IBLS_0   /* Also BTE length/status 0 */
51*4882a593Smuzhiyun #define IIO_BTE_SRC_0		IIO_IBSA_0   /* Also BTE source address	 0 */
52*4882a593Smuzhiyun #define IIO_BTE_DEST_0		IIO_IBDA_0   /* Also BTE dest. address 0 */
53*4882a593Smuzhiyun #define IIO_BTE_CTRL_0		IIO_IBCT_0   /* Also BTE control/terminate 0 */
54*4882a593Smuzhiyun #define IIO_BTE_NOTIFY_0	IIO_IBNA_0   /* Also BTE notification 0 */
55*4882a593Smuzhiyun #define IIO_BTE_INT_0		IIO_IBIA_0   /* Also BTE interrupt 0 */
56*4882a593Smuzhiyun #define IIO_BTE_OFF_0		0	     /* Base offset from BTE 0 regs. */
57*4882a593Smuzhiyun #define IIO_BTE_OFF_1	IIO_IBLS_1 - IIO_IBLS_0 /* Offset from base to BTE 1 */
58*4882a593Smuzhiyun 
59*4882a593Smuzhiyun /* BTE register offsets from base */
60*4882a593Smuzhiyun #define BTEOFF_STAT		0
61*4882a593Smuzhiyun #define BTEOFF_SRC		(IIO_BTE_SRC_0 - IIO_BTE_STAT_0)
62*4882a593Smuzhiyun #define BTEOFF_DEST		(IIO_BTE_DEST_0 - IIO_BTE_STAT_0)
63*4882a593Smuzhiyun #define BTEOFF_CTRL		(IIO_BTE_CTRL_0 - IIO_BTE_STAT_0)
64*4882a593Smuzhiyun #define BTEOFF_NOTIFY		(IIO_BTE_NOTIFY_0 - IIO_BTE_STAT_0)
65*4882a593Smuzhiyun #define BTEOFF_INT		(IIO_BTE_INT_0 - IIO_BTE_STAT_0)
66*4882a593Smuzhiyun 
67*4882a593Smuzhiyun 
68*4882a593Smuzhiyun /*
69*4882a593Smuzhiyun  * The following definitions use the names defined in the IO interface
70*4882a593Smuzhiyun  * document for ease of reference.  When possible, software should
71*4882a593Smuzhiyun  * generally use the longer but clearer names defined above.
72*4882a593Smuzhiyun  */
73*4882a593Smuzhiyun 
74*4882a593Smuzhiyun #define IIO_BASE	0x400000
75*4882a593Smuzhiyun #define IIO_BASE_BTE0	0x410000
76*4882a593Smuzhiyun #define IIO_BASE_BTE1	0x420000
77*4882a593Smuzhiyun #define IIO_BASE_PERF	0x430000
78*4882a593Smuzhiyun #define IIO_PERF_CNT	0x430008
79*4882a593Smuzhiyun 
80*4882a593Smuzhiyun #define IO_PERF_SETS	32
81*4882a593Smuzhiyun 
82*4882a593Smuzhiyun #define IIO_WID		0x400000	/* Widget identification */
83*4882a593Smuzhiyun #define IIO_WSTAT	0x400008	/* Widget status */
84*4882a593Smuzhiyun #define IIO_WCR		0x400020	/* Widget control */
85*4882a593Smuzhiyun 
86*4882a593Smuzhiyun #define IIO_WSTAT_ECRAZY	(1ULL << 32)	/* Hub gone crazy */
87*4882a593Smuzhiyun #define IIO_WSTAT_TXRETRY	(1ULL << 9)	/* Hub Tx Retry timeout */
88*4882a593Smuzhiyun #define IIO_WSTAT_TXRETRY_MASK	(0x7F)
89*4882a593Smuzhiyun #define IIO_WSTAT_TXRETRY_SHFT	(16)
90*4882a593Smuzhiyun #define IIO_WSTAT_TXRETRY_CNT(w)	(((w) >> IIO_WSTAT_TXRETRY_SHFT) & \
91*4882a593Smuzhiyun 					  IIO_WSTAT_TXRETRY_MASK)
92*4882a593Smuzhiyun 
93*4882a593Smuzhiyun #define IIO_ILAPR	0x400100	/* Local Access Protection */
94*4882a593Smuzhiyun #define IIO_ILAPO	0x400108	/* Protection override */
95*4882a593Smuzhiyun #define IIO_IOWA	0x400110	/* outbound widget access */
96*4882a593Smuzhiyun #define IIO_IIWA	0x400118	/* inbound widget access */
97*4882a593Smuzhiyun #define IIO_IIDEM	0x400120	/* Inbound Device Error Mask */
98*4882a593Smuzhiyun #define IIO_ILCSR	0x400128	/* LLP control and status */
99*4882a593Smuzhiyun #define IIO_ILLR	0x400130	/* LLP Log */
100*4882a593Smuzhiyun #define IIO_IIDSR	0x400138	/* Interrupt destination */
101*4882a593Smuzhiyun 
102*4882a593Smuzhiyun #define IIO_IIBUSERR	0x1400208	/* Reads here cause a bus error. */
103*4882a593Smuzhiyun 
104*4882a593Smuzhiyun /* IO Interrupt Destination Register */
105*4882a593Smuzhiyun #define IIO_IIDSR_SENT_SHIFT	28
106*4882a593Smuzhiyun #define IIO_IIDSR_SENT_MASK	0x10000000
107*4882a593Smuzhiyun #define IIO_IIDSR_ENB_SHIFT	24
108*4882a593Smuzhiyun #define IIO_IIDSR_ENB_MASK	0x01000000
109*4882a593Smuzhiyun #define IIO_IIDSR_NODE_SHIFT	8
110*4882a593Smuzhiyun #define IIO_IIDSR_NODE_MASK	0x0000ff00
111*4882a593Smuzhiyun #define IIO_IIDSR_LVL_SHIFT	0
112*4882a593Smuzhiyun #define IIO_IIDSR_LVL_MASK	0x0000003f
113*4882a593Smuzhiyun 
114*4882a593Smuzhiyun 
115*4882a593Smuzhiyun /* GFX Flow Control Node/Widget Register */
116*4882a593Smuzhiyun #define IIO_IGFX_0	0x400140	/* gfx node/widget register 0 */
117*4882a593Smuzhiyun #define IIO_IGFX_1	0x400148	/* gfx node/widget register 1 */
118*4882a593Smuzhiyun #define IIO_IGFX_W_NUM_BITS	4	/* size of widget num field */
119*4882a593Smuzhiyun #define IIO_IGFX_W_NUM_MASK	((1<<IIO_IGFX_W_NUM_BITS)-1)
120*4882a593Smuzhiyun #define IIO_IGFX_W_NUM_SHIFT	0
121*4882a593Smuzhiyun #define IIO_IGFX_N_NUM_BITS	9	/* size of node num field */
122*4882a593Smuzhiyun #define IIO_IGFX_N_NUM_MASK	((1<<IIO_IGFX_N_NUM_BITS)-1)
123*4882a593Smuzhiyun #define IIO_IGFX_N_NUM_SHIFT	4
124*4882a593Smuzhiyun #define IIO_IGFX_P_NUM_BITS	1	/* size of processor num field */
125*4882a593Smuzhiyun #define IIO_IGFX_P_NUM_MASK	((1<<IIO_IGFX_P_NUM_BITS)-1)
126*4882a593Smuzhiyun #define IIO_IGFX_P_NUM_SHIFT	16
127*4882a593Smuzhiyun #define IIO_IGFX_VLD_BITS	1	/* size of valid field */
128*4882a593Smuzhiyun #define IIO_IGFX_VLD_MASK	((1<<IIO_IGFX_VLD_BITS)-1)
129*4882a593Smuzhiyun #define IIO_IGFX_VLD_SHIFT	20
130*4882a593Smuzhiyun #define IIO_IGFX_INIT(widget, node, cpu, valid)				(\
131*4882a593Smuzhiyun 	(((widget) & IIO_IGFX_W_NUM_MASK) << IIO_IGFX_W_NUM_SHIFT) |	 \
132*4882a593Smuzhiyun 	(((node)   & IIO_IGFX_N_NUM_MASK) << IIO_IGFX_N_NUM_SHIFT) |	 \
133*4882a593Smuzhiyun 	(((cpu)	   & IIO_IGFX_P_NUM_MASK) << IIO_IGFX_P_NUM_SHIFT) |	 \
134*4882a593Smuzhiyun 	(((valid)  & IIO_IGFX_VLD_MASK)	  << IIO_IGFX_VLD_SHIFT)	 )
135*4882a593Smuzhiyun 
136*4882a593Smuzhiyun /* Scratch registers (not all bits available) */
137*4882a593Smuzhiyun #define IIO_SCRATCH_REG0	0x400150
138*4882a593Smuzhiyun #define IIO_SCRATCH_REG1	0x400158
139*4882a593Smuzhiyun #define IIO_SCRATCH_MASK	0x0000000f00f11fff
140*4882a593Smuzhiyun 
141*4882a593Smuzhiyun #define IIO_SCRATCH_BIT0_0	0x0000000800000000
142*4882a593Smuzhiyun #define IIO_SCRATCH_BIT0_1	0x0000000400000000
143*4882a593Smuzhiyun #define IIO_SCRATCH_BIT0_2	0x0000000200000000
144*4882a593Smuzhiyun #define IIO_SCRATCH_BIT0_3	0x0000000100000000
145*4882a593Smuzhiyun #define IIO_SCRATCH_BIT0_4	0x0000000000800000
146*4882a593Smuzhiyun #define IIO_SCRATCH_BIT0_5	0x0000000000400000
147*4882a593Smuzhiyun #define IIO_SCRATCH_BIT0_6	0x0000000000200000
148*4882a593Smuzhiyun #define IIO_SCRATCH_BIT0_7	0x0000000000100000
149*4882a593Smuzhiyun #define IIO_SCRATCH_BIT0_8	0x0000000000010000
150*4882a593Smuzhiyun #define IIO_SCRATCH_BIT0_9	0x0000000000001000
151*4882a593Smuzhiyun #define IIO_SCRATCH_BIT0_R	0x0000000000000fff
152*4882a593Smuzhiyun 
153*4882a593Smuzhiyun /* IO Translation Table Entries */
154*4882a593Smuzhiyun #define IIO_NUM_ITTES	7		/* ITTEs numbered 0..6 */
155*4882a593Smuzhiyun 					/* Hw manuals number them 1..7! */
156*4882a593Smuzhiyun 
157*4882a593Smuzhiyun /*
158*4882a593Smuzhiyun  * As a permanent workaround for a bug in the PI side of the hub, we've
159*4882a593Smuzhiyun  * redefined big window 7 as small window 0.
160*4882a593Smuzhiyun  */
161*4882a593Smuzhiyun #define HUB_NUM_BIG_WINDOW	IIO_NUM_ITTES - 1
162*4882a593Smuzhiyun 
163*4882a593Smuzhiyun /*
164*4882a593Smuzhiyun  * Use the top big window as a surrogate for the first small window
165*4882a593Smuzhiyun  */
166*4882a593Smuzhiyun #define SWIN0_BIGWIN		HUB_NUM_BIG_WINDOW
167*4882a593Smuzhiyun 
168*4882a593Smuzhiyun #define ILCSR_WARM_RESET	0x100
169*4882a593Smuzhiyun /*
170*4882a593Smuzhiyun  * The IO LLP control status register and widget control register
171*4882a593Smuzhiyun  */
172*4882a593Smuzhiyun #ifndef __ASSEMBLY__
173*4882a593Smuzhiyun 
174*4882a593Smuzhiyun typedef union hubii_wid_u {
175*4882a593Smuzhiyun 	u64	wid_reg_value;
176*4882a593Smuzhiyun 	struct {
177*4882a593Smuzhiyun 		u64	wid_rsvd:	32,	/* unused */
178*4882a593Smuzhiyun 			wid_rev_num:	 4,	/* revision number */
179*4882a593Smuzhiyun 			wid_part_num:	16,	/* the widget type: hub=c101 */
180*4882a593Smuzhiyun 			wid_mfg_num:	11,	/* Manufacturer id (IBM) */
181*4882a593Smuzhiyun 			wid_rsvd1:	 1;	/* Reserved */
182*4882a593Smuzhiyun 	} wid_fields_s;
183*4882a593Smuzhiyun } hubii_wid_t;
184*4882a593Smuzhiyun 
185*4882a593Smuzhiyun 
186*4882a593Smuzhiyun typedef union hubii_wcr_u {
187*4882a593Smuzhiyun 	u64	wcr_reg_value;
188*4882a593Smuzhiyun 	struct {
189*4882a593Smuzhiyun 		u64	wcr_rsvd:	41,	/* unused */
190*4882a593Smuzhiyun 			wcr_e_thresh:	 5,	/* elasticity threshold */
191*4882a593Smuzhiyun 			wcr_dir_con:	 1,	/* widget direct connect */
192*4882a593Smuzhiyun 			wcr_f_bad_pkt:	 1,	/* Force bad llp pkt enable */
193*4882a593Smuzhiyun 			wcr_xbar_crd:	 3,	/* LLP crossbar credit */
194*4882a593Smuzhiyun 			wcr_rsvd1:	 8,	/* Reserved */
195*4882a593Smuzhiyun 			wcr_tag_mode:	 1,	/* Tag mode */
196*4882a593Smuzhiyun 			wcr_widget_id:	 4;	/* LLP crossbar credit */
197*4882a593Smuzhiyun 	} wcr_fields_s;
198*4882a593Smuzhiyun } hubii_wcr_t;
199*4882a593Smuzhiyun 
200*4882a593Smuzhiyun #define iwcr_dir_con	wcr_fields_s.wcr_dir_con
201*4882a593Smuzhiyun 
202*4882a593Smuzhiyun typedef union hubii_wstat_u {
203*4882a593Smuzhiyun 	u64	 reg_value;
204*4882a593Smuzhiyun 	struct {
205*4882a593Smuzhiyun 		u64	rsvd1:		31,
206*4882a593Smuzhiyun 			crazy:		 1,	/* Crazy bit		*/
207*4882a593Smuzhiyun 			rsvd2:		 8,
208*4882a593Smuzhiyun 			llp_tx_cnt:	 8,	/* LLP Xmit retry counter */
209*4882a593Smuzhiyun 			rsvd3:		 6,
210*4882a593Smuzhiyun 			tx_max_rtry:	 1,	/* LLP Retry Timeout Signal */
211*4882a593Smuzhiyun 			rsvd4:		 2,
212*4882a593Smuzhiyun 			xt_tail_to:	 1,	/* Xtalk Tail Timeout	*/
213*4882a593Smuzhiyun 			xt_crd_to:	 1,	/* Xtalk Credit Timeout */
214*4882a593Smuzhiyun 			pending:	 4;	/* Pending Requests	*/
215*4882a593Smuzhiyun 	} wstat_fields_s;
216*4882a593Smuzhiyun } hubii_wstat_t;
217*4882a593Smuzhiyun 
218*4882a593Smuzhiyun 
219*4882a593Smuzhiyun typedef union hubii_ilcsr_u {
220*4882a593Smuzhiyun 	u64	icsr_reg_value;
221*4882a593Smuzhiyun 	struct {
222*4882a593Smuzhiyun 		u64	icsr_rsvd:	22,	/* unused */
223*4882a593Smuzhiyun 			icsr_max_burst: 10,	/* max burst */
224*4882a593Smuzhiyun 			icsr_rsvd4:	 6,	/* reserved */
225*4882a593Smuzhiyun 			icsr_max_retry: 10,	/* max retry */
226*4882a593Smuzhiyun 			icsr_rsvd3:	 2,	/* reserved */
227*4882a593Smuzhiyun 			icsr_lnk_stat:	 2,	/* link status */
228*4882a593Smuzhiyun 			icsr_bm8:	 1,	/* Bit mode 8 */
229*4882a593Smuzhiyun 			icsr_llp_en:	 1,	/* LLP enable bit */
230*4882a593Smuzhiyun 			icsr_rsvd2:	 1,	/* reserver */
231*4882a593Smuzhiyun 			icsr_wrm_reset:	 1,	/* Warm reset bit */
232*4882a593Smuzhiyun 			icsr_rsvd1:	 2,	/* Data ready offset */
233*4882a593Smuzhiyun 			icsr_null_to:	 6;	/* Null timeout	  */
234*4882a593Smuzhiyun 
235*4882a593Smuzhiyun 	} icsr_fields_s;
236*4882a593Smuzhiyun } hubii_ilcsr_t;
237*4882a593Smuzhiyun 
238*4882a593Smuzhiyun 
239*4882a593Smuzhiyun typedef union hubii_iowa_u {
240*4882a593Smuzhiyun 	u64	iowa_reg_value;
241*4882a593Smuzhiyun 	struct {
242*4882a593Smuzhiyun 		u64	iowa_rsvd:	48,	/* unused */
243*4882a593Smuzhiyun 			iowa_wxoac:	 8,	/* xtalk widget access bits */
244*4882a593Smuzhiyun 			iowa_rsvd1:	 7,	/* xtalk widget access bits */
245*4882a593Smuzhiyun 			iowa_w0oac:	 1;	/* xtalk widget access bits */
246*4882a593Smuzhiyun 	} iowa_fields_s;
247*4882a593Smuzhiyun } hubii_iowa_t;
248*4882a593Smuzhiyun 
249*4882a593Smuzhiyun typedef union hubii_iiwa_u {
250*4882a593Smuzhiyun 	u64	iiwa_reg_value;
251*4882a593Smuzhiyun 	struct {
252*4882a593Smuzhiyun 		u64	iiwa_rsvd:	48,	/* unused */
253*4882a593Smuzhiyun 			iiwa_wxiac:	 8,	/* hub wid access bits */
254*4882a593Smuzhiyun 			iiwa_rsvd1:	 7,	/* reserved */
255*4882a593Smuzhiyun 			iiwa_w0iac:	 1;	/* hub wid0 access */
256*4882a593Smuzhiyun 	} iiwa_fields_s;
257*4882a593Smuzhiyun } hubii_iiwa_t;
258*4882a593Smuzhiyun 
259*4882a593Smuzhiyun typedef union	hubii_illr_u {
260*4882a593Smuzhiyun 	u64	illr_reg_value;
261*4882a593Smuzhiyun 	struct {
262*4882a593Smuzhiyun 		u64	illr_rsvd:	32,	/* unused */
263*4882a593Smuzhiyun 			illr_cb_cnt:	16,	/* checkbit error count */
264*4882a593Smuzhiyun 			illr_sn_cnt:	16;	/* sequence number count */
265*4882a593Smuzhiyun 	} illr_fields_s;
266*4882a593Smuzhiyun } hubii_illr_t;
267*4882a593Smuzhiyun 
268*4882a593Smuzhiyun /* The structures below are defined to extract and modify the ii
269*4882a593Smuzhiyun performance registers */
270*4882a593Smuzhiyun 
271*4882a593Smuzhiyun /* io_perf_sel allows the caller to specify what tests will be
272*4882a593Smuzhiyun    performed */
273*4882a593Smuzhiyun typedef union io_perf_sel {
274*4882a593Smuzhiyun 	u64 perf_sel_reg;
275*4882a593Smuzhiyun 	struct {
276*4882a593Smuzhiyun 		u64	perf_rsvd  : 48,
277*4882a593Smuzhiyun 			perf_icct  :  8,
278*4882a593Smuzhiyun 			perf_ippr1 :  4,
279*4882a593Smuzhiyun 			perf_ippr0 :  4;
280*4882a593Smuzhiyun 	} perf_sel_bits;
281*4882a593Smuzhiyun } io_perf_sel_t;
282*4882a593Smuzhiyun 
283*4882a593Smuzhiyun /* io_perf_cnt is to extract the count from the hub registers. Due to
284*4882a593Smuzhiyun    hardware problems there is only one counter, not two. */
285*4882a593Smuzhiyun 
286*4882a593Smuzhiyun typedef union io_perf_cnt {
287*4882a593Smuzhiyun 	u64	perf_cnt;
288*4882a593Smuzhiyun 	struct {
289*4882a593Smuzhiyun 		u64	perf_rsvd1 : 32,
290*4882a593Smuzhiyun 			perf_rsvd2 : 12,
291*4882a593Smuzhiyun 			perf_cnt   : 20;
292*4882a593Smuzhiyun 	} perf_cnt_bits;
293*4882a593Smuzhiyun } io_perf_cnt_t;
294*4882a593Smuzhiyun 
295*4882a593Smuzhiyun #endif /* !__ASSEMBLY__ */
296*4882a593Smuzhiyun 
297*4882a593Smuzhiyun 
298*4882a593Smuzhiyun #define LNK_STAT_WORKING	0x2
299*4882a593Smuzhiyun 
300*4882a593Smuzhiyun #define IIO_LLP_CB_MAX	0xffff
301*4882a593Smuzhiyun #define IIO_LLP_SN_MAX	0xffff
302*4882a593Smuzhiyun 
303*4882a593Smuzhiyun /* IO PRB Entries */
304*4882a593Smuzhiyun #define IIO_NUM_IPRBS	(9)
305*4882a593Smuzhiyun #define IIO_IOPRB_0	0x400198	/* PRB entry 0 */
306*4882a593Smuzhiyun #define IIO_IOPRB_8	0x4001a0	/* PRB entry 8 */
307*4882a593Smuzhiyun #define IIO_IOPRB_9	0x4001a8	/* PRB entry 9 */
308*4882a593Smuzhiyun #define IIO_IOPRB_A	0x4001b0	/* PRB entry a */
309*4882a593Smuzhiyun #define IIO_IOPRB_B	0x4001b8	/* PRB entry b */
310*4882a593Smuzhiyun #define IIO_IOPRB_C	0x4001c0	/* PRB entry c */
311*4882a593Smuzhiyun #define IIO_IOPRB_D	0x4001c8	/* PRB entry d */
312*4882a593Smuzhiyun #define IIO_IOPRB_E	0x4001d0	/* PRB entry e */
313*4882a593Smuzhiyun #define IIO_IOPRB_F	0x4001d8	/* PRB entry f */
314*4882a593Smuzhiyun 
315*4882a593Smuzhiyun 
316*4882a593Smuzhiyun #define IIO_IXCC	0x4001e0	/* Crosstalk credit count timeout */
317*4882a593Smuzhiyun #define IIO_IXTCC	IIO_IXCC
318*4882a593Smuzhiyun #define IIO_IMEM	0x4001e8	/* Miscellaneous Enable Mask */
319*4882a593Smuzhiyun #define IIO_IXTT	0x4001f0	/* Crosstalk tail timeout */
320*4882a593Smuzhiyun #define IIO_IECLR	0x4001f8	/* IO error clear */
321*4882a593Smuzhiyun #define IIO_IBCN	0x400200	/* IO BTE CRB count */
322*4882a593Smuzhiyun 
323*4882a593Smuzhiyun /*
324*4882a593Smuzhiyun  * IIO_IMEM Register fields.
325*4882a593Smuzhiyun  */
326*4882a593Smuzhiyun #define IIO_IMEM_W0ESD	0x1		/* Widget 0 shut down due to error */
327*4882a593Smuzhiyun #define IIO_IMEM_B0ESD	(1 << 4)	/* BTE 0 shut down due to error */
328*4882a593Smuzhiyun #define IIO_IMEM_B1ESD	(1 << 8)	/* BTE 1 Shut down due to error */
329*4882a593Smuzhiyun 
330*4882a593Smuzhiyun /* PIO Read address Table Entries */
331*4882a593Smuzhiyun #define IIO_IPCA	0x400300	/* PRB Counter adjust */
332*4882a593Smuzhiyun #define IIO_NUM_PRTES	8		/* Total number of PRB table entries */
333*4882a593Smuzhiyun #define IIO_PRTE_0	0x400308	/* PIO Read address table entry 0 */
334*4882a593Smuzhiyun #define IIO_PRTE(_x)	(IIO_PRTE_0 + (8 * (_x)))
335*4882a593Smuzhiyun #define IIO_WIDPRTE(x)	IIO_PRTE(((x) - 8)) /* widget ID to its PRTE num */
336*4882a593Smuzhiyun #define IIO_IPDR	0x400388	/* PIO table entry deallocation */
337*4882a593Smuzhiyun #define IIO_ICDR	0x400390	/* CRB Entry Deallocation */
338*4882a593Smuzhiyun #define IIO_IFDR	0x400398	/* IOQ FIFO Depth */
339*4882a593Smuzhiyun #define IIO_IIAP	0x4003a0	/* IIQ Arbitration Parameters */
340*4882a593Smuzhiyun #define IIO_IMMR	IIO_IIAP
341*4882a593Smuzhiyun #define IIO_ICMR	0x4003a8	/* CRB Management Register */
342*4882a593Smuzhiyun #define IIO_ICCR	0x4003b0	/* CRB Control Register */
343*4882a593Smuzhiyun #define IIO_ICTO	0x4003b8	/* CRB Time Out Register */
344*4882a593Smuzhiyun #define IIO_ICTP	0x4003c0	/* CRB Time Out Prescalar */
345*4882a593Smuzhiyun 
346*4882a593Smuzhiyun 
347*4882a593Smuzhiyun /*
348*4882a593Smuzhiyun  * ICMR register fields
349*4882a593Smuzhiyun  */
350*4882a593Smuzhiyun #define IIO_ICMR_PC_VLD_SHFT	36
351*4882a593Smuzhiyun #define IIO_ICMR_PC_VLD_MASK	(0x7fffUL << IIO_ICMR_PC_VLD_SHFT)
352*4882a593Smuzhiyun 
353*4882a593Smuzhiyun #define IIO_ICMR_CRB_VLD_SHFT	20
354*4882a593Smuzhiyun #define IIO_ICMR_CRB_VLD_MASK	(0x7fffUL << IIO_ICMR_CRB_VLD_SHFT)
355*4882a593Smuzhiyun 
356*4882a593Smuzhiyun #define IIO_ICMR_FC_CNT_SHFT	16
357*4882a593Smuzhiyun #define IIO_ICMR_FC_CNT_MASK	(0xf << IIO_ICMR_FC_CNT_SHFT)
358*4882a593Smuzhiyun 
359*4882a593Smuzhiyun #define IIO_ICMR_C_CNT_SHFT	4
360*4882a593Smuzhiyun #define IIO_ICMR_C_CNT_MASK	(0xf << IIO_ICMR_C_CNT_SHFT)
361*4882a593Smuzhiyun 
362*4882a593Smuzhiyun #define IIO_ICMR_P_CNT_SHFT	0
363*4882a593Smuzhiyun #define IIO_ICMR_P_CNT_MASK	(0xf << IIO_ICMR_P_CNT_SHFT)
364*4882a593Smuzhiyun 
365*4882a593Smuzhiyun #define IIO_ICMR_PRECISE	(1UL << 52)
366*4882a593Smuzhiyun #define IIO_ICMR_CLR_RPPD	(1UL << 13)
367*4882a593Smuzhiyun #define IIO_ICMR_CLR_RQPD	(1UL << 12)
368*4882a593Smuzhiyun 
369*4882a593Smuzhiyun /*
370*4882a593Smuzhiyun  * IIO PIO Deallocation register field masks : (IIO_IPDR)
371*4882a593Smuzhiyun  */
372*4882a593Smuzhiyun #define IIO_IPDR_PND	(1 << 4)
373*4882a593Smuzhiyun 
374*4882a593Smuzhiyun /*
375*4882a593Smuzhiyun  * IIO CRB deallocation register field masks: (IIO_ICDR)
376*4882a593Smuzhiyun  */
377*4882a593Smuzhiyun #define IIO_ICDR_PND	(1 << 4)
378*4882a593Smuzhiyun 
379*4882a593Smuzhiyun /*
380*4882a593Smuzhiyun  * IIO CRB control register Fields: IIO_ICCR
381*4882a593Smuzhiyun  */
382*4882a593Smuzhiyun #define IIO_ICCR_PENDING	(0x10000)
383*4882a593Smuzhiyun #define IIO_ICCR_CMD_MASK	(0xFF)
384*4882a593Smuzhiyun #define IIO_ICCR_CMD_SHFT	(7)
385*4882a593Smuzhiyun #define IIO_ICCR_CMD_NOP	(0x0)	/* No Op */
386*4882a593Smuzhiyun #define IIO_ICCR_CMD_WAKE	(0x100) /* Reactivate CRB entry and process */
387*4882a593Smuzhiyun #define IIO_ICCR_CMD_TIMEOUT	(0x200) /* Make CRB timeout & mark invalid */
388*4882a593Smuzhiyun #define IIO_ICCR_CMD_EJECT	(0x400) /* Contents of entry written to memory
389*4882a593Smuzhiyun 					 * via a WB
390*4882a593Smuzhiyun 					 */
391*4882a593Smuzhiyun #define IIO_ICCR_CMD_FLUSH	(0x800)
392*4882a593Smuzhiyun 
393*4882a593Smuzhiyun /*
394*4882a593Smuzhiyun  * CRB manipulation macros
395*4882a593Smuzhiyun  *	The CRB macros are slightly complicated, since there are up to
396*4882a593Smuzhiyun  *	four registers associated with each CRB entry.
397*4882a593Smuzhiyun  */
398*4882a593Smuzhiyun #define IIO_NUM_CRBS		15	/* Number of CRBs */
399*4882a593Smuzhiyun #define IIO_NUM_NORMAL_CRBS	12	/* Number of regular CRB entries */
400*4882a593Smuzhiyun #define IIO_NUM_PC_CRBS		4	/* Number of partial cache CRBs */
401*4882a593Smuzhiyun #define IIO_ICRB_OFFSET		8
402*4882a593Smuzhiyun #define IIO_ICRB_0		0x400400
403*4882a593Smuzhiyun /* XXX - This is now tuneable:
404*4882a593Smuzhiyun 	#define IIO_FIRST_PC_ENTRY 12
405*4882a593Smuzhiyun  */
406*4882a593Smuzhiyun 
407*4882a593Smuzhiyun #define IIO_ICRB_A(_x)	(IIO_ICRB_0 + (4 * IIO_ICRB_OFFSET * (_x)))
408*4882a593Smuzhiyun #define IIO_ICRB_B(_x)	(IIO_ICRB_A(_x) + 1*IIO_ICRB_OFFSET)
409*4882a593Smuzhiyun #define IIO_ICRB_C(_x)	(IIO_ICRB_A(_x) + 2*IIO_ICRB_OFFSET)
410*4882a593Smuzhiyun #define IIO_ICRB_D(_x)	(IIO_ICRB_A(_x) + 3*IIO_ICRB_OFFSET)
411*4882a593Smuzhiyun 
412*4882a593Smuzhiyun /* XXX - IBUE register coming for Hub 2 */
413*4882a593Smuzhiyun 
414*4882a593Smuzhiyun /*
415*4882a593Smuzhiyun  *
416*4882a593Smuzhiyun  * CRB Register description.
417*4882a593Smuzhiyun  *
418*4882a593Smuzhiyun  * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING
419*4882a593Smuzhiyun  * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING
420*4882a593Smuzhiyun  * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING
421*4882a593Smuzhiyun  * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING
422*4882a593Smuzhiyun  * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING
423*4882a593Smuzhiyun  *
424*4882a593Smuzhiyun  * Many of the fields in CRB are status bits used by hardware
425*4882a593Smuzhiyun  * for implementation of the protocol. It's very dangerous to
426*4882a593Smuzhiyun  * mess around with the CRB registers.
427*4882a593Smuzhiyun  *
428*4882a593Smuzhiyun  * It's OK to read the CRB registers and try to make sense out of the
429*4882a593Smuzhiyun  * fields in CRB.
430*4882a593Smuzhiyun  *
431*4882a593Smuzhiyun  * Updating CRB requires all activities in Hub IIO to be quiesced.
432*4882a593Smuzhiyun  * otherwise, a write to CRB could corrupt other CRB entries.
433*4882a593Smuzhiyun  * CRBs are here only as a back door peek to hub IIO's status.
434*4882a593Smuzhiyun  * Quiescing implies  no dmas no PIOs
435*4882a593Smuzhiyun  * either directly from the cpu or from sn0net.
436*4882a593Smuzhiyun  * this is not something that can be done easily. So, AVOID updating
437*4882a593Smuzhiyun  * CRBs.
438*4882a593Smuzhiyun  */
439*4882a593Smuzhiyun 
440*4882a593Smuzhiyun /*
441*4882a593Smuzhiyun  * Fields in CRB Register A
442*4882a593Smuzhiyun  */
443*4882a593Smuzhiyun #ifndef __ASSEMBLY__
444*4882a593Smuzhiyun typedef union icrba_u {
445*4882a593Smuzhiyun 	u64	reg_value;
446*4882a593Smuzhiyun 	struct {
447*4882a593Smuzhiyun 		u64	resvd:	6,
448*4882a593Smuzhiyun 			stall_bte0: 1,	/* Stall BTE 0 */
449*4882a593Smuzhiyun 			stall_bte1: 1,	/* Stall BTE 1 */
450*4882a593Smuzhiyun 			error:	1,	/* CRB has an error	*/
451*4882a593Smuzhiyun 			ecode:	3,	/* Error Code		*/
452*4882a593Smuzhiyun 			lnetuce: 1,	/* SN0net Uncorrectable error */
453*4882a593Smuzhiyun 			mark:	1,	/* CRB Has been marked	*/
454*4882a593Smuzhiyun 			xerr:	1,	/* Error bit set in xtalk header */
455*4882a593Smuzhiyun 			sidn:	4,	/* SIDN field from xtalk	*/
456*4882a593Smuzhiyun 			tnum:	5,	/* TNUM field in xtalk		*/
457*4882a593Smuzhiyun 			addr:	38,	/* Address of request	*/
458*4882a593Smuzhiyun 			valid:	1,	/* Valid status		*/
459*4882a593Smuzhiyun 			iow:	1;	/* IO Write operation	*/
460*4882a593Smuzhiyun 	} icrba_fields_s;
461*4882a593Smuzhiyun } icrba_t;
462*4882a593Smuzhiyun 
463*4882a593Smuzhiyun /* This is an alternate typedef for the HUB1 CRB A in order to allow
464*4882a593Smuzhiyun    runtime selection of the format based on the REV_ID field of the
465*4882a593Smuzhiyun    NI_STATUS_REV_ID register. */
466*4882a593Smuzhiyun typedef union h1_icrba_u {
467*4882a593Smuzhiyun 	u64	reg_value;
468*4882a593Smuzhiyun 
469*4882a593Smuzhiyun 	struct {
470*4882a593Smuzhiyun 		u64	resvd:	6,
471*4882a593Smuzhiyun 			unused: 1,	/* Unused but RW!!	*/
472*4882a593Smuzhiyun 			error:	1,	/* CRB has an error	*/
473*4882a593Smuzhiyun 			ecode:	4,	/* Error Code		*/
474*4882a593Smuzhiyun 			lnetuce: 1,	/* SN0net Uncorrectable error */
475*4882a593Smuzhiyun 			mark:	1,	/* CRB Has been marked	*/
476*4882a593Smuzhiyun 			xerr:	1,	/* Error bit set in xtalk header */
477*4882a593Smuzhiyun 			sidn:	4,	/* SIDN field from xtalk	*/
478*4882a593Smuzhiyun 			tnum:	5,	/* TNUM field in xtalk		*/
479*4882a593Smuzhiyun 			addr:	38,	/* Address of request	*/
480*4882a593Smuzhiyun 			valid:	1,	/* Valid status		*/
481*4882a593Smuzhiyun 			iow:	1;	/* IO Write operation	*/
482*4882a593Smuzhiyun 	} h1_icrba_fields_s;
483*4882a593Smuzhiyun } h1_icrba_t;
484*4882a593Smuzhiyun 
485*4882a593Smuzhiyun /* XXX - Is this still right?  Check the spec. */
486*4882a593Smuzhiyun #define ICRBN_A_CERR_SHFT	54
487*4882a593Smuzhiyun #define ICRBN_A_ERR_MASK	0x3ff
488*4882a593Smuzhiyun 
489*4882a593Smuzhiyun #endif /* !__ASSEMBLY__ */
490*4882a593Smuzhiyun 
491*4882a593Smuzhiyun #define IIO_ICRB_ADDR_SHFT	2	/* Shift to get proper address */
492*4882a593Smuzhiyun 
493*4882a593Smuzhiyun /*
494*4882a593Smuzhiyun  * values for "ecode" field
495*4882a593Smuzhiyun  */
496*4882a593Smuzhiyun #define IIO_ICRB_ECODE_DERR	0	/* Directory error due to IIO access */
497*4882a593Smuzhiyun #define IIO_ICRB_ECODE_PERR	1	/* Poison error on IO access */
498*4882a593Smuzhiyun #define IIO_ICRB_ECODE_WERR	2	/* Write error by IIO access
499*4882a593Smuzhiyun 					 * e.g. WINV to a Read only line.
500*4882a593Smuzhiyun 					 */
501*4882a593Smuzhiyun #define IIO_ICRB_ECODE_AERR	3	/* Access error caused by IIO access */
502*4882a593Smuzhiyun #define IIO_ICRB_ECODE_PWERR	4	/* Error on partial write	*/
503*4882a593Smuzhiyun #define IIO_ICRB_ECODE_PRERR	5	/* Error on partial read	*/
504*4882a593Smuzhiyun #define IIO_ICRB_ECODE_TOUT	6	/* CRB timeout before deallocating */
505*4882a593Smuzhiyun #define IIO_ICRB_ECODE_XTERR	7	/* Incoming xtalk pkt had error bit */
506*4882a593Smuzhiyun 
507*4882a593Smuzhiyun 
508*4882a593Smuzhiyun 
509*4882a593Smuzhiyun /*
510*4882a593Smuzhiyun  * Fields in CRB Register B
511*4882a593Smuzhiyun  */
512*4882a593Smuzhiyun #ifndef __ASSEMBLY__
513*4882a593Smuzhiyun typedef union icrbb_u {
514*4882a593Smuzhiyun 	u64	reg_value;
515*4882a593Smuzhiyun 	struct {
516*4882a593Smuzhiyun 	    u64 rsvd1:	5,
517*4882a593Smuzhiyun 		btenum: 1,	/* BTE to which entry belongs to */
518*4882a593Smuzhiyun 		cohtrans: 1,	/* Coherent transaction */
519*4882a593Smuzhiyun 		xtsize: 2,	/* Xtalk operation size
520*4882a593Smuzhiyun 				 * 0: Double Word
521*4882a593Smuzhiyun 				 * 1: 32 Bytes.
522*4882a593Smuzhiyun 				 * 2: 128 Bytes,
523*4882a593Smuzhiyun 				 * 3: Reserved.
524*4882a593Smuzhiyun 				 */
525*4882a593Smuzhiyun 		srcnode: 9,	/* Source Node ID		*/
526*4882a593Smuzhiyun 		srcinit: 2,	/* Source Initiator:
527*4882a593Smuzhiyun 				 * See below for field values.
528*4882a593Smuzhiyun 				 */
529*4882a593Smuzhiyun 		useold: 1,	/* Use OLD command for processing */
530*4882a593Smuzhiyun 		imsgtype: 2,	/* Incoming message type
531*4882a593Smuzhiyun 				 * see below for field values
532*4882a593Smuzhiyun 				 */
533*4882a593Smuzhiyun 		imsg:	8,	/* Incoming message	*/
534*4882a593Smuzhiyun 		initator: 3,	/* Initiator of original request
535*4882a593Smuzhiyun 				 * See below for field values.
536*4882a593Smuzhiyun 				 */
537*4882a593Smuzhiyun 		reqtype: 5,	/* Identifies type of request
538*4882a593Smuzhiyun 				 * See below for field values.
539*4882a593Smuzhiyun 				 */
540*4882a593Smuzhiyun 		rsvd2:	7,
541*4882a593Smuzhiyun 		ackcnt: 11,	/* Invalidate ack count */
542*4882a593Smuzhiyun 		resp:	1,	/* data response  given to processor */
543*4882a593Smuzhiyun 		ack:	1,	/* indicates data ack received	*/
544*4882a593Smuzhiyun 		hold:	1,	/* entry is gathering inval acks */
545*4882a593Smuzhiyun 		wb_pend:1,	/* waiting for writeback to complete */
546*4882a593Smuzhiyun 		intvn:	1,	/* Intervention */
547*4882a593Smuzhiyun 		stall_ib: 1,	/* Stall Ibuf (from crosstalk) */
548*4882a593Smuzhiyun 		stall_intr: 1;	/* Stall internal interrupts */
549*4882a593Smuzhiyun 	} icrbb_field_s;
550*4882a593Smuzhiyun } icrbb_t;
551*4882a593Smuzhiyun 
552*4882a593Smuzhiyun /* This is an alternate typedef for the HUB1 CRB B in order to allow
553*4882a593Smuzhiyun    runtime selection of the format based on the REV_ID field of the
554*4882a593Smuzhiyun    NI_STATUS_REV_ID register. */
555*4882a593Smuzhiyun typedef union h1_icrbb_u {
556*4882a593Smuzhiyun 	u64	reg_value;
557*4882a593Smuzhiyun 	struct {
558*4882a593Smuzhiyun 		u64	rsvd1:	5,
559*4882a593Smuzhiyun 			btenum: 1,	/* BTE to which entry belongs to */
560*4882a593Smuzhiyun 			cohtrans: 1,	/* Coherent transaction */
561*4882a593Smuzhiyun 			xtsize: 2,	/* Xtalk operation size
562*4882a593Smuzhiyun 					 * 0: Double Word
563*4882a593Smuzhiyun 					 * 1: 32 Bytes.
564*4882a593Smuzhiyun 					 * 2: 128 Bytes,
565*4882a593Smuzhiyun 					 * 3: Reserved.
566*4882a593Smuzhiyun 					 */
567*4882a593Smuzhiyun 			srcnode: 9,	/* Source Node ID		*/
568*4882a593Smuzhiyun 			srcinit: 2,	/* Source Initiator:
569*4882a593Smuzhiyun 					 * See below for field values.
570*4882a593Smuzhiyun 					 */
571*4882a593Smuzhiyun 			useold: 1,	/* Use OLD command for processing */
572*4882a593Smuzhiyun 			imsgtype: 2,	/* Incoming message type
573*4882a593Smuzhiyun 					 * see below for field values
574*4882a593Smuzhiyun 					 */
575*4882a593Smuzhiyun 			imsg:	8,	/* Incoming message	*/
576*4882a593Smuzhiyun 			initator: 3,	/* Initiator of original request
577*4882a593Smuzhiyun 					 * See below for field values.
578*4882a593Smuzhiyun 					 */
579*4882a593Smuzhiyun 			rsvd2:	1,
580*4882a593Smuzhiyun 			pcache: 1,	/* entry belongs to partial cache */
581*4882a593Smuzhiyun 			reqtype: 5,	/* Identifies type of request
582*4882a593Smuzhiyun 					 * See below for field values.
583*4882a593Smuzhiyun 					 */
584*4882a593Smuzhiyun 			stl_ib: 1,	/* stall Ibus coming from xtalk */
585*4882a593Smuzhiyun 			stl_intr: 1,	/* Stall internal interrupts */
586*4882a593Smuzhiyun 			stl_bte0: 1,	/* Stall BTE 0	*/
587*4882a593Smuzhiyun 			stl_bte1: 1,	/* Stall BTE 1	*/
588*4882a593Smuzhiyun 			intrvn: 1,	/* Req was target of intervention */
589*4882a593Smuzhiyun 			ackcnt: 11,	/* Invalidate ack count */
590*4882a593Smuzhiyun 			resp:	1,	/* data response  given to processor */
591*4882a593Smuzhiyun 			ack:	1,	/* indicates data ack received	*/
592*4882a593Smuzhiyun 			hold:	1,	/* entry is gathering inval acks */
593*4882a593Smuzhiyun 			wb_pend:1,	/* waiting for writeback to complete */
594*4882a593Smuzhiyun 			sleep:	1,	/* xtalk req sleeping till IO-sync */
595*4882a593Smuzhiyun 			pnd_reply: 1,	/* replies not issed due to IOQ full */
596*4882a593Smuzhiyun 			pnd_req: 1;	/* reqs not issued due to IOQ full */
597*4882a593Smuzhiyun 	} h1_icrbb_field_s;
598*4882a593Smuzhiyun } h1_icrbb_t;
599*4882a593Smuzhiyun 
600*4882a593Smuzhiyun 
601*4882a593Smuzhiyun #define b_imsgtype	icrbb_field_s.imsgtype
602*4882a593Smuzhiyun #define b_btenum	icrbb_field_s.btenum
603*4882a593Smuzhiyun #define b_cohtrans	icrbb_field_s.cohtrans
604*4882a593Smuzhiyun #define b_xtsize	icrbb_field_s.xtsize
605*4882a593Smuzhiyun #define b_srcnode	icrbb_field_s.srcnode
606*4882a593Smuzhiyun #define b_srcinit	icrbb_field_s.srcinit
607*4882a593Smuzhiyun #define b_imsgtype	icrbb_field_s.imsgtype
608*4882a593Smuzhiyun #define b_imsg		icrbb_field_s.imsg
609*4882a593Smuzhiyun #define b_initiator	icrbb_field_s.initiator
610*4882a593Smuzhiyun 
611*4882a593Smuzhiyun #endif /* !__ASSEMBLY__ */
612*4882a593Smuzhiyun 
613*4882a593Smuzhiyun /*
614*4882a593Smuzhiyun  * values for field xtsize
615*4882a593Smuzhiyun  */
616*4882a593Smuzhiyun #define IIO_ICRB_XTSIZE_DW	0	/* Xtalk operation size is 8 bytes  */
617*4882a593Smuzhiyun #define IIO_ICRB_XTSIZE_32	1	/* Xtalk operation size is 32 bytes */
618*4882a593Smuzhiyun #define IIO_ICRB_XTSIZE_128	2	/* Xtalk operation size is 128 bytes */
619*4882a593Smuzhiyun 
620*4882a593Smuzhiyun /*
621*4882a593Smuzhiyun  * values for field srcinit
622*4882a593Smuzhiyun  */
623*4882a593Smuzhiyun #define IIO_ICRB_PROC0		0	/* Source of request is Proc 0 */
624*4882a593Smuzhiyun #define IIO_ICRB_PROC1		1	/* Source of request is Proc 1 */
625*4882a593Smuzhiyun #define IIO_ICRB_GB_REQ		2	/* Source is Guaranteed BW request */
626*4882a593Smuzhiyun #define IIO_ICRB_IO_REQ		3	/* Source is Normal IO request	*/
627*4882a593Smuzhiyun 
628*4882a593Smuzhiyun /*
629*4882a593Smuzhiyun  * Values for field imsgtype
630*4882a593Smuzhiyun  */
631*4882a593Smuzhiyun #define IIO_ICRB_IMSGT_XTALK	0	/* Incoming Message from Xtalk */
632*4882a593Smuzhiyun #define IIO_ICRB_IMSGT_BTE	1	/* Incoming message from BTE	*/
633*4882a593Smuzhiyun #define IIO_ICRB_IMSGT_SN0NET	2	/* Incoming message from SN0 net */
634*4882a593Smuzhiyun #define IIO_ICRB_IMSGT_CRB	3	/* Incoming message from CRB ???  */
635*4882a593Smuzhiyun 
636*4882a593Smuzhiyun /*
637*4882a593Smuzhiyun  * values for field initiator.
638*4882a593Smuzhiyun  */
639*4882a593Smuzhiyun #define IIO_ICRB_INIT_XTALK	0	/* Message originated in xtalk	*/
640*4882a593Smuzhiyun #define IIO_ICRB_INIT_BTE0	0x1	/* Message originated in BTE 0	*/
641*4882a593Smuzhiyun #define IIO_ICRB_INIT_SN0NET	0x2	/* Message originated in SN0net */
642*4882a593Smuzhiyun #define IIO_ICRB_INIT_CRB	0x3	/* Message originated in CRB ?	*/
643*4882a593Smuzhiyun #define IIO_ICRB_INIT_BTE1	0x5	/* MEssage originated in BTE 1	*/
644*4882a593Smuzhiyun 
645*4882a593Smuzhiyun /*
646*4882a593Smuzhiyun  * Values for field reqtype.
647*4882a593Smuzhiyun  */
648*4882a593Smuzhiyun /* XXX - Need to fix this for Hub 2 */
649*4882a593Smuzhiyun #define IIO_ICRB_REQ_DWRD	0	/* Request type double word	*/
650*4882a593Smuzhiyun #define IIO_ICRB_REQ_QCLRD	1	/* Request is Qrtr Caceh line Rd */
651*4882a593Smuzhiyun #define IIO_ICRB_REQ_BLKRD	2	/* Request is block read	*/
652*4882a593Smuzhiyun #define IIO_ICRB_REQ_RSHU	6	/* Request is BTE block read	*/
653*4882a593Smuzhiyun #define IIO_ICRB_REQ_REXU	7	/* request is BTE Excl Read	*/
654*4882a593Smuzhiyun #define IIO_ICRB_REQ_RDEX	8	/* Request is Read Exclusive	*/
655*4882a593Smuzhiyun #define IIO_ICRB_REQ_WINC	9	/* Request is Write Invalidate	*/
656*4882a593Smuzhiyun #define IIO_ICRB_REQ_BWINV	10	/* Request is BTE Winv		*/
657*4882a593Smuzhiyun #define IIO_ICRB_REQ_PIORD	11	/* Request is PIO read		*/
658*4882a593Smuzhiyun #define IIO_ICRB_REQ_PIOWR	12	/* Request is PIO Write		*/
659*4882a593Smuzhiyun #define IIO_ICRB_REQ_PRDM	13	/* Request is Fetch&Op		*/
660*4882a593Smuzhiyun #define IIO_ICRB_REQ_PWRM	14	/* Request is Store &Op		*/
661*4882a593Smuzhiyun #define IIO_ICRB_REQ_PTPWR	15	/* Request is Peer to peer	*/
662*4882a593Smuzhiyun #define IIO_ICRB_REQ_WB		16	/* Request is Write back	*/
663*4882a593Smuzhiyun #define IIO_ICRB_REQ_DEX	17	/* Retained DEX Cache line	*/
664*4882a593Smuzhiyun 
665*4882a593Smuzhiyun /*
666*4882a593Smuzhiyun  * Fields in CRB Register C
667*4882a593Smuzhiyun  */
668*4882a593Smuzhiyun 
669*4882a593Smuzhiyun #ifndef __ASSEMBLY__
670*4882a593Smuzhiyun 
671*4882a593Smuzhiyun typedef union icrbc_s {
672*4882a593Smuzhiyun 	u64	reg_value;
673*4882a593Smuzhiyun 	struct {
674*4882a593Smuzhiyun 		u64	rsvd:	6,
675*4882a593Smuzhiyun 			sleep:	1,
676*4882a593Smuzhiyun 			pricnt: 4,	/* Priority count sent with Read req */
677*4882a593Smuzhiyun 			pripsc: 4,	/* Priority Pre scalar	*/
678*4882a593Smuzhiyun 			bteop:	1,	/* BTE Operation	*/
679*4882a593Smuzhiyun 			push_be: 34,	/* Push address Byte enable
680*4882a593Smuzhiyun 					 * Holds push addr, if CRB is for BTE
681*4882a593Smuzhiyun 					 * If CRB belongs to Partial cache,
682*4882a593Smuzhiyun 					 * this contains byte enables bits
683*4882a593Smuzhiyun 					 * ([47:46] = 0)
684*4882a593Smuzhiyun 					 */
685*4882a593Smuzhiyun 			suppl:	11,	/* Supplemental field	*/
686*4882a593Smuzhiyun 			barrop: 1,	/* Barrier Op bit set in xtalk req */
687*4882a593Smuzhiyun 			doresp: 1,	/* Xtalk req needs a response	*/
688*4882a593Smuzhiyun 			gbr:	1;	/* GBR bit set in xtalk packet	*/
689*4882a593Smuzhiyun 	} icrbc_field_s;
690*4882a593Smuzhiyun } icrbc_t;
691*4882a593Smuzhiyun 
692*4882a593Smuzhiyun #define c_pricnt	icrbc_field_s.pricnt
693*4882a593Smuzhiyun #define c_pripsc	icrbc_field_s.pripsc
694*4882a593Smuzhiyun #define c_bteop		icrbc_field_s.bteop
695*4882a593Smuzhiyun #define c_bteaddr	icrbc_field_s.push_be	/* push_be field has 2 names */
696*4882a593Smuzhiyun #define c_benable	icrbc_field_s.push_be	/* push_be field has 2 names */
697*4882a593Smuzhiyun #define c_suppl		icrbc_field_s.suppl
698*4882a593Smuzhiyun #define c_barrop	icrbc_field_s.barrop
699*4882a593Smuzhiyun #define c_doresp	icrbc_field_s.doresp
700*4882a593Smuzhiyun #define c_gbr	icrbc_field_s.gbr
701*4882a593Smuzhiyun #endif /* !__ASSEMBLY__ */
702*4882a593Smuzhiyun 
703*4882a593Smuzhiyun /*
704*4882a593Smuzhiyun  * Fields in CRB Register D
705*4882a593Smuzhiyun  */
706*4882a593Smuzhiyun 
707*4882a593Smuzhiyun #ifndef __ASSEMBLY__
708*4882a593Smuzhiyun typedef union icrbd_s {
709*4882a593Smuzhiyun 	u64	reg_value;
710*4882a593Smuzhiyun 	struct {
711*4882a593Smuzhiyun 	    u64 rsvd:	38,
712*4882a593Smuzhiyun 		toutvld: 1,	/* Timeout in progress for this CRB */
713*4882a593Smuzhiyun 		ctxtvld: 1,	/* Context field below is valid */
714*4882a593Smuzhiyun 		rsvd2:	1,
715*4882a593Smuzhiyun 		context: 15,	/* Bit vector:
716*4882a593Smuzhiyun 				 * Has a bit set for each CRB entry
717*4882a593Smuzhiyun 				 * which needs to be deallocated
718*4882a593Smuzhiyun 				 * before this CRB entry is processed.
719*4882a593Smuzhiyun 				 * Set only for barrier operations.
720*4882a593Smuzhiyun 				 */
721*4882a593Smuzhiyun 		timeout: 8;	/* Timeout Upper 8 bits */
722*4882a593Smuzhiyun 	} icrbd_field_s;
723*4882a593Smuzhiyun } icrbd_t;
724*4882a593Smuzhiyun 
725*4882a593Smuzhiyun #define icrbd_toutvld	icrbd_field_s.toutvld
726*4882a593Smuzhiyun #define icrbd_ctxtvld	icrbd_field_s.ctxtvld
727*4882a593Smuzhiyun #define icrbd_context	icrbd_field_s.context
728*4882a593Smuzhiyun 
729*4882a593Smuzhiyun 
730*4882a593Smuzhiyun typedef union hubii_ifdr_u {
731*4882a593Smuzhiyun 	u64	hi_ifdr_value;
732*4882a593Smuzhiyun 	struct {
733*4882a593Smuzhiyun 		u64	ifdr_rsvd:	49,
734*4882a593Smuzhiyun 			ifdr_maxrp:	 7,
735*4882a593Smuzhiyun 			ifdr_rsvd1:	 1,
736*4882a593Smuzhiyun 			ifdr_maxrq:	 7;
737*4882a593Smuzhiyun 	} hi_ifdr_fields;
738*4882a593Smuzhiyun } hubii_ifdr_t;
739*4882a593Smuzhiyun 
740*4882a593Smuzhiyun #endif /* !__ASSEMBLY__ */
741*4882a593Smuzhiyun 
742*4882a593Smuzhiyun /*
743*4882a593Smuzhiyun  * Hardware designed names for the BTE control registers.
744*4882a593Smuzhiyun  */
745*4882a593Smuzhiyun #define IIO_IBLS_0	0x410000	/* BTE length/status 0 */
746*4882a593Smuzhiyun #define IIO_IBSA_0	0x410008	/* BTE source address 0 */
747*4882a593Smuzhiyun #define IIO_IBDA_0	0x410010	/* BTE destination address 0 */
748*4882a593Smuzhiyun #define IIO_IBCT_0	0x410018	/* BTE control/terminate 0 */
749*4882a593Smuzhiyun #define IIO_IBNA_0	0x410020	/* BTE notification address 0 */
750*4882a593Smuzhiyun #define IIO_IBNR_0	IIO_IBNA_0
751*4882a593Smuzhiyun #define IIO_IBIA_0	0x410028	/* BTE interrupt address 0 */
752*4882a593Smuzhiyun 
753*4882a593Smuzhiyun #define IIO_IBLS_1	0x420000	/* BTE length/status 1 */
754*4882a593Smuzhiyun #define IIO_IBSA_1	0x420008	/* BTE source address 1 */
755*4882a593Smuzhiyun #define IIO_IBDA_1	0x420010	/* BTE destination address 1 */
756*4882a593Smuzhiyun #define IIO_IBCT_1	0x420018	/* BTE control/terminate 1 */
757*4882a593Smuzhiyun #define IIO_IBNA_1	0x420020	/* BTE notification address 1 */
758*4882a593Smuzhiyun #define IIO_IBNR_1	IIO_IBNA_1
759*4882a593Smuzhiyun #define IIO_IBIA_1	0x420028	/* BTE interrupt address 1 */
760*4882a593Smuzhiyun 
761*4882a593Smuzhiyun /*
762*4882a593Smuzhiyun  * More miscellaneous registers
763*4882a593Smuzhiyun  */
764*4882a593Smuzhiyun #define IIO_IPCR	0x430000	/* Performance Control */
765*4882a593Smuzhiyun #define IIO_IPPR	0x430008	/* Performance Profiling */
766*4882a593Smuzhiyun 
767*4882a593Smuzhiyun /*
768*4882a593Smuzhiyun  * IO Error Clear register bit field definitions
769*4882a593Smuzhiyun  */
770*4882a593Smuzhiyun #define IECLR_BTE1		(1 << 18)  /* clear bte error 1 ??? */
771*4882a593Smuzhiyun #define IECLR_BTE0		(1 << 17)  /* clear bte error 0 ??? */
772*4882a593Smuzhiyun #define IECLR_CRAZY		(1 << 16)  /* clear crazy bit in wstat reg */
773*4882a593Smuzhiyun #define IECLR_PRB_F		(1 << 15)  /* clear err bit in PRB_F reg */
774*4882a593Smuzhiyun #define IECLR_PRB_E		(1 << 14)  /* clear err bit in PRB_E reg */
775*4882a593Smuzhiyun #define IECLR_PRB_D		(1 << 13)  /* clear err bit in PRB_D reg */
776*4882a593Smuzhiyun #define IECLR_PRB_C		(1 << 12)  /* clear err bit in PRB_C reg */
777*4882a593Smuzhiyun #define IECLR_PRB_B		(1 << 11)  /* clear err bit in PRB_B reg */
778*4882a593Smuzhiyun #define IECLR_PRB_A		(1 << 10)  /* clear err bit in PRB_A reg */
779*4882a593Smuzhiyun #define IECLR_PRB_9		(1 << 9)   /* clear err bit in PRB_9 reg */
780*4882a593Smuzhiyun #define IECLR_PRB_8		(1 << 8)   /* clear err bit in PRB_8 reg */
781*4882a593Smuzhiyun #define IECLR_PRB_0		(1 << 0)   /* clear err bit in PRB_0 reg */
782*4882a593Smuzhiyun 
783*4882a593Smuzhiyun /*
784*4882a593Smuzhiyun  * IO PIO Read Table Entry format
785*4882a593Smuzhiyun  */
786*4882a593Smuzhiyun 
787*4882a593Smuzhiyun #ifndef __ASSEMBLY__
788*4882a593Smuzhiyun 
789*4882a593Smuzhiyun typedef union iprte_a {
790*4882a593Smuzhiyun 	u64	entry;
791*4882a593Smuzhiyun 	struct {
792*4882a593Smuzhiyun 	    u64 rsvd1	  : 7,	/* Reserved field		*/
793*4882a593Smuzhiyun 		valid	  : 1,	/* Maps to a timeout entry	*/
794*4882a593Smuzhiyun 		rsvd2	  : 1,
795*4882a593Smuzhiyun 		srcnode	  : 9,	/* Node which did this PIO	*/
796*4882a593Smuzhiyun 		initiator : 2,	/* If T5A or T5B or IO		*/
797*4882a593Smuzhiyun 		rsvd3	  : 3,
798*4882a593Smuzhiyun 		addr	  : 38, /* Physical address of PIO	*/
799*4882a593Smuzhiyun 		rsvd4	  : 3;
800*4882a593Smuzhiyun 	} iprte_fields;
801*4882a593Smuzhiyun } iprte_a_t;
802*4882a593Smuzhiyun 
803*4882a593Smuzhiyun #define iprte_valid	iprte_fields.valid
804*4882a593Smuzhiyun #define iprte_timeout	iprte_fields.timeout
805*4882a593Smuzhiyun #define iprte_srcnode	iprte_fields.srcnode
806*4882a593Smuzhiyun #define iprte_init	iprte_fields.initiator
807*4882a593Smuzhiyun #define iprte_addr	iprte_fields.addr
808*4882a593Smuzhiyun 
809*4882a593Smuzhiyun #endif /* !__ASSEMBLY__ */
810*4882a593Smuzhiyun 
811*4882a593Smuzhiyun #define IPRTE_ADDRSHFT	3
812*4882a593Smuzhiyun 
813*4882a593Smuzhiyun /*
814*4882a593Smuzhiyun  * Hub IIO PRB Register format.
815*4882a593Smuzhiyun  */
816*4882a593Smuzhiyun 
817*4882a593Smuzhiyun #ifndef __ASSEMBLY__
818*4882a593Smuzhiyun /*
819*4882a593Smuzhiyun  * Note: Fields bnakctr, anakctr, xtalkctrmode, ovflow fields are
820*4882a593Smuzhiyun  * "Status" fields, and should only be used in case of clean up after errors.
821*4882a593Smuzhiyun  */
822*4882a593Smuzhiyun 
823*4882a593Smuzhiyun typedef union iprb_u {
824*4882a593Smuzhiyun 	u64	reg_value;
825*4882a593Smuzhiyun 	struct {
826*4882a593Smuzhiyun 	    u64 rsvd1:	15,
827*4882a593Smuzhiyun 		error:	1,	/* Widget rcvd wr resp pkt w/ error */
828*4882a593Smuzhiyun 		ovflow: 5,	/* Overflow count. perf measurement */
829*4882a593Smuzhiyun 		fire_and_forget: 1, /* Launch Write without response */
830*4882a593Smuzhiyun 		mode:	2,	/* Widget operation Mode	*/
831*4882a593Smuzhiyun 		rsvd2:	2,
832*4882a593Smuzhiyun 		bnakctr: 14,
833*4882a593Smuzhiyun 		rsvd3:	2,
834*4882a593Smuzhiyun 		anakctr: 14,
835*4882a593Smuzhiyun 		xtalkctr: 8;
836*4882a593Smuzhiyun 	} iprb_fields_s;
837*4882a593Smuzhiyun } iprb_t;
838*4882a593Smuzhiyun 
839*4882a593Smuzhiyun #define iprb_regval	reg_value
840*4882a593Smuzhiyun 
841*4882a593Smuzhiyun #define iprb_error	iprb_fields_s.error
842*4882a593Smuzhiyun #define iprb_ovflow	iprb_fields_s.ovflow
843*4882a593Smuzhiyun #define iprb_ff		iprb_fields_s.fire_and_forget
844*4882a593Smuzhiyun #define iprb_mode	iprb_fields_s.mode
845*4882a593Smuzhiyun #define iprb_bnakctr	iprb_fields_s.bnakctr
846*4882a593Smuzhiyun #define iprb_anakctr	iprb_fields_s.anakctr
847*4882a593Smuzhiyun #define iprb_xtalkctr	iprb_fields_s.xtalkctr
848*4882a593Smuzhiyun 
849*4882a593Smuzhiyun #endif /* !__ASSEMBLY__ */
850*4882a593Smuzhiyun 
851*4882a593Smuzhiyun /*
852*4882a593Smuzhiyun  * values for mode field in iprb_t.
853*4882a593Smuzhiyun  * For details of the meanings of NAK and Accept, refer the PIO flow
854*4882a593Smuzhiyun  * document
855*4882a593Smuzhiyun  */
856*4882a593Smuzhiyun #define IPRB_MODE_NORMAL	(0)
857*4882a593Smuzhiyun #define IPRB_MODE_COLLECT_A	(1)	/* PRB in collect A mode */
858*4882a593Smuzhiyun #define IPRB_MODE_SERVICE_A	(2)	/* NAK B and Accept A */
859*4882a593Smuzhiyun #define IPRB_MODE_SERVICE_B	(3)	/* NAK A and Accept B */
860*4882a593Smuzhiyun 
861*4882a593Smuzhiyun /*
862*4882a593Smuzhiyun  * IO CRB entry C_A to E_A : Partial (cache) CRBS
863*4882a593Smuzhiyun  */
864*4882a593Smuzhiyun #ifndef __ASSEMBLY__
865*4882a593Smuzhiyun typedef union icrbp_a {
866*4882a593Smuzhiyun 	u64   ip_reg;	    /* the entire register value	*/
867*4882a593Smuzhiyun 	struct {
868*4882a593Smuzhiyun 	     u64 error: 1,  /*	  63, error occurred		*/
869*4882a593Smuzhiyun 		ln_uce: 1,  /*	  62: uncorrectable memory	*/
870*4882a593Smuzhiyun 		ln_ae:	1,  /*	  61: protection violation	*/
871*4882a593Smuzhiyun 		ln_werr:1,  /*	  60: write access error	*/
872*4882a593Smuzhiyun 		ln_aerr:1,  /*	  59: sn0net: Address error	*/
873*4882a593Smuzhiyun 		ln_perr:1,  /*	  58: sn0net: poison error	*/
874*4882a593Smuzhiyun 		timeout:1,  /*	  57: CRB timed out		*/
875*4882a593Smuzhiyun 		l_bdpkt:1,  /*	  56: truncated pkt on sn0net	*/
876*4882a593Smuzhiyun 		c_bdpkt:1,  /*	  55: truncated pkt on xtalk	*/
877*4882a593Smuzhiyun 		c_err:	1,  /*	  54: incoming xtalk req, err set*/
878*4882a593Smuzhiyun 		rsvd1: 12,  /* 53-42: reserved			*/
879*4882a593Smuzhiyun 		valid:	1,  /*	  41: Valid status		*/
880*4882a593Smuzhiyun 		sidn:	4,  /* 40-37: SIDN field of xtalk rqst	*/
881*4882a593Smuzhiyun 		tnum:	5,  /* 36-32: TNUM of xtalk request	*/
882*4882a593Smuzhiyun 		bo:	1,  /*	  31: barrier op set in xtalk rqst*/
883*4882a593Smuzhiyun 		resprqd:1,  /*	  30: xtalk rqst requires response*/
884*4882a593Smuzhiyun 		gbr:	1,  /*	  29: gbr bit set in xtalk rqst */
885*4882a593Smuzhiyun 		size:	2,  /* 28-27: size of xtalk request	*/
886*4882a593Smuzhiyun 		excl:	4,  /* 26-23: exclusive bit(s)		*/
887*4882a593Smuzhiyun 		stall:	3,  /* 22-20: stall (xtalk, bte 0/1)	*/
888*4882a593Smuzhiyun 		intvn:	1,  /*	  19: rqst target of intervention*/
889*4882a593Smuzhiyun 		resp:	1,  /*	  18: Data response given to t5 */
890*4882a593Smuzhiyun 		ack:	1,  /*	  17: Data ack received.	*/
891*4882a593Smuzhiyun 		hold:	1,  /*	  16: crb gathering invalidate acks*/
892*4882a593Smuzhiyun 		wb:	1,  /*	  15: writeback pending.	*/
893*4882a593Smuzhiyun 		ack_cnt:11, /* 14-04: counter of invalidate acks*/
894*4882a593Smuzhiyun 		tscaler:4;  /* 03-00: Timeout prescaler		*/
895*4882a593Smuzhiyun 	} ip_fmt;
896*4882a593Smuzhiyun } icrbp_a_t;
897*4882a593Smuzhiyun 
898*4882a593Smuzhiyun #endif /* !__ASSEMBLY__ */
899*4882a593Smuzhiyun 
900*4882a593Smuzhiyun /*
901*4882a593Smuzhiyun  * A couple of defines to go with the above structure.
902*4882a593Smuzhiyun  */
903*4882a593Smuzhiyun #define ICRBP_A_CERR_SHFT	54
904*4882a593Smuzhiyun #define ICRBP_A_ERR_MASK	0x3ff
905*4882a593Smuzhiyun 
906*4882a593Smuzhiyun #ifndef __ASSEMBLY__
907*4882a593Smuzhiyun typedef union hubii_idsr {
908*4882a593Smuzhiyun 	u64 iin_reg;
909*4882a593Smuzhiyun 	struct {
910*4882a593Smuzhiyun 		u64 rsvd1 : 35,
911*4882a593Smuzhiyun 		    isent : 1,
912*4882a593Smuzhiyun 		    rsvd2 : 3,
913*4882a593Smuzhiyun 		    ienable: 1,
914*4882a593Smuzhiyun 		    rsvd  : 7,
915*4882a593Smuzhiyun 		    node  : 9,
916*4882a593Smuzhiyun 		    rsvd4 : 1,
917*4882a593Smuzhiyun 		    level : 7;
918*4882a593Smuzhiyun 	} iin_fmt;
919*4882a593Smuzhiyun } hubii_idsr_t;
920*4882a593Smuzhiyun #endif /* !__ASSEMBLY__ */
921*4882a593Smuzhiyun 
922*4882a593Smuzhiyun /*
923*4882a593Smuzhiyun  * IO BTE Length/Status (IIO_IBLS) register bit field definitions
924*4882a593Smuzhiyun  */
925*4882a593Smuzhiyun #define IBLS_BUSY		(0x1 << 20)
926*4882a593Smuzhiyun #define IBLS_ERROR_SHFT		16
927*4882a593Smuzhiyun #define IBLS_ERROR		(0x1 << IBLS_ERROR_SHFT)
928*4882a593Smuzhiyun #define IBLS_LENGTH_MASK	0xffff
929*4882a593Smuzhiyun 
930*4882a593Smuzhiyun /*
931*4882a593Smuzhiyun  * IO BTE Control/Terminate register (IBCT) register bit field definitions
932*4882a593Smuzhiyun  */
933*4882a593Smuzhiyun #define IBCT_POISON		(0x1 << 8)
934*4882a593Smuzhiyun #define IBCT_NOTIFY		(0x1 << 4)
935*4882a593Smuzhiyun #define IBCT_ZFIL_MODE		(0x1 << 0)
936*4882a593Smuzhiyun 
937*4882a593Smuzhiyun /*
938*4882a593Smuzhiyun  * IO BTE Interrupt Address Register (IBIA) register bit field definitions
939*4882a593Smuzhiyun  */
940*4882a593Smuzhiyun #define IBIA_LEVEL_SHFT		16
941*4882a593Smuzhiyun #define IBIA_LEVEL_MASK		(0x7f << IBIA_LEVEL_SHFT)
942*4882a593Smuzhiyun #define IBIA_NODE_ID_SHFT	0
943*4882a593Smuzhiyun #define IBIA_NODE_ID_MASK	(0x1ff)
944*4882a593Smuzhiyun 
945*4882a593Smuzhiyun /*
946*4882a593Smuzhiyun  * Miscellaneous hub constants
947*4882a593Smuzhiyun  */
948*4882a593Smuzhiyun 
949*4882a593Smuzhiyun /* Number of widgets supported by hub */
950*4882a593Smuzhiyun #define HUB_NUM_WIDGET		9
951*4882a593Smuzhiyun #define HUB_WIDGET_ID_MIN	0x8
952*4882a593Smuzhiyun #define HUB_WIDGET_ID_MAX	0xf
953*4882a593Smuzhiyun 
954*4882a593Smuzhiyun #define HUB_WIDGET_PART_NUM	0xc101
955*4882a593Smuzhiyun #define MAX_HUBS_PER_XBOW	2
956*4882a593Smuzhiyun 
957*4882a593Smuzhiyun /*
958*4882a593Smuzhiyun  * Get a hub's widget id from widget control register
959*4882a593Smuzhiyun  */
960*4882a593Smuzhiyun #define IIO_WCR_WID_GET(nasid)	(REMOTE_HUB_L(nasid, III_WCR) & 0xf)
961*4882a593Smuzhiyun #define IIO_WST_ERROR_MASK	(UINT64_CAST 1 << 32) /* Widget status error */
962*4882a593Smuzhiyun 
963*4882a593Smuzhiyun /*
964*4882a593Smuzhiyun  * Number of credits Hub widget has while sending req/response to
965*4882a593Smuzhiyun  * xbow.
966*4882a593Smuzhiyun  * Value of 3 is required by Xbow 1.1
967*4882a593Smuzhiyun  * We may be able to increase this to 4 with Xbow 1.2.
968*4882a593Smuzhiyun  */
969*4882a593Smuzhiyun #define	      HUBII_XBOW_CREDIT	      3
970*4882a593Smuzhiyun #define	      HUBII_XBOW_REV2_CREDIT  4
971*4882a593Smuzhiyun 
972*4882a593Smuzhiyun #endif /* _ASM_SGI_SN_SN0_HUBIO_H */
973