xwidget.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:5k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  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. /*
  77.  * according to the crosstalk spec, only 32-bits access to the widget
  78.  * configuration registers is allowed.  some widgets may allow 64-bits
  79.  * access but software should not depend on it.  registers beyond the
  80.  * widget target flush register are widget dependent thus will not be
  81.  * defined here
  82.  */
  83. #ifndef __ASSEMBLY__
  84. typedef u32 widgetreg_t;
  85. /* widget configuration registers */
  86. typedef volatile struct widget_cfg {
  87. widgetreg_t w_pad_0; /* 0x00 */
  88. widgetreg_t w_id; /* 0x04 */
  89. widgetreg_t w_pad_1; /* 0x08 */
  90. widgetreg_t w_status; /* 0x0c */
  91. widgetreg_t w_pad_2; /* 0x10 */
  92. widgetreg_t w_err_upper_addr; /* 0x14 */
  93. widgetreg_t w_pad_3; /* 0x18 */
  94. widgetreg_t w_err_lower_addr; /* 0x1c */
  95. widgetreg_t w_pad_4; /* 0x20 */
  96. widgetreg_t w_control; /* 0x24 */
  97. widgetreg_t w_pad_5; /* 0x28 */
  98. widgetreg_t w_req_timeout; /* 0x2c */
  99. widgetreg_t w_pad_6; /* 0x30 */
  100. widgetreg_t w_intdest_upper_addr; /* 0x34 */
  101. widgetreg_t w_pad_7; /* 0x38 */
  102. widgetreg_t w_intdest_lower_addr; /* 0x3c */
  103. widgetreg_t w_pad_8; /* 0x40 */
  104. widgetreg_t w_err_cmd_word; /* 0x44 */
  105. widgetreg_t w_pad_9; /* 0x48 */
  106. widgetreg_t w_llp_cfg; /* 0x4c */
  107. widgetreg_t w_pad_10; /* 0x50 */
  108. widgetreg_t w_tflush; /* 0x54 */
  109. } widget_cfg_t;
  110. typedef struct {
  111. unsigned didn:4;
  112. unsigned sidn:4;
  113. unsigned pactyp:4;
  114. unsigned tnum:5;
  115. unsigned ct:1;
  116. unsigned ds:2;
  117. unsigned gbr:1;
  118. unsigned vbpm:1;
  119. unsigned error:1;
  120. unsigned bo:1;
  121. unsigned other:8;
  122. } w_err_cmd_word_f;
  123. typedef union {
  124. widgetreg_t r;
  125. w_err_cmd_word_f f;
  126. } w_err_cmd_word_u;
  127. typedef struct xwidget_info_s *xwidget_info_t;
  128. /*
  129.  * Crosstalk Widget Hardware Identification, as defined in the Crosstalk spec.
  130.  */
  131. typedef struct xwidget_hwid_s {
  132. xwidget_part_num_t part_num;
  133. xwidget_rev_num_t rev_num;
  134. xwidget_mfg_num_t mfg_num;
  135. } *xwidget_hwid_t;
  136. /*
  137.  * Returns 1 if a driver that handles devices described by hwid1 is able
  138.  * to manage a device with hardwareid hwid2.  NOTE: We don't check rev
  139.  * numbers at all.
  140.  */
  141. #define XWIDGET_HARDWARE_ID_MATCH(hwid1, hwid2) 
  142. (((hwid1)->part_num == (hwid2)->part_num) && 
  143. (((hwid1)->mfg_num == XWIDGET_MFG_NUM_NONE) || 
  144. ((hwid2)->mfg_num == XWIDGET_MFG_NUM_NONE) || 
  145. ((hwid1)->mfg_num == (hwid2)->mfg_num)))
  146. #endif /* !__ASSEMBLY__ */
  147. #endif /* _ASM_XTALK_XWIDGET_H */