1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 
  16 
  17 
  18 
  19 
  20 
  21 
  22 
  23 
  24 
  25 
  26 
  27 
  28 
  29 
  30 
  31 
  32 
  33 
  34 
  35 
  36 
  37 
  38 
  39 
  40 
  41 
  42 
  43 
  44 
  45 
  46 
  47 
  48 
  49 
  50 
  51 
  52 
  53 
  54 
  55 
  56 #ifndef _SCU_COMPLETION_CODES_HEADER_
  57 #define _SCU_COMPLETION_CODES_HEADER_
  58 
  59 
  60 
  61 
  62 
  63 
  64 
  65 
  66 #define SCU_COMPLETION_TYPE_SHIFT      28
  67 #define SCU_COMPLETION_TYPE_MASK       0x70000000
  68 
  69 
  70 
  71 
  72 
  73 
  74 #define SCU_COMPLETION_TYPE(type) \
  75         ((u32)(type) << SCU_COMPLETION_TYPE_SHIFT)
  76 
  77 
  78 
  79 
  80 
  81 
  82 #define SCU_COMPLETION_TYPE_TASK       SCU_COMPLETION_TYPE(0)
  83 #define SCU_COMPLETION_TYPE_SDMA       SCU_COMPLETION_TYPE(1)
  84 #define SCU_COMPLETION_TYPE_UFI        SCU_COMPLETION_TYPE(2)
  85 #define SCU_COMPLETION_TYPE_EVENT      SCU_COMPLETION_TYPE(3)
  86 #define SCU_COMPLETION_TYPE_NOTIFY     SCU_COMPLETION_TYPE(4)
  87 
  88 
  89 
  90 
  91 
  92 
  93 
  94 #define SCU_COMPLETION_STATUS_MASK       0x0FFC0000
  95 #define SCU_COMPLETION_TL_STATUS_MASK    0x0FC00000
  96 #define SCU_COMPLETION_TL_STATUS_SHIFT   22
  97 #define SCU_COMPLETION_SDMA_STATUS_MASK  0x003C0000
  98 #define SCU_COMPLETION_PEG_MASK          0x00010000
  99 #define SCU_COMPLETION_PORT_MASK         0x00007000
 100 #define SCU_COMPLETION_PE_MASK           SCU_COMPLETION_PORT_MASK
 101 #define SCU_COMPLETION_PE_SHIFT          12
 102 #define SCU_COMPLETION_INDEX_MASK        0x00000FFF
 103 
 104 
 105 
 106 
 107 
 108 
 109 #define SCU_GET_COMPLETION_TYPE(completion_code) \
 110         ((completion_code) & SCU_COMPLETION_TYPE_MASK)
 111 
 112 
 113 
 114 
 115 
 116 
 117 #define SCU_GET_COMPLETION_STATUS(completion_code) \
 118         ((completion_code) & SCU_COMPLETION_STATUS_MASK)
 119 
 120 
 121 
 122 
 123 
 124 
 125 #define SCU_GET_COMPLETION_TL_STATUS(completion_code) \
 126         ((completion_code) & SCU_COMPLETION_TL_STATUS_MASK)
 127 
 128 
 129 
 130 
 131 
 132 
 133 
 134 
 135 #define SCU_MAKE_COMPLETION_STATUS(completion_code) \
 136         ((u32)(completion_code) << SCU_COMPLETION_TL_STATUS_SHIFT)
 137 
 138 
 139 
 140 
 141 
 142 
 143 
 144 #define SCU_NORMALIZE_COMPLETION_STATUS(completion_code) \
 145         (\
 146                 ((completion_code) & SCU_COMPLETION_TL_STATUS_MASK) \
 147                 >> SCU_COMPLETION_TL_STATUS_SHIFT \
 148         )
 149 
 150 
 151 
 152 
 153 
 154 
 155 #define SCU_GET_COMPLETION_SDMA_STATUS(completion_code) \
 156         ((completion_code) & SCU_COMPLETION_SDMA_STATUS_MASK)
 157 
 158 
 159 
 160 
 161 
 162 
 163 #define SCU_GET_COMPLETION_PEG(completion_code) \
 164         ((completion_code) & SCU_COMPLETION_PEG_MASK)
 165 
 166 
 167 
 168 
 169 
 170 
 171 #define SCU_GET_COMPLETION_PORT(completion_code) \
 172         ((completion_code) & SCU_COMPLETION_PORT_MASK)
 173 
 174 
 175 
 176 
 177 
 178 
 179 #define SCU_GET_PROTOCOL_ENGINE_INDEX(completion_code) \
 180         (((completion_code) & SCU_COMPLETION_PE_MASK) >> SCU_COMPLETION_PE_SHIFT)
 181 
 182 
 183 
 184 
 185 
 186 
 187 
 188 #define SCU_GET_COMPLETION_INDEX(completion_code) \
 189         ((completion_code) & SCU_COMPLETION_INDEX_MASK)
 190 
 191 #define SCU_UNSOLICITED_FRAME_MASK     0x0FFF0000
 192 #define SCU_UNSOLICITED_FRAME_SHIFT    16
 193 
 194 
 195 
 196 
 197 
 198 
 199 
 200 #define SCU_GET_FRAME_INDEX(completion_code) \
 201         (\
 202                 ((completion_code) & SCU_UNSOLICITED_FRAME_MASK) \
 203                 >> SCU_UNSOLICITED_FRAME_SHIFT \
 204         )
 205 
 206 #define SCU_UNSOLICITED_FRAME_ERROR_MASK  0x00008000
 207 
 208 
 209 
 210 
 211 
 212 
 213 
 214 #define SCU_GET_FRAME_ERROR(completion_code) \
 215         ((completion_code) & SCU_UNSOLICITED_FRAME_ERROR_MASK)
 216 
 217 
 218 
 219 
 220 
 221 
 222 
 223 
 224 
 225 
 226 #define SCU_TASK_DONE_GOOD                                  ((u32)0x00)
 227 #define SCU_TASK_DONE_TX_RAW_CMD_ERR                        ((u32)0x08)
 228 #define SCU_TASK_DONE_CRC_ERR                               ((u32)0x14)
 229 #define SCU_TASK_DONE_CHECK_RESPONSE                        ((u32)0x14)
 230 #define SCU_TASK_DONE_GEN_RESPONSE                          ((u32)0x15)
 231 #define SCU_TASK_DONE_NAK_CMD_ERR                           ((u32)0x16)
 232 #define SCU_TASK_DONE_CMD_LL_R_ERR                          ((u32)0x16)
 233 #define SCU_TASK_DONE_LL_R_ERR                              ((u32)0x17)
 234 #define SCU_TASK_DONE_ACK_NAK_TO                            ((u32)0x17)
 235 #define SCU_TASK_DONE_LL_PERR                               ((u32)0x18)
 236 #define SCU_TASK_DONE_LL_SY_TERM                            ((u32)0x19)
 237 #define SCU_TASK_DONE_NAK_ERR                               ((u32)0x19)
 238 #define SCU_TASK_DONE_LL_LF_TERM                            ((u32)0x1A)
 239 #define SCU_TASK_DONE_DATA_LEN_ERR                          ((u32)0x1A)
 240 #define SCU_TASK_DONE_LL_CL_TERM                            ((u32)0x1B)
 241 #define SCU_TASK_DONE_BREAK_RCVD                            ((u32)0x1B)
 242 #define SCU_TASK_DONE_LL_ABORT_ERR                          ((u32)0x1B)
 243 #define SCU_TASK_DONE_SEQ_INV_TYPE                          ((u32)0x1C)
 244 #define SCU_TASK_DONE_UNEXP_XR                              ((u32)0x1C)
 245 #define SCU_TASK_DONE_INV_FIS_TYPE                          ((u32)0x1D)
 246 #define SCU_TASK_DONE_XR_IU_LEN_ERR                         ((u32)0x1D)
 247 #define SCU_TASK_DONE_INV_FIS_LEN                           ((u32)0x1E)
 248 #define SCU_TASK_DONE_XR_WD_LEN                             ((u32)0x1E)
 249 #define SCU_TASK_DONE_SDMA_ERR                              ((u32)0x1F)
 250 #define SCU_TASK_DONE_OFFSET_ERR                            ((u32)0x20)
 251 #define SCU_TASK_DONE_MAX_PLD_ERR                           ((u32)0x21)
 252 #define SCU_TASK_DONE_EXCESS_DATA                           ((u32)0x22)
 253 #define SCU_TASK_DONE_LF_ERR                                ((u32)0x23)
 254 #define SCU_TASK_DONE_UNEXP_FIS                             ((u32)0x24)
 255 #define SCU_TASK_DONE_UNEXP_RESP                            ((u32)0x24)
 256 #define SCU_TASK_DONE_EARLY_RESP                            ((u32)0x25)
 257 #define SCU_TASK_DONE_SMP_RESP_TO_ERR                       ((u32)0x26)
 258 #define SCU_TASK_DONE_DMASETUP_DIRERR                       ((u32)0x27)
 259 #define SCU_TASK_DONE_SMP_UFI_ERR                           ((u32)0x27)
 260 #define SCU_TASK_DONE_XFERCNT_ERR                           ((u32)0x28)
 261 #define SCU_TASK_DONE_SMP_FRM_TYPE_ERR                      ((u32)0x28)
 262 #define SCU_TASK_DONE_SMP_LL_RX_ERR                         ((u32)0x29)
 263 #define SCU_TASK_DONE_RESP_LEN_ERR                          ((u32)0x2A)
 264 #define SCU_TASK_DONE_UNEXP_DATA                            ((u32)0x2B)
 265 #define SCU_TASK_DONE_OPEN_FAIL                             ((u32)0x2C)
 266 #define SCU_TASK_DONE_UNEXP_SDBFIS                          ((u32)0x2D)
 267 #define SCU_TASK_DONE_REG_ERR                               ((u32)0x2E)
 268 #define SCU_TASK_DONE_SDB_ERR                               ((u32)0x2F)
 269 #define SCU_TASK_DONE_TASK_ABORT                            ((u32)0x30)
 270 #define SCU_TASK_DONE_CMD_SDMA_ERR                          ((U32)0x32)
 271 #define SCU_TASK_DONE_CMD_LL_ABORT_ERR                      ((U32)0x33)
 272 #define SCU_TASK_OPEN_REJECT_WRONG_DESTINATION              ((u32)0x34)
 273 #define SCU_TASK_OPEN_REJECT_RESERVED_ABANDON_1             ((u32)0x35)
 274 #define SCU_TASK_OPEN_REJECT_RESERVED_ABANDON_2             ((u32)0x36)
 275 #define SCU_TASK_OPEN_REJECT_RESERVED_ABANDON_3             ((u32)0x37)
 276 #define SCU_TASK_OPEN_REJECT_BAD_DESTINATION                ((u32)0x38)
 277 #define SCU_TASK_OPEN_REJECT_ZONE_VIOLATION                 ((u32)0x39)
 278 #define SCU_TASK_DONE_VIIT_ENTRY_NV                         ((u32)0x3A)
 279 #define SCU_TASK_DONE_IIT_ENTRY_NV                          ((u32)0x3B)
 280 #define SCU_TASK_DONE_RNCNV_OUTBOUND                        ((u32)0x3C)
 281 #define SCU_TASK_OPEN_REJECT_STP_RESOURCES_BUSY             ((u32)0x3D)
 282 #define SCU_TASK_OPEN_REJECT_PROTOCOL_NOT_SUPPORTED         ((u32)0x3E)
 283 #define SCU_TASK_OPEN_REJECT_CONNECTION_RATE_NOT_SUPPORTED  ((u32)0x3F)
 284 
 285 #endif