18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
38c2ecf20Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
48c2ecf20Sopenharmony_ci * for more details.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Derived from IRIX <sys/SN/SN0/hubio.h>, Revision 1.80.
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Copyright (C) 1992 - 1997, 1999 Silicon Graphics, Inc.
98c2ecf20Sopenharmony_ci * Copyright (C) 1999 by Ralf Baechle
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci#ifndef _ASM_SGI_SN_SN0_HUBIO_H
128c2ecf20Sopenharmony_ci#define _ASM_SGI_SN_SN0_HUBIO_H
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci/*
158c2ecf20Sopenharmony_ci * Hub I/O interface registers
168c2ecf20Sopenharmony_ci *
178c2ecf20Sopenharmony_ci * All registers in this file are subject to change until Hub chip tapeout.
188c2ecf20Sopenharmony_ci * In general, the longer software name should be used when available.
198c2ecf20Sopenharmony_ci */
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/*
228c2ecf20Sopenharmony_ci * Slightly friendlier names for some common registers.
238c2ecf20Sopenharmony_ci * The hardware definitions follow.
248c2ecf20Sopenharmony_ci */
258c2ecf20Sopenharmony_ci#define IIO_WIDGET		IIO_WID	     /* Widget identification */
268c2ecf20Sopenharmony_ci#define IIO_WIDGET_STAT		IIO_WSTAT    /* Widget status register */
278c2ecf20Sopenharmony_ci#define IIO_WIDGET_CTRL		IIO_WCR	     /* Widget control register */
288c2ecf20Sopenharmony_ci#define IIO_WIDGET_TOUT		IIO_WRTO     /* Widget request timeout */
298c2ecf20Sopenharmony_ci#define IIO_WIDGET_FLUSH	IIO_WTFR     /* Widget target flush */
308c2ecf20Sopenharmony_ci#define IIO_PROTECT		IIO_ILAPR    /* IO interface protection */
318c2ecf20Sopenharmony_ci#define IIO_PROTECT_OVRRD	IIO_ILAPO    /* IO protect override */
328c2ecf20Sopenharmony_ci#define IIO_OUTWIDGET_ACCESS	IIO_IOWA     /* Outbound widget access */
338c2ecf20Sopenharmony_ci#define IIO_INWIDGET_ACCESS	IIO_IIWA     /* Inbound widget access */
348c2ecf20Sopenharmony_ci#define IIO_INDEV_ERR_MASK	IIO_IIDEM    /* Inbound device error mask */
358c2ecf20Sopenharmony_ci#define IIO_LLP_CSR		IIO_ILCSR    /* LLP control and status */
368c2ecf20Sopenharmony_ci#define IIO_LLP_LOG		IIO_ILLR     /* LLP log */
378c2ecf20Sopenharmony_ci#define IIO_XTALKCC_TOUT	IIO_IXCC     /* Xtalk credit count timeout*/
388c2ecf20Sopenharmony_ci#define IIO_XTALKTT_TOUT	IIO_IXTT     /* Xtalk tail timeout */
398c2ecf20Sopenharmony_ci#define IIO_IO_ERR_CLR		IIO_IECLR    /* IO error clear */
408c2ecf20Sopenharmony_ci#define IIO_BTE_CRB_CNT		IIO_IBCN     /* IO BTE CRB count */
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#define IIO_LLP_CSR_IS_UP		0x00002000
438c2ecf20Sopenharmony_ci#define IIO_LLP_CSR_LLP_STAT_MASK	0x00003000
448c2ecf20Sopenharmony_ci#define IIO_LLP_CSR_LLP_STAT_SHFT	12
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci/* key to IIO_PROTECT_OVRRD */
478c2ecf20Sopenharmony_ci#define IIO_PROTECT_OVRRD_KEY	0x53474972756c6573ull	/* "SGIrules" */
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci/* BTE register names */
508c2ecf20Sopenharmony_ci#define IIO_BTE_STAT_0		IIO_IBLS_0   /* Also BTE length/status 0 */
518c2ecf20Sopenharmony_ci#define IIO_BTE_SRC_0		IIO_IBSA_0   /* Also BTE source address	 0 */
528c2ecf20Sopenharmony_ci#define IIO_BTE_DEST_0		IIO_IBDA_0   /* Also BTE dest. address 0 */
538c2ecf20Sopenharmony_ci#define IIO_BTE_CTRL_0		IIO_IBCT_0   /* Also BTE control/terminate 0 */
548c2ecf20Sopenharmony_ci#define IIO_BTE_NOTIFY_0	IIO_IBNA_0   /* Also BTE notification 0 */
558c2ecf20Sopenharmony_ci#define IIO_BTE_INT_0		IIO_IBIA_0   /* Also BTE interrupt 0 */
568c2ecf20Sopenharmony_ci#define IIO_BTE_OFF_0		0	     /* Base offset from BTE 0 regs. */
578c2ecf20Sopenharmony_ci#define IIO_BTE_OFF_1	IIO_IBLS_1 - IIO_IBLS_0 /* Offset from base to BTE 1 */
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci/* BTE register offsets from base */
608c2ecf20Sopenharmony_ci#define BTEOFF_STAT		0
618c2ecf20Sopenharmony_ci#define BTEOFF_SRC		(IIO_BTE_SRC_0 - IIO_BTE_STAT_0)
628c2ecf20Sopenharmony_ci#define BTEOFF_DEST		(IIO_BTE_DEST_0 - IIO_BTE_STAT_0)
638c2ecf20Sopenharmony_ci#define BTEOFF_CTRL		(IIO_BTE_CTRL_0 - IIO_BTE_STAT_0)
648c2ecf20Sopenharmony_ci#define BTEOFF_NOTIFY		(IIO_BTE_NOTIFY_0 - IIO_BTE_STAT_0)
658c2ecf20Sopenharmony_ci#define BTEOFF_INT		(IIO_BTE_INT_0 - IIO_BTE_STAT_0)
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci/*
698c2ecf20Sopenharmony_ci * The following definitions use the names defined in the IO interface
708c2ecf20Sopenharmony_ci * document for ease of reference.  When possible, software should
718c2ecf20Sopenharmony_ci * generally use the longer but clearer names defined above.
728c2ecf20Sopenharmony_ci */
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci#define IIO_BASE	0x400000
758c2ecf20Sopenharmony_ci#define IIO_BASE_BTE0	0x410000
768c2ecf20Sopenharmony_ci#define IIO_BASE_BTE1	0x420000
778c2ecf20Sopenharmony_ci#define IIO_BASE_PERF	0x430000
788c2ecf20Sopenharmony_ci#define IIO_PERF_CNT	0x430008
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci#define IO_PERF_SETS	32
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci#define IIO_WID		0x400000	/* Widget identification */
838c2ecf20Sopenharmony_ci#define IIO_WSTAT	0x400008	/* Widget status */
848c2ecf20Sopenharmony_ci#define IIO_WCR		0x400020	/* Widget control */
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci#define IIO_WSTAT_ECRAZY	(1ULL << 32)	/* Hub gone crazy */
878c2ecf20Sopenharmony_ci#define IIO_WSTAT_TXRETRY	(1ULL << 9)	/* Hub Tx Retry timeout */
888c2ecf20Sopenharmony_ci#define IIO_WSTAT_TXRETRY_MASK	(0x7F)
898c2ecf20Sopenharmony_ci#define IIO_WSTAT_TXRETRY_SHFT	(16)
908c2ecf20Sopenharmony_ci#define IIO_WSTAT_TXRETRY_CNT(w)	(((w) >> IIO_WSTAT_TXRETRY_SHFT) & \
918c2ecf20Sopenharmony_ci					  IIO_WSTAT_TXRETRY_MASK)
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci#define IIO_ILAPR	0x400100	/* Local Access Protection */
948c2ecf20Sopenharmony_ci#define IIO_ILAPO	0x400108	/* Protection override */
958c2ecf20Sopenharmony_ci#define IIO_IOWA	0x400110	/* outbound widget access */
968c2ecf20Sopenharmony_ci#define IIO_IIWA	0x400118	/* inbound widget access */
978c2ecf20Sopenharmony_ci#define IIO_IIDEM	0x400120	/* Inbound Device Error Mask */
988c2ecf20Sopenharmony_ci#define IIO_ILCSR	0x400128	/* LLP control and status */
998c2ecf20Sopenharmony_ci#define IIO_ILLR	0x400130	/* LLP Log */
1008c2ecf20Sopenharmony_ci#define IIO_IIDSR	0x400138	/* Interrupt destination */
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci#define IIO_IIBUSERR	0x1400208	/* Reads here cause a bus error. */
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci/* IO Interrupt Destination Register */
1058c2ecf20Sopenharmony_ci#define IIO_IIDSR_SENT_SHIFT	28
1068c2ecf20Sopenharmony_ci#define IIO_IIDSR_SENT_MASK	0x10000000
1078c2ecf20Sopenharmony_ci#define IIO_IIDSR_ENB_SHIFT	24
1088c2ecf20Sopenharmony_ci#define IIO_IIDSR_ENB_MASK	0x01000000
1098c2ecf20Sopenharmony_ci#define IIO_IIDSR_NODE_SHIFT	8
1108c2ecf20Sopenharmony_ci#define IIO_IIDSR_NODE_MASK	0x0000ff00
1118c2ecf20Sopenharmony_ci#define IIO_IIDSR_LVL_SHIFT	0
1128c2ecf20Sopenharmony_ci#define IIO_IIDSR_LVL_MASK	0x0000003f
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci/* GFX Flow Control Node/Widget Register */
1168c2ecf20Sopenharmony_ci#define IIO_IGFX_0	0x400140	/* gfx node/widget register 0 */
1178c2ecf20Sopenharmony_ci#define IIO_IGFX_1	0x400148	/* gfx node/widget register 1 */
1188c2ecf20Sopenharmony_ci#define IIO_IGFX_W_NUM_BITS	4	/* size of widget num field */
1198c2ecf20Sopenharmony_ci#define IIO_IGFX_W_NUM_MASK	((1<<IIO_IGFX_W_NUM_BITS)-1)
1208c2ecf20Sopenharmony_ci#define IIO_IGFX_W_NUM_SHIFT	0
1218c2ecf20Sopenharmony_ci#define IIO_IGFX_N_NUM_BITS	9	/* size of node num field */
1228c2ecf20Sopenharmony_ci#define IIO_IGFX_N_NUM_MASK	((1<<IIO_IGFX_N_NUM_BITS)-1)
1238c2ecf20Sopenharmony_ci#define IIO_IGFX_N_NUM_SHIFT	4
1248c2ecf20Sopenharmony_ci#define IIO_IGFX_P_NUM_BITS	1	/* size of processor num field */
1258c2ecf20Sopenharmony_ci#define IIO_IGFX_P_NUM_MASK	((1<<IIO_IGFX_P_NUM_BITS)-1)
1268c2ecf20Sopenharmony_ci#define IIO_IGFX_P_NUM_SHIFT	16
1278c2ecf20Sopenharmony_ci#define IIO_IGFX_VLD_BITS	1	/* size of valid field */
1288c2ecf20Sopenharmony_ci#define IIO_IGFX_VLD_MASK	((1<<IIO_IGFX_VLD_BITS)-1)
1298c2ecf20Sopenharmony_ci#define IIO_IGFX_VLD_SHIFT	20
1308c2ecf20Sopenharmony_ci#define IIO_IGFX_INIT(widget, node, cpu, valid)				(\
1318c2ecf20Sopenharmony_ci	(((widget) & IIO_IGFX_W_NUM_MASK) << IIO_IGFX_W_NUM_SHIFT) |	 \
1328c2ecf20Sopenharmony_ci	(((node)   & IIO_IGFX_N_NUM_MASK) << IIO_IGFX_N_NUM_SHIFT) |	 \
1338c2ecf20Sopenharmony_ci	(((cpu)	   & IIO_IGFX_P_NUM_MASK) << IIO_IGFX_P_NUM_SHIFT) |	 \
1348c2ecf20Sopenharmony_ci	(((valid)  & IIO_IGFX_VLD_MASK)	  << IIO_IGFX_VLD_SHIFT)	 )
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci/* Scratch registers (not all bits available) */
1378c2ecf20Sopenharmony_ci#define IIO_SCRATCH_REG0	0x400150
1388c2ecf20Sopenharmony_ci#define IIO_SCRATCH_REG1	0x400158
1398c2ecf20Sopenharmony_ci#define IIO_SCRATCH_MASK	0x0000000f00f11fff
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci#define IIO_SCRATCH_BIT0_0	0x0000000800000000
1428c2ecf20Sopenharmony_ci#define IIO_SCRATCH_BIT0_1	0x0000000400000000
1438c2ecf20Sopenharmony_ci#define IIO_SCRATCH_BIT0_2	0x0000000200000000
1448c2ecf20Sopenharmony_ci#define IIO_SCRATCH_BIT0_3	0x0000000100000000
1458c2ecf20Sopenharmony_ci#define IIO_SCRATCH_BIT0_4	0x0000000000800000
1468c2ecf20Sopenharmony_ci#define IIO_SCRATCH_BIT0_5	0x0000000000400000
1478c2ecf20Sopenharmony_ci#define IIO_SCRATCH_BIT0_6	0x0000000000200000
1488c2ecf20Sopenharmony_ci#define IIO_SCRATCH_BIT0_7	0x0000000000100000
1498c2ecf20Sopenharmony_ci#define IIO_SCRATCH_BIT0_8	0x0000000000010000
1508c2ecf20Sopenharmony_ci#define IIO_SCRATCH_BIT0_9	0x0000000000001000
1518c2ecf20Sopenharmony_ci#define IIO_SCRATCH_BIT0_R	0x0000000000000fff
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ci/* IO Translation Table Entries */
1548c2ecf20Sopenharmony_ci#define IIO_NUM_ITTES	7		/* ITTEs numbered 0..6 */
1558c2ecf20Sopenharmony_ci					/* Hw manuals number them 1..7! */
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci/*
1588c2ecf20Sopenharmony_ci * As a permanent workaround for a bug in the PI side of the hub, we've
1598c2ecf20Sopenharmony_ci * redefined big window 7 as small window 0.
1608c2ecf20Sopenharmony_ci */
1618c2ecf20Sopenharmony_ci#define HUB_NUM_BIG_WINDOW	IIO_NUM_ITTES - 1
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci/*
1648c2ecf20Sopenharmony_ci * Use the top big window as a surrogate for the first small window
1658c2ecf20Sopenharmony_ci */
1668c2ecf20Sopenharmony_ci#define SWIN0_BIGWIN		HUB_NUM_BIG_WINDOW
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci#define ILCSR_WARM_RESET	0x100
1698c2ecf20Sopenharmony_ci/*
1708c2ecf20Sopenharmony_ci * The IO LLP control status register and widget control register
1718c2ecf20Sopenharmony_ci */
1728c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_citypedef union hubii_wid_u {
1758c2ecf20Sopenharmony_ci	u64	wid_reg_value;
1768c2ecf20Sopenharmony_ci	struct {
1778c2ecf20Sopenharmony_ci		u64	wid_rsvd:	32,	/* unused */
1788c2ecf20Sopenharmony_ci			wid_rev_num:	 4,	/* revision number */
1798c2ecf20Sopenharmony_ci			wid_part_num:	16,	/* the widget type: hub=c101 */
1808c2ecf20Sopenharmony_ci			wid_mfg_num:	11,	/* Manufacturer id (IBM) */
1818c2ecf20Sopenharmony_ci			wid_rsvd1:	 1;	/* Reserved */
1828c2ecf20Sopenharmony_ci	} wid_fields_s;
1838c2ecf20Sopenharmony_ci} hubii_wid_t;
1848c2ecf20Sopenharmony_ci
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_citypedef union hubii_wcr_u {
1878c2ecf20Sopenharmony_ci	u64	wcr_reg_value;
1888c2ecf20Sopenharmony_ci	struct {
1898c2ecf20Sopenharmony_ci		u64	wcr_rsvd:	41,	/* unused */
1908c2ecf20Sopenharmony_ci			wcr_e_thresh:	 5,	/* elasticity threshold */
1918c2ecf20Sopenharmony_ci			wcr_dir_con:	 1,	/* widget direct connect */
1928c2ecf20Sopenharmony_ci			wcr_f_bad_pkt:	 1,	/* Force bad llp pkt enable */
1938c2ecf20Sopenharmony_ci			wcr_xbar_crd:	 3,	/* LLP crossbar credit */
1948c2ecf20Sopenharmony_ci			wcr_rsvd1:	 8,	/* Reserved */
1958c2ecf20Sopenharmony_ci			wcr_tag_mode:	 1,	/* Tag mode */
1968c2ecf20Sopenharmony_ci			wcr_widget_id:	 4;	/* LLP crossbar credit */
1978c2ecf20Sopenharmony_ci	} wcr_fields_s;
1988c2ecf20Sopenharmony_ci} hubii_wcr_t;
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_ci#define iwcr_dir_con	wcr_fields_s.wcr_dir_con
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_citypedef union hubii_wstat_u {
2038c2ecf20Sopenharmony_ci	u64	 reg_value;
2048c2ecf20Sopenharmony_ci	struct {
2058c2ecf20Sopenharmony_ci		u64	rsvd1:		31,
2068c2ecf20Sopenharmony_ci			crazy:		 1,	/* Crazy bit		*/
2078c2ecf20Sopenharmony_ci			rsvd2:		 8,
2088c2ecf20Sopenharmony_ci			llp_tx_cnt:	 8,	/* LLP Xmit retry counter */
2098c2ecf20Sopenharmony_ci			rsvd3:		 6,
2108c2ecf20Sopenharmony_ci			tx_max_rtry:	 1,	/* LLP Retry Timeout Signal */
2118c2ecf20Sopenharmony_ci			rsvd4:		 2,
2128c2ecf20Sopenharmony_ci			xt_tail_to:	 1,	/* Xtalk Tail Timeout	*/
2138c2ecf20Sopenharmony_ci			xt_crd_to:	 1,	/* Xtalk Credit Timeout */
2148c2ecf20Sopenharmony_ci			pending:	 4;	/* Pending Requests	*/
2158c2ecf20Sopenharmony_ci	} wstat_fields_s;
2168c2ecf20Sopenharmony_ci} hubii_wstat_t;
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_citypedef union hubii_ilcsr_u {
2208c2ecf20Sopenharmony_ci	u64	icsr_reg_value;
2218c2ecf20Sopenharmony_ci	struct {
2228c2ecf20Sopenharmony_ci		u64	icsr_rsvd:	22,	/* unused */
2238c2ecf20Sopenharmony_ci			icsr_max_burst: 10,	/* max burst */
2248c2ecf20Sopenharmony_ci			icsr_rsvd4:	 6,	/* reserved */
2258c2ecf20Sopenharmony_ci			icsr_max_retry: 10,	/* max retry */
2268c2ecf20Sopenharmony_ci			icsr_rsvd3:	 2,	/* reserved */
2278c2ecf20Sopenharmony_ci			icsr_lnk_stat:	 2,	/* link status */
2288c2ecf20Sopenharmony_ci			icsr_bm8:	 1,	/* Bit mode 8 */
2298c2ecf20Sopenharmony_ci			icsr_llp_en:	 1,	/* LLP enable bit */
2308c2ecf20Sopenharmony_ci			icsr_rsvd2:	 1,	/* reserver */
2318c2ecf20Sopenharmony_ci			icsr_wrm_reset:	 1,	/* Warm reset bit */
2328c2ecf20Sopenharmony_ci			icsr_rsvd1:	 2,	/* Data ready offset */
2338c2ecf20Sopenharmony_ci			icsr_null_to:	 6;	/* Null timeout	  */
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ci	} icsr_fields_s;
2368c2ecf20Sopenharmony_ci} hubii_ilcsr_t;
2378c2ecf20Sopenharmony_ci
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_citypedef union hubii_iowa_u {
2408c2ecf20Sopenharmony_ci	u64	iowa_reg_value;
2418c2ecf20Sopenharmony_ci	struct {
2428c2ecf20Sopenharmony_ci		u64	iowa_rsvd:	48,	/* unused */
2438c2ecf20Sopenharmony_ci			iowa_wxoac:	 8,	/* xtalk widget access bits */
2448c2ecf20Sopenharmony_ci			iowa_rsvd1:	 7,	/* xtalk widget access bits */
2458c2ecf20Sopenharmony_ci			iowa_w0oac:	 1;	/* xtalk widget access bits */
2468c2ecf20Sopenharmony_ci	} iowa_fields_s;
2478c2ecf20Sopenharmony_ci} hubii_iowa_t;
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_citypedef union hubii_iiwa_u {
2508c2ecf20Sopenharmony_ci	u64	iiwa_reg_value;
2518c2ecf20Sopenharmony_ci	struct {
2528c2ecf20Sopenharmony_ci		u64	iiwa_rsvd:	48,	/* unused */
2538c2ecf20Sopenharmony_ci			iiwa_wxiac:	 8,	/* hub wid access bits */
2548c2ecf20Sopenharmony_ci			iiwa_rsvd1:	 7,	/* reserved */
2558c2ecf20Sopenharmony_ci			iiwa_w0iac:	 1;	/* hub wid0 access */
2568c2ecf20Sopenharmony_ci	} iiwa_fields_s;
2578c2ecf20Sopenharmony_ci} hubii_iiwa_t;
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_citypedef union	hubii_illr_u {
2608c2ecf20Sopenharmony_ci	u64	illr_reg_value;
2618c2ecf20Sopenharmony_ci	struct {
2628c2ecf20Sopenharmony_ci		u64	illr_rsvd:	32,	/* unused */
2638c2ecf20Sopenharmony_ci			illr_cb_cnt:	16,	/* checkbit error count */
2648c2ecf20Sopenharmony_ci			illr_sn_cnt:	16;	/* sequence number count */
2658c2ecf20Sopenharmony_ci	} illr_fields_s;
2668c2ecf20Sopenharmony_ci} hubii_illr_t;
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_ci/* The structures below are defined to extract and modify the ii
2698c2ecf20Sopenharmony_ciperformance registers */
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ci/* io_perf_sel allows the caller to specify what tests will be
2728c2ecf20Sopenharmony_ci   performed */
2738c2ecf20Sopenharmony_citypedef union io_perf_sel {
2748c2ecf20Sopenharmony_ci	u64 perf_sel_reg;
2758c2ecf20Sopenharmony_ci	struct {
2768c2ecf20Sopenharmony_ci		u64	perf_rsvd  : 48,
2778c2ecf20Sopenharmony_ci			perf_icct  :  8,
2788c2ecf20Sopenharmony_ci			perf_ippr1 :  4,
2798c2ecf20Sopenharmony_ci			perf_ippr0 :  4;
2808c2ecf20Sopenharmony_ci	} perf_sel_bits;
2818c2ecf20Sopenharmony_ci} io_perf_sel_t;
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_ci/* io_perf_cnt is to extract the count from the hub registers. Due to
2848c2ecf20Sopenharmony_ci   hardware problems there is only one counter, not two. */
2858c2ecf20Sopenharmony_ci
2868c2ecf20Sopenharmony_citypedef union io_perf_cnt {
2878c2ecf20Sopenharmony_ci	u64	perf_cnt;
2888c2ecf20Sopenharmony_ci	struct {
2898c2ecf20Sopenharmony_ci		u64	perf_rsvd1 : 32,
2908c2ecf20Sopenharmony_ci			perf_rsvd2 : 12,
2918c2ecf20Sopenharmony_ci			perf_cnt   : 20;
2928c2ecf20Sopenharmony_ci	} perf_cnt_bits;
2938c2ecf20Sopenharmony_ci} io_perf_cnt_t;
2948c2ecf20Sopenharmony_ci
2958c2ecf20Sopenharmony_ci#endif /* !__ASSEMBLY__ */
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_ci#define LNK_STAT_WORKING	0x2
2998c2ecf20Sopenharmony_ci
3008c2ecf20Sopenharmony_ci#define IIO_LLP_CB_MAX	0xffff
3018c2ecf20Sopenharmony_ci#define IIO_LLP_SN_MAX	0xffff
3028c2ecf20Sopenharmony_ci
3038c2ecf20Sopenharmony_ci/* IO PRB Entries */
3048c2ecf20Sopenharmony_ci#define IIO_NUM_IPRBS	(9)
3058c2ecf20Sopenharmony_ci#define IIO_IOPRB_0	0x400198	/* PRB entry 0 */
3068c2ecf20Sopenharmony_ci#define IIO_IOPRB_8	0x4001a0	/* PRB entry 8 */
3078c2ecf20Sopenharmony_ci#define IIO_IOPRB_9	0x4001a8	/* PRB entry 9 */
3088c2ecf20Sopenharmony_ci#define IIO_IOPRB_A	0x4001b0	/* PRB entry a */
3098c2ecf20Sopenharmony_ci#define IIO_IOPRB_B	0x4001b8	/* PRB entry b */
3108c2ecf20Sopenharmony_ci#define IIO_IOPRB_C	0x4001c0	/* PRB entry c */
3118c2ecf20Sopenharmony_ci#define IIO_IOPRB_D	0x4001c8	/* PRB entry d */
3128c2ecf20Sopenharmony_ci#define IIO_IOPRB_E	0x4001d0	/* PRB entry e */
3138c2ecf20Sopenharmony_ci#define IIO_IOPRB_F	0x4001d8	/* PRB entry f */
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_ci
3168c2ecf20Sopenharmony_ci#define IIO_IXCC	0x4001e0	/* Crosstalk credit count timeout */
3178c2ecf20Sopenharmony_ci#define IIO_IXTCC	IIO_IXCC
3188c2ecf20Sopenharmony_ci#define IIO_IMEM	0x4001e8	/* Miscellaneous Enable Mask */
3198c2ecf20Sopenharmony_ci#define IIO_IXTT	0x4001f0	/* Crosstalk tail timeout */
3208c2ecf20Sopenharmony_ci#define IIO_IECLR	0x4001f8	/* IO error clear */
3218c2ecf20Sopenharmony_ci#define IIO_IBCN	0x400200	/* IO BTE CRB count */
3228c2ecf20Sopenharmony_ci
3238c2ecf20Sopenharmony_ci/*
3248c2ecf20Sopenharmony_ci * IIO_IMEM Register fields.
3258c2ecf20Sopenharmony_ci */
3268c2ecf20Sopenharmony_ci#define IIO_IMEM_W0ESD	0x1		/* Widget 0 shut down due to error */
3278c2ecf20Sopenharmony_ci#define IIO_IMEM_B0ESD	(1 << 4)	/* BTE 0 shut down due to error */
3288c2ecf20Sopenharmony_ci#define IIO_IMEM_B1ESD	(1 << 8)	/* BTE 1 Shut down due to error */
3298c2ecf20Sopenharmony_ci
3308c2ecf20Sopenharmony_ci/* PIO Read address Table Entries */
3318c2ecf20Sopenharmony_ci#define IIO_IPCA	0x400300	/* PRB Counter adjust */
3328c2ecf20Sopenharmony_ci#define IIO_NUM_PRTES	8		/* Total number of PRB table entries */
3338c2ecf20Sopenharmony_ci#define IIO_PRTE_0	0x400308	/* PIO Read address table entry 0 */
3348c2ecf20Sopenharmony_ci#define IIO_PRTE(_x)	(IIO_PRTE_0 + (8 * (_x)))
3358c2ecf20Sopenharmony_ci#define IIO_WIDPRTE(x)	IIO_PRTE(((x) - 8)) /* widget ID to its PRTE num */
3368c2ecf20Sopenharmony_ci#define IIO_IPDR	0x400388	/* PIO table entry deallocation */
3378c2ecf20Sopenharmony_ci#define IIO_ICDR	0x400390	/* CRB Entry Deallocation */
3388c2ecf20Sopenharmony_ci#define IIO_IFDR	0x400398	/* IOQ FIFO Depth */
3398c2ecf20Sopenharmony_ci#define IIO_IIAP	0x4003a0	/* IIQ Arbitration Parameters */
3408c2ecf20Sopenharmony_ci#define IIO_IMMR	IIO_IIAP
3418c2ecf20Sopenharmony_ci#define IIO_ICMR	0x4003a8	/* CRB Management Register */
3428c2ecf20Sopenharmony_ci#define IIO_ICCR	0x4003b0	/* CRB Control Register */
3438c2ecf20Sopenharmony_ci#define IIO_ICTO	0x4003b8	/* CRB Time Out Register */
3448c2ecf20Sopenharmony_ci#define IIO_ICTP	0x4003c0	/* CRB Time Out Prescalar */
3458c2ecf20Sopenharmony_ci
3468c2ecf20Sopenharmony_ci
3478c2ecf20Sopenharmony_ci/*
3488c2ecf20Sopenharmony_ci * ICMR register fields
3498c2ecf20Sopenharmony_ci */
3508c2ecf20Sopenharmony_ci#define IIO_ICMR_PC_VLD_SHFT	36
3518c2ecf20Sopenharmony_ci#define IIO_ICMR_PC_VLD_MASK	(0x7fffUL << IIO_ICMR_PC_VLD_SHFT)
3528c2ecf20Sopenharmony_ci
3538c2ecf20Sopenharmony_ci#define IIO_ICMR_CRB_VLD_SHFT	20
3548c2ecf20Sopenharmony_ci#define IIO_ICMR_CRB_VLD_MASK	(0x7fffUL << IIO_ICMR_CRB_VLD_SHFT)
3558c2ecf20Sopenharmony_ci
3568c2ecf20Sopenharmony_ci#define IIO_ICMR_FC_CNT_SHFT	16
3578c2ecf20Sopenharmony_ci#define IIO_ICMR_FC_CNT_MASK	(0xf << IIO_ICMR_FC_CNT_SHFT)
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_ci#define IIO_ICMR_C_CNT_SHFT	4
3608c2ecf20Sopenharmony_ci#define IIO_ICMR_C_CNT_MASK	(0xf << IIO_ICMR_C_CNT_SHFT)
3618c2ecf20Sopenharmony_ci
3628c2ecf20Sopenharmony_ci#define IIO_ICMR_P_CNT_SHFT	0
3638c2ecf20Sopenharmony_ci#define IIO_ICMR_P_CNT_MASK	(0xf << IIO_ICMR_P_CNT_SHFT)
3648c2ecf20Sopenharmony_ci
3658c2ecf20Sopenharmony_ci#define IIO_ICMR_PRECISE	(1UL << 52)
3668c2ecf20Sopenharmony_ci#define IIO_ICMR_CLR_RPPD	(1UL << 13)
3678c2ecf20Sopenharmony_ci#define IIO_ICMR_CLR_RQPD	(1UL << 12)
3688c2ecf20Sopenharmony_ci
3698c2ecf20Sopenharmony_ci/*
3708c2ecf20Sopenharmony_ci * IIO PIO Deallocation register field masks : (IIO_IPDR)
3718c2ecf20Sopenharmony_ci */
3728c2ecf20Sopenharmony_ci#define IIO_IPDR_PND	(1 << 4)
3738c2ecf20Sopenharmony_ci
3748c2ecf20Sopenharmony_ci/*
3758c2ecf20Sopenharmony_ci * IIO CRB deallocation register field masks: (IIO_ICDR)
3768c2ecf20Sopenharmony_ci */
3778c2ecf20Sopenharmony_ci#define IIO_ICDR_PND	(1 << 4)
3788c2ecf20Sopenharmony_ci
3798c2ecf20Sopenharmony_ci/*
3808c2ecf20Sopenharmony_ci * IIO CRB control register Fields: IIO_ICCR
3818c2ecf20Sopenharmony_ci */
3828c2ecf20Sopenharmony_ci#define IIO_ICCR_PENDING	(0x10000)
3838c2ecf20Sopenharmony_ci#define IIO_ICCR_CMD_MASK	(0xFF)
3848c2ecf20Sopenharmony_ci#define IIO_ICCR_CMD_SHFT	(7)
3858c2ecf20Sopenharmony_ci#define IIO_ICCR_CMD_NOP	(0x0)	/* No Op */
3868c2ecf20Sopenharmony_ci#define IIO_ICCR_CMD_WAKE	(0x100) /* Reactivate CRB entry and process */
3878c2ecf20Sopenharmony_ci#define IIO_ICCR_CMD_TIMEOUT	(0x200) /* Make CRB timeout & mark invalid */
3888c2ecf20Sopenharmony_ci#define IIO_ICCR_CMD_EJECT	(0x400) /* Contents of entry written to memory
3898c2ecf20Sopenharmony_ci					 * via a WB
3908c2ecf20Sopenharmony_ci					 */
3918c2ecf20Sopenharmony_ci#define IIO_ICCR_CMD_FLUSH	(0x800)
3928c2ecf20Sopenharmony_ci
3938c2ecf20Sopenharmony_ci/*
3948c2ecf20Sopenharmony_ci * CRB manipulation macros
3958c2ecf20Sopenharmony_ci *	The CRB macros are slightly complicated, since there are up to
3968c2ecf20Sopenharmony_ci *	four registers associated with each CRB entry.
3978c2ecf20Sopenharmony_ci */
3988c2ecf20Sopenharmony_ci#define IIO_NUM_CRBS		15	/* Number of CRBs */
3998c2ecf20Sopenharmony_ci#define IIO_NUM_NORMAL_CRBS	12	/* Number of regular CRB entries */
4008c2ecf20Sopenharmony_ci#define IIO_NUM_PC_CRBS		4	/* Number of partial cache CRBs */
4018c2ecf20Sopenharmony_ci#define IIO_ICRB_OFFSET		8
4028c2ecf20Sopenharmony_ci#define IIO_ICRB_0		0x400400
4038c2ecf20Sopenharmony_ci/* XXX - This is now tuneable:
4048c2ecf20Sopenharmony_ci	#define IIO_FIRST_PC_ENTRY 12
4058c2ecf20Sopenharmony_ci */
4068c2ecf20Sopenharmony_ci
4078c2ecf20Sopenharmony_ci#define IIO_ICRB_A(_x)	(IIO_ICRB_0 + (4 * IIO_ICRB_OFFSET * (_x)))
4088c2ecf20Sopenharmony_ci#define IIO_ICRB_B(_x)	(IIO_ICRB_A(_x) + 1*IIO_ICRB_OFFSET)
4098c2ecf20Sopenharmony_ci#define IIO_ICRB_C(_x)	(IIO_ICRB_A(_x) + 2*IIO_ICRB_OFFSET)
4108c2ecf20Sopenharmony_ci#define IIO_ICRB_D(_x)	(IIO_ICRB_A(_x) + 3*IIO_ICRB_OFFSET)
4118c2ecf20Sopenharmony_ci
4128c2ecf20Sopenharmony_ci/* XXX - IBUE register coming for Hub 2 */
4138c2ecf20Sopenharmony_ci
4148c2ecf20Sopenharmony_ci/*
4158c2ecf20Sopenharmony_ci *
4168c2ecf20Sopenharmony_ci * CRB Register description.
4178c2ecf20Sopenharmony_ci *
4188c2ecf20Sopenharmony_ci * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING
4198c2ecf20Sopenharmony_ci * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING
4208c2ecf20Sopenharmony_ci * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING
4218c2ecf20Sopenharmony_ci * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING
4228c2ecf20Sopenharmony_ci * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING
4238c2ecf20Sopenharmony_ci *
4248c2ecf20Sopenharmony_ci * Many of the fields in CRB are status bits used by hardware
4258c2ecf20Sopenharmony_ci * for implementation of the protocol. It's very dangerous to
4268c2ecf20Sopenharmony_ci * mess around with the CRB registers.
4278c2ecf20Sopenharmony_ci *
4288c2ecf20Sopenharmony_ci * It's OK to read the CRB registers and try to make sense out of the
4298c2ecf20Sopenharmony_ci * fields in CRB.
4308c2ecf20Sopenharmony_ci *
4318c2ecf20Sopenharmony_ci * Updating CRB requires all activities in Hub IIO to be quiesced.
4328c2ecf20Sopenharmony_ci * otherwise, a write to CRB could corrupt other CRB entries.
4338c2ecf20Sopenharmony_ci * CRBs are here only as a back door peek to hub IIO's status.
4348c2ecf20Sopenharmony_ci * Quiescing implies  no dmas no PIOs
4358c2ecf20Sopenharmony_ci * either directly from the cpu or from sn0net.
4368c2ecf20Sopenharmony_ci * this is not something that can be done easily. So, AVOID updating
4378c2ecf20Sopenharmony_ci * CRBs.
4388c2ecf20Sopenharmony_ci */
4398c2ecf20Sopenharmony_ci
4408c2ecf20Sopenharmony_ci/*
4418c2ecf20Sopenharmony_ci * Fields in CRB Register A
4428c2ecf20Sopenharmony_ci */
4438c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
4448c2ecf20Sopenharmony_citypedef union icrba_u {
4458c2ecf20Sopenharmony_ci	u64	reg_value;
4468c2ecf20Sopenharmony_ci	struct {
4478c2ecf20Sopenharmony_ci		u64	resvd:	6,
4488c2ecf20Sopenharmony_ci			stall_bte0: 1,	/* Stall BTE 0 */
4498c2ecf20Sopenharmony_ci			stall_bte1: 1,	/* Stall BTE 1 */
4508c2ecf20Sopenharmony_ci			error:	1,	/* CRB has an error	*/
4518c2ecf20Sopenharmony_ci			ecode:	3,	/* Error Code		*/
4528c2ecf20Sopenharmony_ci			lnetuce: 1,	/* SN0net Uncorrectable error */
4538c2ecf20Sopenharmony_ci			mark:	1,	/* CRB Has been marked	*/
4548c2ecf20Sopenharmony_ci			xerr:	1,	/* Error bit set in xtalk header */
4558c2ecf20Sopenharmony_ci			sidn:	4,	/* SIDN field from xtalk	*/
4568c2ecf20Sopenharmony_ci			tnum:	5,	/* TNUM field in xtalk		*/
4578c2ecf20Sopenharmony_ci			addr:	38,	/* Address of request	*/
4588c2ecf20Sopenharmony_ci			valid:	1,	/* Valid status		*/
4598c2ecf20Sopenharmony_ci			iow:	1;	/* IO Write operation	*/
4608c2ecf20Sopenharmony_ci	} icrba_fields_s;
4618c2ecf20Sopenharmony_ci} icrba_t;
4628c2ecf20Sopenharmony_ci
4638c2ecf20Sopenharmony_ci/* This is an alternate typedef for the HUB1 CRB A in order to allow
4648c2ecf20Sopenharmony_ci   runtime selection of the format based on the REV_ID field of the
4658c2ecf20Sopenharmony_ci   NI_STATUS_REV_ID register. */
4668c2ecf20Sopenharmony_citypedef union h1_icrba_u {
4678c2ecf20Sopenharmony_ci	u64	reg_value;
4688c2ecf20Sopenharmony_ci
4698c2ecf20Sopenharmony_ci	struct {
4708c2ecf20Sopenharmony_ci		u64	resvd:	6,
4718c2ecf20Sopenharmony_ci			unused: 1,	/* Unused but RW!!	*/
4728c2ecf20Sopenharmony_ci			error:	1,	/* CRB has an error	*/
4738c2ecf20Sopenharmony_ci			ecode:	4,	/* Error Code		*/
4748c2ecf20Sopenharmony_ci			lnetuce: 1,	/* SN0net Uncorrectable error */
4758c2ecf20Sopenharmony_ci			mark:	1,	/* CRB Has been marked	*/
4768c2ecf20Sopenharmony_ci			xerr:	1,	/* Error bit set in xtalk header */
4778c2ecf20Sopenharmony_ci			sidn:	4,	/* SIDN field from xtalk	*/
4788c2ecf20Sopenharmony_ci			tnum:	5,	/* TNUM field in xtalk		*/
4798c2ecf20Sopenharmony_ci			addr:	38,	/* Address of request	*/
4808c2ecf20Sopenharmony_ci			valid:	1,	/* Valid status		*/
4818c2ecf20Sopenharmony_ci			iow:	1;	/* IO Write operation	*/
4828c2ecf20Sopenharmony_ci	} h1_icrba_fields_s;
4838c2ecf20Sopenharmony_ci} h1_icrba_t;
4848c2ecf20Sopenharmony_ci
4858c2ecf20Sopenharmony_ci/* XXX - Is this still right?  Check the spec. */
4868c2ecf20Sopenharmony_ci#define ICRBN_A_CERR_SHFT	54
4878c2ecf20Sopenharmony_ci#define ICRBN_A_ERR_MASK	0x3ff
4888c2ecf20Sopenharmony_ci
4898c2ecf20Sopenharmony_ci#endif /* !__ASSEMBLY__ */
4908c2ecf20Sopenharmony_ci
4918c2ecf20Sopenharmony_ci#define IIO_ICRB_ADDR_SHFT	2	/* Shift to get proper address */
4928c2ecf20Sopenharmony_ci
4938c2ecf20Sopenharmony_ci/*
4948c2ecf20Sopenharmony_ci * values for "ecode" field
4958c2ecf20Sopenharmony_ci */
4968c2ecf20Sopenharmony_ci#define IIO_ICRB_ECODE_DERR	0	/* Directory error due to IIO access */
4978c2ecf20Sopenharmony_ci#define IIO_ICRB_ECODE_PERR	1	/* Poison error on IO access */
4988c2ecf20Sopenharmony_ci#define IIO_ICRB_ECODE_WERR	2	/* Write error by IIO access
4998c2ecf20Sopenharmony_ci					 * e.g. WINV to a Read only line.
5008c2ecf20Sopenharmony_ci					 */
5018c2ecf20Sopenharmony_ci#define IIO_ICRB_ECODE_AERR	3	/* Access error caused by IIO access */
5028c2ecf20Sopenharmony_ci#define IIO_ICRB_ECODE_PWERR	4	/* Error on partial write	*/
5038c2ecf20Sopenharmony_ci#define IIO_ICRB_ECODE_PRERR	5	/* Error on partial read	*/
5048c2ecf20Sopenharmony_ci#define IIO_ICRB_ECODE_TOUT	6	/* CRB timeout before deallocating */
5058c2ecf20Sopenharmony_ci#define IIO_ICRB_ECODE_XTERR	7	/* Incoming xtalk pkt had error bit */
5068c2ecf20Sopenharmony_ci
5078c2ecf20Sopenharmony_ci
5088c2ecf20Sopenharmony_ci
5098c2ecf20Sopenharmony_ci/*
5108c2ecf20Sopenharmony_ci * Fields in CRB Register B
5118c2ecf20Sopenharmony_ci */
5128c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
5138c2ecf20Sopenharmony_citypedef union icrbb_u {
5148c2ecf20Sopenharmony_ci	u64	reg_value;
5158c2ecf20Sopenharmony_ci	struct {
5168c2ecf20Sopenharmony_ci	    u64 rsvd1:	5,
5178c2ecf20Sopenharmony_ci		btenum: 1,	/* BTE to which entry belongs to */
5188c2ecf20Sopenharmony_ci		cohtrans: 1,	/* Coherent transaction */
5198c2ecf20Sopenharmony_ci		xtsize: 2,	/* Xtalk operation size
5208c2ecf20Sopenharmony_ci				 * 0: Double Word
5218c2ecf20Sopenharmony_ci				 * 1: 32 Bytes.
5228c2ecf20Sopenharmony_ci				 * 2: 128 Bytes,
5238c2ecf20Sopenharmony_ci				 * 3: Reserved.
5248c2ecf20Sopenharmony_ci				 */
5258c2ecf20Sopenharmony_ci		srcnode: 9,	/* Source Node ID		*/
5268c2ecf20Sopenharmony_ci		srcinit: 2,	/* Source Initiator:
5278c2ecf20Sopenharmony_ci				 * See below for field values.
5288c2ecf20Sopenharmony_ci				 */
5298c2ecf20Sopenharmony_ci		useold: 1,	/* Use OLD command for processing */
5308c2ecf20Sopenharmony_ci		imsgtype: 2,	/* Incoming message type
5318c2ecf20Sopenharmony_ci				 * see below for field values
5328c2ecf20Sopenharmony_ci				 */
5338c2ecf20Sopenharmony_ci		imsg:	8,	/* Incoming message	*/
5348c2ecf20Sopenharmony_ci		initator: 3,	/* Initiator of original request
5358c2ecf20Sopenharmony_ci				 * See below for field values.
5368c2ecf20Sopenharmony_ci				 */
5378c2ecf20Sopenharmony_ci		reqtype: 5,	/* Identifies type of request
5388c2ecf20Sopenharmony_ci				 * See below for field values.
5398c2ecf20Sopenharmony_ci				 */
5408c2ecf20Sopenharmony_ci		rsvd2:	7,
5418c2ecf20Sopenharmony_ci		ackcnt: 11,	/* Invalidate ack count */
5428c2ecf20Sopenharmony_ci		resp:	1,	/* data response  given to processor */
5438c2ecf20Sopenharmony_ci		ack:	1,	/* indicates data ack received	*/
5448c2ecf20Sopenharmony_ci		hold:	1,	/* entry is gathering inval acks */
5458c2ecf20Sopenharmony_ci		wb_pend:1,	/* waiting for writeback to complete */
5468c2ecf20Sopenharmony_ci		intvn:	1,	/* Intervention */
5478c2ecf20Sopenharmony_ci		stall_ib: 1,	/* Stall Ibuf (from crosstalk) */
5488c2ecf20Sopenharmony_ci		stall_intr: 1;	/* Stall internal interrupts */
5498c2ecf20Sopenharmony_ci	} icrbb_field_s;
5508c2ecf20Sopenharmony_ci} icrbb_t;
5518c2ecf20Sopenharmony_ci
5528c2ecf20Sopenharmony_ci/* This is an alternate typedef for the HUB1 CRB B in order to allow
5538c2ecf20Sopenharmony_ci   runtime selection of the format based on the REV_ID field of the
5548c2ecf20Sopenharmony_ci   NI_STATUS_REV_ID register. */
5558c2ecf20Sopenharmony_citypedef union h1_icrbb_u {
5568c2ecf20Sopenharmony_ci	u64	reg_value;
5578c2ecf20Sopenharmony_ci	struct {
5588c2ecf20Sopenharmony_ci		u64	rsvd1:	5,
5598c2ecf20Sopenharmony_ci			btenum: 1,	/* BTE to which entry belongs to */
5608c2ecf20Sopenharmony_ci			cohtrans: 1,	/* Coherent transaction */
5618c2ecf20Sopenharmony_ci			xtsize: 2,	/* Xtalk operation size
5628c2ecf20Sopenharmony_ci					 * 0: Double Word
5638c2ecf20Sopenharmony_ci					 * 1: 32 Bytes.
5648c2ecf20Sopenharmony_ci					 * 2: 128 Bytes,
5658c2ecf20Sopenharmony_ci					 * 3: Reserved.
5668c2ecf20Sopenharmony_ci					 */
5678c2ecf20Sopenharmony_ci			srcnode: 9,	/* Source Node ID		*/
5688c2ecf20Sopenharmony_ci			srcinit: 2,	/* Source Initiator:
5698c2ecf20Sopenharmony_ci					 * See below for field values.
5708c2ecf20Sopenharmony_ci					 */
5718c2ecf20Sopenharmony_ci			useold: 1,	/* Use OLD command for processing */
5728c2ecf20Sopenharmony_ci			imsgtype: 2,	/* Incoming message type
5738c2ecf20Sopenharmony_ci					 * see below for field values
5748c2ecf20Sopenharmony_ci					 */
5758c2ecf20Sopenharmony_ci			imsg:	8,	/* Incoming message	*/
5768c2ecf20Sopenharmony_ci			initator: 3,	/* Initiator of original request
5778c2ecf20Sopenharmony_ci					 * See below for field values.
5788c2ecf20Sopenharmony_ci					 */
5798c2ecf20Sopenharmony_ci			rsvd2:	1,
5808c2ecf20Sopenharmony_ci			pcache: 1,	/* entry belongs to partial cache */
5818c2ecf20Sopenharmony_ci			reqtype: 5,	/* Identifies type of request
5828c2ecf20Sopenharmony_ci					 * See below for field values.
5838c2ecf20Sopenharmony_ci					 */
5848c2ecf20Sopenharmony_ci			stl_ib: 1,	/* stall Ibus coming from xtalk */
5858c2ecf20Sopenharmony_ci			stl_intr: 1,	/* Stall internal interrupts */
5868c2ecf20Sopenharmony_ci			stl_bte0: 1,	/* Stall BTE 0	*/
5878c2ecf20Sopenharmony_ci			stl_bte1: 1,	/* Stall BTE 1	*/
5888c2ecf20Sopenharmony_ci			intrvn: 1,	/* Req was target of intervention */
5898c2ecf20Sopenharmony_ci			ackcnt: 11,	/* Invalidate ack count */
5908c2ecf20Sopenharmony_ci			resp:	1,	/* data response  given to processor */
5918c2ecf20Sopenharmony_ci			ack:	1,	/* indicates data ack received	*/
5928c2ecf20Sopenharmony_ci			hold:	1,	/* entry is gathering inval acks */
5938c2ecf20Sopenharmony_ci			wb_pend:1,	/* waiting for writeback to complete */
5948c2ecf20Sopenharmony_ci			sleep:	1,	/* xtalk req sleeping till IO-sync */
5958c2ecf20Sopenharmony_ci			pnd_reply: 1,	/* replies not issed due to IOQ full */
5968c2ecf20Sopenharmony_ci			pnd_req: 1;	/* reqs not issued due to IOQ full */
5978c2ecf20Sopenharmony_ci	} h1_icrbb_field_s;
5988c2ecf20Sopenharmony_ci} h1_icrbb_t;
5998c2ecf20Sopenharmony_ci
6008c2ecf20Sopenharmony_ci
6018c2ecf20Sopenharmony_ci#define b_imsgtype	icrbb_field_s.imsgtype
6028c2ecf20Sopenharmony_ci#define b_btenum	icrbb_field_s.btenum
6038c2ecf20Sopenharmony_ci#define b_cohtrans	icrbb_field_s.cohtrans
6048c2ecf20Sopenharmony_ci#define b_xtsize	icrbb_field_s.xtsize
6058c2ecf20Sopenharmony_ci#define b_srcnode	icrbb_field_s.srcnode
6068c2ecf20Sopenharmony_ci#define b_srcinit	icrbb_field_s.srcinit
6078c2ecf20Sopenharmony_ci#define b_imsgtype	icrbb_field_s.imsgtype
6088c2ecf20Sopenharmony_ci#define b_imsg		icrbb_field_s.imsg
6098c2ecf20Sopenharmony_ci#define b_initiator	icrbb_field_s.initiator
6108c2ecf20Sopenharmony_ci
6118c2ecf20Sopenharmony_ci#endif /* !__ASSEMBLY__ */
6128c2ecf20Sopenharmony_ci
6138c2ecf20Sopenharmony_ci/*
6148c2ecf20Sopenharmony_ci * values for field xtsize
6158c2ecf20Sopenharmony_ci */
6168c2ecf20Sopenharmony_ci#define IIO_ICRB_XTSIZE_DW	0	/* Xtalk operation size is 8 bytes  */
6178c2ecf20Sopenharmony_ci#define IIO_ICRB_XTSIZE_32	1	/* Xtalk operation size is 32 bytes */
6188c2ecf20Sopenharmony_ci#define IIO_ICRB_XTSIZE_128	2	/* Xtalk operation size is 128 bytes */
6198c2ecf20Sopenharmony_ci
6208c2ecf20Sopenharmony_ci/*
6218c2ecf20Sopenharmony_ci * values for field srcinit
6228c2ecf20Sopenharmony_ci */
6238c2ecf20Sopenharmony_ci#define IIO_ICRB_PROC0		0	/* Source of request is Proc 0 */
6248c2ecf20Sopenharmony_ci#define IIO_ICRB_PROC1		1	/* Source of request is Proc 1 */
6258c2ecf20Sopenharmony_ci#define IIO_ICRB_GB_REQ		2	/* Source is Guaranteed BW request */
6268c2ecf20Sopenharmony_ci#define IIO_ICRB_IO_REQ		3	/* Source is Normal IO request	*/
6278c2ecf20Sopenharmony_ci
6288c2ecf20Sopenharmony_ci/*
6298c2ecf20Sopenharmony_ci * Values for field imsgtype
6308c2ecf20Sopenharmony_ci */
6318c2ecf20Sopenharmony_ci#define IIO_ICRB_IMSGT_XTALK	0	/* Incoming Message from Xtalk */
6328c2ecf20Sopenharmony_ci#define IIO_ICRB_IMSGT_BTE	1	/* Incoming message from BTE	*/
6338c2ecf20Sopenharmony_ci#define IIO_ICRB_IMSGT_SN0NET	2	/* Incoming message from SN0 net */
6348c2ecf20Sopenharmony_ci#define IIO_ICRB_IMSGT_CRB	3	/* Incoming message from CRB ???  */
6358c2ecf20Sopenharmony_ci
6368c2ecf20Sopenharmony_ci/*
6378c2ecf20Sopenharmony_ci * values for field initiator.
6388c2ecf20Sopenharmony_ci */
6398c2ecf20Sopenharmony_ci#define IIO_ICRB_INIT_XTALK	0	/* Message originated in xtalk	*/
6408c2ecf20Sopenharmony_ci#define IIO_ICRB_INIT_BTE0	0x1	/* Message originated in BTE 0	*/
6418c2ecf20Sopenharmony_ci#define IIO_ICRB_INIT_SN0NET	0x2	/* Message originated in SN0net */
6428c2ecf20Sopenharmony_ci#define IIO_ICRB_INIT_CRB	0x3	/* Message originated in CRB ?	*/
6438c2ecf20Sopenharmony_ci#define IIO_ICRB_INIT_BTE1	0x5	/* MEssage originated in BTE 1	*/
6448c2ecf20Sopenharmony_ci
6458c2ecf20Sopenharmony_ci/*
6468c2ecf20Sopenharmony_ci * Values for field reqtype.
6478c2ecf20Sopenharmony_ci */
6488c2ecf20Sopenharmony_ci/* XXX - Need to fix this for Hub 2 */
6498c2ecf20Sopenharmony_ci#define IIO_ICRB_REQ_DWRD	0	/* Request type double word	*/
6508c2ecf20Sopenharmony_ci#define IIO_ICRB_REQ_QCLRD	1	/* Request is Qrtr Caceh line Rd */
6518c2ecf20Sopenharmony_ci#define IIO_ICRB_REQ_BLKRD	2	/* Request is block read	*/
6528c2ecf20Sopenharmony_ci#define IIO_ICRB_REQ_RSHU	6	/* Request is BTE block read	*/
6538c2ecf20Sopenharmony_ci#define IIO_ICRB_REQ_REXU	7	/* request is BTE Excl Read	*/
6548c2ecf20Sopenharmony_ci#define IIO_ICRB_REQ_RDEX	8	/* Request is Read Exclusive	*/
6558c2ecf20Sopenharmony_ci#define IIO_ICRB_REQ_WINC	9	/* Request is Write Invalidate	*/
6568c2ecf20Sopenharmony_ci#define IIO_ICRB_REQ_BWINV	10	/* Request is BTE Winv		*/
6578c2ecf20Sopenharmony_ci#define IIO_ICRB_REQ_PIORD	11	/* Request is PIO read		*/
6588c2ecf20Sopenharmony_ci#define IIO_ICRB_REQ_PIOWR	12	/* Request is PIO Write		*/
6598c2ecf20Sopenharmony_ci#define IIO_ICRB_REQ_PRDM	13	/* Request is Fetch&Op		*/
6608c2ecf20Sopenharmony_ci#define IIO_ICRB_REQ_PWRM	14	/* Request is Store &Op		*/
6618c2ecf20Sopenharmony_ci#define IIO_ICRB_REQ_PTPWR	15	/* Request is Peer to peer	*/
6628c2ecf20Sopenharmony_ci#define IIO_ICRB_REQ_WB		16	/* Request is Write back	*/
6638c2ecf20Sopenharmony_ci#define IIO_ICRB_REQ_DEX	17	/* Retained DEX Cache line	*/
6648c2ecf20Sopenharmony_ci
6658c2ecf20Sopenharmony_ci/*
6668c2ecf20Sopenharmony_ci * Fields in CRB Register C
6678c2ecf20Sopenharmony_ci */
6688c2ecf20Sopenharmony_ci
6698c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
6708c2ecf20Sopenharmony_ci
6718c2ecf20Sopenharmony_citypedef union icrbc_s {
6728c2ecf20Sopenharmony_ci	u64	reg_value;
6738c2ecf20Sopenharmony_ci	struct {
6748c2ecf20Sopenharmony_ci		u64	rsvd:	6,
6758c2ecf20Sopenharmony_ci			sleep:	1,
6768c2ecf20Sopenharmony_ci			pricnt: 4,	/* Priority count sent with Read req */
6778c2ecf20Sopenharmony_ci			pripsc: 4,	/* Priority Pre scalar	*/
6788c2ecf20Sopenharmony_ci			bteop:	1,	/* BTE Operation	*/
6798c2ecf20Sopenharmony_ci			push_be: 34,	/* Push address Byte enable
6808c2ecf20Sopenharmony_ci					 * Holds push addr, if CRB is for BTE
6818c2ecf20Sopenharmony_ci					 * If CRB belongs to Partial cache,
6828c2ecf20Sopenharmony_ci					 * this contains byte enables bits
6838c2ecf20Sopenharmony_ci					 * ([47:46] = 0)
6848c2ecf20Sopenharmony_ci					 */
6858c2ecf20Sopenharmony_ci			suppl:	11,	/* Supplemental field	*/
6868c2ecf20Sopenharmony_ci			barrop: 1,	/* Barrier Op bit set in xtalk req */
6878c2ecf20Sopenharmony_ci			doresp: 1,	/* Xtalk req needs a response	*/
6888c2ecf20Sopenharmony_ci			gbr:	1;	/* GBR bit set in xtalk packet	*/
6898c2ecf20Sopenharmony_ci	} icrbc_field_s;
6908c2ecf20Sopenharmony_ci} icrbc_t;
6918c2ecf20Sopenharmony_ci
6928c2ecf20Sopenharmony_ci#define c_pricnt	icrbc_field_s.pricnt
6938c2ecf20Sopenharmony_ci#define c_pripsc	icrbc_field_s.pripsc
6948c2ecf20Sopenharmony_ci#define c_bteop		icrbc_field_s.bteop
6958c2ecf20Sopenharmony_ci#define c_bteaddr	icrbc_field_s.push_be	/* push_be field has 2 names */
6968c2ecf20Sopenharmony_ci#define c_benable	icrbc_field_s.push_be	/* push_be field has 2 names */
6978c2ecf20Sopenharmony_ci#define c_suppl		icrbc_field_s.suppl
6988c2ecf20Sopenharmony_ci#define c_barrop	icrbc_field_s.barrop
6998c2ecf20Sopenharmony_ci#define c_doresp	icrbc_field_s.doresp
7008c2ecf20Sopenharmony_ci#define c_gbr	icrbc_field_s.gbr
7018c2ecf20Sopenharmony_ci#endif /* !__ASSEMBLY__ */
7028c2ecf20Sopenharmony_ci
7038c2ecf20Sopenharmony_ci/*
7048c2ecf20Sopenharmony_ci * Fields in CRB Register D
7058c2ecf20Sopenharmony_ci */
7068c2ecf20Sopenharmony_ci
7078c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
7088c2ecf20Sopenharmony_citypedef union icrbd_s {
7098c2ecf20Sopenharmony_ci	u64	reg_value;
7108c2ecf20Sopenharmony_ci	struct {
7118c2ecf20Sopenharmony_ci	    u64 rsvd:	38,
7128c2ecf20Sopenharmony_ci		toutvld: 1,	/* Timeout in progress for this CRB */
7138c2ecf20Sopenharmony_ci		ctxtvld: 1,	/* Context field below is valid */
7148c2ecf20Sopenharmony_ci		rsvd2:	1,
7158c2ecf20Sopenharmony_ci		context: 15,	/* Bit vector:
7168c2ecf20Sopenharmony_ci				 * Has a bit set for each CRB entry
7178c2ecf20Sopenharmony_ci				 * which needs to be deallocated
7188c2ecf20Sopenharmony_ci				 * before this CRB entry is processed.
7198c2ecf20Sopenharmony_ci				 * Set only for barrier operations.
7208c2ecf20Sopenharmony_ci				 */
7218c2ecf20Sopenharmony_ci		timeout: 8;	/* Timeout Upper 8 bits */
7228c2ecf20Sopenharmony_ci	} icrbd_field_s;
7238c2ecf20Sopenharmony_ci} icrbd_t;
7248c2ecf20Sopenharmony_ci
7258c2ecf20Sopenharmony_ci#define icrbd_toutvld	icrbd_field_s.toutvld
7268c2ecf20Sopenharmony_ci#define icrbd_ctxtvld	icrbd_field_s.ctxtvld
7278c2ecf20Sopenharmony_ci#define icrbd_context	icrbd_field_s.context
7288c2ecf20Sopenharmony_ci
7298c2ecf20Sopenharmony_ci
7308c2ecf20Sopenharmony_citypedef union hubii_ifdr_u {
7318c2ecf20Sopenharmony_ci	u64	hi_ifdr_value;
7328c2ecf20Sopenharmony_ci	struct {
7338c2ecf20Sopenharmony_ci		u64	ifdr_rsvd:	49,
7348c2ecf20Sopenharmony_ci			ifdr_maxrp:	 7,
7358c2ecf20Sopenharmony_ci			ifdr_rsvd1:	 1,
7368c2ecf20Sopenharmony_ci			ifdr_maxrq:	 7;
7378c2ecf20Sopenharmony_ci	} hi_ifdr_fields;
7388c2ecf20Sopenharmony_ci} hubii_ifdr_t;
7398c2ecf20Sopenharmony_ci
7408c2ecf20Sopenharmony_ci#endif /* !__ASSEMBLY__ */
7418c2ecf20Sopenharmony_ci
7428c2ecf20Sopenharmony_ci/*
7438c2ecf20Sopenharmony_ci * Hardware designed names for the BTE control registers.
7448c2ecf20Sopenharmony_ci */
7458c2ecf20Sopenharmony_ci#define IIO_IBLS_0	0x410000	/* BTE length/status 0 */
7468c2ecf20Sopenharmony_ci#define IIO_IBSA_0	0x410008	/* BTE source address 0 */
7478c2ecf20Sopenharmony_ci#define IIO_IBDA_0	0x410010	/* BTE destination address 0 */
7488c2ecf20Sopenharmony_ci#define IIO_IBCT_0	0x410018	/* BTE control/terminate 0 */
7498c2ecf20Sopenharmony_ci#define IIO_IBNA_0	0x410020	/* BTE notification address 0 */
7508c2ecf20Sopenharmony_ci#define IIO_IBNR_0	IIO_IBNA_0
7518c2ecf20Sopenharmony_ci#define IIO_IBIA_0	0x410028	/* BTE interrupt address 0 */
7528c2ecf20Sopenharmony_ci
7538c2ecf20Sopenharmony_ci#define IIO_IBLS_1	0x420000	/* BTE length/status 1 */
7548c2ecf20Sopenharmony_ci#define IIO_IBSA_1	0x420008	/* BTE source address 1 */
7558c2ecf20Sopenharmony_ci#define IIO_IBDA_1	0x420010	/* BTE destination address 1 */
7568c2ecf20Sopenharmony_ci#define IIO_IBCT_1	0x420018	/* BTE control/terminate 1 */
7578c2ecf20Sopenharmony_ci#define IIO_IBNA_1	0x420020	/* BTE notification address 1 */
7588c2ecf20Sopenharmony_ci#define IIO_IBNR_1	IIO_IBNA_1
7598c2ecf20Sopenharmony_ci#define IIO_IBIA_1	0x420028	/* BTE interrupt address 1 */
7608c2ecf20Sopenharmony_ci
7618c2ecf20Sopenharmony_ci/*
7628c2ecf20Sopenharmony_ci * More miscellaneous registers
7638c2ecf20Sopenharmony_ci */
7648c2ecf20Sopenharmony_ci#define IIO_IPCR	0x430000	/* Performance Control */
7658c2ecf20Sopenharmony_ci#define IIO_IPPR	0x430008	/* Performance Profiling */
7668c2ecf20Sopenharmony_ci
7678c2ecf20Sopenharmony_ci/*
7688c2ecf20Sopenharmony_ci * IO Error Clear register bit field definitions
7698c2ecf20Sopenharmony_ci */
7708c2ecf20Sopenharmony_ci#define IECLR_BTE1		(1 << 18)  /* clear bte error 1 ??? */
7718c2ecf20Sopenharmony_ci#define IECLR_BTE0		(1 << 17)  /* clear bte error 0 ??? */
7728c2ecf20Sopenharmony_ci#define IECLR_CRAZY		(1 << 16)  /* clear crazy bit in wstat reg */
7738c2ecf20Sopenharmony_ci#define IECLR_PRB_F		(1 << 15)  /* clear err bit in PRB_F reg */
7748c2ecf20Sopenharmony_ci#define IECLR_PRB_E		(1 << 14)  /* clear err bit in PRB_E reg */
7758c2ecf20Sopenharmony_ci#define IECLR_PRB_D		(1 << 13)  /* clear err bit in PRB_D reg */
7768c2ecf20Sopenharmony_ci#define IECLR_PRB_C		(1 << 12)  /* clear err bit in PRB_C reg */
7778c2ecf20Sopenharmony_ci#define IECLR_PRB_B		(1 << 11)  /* clear err bit in PRB_B reg */
7788c2ecf20Sopenharmony_ci#define IECLR_PRB_A		(1 << 10)  /* clear err bit in PRB_A reg */
7798c2ecf20Sopenharmony_ci#define IECLR_PRB_9		(1 << 9)   /* clear err bit in PRB_9 reg */
7808c2ecf20Sopenharmony_ci#define IECLR_PRB_8		(1 << 8)   /* clear err bit in PRB_8 reg */
7818c2ecf20Sopenharmony_ci#define IECLR_PRB_0		(1 << 0)   /* clear err bit in PRB_0 reg */
7828c2ecf20Sopenharmony_ci
7838c2ecf20Sopenharmony_ci/*
7848c2ecf20Sopenharmony_ci * IO PIO Read Table Entry format
7858c2ecf20Sopenharmony_ci */
7868c2ecf20Sopenharmony_ci
7878c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
7888c2ecf20Sopenharmony_ci
7898c2ecf20Sopenharmony_citypedef union iprte_a {
7908c2ecf20Sopenharmony_ci	u64	entry;
7918c2ecf20Sopenharmony_ci	struct {
7928c2ecf20Sopenharmony_ci	    u64 rsvd1	  : 7,	/* Reserved field		*/
7938c2ecf20Sopenharmony_ci		valid	  : 1,	/* Maps to a timeout entry	*/
7948c2ecf20Sopenharmony_ci		rsvd2	  : 1,
7958c2ecf20Sopenharmony_ci		srcnode	  : 9,	/* Node which did this PIO	*/
7968c2ecf20Sopenharmony_ci		initiator : 2,	/* If T5A or T5B or IO		*/
7978c2ecf20Sopenharmony_ci		rsvd3	  : 3,
7988c2ecf20Sopenharmony_ci		addr	  : 38, /* Physical address of PIO	*/
7998c2ecf20Sopenharmony_ci		rsvd4	  : 3;
8008c2ecf20Sopenharmony_ci	} iprte_fields;
8018c2ecf20Sopenharmony_ci} iprte_a_t;
8028c2ecf20Sopenharmony_ci
8038c2ecf20Sopenharmony_ci#define iprte_valid	iprte_fields.valid
8048c2ecf20Sopenharmony_ci#define iprte_timeout	iprte_fields.timeout
8058c2ecf20Sopenharmony_ci#define iprte_srcnode	iprte_fields.srcnode
8068c2ecf20Sopenharmony_ci#define iprte_init	iprte_fields.initiator
8078c2ecf20Sopenharmony_ci#define iprte_addr	iprte_fields.addr
8088c2ecf20Sopenharmony_ci
8098c2ecf20Sopenharmony_ci#endif /* !__ASSEMBLY__ */
8108c2ecf20Sopenharmony_ci
8118c2ecf20Sopenharmony_ci#define IPRTE_ADDRSHFT	3
8128c2ecf20Sopenharmony_ci
8138c2ecf20Sopenharmony_ci/*
8148c2ecf20Sopenharmony_ci * Hub IIO PRB Register format.
8158c2ecf20Sopenharmony_ci */
8168c2ecf20Sopenharmony_ci
8178c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
8188c2ecf20Sopenharmony_ci/*
8198c2ecf20Sopenharmony_ci * Note: Fields bnakctr, anakctr, xtalkctrmode, ovflow fields are
8208c2ecf20Sopenharmony_ci * "Status" fields, and should only be used in case of clean up after errors.
8218c2ecf20Sopenharmony_ci */
8228c2ecf20Sopenharmony_ci
8238c2ecf20Sopenharmony_citypedef union iprb_u {
8248c2ecf20Sopenharmony_ci	u64	reg_value;
8258c2ecf20Sopenharmony_ci	struct {
8268c2ecf20Sopenharmony_ci	    u64 rsvd1:	15,
8278c2ecf20Sopenharmony_ci		error:	1,	/* Widget rcvd wr resp pkt w/ error */
8288c2ecf20Sopenharmony_ci		ovflow: 5,	/* Overflow count. perf measurement */
8298c2ecf20Sopenharmony_ci		fire_and_forget: 1, /* Launch Write without response */
8308c2ecf20Sopenharmony_ci		mode:	2,	/* Widget operation Mode	*/
8318c2ecf20Sopenharmony_ci		rsvd2:	2,
8328c2ecf20Sopenharmony_ci		bnakctr: 14,
8338c2ecf20Sopenharmony_ci		rsvd3:	2,
8348c2ecf20Sopenharmony_ci		anakctr: 14,
8358c2ecf20Sopenharmony_ci		xtalkctr: 8;
8368c2ecf20Sopenharmony_ci	} iprb_fields_s;
8378c2ecf20Sopenharmony_ci} iprb_t;
8388c2ecf20Sopenharmony_ci
8398c2ecf20Sopenharmony_ci#define iprb_regval	reg_value
8408c2ecf20Sopenharmony_ci
8418c2ecf20Sopenharmony_ci#define iprb_error	iprb_fields_s.error
8428c2ecf20Sopenharmony_ci#define iprb_ovflow	iprb_fields_s.ovflow
8438c2ecf20Sopenharmony_ci#define iprb_ff		iprb_fields_s.fire_and_forget
8448c2ecf20Sopenharmony_ci#define iprb_mode	iprb_fields_s.mode
8458c2ecf20Sopenharmony_ci#define iprb_bnakctr	iprb_fields_s.bnakctr
8468c2ecf20Sopenharmony_ci#define iprb_anakctr	iprb_fields_s.anakctr
8478c2ecf20Sopenharmony_ci#define iprb_xtalkctr	iprb_fields_s.xtalkctr
8488c2ecf20Sopenharmony_ci
8498c2ecf20Sopenharmony_ci#endif /* !__ASSEMBLY__ */
8508c2ecf20Sopenharmony_ci
8518c2ecf20Sopenharmony_ci/*
8528c2ecf20Sopenharmony_ci * values for mode field in iprb_t.
8538c2ecf20Sopenharmony_ci * For details of the meanings of NAK and Accept, refer the PIO flow
8548c2ecf20Sopenharmony_ci * document
8558c2ecf20Sopenharmony_ci */
8568c2ecf20Sopenharmony_ci#define IPRB_MODE_NORMAL	(0)
8578c2ecf20Sopenharmony_ci#define IPRB_MODE_COLLECT_A	(1)	/* PRB in collect A mode */
8588c2ecf20Sopenharmony_ci#define IPRB_MODE_SERVICE_A	(2)	/* NAK B and Accept A */
8598c2ecf20Sopenharmony_ci#define IPRB_MODE_SERVICE_B	(3)	/* NAK A and Accept B */
8608c2ecf20Sopenharmony_ci
8618c2ecf20Sopenharmony_ci/*
8628c2ecf20Sopenharmony_ci * IO CRB entry C_A to E_A : Partial (cache) CRBS
8638c2ecf20Sopenharmony_ci */
8648c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
8658c2ecf20Sopenharmony_citypedef union icrbp_a {
8668c2ecf20Sopenharmony_ci	u64   ip_reg;	    /* the entire register value	*/
8678c2ecf20Sopenharmony_ci	struct {
8688c2ecf20Sopenharmony_ci	     u64 error: 1,  /*	  63, error occurred		*/
8698c2ecf20Sopenharmony_ci		ln_uce: 1,  /*	  62: uncorrectable memory	*/
8708c2ecf20Sopenharmony_ci		ln_ae:	1,  /*	  61: protection violation	*/
8718c2ecf20Sopenharmony_ci		ln_werr:1,  /*	  60: write access error	*/
8728c2ecf20Sopenharmony_ci		ln_aerr:1,  /*	  59: sn0net: Address error	*/
8738c2ecf20Sopenharmony_ci		ln_perr:1,  /*	  58: sn0net: poison error	*/
8748c2ecf20Sopenharmony_ci		timeout:1,  /*	  57: CRB timed out		*/
8758c2ecf20Sopenharmony_ci		l_bdpkt:1,  /*	  56: truncated pkt on sn0net	*/
8768c2ecf20Sopenharmony_ci		c_bdpkt:1,  /*	  55: truncated pkt on xtalk	*/
8778c2ecf20Sopenharmony_ci		c_err:	1,  /*	  54: incoming xtalk req, err set*/
8788c2ecf20Sopenharmony_ci		rsvd1: 12,  /* 53-42: reserved			*/
8798c2ecf20Sopenharmony_ci		valid:	1,  /*	  41: Valid status		*/
8808c2ecf20Sopenharmony_ci		sidn:	4,  /* 40-37: SIDN field of xtalk rqst	*/
8818c2ecf20Sopenharmony_ci		tnum:	5,  /* 36-32: TNUM of xtalk request	*/
8828c2ecf20Sopenharmony_ci		bo:	1,  /*	  31: barrier op set in xtalk rqst*/
8838c2ecf20Sopenharmony_ci		resprqd:1,  /*	  30: xtalk rqst requires response*/
8848c2ecf20Sopenharmony_ci		gbr:	1,  /*	  29: gbr bit set in xtalk rqst */
8858c2ecf20Sopenharmony_ci		size:	2,  /* 28-27: size of xtalk request	*/
8868c2ecf20Sopenharmony_ci		excl:	4,  /* 26-23: exclusive bit(s)		*/
8878c2ecf20Sopenharmony_ci		stall:	3,  /* 22-20: stall (xtalk, bte 0/1)	*/
8888c2ecf20Sopenharmony_ci		intvn:	1,  /*	  19: rqst target of intervention*/
8898c2ecf20Sopenharmony_ci		resp:	1,  /*	  18: Data response given to t5 */
8908c2ecf20Sopenharmony_ci		ack:	1,  /*	  17: Data ack received.	*/
8918c2ecf20Sopenharmony_ci		hold:	1,  /*	  16: crb gathering invalidate acks*/
8928c2ecf20Sopenharmony_ci		wb:	1,  /*	  15: writeback pending.	*/
8938c2ecf20Sopenharmony_ci		ack_cnt:11, /* 14-04: counter of invalidate acks*/
8948c2ecf20Sopenharmony_ci		tscaler:4;  /* 03-00: Timeout prescaler		*/
8958c2ecf20Sopenharmony_ci	} ip_fmt;
8968c2ecf20Sopenharmony_ci} icrbp_a_t;
8978c2ecf20Sopenharmony_ci
8988c2ecf20Sopenharmony_ci#endif /* !__ASSEMBLY__ */
8998c2ecf20Sopenharmony_ci
9008c2ecf20Sopenharmony_ci/*
9018c2ecf20Sopenharmony_ci * A couple of defines to go with the above structure.
9028c2ecf20Sopenharmony_ci */
9038c2ecf20Sopenharmony_ci#define ICRBP_A_CERR_SHFT	54
9048c2ecf20Sopenharmony_ci#define ICRBP_A_ERR_MASK	0x3ff
9058c2ecf20Sopenharmony_ci
9068c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
9078c2ecf20Sopenharmony_citypedef union hubii_idsr {
9088c2ecf20Sopenharmony_ci	u64 iin_reg;
9098c2ecf20Sopenharmony_ci	struct {
9108c2ecf20Sopenharmony_ci		u64 rsvd1 : 35,
9118c2ecf20Sopenharmony_ci		    isent : 1,
9128c2ecf20Sopenharmony_ci		    rsvd2 : 3,
9138c2ecf20Sopenharmony_ci		    ienable: 1,
9148c2ecf20Sopenharmony_ci		    rsvd  : 7,
9158c2ecf20Sopenharmony_ci		    node  : 9,
9168c2ecf20Sopenharmony_ci		    rsvd4 : 1,
9178c2ecf20Sopenharmony_ci		    level : 7;
9188c2ecf20Sopenharmony_ci	} iin_fmt;
9198c2ecf20Sopenharmony_ci} hubii_idsr_t;
9208c2ecf20Sopenharmony_ci#endif /* !__ASSEMBLY__ */
9218c2ecf20Sopenharmony_ci
9228c2ecf20Sopenharmony_ci/*
9238c2ecf20Sopenharmony_ci * IO BTE Length/Status (IIO_IBLS) register bit field definitions
9248c2ecf20Sopenharmony_ci */
9258c2ecf20Sopenharmony_ci#define IBLS_BUSY		(0x1 << 20)
9268c2ecf20Sopenharmony_ci#define IBLS_ERROR_SHFT		16
9278c2ecf20Sopenharmony_ci#define IBLS_ERROR		(0x1 << IBLS_ERROR_SHFT)
9288c2ecf20Sopenharmony_ci#define IBLS_LENGTH_MASK	0xffff
9298c2ecf20Sopenharmony_ci
9308c2ecf20Sopenharmony_ci/*
9318c2ecf20Sopenharmony_ci * IO BTE Control/Terminate register (IBCT) register bit field definitions
9328c2ecf20Sopenharmony_ci */
9338c2ecf20Sopenharmony_ci#define IBCT_POISON		(0x1 << 8)
9348c2ecf20Sopenharmony_ci#define IBCT_NOTIFY		(0x1 << 4)
9358c2ecf20Sopenharmony_ci#define IBCT_ZFIL_MODE		(0x1 << 0)
9368c2ecf20Sopenharmony_ci
9378c2ecf20Sopenharmony_ci/*
9388c2ecf20Sopenharmony_ci * IO BTE Interrupt Address Register (IBIA) register bit field definitions
9398c2ecf20Sopenharmony_ci */
9408c2ecf20Sopenharmony_ci#define IBIA_LEVEL_SHFT		16
9418c2ecf20Sopenharmony_ci#define IBIA_LEVEL_MASK		(0x7f << IBIA_LEVEL_SHFT)
9428c2ecf20Sopenharmony_ci#define IBIA_NODE_ID_SHFT	0
9438c2ecf20Sopenharmony_ci#define IBIA_NODE_ID_MASK	(0x1ff)
9448c2ecf20Sopenharmony_ci
9458c2ecf20Sopenharmony_ci/*
9468c2ecf20Sopenharmony_ci * Miscellaneous hub constants
9478c2ecf20Sopenharmony_ci */
9488c2ecf20Sopenharmony_ci
9498c2ecf20Sopenharmony_ci/* Number of widgets supported by hub */
9508c2ecf20Sopenharmony_ci#define HUB_NUM_WIDGET		9
9518c2ecf20Sopenharmony_ci#define HUB_WIDGET_ID_MIN	0x8
9528c2ecf20Sopenharmony_ci#define HUB_WIDGET_ID_MAX	0xf
9538c2ecf20Sopenharmony_ci
9548c2ecf20Sopenharmony_ci#define HUB_WIDGET_PART_NUM	0xc101
9558c2ecf20Sopenharmony_ci#define MAX_HUBS_PER_XBOW	2
9568c2ecf20Sopenharmony_ci
9578c2ecf20Sopenharmony_ci/*
9588c2ecf20Sopenharmony_ci * Get a hub's widget id from widget control register
9598c2ecf20Sopenharmony_ci */
9608c2ecf20Sopenharmony_ci#define IIO_WCR_WID_GET(nasid)	(REMOTE_HUB_L(nasid, III_WCR) & 0xf)
9618c2ecf20Sopenharmony_ci#define IIO_WST_ERROR_MASK	(UINT64_CAST 1 << 32) /* Widget status error */
9628c2ecf20Sopenharmony_ci
9638c2ecf20Sopenharmony_ci/*
9648c2ecf20Sopenharmony_ci * Number of credits Hub widget has while sending req/response to
9658c2ecf20Sopenharmony_ci * xbow.
9668c2ecf20Sopenharmony_ci * Value of 3 is required by Xbow 1.1
9678c2ecf20Sopenharmony_ci * We may be able to increase this to 4 with Xbow 1.2.
9688c2ecf20Sopenharmony_ci */
9698c2ecf20Sopenharmony_ci#define	      HUBII_XBOW_CREDIT	      3
9708c2ecf20Sopenharmony_ci#define	      HUBII_XBOW_REV2_CREDIT  4
9718c2ecf20Sopenharmony_ci
9728c2ecf20Sopenharmony_ci#endif /* _ASM_SGI_SN_SN0_HUBIO_H */
973