Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * This file is provided under a dual BSD/GPLv2 license.  When using or
0003  * redistributing this file, you may do so under either license.
0004  *
0005  * GPL LICENSE SUMMARY
0006  *
0007  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
0008  *
0009  * This program is free software; you can redistribute it and/or modify
0010  * it under the terms of version 2 of the GNU General Public License as
0011  * published by the Free Software Foundation.
0012  *
0013  * This program is distributed in the hope that it will be useful, but
0014  * WITHOUT ANY WARRANTY; without even the implied warranty of
0015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016  * General Public License for more details.
0017  *
0018  * You should have received a copy of the GNU General Public License
0019  * along with this program; if not, write to the Free Software
0020  * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
0021  * The full GNU General Public License is included in this distribution
0022  * in the file called LICENSE.GPL.
0023  *
0024  * BSD LICENSE
0025  *
0026  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
0027  * All rights reserved.
0028  *
0029  * Redistribution and use in source and binary forms, with or without
0030  * modification, are permitted provided that the following conditions
0031  * are met:
0032  *
0033  *   * Redistributions of source code must retain the above copyright
0034  *     notice, this list of conditions and the following disclaimer.
0035  *   * Redistributions in binary form must reproduce the above copyright
0036  *     notice, this list of conditions and the following disclaimer in
0037  *     the documentation and/or other materials provided with the
0038  *     distribution.
0039  *   * Neither the name of Intel Corporation nor the names of its
0040  *     contributors may be used to endorse or promote products derived
0041  *     from this software without specific prior written permission.
0042  *
0043  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0044  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0045  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0046  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0047  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0048  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0049  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0050  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0051  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0052  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0053  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0054  */
0055 
0056 #ifndef _SCU_COMPLETION_CODES_HEADER_
0057 #define _SCU_COMPLETION_CODES_HEADER_
0058 
0059 /**
0060  * This file contains the constants and macros for the SCU hardware completion
0061  *    codes.
0062  *
0063  *
0064  */
0065 
0066 #define SCU_COMPLETION_TYPE_SHIFT      28
0067 #define SCU_COMPLETION_TYPE_MASK       0x70000000
0068 
0069 /**
0070  * SCU_COMPLETION_TYPE() -
0071  *
0072  * This macro constructs an SCU completion type
0073  */
0074 #define SCU_COMPLETION_TYPE(type) \
0075     ((u32)(type) << SCU_COMPLETION_TYPE_SHIFT)
0076 
0077 /**
0078  * SCU_COMPLETION_TYPE() -
0079  *
0080  * These macros contain the SCU completion types SCU_COMPLETION_TYPE
0081  */
0082 #define SCU_COMPLETION_TYPE_TASK       SCU_COMPLETION_TYPE(0)
0083 #define SCU_COMPLETION_TYPE_SDMA       SCU_COMPLETION_TYPE(1)
0084 #define SCU_COMPLETION_TYPE_UFI        SCU_COMPLETION_TYPE(2)
0085 #define SCU_COMPLETION_TYPE_EVENT      SCU_COMPLETION_TYPE(3)
0086 #define SCU_COMPLETION_TYPE_NOTIFY     SCU_COMPLETION_TYPE(4)
0087 
0088 /**
0089  *
0090  *
0091  * These constants provide the shift and mask values for the various parts of
0092  * an SCU completion code.
0093  */
0094 #define SCU_COMPLETION_STATUS_MASK       0x0FFC0000
0095 #define SCU_COMPLETION_TL_STATUS_MASK    0x0FC00000
0096 #define SCU_COMPLETION_TL_STATUS_SHIFT   22
0097 #define SCU_COMPLETION_SDMA_STATUS_MASK  0x003C0000
0098 #define SCU_COMPLETION_PEG_MASK          0x00010000
0099 #define SCU_COMPLETION_PORT_MASK         0x00007000
0100 #define SCU_COMPLETION_PE_MASK           SCU_COMPLETION_PORT_MASK
0101 #define SCU_COMPLETION_PE_SHIFT          12
0102 #define SCU_COMPLETION_INDEX_MASK        0x00000FFF
0103 
0104 /**
0105  * SCU_GET_COMPLETION_TYPE() -
0106  *
0107  * This macro returns the SCU completion type.
0108  */
0109 #define SCU_GET_COMPLETION_TYPE(completion_code) \
0110     ((completion_code) & SCU_COMPLETION_TYPE_MASK)
0111 
0112 /**
0113  * SCU_GET_COMPLETION_STATUS() -
0114  *
0115  * This macro returns the SCU completion status.
0116  */
0117 #define SCU_GET_COMPLETION_STATUS(completion_code) \
0118     ((completion_code) & SCU_COMPLETION_STATUS_MASK)
0119 
0120 /**
0121  * SCU_GET_COMPLETION_TL_STATUS() -
0122  *
0123  * This macro returns the transport layer completion status.
0124  */
0125 #define SCU_GET_COMPLETION_TL_STATUS(completion_code) \
0126     ((completion_code) & SCU_COMPLETION_TL_STATUS_MASK)
0127 
0128 /**
0129  * SCU_MAKE_COMPLETION_STATUS() -
0130  *
0131  * This macro takes a completion code and performs the shift and mask
0132  * operations to turn it into a completion code that can be compared to a
0133  * SCU_GET_COMPLETION_TL_STATUS.
0134  */
0135 #define SCU_MAKE_COMPLETION_STATUS(completion_code) \
0136     ((u32)(completion_code) << SCU_COMPLETION_TL_STATUS_SHIFT)
0137 
0138 /**
0139  * SCU_NORMALIZE_COMPLETION_STATUS() -
0140  *
0141  * This macro takes a SCU_GET_COMPLETION_TL_STATUS and normalizes it for a
0142  * return code.
0143  */
0144 #define SCU_NORMALIZE_COMPLETION_STATUS(completion_code) \
0145     (\
0146         ((completion_code) & SCU_COMPLETION_TL_STATUS_MASK) \
0147         >> SCU_COMPLETION_TL_STATUS_SHIFT \
0148     )
0149 
0150 /**
0151  * SCU_GET_COMPLETION_SDMA_STATUS() -
0152  *
0153  * This macro returns the SDMA completion status.
0154  */
0155 #define SCU_GET_COMPLETION_SDMA_STATUS(completion_code) \
0156     ((completion_code) & SCU_COMPLETION_SDMA_STATUS_MASK)
0157 
0158 /**
0159  * SCU_GET_COMPLETION_PEG() -
0160  *
0161  * This macro returns the Protocol Engine Group from the completion code.
0162  */
0163 #define SCU_GET_COMPLETION_PEG(completion_code) \
0164     ((completion_code) & SCU_COMPLETION_PEG_MASK)
0165 
0166 /**
0167  * SCU_GET_COMPLETION_PORT() -
0168  *
0169  * This macro reuturns the logical port index from the completion code.
0170  */
0171 #define SCU_GET_COMPLETION_PORT(completion_code) \
0172     ((completion_code) & SCU_COMPLETION_PORT_MASK)
0173 
0174 /**
0175  * SCU_GET_PROTOCOL_ENGINE_INDEX() -
0176  *
0177  * This macro returns the PE index from the completion code.
0178  */
0179 #define SCU_GET_PROTOCOL_ENGINE_INDEX(completion_code) \
0180     (((completion_code) & SCU_COMPLETION_PE_MASK) >> SCU_COMPLETION_PE_SHIFT)
0181 
0182 /**
0183  * SCU_GET_COMPLETION_INDEX() -
0184  *
0185  * This macro returns the index of the completion which is either a TCi or an
0186  * RNi depending on the completion type.
0187  */
0188 #define SCU_GET_COMPLETION_INDEX(completion_code) \
0189     ((completion_code) & SCU_COMPLETION_INDEX_MASK)
0190 
0191 #define SCU_UNSOLICITED_FRAME_MASK     0x0FFF0000
0192 #define SCU_UNSOLICITED_FRAME_SHIFT    16
0193 
0194 /**
0195  * SCU_GET_FRAME_INDEX() -
0196  *
0197  * This macro returns a normalized frame index from an unsolicited frame
0198  * completion.
0199  */
0200 #define SCU_GET_FRAME_INDEX(completion_code) \
0201     (\
0202         ((completion_code) & SCU_UNSOLICITED_FRAME_MASK) \
0203         >> SCU_UNSOLICITED_FRAME_SHIFT \
0204     )
0205 
0206 #define SCU_UNSOLICITED_FRAME_ERROR_MASK  0x00008000
0207 
0208 /**
0209  * SCU_GET_FRAME_ERROR() -
0210  *
0211  * This macro returns a zero (0) value if there is no frame error otherwise it
0212  * returns non-zero (!0).
0213  */
0214 #define SCU_GET_FRAME_ERROR(completion_code) \
0215     ((completion_code) & SCU_UNSOLICITED_FRAME_ERROR_MASK)
0216 
0217 /**
0218  *
0219  *
0220  * These constants represent normalized completion codes which must be shifted
0221  * 18 bits to match it with the hardware completion code. In a 16-bit compiler,
0222  * immediate constants are 16-bit values (the size of an int). If we shift
0223  * those by 18 bits, we completely lose the value. To ensure the value is a
0224  * 32-bit value like we want, each immediate value must be cast to a u32.
0225  */
0226 #define SCU_TASK_DONE_GOOD                                  ((u32)0x00)
0227 #define SCU_TASK_DONE_TX_RAW_CMD_ERR                        ((u32)0x08)
0228 #define SCU_TASK_DONE_CRC_ERR                               ((u32)0x14)
0229 #define SCU_TASK_DONE_CHECK_RESPONSE                        ((u32)0x14)
0230 #define SCU_TASK_DONE_GEN_RESPONSE                          ((u32)0x15)
0231 #define SCU_TASK_DONE_NAK_CMD_ERR                           ((u32)0x16)
0232 #define SCU_TASK_DONE_CMD_LL_R_ERR                          ((u32)0x16)
0233 #define SCU_TASK_DONE_LL_R_ERR                              ((u32)0x17)
0234 #define SCU_TASK_DONE_ACK_NAK_TO                            ((u32)0x17)
0235 #define SCU_TASK_DONE_LL_PERR                               ((u32)0x18)
0236 #define SCU_TASK_DONE_LL_SY_TERM                            ((u32)0x19)
0237 #define SCU_TASK_DONE_NAK_ERR                               ((u32)0x19)
0238 #define SCU_TASK_DONE_LL_LF_TERM                            ((u32)0x1A)
0239 #define SCU_TASK_DONE_DATA_LEN_ERR                          ((u32)0x1A)
0240 #define SCU_TASK_DONE_LL_CL_TERM                            ((u32)0x1B)
0241 #define SCU_TASK_DONE_BREAK_RCVD                            ((u32)0x1B)
0242 #define SCU_TASK_DONE_LL_ABORT_ERR                          ((u32)0x1B)
0243 #define SCU_TASK_DONE_SEQ_INV_TYPE                          ((u32)0x1C)
0244 #define SCU_TASK_DONE_UNEXP_XR                              ((u32)0x1C)
0245 #define SCU_TASK_DONE_INV_FIS_TYPE                          ((u32)0x1D)
0246 #define SCU_TASK_DONE_XR_IU_LEN_ERR                         ((u32)0x1D)
0247 #define SCU_TASK_DONE_INV_FIS_LEN                           ((u32)0x1E)
0248 #define SCU_TASK_DONE_XR_WD_LEN                             ((u32)0x1E)
0249 #define SCU_TASK_DONE_SDMA_ERR                              ((u32)0x1F)
0250 #define SCU_TASK_DONE_OFFSET_ERR                            ((u32)0x20)
0251 #define SCU_TASK_DONE_MAX_PLD_ERR                           ((u32)0x21)
0252 #define SCU_TASK_DONE_EXCESS_DATA                           ((u32)0x22)
0253 #define SCU_TASK_DONE_LF_ERR                                ((u32)0x23)
0254 #define SCU_TASK_DONE_UNEXP_FIS                             ((u32)0x24)
0255 #define SCU_TASK_DONE_UNEXP_RESP                            ((u32)0x24)
0256 #define SCU_TASK_DONE_EARLY_RESP                            ((u32)0x25)
0257 #define SCU_TASK_DONE_SMP_RESP_TO_ERR                       ((u32)0x26)
0258 #define SCU_TASK_DONE_DMASETUP_DIRERR                       ((u32)0x27)
0259 #define SCU_TASK_DONE_SMP_UFI_ERR                           ((u32)0x27)
0260 #define SCU_TASK_DONE_XFERCNT_ERR                           ((u32)0x28)
0261 #define SCU_TASK_DONE_SMP_FRM_TYPE_ERR                      ((u32)0x28)
0262 #define SCU_TASK_DONE_SMP_LL_RX_ERR                         ((u32)0x29)
0263 #define SCU_TASK_DONE_RESP_LEN_ERR                          ((u32)0x2A)
0264 #define SCU_TASK_DONE_UNEXP_DATA                            ((u32)0x2B)
0265 #define SCU_TASK_DONE_OPEN_FAIL                             ((u32)0x2C)
0266 #define SCU_TASK_DONE_UNEXP_SDBFIS                          ((u32)0x2D)
0267 #define SCU_TASK_DONE_REG_ERR                               ((u32)0x2E)
0268 #define SCU_TASK_DONE_SDB_ERR                               ((u32)0x2F)
0269 #define SCU_TASK_DONE_TASK_ABORT                            ((u32)0x30)
0270 #define SCU_TASK_DONE_CMD_SDMA_ERR                          ((U32)0x32)
0271 #define SCU_TASK_DONE_CMD_LL_ABORT_ERR                      ((U32)0x33)
0272 #define SCU_TASK_OPEN_REJECT_WRONG_DESTINATION              ((u32)0x34)
0273 #define SCU_TASK_OPEN_REJECT_RESERVED_ABANDON_1             ((u32)0x35)
0274 #define SCU_TASK_OPEN_REJECT_RESERVED_ABANDON_2             ((u32)0x36)
0275 #define SCU_TASK_OPEN_REJECT_RESERVED_ABANDON_3             ((u32)0x37)
0276 #define SCU_TASK_OPEN_REJECT_BAD_DESTINATION                ((u32)0x38)
0277 #define SCU_TASK_OPEN_REJECT_ZONE_VIOLATION                 ((u32)0x39)
0278 #define SCU_TASK_DONE_VIIT_ENTRY_NV                         ((u32)0x3A)
0279 #define SCU_TASK_DONE_IIT_ENTRY_NV                          ((u32)0x3B)
0280 #define SCU_TASK_DONE_RNCNV_OUTBOUND                        ((u32)0x3C)
0281 #define SCU_TASK_OPEN_REJECT_STP_RESOURCES_BUSY             ((u32)0x3D)
0282 #define SCU_TASK_OPEN_REJECT_PROTOCOL_NOT_SUPPORTED         ((u32)0x3E)
0283 #define SCU_TASK_OPEN_REJECT_CONNECTION_RATE_NOT_SUPPORTED  ((u32)0x3F)
0284 
0285 #endif /* _SCU_COMPLETION_CODES_HEADER_ */