1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 #ifndef _ASM_SN_SN0_HUBPI_H
  12 #define _ASM_SN_SN0_HUBPI_H
  13 
  14 #include <linux/types.h>
  15 
  16 
  17 
  18 
  19 
  20 
  21 
  22 
  23 
  24 #define PI_BASE                 0x000000
  25 
  26 
  27 
  28 #define PI_CPU_PROTECT          0x000000 
  29 #define PI_PROT_OVERRD          0x000008 
  30 #define PI_IO_PROTECT           0x000010 
  31 #define PI_REGION_PRESENT       0x000018 
  32 #define PI_CPU_NUM              0x000020 
  33 #define PI_CALIAS_SIZE          0x000028 
  34 #define PI_MAX_CRB_TIMEOUT      0x000030 
  35 #define PI_CRB_SFACTOR          0x000038 
  36 
  37 
  38 #define PI_CALIAS_SIZE_0        0
  39 #define PI_CALIAS_SIZE_4K       1
  40 #define PI_CALIAS_SIZE_8K       2
  41 #define PI_CALIAS_SIZE_16K      3
  42 #define PI_CALIAS_SIZE_32K      4
  43 #define PI_CALIAS_SIZE_64K      5
  44 #define PI_CALIAS_SIZE_128K     6
  45 #define PI_CALIAS_SIZE_256K     7
  46 #define PI_CALIAS_SIZE_512K     8
  47 #define PI_CALIAS_SIZE_1M       9
  48 #define PI_CALIAS_SIZE_2M       10
  49 #define PI_CALIAS_SIZE_4M       11
  50 #define PI_CALIAS_SIZE_8M       12
  51 #define PI_CALIAS_SIZE_16M      13
  52 #define PI_CALIAS_SIZE_32M      14
  53 #define PI_CALIAS_SIZE_64M      15
  54 
  55 
  56 
  57 #define PI_CPU_PRESENT_A        0x000040 
  58 #define PI_CPU_PRESENT_B        0x000048 
  59 #define PI_CPU_ENABLE_A         0x000050 
  60 #define PI_CPU_ENABLE_B         0x000058 
  61 #define PI_REPLY_LEVEL          0x000060 
  62 #define PI_HARDRESET_BIT        0x020068 
  63 #define PI_NMI_A                0x000070 
  64 #define PI_NMI_B                0x000078 
  65 #define PI_NMI_OFFSET           (PI_NMI_B - PI_NMI_A)
  66 #define PI_SOFTRESET            0x000080 
  67 
  68 
  69 
  70 #define PI_INT_PEND_MOD         0x000090 
  71 #define PI_INT_PEND0            0x000098 
  72 #define PI_INT_PEND1            0x0000a0 
  73 #define PI_INT_MASK0_A          0x0000a8 
  74 #define PI_INT_MASK1_A          0x0000b0 
  75 #define PI_INT_MASK0_B          0x0000b8 
  76 #define PI_INT_MASK1_B          0x0000c0 
  77 
  78 #define PI_INT_MASK_OFFSET      0x10     
  79 
  80 
  81 
  82 #define PI_CC_PEND_SET_A        0x0000c8 
  83 #define PI_CC_PEND_SET_B        0x0000d0 
  84 #define PI_CC_PEND_CLR_A        0x0000d8 
  85 #define PI_CC_PEND_CLR_B        0x0000e0 
  86 #define PI_CC_MASK              0x0000e8 
  87 
  88 #define PI_INT_SET_OFFSET       0x08     
  89 
  90 
  91 
  92 #define PI_RT_COUNT             0x030100 
  93 #define PI_RT_COMPARE_A         0x000108 
  94 #define PI_RT_COMPARE_B         0x000110 
  95 #define PI_PROFILE_COMPARE      0x000118 
  96 #define PI_RT_PEND_A            0x000120 
  97 #define PI_RT_PEND_B            0x000128 
  98 #define PI_PROF_PEND_A          0x000130 
  99 #define PI_PROF_PEND_B          0x000138 
 100 #define PI_RT_EN_A              0x000140 
 101 #define PI_RT_EN_B              0x000148 
 102 #define PI_PROF_EN_A            0x000150 
 103 #define PI_PROF_EN_B            0x000158 
 104 #define PI_RT_LOCAL_CTRL        0x000160 
 105 #define PI_RT_FILTER_CTRL       0x000168 
 106 
 107 #define PI_COUNT_OFFSET         0x08     
 108 
 109 
 110 
 111 #define PI_BIST_WRITE_DATA      0x000200 
 112 #define PI_BIST_READ_DATA       0x000208 
 113 #define PI_BIST_COUNT_TARG      0x000210 
 114 #define PI_BIST_READY           0x000218 
 115 #define PI_BIST_SHIFT_LOAD      0x000220 
 116 #define PI_BIST_SHIFT_UNLOAD    0x000228 
 117 #define PI_BIST_ENTER_RUN       0x000230 
 118 
 119 
 120 
 121 #define PI_GFX_PAGE_A           0x000300 
 122 #define PI_GFX_CREDIT_CNTR_A    0x000308 
 123 #define PI_GFX_BIAS_A           0x000310 
 124 #define PI_GFX_INT_CNTR_A       0x000318 
 125 #define PI_GFX_INT_CMP_A        0x000320 
 126 #define PI_GFX_PAGE_B           0x000328 
 127 #define PI_GFX_CREDIT_CNTR_B    0x000330 
 128 #define PI_GFX_BIAS_B           0x000338 
 129 #define PI_GFX_INT_CNTR_B       0x000340 
 130 #define PI_GFX_INT_CMP_B        0x000348 
 131 
 132 #define PI_GFX_OFFSET           (PI_GFX_PAGE_B - PI_GFX_PAGE_A)
 133 #define PI_GFX_PAGE_ENABLE      0x0000010000000000LL
 134 
 135 
 136 #define PI_ERR_INT_PEND         0x000400 
 137 #define PI_ERR_INT_MASK_A       0x000408 
 138 #define PI_ERR_INT_MASK_B       0x000410 
 139 #define PI_ERR_STACK_ADDR_A     0x000418 
 140 #define PI_ERR_STACK_ADDR_B     0x000420 
 141 #define PI_ERR_STACK_SIZE       0x000428 
 142 #define PI_ERR_STATUS0_A        0x000430 
 143 #define PI_ERR_STATUS0_A_RCLR   0x000438 
 144 #define PI_ERR_STATUS1_A        0x000440 
 145 #define PI_ERR_STATUS1_A_RCLR   0x000448 
 146 #define PI_ERR_STATUS0_B        0x000450 
 147 #define PI_ERR_STATUS0_B_RCLR   0x000458 
 148 #define PI_ERR_STATUS1_B        0x000460 
 149 #define PI_ERR_STATUS1_B_RCLR   0x000468 
 150 #define PI_SPOOL_CMP_A          0x000470 
 151 #define PI_SPOOL_CMP_B          0x000478 
 152 #define PI_CRB_TIMEOUT_A        0x000480 
 153 #define PI_CRB_TIMEOUT_B        0x000488 
 154 #define PI_SYSAD_ERRCHK_EN      0x000490 
 155 #define PI_BAD_CHECK_BIT_A      0x000498 
 156 #define PI_BAD_CHECK_BIT_B      0x0004a0 
 157 #define PI_NACK_CNT_A           0x0004a8 
 158 #define PI_NACK_CNT_B           0x0004b0 
 159 #define PI_NACK_CMP             0x0004b8 
 160 #define PI_STACKADDR_OFFSET     (PI_ERR_STACK_ADDR_B - PI_ERR_STACK_ADDR_A)
 161 #define PI_ERRSTAT_OFFSET       (PI_ERR_STATUS0_B - PI_ERR_STATUS0_A)
 162 #define PI_RDCLR_OFFSET         (PI_ERR_STATUS0_A_RCLR - PI_ERR_STATUS0_A)
 163 
 164 
 165 #define PI_ERR_SPOOL_CMP_B      0x00000001      
 166 #define PI_ERR_SPOOL_CMP_A      0x00000002
 167 #define PI_ERR_SPUR_MSG_B       0x00000004      
 168 #define PI_ERR_SPUR_MSG_A       0x00000008
 169 #define PI_ERR_WRB_TERR_B       0x00000010      
 170 #define PI_ERR_WRB_TERR_A       0x00000020
 171 #define PI_ERR_WRB_WERR_B       0x00000040      
 172 #define PI_ERR_WRB_WERR_A       0x00000080
 173 #define PI_ERR_SYSSTATE_B       0x00000100      
 174 #define PI_ERR_SYSSTATE_A       0x00000200
 175 #define PI_ERR_SYSAD_DATA_B     0x00000400      
 176 #define PI_ERR_SYSAD_DATA_A     0x00000800
 177 #define PI_ERR_SYSAD_ADDR_B     0x00001000      
 178 #define PI_ERR_SYSAD_ADDR_A     0x00002000
 179 #define PI_ERR_SYSCMD_DATA_B    0x00004000      
 180 #define PI_ERR_SYSCMD_DATA_A    0x00008000
 181 #define PI_ERR_SYSCMD_ADDR_B    0x00010000      
 182 #define PI_ERR_SYSCMD_ADDR_A    0x00020000
 183 #define PI_ERR_BAD_SPOOL_B      0x00040000      
 184 #define PI_ERR_BAD_SPOOL_A      0x00080000
 185 #define PI_ERR_UNCAC_UNCORR_B   0x00100000      
 186 #define PI_ERR_UNCAC_UNCORR_A   0x00200000
 187 #define PI_ERR_SYSSTATE_TAG_B   0x00400000      
 188 #define PI_ERR_SYSSTATE_TAG_A   0x00800000
 189 #define PI_ERR_MD_UNCORR        0x01000000      
 190 
 191 #define PI_ERR_CLEAR_ALL_A      0x00aaaaaa
 192 #define PI_ERR_CLEAR_ALL_B      0x00555555
 193 
 194 
 195 
 196 
 197 
 198 
 199 #define PI_FATAL_ERR_CPU_A      (PI_ERR_SYSSTATE_TAG_A  | \
 200                                  PI_ERR_BAD_SPOOL_A     | \
 201                                  PI_ERR_SYSCMD_ADDR_A   | \
 202                                  PI_ERR_SYSCMD_DATA_A   | \
 203                                  PI_ERR_SYSAD_ADDR_A    | \
 204                                  PI_ERR_SYSAD_DATA_A    | \
 205                                  PI_ERR_SYSSTATE_A)
 206 
 207 #define PI_MISC_ERR_CPU_A       (PI_ERR_UNCAC_UNCORR_A  | \
 208                                  PI_ERR_WRB_WERR_A      | \
 209                                  PI_ERR_WRB_TERR_A      | \
 210                                  PI_ERR_SPUR_MSG_A      | \
 211                                  PI_ERR_SPOOL_CMP_A)
 212 
 213 #define PI_FATAL_ERR_CPU_B      (PI_ERR_SYSSTATE_TAG_B  | \
 214                                  PI_ERR_BAD_SPOOL_B     | \
 215                                  PI_ERR_SYSCMD_ADDR_B   | \
 216                                  PI_ERR_SYSCMD_DATA_B   | \
 217                                  PI_ERR_SYSAD_ADDR_B    | \
 218                                  PI_ERR_SYSAD_DATA_B    | \
 219                                  PI_ERR_SYSSTATE_B)
 220 
 221 #define PI_MISC_ERR_CPU_B       (PI_ERR_UNCAC_UNCORR_B  | \
 222                                  PI_ERR_WRB_WERR_B      | \
 223                                  PI_ERR_WRB_TERR_B      | \
 224                                  PI_ERR_SPUR_MSG_B      | \
 225                                  PI_ERR_SPOOL_CMP_B)
 226 
 227 #define PI_ERR_GENERIC  (PI_ERR_MD_UNCORR)
 228 
 229 
 230 
 231 
 232 
 233 
 234 
 235 #define PI_ERR_ST0_TYPE_MASK    0x0000000000000007
 236 #define PI_ERR_ST0_TYPE_SHFT    0
 237 #define PI_ERR_ST0_REQNUM_MASK  0x0000000000000038
 238 #define PI_ERR_ST0_REQNUM_SHFT  3
 239 #define PI_ERR_ST0_SUPPL_MASK   0x000000000001ffc0
 240 #define PI_ERR_ST0_SUPPL_SHFT   6
 241 #define PI_ERR_ST0_CMD_MASK     0x0000000001fe0000
 242 #define PI_ERR_ST0_CMD_SHFT     17
 243 #define PI_ERR_ST0_ADDR_MASK    0x3ffffffffe000000
 244 #define PI_ERR_ST0_ADDR_SHFT    25
 245 #define PI_ERR_ST0_OVERRUN_MASK 0x4000000000000000
 246 #define PI_ERR_ST0_OVERRUN_SHFT 62
 247 #define PI_ERR_ST0_VALID_MASK   0x8000000000000000
 248 #define PI_ERR_ST0_VALID_SHFT   63
 249 
 250 
 251 #define PI_ERR_ST1_SPOOL_MASK   0x00000000001fffff
 252 #define PI_ERR_ST1_SPOOL_SHFT   0
 253 #define PI_ERR_ST1_TOUTCNT_MASK 0x000000001fe00000
 254 #define PI_ERR_ST1_TOUTCNT_SHFT 21
 255 #define PI_ERR_ST1_INVCNT_MASK  0x0000007fe0000000
 256 #define PI_ERR_ST1_INVCNT_SHFT  29
 257 #define PI_ERR_ST1_CRBNUM_MASK  0x0000038000000000
 258 #define PI_ERR_ST1_CRBNUM_SHFT  39
 259 #define PI_ERR_ST1_WRBRRB_MASK  0x0000040000000000
 260 #define PI_ERR_ST1_WRBRRB_SHFT  42
 261 #define PI_ERR_ST1_CRBSTAT_MASK 0x001ff80000000000
 262 #define PI_ERR_ST1_CRBSTAT_SHFT 43
 263 #define PI_ERR_ST1_MSGSRC_MASK  0xffe0000000000000
 264 #define PI_ERR_ST1_MSGSRC_SHFT  53
 265 
 266 
 267 #define PI_ERR_STK_TYPE_MASK    0x0000000000000003
 268 #define PI_ERR_STK_TYPE_SHFT    0
 269 #define PI_ERR_STK_SUPPL_MASK   0x0000000000000038
 270 #define PI_ERR_STK_SUPPL_SHFT   3
 271 #define PI_ERR_STK_REQNUM_MASK  0x00000000000001c0
 272 #define PI_ERR_STK_REQNUM_SHFT  6
 273 #define PI_ERR_STK_CRBNUM_MASK  0x0000000000000e00
 274 #define PI_ERR_STK_CRBNUM_SHFT  9
 275 #define PI_ERR_STK_WRBRRB_MASK  0x0000000000001000
 276 #define PI_ERR_STK_WRBRRB_SHFT  12
 277 #define PI_ERR_STK_CRBSTAT_MASK 0x00000000007fe000
 278 #define PI_ERR_STK_CRBSTAT_SHFT 13
 279 #define PI_ERR_STK_CMD_MASK     0x000000007f800000
 280 #define PI_ERR_STK_CMD_SHFT     23
 281 #define PI_ERR_STK_ADDR_MASK    0xffffffff80000000
 282 #define PI_ERR_STK_ADDR_SHFT    31
 283 
 284 
 285 #define PI_ERR_RD_PRERR         1
 286 #define PI_ERR_RD_DERR          2
 287 #define PI_ERR_RD_TERR          3
 288 
 289 
 290 #define PI_ERR_WR_WERR          0
 291 #define PI_ERR_WR_PWERR         1
 292 #define PI_ERR_WR_TERR          3
 293 
 294 
 295 #define PI_ERR_RRB      0
 296 #define PI_ERR_WRB      1
 297 #define PI_ERR_ANY_CRB  2
 298 
 299 
 300 #define ERR_STK_ADDR_SHFT       7
 301 #define ERR_STAT0_ADDR_SHFT     3
 302 
 303 #define PI_MIN_STACK_SIZE 4096  
 304 #define PI_STACK_SIZE_SHFT      12      
 305 
 306 #define ERR_STACK_SIZE_BYTES(_sz) \
 307        ((_sz) ? (PI_MIN_STACK_SIZE << ((_sz) - 1)) : 0)
 308 
 309 #ifndef __ASSEMBLY__
 310 
 311 
 312 
 313 
 314 struct err_stack_format {
 315         u64     sk_addr    : 33,   
 316                 sk_cmd     :  8,   
 317                 sk_crb_sts : 10,   
 318                 sk_rw_rb   :  1,   
 319                 sk_crb_num :  3,   
 320                 sk_t5_req  :  3,   
 321                 sk_suppl   :  3,   
 322                 sk_err_type:  3;   
 323 };
 324 
 325 typedef union pi_err_stack {
 326         u64     pi_stk_word;
 327         struct  err_stack_format pi_stk_fmt;
 328 } pi_err_stack_t;
 329 
 330 struct err_status0_format {
 331         u64     s0_valid   :  1,   
 332                 s0_ovr_run :  1,   
 333                 s0_addr    : 37,   
 334                 s0_cmd     :  8,   
 335                 s0_supl    : 11,   
 336                 s0_t5_req  :  3,   
 337                 s0_err_type:  3;   
 338 };
 339 
 340 typedef union pi_err_stat0 {
 341         u64     pi_stat0_word;
 342         struct err_status0_format pi_stat0_fmt;
 343 } pi_err_stat0_t;
 344 
 345 struct err_status1_format {
 346         u64     s1_src     : 11,   
 347                 s1_crb_sts : 10,   
 348                 s1_rw_rb   :  1,   
 349                 s1_crb_num :  3,   
 350                 s1_inval_cnt:10,   
 351                 s1_to_cnt  :  8,   
 352                 s1_spl_cnt : 21;   
 353 };
 354 
 355 typedef union pi_err_stat1 {
 356         u64     pi_stat1_word;
 357         struct err_status1_format pi_stat1_fmt;
 358 } pi_err_stat1_t;
 359 
 360 typedef u64     rtc_time_t;
 361 
 362 #endif 
 363 
 364 
 365 
 366 #define PI_SYSAD_ERRCHK_ECCGEN  0x01    
 367 #define PI_SYSAD_ERRCHK_QUALGEN 0x02    
 368 #define PI_SYSAD_ERRCHK_SADP    0x04    
 369 #define PI_SYSAD_ERRCHK_CMDP    0x08    
 370 #define PI_SYSAD_ERRCHK_STATE   0x10    
 371 #define PI_SYSAD_ERRCHK_QUAL    0x20    
 372 #define PI_SYSAD_CHECK_ALL      0x3f    
 373 
 374 
 375 
 376 #define HUB_IP_PEND0            0x0400
 377 #define HUB_IP_PEND1_CC         0x0800
 378 #define HUB_IP_RT               0x1000
 379 #define HUB_IP_PROF             0x2000
 380 #define HUB_IP_ERROR            0x4000
 381 #define HUB_IP_MASK             0x7c00
 382 
 383 
 384 
 385 #define PRLC_USE_INT_SHFT       16
 386 #define PRLC_USE_INT_MASK       (UINT64_CAST 1 << 16)
 387 #define PRLC_USE_INT            (UINT64_CAST 1 << 16)
 388 #define PRLC_GCLK_SHFT          15
 389 #define PRLC_GCLK_MASK          (UINT64_CAST 1 << 15)
 390 #define PRLC_GCLK               (UINT64_CAST 1 << 15)
 391 #define PRLC_GCLK_COUNT_SHFT    8
 392 #define PRLC_GCLK_COUNT_MASK    (UINT64_CAST 0x7f << 8)
 393 #define PRLC_MAX_COUNT_SHFT     1
 394 #define PRLC_MAX_COUNT_MASK     (UINT64_CAST 0x7f << 1)
 395 #define PRLC_GCLK_EN_SHFT       0
 396 #define PRLC_GCLK_EN_MASK       (UINT64_CAST 1)
 397 #define PRLC_GCLK_EN            (UINT64_CAST 1)
 398 
 399 
 400 
 401 
 402 
 403 
 404 #define PI_NACK_CNT_EN_SHFT     20
 405 #define PI_NACK_CNT_EN_MASK     0x100000
 406 #define PI_NACK_CNT_MASK        0x0fffff
 407 #define PI_NACK_CNT_MAX         0x0fffff
 408 
 409 #endif