xwidget.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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. * xwidget.h - generic crosstalk widget header file, derived from IRIX
  7. * <sys/xtalk/xtalkwidget.h>, revision 1.32.
  8. *
  9. * Copyright (C) 1996, 1999 Silcon Graphics, Inc.
  10. * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org)
  11. */
  12. #ifndef _ASM_XTALK_XWIDGET_H
  13. #define _ASM_XTALK_XWIDGET_H
  14. #include <linux/types.h>
  15. #include <asm/xtalk/xtalk.h>
  16. #define WIDGET_ID 0x04
  17. #define WIDGET_STATUS 0x0c
  18. #define WIDGET_ERR_UPPER_ADDR 0x14
  19. #define WIDGET_ERR_LOWER_ADDR 0x1c
  20. #define WIDGET_CONTROL 0x24
  21. #define WIDGET_REQ_TIMEOUT 0x2c
  22. #define WIDGET_INTDEST_UPPER_ADDR 0x34
  23. #define WIDGET_INTDEST_LOWER_ADDR 0x3c
  24. #define WIDGET_ERR_CMD_WORD 0x44
  25. #define WIDGET_LLP_CFG 0x4c
  26. #define WIDGET_TFLUSH 0x54
  27. /* WIDGET_ID */
  28. #define WIDGET_REV_NUM 0xf0000000
  29. #define WIDGET_PART_NUM 0x0ffff000
  30. #define WIDGET_MFG_NUM 0x00000ffe
  31. #define WIDGET_REV_NUM_SHFT 28
  32. #define WIDGET_PART_NUM_SHFT 12
  33. #define WIDGET_MFG_NUM_SHFT 1
  34. #define XWIDGET_PART_NUM(widgetid) (((widgetid) & WIDGET_PART_NUM) >> WIDGET_PART_NUM_SHFT)
  35. #define XWIDGET_REV_NUM(widgetid) (((widgetid) & WIDGET_REV_NUM) >> WIDGET_REV_NUM_SHFT)
  36. #define XWIDGET_MFG_NUM(widgetid) (((widgetid) & WIDGET_MFG_NUM) >> WIDGET_MFG_NUM_SHFT)
  37. /* WIDGET_STATUS */
  38. #define WIDGET_LLP_REC_CNT 0xff000000
  39. #define WIDGET_LLP_TX_CNT 0x00ff0000
  40. #define WIDGET_PENDING 0x0000001f
  41. /* WIDGET_ERR_UPPER_ADDR */
  42. #define WIDGET_ERR_UPPER_ADDR_ONLY 0x0000ffff
  43. /* WIDGET_CONTROL */
  44. #define WIDGET_F_BAD_PKT 0x00010000
  45. #define WIDGET_LLP_XBAR_CRD 0x0000f000
  46. #define WIDGET_LLP_XBAR_CRD_SHFT 12
  47. #define WIDGET_CLR_RLLP_CNT 0x00000800
  48. #define WIDGET_CLR_TLLP_CNT 0x00000400
  49. #define WIDGET_SYS_END 0x00000200
  50. #define WIDGET_MAX_TRANS 0x000001f0
  51. #define WIDGET_WIDGET_ID 0x0000000f
  52. /* WIDGET_INTDEST_UPPER_ADDR */
  53. #define WIDGET_INT_VECTOR 0xff000000
  54. #define WIDGET_INT_VECTOR_SHFT 24
  55. #define WIDGET_TARGET_ID 0x000f0000
  56. #define WIDGET_TARGET_ID_SHFT 16
  57. #define WIDGET_UPP_ADDR 0x0000ffff
  58. /* WIDGET_ERR_CMD_WORD */
  59. #define WIDGET_DIDN 0xf0000000
  60. #define WIDGET_SIDN 0x0f000000
  61. #define WIDGET_PACTYP 0x00f00000
  62. #define WIDGET_TNUM 0x000f8000
  63. #define WIDGET_COHERENT 0x00004000
  64. #define WIDGET_DS 0x00003000
  65. #define WIDGET_GBR 0x00000800
  66. #define WIDGET_VBPM 0x00000400
  67. #define WIDGET_ERROR 0x00000200
  68. #define WIDGET_BARRIER 0x00000100
  69. /* WIDGET_LLP_CFG */
  70. #define WIDGET_LLP_MAXRETRY 0x03ff0000
  71. #define WIDGET_LLP_MAXRETRY_SHFT 16
  72. #define WIDGET_LLP_NULLTIMEOUT 0x0000fc00
  73. #define WIDGET_LLP_NULLTIMEOUT_SHFT 10
  74. #define WIDGET_LLP_MAXBURST 0x000003ff
  75. #define WIDGET_LLP_MAXBURST_SHFT 0
  76. /* Xtalk Widget Device Mfgr Nums */
  77. #define WIDGET_XBOW_MFGR_NUM 0x0 /* IP30 XBow Chip */
  78. #define WIDGET_XXBOW_MFGR_NUM 0x0 /* IP35 Xbow + XBridge Chip */
  79. #define WIDGET_ODYS_MFGR_NUM 0x023 /* Odyssey / VPro GFX */
  80. #define WIDGET_TPU_MFGR_NUM 0x024 /* Tensor Processor Unit */
  81. #define WIDGET_XBRDG_MFGR_NUM 0x024 /* IP35 XBridge Chip */
  82. #define WIDGET_HEART_MFGR_NUM 0x036 /* IP30 HEART Chip */
  83. #define WIDGET_BRIDG_MFGR_NUM 0x036 /* PCI Bridge */
  84. #define WIDGET_HUB_MFGR_NUM 0x036 /* IP27 Hub Chip */
  85. #define WIDGET_BDRCK_MFGR_NUM 0x036 /* IP35 Bedrock Chip */
  86. #define WIDGET_IMPCT_MFGR_NUM 0x2aa /* HQ4 / Impact GFX */
  87. #define WIDGET_KONA_MFGR_NUM 0x2aa /* InfiniteReality3 / Kona GFX */
  88. #define WIDGET_NULL_MFGR_NUM -1 /* NULL */
  89. /* Xtalk Widget Device Part Nums */
  90. #define WIDGET_XBOW_PART_NUM 0x0000
  91. #define WIDGET_HEART_PART_NUM 0xc001
  92. #define WIDGET_BRIDG_PART_NUM 0xc002
  93. #define WIDGET_IMPCT_PART_NUM 0xc003
  94. #define WIDGET_ODYS_PART_NUM 0xc013
  95. #define WIDGET_HUB_PART_NUM 0xc101
  96. #define WIDGET_KONA_PART_NUM 0xc102
  97. #define WIDGET_BDRCK_PART_NUM 0xc110
  98. #define WIDGET_TPU_PART_NUM 0xc202
  99. #define WIDGET_XXBOW_PART_NUM 0xd000
  100. #define WIDGET_XBRDG_PART_NUM 0xd002
  101. #define WIDGET_NULL_PART_NUM -1
  102. /* For Xtalk Widget identification */
  103. struct widget_ident {
  104. u32 mfgr;
  105. u32 part;
  106. char *name;
  107. char *revs[16];
  108. };
  109. /* Known Xtalk Widgets */
  110. static const struct widget_ident __initconst widget_idents[] = {
  111. {
  112. WIDGET_XBOW_MFGR_NUM,
  113. WIDGET_XBOW_PART_NUM,
  114. "xbow",
  115. {NULL, "1.0", "1.1", "1.2", "1.3", "2.0", NULL},
  116. },
  117. {
  118. WIDGET_HEART_MFGR_NUM,
  119. WIDGET_HEART_PART_NUM,
  120. "heart",
  121. {NULL, "A", "B", "C", "D", "E", "F", NULL},
  122. },
  123. {
  124. WIDGET_BRIDG_MFGR_NUM,
  125. WIDGET_BRIDG_PART_NUM,
  126. "bridge",
  127. {NULL, "A", "B", "C", "D", NULL},
  128. },
  129. {
  130. WIDGET_IMPCT_MFGR_NUM,
  131. WIDGET_IMPCT_PART_NUM,
  132. "impact",
  133. {NULL, "A", "B", NULL},
  134. },
  135. {
  136. WIDGET_ODYS_MFGR_NUM,
  137. WIDGET_ODYS_PART_NUM,
  138. "odyssey",
  139. {NULL, "A", "B", NULL},
  140. },
  141. {
  142. WIDGET_HUB_MFGR_NUM,
  143. WIDGET_HUB_PART_NUM,
  144. "hub",
  145. {NULL, "1.0", "2.0", "2.1", "2.2", "2.3", "2.4", NULL},
  146. },
  147. {
  148. WIDGET_KONA_MFGR_NUM,
  149. WIDGET_KONA_PART_NUM,
  150. "kona",
  151. {NULL},
  152. },
  153. {
  154. WIDGET_BDRCK_MFGR_NUM,
  155. WIDGET_BDRCK_PART_NUM,
  156. "bedrock",
  157. {NULL, "1.0", "1.1", NULL},
  158. },
  159. {
  160. WIDGET_TPU_MFGR_NUM,
  161. WIDGET_TPU_PART_NUM,
  162. "tpu",
  163. {"0", NULL},
  164. },
  165. {
  166. WIDGET_XXBOW_MFGR_NUM,
  167. WIDGET_XXBOW_PART_NUM,
  168. "xxbow",
  169. {NULL, "1.0", "2.0", NULL},
  170. },
  171. {
  172. WIDGET_XBRDG_MFGR_NUM,
  173. WIDGET_XBRDG_PART_NUM,
  174. "xbridge",
  175. {NULL, "A", "B", NULL},
  176. },
  177. {
  178. WIDGET_NULL_MFGR_NUM,
  179. WIDGET_NULL_PART_NUM,
  180. NULL,
  181. {NULL},
  182. }
  183. };
  184. /*
  185. * according to the crosstalk spec, only 32-bits access to the widget
  186. * configuration registers is allowed. some widgets may allow 64-bits
  187. * access but software should not depend on it. registers beyond the
  188. * widget target flush register are widget dependent thus will not be
  189. * defined here
  190. */
  191. #ifndef __ASSEMBLY__
  192. typedef u32 widgetreg_t;
  193. /* widget configuration registers */
  194. typedef volatile struct widget_cfg {
  195. widgetreg_t w_pad_0; /* 0x00 */
  196. widgetreg_t w_id; /* 0x04 */
  197. widgetreg_t w_pad_1; /* 0x08 */
  198. widgetreg_t w_status; /* 0x0c */
  199. widgetreg_t w_pad_2; /* 0x10 */
  200. widgetreg_t w_err_upper_addr; /* 0x14 */
  201. widgetreg_t w_pad_3; /* 0x18 */
  202. widgetreg_t w_err_lower_addr; /* 0x1c */
  203. widgetreg_t w_pad_4; /* 0x20 */
  204. widgetreg_t w_control; /* 0x24 */
  205. widgetreg_t w_pad_5; /* 0x28 */
  206. widgetreg_t w_req_timeout; /* 0x2c */
  207. widgetreg_t w_pad_6; /* 0x30 */
  208. widgetreg_t w_intdest_upper_addr; /* 0x34 */
  209. widgetreg_t w_pad_7; /* 0x38 */
  210. widgetreg_t w_intdest_lower_addr; /* 0x3c */
  211. widgetreg_t w_pad_8; /* 0x40 */
  212. widgetreg_t w_err_cmd_word; /* 0x44 */
  213. widgetreg_t w_pad_9; /* 0x48 */
  214. widgetreg_t w_llp_cfg; /* 0x4c */
  215. widgetreg_t w_pad_10; /* 0x50 */
  216. widgetreg_t w_tflush; /* 0x54 */
  217. } widget_cfg_t;
  218. typedef struct {
  219. unsigned didn:4;
  220. unsigned sidn:4;
  221. unsigned pactyp:4;
  222. unsigned tnum:5;
  223. unsigned ct:1;
  224. unsigned ds:2;
  225. unsigned gbr:1;
  226. unsigned vbpm:1;
  227. unsigned error:1;
  228. unsigned bo:1;
  229. unsigned other:8;
  230. } w_err_cmd_word_f;
  231. typedef union {
  232. widgetreg_t r;
  233. w_err_cmd_word_f f;
  234. } w_err_cmd_word_u;
  235. typedef struct xwidget_info_s *xwidget_info_t;
  236. /*
  237. * Crosstalk Widget Hardware Identification, as defined in the Crosstalk spec.
  238. */
  239. typedef struct xwidget_hwid_s {
  240. xwidget_part_num_t part_num;
  241. xwidget_rev_num_t rev_num;
  242. xwidget_mfg_num_t mfg_num;
  243. } *xwidget_hwid_t;
  244. /*
  245. * Returns 1 if a driver that handles devices described by hwid1 is able
  246. * to manage a device with hardwareid hwid2. NOTE: We don't check rev
  247. * numbers at all.
  248. */
  249. #define XWIDGET_HARDWARE_ID_MATCH(hwid1, hwid2) \
  250. (((hwid1)->part_num == (hwid2)->part_num) && \
  251. (((hwid1)->mfg_num == XWIDGET_MFG_NUM_NONE) || \
  252. ((hwid2)->mfg_num == XWIDGET_MFG_NUM_NONE) || \
  253. ((hwid1)->mfg_num == (hwid2)->mfg_num)))
  254. #endif /* !__ASSEMBLY__ */
  255. #endif /* _ASM_XTALK_XWIDGET_H */