162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * This file is provided under a dual BSD/GPLv2 license. When using or 362306a36Sopenharmony_ci * redistributing this file, you may do so under either license. 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * GPL LICENSE SUMMARY 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 862306a36Sopenharmony_ci * 962306a36Sopenharmony_ci * This program is free software; you can redistribute it and/or modify 1062306a36Sopenharmony_ci * it under the terms of version 2 of the GNU General Public License as 1162306a36Sopenharmony_ci * published by the Free Software Foundation. 1262306a36Sopenharmony_ci * 1362306a36Sopenharmony_ci * This program is distributed in the hope that it will be useful, but 1462306a36Sopenharmony_ci * WITHOUT ANY WARRANTY; without even the implied warranty of 1562306a36Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1662306a36Sopenharmony_ci * General Public License for more details. 1762306a36Sopenharmony_ci * 1862306a36Sopenharmony_ci * You should have received a copy of the GNU General Public License 1962306a36Sopenharmony_ci * along with this program; if not, write to the Free Software 2062306a36Sopenharmony_ci * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 2162306a36Sopenharmony_ci * The full GNU General Public License is included in this distribution 2262306a36Sopenharmony_ci * in the file called LICENSE.GPL. 2362306a36Sopenharmony_ci * 2462306a36Sopenharmony_ci * BSD LICENSE 2562306a36Sopenharmony_ci * 2662306a36Sopenharmony_ci * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 2762306a36Sopenharmony_ci * All rights reserved. 2862306a36Sopenharmony_ci * 2962306a36Sopenharmony_ci * Redistribution and use in source and binary forms, with or without 3062306a36Sopenharmony_ci * modification, are permitted provided that the following conditions 3162306a36Sopenharmony_ci * are met: 3262306a36Sopenharmony_ci * 3362306a36Sopenharmony_ci * * Redistributions of source code must retain the above copyright 3462306a36Sopenharmony_ci * notice, this list of conditions and the following disclaimer. 3562306a36Sopenharmony_ci * * Redistributions in binary form must reproduce the above copyright 3662306a36Sopenharmony_ci * notice, this list of conditions and the following disclaimer in 3762306a36Sopenharmony_ci * the documentation and/or other materials provided with the 3862306a36Sopenharmony_ci * distribution. 3962306a36Sopenharmony_ci * * Neither the name of Intel Corporation nor the names of its 4062306a36Sopenharmony_ci * contributors may be used to endorse or promote products derived 4162306a36Sopenharmony_ci * from this software without specific prior written permission. 4262306a36Sopenharmony_ci * 4362306a36Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 4462306a36Sopenharmony_ci * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 4562306a36Sopenharmony_ci * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 4662306a36Sopenharmony_ci * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 4762306a36Sopenharmony_ci * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 4862306a36Sopenharmony_ci * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 4962306a36Sopenharmony_ci * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 5062306a36Sopenharmony_ci * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 5162306a36Sopenharmony_ci * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 5262306a36Sopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 5362306a36Sopenharmony_ci * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 5462306a36Sopenharmony_ci */ 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci#ifndef _SCU_COMPLETION_CODES_HEADER_ 5762306a36Sopenharmony_ci#define _SCU_COMPLETION_CODES_HEADER_ 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ci/** 6062306a36Sopenharmony_ci * This file contains the constants and macros for the SCU hardware completion 6162306a36Sopenharmony_ci * codes. 6262306a36Sopenharmony_ci * 6362306a36Sopenharmony_ci * 6462306a36Sopenharmony_ci */ 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ci#define SCU_COMPLETION_TYPE_SHIFT 28 6762306a36Sopenharmony_ci#define SCU_COMPLETION_TYPE_MASK 0x70000000 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_ci/** 7062306a36Sopenharmony_ci * SCU_COMPLETION_TYPE() - 7162306a36Sopenharmony_ci * 7262306a36Sopenharmony_ci * This macro constructs an SCU completion type 7362306a36Sopenharmony_ci */ 7462306a36Sopenharmony_ci#define SCU_COMPLETION_TYPE(type) \ 7562306a36Sopenharmony_ci ((u32)(type) << SCU_COMPLETION_TYPE_SHIFT) 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_ci/** 7862306a36Sopenharmony_ci * SCU_COMPLETION_TYPE() - 7962306a36Sopenharmony_ci * 8062306a36Sopenharmony_ci * These macros contain the SCU completion types SCU_COMPLETION_TYPE 8162306a36Sopenharmony_ci */ 8262306a36Sopenharmony_ci#define SCU_COMPLETION_TYPE_TASK SCU_COMPLETION_TYPE(0) 8362306a36Sopenharmony_ci#define SCU_COMPLETION_TYPE_SDMA SCU_COMPLETION_TYPE(1) 8462306a36Sopenharmony_ci#define SCU_COMPLETION_TYPE_UFI SCU_COMPLETION_TYPE(2) 8562306a36Sopenharmony_ci#define SCU_COMPLETION_TYPE_EVENT SCU_COMPLETION_TYPE(3) 8662306a36Sopenharmony_ci#define SCU_COMPLETION_TYPE_NOTIFY SCU_COMPLETION_TYPE(4) 8762306a36Sopenharmony_ci 8862306a36Sopenharmony_ci/** 8962306a36Sopenharmony_ci * 9062306a36Sopenharmony_ci * 9162306a36Sopenharmony_ci * These constants provide the shift and mask values for the various parts of 9262306a36Sopenharmony_ci * an SCU completion code. 9362306a36Sopenharmony_ci */ 9462306a36Sopenharmony_ci#define SCU_COMPLETION_STATUS_MASK 0x0FFC0000 9562306a36Sopenharmony_ci#define SCU_COMPLETION_TL_STATUS_MASK 0x0FC00000 9662306a36Sopenharmony_ci#define SCU_COMPLETION_TL_STATUS_SHIFT 22 9762306a36Sopenharmony_ci#define SCU_COMPLETION_SDMA_STATUS_MASK 0x003C0000 9862306a36Sopenharmony_ci#define SCU_COMPLETION_PEG_MASK 0x00010000 9962306a36Sopenharmony_ci#define SCU_COMPLETION_PORT_MASK 0x00007000 10062306a36Sopenharmony_ci#define SCU_COMPLETION_PE_MASK SCU_COMPLETION_PORT_MASK 10162306a36Sopenharmony_ci#define SCU_COMPLETION_PE_SHIFT 12 10262306a36Sopenharmony_ci#define SCU_COMPLETION_INDEX_MASK 0x00000FFF 10362306a36Sopenharmony_ci 10462306a36Sopenharmony_ci/** 10562306a36Sopenharmony_ci * SCU_GET_COMPLETION_TYPE() - 10662306a36Sopenharmony_ci * 10762306a36Sopenharmony_ci * This macro returns the SCU completion type. 10862306a36Sopenharmony_ci */ 10962306a36Sopenharmony_ci#define SCU_GET_COMPLETION_TYPE(completion_code) \ 11062306a36Sopenharmony_ci ((completion_code) & SCU_COMPLETION_TYPE_MASK) 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_ci/** 11362306a36Sopenharmony_ci * SCU_GET_COMPLETION_STATUS() - 11462306a36Sopenharmony_ci * 11562306a36Sopenharmony_ci * This macro returns the SCU completion status. 11662306a36Sopenharmony_ci */ 11762306a36Sopenharmony_ci#define SCU_GET_COMPLETION_STATUS(completion_code) \ 11862306a36Sopenharmony_ci ((completion_code) & SCU_COMPLETION_STATUS_MASK) 11962306a36Sopenharmony_ci 12062306a36Sopenharmony_ci/** 12162306a36Sopenharmony_ci * SCU_GET_COMPLETION_TL_STATUS() - 12262306a36Sopenharmony_ci * 12362306a36Sopenharmony_ci * This macro returns the transport layer completion status. 12462306a36Sopenharmony_ci */ 12562306a36Sopenharmony_ci#define SCU_GET_COMPLETION_TL_STATUS(completion_code) \ 12662306a36Sopenharmony_ci ((completion_code) & SCU_COMPLETION_TL_STATUS_MASK) 12762306a36Sopenharmony_ci 12862306a36Sopenharmony_ci/** 12962306a36Sopenharmony_ci * SCU_MAKE_COMPLETION_STATUS() - 13062306a36Sopenharmony_ci * 13162306a36Sopenharmony_ci * This macro takes a completion code and performs the shift and mask 13262306a36Sopenharmony_ci * operations to turn it into a completion code that can be compared to a 13362306a36Sopenharmony_ci * SCU_GET_COMPLETION_TL_STATUS. 13462306a36Sopenharmony_ci */ 13562306a36Sopenharmony_ci#define SCU_MAKE_COMPLETION_STATUS(completion_code) \ 13662306a36Sopenharmony_ci ((u32)(completion_code) << SCU_COMPLETION_TL_STATUS_SHIFT) 13762306a36Sopenharmony_ci 13862306a36Sopenharmony_ci/** 13962306a36Sopenharmony_ci * SCU_NORMALIZE_COMPLETION_STATUS() - 14062306a36Sopenharmony_ci * 14162306a36Sopenharmony_ci * This macro takes a SCU_GET_COMPLETION_TL_STATUS and normalizes it for a 14262306a36Sopenharmony_ci * return code. 14362306a36Sopenharmony_ci */ 14462306a36Sopenharmony_ci#define SCU_NORMALIZE_COMPLETION_STATUS(completion_code) \ 14562306a36Sopenharmony_ci (\ 14662306a36Sopenharmony_ci ((completion_code) & SCU_COMPLETION_TL_STATUS_MASK) \ 14762306a36Sopenharmony_ci >> SCU_COMPLETION_TL_STATUS_SHIFT \ 14862306a36Sopenharmony_ci ) 14962306a36Sopenharmony_ci 15062306a36Sopenharmony_ci/** 15162306a36Sopenharmony_ci * SCU_GET_COMPLETION_SDMA_STATUS() - 15262306a36Sopenharmony_ci * 15362306a36Sopenharmony_ci * This macro returns the SDMA completion status. 15462306a36Sopenharmony_ci */ 15562306a36Sopenharmony_ci#define SCU_GET_COMPLETION_SDMA_STATUS(completion_code) \ 15662306a36Sopenharmony_ci ((completion_code) & SCU_COMPLETION_SDMA_STATUS_MASK) 15762306a36Sopenharmony_ci 15862306a36Sopenharmony_ci/** 15962306a36Sopenharmony_ci * SCU_GET_COMPLETION_PEG() - 16062306a36Sopenharmony_ci * 16162306a36Sopenharmony_ci * This macro returns the Protocol Engine Group from the completion code. 16262306a36Sopenharmony_ci */ 16362306a36Sopenharmony_ci#define SCU_GET_COMPLETION_PEG(completion_code) \ 16462306a36Sopenharmony_ci ((completion_code) & SCU_COMPLETION_PEG_MASK) 16562306a36Sopenharmony_ci 16662306a36Sopenharmony_ci/** 16762306a36Sopenharmony_ci * SCU_GET_COMPLETION_PORT() - 16862306a36Sopenharmony_ci * 16962306a36Sopenharmony_ci * This macro reuturns the logical port index from the completion code. 17062306a36Sopenharmony_ci */ 17162306a36Sopenharmony_ci#define SCU_GET_COMPLETION_PORT(completion_code) \ 17262306a36Sopenharmony_ci ((completion_code) & SCU_COMPLETION_PORT_MASK) 17362306a36Sopenharmony_ci 17462306a36Sopenharmony_ci/** 17562306a36Sopenharmony_ci * SCU_GET_PROTOCOL_ENGINE_INDEX() - 17662306a36Sopenharmony_ci * 17762306a36Sopenharmony_ci * This macro returns the PE index from the completion code. 17862306a36Sopenharmony_ci */ 17962306a36Sopenharmony_ci#define SCU_GET_PROTOCOL_ENGINE_INDEX(completion_code) \ 18062306a36Sopenharmony_ci (((completion_code) & SCU_COMPLETION_PE_MASK) >> SCU_COMPLETION_PE_SHIFT) 18162306a36Sopenharmony_ci 18262306a36Sopenharmony_ci/** 18362306a36Sopenharmony_ci * SCU_GET_COMPLETION_INDEX() - 18462306a36Sopenharmony_ci * 18562306a36Sopenharmony_ci * This macro returns the index of the completion which is either a TCi or an 18662306a36Sopenharmony_ci * RNi depending on the completion type. 18762306a36Sopenharmony_ci */ 18862306a36Sopenharmony_ci#define SCU_GET_COMPLETION_INDEX(completion_code) \ 18962306a36Sopenharmony_ci ((completion_code) & SCU_COMPLETION_INDEX_MASK) 19062306a36Sopenharmony_ci 19162306a36Sopenharmony_ci#define SCU_UNSOLICITED_FRAME_MASK 0x0FFF0000 19262306a36Sopenharmony_ci#define SCU_UNSOLICITED_FRAME_SHIFT 16 19362306a36Sopenharmony_ci 19462306a36Sopenharmony_ci/** 19562306a36Sopenharmony_ci * SCU_GET_FRAME_INDEX() - 19662306a36Sopenharmony_ci * 19762306a36Sopenharmony_ci * This macro returns a normalized frame index from an unsolicited frame 19862306a36Sopenharmony_ci * completion. 19962306a36Sopenharmony_ci */ 20062306a36Sopenharmony_ci#define SCU_GET_FRAME_INDEX(completion_code) \ 20162306a36Sopenharmony_ci (\ 20262306a36Sopenharmony_ci ((completion_code) & SCU_UNSOLICITED_FRAME_MASK) \ 20362306a36Sopenharmony_ci >> SCU_UNSOLICITED_FRAME_SHIFT \ 20462306a36Sopenharmony_ci ) 20562306a36Sopenharmony_ci 20662306a36Sopenharmony_ci#define SCU_UNSOLICITED_FRAME_ERROR_MASK 0x00008000 20762306a36Sopenharmony_ci 20862306a36Sopenharmony_ci/** 20962306a36Sopenharmony_ci * SCU_GET_FRAME_ERROR() - 21062306a36Sopenharmony_ci * 21162306a36Sopenharmony_ci * This macro returns a zero (0) value if there is no frame error otherwise it 21262306a36Sopenharmony_ci * returns non-zero (!0). 21362306a36Sopenharmony_ci */ 21462306a36Sopenharmony_ci#define SCU_GET_FRAME_ERROR(completion_code) \ 21562306a36Sopenharmony_ci ((completion_code) & SCU_UNSOLICITED_FRAME_ERROR_MASK) 21662306a36Sopenharmony_ci 21762306a36Sopenharmony_ci/** 21862306a36Sopenharmony_ci * 21962306a36Sopenharmony_ci * 22062306a36Sopenharmony_ci * These constants represent normalized completion codes which must be shifted 22162306a36Sopenharmony_ci * 18 bits to match it with the hardware completion code. In a 16-bit compiler, 22262306a36Sopenharmony_ci * immediate constants are 16-bit values (the size of an int). If we shift 22362306a36Sopenharmony_ci * those by 18 bits, we completely lose the value. To ensure the value is a 22462306a36Sopenharmony_ci * 32-bit value like we want, each immediate value must be cast to a u32. 22562306a36Sopenharmony_ci */ 22662306a36Sopenharmony_ci#define SCU_TASK_DONE_GOOD ((u32)0x00) 22762306a36Sopenharmony_ci#define SCU_TASK_DONE_TX_RAW_CMD_ERR ((u32)0x08) 22862306a36Sopenharmony_ci#define SCU_TASK_DONE_CRC_ERR ((u32)0x14) 22962306a36Sopenharmony_ci#define SCU_TASK_DONE_CHECK_RESPONSE ((u32)0x14) 23062306a36Sopenharmony_ci#define SCU_TASK_DONE_GEN_RESPONSE ((u32)0x15) 23162306a36Sopenharmony_ci#define SCU_TASK_DONE_NAK_CMD_ERR ((u32)0x16) 23262306a36Sopenharmony_ci#define SCU_TASK_DONE_CMD_LL_R_ERR ((u32)0x16) 23362306a36Sopenharmony_ci#define SCU_TASK_DONE_LL_R_ERR ((u32)0x17) 23462306a36Sopenharmony_ci#define SCU_TASK_DONE_ACK_NAK_TO ((u32)0x17) 23562306a36Sopenharmony_ci#define SCU_TASK_DONE_LL_PERR ((u32)0x18) 23662306a36Sopenharmony_ci#define SCU_TASK_DONE_LL_SY_TERM ((u32)0x19) 23762306a36Sopenharmony_ci#define SCU_TASK_DONE_NAK_ERR ((u32)0x19) 23862306a36Sopenharmony_ci#define SCU_TASK_DONE_LL_LF_TERM ((u32)0x1A) 23962306a36Sopenharmony_ci#define SCU_TASK_DONE_DATA_LEN_ERR ((u32)0x1A) 24062306a36Sopenharmony_ci#define SCU_TASK_DONE_LL_CL_TERM ((u32)0x1B) 24162306a36Sopenharmony_ci#define SCU_TASK_DONE_BREAK_RCVD ((u32)0x1B) 24262306a36Sopenharmony_ci#define SCU_TASK_DONE_LL_ABORT_ERR ((u32)0x1B) 24362306a36Sopenharmony_ci#define SCU_TASK_DONE_SEQ_INV_TYPE ((u32)0x1C) 24462306a36Sopenharmony_ci#define SCU_TASK_DONE_UNEXP_XR ((u32)0x1C) 24562306a36Sopenharmony_ci#define SCU_TASK_DONE_INV_FIS_TYPE ((u32)0x1D) 24662306a36Sopenharmony_ci#define SCU_TASK_DONE_XR_IU_LEN_ERR ((u32)0x1D) 24762306a36Sopenharmony_ci#define SCU_TASK_DONE_INV_FIS_LEN ((u32)0x1E) 24862306a36Sopenharmony_ci#define SCU_TASK_DONE_XR_WD_LEN ((u32)0x1E) 24962306a36Sopenharmony_ci#define SCU_TASK_DONE_SDMA_ERR ((u32)0x1F) 25062306a36Sopenharmony_ci#define SCU_TASK_DONE_OFFSET_ERR ((u32)0x20) 25162306a36Sopenharmony_ci#define SCU_TASK_DONE_MAX_PLD_ERR ((u32)0x21) 25262306a36Sopenharmony_ci#define SCU_TASK_DONE_EXCESS_DATA ((u32)0x22) 25362306a36Sopenharmony_ci#define SCU_TASK_DONE_LF_ERR ((u32)0x23) 25462306a36Sopenharmony_ci#define SCU_TASK_DONE_UNEXP_FIS ((u32)0x24) 25562306a36Sopenharmony_ci#define SCU_TASK_DONE_UNEXP_RESP ((u32)0x24) 25662306a36Sopenharmony_ci#define SCU_TASK_DONE_EARLY_RESP ((u32)0x25) 25762306a36Sopenharmony_ci#define SCU_TASK_DONE_SMP_RESP_TO_ERR ((u32)0x26) 25862306a36Sopenharmony_ci#define SCU_TASK_DONE_DMASETUP_DIRERR ((u32)0x27) 25962306a36Sopenharmony_ci#define SCU_TASK_DONE_SMP_UFI_ERR ((u32)0x27) 26062306a36Sopenharmony_ci#define SCU_TASK_DONE_XFERCNT_ERR ((u32)0x28) 26162306a36Sopenharmony_ci#define SCU_TASK_DONE_SMP_FRM_TYPE_ERR ((u32)0x28) 26262306a36Sopenharmony_ci#define SCU_TASK_DONE_SMP_LL_RX_ERR ((u32)0x29) 26362306a36Sopenharmony_ci#define SCU_TASK_DONE_RESP_LEN_ERR ((u32)0x2A) 26462306a36Sopenharmony_ci#define SCU_TASK_DONE_UNEXP_DATA ((u32)0x2B) 26562306a36Sopenharmony_ci#define SCU_TASK_DONE_OPEN_FAIL ((u32)0x2C) 26662306a36Sopenharmony_ci#define SCU_TASK_DONE_UNEXP_SDBFIS ((u32)0x2D) 26762306a36Sopenharmony_ci#define SCU_TASK_DONE_REG_ERR ((u32)0x2E) 26862306a36Sopenharmony_ci#define SCU_TASK_DONE_SDB_ERR ((u32)0x2F) 26962306a36Sopenharmony_ci#define SCU_TASK_DONE_TASK_ABORT ((u32)0x30) 27062306a36Sopenharmony_ci#define SCU_TASK_DONE_CMD_SDMA_ERR ((U32)0x32) 27162306a36Sopenharmony_ci#define SCU_TASK_DONE_CMD_LL_ABORT_ERR ((U32)0x33) 27262306a36Sopenharmony_ci#define SCU_TASK_OPEN_REJECT_WRONG_DESTINATION ((u32)0x34) 27362306a36Sopenharmony_ci#define SCU_TASK_OPEN_REJECT_RESERVED_ABANDON_1 ((u32)0x35) 27462306a36Sopenharmony_ci#define SCU_TASK_OPEN_REJECT_RESERVED_ABANDON_2 ((u32)0x36) 27562306a36Sopenharmony_ci#define SCU_TASK_OPEN_REJECT_RESERVED_ABANDON_3 ((u32)0x37) 27662306a36Sopenharmony_ci#define SCU_TASK_OPEN_REJECT_BAD_DESTINATION ((u32)0x38) 27762306a36Sopenharmony_ci#define SCU_TASK_OPEN_REJECT_ZONE_VIOLATION ((u32)0x39) 27862306a36Sopenharmony_ci#define SCU_TASK_DONE_VIIT_ENTRY_NV ((u32)0x3A) 27962306a36Sopenharmony_ci#define SCU_TASK_DONE_IIT_ENTRY_NV ((u32)0x3B) 28062306a36Sopenharmony_ci#define SCU_TASK_DONE_RNCNV_OUTBOUND ((u32)0x3C) 28162306a36Sopenharmony_ci#define SCU_TASK_OPEN_REJECT_STP_RESOURCES_BUSY ((u32)0x3D) 28262306a36Sopenharmony_ci#define SCU_TASK_OPEN_REJECT_PROTOCOL_NOT_SUPPORTED ((u32)0x3E) 28362306a36Sopenharmony_ci#define SCU_TASK_OPEN_REJECT_CONNECTION_RATE_NOT_SUPPORTED ((u32)0x3F) 28462306a36Sopenharmony_ci 28562306a36Sopenharmony_ci#endif /* _SCU_COMPLETION_CODES_HEADER_ */ 286