hubni.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Derived from IRIX <sys/SN/SN0/hubni.h>, Revision 1.27.
  7. *
  8. * Copyright (C) 1992-1997, 1999 Silicon Graphics, Inc.
  9. * Copyright (C) 1999 by Ralf Baechle
  10. */
  11. #ifndef _ASM_SGI_SN0_HUBNI_H
  12. #define _ASM_SGI_SN0_HUBNI_H
  13. #ifndef __ASSEMBLY__
  14. #include <linux/types.h>
  15. #endif
  16. /*
  17. * Hub Network Interface registers
  18. *
  19. * All registers in this file are subject to change until Hub chip tapeout.
  20. */
  21. #define NI_BASE 0x600000
  22. #define NI_BASE_TABLES 0x630000
  23. #define NI_STATUS_REV_ID 0x600000 /* Hub network status, rev, and ID */
  24. #define NI_PORT_RESET 0x600008 /* Reset the network interface */
  25. #define NI_PROTECTION 0x600010 /* NI register access permissions */
  26. #define NI_GLOBAL_PARMS 0x600018 /* LLP parameters */
  27. #define NI_SCRATCH_REG0 0x600100 /* Scratch register 0 (64 bits) */
  28. #define NI_SCRATCH_REG1 0x600108 /* Scratch register 1 (64 bits) */
  29. #define NI_DIAG_PARMS 0x600110 /* Parameters for diags */
  30. #define NI_VECTOR_PARMS 0x600200 /* Vector PIO routing parameters */
  31. #define NI_VECTOR 0x600208 /* Vector PIO route */
  32. #define NI_VECTOR_DATA 0x600210 /* Vector PIO data */
  33. #define NI_VECTOR_STATUS 0x600300 /* Vector PIO return status */
  34. #define NI_RETURN_VECTOR 0x600308 /* Vector PIO return vector */
  35. #define NI_VECTOR_READ_DATA 0x600310 /* Vector PIO read data */
  36. #define NI_VECTOR_CLEAR 0x600380 /* Vector PIO read & clear status */
  37. #define NI_IO_PROTECT 0x600400 /* PIO protection bits */
  38. #define NI_IO_PROT_OVRRD 0x600408 /* PIO protection bit override */
  39. #define NI_AGE_CPU0_MEMORY 0x600500 /* CPU 0 memory age control */
  40. #define NI_AGE_CPU0_PIO 0x600508 /* CPU 0 PIO age control */
  41. #define NI_AGE_CPU1_MEMORY 0x600510 /* CPU 1 memory age control */
  42. #define NI_AGE_CPU1_PIO 0x600518 /* CPU 1 PIO age control */
  43. #define NI_AGE_GBR_MEMORY 0x600520 /* GBR memory age control */
  44. #define NI_AGE_GBR_PIO 0x600528 /* GBR PIO age control */
  45. #define NI_AGE_IO_MEMORY 0x600530 /* IO memory age control */
  46. #define NI_AGE_IO_PIO 0x600538 /* IO PIO age control */
  47. #define NI_AGE_REG_MIN NI_AGE_CPU0_MEMORY
  48. #define NI_AGE_REG_MAX NI_AGE_IO_PIO
  49. #define NI_PORT_PARMS 0x608000 /* LLP Parameters */
  50. #define NI_PORT_ERROR 0x608008 /* LLP Errors */
  51. #define NI_PORT_ERROR_CLEAR 0x608088 /* Clear the error bits */
  52. #define NI_META_TABLE0 0x638000 /* First meta routing table entry */
  53. #define NI_META_TABLE(_x) (NI_META_TABLE0 + (8 * (_x)))
  54. #define NI_META_ENTRIES 32
  55. #define NI_LOCAL_TABLE0 0x638100 /* First local routing table entry */
  56. #define NI_LOCAL_TABLE(_x) (NI_LOCAL_TABLE0 + (8 * (_x)))
  57. #define NI_LOCAL_ENTRIES 16
  58. /*
  59. * NI_STATUS_REV_ID mask and shift definitions
  60. * Have to use UINT64_CAST instead of 'L' suffix, for assembler.
  61. */
  62. #define NSRI_8BITMODE_SHFT 30
  63. #define NSRI_8BITMODE_MASK (UINT64_CAST 0x1 << 30)
  64. #define NSRI_LINKUP_SHFT 29
  65. #define NSRI_LINKUP_MASK (UINT64_CAST 0x1 << 29)
  66. #define NSRI_DOWNREASON_SHFT 28 /* 0=failed, 1=never came */
  67. #define NSRI_DOWNREASON_MASK (UINT64_CAST 0x1 << 28) /* out of reset. */
  68. #define NSRI_MORENODES_SHFT 18
  69. #define NSRI_MORENODES_MASK (UINT64_CAST 1 << 18) /* Max. # of nodes */
  70. #define MORE_MEMORY 0
  71. #define MORE_NODES 1
  72. #define NSRI_REGIONSIZE_SHFT 17
  73. #define NSRI_REGIONSIZE_MASK (UINT64_CAST 1 << 17) /* Granularity */
  74. #define REGIONSIZE_FINE 1
  75. #define REGIONSIZE_COARSE 0
  76. #define NSRI_NODEID_SHFT 8
  77. #define NSRI_NODEID_MASK (UINT64_CAST 0x1ff << 8)/* Node (Hub) ID */
  78. #define NSRI_REV_SHFT 4
  79. #define NSRI_REV_MASK (UINT64_CAST 0xf << 4) /* Chip Revision */
  80. #define NSRI_CHIPID_SHFT 0
  81. #define NSRI_CHIPID_MASK (UINT64_CAST 0xf) /* Chip type ID */
  82. /*
  83. * In fine mode, each node is a region. In coarse mode, there are
  84. * eight nodes per region.
  85. */
  86. #define NASID_TO_FINEREG_SHFT 0
  87. #define NASID_TO_COARSEREG_SHFT 3
  88. /* NI_PORT_RESET mask definitions */
  89. #define NPR_PORTRESET (UINT64_CAST 1 << 7) /* Send warm reset */
  90. #define NPR_LINKRESET (UINT64_CAST 1 << 1) /* Send link reset */
  91. #define NPR_LOCALRESET (UINT64_CAST 1) /* Reset entire hub */
  92. /* NI_PROTECTION mask and shift definitions */
  93. #define NPROT_RESETOK (UINT64_CAST 1)
  94. /* NI_GLOBAL_PARMS mask and shift definitions */
  95. #define NGP_MAXRETRY_SHFT 48 /* Maximum retries */
  96. #define NGP_MAXRETRY_MASK (UINT64_CAST 0x3ff << 48)
  97. #define NGP_TAILTOWRAP_SHFT 32 /* Tail timeout wrap */
  98. #define NGP_TAILTOWRAP_MASK (UINT64_CAST 0xffff << 32)
  99. #define NGP_CREDITTOVAL_SHFT 16 /* Tail timeout wrap */
  100. #define NGP_CREDITTOVAL_MASK (UINT64_CAST 0xf << 16)
  101. #define NGP_TAILTOVAL_SHFT 4 /* Tail timeout value */
  102. #define NGP_TAILTOVAL_MASK (UINT64_CAST 0xf << 4)
  103. /* NI_DIAG_PARMS mask and shift definitions */
  104. #define NDP_PORTTORESET (UINT64_CAST 1 << 18) /* Port tmout reset */
  105. #define NDP_LLP8BITMODE (UINT64_CAST 1 << 12) /* LLP 8-bit mode */
  106. #define NDP_PORTDISABLE (UINT64_CAST 1 << 6) /* Port disable */
  107. #define NDP_SENDERROR (UINT64_CAST 1) /* Send data error */
  108. /*
  109. * NI_VECTOR_PARMS mask and shift definitions.
  110. * TYPE may be any of the first four PIOTYPEs defined under NI_VECTOR_STATUS.
  111. */
  112. #define NVP_PIOID_SHFT 40
  113. #define NVP_PIOID_MASK (UINT64_CAST 0x3ff << 40)
  114. #define NVP_WRITEID_SHFT 32
  115. #define NVP_WRITEID_MASK (UINT64_CAST 0xff << 32)
  116. #define NVP_ADDRESS_MASK (UINT64_CAST 0xffff8) /* Bits 19:3 */
  117. #define NVP_TYPE_SHFT 0
  118. #define NVP_TYPE_MASK (UINT64_CAST 0x3)
  119. /* NI_VECTOR_STATUS mask and shift definitions */
  120. #define NVS_VALID (UINT64_CAST 1 << 63)
  121. #define NVS_OVERRUN (UINT64_CAST 1 << 62)
  122. #define NVS_TARGET_SHFT 51
  123. #define NVS_TARGET_MASK (UINT64_CAST 0x3ff << 51)
  124. #define NVS_PIOID_SHFT 40
  125. #define NVS_PIOID_MASK (UINT64_CAST 0x3ff << 40)
  126. #define NVS_WRITEID_SHFT 32
  127. #define NVS_WRITEID_MASK (UINT64_CAST 0xff << 32)
  128. #define NVS_ADDRESS_MASK (UINT64_CAST 0xfffffff8) /* Bits 31:3 */
  129. #define NVS_TYPE_SHFT 0
  130. #define NVS_TYPE_MASK (UINT64_CAST 0x7)
  131. #define NVS_ERROR_MASK (UINT64_CAST 0x4) /* bit set means error */
  132. #define PIOTYPE_READ 0 /* VECTOR_PARMS and VECTOR_STATUS */
  133. #define PIOTYPE_WRITE 1 /* VECTOR_PARMS and VECTOR_STATUS */
  134. #define PIOTYPE_UNDEFINED 2 /* VECTOR_PARMS and VECTOR_STATUS */
  135. #define PIOTYPE_EXCHANGE 3 /* VECTOR_PARMS and VECTOR_STATUS */
  136. #define PIOTYPE_ADDR_ERR 4 /* VECTOR_STATUS only */
  137. #define PIOTYPE_CMD_ERR 5 /* VECTOR_STATUS only */
  138. #define PIOTYPE_PROT_ERR 6 /* VECTOR_STATUS only */
  139. #define PIOTYPE_UNKNOWN 7 /* VECTOR_STATUS only */
  140. /* NI_AGE_XXX mask and shift definitions */
  141. #define NAGE_VCH_SHFT 10
  142. #define NAGE_VCH_MASK (UINT64_CAST 3 << 10)
  143. #define NAGE_CC_SHFT 8
  144. #define NAGE_CC_MASK (UINT64_CAST 3 << 8)
  145. #define NAGE_AGE_SHFT 0
  146. #define NAGE_AGE_MASK (UINT64_CAST 0xff)
  147. #define NAGE_MASK (NAGE_VCH_MASK | NAGE_CC_MASK | NAGE_AGE_MASK)
  148. #define VCHANNEL_A 0
  149. #define VCHANNEL_B 1
  150. #define VCHANNEL_ANY 2
  151. /* NI_PORT_PARMS mask and shift definitions */
  152. #define NPP_NULLTO_SHFT 10
  153. #define NPP_NULLTO_MASK (UINT64_CAST 0x3f << 16)
  154. #define NPP_MAXBURST_SHFT 0
  155. #define NPP_MAXBURST_MASK (UINT64_CAST 0x3ff)
  156. #define NPP_RESET_DFLT_HUB20 ((UINT64_CAST 1 << NPP_NULLTO_SHFT) | \
  157. (UINT64_CAST 0x3f0 << NPP_MAXBURST_SHFT))
  158. #define NPP_RESET_DEFAULTS ((UINT64_CAST 6 << NPP_NULLTO_SHFT) | \
  159. (UINT64_CAST 0x3f0 << NPP_MAXBURST_SHFT))
  160. /* NI_PORT_ERROR mask and shift definitions */
  161. #define NPE_LINKRESET (UINT64_CAST 1 << 37)
  162. #define NPE_INTERNALERROR (UINT64_CAST 1 << 36)
  163. #define NPE_BADMESSAGE (UINT64_CAST 1 << 35)
  164. #define NPE_BADDEST (UINT64_CAST 1 << 34)
  165. #define NPE_FIFOOVERFLOW (UINT64_CAST 1 << 33)
  166. #define NPE_CREDITTO_SHFT 28
  167. #define NPE_CREDITTO_MASK (UINT64_CAST 0xf << 28)
  168. #define NPE_TAILTO_SHFT 24
  169. #define NPE_TAILTO_MASK (UINT64_CAST 0xf << 24)
  170. #define NPE_RETRYCOUNT_SHFT 16
  171. #define NPE_RETRYCOUNT_MASK (UINT64_CAST 0xff << 16)
  172. #define NPE_CBERRCOUNT_SHFT 8
  173. #define NPE_CBERRCOUNT_MASK (UINT64_CAST 0xff << 8)
  174. #define NPE_SNERRCOUNT_SHFT 0
  175. #define NPE_SNERRCOUNT_MASK (UINT64_CAST 0xff << 0)
  176. #define NPE_MASK 0x3effffffff
  177. #define NPE_COUNT_MAX 0xff
  178. #define NPE_FATAL_ERRORS (NPE_LINKRESET | NPE_INTERNALERROR | \
  179. NPE_BADMESSAGE | NPE_BADDEST | \
  180. NPE_FIFOOVERFLOW | NPE_CREDITTO_MASK | \
  181. NPE_TAILTO_MASK)
  182. /* NI_META_TABLE mask and shift definitions */
  183. #define NMT_EXIT_PORT_MASK (UINT64_CAST 0xf)
  184. /* NI_LOCAL_TABLE mask and shift definitions */
  185. #define NLT_EXIT_PORT_MASK (UINT64_CAST 0xf)
  186. #ifndef __ASSEMBLY__
  187. typedef union hubni_port_error_u {
  188. u64 nipe_reg_value;
  189. struct {
  190. u64 nipe_rsvd: 26, /* unused */
  191. nipe_lnk_reset: 1, /* link reset */
  192. nipe_intl_err: 1, /* internal error */
  193. nipe_bad_msg: 1, /* bad message */
  194. nipe_bad_dest: 1, /* bad dest */
  195. nipe_fifo_ovfl: 1, /* fifo overflow */
  196. nipe_rsvd1: 1, /* unused */
  197. nipe_credit_to: 4, /* credit timeout */
  198. nipe_tail_to: 4, /* tail timeout */
  199. nipe_retry_cnt: 8, /* retry error count */
  200. nipe_cb_cnt: 8, /* checkbit error count */
  201. nipe_sn_cnt: 8; /* sequence number count */
  202. } nipe_fields_s;
  203. } hubni_port_error_t;
  204. #define NI_LLP_RETRY_MAX 0xff
  205. #define NI_LLP_CB_MAX 0xff
  206. #define NI_LLP_SN_MAX 0xff
  207. #endif /* !__ASSEMBLY__ */
  208. #endif /* _ASM_SGI_SN0_HUBNI_H */