0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef _ASM_SGI_SN0_HUBNI_H
0012 #define _ASM_SGI_SN0_HUBNI_H
0013
0014 #ifndef __ASSEMBLY__
0015 #include <linux/types.h>
0016 #endif
0017
0018
0019
0020
0021
0022
0023
0024 #define NI_BASE 0x600000
0025 #define NI_BASE_TABLES 0x630000
0026
0027 #define NI_STATUS_REV_ID 0x600000
0028 #define NI_PORT_RESET 0x600008
0029 #define NI_PROTECTION 0x600010
0030 #define NI_GLOBAL_PARMS 0x600018
0031 #define NI_SCRATCH_REG0 0x600100
0032 #define NI_SCRATCH_REG1 0x600108
0033 #define NI_DIAG_PARMS 0x600110
0034
0035 #define NI_VECTOR_PARMS 0x600200
0036 #define NI_VECTOR 0x600208
0037 #define NI_VECTOR_DATA 0x600210
0038 #define NI_VECTOR_STATUS 0x600300
0039 #define NI_RETURN_VECTOR 0x600308
0040 #define NI_VECTOR_READ_DATA 0x600310
0041 #define NI_VECTOR_CLEAR 0x600380
0042
0043 #define NI_IO_PROTECT 0x600400
0044 #define NI_IO_PROT_OVRRD 0x600408
0045
0046 #define NI_AGE_CPU0_MEMORY 0x600500
0047 #define NI_AGE_CPU0_PIO 0x600508
0048 #define NI_AGE_CPU1_MEMORY 0x600510
0049 #define NI_AGE_CPU1_PIO 0x600518
0050 #define NI_AGE_GBR_MEMORY 0x600520
0051 #define NI_AGE_GBR_PIO 0x600528
0052 #define NI_AGE_IO_MEMORY 0x600530
0053 #define NI_AGE_IO_PIO 0x600538
0054 #define NI_AGE_REG_MIN NI_AGE_CPU0_MEMORY
0055 #define NI_AGE_REG_MAX NI_AGE_IO_PIO
0056
0057 #define NI_PORT_PARMS 0x608000
0058 #define NI_PORT_ERROR 0x608008
0059 #define NI_PORT_ERROR_CLEAR 0x608088
0060
0061 #define NI_META_TABLE0 0x638000
0062 #define NI_META_TABLE(_x) (NI_META_TABLE0 + (8 * (_x)))
0063 #define NI_META_ENTRIES 32
0064
0065 #define NI_LOCAL_TABLE0 0x638100
0066 #define NI_LOCAL_TABLE(_x) (NI_LOCAL_TABLE0 + (8 * (_x)))
0067 #define NI_LOCAL_ENTRIES 16
0068
0069
0070
0071
0072
0073
0074 #define NSRI_8BITMODE_SHFT 30
0075 #define NSRI_8BITMODE_MASK (UINT64_CAST 0x1 << 30)
0076 #define NSRI_LINKUP_SHFT 29
0077 #define NSRI_LINKUP_MASK (UINT64_CAST 0x1 << 29)
0078 #define NSRI_DOWNREASON_SHFT 28
0079 #define NSRI_DOWNREASON_MASK (UINT64_CAST 0x1 << 28)
0080 #define NSRI_MORENODES_SHFT 18
0081 #define NSRI_MORENODES_MASK (UINT64_CAST 1 << 18)
0082 #define MORE_MEMORY 0
0083 #define MORE_NODES 1
0084 #define NSRI_REGIONSIZE_SHFT 17
0085 #define NSRI_REGIONSIZE_MASK (UINT64_CAST 1 << 17)
0086 #define REGIONSIZE_FINE 1
0087 #define REGIONSIZE_COARSE 0
0088 #define NSRI_NODEID_SHFT 8
0089 #define NSRI_NODEID_MASK (UINT64_CAST 0x1ff << 8)
0090 #define NSRI_REV_SHFT 4
0091 #define NSRI_REV_MASK (UINT64_CAST 0xf << 4)
0092 #define NSRI_CHIPID_SHFT 0
0093 #define NSRI_CHIPID_MASK (UINT64_CAST 0xf)
0094
0095
0096
0097
0098
0099 #define NASID_TO_FINEREG_SHFT 0
0100 #define NASID_TO_COARSEREG_SHFT 3
0101
0102
0103
0104 #define NPR_PORTRESET (UINT64_CAST 1 << 7)
0105 #define NPR_LINKRESET (UINT64_CAST 1 << 1)
0106 #define NPR_LOCALRESET (UINT64_CAST 1)
0107
0108
0109
0110 #define NPROT_RESETOK (UINT64_CAST 1)
0111
0112
0113
0114 #define NGP_MAXRETRY_SHFT 48
0115 #define NGP_MAXRETRY_MASK (UINT64_CAST 0x3ff << 48)
0116 #define NGP_TAILTOWRAP_SHFT 32
0117 #define NGP_TAILTOWRAP_MASK (UINT64_CAST 0xffff << 32)
0118
0119 #define NGP_CREDITTOVAL_SHFT 16
0120 #define NGP_CREDITTOVAL_MASK (UINT64_CAST 0xf << 16)
0121 #define NGP_TAILTOVAL_SHFT 4
0122 #define NGP_TAILTOVAL_MASK (UINT64_CAST 0xf << 4)
0123
0124
0125
0126 #define NDP_PORTTORESET (UINT64_CAST 1 << 18)
0127 #define NDP_LLP8BITMODE (UINT64_CAST 1 << 12)
0128 #define NDP_PORTDISABLE (UINT64_CAST 1 << 6)
0129 #define NDP_SENDERROR (UINT64_CAST 1)
0130
0131
0132
0133
0134
0135
0136 #define NVP_PIOID_SHFT 40
0137 #define NVP_PIOID_MASK (UINT64_CAST 0x3ff << 40)
0138 #define NVP_WRITEID_SHFT 32
0139 #define NVP_WRITEID_MASK (UINT64_CAST 0xff << 32)
0140 #define NVP_ADDRESS_MASK (UINT64_CAST 0xffff8)
0141 #define NVP_TYPE_SHFT 0
0142 #define NVP_TYPE_MASK (UINT64_CAST 0x3)
0143
0144
0145
0146 #define NVS_VALID (UINT64_CAST 1 << 63)
0147 #define NVS_OVERRUN (UINT64_CAST 1 << 62)
0148 #define NVS_TARGET_SHFT 51
0149 #define NVS_TARGET_MASK (UINT64_CAST 0x3ff << 51)
0150 #define NVS_PIOID_SHFT 40
0151 #define NVS_PIOID_MASK (UINT64_CAST 0x3ff << 40)
0152 #define NVS_WRITEID_SHFT 32
0153 #define NVS_WRITEID_MASK (UINT64_CAST 0xff << 32)
0154 #define NVS_ADDRESS_MASK (UINT64_CAST 0xfffffff8)
0155 #define NVS_TYPE_SHFT 0
0156 #define NVS_TYPE_MASK (UINT64_CAST 0x7)
0157 #define NVS_ERROR_MASK (UINT64_CAST 0x4)
0158
0159
0160 #define PIOTYPE_READ 0
0161 #define PIOTYPE_WRITE 1
0162 #define PIOTYPE_UNDEFINED 2
0163 #define PIOTYPE_EXCHANGE 3
0164 #define PIOTYPE_ADDR_ERR 4
0165 #define PIOTYPE_CMD_ERR 5
0166 #define PIOTYPE_PROT_ERR 6
0167 #define PIOTYPE_UNKNOWN 7
0168
0169
0170
0171 #define NAGE_VCH_SHFT 10
0172 #define NAGE_VCH_MASK (UINT64_CAST 3 << 10)
0173 #define NAGE_CC_SHFT 8
0174 #define NAGE_CC_MASK (UINT64_CAST 3 << 8)
0175 #define NAGE_AGE_SHFT 0
0176 #define NAGE_AGE_MASK (UINT64_CAST 0xff)
0177 #define NAGE_MASK (NAGE_VCH_MASK | NAGE_CC_MASK | NAGE_AGE_MASK)
0178
0179 #define VCHANNEL_A 0
0180 #define VCHANNEL_B 1
0181 #define VCHANNEL_ANY 2
0182
0183
0184
0185 #define NPP_NULLTO_SHFT 10
0186 #define NPP_NULLTO_MASK (UINT64_CAST 0x3f << 16)
0187 #define NPP_MAXBURST_SHFT 0
0188 #define NPP_MAXBURST_MASK (UINT64_CAST 0x3ff)
0189 #define NPP_RESET_DFLT_HUB20 ((UINT64_CAST 1 << NPP_NULLTO_SHFT) | \
0190 (UINT64_CAST 0x3f0 << NPP_MAXBURST_SHFT))
0191 #define NPP_RESET_DEFAULTS ((UINT64_CAST 6 << NPP_NULLTO_SHFT) | \
0192 (UINT64_CAST 0x3f0 << NPP_MAXBURST_SHFT))
0193
0194
0195
0196
0197 #define NPE_LINKRESET (UINT64_CAST 1 << 37)
0198 #define NPE_INTERNALERROR (UINT64_CAST 1 << 36)
0199 #define NPE_BADMESSAGE (UINT64_CAST 1 << 35)
0200 #define NPE_BADDEST (UINT64_CAST 1 << 34)
0201 #define NPE_FIFOOVERFLOW (UINT64_CAST 1 << 33)
0202 #define NPE_CREDITTO_SHFT 28
0203 #define NPE_CREDITTO_MASK (UINT64_CAST 0xf << 28)
0204 #define NPE_TAILTO_SHFT 24
0205 #define NPE_TAILTO_MASK (UINT64_CAST 0xf << 24)
0206 #define NPE_RETRYCOUNT_SHFT 16
0207 #define NPE_RETRYCOUNT_MASK (UINT64_CAST 0xff << 16)
0208 #define NPE_CBERRCOUNT_SHFT 8
0209 #define NPE_CBERRCOUNT_MASK (UINT64_CAST 0xff << 8)
0210 #define NPE_SNERRCOUNT_SHFT 0
0211 #define NPE_SNERRCOUNT_MASK (UINT64_CAST 0xff << 0)
0212 #define NPE_MASK 0x3effffffff
0213
0214 #define NPE_COUNT_MAX 0xff
0215
0216 #define NPE_FATAL_ERRORS (NPE_LINKRESET | NPE_INTERNALERROR | \
0217 NPE_BADMESSAGE | NPE_BADDEST | \
0218 NPE_FIFOOVERFLOW | NPE_CREDITTO_MASK | \
0219 NPE_TAILTO_MASK)
0220
0221
0222
0223 #define NMT_EXIT_PORT_MASK (UINT64_CAST 0xf)
0224
0225
0226
0227 #define NLT_EXIT_PORT_MASK (UINT64_CAST 0xf)
0228
0229 #ifndef __ASSEMBLY__
0230
0231 typedef union hubni_port_error_u {
0232 u64 nipe_reg_value;
0233 struct {
0234 u64 nipe_rsvd: 26,
0235 nipe_lnk_reset: 1,
0236 nipe_intl_err: 1,
0237 nipe_bad_msg: 1,
0238 nipe_bad_dest: 1,
0239 nipe_fifo_ovfl: 1,
0240 nipe_rsvd1: 1,
0241 nipe_credit_to: 4,
0242 nipe_tail_to: 4,
0243 nipe_retry_cnt: 8,
0244 nipe_cb_cnt: 8,
0245 nipe_sn_cnt: 8;
0246 } nipe_fields_s;
0247 } hubni_port_error_t;
0248
0249 #define NI_LLP_RETRY_MAX 0xff
0250 #define NI_LLP_CB_MAX 0xff
0251 #define NI_LLP_SN_MAX 0xff
0252
0253 static inline int get_region_shift(void)
0254 {
0255 if (LOCAL_HUB_L(NI_STATUS_REV_ID) & NSRI_REGIONSIZE_MASK)
0256 return NASID_TO_FINEREG_SHFT;
0257
0258 return NASID_TO_COARSEREG_SHFT;
0259 }
0260
0261 #endif
0262
0263 #endif