1384740dcSRalf Baechle /* 2384740dcSRalf Baechle * This file is subject to the terms and conditions of the GNU General Public 3384740dcSRalf Baechle * License. See the file "COPYING" in the main directory of this archive 4384740dcSRalf Baechle * for more details. 5384740dcSRalf Baechle * 6384740dcSRalf Baechle * Derived from IRIX <sys/SN/SN0/hubio.h>, Revision 1.80. 7384740dcSRalf Baechle * 8384740dcSRalf Baechle * Copyright (C) 1992 - 1997, 1999 Silicon Graphics, Inc. 9384740dcSRalf Baechle * Copyright (C) 1999 by Ralf Baechle 10384740dcSRalf Baechle */ 11384740dcSRalf Baechle #ifndef _ASM_SGI_SN_SN0_HUBIO_H 12384740dcSRalf Baechle #define _ASM_SGI_SN_SN0_HUBIO_H 13384740dcSRalf Baechle 14384740dcSRalf Baechle /* 15384740dcSRalf Baechle * Hub I/O interface registers 16384740dcSRalf Baechle * 17384740dcSRalf Baechle * All registers in this file are subject to change until Hub chip tapeout. 18384740dcSRalf Baechle * In general, the longer software name should be used when available. 19384740dcSRalf Baechle */ 20384740dcSRalf Baechle 21384740dcSRalf Baechle /* 22384740dcSRalf Baechle * Slightly friendlier names for some common registers. 23384740dcSRalf Baechle * The hardware definitions follow. 24384740dcSRalf Baechle */ 25384740dcSRalf Baechle #define IIO_WIDGET IIO_WID /* Widget identification */ 26384740dcSRalf Baechle #define IIO_WIDGET_STAT IIO_WSTAT /* Widget status register */ 27384740dcSRalf Baechle #define IIO_WIDGET_CTRL IIO_WCR /* Widget control register */ 28384740dcSRalf Baechle #define IIO_WIDGET_TOUT IIO_WRTO /* Widget request timeout */ 29384740dcSRalf Baechle #define IIO_WIDGET_FLUSH IIO_WTFR /* Widget target flush */ 30384740dcSRalf Baechle #define IIO_PROTECT IIO_ILAPR /* IO interface protection */ 31384740dcSRalf Baechle #define IIO_PROTECT_OVRRD IIO_ILAPO /* IO protect override */ 32384740dcSRalf Baechle #define IIO_OUTWIDGET_ACCESS IIO_IOWA /* Outbound widget access */ 33384740dcSRalf Baechle #define IIO_INWIDGET_ACCESS IIO_IIWA /* Inbound widget access */ 34384740dcSRalf Baechle #define IIO_INDEV_ERR_MASK IIO_IIDEM /* Inbound device error mask */ 35384740dcSRalf Baechle #define IIO_LLP_CSR IIO_ILCSR /* LLP control and status */ 36384740dcSRalf Baechle #define IIO_LLP_LOG IIO_ILLR /* LLP log */ 37384740dcSRalf Baechle #define IIO_XTALKCC_TOUT IIO_IXCC /* Xtalk credit count timeout*/ 38384740dcSRalf Baechle #define IIO_XTALKTT_TOUT IIO_IXTT /* Xtalk tail timeout */ 39384740dcSRalf Baechle #define IIO_IO_ERR_CLR IIO_IECLR /* IO error clear */ 40384740dcSRalf Baechle #define IIO_BTE_CRB_CNT IIO_IBCN /* IO BTE CRB count */ 41384740dcSRalf Baechle 42384740dcSRalf Baechle #define IIO_LLP_CSR_IS_UP 0x00002000 43384740dcSRalf Baechle #define IIO_LLP_CSR_LLP_STAT_MASK 0x00003000 44384740dcSRalf Baechle #define IIO_LLP_CSR_LLP_STAT_SHFT 12 45384740dcSRalf Baechle 46384740dcSRalf Baechle /* key to IIO_PROTECT_OVRRD */ 47384740dcSRalf Baechle #define IIO_PROTECT_OVRRD_KEY 0x53474972756c6573ull /* "SGIrules" */ 48384740dcSRalf Baechle 49384740dcSRalf Baechle /* BTE register names */ 50384740dcSRalf Baechle #define IIO_BTE_STAT_0 IIO_IBLS_0 /* Also BTE length/status 0 */ 51384740dcSRalf Baechle #define IIO_BTE_SRC_0 IIO_IBSA_0 /* Also BTE source address 0 */ 52384740dcSRalf Baechle #define IIO_BTE_DEST_0 IIO_IBDA_0 /* Also BTE dest. address 0 */ 53384740dcSRalf Baechle #define IIO_BTE_CTRL_0 IIO_IBCT_0 /* Also BTE control/terminate 0 */ 54384740dcSRalf Baechle #define IIO_BTE_NOTIFY_0 IIO_IBNA_0 /* Also BTE notification 0 */ 55384740dcSRalf Baechle #define IIO_BTE_INT_0 IIO_IBIA_0 /* Also BTE interrupt 0 */ 56384740dcSRalf Baechle #define IIO_BTE_OFF_0 0 /* Base offset from BTE 0 regs. */ 57384740dcSRalf Baechle #define IIO_BTE_OFF_1 IIO_IBLS_1 - IIO_IBLS_0 /* Offset from base to BTE 1 */ 58384740dcSRalf Baechle 59384740dcSRalf Baechle /* BTE register offsets from base */ 60384740dcSRalf Baechle #define BTEOFF_STAT 0 61384740dcSRalf Baechle #define BTEOFF_SRC (IIO_BTE_SRC_0 - IIO_BTE_STAT_0) 62384740dcSRalf Baechle #define BTEOFF_DEST (IIO_BTE_DEST_0 - IIO_BTE_STAT_0) 63384740dcSRalf Baechle #define BTEOFF_CTRL (IIO_BTE_CTRL_0 - IIO_BTE_STAT_0) 64384740dcSRalf Baechle #define BTEOFF_NOTIFY (IIO_BTE_NOTIFY_0 - IIO_BTE_STAT_0) 65384740dcSRalf Baechle #define BTEOFF_INT (IIO_BTE_INT_0 - IIO_BTE_STAT_0) 66384740dcSRalf Baechle 67384740dcSRalf Baechle 68384740dcSRalf Baechle /* 69384740dcSRalf Baechle * The following definitions use the names defined in the IO interface 70384740dcSRalf Baechle * document for ease of reference. When possible, software should 71384740dcSRalf Baechle * generally use the longer but clearer names defined above. 72384740dcSRalf Baechle */ 73384740dcSRalf Baechle 74384740dcSRalf Baechle #define IIO_BASE 0x400000 75384740dcSRalf Baechle #define IIO_BASE_BTE0 0x410000 76384740dcSRalf Baechle #define IIO_BASE_BTE1 0x420000 77384740dcSRalf Baechle #define IIO_BASE_PERF 0x430000 78384740dcSRalf Baechle #define IIO_PERF_CNT 0x430008 79384740dcSRalf Baechle 80384740dcSRalf Baechle #define IO_PERF_SETS 32 81384740dcSRalf Baechle 82384740dcSRalf Baechle #define IIO_WID 0x400000 /* Widget identification */ 83384740dcSRalf Baechle #define IIO_WSTAT 0x400008 /* Widget status */ 84384740dcSRalf Baechle #define IIO_WCR 0x400020 /* Widget control */ 85384740dcSRalf Baechle 86384740dcSRalf Baechle #define IIO_WSTAT_ECRAZY (1ULL << 32) /* Hub gone crazy */ 87384740dcSRalf Baechle #define IIO_WSTAT_TXRETRY (1ULL << 9) /* Hub Tx Retry timeout */ 88384740dcSRalf Baechle #define IIO_WSTAT_TXRETRY_MASK (0x7F) 89384740dcSRalf Baechle #define IIO_WSTAT_TXRETRY_SHFT (16) 90384740dcSRalf Baechle #define IIO_WSTAT_TXRETRY_CNT(w) (((w) >> IIO_WSTAT_TXRETRY_SHFT) & \ 91384740dcSRalf Baechle IIO_WSTAT_TXRETRY_MASK) 92384740dcSRalf Baechle 93384740dcSRalf Baechle #define IIO_ILAPR 0x400100 /* Local Access Protection */ 94384740dcSRalf Baechle #define IIO_ILAPO 0x400108 /* Protection override */ 95384740dcSRalf Baechle #define IIO_IOWA 0x400110 /* outbound widget access */ 96384740dcSRalf Baechle #define IIO_IIWA 0x400118 /* inbound widget access */ 97384740dcSRalf Baechle #define IIO_IIDEM 0x400120 /* Inbound Device Error Mask */ 98384740dcSRalf Baechle #define IIO_ILCSR 0x400128 /* LLP control and status */ 99384740dcSRalf Baechle #define IIO_ILLR 0x400130 /* LLP Log */ 100384740dcSRalf Baechle #define IIO_IIDSR 0x400138 /* Interrupt destination */ 101384740dcSRalf Baechle 102384740dcSRalf Baechle #define IIO_IIBUSERR 0x1400208 /* Reads here cause a bus error. */ 103384740dcSRalf Baechle 104384740dcSRalf Baechle /* IO Interrupt Destination Register */ 105384740dcSRalf Baechle #define IIO_IIDSR_SENT_SHIFT 28 106384740dcSRalf Baechle #define IIO_IIDSR_SENT_MASK 0x10000000 107384740dcSRalf Baechle #define IIO_IIDSR_ENB_SHIFT 24 108384740dcSRalf Baechle #define IIO_IIDSR_ENB_MASK 0x01000000 109384740dcSRalf Baechle #define IIO_IIDSR_NODE_SHIFT 8 110384740dcSRalf Baechle #define IIO_IIDSR_NODE_MASK 0x0000ff00 111384740dcSRalf Baechle #define IIO_IIDSR_LVL_SHIFT 0 112384740dcSRalf Baechle #define IIO_IIDSR_LVL_MASK 0x0000003f 113384740dcSRalf Baechle 114384740dcSRalf Baechle 115384740dcSRalf Baechle /* GFX Flow Control Node/Widget Register */ 116384740dcSRalf Baechle #define IIO_IGFX_0 0x400140 /* gfx node/widget register 0 */ 117384740dcSRalf Baechle #define IIO_IGFX_1 0x400148 /* gfx node/widget register 1 */ 118384740dcSRalf Baechle #define IIO_IGFX_W_NUM_BITS 4 /* size of widget num field */ 119384740dcSRalf Baechle #define IIO_IGFX_W_NUM_MASK ((1<<IIO_IGFX_W_NUM_BITS)-1) 120384740dcSRalf Baechle #define IIO_IGFX_W_NUM_SHIFT 0 121384740dcSRalf Baechle #define IIO_IGFX_N_NUM_BITS 9 /* size of node num field */ 122384740dcSRalf Baechle #define IIO_IGFX_N_NUM_MASK ((1<<IIO_IGFX_N_NUM_BITS)-1) 123384740dcSRalf Baechle #define IIO_IGFX_N_NUM_SHIFT 4 124384740dcSRalf Baechle #define IIO_IGFX_P_NUM_BITS 1 /* size of processor num field */ 125384740dcSRalf Baechle #define IIO_IGFX_P_NUM_MASK ((1<<IIO_IGFX_P_NUM_BITS)-1) 126384740dcSRalf Baechle #define IIO_IGFX_P_NUM_SHIFT 16 127384740dcSRalf Baechle #define IIO_IGFX_VLD_BITS 1 /* size of valid field */ 128384740dcSRalf Baechle #define IIO_IGFX_VLD_MASK ((1<<IIO_IGFX_VLD_BITS)-1) 129384740dcSRalf Baechle #define IIO_IGFX_VLD_SHIFT 20 130384740dcSRalf Baechle #define IIO_IGFX_INIT(widget, node, cpu, valid) (\ 131384740dcSRalf Baechle (((widget) & IIO_IGFX_W_NUM_MASK) << IIO_IGFX_W_NUM_SHIFT) | \ 132384740dcSRalf Baechle (((node) & IIO_IGFX_N_NUM_MASK) << IIO_IGFX_N_NUM_SHIFT) | \ 133384740dcSRalf Baechle (((cpu) & IIO_IGFX_P_NUM_MASK) << IIO_IGFX_P_NUM_SHIFT) | \ 134384740dcSRalf Baechle (((valid) & IIO_IGFX_VLD_MASK) << IIO_IGFX_VLD_SHIFT) ) 135384740dcSRalf Baechle 136384740dcSRalf Baechle /* Scratch registers (not all bits available) */ 137384740dcSRalf Baechle #define IIO_SCRATCH_REG0 0x400150 138384740dcSRalf Baechle #define IIO_SCRATCH_REG1 0x400158 139384740dcSRalf Baechle #define IIO_SCRATCH_MASK 0x0000000f00f11fff 140384740dcSRalf Baechle 141384740dcSRalf Baechle #define IIO_SCRATCH_BIT0_0 0x0000000800000000 142384740dcSRalf Baechle #define IIO_SCRATCH_BIT0_1 0x0000000400000000 143384740dcSRalf Baechle #define IIO_SCRATCH_BIT0_2 0x0000000200000000 144384740dcSRalf Baechle #define IIO_SCRATCH_BIT0_3 0x0000000100000000 145384740dcSRalf Baechle #define IIO_SCRATCH_BIT0_4 0x0000000000800000 146384740dcSRalf Baechle #define IIO_SCRATCH_BIT0_5 0x0000000000400000 147384740dcSRalf Baechle #define IIO_SCRATCH_BIT0_6 0x0000000000200000 148384740dcSRalf Baechle #define IIO_SCRATCH_BIT0_7 0x0000000000100000 149384740dcSRalf Baechle #define IIO_SCRATCH_BIT0_8 0x0000000000010000 150384740dcSRalf Baechle #define IIO_SCRATCH_BIT0_9 0x0000000000001000 151384740dcSRalf Baechle #define IIO_SCRATCH_BIT0_R 0x0000000000000fff 152384740dcSRalf Baechle 153384740dcSRalf Baechle /* IO Translation Table Entries */ 154384740dcSRalf Baechle #define IIO_NUM_ITTES 7 /* ITTEs numbered 0..6 */ 155384740dcSRalf Baechle /* Hw manuals number them 1..7! */ 156384740dcSRalf Baechle 157384740dcSRalf Baechle /* 158384740dcSRalf Baechle * As a permanent workaround for a bug in the PI side of the hub, we've 159384740dcSRalf Baechle * redefined big window 7 as small window 0. 160384740dcSRalf Baechle */ 161384740dcSRalf Baechle #define HUB_NUM_BIG_WINDOW IIO_NUM_ITTES - 1 162384740dcSRalf Baechle 163384740dcSRalf Baechle /* 164384740dcSRalf Baechle * Use the top big window as a surrogate for the first small window 165384740dcSRalf Baechle */ 166384740dcSRalf Baechle #define SWIN0_BIGWIN HUB_NUM_BIG_WINDOW 167384740dcSRalf Baechle 168384740dcSRalf Baechle #define ILCSR_WARM_RESET 0x100 169384740dcSRalf Baechle /* 170384740dcSRalf Baechle * The IO LLP control status register and widget control register 171384740dcSRalf Baechle */ 172384740dcSRalf Baechle #ifndef __ASSEMBLY__ 173384740dcSRalf Baechle 174384740dcSRalf Baechle typedef union hubii_wid_u { 175384740dcSRalf Baechle u64 wid_reg_value; 176384740dcSRalf Baechle struct { 177384740dcSRalf Baechle u64 wid_rsvd: 32, /* unused */ 178384740dcSRalf Baechle wid_rev_num: 4, /* revision number */ 179384740dcSRalf Baechle wid_part_num: 16, /* the widget type: hub=c101 */ 180384740dcSRalf Baechle wid_mfg_num: 11, /* Manufacturer id (IBM) */ 181384740dcSRalf Baechle wid_rsvd1: 1; /* Reserved */ 182384740dcSRalf Baechle } wid_fields_s; 183384740dcSRalf Baechle } hubii_wid_t; 184384740dcSRalf Baechle 185384740dcSRalf Baechle 186384740dcSRalf Baechle typedef union hubii_wcr_u { 187384740dcSRalf Baechle u64 wcr_reg_value; 188384740dcSRalf Baechle struct { 189384740dcSRalf Baechle u64 wcr_rsvd: 41, /* unused */ 190384740dcSRalf Baechle wcr_e_thresh: 5, /* elasticity threshold */ 191384740dcSRalf Baechle wcr_dir_con: 1, /* widget direct connect */ 192384740dcSRalf Baechle wcr_f_bad_pkt: 1, /* Force bad llp pkt enable */ 193384740dcSRalf Baechle wcr_xbar_crd: 3, /* LLP crossbar credit */ 194384740dcSRalf Baechle wcr_rsvd1: 8, /* Reserved */ 195384740dcSRalf Baechle wcr_tag_mode: 1, /* Tag mode */ 196384740dcSRalf Baechle wcr_widget_id: 4; /* LLP crossbar credit */ 197384740dcSRalf Baechle } wcr_fields_s; 198384740dcSRalf Baechle } hubii_wcr_t; 199384740dcSRalf Baechle 200384740dcSRalf Baechle #define iwcr_dir_con wcr_fields_s.wcr_dir_con 201384740dcSRalf Baechle 202384740dcSRalf Baechle typedef union hubii_wstat_u { 203384740dcSRalf Baechle u64 reg_value; 204384740dcSRalf Baechle struct { 205384740dcSRalf Baechle u64 rsvd1: 31, 206384740dcSRalf Baechle crazy: 1, /* Crazy bit */ 207384740dcSRalf Baechle rsvd2: 8, 208384740dcSRalf Baechle llp_tx_cnt: 8, /* LLP Xmit retry counter */ 209384740dcSRalf Baechle rsvd3: 6, 210384740dcSRalf Baechle tx_max_rtry: 1, /* LLP Retry Timeout Signal */ 211384740dcSRalf Baechle rsvd4: 2, 212384740dcSRalf Baechle xt_tail_to: 1, /* Xtalk Tail Timeout */ 213384740dcSRalf Baechle xt_crd_to: 1, /* Xtalk Credit Timeout */ 214384740dcSRalf Baechle pending: 4; /* Pending Requests */ 215384740dcSRalf Baechle } wstat_fields_s; 216384740dcSRalf Baechle } hubii_wstat_t; 217384740dcSRalf Baechle 218384740dcSRalf Baechle 219384740dcSRalf Baechle typedef union hubii_ilcsr_u { 220384740dcSRalf Baechle u64 icsr_reg_value; 221384740dcSRalf Baechle struct { 222384740dcSRalf Baechle u64 icsr_rsvd: 22, /* unused */ 223384740dcSRalf Baechle icsr_max_burst: 10, /* max burst */ 224384740dcSRalf Baechle icsr_rsvd4: 6, /* reserved */ 225384740dcSRalf Baechle icsr_max_retry: 10, /* max retry */ 226384740dcSRalf Baechle icsr_rsvd3: 2, /* reserved */ 227384740dcSRalf Baechle icsr_lnk_stat: 2, /* link status */ 228384740dcSRalf Baechle icsr_bm8: 1, /* Bit mode 8 */ 229384740dcSRalf Baechle icsr_llp_en: 1, /* LLP enable bit */ 230384740dcSRalf Baechle icsr_rsvd2: 1, /* reserver */ 231384740dcSRalf Baechle icsr_wrm_reset: 1, /* Warm reset bit */ 232384740dcSRalf Baechle icsr_rsvd1: 2, /* Data ready offset */ 233384740dcSRalf Baechle icsr_null_to: 6; /* Null timeout */ 234384740dcSRalf Baechle 235384740dcSRalf Baechle } icsr_fields_s; 236384740dcSRalf Baechle } hubii_ilcsr_t; 237384740dcSRalf Baechle 238384740dcSRalf Baechle 239384740dcSRalf Baechle typedef union hubii_iowa_u { 240384740dcSRalf Baechle u64 iowa_reg_value; 241384740dcSRalf Baechle struct { 242384740dcSRalf Baechle u64 iowa_rsvd: 48, /* unused */ 243384740dcSRalf Baechle iowa_wxoac: 8, /* xtalk widget access bits */ 244384740dcSRalf Baechle iowa_rsvd1: 7, /* xtalk widget access bits */ 245384740dcSRalf Baechle iowa_w0oac: 1; /* xtalk widget access bits */ 246384740dcSRalf Baechle } iowa_fields_s; 247384740dcSRalf Baechle } hubii_iowa_t; 248384740dcSRalf Baechle 249384740dcSRalf Baechle typedef union hubii_iiwa_u { 250384740dcSRalf Baechle u64 iiwa_reg_value; 251384740dcSRalf Baechle struct { 252384740dcSRalf Baechle u64 iiwa_rsvd: 48, /* unused */ 253384740dcSRalf Baechle iiwa_wxiac: 8, /* hub wid access bits */ 254384740dcSRalf Baechle iiwa_rsvd1: 7, /* reserved */ 255384740dcSRalf Baechle iiwa_w0iac: 1; /* hub wid0 access */ 256384740dcSRalf Baechle } iiwa_fields_s; 257384740dcSRalf Baechle } hubii_iiwa_t; 258384740dcSRalf Baechle 259384740dcSRalf Baechle typedef union hubii_illr_u { 260384740dcSRalf Baechle u64 illr_reg_value; 261384740dcSRalf Baechle struct { 262384740dcSRalf Baechle u64 illr_rsvd: 32, /* unused */ 263384740dcSRalf Baechle illr_cb_cnt: 16, /* checkbit error count */ 264384740dcSRalf Baechle illr_sn_cnt: 16; /* sequence number count */ 265384740dcSRalf Baechle } illr_fields_s; 266384740dcSRalf Baechle } hubii_illr_t; 267384740dcSRalf Baechle 268384740dcSRalf Baechle /* The structures below are defined to extract and modify the ii 269384740dcSRalf Baechle performance registers */ 270384740dcSRalf Baechle 271384740dcSRalf Baechle /* io_perf_sel allows the caller to specify what tests will be 272384740dcSRalf Baechle performed */ 273384740dcSRalf Baechle typedef union io_perf_sel { 274384740dcSRalf Baechle u64 perf_sel_reg; 275384740dcSRalf Baechle struct { 276384740dcSRalf Baechle u64 perf_rsvd : 48, 277384740dcSRalf Baechle perf_icct : 8, 278384740dcSRalf Baechle perf_ippr1 : 4, 279384740dcSRalf Baechle perf_ippr0 : 4; 280384740dcSRalf Baechle } perf_sel_bits; 281384740dcSRalf Baechle } io_perf_sel_t; 282384740dcSRalf Baechle 283384740dcSRalf Baechle /* io_perf_cnt is to extract the count from the hub registers. Due to 284384740dcSRalf Baechle hardware problems there is only one counter, not two. */ 285384740dcSRalf Baechle 286384740dcSRalf Baechle typedef union io_perf_cnt { 287384740dcSRalf Baechle u64 perf_cnt; 288384740dcSRalf Baechle struct { 289384740dcSRalf Baechle u64 perf_rsvd1 : 32, 290384740dcSRalf Baechle perf_rsvd2 : 12, 291384740dcSRalf Baechle perf_cnt : 20; 292384740dcSRalf Baechle } perf_cnt_bits; 293384740dcSRalf Baechle } io_perf_cnt_t; 294384740dcSRalf Baechle 295384740dcSRalf Baechle #endif /* !__ASSEMBLY__ */ 296384740dcSRalf Baechle 297384740dcSRalf Baechle 298384740dcSRalf Baechle #define LNK_STAT_WORKING 0x2 299384740dcSRalf Baechle 300384740dcSRalf Baechle #define IIO_LLP_CB_MAX 0xffff 301384740dcSRalf Baechle #define IIO_LLP_SN_MAX 0xffff 302384740dcSRalf Baechle 303384740dcSRalf Baechle /* IO PRB Entries */ 304384740dcSRalf Baechle #define IIO_NUM_IPRBS (9) 305384740dcSRalf Baechle #define IIO_IOPRB_0 0x400198 /* PRB entry 0 */ 306384740dcSRalf Baechle #define IIO_IOPRB_8 0x4001a0 /* PRB entry 8 */ 307384740dcSRalf Baechle #define IIO_IOPRB_9 0x4001a8 /* PRB entry 9 */ 308384740dcSRalf Baechle #define IIO_IOPRB_A 0x4001b0 /* PRB entry a */ 309384740dcSRalf Baechle #define IIO_IOPRB_B 0x4001b8 /* PRB entry b */ 310384740dcSRalf Baechle #define IIO_IOPRB_C 0x4001c0 /* PRB entry c */ 311384740dcSRalf Baechle #define IIO_IOPRB_D 0x4001c8 /* PRB entry d */ 312384740dcSRalf Baechle #define IIO_IOPRB_E 0x4001d0 /* PRB entry e */ 313384740dcSRalf Baechle #define IIO_IOPRB_F 0x4001d8 /* PRB entry f */ 314384740dcSRalf Baechle 315384740dcSRalf Baechle 316384740dcSRalf Baechle #define IIO_IXCC 0x4001e0 /* Crosstalk credit count timeout */ 317384740dcSRalf Baechle #define IIO_IXTCC IIO_IXCC 318384740dcSRalf Baechle #define IIO_IMEM 0x4001e8 /* Miscellaneous Enable Mask */ 319384740dcSRalf Baechle #define IIO_IXTT 0x4001f0 /* Crosstalk tail timeout */ 320384740dcSRalf Baechle #define IIO_IECLR 0x4001f8 /* IO error clear */ 321384740dcSRalf Baechle #define IIO_IBCN 0x400200 /* IO BTE CRB count */ 322384740dcSRalf Baechle 323384740dcSRalf Baechle /* 324384740dcSRalf Baechle * IIO_IMEM Register fields. 325384740dcSRalf Baechle */ 326384740dcSRalf Baechle #define IIO_IMEM_W0ESD 0x1 /* Widget 0 shut down due to error */ 327384740dcSRalf Baechle #define IIO_IMEM_B0ESD (1 << 4) /* BTE 0 shut down due to error */ 328384740dcSRalf Baechle #define IIO_IMEM_B1ESD (1 << 8) /* BTE 1 Shut down due to error */ 329384740dcSRalf Baechle 330384740dcSRalf Baechle /* PIO Read address Table Entries */ 331384740dcSRalf Baechle #define IIO_IPCA 0x400300 /* PRB Counter adjust */ 332384740dcSRalf Baechle #define IIO_NUM_PRTES 8 /* Total number of PRB table entries */ 333384740dcSRalf Baechle #define IIO_PRTE_0 0x400308 /* PIO Read address table entry 0 */ 334384740dcSRalf Baechle #define IIO_PRTE(_x) (IIO_PRTE_0 + (8 * (_x))) 335384740dcSRalf Baechle #define IIO_WIDPRTE(x) IIO_PRTE(((x) - 8)) /* widget ID to its PRTE num */ 336384740dcSRalf Baechle #define IIO_IPDR 0x400388 /* PIO table entry deallocation */ 337384740dcSRalf Baechle #define IIO_ICDR 0x400390 /* CRB Entry Deallocation */ 338384740dcSRalf Baechle #define IIO_IFDR 0x400398 /* IOQ FIFO Depth */ 339384740dcSRalf Baechle #define IIO_IIAP 0x4003a0 /* IIQ Arbitration Parameters */ 340384740dcSRalf Baechle #define IIO_IMMR IIO_IIAP 341384740dcSRalf Baechle #define IIO_ICMR 0x4003a8 /* CRB Management Register */ 342384740dcSRalf Baechle #define IIO_ICCR 0x4003b0 /* CRB Control Register */ 343384740dcSRalf Baechle #define IIO_ICTO 0x4003b8 /* CRB Time Out Register */ 344384740dcSRalf Baechle #define IIO_ICTP 0x4003c0 /* CRB Time Out Prescalar */ 345384740dcSRalf Baechle 346384740dcSRalf Baechle 347384740dcSRalf Baechle /* 348384740dcSRalf Baechle * ICMR register fields 349384740dcSRalf Baechle */ 350384740dcSRalf Baechle #define IIO_ICMR_PC_VLD_SHFT 36 351384740dcSRalf Baechle #define IIO_ICMR_PC_VLD_MASK (0x7fffUL << IIO_ICMR_PC_VLD_SHFT) 352384740dcSRalf Baechle 353384740dcSRalf Baechle #define IIO_ICMR_CRB_VLD_SHFT 20 354384740dcSRalf Baechle #define IIO_ICMR_CRB_VLD_MASK (0x7fffUL << IIO_ICMR_CRB_VLD_SHFT) 355384740dcSRalf Baechle 356384740dcSRalf Baechle #define IIO_ICMR_FC_CNT_SHFT 16 357384740dcSRalf Baechle #define IIO_ICMR_FC_CNT_MASK (0xf << IIO_ICMR_FC_CNT_SHFT) 358384740dcSRalf Baechle 359384740dcSRalf Baechle #define IIO_ICMR_C_CNT_SHFT 4 360384740dcSRalf Baechle #define IIO_ICMR_C_CNT_MASK (0xf << IIO_ICMR_C_CNT_SHFT) 361384740dcSRalf Baechle 362384740dcSRalf Baechle #define IIO_ICMR_P_CNT_SHFT 0 363384740dcSRalf Baechle #define IIO_ICMR_P_CNT_MASK (0xf << IIO_ICMR_P_CNT_SHFT) 364384740dcSRalf Baechle 365384740dcSRalf Baechle #define IIO_ICMR_PRECISE (1UL << 52) 366384740dcSRalf Baechle #define IIO_ICMR_CLR_RPPD (1UL << 13) 367384740dcSRalf Baechle #define IIO_ICMR_CLR_RQPD (1UL << 12) 368384740dcSRalf Baechle 369384740dcSRalf Baechle /* 370384740dcSRalf Baechle * IIO PIO Deallocation register field masks : (IIO_IPDR) 371384740dcSRalf Baechle */ 372384740dcSRalf Baechle #define IIO_IPDR_PND (1 << 4) 373384740dcSRalf Baechle 374384740dcSRalf Baechle /* 375384740dcSRalf Baechle * IIO CRB deallocation register field masks: (IIO_ICDR) 376384740dcSRalf Baechle */ 377384740dcSRalf Baechle #define IIO_ICDR_PND (1 << 4) 378384740dcSRalf Baechle 379384740dcSRalf Baechle /* 380384740dcSRalf Baechle * IIO CRB control register Fields: IIO_ICCR 381384740dcSRalf Baechle */ 382384740dcSRalf Baechle #define IIO_ICCR_PENDING (0x10000) 383384740dcSRalf Baechle #define IIO_ICCR_CMD_MASK (0xFF) 384384740dcSRalf Baechle #define IIO_ICCR_CMD_SHFT (7) 385384740dcSRalf Baechle #define IIO_ICCR_CMD_NOP (0x0) /* No Op */ 386384740dcSRalf Baechle #define IIO_ICCR_CMD_WAKE (0x100) /* Reactivate CRB entry and process */ 387384740dcSRalf Baechle #define IIO_ICCR_CMD_TIMEOUT (0x200) /* Make CRB timeout & mark invalid */ 388384740dcSRalf Baechle #define IIO_ICCR_CMD_EJECT (0x400) /* Contents of entry written to memory 389384740dcSRalf Baechle * via a WB 390384740dcSRalf Baechle */ 391384740dcSRalf Baechle #define IIO_ICCR_CMD_FLUSH (0x800) 392384740dcSRalf Baechle 393384740dcSRalf Baechle /* 394384740dcSRalf Baechle * CRB manipulation macros 395384740dcSRalf Baechle * The CRB macros are slightly complicated, since there are up to 396384740dcSRalf Baechle * four registers associated with each CRB entry. 397384740dcSRalf Baechle */ 398384740dcSRalf Baechle #define IIO_NUM_CRBS 15 /* Number of CRBs */ 399384740dcSRalf Baechle #define IIO_NUM_NORMAL_CRBS 12 /* Number of regular CRB entries */ 400384740dcSRalf Baechle #define IIO_NUM_PC_CRBS 4 /* Number of partial cache CRBs */ 401384740dcSRalf Baechle #define IIO_ICRB_OFFSET 8 402384740dcSRalf Baechle #define IIO_ICRB_0 0x400400 403384740dcSRalf Baechle /* XXX - This is now tuneable: 404384740dcSRalf Baechle #define IIO_FIRST_PC_ENTRY 12 405384740dcSRalf Baechle */ 406384740dcSRalf Baechle 407384740dcSRalf Baechle #define IIO_ICRB_A(_x) (IIO_ICRB_0 + (4 * IIO_ICRB_OFFSET * (_x))) 408384740dcSRalf Baechle #define IIO_ICRB_B(_x) (IIO_ICRB_A(_x) + 1*IIO_ICRB_OFFSET) 409384740dcSRalf Baechle #define IIO_ICRB_C(_x) (IIO_ICRB_A(_x) + 2*IIO_ICRB_OFFSET) 410384740dcSRalf Baechle #define IIO_ICRB_D(_x) (IIO_ICRB_A(_x) + 3*IIO_ICRB_OFFSET) 411384740dcSRalf Baechle 412384740dcSRalf Baechle /* XXX - IBUE register coming for Hub 2 */ 413384740dcSRalf Baechle 414384740dcSRalf Baechle /* 415384740dcSRalf Baechle * 416384740dcSRalf Baechle * CRB Register description. 417384740dcSRalf Baechle * 418384740dcSRalf Baechle * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING 419384740dcSRalf Baechle * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING 420384740dcSRalf Baechle * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING 421384740dcSRalf Baechle * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING 422384740dcSRalf Baechle * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING 423384740dcSRalf Baechle * 424384740dcSRalf Baechle * Many of the fields in CRB are status bits used by hardware 425384740dcSRalf Baechle * for implementation of the protocol. It's very dangerous to 426384740dcSRalf Baechle * mess around with the CRB registers. 427384740dcSRalf Baechle * 428384740dcSRalf Baechle * It's OK to read the CRB registers and try to make sense out of the 429384740dcSRalf Baechle * fields in CRB. 430384740dcSRalf Baechle * 431384740dcSRalf Baechle * Updating CRB requires all activities in Hub IIO to be quiesced. 432384740dcSRalf Baechle * otherwise, a write to CRB could corrupt other CRB entries. 433384740dcSRalf Baechle * CRBs are here only as a back door peek to hub IIO's status. 434384740dcSRalf Baechle * Quiescing implies no dmas no PIOs 435384740dcSRalf Baechle * either directly from the cpu or from sn0net. 436384740dcSRalf Baechle * this is not something that can be done easily. So, AVOID updating 437384740dcSRalf Baechle * CRBs. 438384740dcSRalf Baechle */ 439384740dcSRalf Baechle 440384740dcSRalf Baechle /* 441384740dcSRalf Baechle * Fields in CRB Register A 442384740dcSRalf Baechle */ 443384740dcSRalf Baechle #ifndef __ASSEMBLY__ 444384740dcSRalf Baechle typedef union icrba_u { 445384740dcSRalf Baechle u64 reg_value; 446384740dcSRalf Baechle struct { 447384740dcSRalf Baechle u64 resvd: 6, 448384740dcSRalf Baechle stall_bte0: 1, /* Stall BTE 0 */ 449384740dcSRalf Baechle stall_bte1: 1, /* Stall BTE 1 */ 450384740dcSRalf Baechle error: 1, /* CRB has an error */ 451384740dcSRalf Baechle ecode: 3, /* Error Code */ 452384740dcSRalf Baechle lnetuce: 1, /* SN0net Uncorrectable error */ 453384740dcSRalf Baechle mark: 1, /* CRB Has been marked */ 454384740dcSRalf Baechle xerr: 1, /* Error bit set in xtalk header */ 455384740dcSRalf Baechle sidn: 4, /* SIDN field from xtalk */ 456384740dcSRalf Baechle tnum: 5, /* TNUM field in xtalk */ 457384740dcSRalf Baechle addr: 38, /* Address of request */ 458384740dcSRalf Baechle valid: 1, /* Valid status */ 459384740dcSRalf Baechle iow: 1; /* IO Write operation */ 460384740dcSRalf Baechle } icrba_fields_s; 461384740dcSRalf Baechle } icrba_t; 462384740dcSRalf Baechle 463384740dcSRalf Baechle /* This is an alternate typedef for the HUB1 CRB A in order to allow 464384740dcSRalf Baechle runtime selection of the format based on the REV_ID field of the 465384740dcSRalf Baechle NI_STATUS_REV_ID register. */ 466384740dcSRalf Baechle typedef union h1_icrba_u { 467384740dcSRalf Baechle u64 reg_value; 468384740dcSRalf Baechle 469384740dcSRalf Baechle struct { 470384740dcSRalf Baechle u64 resvd: 6, 471384740dcSRalf Baechle unused: 1, /* Unused but RW!! */ 472384740dcSRalf Baechle error: 1, /* CRB has an error */ 473384740dcSRalf Baechle ecode: 4, /* Error Code */ 474384740dcSRalf Baechle lnetuce: 1, /* SN0net Uncorrectable error */ 475384740dcSRalf Baechle mark: 1, /* CRB Has been marked */ 476384740dcSRalf Baechle xerr: 1, /* Error bit set in xtalk header */ 477384740dcSRalf Baechle sidn: 4, /* SIDN field from xtalk */ 478384740dcSRalf Baechle tnum: 5, /* TNUM field in xtalk */ 479384740dcSRalf Baechle addr: 38, /* Address of request */ 480384740dcSRalf Baechle valid: 1, /* Valid status */ 481384740dcSRalf Baechle iow: 1; /* IO Write operation */ 482384740dcSRalf Baechle } h1_icrba_fields_s; 483384740dcSRalf Baechle } h1_icrba_t; 484384740dcSRalf Baechle 485384740dcSRalf Baechle /* XXX - Is this still right? Check the spec. */ 486384740dcSRalf Baechle #define ICRBN_A_CERR_SHFT 54 487384740dcSRalf Baechle #define ICRBN_A_ERR_MASK 0x3ff 488384740dcSRalf Baechle 489384740dcSRalf Baechle #endif /* !__ASSEMBLY__ */ 490384740dcSRalf Baechle 491384740dcSRalf Baechle #define IIO_ICRB_ADDR_SHFT 2 /* Shift to get proper address */ 492384740dcSRalf Baechle 493384740dcSRalf Baechle /* 494384740dcSRalf Baechle * values for "ecode" field 495384740dcSRalf Baechle */ 496384740dcSRalf Baechle #define IIO_ICRB_ECODE_DERR 0 /* Directory error due to IIO access */ 497384740dcSRalf Baechle #define IIO_ICRB_ECODE_PERR 1 /* Poison error on IO access */ 498384740dcSRalf Baechle #define IIO_ICRB_ECODE_WERR 2 /* Write error by IIO access 499384740dcSRalf Baechle * e.g. WINV to a Read only line. 500384740dcSRalf Baechle */ 501384740dcSRalf Baechle #define IIO_ICRB_ECODE_AERR 3 /* Access error caused by IIO access */ 502384740dcSRalf Baechle #define IIO_ICRB_ECODE_PWERR 4 /* Error on partial write */ 503384740dcSRalf Baechle #define IIO_ICRB_ECODE_PRERR 5 /* Error on partial read */ 504384740dcSRalf Baechle #define IIO_ICRB_ECODE_TOUT 6 /* CRB timeout before deallocating */ 505384740dcSRalf Baechle #define IIO_ICRB_ECODE_XTERR 7 /* Incoming xtalk pkt had error bit */ 506384740dcSRalf Baechle 507384740dcSRalf Baechle 508384740dcSRalf Baechle 509384740dcSRalf Baechle /* 510384740dcSRalf Baechle * Fields in CRB Register B 511384740dcSRalf Baechle */ 512384740dcSRalf Baechle #ifndef __ASSEMBLY__ 513384740dcSRalf Baechle typedef union icrbb_u { 514384740dcSRalf Baechle u64 reg_value; 515384740dcSRalf Baechle struct { 516384740dcSRalf Baechle u64 rsvd1: 5, 517384740dcSRalf Baechle btenum: 1, /* BTE to which entry belongs to */ 518384740dcSRalf Baechle cohtrans: 1, /* Coherent transaction */ 519384740dcSRalf Baechle xtsize: 2, /* Xtalk operation size 520384740dcSRalf Baechle * 0: Double Word 521384740dcSRalf Baechle * 1: 32 Bytes. 522384740dcSRalf Baechle * 2: 128 Bytes, 523384740dcSRalf Baechle * 3: Reserved. 524384740dcSRalf Baechle */ 525384740dcSRalf Baechle srcnode: 9, /* Source Node ID */ 526384740dcSRalf Baechle srcinit: 2, /* Source Initiator: 527384740dcSRalf Baechle * See below for field values. 528384740dcSRalf Baechle */ 529384740dcSRalf Baechle useold: 1, /* Use OLD command for processing */ 530384740dcSRalf Baechle imsgtype: 2, /* Incoming message type 531384740dcSRalf Baechle * see below for field values 532384740dcSRalf Baechle */ 533384740dcSRalf Baechle imsg: 8, /* Incoming message */ 534384740dcSRalf Baechle initator: 3, /* Initiator of original request 535384740dcSRalf Baechle * See below for field values. 536384740dcSRalf Baechle */ 537384740dcSRalf Baechle reqtype: 5, /* Identifies type of request 538384740dcSRalf Baechle * See below for field values. 539384740dcSRalf Baechle */ 540384740dcSRalf Baechle rsvd2: 7, 541384740dcSRalf Baechle ackcnt: 11, /* Invalidate ack count */ 542384740dcSRalf Baechle resp: 1, /* data response given to processor */ 543384740dcSRalf Baechle ack: 1, /* indicates data ack received */ 544384740dcSRalf Baechle hold: 1, /* entry is gathering inval acks */ 545384740dcSRalf Baechle wb_pend:1, /* waiting for writeback to complete */ 546384740dcSRalf Baechle intvn: 1, /* Intervention */ 547384740dcSRalf Baechle stall_ib: 1, /* Stall Ibuf (from crosstalk) */ 548384740dcSRalf Baechle stall_intr: 1; /* Stall internal interrupts */ 549384740dcSRalf Baechle } icrbb_field_s; 550384740dcSRalf Baechle } icrbb_t; 551384740dcSRalf Baechle 552384740dcSRalf Baechle /* This is an alternate typedef for the HUB1 CRB B in order to allow 553384740dcSRalf Baechle runtime selection of the format based on the REV_ID field of the 554384740dcSRalf Baechle NI_STATUS_REV_ID register. */ 555384740dcSRalf Baechle typedef union h1_icrbb_u { 556384740dcSRalf Baechle u64 reg_value; 557384740dcSRalf Baechle struct { 558384740dcSRalf Baechle u64 rsvd1: 5, 559384740dcSRalf Baechle btenum: 1, /* BTE to which entry belongs to */ 560384740dcSRalf Baechle cohtrans: 1, /* Coherent transaction */ 561384740dcSRalf Baechle xtsize: 2, /* Xtalk operation size 562384740dcSRalf Baechle * 0: Double Word 563384740dcSRalf Baechle * 1: 32 Bytes. 564384740dcSRalf Baechle * 2: 128 Bytes, 565384740dcSRalf Baechle * 3: Reserved. 566384740dcSRalf Baechle */ 567384740dcSRalf Baechle srcnode: 9, /* Source Node ID */ 568384740dcSRalf Baechle srcinit: 2, /* Source Initiator: 569384740dcSRalf Baechle * See below for field values. 570384740dcSRalf Baechle */ 571384740dcSRalf Baechle useold: 1, /* Use OLD command for processing */ 572384740dcSRalf Baechle imsgtype: 2, /* Incoming message type 573384740dcSRalf Baechle * see below for field values 574384740dcSRalf Baechle */ 575384740dcSRalf Baechle imsg: 8, /* Incoming message */ 576384740dcSRalf Baechle initator: 3, /* Initiator of original request 577384740dcSRalf Baechle * See below for field values. 578384740dcSRalf Baechle */ 579384740dcSRalf Baechle rsvd2: 1, 580384740dcSRalf Baechle pcache: 1, /* entry belongs to partial cache */ 581384740dcSRalf Baechle reqtype: 5, /* Identifies type of request 582384740dcSRalf Baechle * See below for field values. 583384740dcSRalf Baechle */ 584384740dcSRalf Baechle stl_ib: 1, /* stall Ibus coming from xtalk */ 585384740dcSRalf Baechle stl_intr: 1, /* Stall internal interrupts */ 586384740dcSRalf Baechle stl_bte0: 1, /* Stall BTE 0 */ 587384740dcSRalf Baechle stl_bte1: 1, /* Stall BTE 1 */ 588384740dcSRalf Baechle intrvn: 1, /* Req was target of intervention */ 589384740dcSRalf Baechle ackcnt: 11, /* Invalidate ack count */ 590384740dcSRalf Baechle resp: 1, /* data response given to processor */ 591384740dcSRalf Baechle ack: 1, /* indicates data ack received */ 592384740dcSRalf Baechle hold: 1, /* entry is gathering inval acks */ 593384740dcSRalf Baechle wb_pend:1, /* waiting for writeback to complete */ 594384740dcSRalf Baechle sleep: 1, /* xtalk req sleeping till IO-sync */ 595384740dcSRalf Baechle pnd_reply: 1, /* replies not issed due to IOQ full */ 596384740dcSRalf Baechle pnd_req: 1; /* reqs not issued due to IOQ full */ 597384740dcSRalf Baechle } h1_icrbb_field_s; 598384740dcSRalf Baechle } h1_icrbb_t; 599384740dcSRalf Baechle 600384740dcSRalf Baechle 601384740dcSRalf Baechle #define b_imsgtype icrbb_field_s.imsgtype 602384740dcSRalf Baechle #define b_btenum icrbb_field_s.btenum 603384740dcSRalf Baechle #define b_cohtrans icrbb_field_s.cohtrans 604384740dcSRalf Baechle #define b_xtsize icrbb_field_s.xtsize 605384740dcSRalf Baechle #define b_srcnode icrbb_field_s.srcnode 606384740dcSRalf Baechle #define b_srcinit icrbb_field_s.srcinit 607384740dcSRalf Baechle #define b_imsgtype icrbb_field_s.imsgtype 608384740dcSRalf Baechle #define b_imsg icrbb_field_s.imsg 609384740dcSRalf Baechle #define b_initiator icrbb_field_s.initiator 610384740dcSRalf Baechle 611384740dcSRalf Baechle #endif /* !__ASSEMBLY__ */ 612384740dcSRalf Baechle 613384740dcSRalf Baechle /* 614384740dcSRalf Baechle * values for field xtsize 615384740dcSRalf Baechle */ 616384740dcSRalf Baechle #define IIO_ICRB_XTSIZE_DW 0 /* Xtalk operation size is 8 bytes */ 617384740dcSRalf Baechle #define IIO_ICRB_XTSIZE_32 1 /* Xtalk operation size is 32 bytes */ 618384740dcSRalf Baechle #define IIO_ICRB_XTSIZE_128 2 /* Xtalk operation size is 128 bytes */ 619384740dcSRalf Baechle 620384740dcSRalf Baechle /* 621384740dcSRalf Baechle * values for field srcinit 622384740dcSRalf Baechle */ 623384740dcSRalf Baechle #define IIO_ICRB_PROC0 0 /* Source of request is Proc 0 */ 624384740dcSRalf Baechle #define IIO_ICRB_PROC1 1 /* Source of request is Proc 1 */ 62525985edcSLucas De Marchi #define IIO_ICRB_GB_REQ 2 /* Source is Guaranteed BW request */ 626384740dcSRalf Baechle #define IIO_ICRB_IO_REQ 3 /* Source is Normal IO request */ 627384740dcSRalf Baechle 628384740dcSRalf Baechle /* 629384740dcSRalf Baechle * Values for field imsgtype 630384740dcSRalf Baechle */ 631*92a76f6dSAdam Buchbinder #define IIO_ICRB_IMSGT_XTALK 0 /* Incoming Message from Xtalk */ 632384740dcSRalf Baechle #define IIO_ICRB_IMSGT_BTE 1 /* Incoming message from BTE */ 633384740dcSRalf Baechle #define IIO_ICRB_IMSGT_SN0NET 2 /* Incoming message from SN0 net */ 634384740dcSRalf Baechle #define IIO_ICRB_IMSGT_CRB 3 /* Incoming message from CRB ??? */ 635384740dcSRalf Baechle 636384740dcSRalf Baechle /* 637384740dcSRalf Baechle * values for field initiator. 638384740dcSRalf Baechle */ 639384740dcSRalf Baechle #define IIO_ICRB_INIT_XTALK 0 /* Message originated in xtalk */ 640384740dcSRalf Baechle #define IIO_ICRB_INIT_BTE0 0x1 /* Message originated in BTE 0 */ 641384740dcSRalf Baechle #define IIO_ICRB_INIT_SN0NET 0x2 /* Message originated in SN0net */ 642384740dcSRalf Baechle #define IIO_ICRB_INIT_CRB 0x3 /* Message originated in CRB ? */ 643384740dcSRalf Baechle #define IIO_ICRB_INIT_BTE1 0x5 /* MEssage originated in BTE 1 */ 644384740dcSRalf Baechle 645384740dcSRalf Baechle /* 646384740dcSRalf Baechle * Values for field reqtype. 647384740dcSRalf Baechle */ 648384740dcSRalf Baechle /* XXX - Need to fix this for Hub 2 */ 649384740dcSRalf Baechle #define IIO_ICRB_REQ_DWRD 0 /* Request type double word */ 650384740dcSRalf Baechle #define IIO_ICRB_REQ_QCLRD 1 /* Request is Qrtr Caceh line Rd */ 651384740dcSRalf Baechle #define IIO_ICRB_REQ_BLKRD 2 /* Request is block read */ 652384740dcSRalf Baechle #define IIO_ICRB_REQ_RSHU 6 /* Request is BTE block read */ 653384740dcSRalf Baechle #define IIO_ICRB_REQ_REXU 7 /* request is BTE Excl Read */ 654384740dcSRalf Baechle #define IIO_ICRB_REQ_RDEX 8 /* Request is Read Exclusive */ 655384740dcSRalf Baechle #define IIO_ICRB_REQ_WINC 9 /* Request is Write Invalidate */ 656384740dcSRalf Baechle #define IIO_ICRB_REQ_BWINV 10 /* Request is BTE Winv */ 657384740dcSRalf Baechle #define IIO_ICRB_REQ_PIORD 11 /* Request is PIO read */ 658384740dcSRalf Baechle #define IIO_ICRB_REQ_PIOWR 12 /* Request is PIO Write */ 659384740dcSRalf Baechle #define IIO_ICRB_REQ_PRDM 13 /* Request is Fetch&Op */ 660384740dcSRalf Baechle #define IIO_ICRB_REQ_PWRM 14 /* Request is Store &Op */ 661384740dcSRalf Baechle #define IIO_ICRB_REQ_PTPWR 15 /* Request is Peer to peer */ 662384740dcSRalf Baechle #define IIO_ICRB_REQ_WB 16 /* Request is Write back */ 663384740dcSRalf Baechle #define IIO_ICRB_REQ_DEX 17 /* Retained DEX Cache line */ 664384740dcSRalf Baechle 665384740dcSRalf Baechle /* 666384740dcSRalf Baechle * Fields in CRB Register C 667384740dcSRalf Baechle */ 668384740dcSRalf Baechle 669384740dcSRalf Baechle #ifndef __ASSEMBLY__ 670384740dcSRalf Baechle 671384740dcSRalf Baechle typedef union icrbc_s { 672384740dcSRalf Baechle u64 reg_value; 673384740dcSRalf Baechle struct { 674384740dcSRalf Baechle u64 rsvd: 6, 675384740dcSRalf Baechle sleep: 1, 676384740dcSRalf Baechle pricnt: 4, /* Priority count sent with Read req */ 677384740dcSRalf Baechle pripsc: 4, /* Priority Pre scalar */ 678384740dcSRalf Baechle bteop: 1, /* BTE Operation */ 679384740dcSRalf Baechle push_be: 34, /* Push address Byte enable 680384740dcSRalf Baechle * Holds push addr, if CRB is for BTE 681384740dcSRalf Baechle * If CRB belongs to Partial cache, 682384740dcSRalf Baechle * this contains byte enables bits 683384740dcSRalf Baechle * ([47:46] = 0) 684384740dcSRalf Baechle */ 685384740dcSRalf Baechle suppl: 11, /* Supplemental field */ 686384740dcSRalf Baechle barrop: 1, /* Barrier Op bit set in xtalk req */ 687384740dcSRalf Baechle doresp: 1, /* Xtalk req needs a response */ 688384740dcSRalf Baechle gbr: 1; /* GBR bit set in xtalk packet */ 689384740dcSRalf Baechle } icrbc_field_s; 690384740dcSRalf Baechle } icrbc_t; 691384740dcSRalf Baechle 692384740dcSRalf Baechle #define c_pricnt icrbc_field_s.pricnt 693384740dcSRalf Baechle #define c_pripsc icrbc_field_s.pripsc 694384740dcSRalf Baechle #define c_bteop icrbc_field_s.bteop 695384740dcSRalf Baechle #define c_bteaddr icrbc_field_s.push_be /* push_be field has 2 names */ 696384740dcSRalf Baechle #define c_benable icrbc_field_s.push_be /* push_be field has 2 names */ 697384740dcSRalf Baechle #define c_suppl icrbc_field_s.suppl 698384740dcSRalf Baechle #define c_barrop icrbc_field_s.barrop 699384740dcSRalf Baechle #define c_doresp icrbc_field_s.doresp 700384740dcSRalf Baechle #define c_gbr icrbc_field_s.gbr 701384740dcSRalf Baechle #endif /* !__ASSEMBLY__ */ 702384740dcSRalf Baechle 703384740dcSRalf Baechle /* 704384740dcSRalf Baechle * Fields in CRB Register D 705384740dcSRalf Baechle */ 706384740dcSRalf Baechle 707384740dcSRalf Baechle #ifndef __ASSEMBLY__ 708384740dcSRalf Baechle typedef union icrbd_s { 709384740dcSRalf Baechle u64 reg_value; 710384740dcSRalf Baechle struct { 711384740dcSRalf Baechle u64 rsvd: 38, 712384740dcSRalf Baechle toutvld: 1, /* Timeout in progress for this CRB */ 713384740dcSRalf Baechle ctxtvld: 1, /* Context field below is valid */ 714384740dcSRalf Baechle rsvd2: 1, 715384740dcSRalf Baechle context: 15, /* Bit vector: 716384740dcSRalf Baechle * Has a bit set for each CRB entry 717384740dcSRalf Baechle * which needs to be deallocated 718384740dcSRalf Baechle * before this CRB entry is processed. 719384740dcSRalf Baechle * Set only for barrier operations. 720384740dcSRalf Baechle */ 721384740dcSRalf Baechle timeout: 8; /* Timeout Upper 8 bits */ 722384740dcSRalf Baechle } icrbd_field_s; 723384740dcSRalf Baechle } icrbd_t; 724384740dcSRalf Baechle 725384740dcSRalf Baechle #define icrbd_toutvld icrbd_field_s.toutvld 726384740dcSRalf Baechle #define icrbd_ctxtvld icrbd_field_s.ctxtvld 727384740dcSRalf Baechle #define icrbd_context icrbd_field_s.context 728384740dcSRalf Baechle 729384740dcSRalf Baechle 730384740dcSRalf Baechle typedef union hubii_ifdr_u { 731384740dcSRalf Baechle u64 hi_ifdr_value; 732384740dcSRalf Baechle struct { 733384740dcSRalf Baechle u64 ifdr_rsvd: 49, 734384740dcSRalf Baechle ifdr_maxrp: 7, 735384740dcSRalf Baechle ifdr_rsvd1: 1, 736384740dcSRalf Baechle ifdr_maxrq: 7; 737384740dcSRalf Baechle } hi_ifdr_fields; 738384740dcSRalf Baechle } hubii_ifdr_t; 739384740dcSRalf Baechle 740384740dcSRalf Baechle #endif /* !__ASSEMBLY__ */ 741384740dcSRalf Baechle 742384740dcSRalf Baechle /* 743384740dcSRalf Baechle * Hardware designed names for the BTE control registers. 744384740dcSRalf Baechle */ 745384740dcSRalf Baechle #define IIO_IBLS_0 0x410000 /* BTE length/status 0 */ 746384740dcSRalf Baechle #define IIO_IBSA_0 0x410008 /* BTE source address 0 */ 747384740dcSRalf Baechle #define IIO_IBDA_0 0x410010 /* BTE destination address 0 */ 748384740dcSRalf Baechle #define IIO_IBCT_0 0x410018 /* BTE control/terminate 0 */ 749384740dcSRalf Baechle #define IIO_IBNA_0 0x410020 /* BTE notification address 0 */ 750384740dcSRalf Baechle #define IIO_IBNR_0 IIO_IBNA_0 751384740dcSRalf Baechle #define IIO_IBIA_0 0x410028 /* BTE interrupt address 0 */ 752384740dcSRalf Baechle 753384740dcSRalf Baechle #define IIO_IBLS_1 0x420000 /* BTE length/status 1 */ 754384740dcSRalf Baechle #define IIO_IBSA_1 0x420008 /* BTE source address 1 */ 755384740dcSRalf Baechle #define IIO_IBDA_1 0x420010 /* BTE destination address 1 */ 756384740dcSRalf Baechle #define IIO_IBCT_1 0x420018 /* BTE control/terminate 1 */ 757384740dcSRalf Baechle #define IIO_IBNA_1 0x420020 /* BTE notification address 1 */ 758384740dcSRalf Baechle #define IIO_IBNR_1 IIO_IBNA_1 759384740dcSRalf Baechle #define IIO_IBIA_1 0x420028 /* BTE interrupt address 1 */ 760384740dcSRalf Baechle 761384740dcSRalf Baechle /* 762384740dcSRalf Baechle * More miscellaneous registers 763384740dcSRalf Baechle */ 764384740dcSRalf Baechle #define IIO_IPCR 0x430000 /* Performance Control */ 765384740dcSRalf Baechle #define IIO_IPPR 0x430008 /* Performance Profiling */ 766384740dcSRalf Baechle 767384740dcSRalf Baechle /* 768384740dcSRalf Baechle * IO Error Clear register bit field definitions 769384740dcSRalf Baechle */ 770384740dcSRalf Baechle #define IECLR_BTE1 (1 << 18) /* clear bte error 1 ??? */ 771384740dcSRalf Baechle #define IECLR_BTE0 (1 << 17) /* clear bte error 0 ??? */ 772384740dcSRalf Baechle #define IECLR_CRAZY (1 << 16) /* clear crazy bit in wstat reg */ 773384740dcSRalf Baechle #define IECLR_PRB_F (1 << 15) /* clear err bit in PRB_F reg */ 774384740dcSRalf Baechle #define IECLR_PRB_E (1 << 14) /* clear err bit in PRB_E reg */ 775384740dcSRalf Baechle #define IECLR_PRB_D (1 << 13) /* clear err bit in PRB_D reg */ 776384740dcSRalf Baechle #define IECLR_PRB_C (1 << 12) /* clear err bit in PRB_C reg */ 777384740dcSRalf Baechle #define IECLR_PRB_B (1 << 11) /* clear err bit in PRB_B reg */ 778384740dcSRalf Baechle #define IECLR_PRB_A (1 << 10) /* clear err bit in PRB_A reg */ 779384740dcSRalf Baechle #define IECLR_PRB_9 (1 << 9) /* clear err bit in PRB_9 reg */ 780384740dcSRalf Baechle #define IECLR_PRB_8 (1 << 8) /* clear err bit in PRB_8 reg */ 781384740dcSRalf Baechle #define IECLR_PRB_0 (1 << 0) /* clear err bit in PRB_0 reg */ 782384740dcSRalf Baechle 783384740dcSRalf Baechle /* 784384740dcSRalf Baechle * IO PIO Read Table Entry format 785384740dcSRalf Baechle */ 786384740dcSRalf Baechle 787384740dcSRalf Baechle #ifndef __ASSEMBLY__ 788384740dcSRalf Baechle 789384740dcSRalf Baechle typedef union iprte_a { 790384740dcSRalf Baechle u64 entry; 791384740dcSRalf Baechle struct { 792384740dcSRalf Baechle u64 rsvd1 : 7, /* Reserved field */ 793384740dcSRalf Baechle valid : 1, /* Maps to a timeout entry */ 794384740dcSRalf Baechle rsvd2 : 1, 795384740dcSRalf Baechle srcnode : 9, /* Node which did this PIO */ 796384740dcSRalf Baechle initiator : 2, /* If T5A or T5B or IO */ 797384740dcSRalf Baechle rsvd3 : 3, 798384740dcSRalf Baechle addr : 38, /* Physical address of PIO */ 799384740dcSRalf Baechle rsvd4 : 3; 800384740dcSRalf Baechle } iprte_fields; 801384740dcSRalf Baechle } iprte_a_t; 802384740dcSRalf Baechle 803384740dcSRalf Baechle #define iprte_valid iprte_fields.valid 804384740dcSRalf Baechle #define iprte_timeout iprte_fields.timeout 805384740dcSRalf Baechle #define iprte_srcnode iprte_fields.srcnode 806384740dcSRalf Baechle #define iprte_init iprte_fields.initiator 807384740dcSRalf Baechle #define iprte_addr iprte_fields.addr 808384740dcSRalf Baechle 809384740dcSRalf Baechle #endif /* !__ASSEMBLY__ */ 810384740dcSRalf Baechle 811384740dcSRalf Baechle #define IPRTE_ADDRSHFT 3 812384740dcSRalf Baechle 813384740dcSRalf Baechle /* 814384740dcSRalf Baechle * Hub IIO PRB Register format. 815384740dcSRalf Baechle */ 816384740dcSRalf Baechle 817384740dcSRalf Baechle #ifndef __ASSEMBLY__ 818384740dcSRalf Baechle /* 819384740dcSRalf Baechle * Note: Fields bnakctr, anakctr, xtalkctrmode, ovflow fields are 820384740dcSRalf Baechle * "Status" fields, and should only be used in case of clean up after errors. 821384740dcSRalf Baechle */ 822384740dcSRalf Baechle 823384740dcSRalf Baechle typedef union iprb_u { 824384740dcSRalf Baechle u64 reg_value; 825384740dcSRalf Baechle struct { 826384740dcSRalf Baechle u64 rsvd1: 15, 827384740dcSRalf Baechle error: 1, /* Widget rcvd wr resp pkt w/ error */ 828384740dcSRalf Baechle ovflow: 5, /* Overflow count. perf measurement */ 829384740dcSRalf Baechle fire_and_forget: 1, /* Launch Write without response */ 830384740dcSRalf Baechle mode: 2, /* Widget operation Mode */ 831384740dcSRalf Baechle rsvd2: 2, 832384740dcSRalf Baechle bnakctr: 14, 833384740dcSRalf Baechle rsvd3: 2, 834384740dcSRalf Baechle anakctr: 14, 835384740dcSRalf Baechle xtalkctr: 8; 836384740dcSRalf Baechle } iprb_fields_s; 837384740dcSRalf Baechle } iprb_t; 838384740dcSRalf Baechle 839384740dcSRalf Baechle #define iprb_regval reg_value 840384740dcSRalf Baechle 841384740dcSRalf Baechle #define iprb_error iprb_fields_s.error 842384740dcSRalf Baechle #define iprb_ovflow iprb_fields_s.ovflow 843384740dcSRalf Baechle #define iprb_ff iprb_fields_s.fire_and_forget 844384740dcSRalf Baechle #define iprb_mode iprb_fields_s.mode 845384740dcSRalf Baechle #define iprb_bnakctr iprb_fields_s.bnakctr 846384740dcSRalf Baechle #define iprb_anakctr iprb_fields_s.anakctr 847384740dcSRalf Baechle #define iprb_xtalkctr iprb_fields_s.xtalkctr 848384740dcSRalf Baechle 849384740dcSRalf Baechle #endif /* !__ASSEMBLY__ */ 850384740dcSRalf Baechle 851384740dcSRalf Baechle /* 852384740dcSRalf Baechle * values for mode field in iprb_t. 853384740dcSRalf Baechle * For details of the meanings of NAK and Accept, refer the PIO flow 854384740dcSRalf Baechle * document 855384740dcSRalf Baechle */ 856384740dcSRalf Baechle #define IPRB_MODE_NORMAL (0) 857384740dcSRalf Baechle #define IPRB_MODE_COLLECT_A (1) /* PRB in collect A mode */ 858384740dcSRalf Baechle #define IPRB_MODE_SERVICE_A (2) /* NAK B and Accept A */ 859384740dcSRalf Baechle #define IPRB_MODE_SERVICE_B (3) /* NAK A and Accept B */ 860384740dcSRalf Baechle 861384740dcSRalf Baechle /* 862384740dcSRalf Baechle * IO CRB entry C_A to E_A : Partial (cache) CRBS 863384740dcSRalf Baechle */ 864384740dcSRalf Baechle #ifndef __ASSEMBLY__ 865384740dcSRalf Baechle typedef union icrbp_a { 866384740dcSRalf Baechle u64 ip_reg; /* the entire register value */ 867384740dcSRalf Baechle struct { 868384740dcSRalf Baechle u64 error: 1, /* 63, error occurred */ 869384740dcSRalf Baechle ln_uce: 1, /* 62: uncorrectable memory */ 870384740dcSRalf Baechle ln_ae: 1, /* 61: protection violation */ 871384740dcSRalf Baechle ln_werr:1, /* 60: write access error */ 872384740dcSRalf Baechle ln_aerr:1, /* 59: sn0net: Address error */ 873384740dcSRalf Baechle ln_perr:1, /* 58: sn0net: poison error */ 874384740dcSRalf Baechle timeout:1, /* 57: CRB timed out */ 875384740dcSRalf Baechle l_bdpkt:1, /* 56: truncated pkt on sn0net */ 876384740dcSRalf Baechle c_bdpkt:1, /* 55: truncated pkt on xtalk */ 877384740dcSRalf Baechle c_err: 1, /* 54: incoming xtalk req, err set*/ 878384740dcSRalf Baechle rsvd1: 12, /* 53-42: reserved */ 879384740dcSRalf Baechle valid: 1, /* 41: Valid status */ 880384740dcSRalf Baechle sidn: 4, /* 40-37: SIDN field of xtalk rqst */ 881384740dcSRalf Baechle tnum: 5, /* 36-32: TNUM of xtalk request */ 882384740dcSRalf Baechle bo: 1, /* 31: barrier op set in xtalk rqst*/ 883384740dcSRalf Baechle resprqd:1, /* 30: xtalk rqst requires response*/ 884384740dcSRalf Baechle gbr: 1, /* 29: gbr bit set in xtalk rqst */ 885384740dcSRalf Baechle size: 2, /* 28-27: size of xtalk request */ 886384740dcSRalf Baechle excl: 4, /* 26-23: exclusive bit(s) */ 887384740dcSRalf Baechle stall: 3, /* 22-20: stall (xtalk, bte 0/1) */ 888384740dcSRalf Baechle intvn: 1, /* 19: rqst target of intervention*/ 889384740dcSRalf Baechle resp: 1, /* 18: Data response given to t5 */ 890384740dcSRalf Baechle ack: 1, /* 17: Data ack received. */ 891384740dcSRalf Baechle hold: 1, /* 16: crb gathering invalidate acks*/ 892384740dcSRalf Baechle wb: 1, /* 15: writeback pending. */ 893384740dcSRalf Baechle ack_cnt:11, /* 14-04: counter of invalidate acks*/ 894384740dcSRalf Baechle tscaler:4; /* 03-00: Timeout prescaler */ 895384740dcSRalf Baechle } ip_fmt; 896384740dcSRalf Baechle } icrbp_a_t; 897384740dcSRalf Baechle 898384740dcSRalf Baechle #endif /* !__ASSEMBLY__ */ 899384740dcSRalf Baechle 900384740dcSRalf Baechle /* 901384740dcSRalf Baechle * A couple of defines to go with the above structure. 902384740dcSRalf Baechle */ 903384740dcSRalf Baechle #define ICRBP_A_CERR_SHFT 54 904384740dcSRalf Baechle #define ICRBP_A_ERR_MASK 0x3ff 905384740dcSRalf Baechle 906384740dcSRalf Baechle #ifndef __ASSEMBLY__ 907384740dcSRalf Baechle typedef union hubii_idsr { 908384740dcSRalf Baechle u64 iin_reg; 909384740dcSRalf Baechle struct { 910384740dcSRalf Baechle u64 rsvd1 : 35, 911384740dcSRalf Baechle isent : 1, 912384740dcSRalf Baechle rsvd2 : 3, 913384740dcSRalf Baechle ienable: 1, 914384740dcSRalf Baechle rsvd : 7, 915384740dcSRalf Baechle node : 9, 916384740dcSRalf Baechle rsvd4 : 1, 917384740dcSRalf Baechle level : 7; 918384740dcSRalf Baechle } iin_fmt; 919384740dcSRalf Baechle } hubii_idsr_t; 920384740dcSRalf Baechle #endif /* !__ASSEMBLY__ */ 921384740dcSRalf Baechle 922384740dcSRalf Baechle /* 923384740dcSRalf Baechle * IO BTE Length/Status (IIO_IBLS) register bit field definitions 924384740dcSRalf Baechle */ 925384740dcSRalf Baechle #define IBLS_BUSY (0x1 << 20) 926384740dcSRalf Baechle #define IBLS_ERROR_SHFT 16 927384740dcSRalf Baechle #define IBLS_ERROR (0x1 << IBLS_ERROR_SHFT) 928384740dcSRalf Baechle #define IBLS_LENGTH_MASK 0xffff 929384740dcSRalf Baechle 930384740dcSRalf Baechle /* 931384740dcSRalf Baechle * IO BTE Control/Terminate register (IBCT) register bit field definitions 932384740dcSRalf Baechle */ 933384740dcSRalf Baechle #define IBCT_POISON (0x1 << 8) 934384740dcSRalf Baechle #define IBCT_NOTIFY (0x1 << 4) 935384740dcSRalf Baechle #define IBCT_ZFIL_MODE (0x1 << 0) 936384740dcSRalf Baechle 937384740dcSRalf Baechle /* 938384740dcSRalf Baechle * IO BTE Interrupt Address Register (IBIA) register bit field definitions 939384740dcSRalf Baechle */ 940384740dcSRalf Baechle #define IBIA_LEVEL_SHFT 16 941384740dcSRalf Baechle #define IBIA_LEVEL_MASK (0x7f << IBIA_LEVEL_SHFT) 942384740dcSRalf Baechle #define IBIA_NODE_ID_SHFT 0 943384740dcSRalf Baechle #define IBIA_NODE_ID_MASK (0x1ff) 944384740dcSRalf Baechle 945384740dcSRalf Baechle /* 946384740dcSRalf Baechle * Miscellaneous hub constants 947384740dcSRalf Baechle */ 948384740dcSRalf Baechle 949384740dcSRalf Baechle /* Number of widgets supported by hub */ 950384740dcSRalf Baechle #define HUB_NUM_WIDGET 9 951384740dcSRalf Baechle #define HUB_WIDGET_ID_MIN 0x8 952384740dcSRalf Baechle #define HUB_WIDGET_ID_MAX 0xf 953384740dcSRalf Baechle 954384740dcSRalf Baechle #define HUB_WIDGET_PART_NUM 0xc101 955384740dcSRalf Baechle #define MAX_HUBS_PER_XBOW 2 956384740dcSRalf Baechle 957384740dcSRalf Baechle /* 958384740dcSRalf Baechle * Get a hub's widget id from widget control register 959384740dcSRalf Baechle */ 960384740dcSRalf Baechle #define IIO_WCR_WID_GET(nasid) (REMOTE_HUB_L(nasid, III_WCR) & 0xf) 961384740dcSRalf Baechle #define IIO_WST_ERROR_MASK (UINT64_CAST 1 << 32) /* Widget status error */ 962384740dcSRalf Baechle 963384740dcSRalf Baechle /* 964384740dcSRalf Baechle * Number of credits Hub widget has while sending req/response to 965384740dcSRalf Baechle * xbow. 966384740dcSRalf Baechle * Value of 3 is required by Xbow 1.1 967384740dcSRalf Baechle * We may be able to increase this to 4 with Xbow 1.2. 968384740dcSRalf Baechle */ 969384740dcSRalf Baechle #define HUBII_XBOW_CREDIT 3 970384740dcSRalf Baechle #define HUBII_XBOW_REV2_CREDIT 4 971384740dcSRalf Baechle 972384740dcSRalf Baechle #endif /* _ASM_SGI_SN_SN0_HUBIO_H */ 973