scu_completion_codes.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. /*
  2. * This file is provided under a dual BSD/GPLv2 license. When using or
  3. * redistributing this file, you may do so under either license.
  4. *
  5. * GPL LICENSE SUMMARY
  6. *
  7. * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of version 2 of the GNU General Public License as
  11. * published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  21. * The full GNU General Public License is included in this distribution
  22. * in the file called LICENSE.GPL.
  23. *
  24. * BSD LICENSE
  25. *
  26. * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
  27. * All rights reserved.
  28. *
  29. * Redistribution and use in source and binary forms, with or without
  30. * modification, are permitted provided that the following conditions
  31. * are met:
  32. *
  33. * * Redistributions of source code must retain the above copyright
  34. * notice, this list of conditions and the following disclaimer.
  35. * * Redistributions in binary form must reproduce the above copyright
  36. * notice, this list of conditions and the following disclaimer in
  37. * the documentation and/or other materials provided with the
  38. * distribution.
  39. * * Neither the name of Intel Corporation nor the names of its
  40. * contributors may be used to endorse or promote products derived
  41. * from this software without specific prior written permission.
  42. *
  43. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  44. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  45. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  46. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  47. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  48. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  49. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  50. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  51. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  52. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  53. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  54. */
  55. #ifndef _SCU_COMPLETION_CODES_HEADER_
  56. #define _SCU_COMPLETION_CODES_HEADER_
  57. /**
  58. * This file contains the constants and macros for the SCU hardware completion
  59. * codes.
  60. *
  61. *
  62. */
  63. #define SCU_COMPLETION_TYPE_SHIFT 28
  64. #define SCU_COMPLETION_TYPE_MASK 0x70000000
  65. /**
  66. * SCU_COMPLETION_TYPE() -
  67. *
  68. * This macro constructs an SCU completion type
  69. */
  70. #define SCU_COMPLETION_TYPE(type) \
  71. ((u32)(type) << SCU_COMPLETION_TYPE_SHIFT)
  72. /**
  73. * SCU_COMPLETION_TYPE() -
  74. *
  75. * These macros contain the SCU completion types SCU_COMPLETION_TYPE
  76. */
  77. #define SCU_COMPLETION_TYPE_TASK SCU_COMPLETION_TYPE(0)
  78. #define SCU_COMPLETION_TYPE_SDMA SCU_COMPLETION_TYPE(1)
  79. #define SCU_COMPLETION_TYPE_UFI SCU_COMPLETION_TYPE(2)
  80. #define SCU_COMPLETION_TYPE_EVENT SCU_COMPLETION_TYPE(3)
  81. #define SCU_COMPLETION_TYPE_NOTIFY SCU_COMPLETION_TYPE(4)
  82. /**
  83. *
  84. *
  85. * These constants provide the shift and mask values for the various parts of
  86. * an SCU completion code.
  87. */
  88. #define SCU_COMPLETION_STATUS_MASK 0x0FFC0000
  89. #define SCU_COMPLETION_TL_STATUS_MASK 0x0FC00000
  90. #define SCU_COMPLETION_TL_STATUS_SHIFT 22
  91. #define SCU_COMPLETION_SDMA_STATUS_MASK 0x003C0000
  92. #define SCU_COMPLETION_PEG_MASK 0x00010000
  93. #define SCU_COMPLETION_PORT_MASK 0x00007000
  94. #define SCU_COMPLETION_PE_MASK SCU_COMPLETION_PORT_MASK
  95. #define SCU_COMPLETION_PE_SHIFT 12
  96. #define SCU_COMPLETION_INDEX_MASK 0x00000FFF
  97. /**
  98. * SCU_GET_COMPLETION_TYPE() -
  99. *
  100. * This macro returns the SCU completion type.
  101. */
  102. #define SCU_GET_COMPLETION_TYPE(completion_code) \
  103. ((completion_code) & SCU_COMPLETION_TYPE_MASK)
  104. /**
  105. * SCU_GET_COMPLETION_STATUS() -
  106. *
  107. * This macro returns the SCU completion status.
  108. */
  109. #define SCU_GET_COMPLETION_STATUS(completion_code) \
  110. ((completion_code) & SCU_COMPLETION_STATUS_MASK)
  111. /**
  112. * SCU_GET_COMPLETION_TL_STATUS() -
  113. *
  114. * This macro returns the transport layer completion status.
  115. */
  116. #define SCU_GET_COMPLETION_TL_STATUS(completion_code) \
  117. ((completion_code) & SCU_COMPLETION_TL_STATUS_MASK)
  118. /**
  119. * SCU_MAKE_COMPLETION_STATUS() -
  120. *
  121. * This macro takes a completion code and performs the shift and mask
  122. * operations to turn it into a completion code that can be compared to a
  123. * SCU_GET_COMPLETION_TL_STATUS.
  124. */
  125. #define SCU_MAKE_COMPLETION_STATUS(completion_code) \
  126. ((u32)(completion_code) << SCU_COMPLETION_TL_STATUS_SHIFT)
  127. /**
  128. * SCU_NORMALIZE_COMPLETION_STATUS() -
  129. *
  130. * This macro takes a SCU_GET_COMPLETION_TL_STATUS and normalizes it for a
  131. * return code.
  132. */
  133. #define SCU_NORMALIZE_COMPLETION_STATUS(completion_code) \
  134. (\
  135. ((completion_code) & SCU_COMPLETION_TL_STATUS_MASK) \
  136. >> SCU_COMPLETION_TL_STATUS_SHIFT \
  137. )
  138. /**
  139. * SCU_GET_COMPLETION_SDMA_STATUS() -
  140. *
  141. * This macro returns the SDMA completion status.
  142. */
  143. #define SCU_GET_COMPLETION_SDMA_STATUS(completion_code) \
  144. ((completion_code) & SCU_COMPLETION_SDMA_STATUS_MASK)
  145. /**
  146. * SCU_GET_COMPLETION_PEG() -
  147. *
  148. * This macro returns the Protocol Engine Group from the completion code.
  149. */
  150. #define SCU_GET_COMPLETION_PEG(completion_code) \
  151. ((completion_code) & SCU_COMPLETION_PEG_MASK)
  152. /**
  153. * SCU_GET_COMPLETION_PORT() -
  154. *
  155. * This macro reuturns the logical port index from the completion code.
  156. */
  157. #define SCU_GET_COMPLETION_PORT(completion_code) \
  158. ((completion_code) & SCU_COMPLETION_PORT_MASK)
  159. /**
  160. * SCU_GET_PROTOCOL_ENGINE_INDEX() -
  161. *
  162. * This macro returns the PE index from the completion code.
  163. */
  164. #define SCU_GET_PROTOCOL_ENGINE_INDEX(completion_code) \
  165. (((completion_code) & SCU_COMPLETION_PE_MASK) >> SCU_COMPLETION_PE_SHIFT)
  166. /**
  167. * SCU_GET_COMPLETION_INDEX() -
  168. *
  169. * This macro returns the index of the completion which is either a TCi or an
  170. * RNi depending on the completion type.
  171. */
  172. #define SCU_GET_COMPLETION_INDEX(completion_code) \
  173. ((completion_code) & SCU_COMPLETION_INDEX_MASK)
  174. #define SCU_UNSOLICITED_FRAME_MASK 0x0FFF0000
  175. #define SCU_UNSOLICITED_FRAME_SHIFT 16
  176. /**
  177. * SCU_GET_FRAME_INDEX() -
  178. *
  179. * This macro returns a normalized frame index from an unsolicited frame
  180. * completion.
  181. */
  182. #define SCU_GET_FRAME_INDEX(completion_code) \
  183. (\
  184. ((completion_code) & SCU_UNSOLICITED_FRAME_MASK) \
  185. >> SCU_UNSOLICITED_FRAME_SHIFT \
  186. )
  187. #define SCU_UNSOLICITED_FRAME_ERROR_MASK 0x00008000
  188. /**
  189. * SCU_GET_FRAME_ERROR() -
  190. *
  191. * This macro returns a zero (0) value if there is no frame error otherwise it
  192. * returns non-zero (!0).
  193. */
  194. #define SCU_GET_FRAME_ERROR(completion_code) \
  195. ((completion_code) & SCU_UNSOLICITED_FRAME_ERROR_MASK)
  196. /**
  197. *
  198. *
  199. * These constants represent normalized completion codes which must be shifted
  200. * 18 bits to match it with the hardware completion code. In a 16-bit compiler,
  201. * immediate constants are 16-bit values (the size of an int). If we shift
  202. * those by 18 bits, we completely lose the value. To ensure the value is a
  203. * 32-bit value like we want, each immediate value must be cast to a u32.
  204. */
  205. #define SCU_TASK_DONE_GOOD ((u32)0x00)
  206. #define SCU_TASK_DONE_TX_RAW_CMD_ERR ((u32)0x08)
  207. #define SCU_TASK_DONE_CRC_ERR ((u32)0x14)
  208. #define SCU_TASK_DONE_CHECK_RESPONSE ((u32)0x14)
  209. #define SCU_TASK_DONE_GEN_RESPONSE ((u32)0x15)
  210. #define SCU_TASK_DONE_NAK_CMD_ERR ((u32)0x16)
  211. #define SCU_TASK_DONE_CMD_LL_R_ERR ((u32)0x16)
  212. #define SCU_TASK_DONE_LL_R_ERR ((u32)0x17)
  213. #define SCU_TASK_DONE_ACK_NAK_TO ((u32)0x17)
  214. #define SCU_TASK_DONE_LL_PERR ((u32)0x18)
  215. #define SCU_TASK_DONE_LL_SY_TERM ((u32)0x19)
  216. #define SCU_TASK_DONE_NAK_ERR ((u32)0x19)
  217. #define SCU_TASK_DONE_LL_LF_TERM ((u32)0x1A)
  218. #define SCU_TASK_DONE_DATA_LEN_ERR ((u32)0x1A)
  219. #define SCU_TASK_DONE_LL_CL_TERM ((u32)0x1B)
  220. #define SCU_TASK_DONE_BREAK_RCVD ((u32)0x1B)
  221. #define SCU_TASK_DONE_LL_ABORT_ERR ((u32)0x1B)
  222. #define SCU_TASK_DONE_SEQ_INV_TYPE ((u32)0x1C)
  223. #define SCU_TASK_DONE_UNEXP_XR ((u32)0x1C)
  224. #define SCU_TASK_DONE_INV_FIS_TYPE ((u32)0x1D)
  225. #define SCU_TASK_DONE_XR_IU_LEN_ERR ((u32)0x1D)
  226. #define SCU_TASK_DONE_INV_FIS_LEN ((u32)0x1E)
  227. #define SCU_TASK_DONE_XR_WD_LEN ((u32)0x1E)
  228. #define SCU_TASK_DONE_SDMA_ERR ((u32)0x1F)
  229. #define SCU_TASK_DONE_OFFSET_ERR ((u32)0x20)
  230. #define SCU_TASK_DONE_MAX_PLD_ERR ((u32)0x21)
  231. #define SCU_TASK_DONE_EXCESS_DATA ((u32)0x22)
  232. #define SCU_TASK_DONE_LF_ERR ((u32)0x23)
  233. #define SCU_TASK_DONE_UNEXP_FIS ((u32)0x24)
  234. #define SCU_TASK_DONE_UNEXP_RESP ((u32)0x24)
  235. #define SCU_TASK_DONE_EARLY_RESP ((u32)0x25)
  236. #define SCU_TASK_DONE_SMP_RESP_TO_ERR ((u32)0x26)
  237. #define SCU_TASK_DONE_DMASETUP_DIRERR ((u32)0x27)
  238. #define SCU_TASK_DONE_SMP_UFI_ERR ((u32)0x27)
  239. #define SCU_TASK_DONE_XFERCNT_ERR ((u32)0x28)
  240. #define SCU_TASK_DONE_SMP_FRM_TYPE_ERR ((u32)0x28)
  241. #define SCU_TASK_DONE_SMP_LL_RX_ERR ((u32)0x29)
  242. #define SCU_TASK_DONE_RESP_LEN_ERR ((u32)0x2A)
  243. #define SCU_TASK_DONE_UNEXP_DATA ((u32)0x2B)
  244. #define SCU_TASK_DONE_OPEN_FAIL ((u32)0x2C)
  245. #define SCU_TASK_DONE_UNEXP_SDBFIS ((u32)0x2D)
  246. #define SCU_TASK_DONE_REG_ERR ((u32)0x2E)
  247. #define SCU_TASK_DONE_SDB_ERR ((u32)0x2F)
  248. #define SCU_TASK_DONE_TASK_ABORT ((u32)0x30)
  249. #define SCU_TASK_DONE_CMD_SDMA_ERR ((U32)0x32)
  250. #define SCU_TASK_DONE_CMD_LL_ABORT_ERR ((U32)0x33)
  251. #define SCU_TASK_OPEN_REJECT_WRONG_DESTINATION ((u32)0x34)
  252. #define SCU_TASK_OPEN_REJECT_RESERVED_ABANDON_1 ((u32)0x35)
  253. #define SCU_TASK_OPEN_REJECT_RESERVED_ABANDON_2 ((u32)0x36)
  254. #define SCU_TASK_OPEN_REJECT_RESERVED_ABANDON_3 ((u32)0x37)
  255. #define SCU_TASK_OPEN_REJECT_BAD_DESTINATION ((u32)0x38)
  256. #define SCU_TASK_OPEN_REJECT_ZONE_VIOLATION ((u32)0x39)
  257. #define SCU_TASK_DONE_VIIT_ENTRY_NV ((u32)0x3A)
  258. #define SCU_TASK_DONE_IIT_ENTRY_NV ((u32)0x3B)
  259. #define SCU_TASK_DONE_RNCNV_OUTBOUND ((u32)0x3C)
  260. #define SCU_TASK_OPEN_REJECT_STP_RESOURCES_BUSY ((u32)0x3D)
  261. #define SCU_TASK_OPEN_REJECT_PROTOCOL_NOT_SUPPORTED ((u32)0x3E)
  262. #define SCU_TASK_OPEN_REJECT_CONNECTION_RATE_NOT_SUPPORTED ((u32)0x3F)
  263. #endif /* _SCU_COMPLETION_CODES_HEADER_ */