1/*******************************************************************************
2*Copyright (c) 2014 PMC-Sierra, Inc.  All rights reserved.
3*
4*Redistribution and use in source and binary forms, with or without modification, are permitted provided
5*that the following conditions are met:
6*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
7*following disclaimer.
8*2. Redistributions in binary form must reproduce the above copyright notice,
9*this list of conditions and the following disclaimer in the documentation and/or other materials provided
10*with the distribution.
11*
12*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
13*WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
15*FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16*NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
17*BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
18*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
19*SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
20
21********************************************************************************/
22/*******************************************************************************/
23/** \file
24 *
25 * $RCSfile: ttdtxchg.h,v $
26 *
27 * Copyright 2006 PMC-Sierra, Inc.
28 *
29 *
30 * #define and data structures for SAS target in SAS/SATA TD layer
31 *
32 */
33
34typedef struct sas_resp_s
35{
36  agsaSSPResponseInfoUnit_t    agResp;
37  bit8                         RespData[4];
38  bit8                         SenseData[64];
39} sas_resp_t;
40
41typedef struct smp_resp_s
42{
43  bit8                         RespData[1024]; /* SAS Spec */
44} smp_resp_t;
45
46
47typedef struct
48{
49  bit8   *virtAddr;
50  bit32  phyAddrUpper;
51  bit32  phyAddrLower;
52  bit32  length;
53} ttdsaDmaMemoryArea_t;
54
55struct tdsaDeviceData_s;
56
57/* I/O structurre */
58typedef struct ttdsaXchg_s
59{
60
61  tdIORequestBody_t              IORequestBody; /* has to be at the top */
62  tdssSMPRequestBody_t           SMPRequestBody; /* has to be at the second top */
63
64  tdList_t                       XchgLinks;
65  /* pointer to device(initiator) for which the I/O was initiated */
66  struct tdsaDeviceData_s        *DeviceData;
67  struct ttdsaXchg_s             *pTMResp;
68  bit32                          oustandingIos;
69  bit32                          isAborting;
70  bit32                          oslayerAborting;
71  bit32                          isTMRequest;
72  bit32                          index;         /* index of structure */
73  agsaSSPCmdInfoUnit_t           agSSPCmndIU;
74  agsaSSPScsiTaskMgntReq_t       agTMIU;
75  /* SSPTargetRead/SSPTargetWrite             */
76  bit32                          XchType;
77  bit32                          FrameType; /* cmnd or TM */
78  agsaRoot_t                     *agRoot;
79  tiRoot_t                       *tiRoot;
80  /* indicates that at the completion of this data phase, this
81     exchange structure will be freed */
82  bit32                          statusSent;
83  bit32                          responseSent;
84  bit32                          readRspCollapsed : 1;
85  bit32                          wrtRspCollapsed : 1;
86  bit32                          readWrtCollapsedRes : 30;
87  tiTargetScsiCmnd_t             tiTgtScsiCmnd;
88
89  /* initiator tag a target received */
90  bit16                          tag;
91  bit64                          dataLen;
92  bit32                          respLen;
93  bit32                          smprespLen;
94  ttdsaDmaMemoryArea_t           resp; /* sas response */
95  ttdsaDmaMemoryArea_t           smpresp; /* sas smp response */
96  bit32                          usedEsgl;
97  /* for abort task io which is not founded in TD */
98  bit32                          io_found;
99  /* for debugging only */
100  bit32                          id;
101  /* PhyId for SMP*/
102  bit32                          SMPphyId;
103  bit32                          state;
104  bit32                          TLR; /* Transport Layer Retransmit bits */
105  bit32                          retries; /* retries */
106  tiIORequest_t                  *tiIOToBeAbortedRequest; /* IO to be aborted */
107  struct ttdsaXchg_s             *XchgToBeAborted; /* Xchg to be aborted */
108} ttdsaXchg_t;
109
110/*************************************************************************
111** now ttdssIOData_t and old tgtXchgData_t -
112**************************************************************************/
113
114typedef struct ttdsaXchgData_s
115{
116  bit32           maxNumXchgs;
117  tdList_t        xchgFreeList;
118  tdList_t        xchgBusyList;
119  bit32           noUsed;
120  bit32           noFreed;
121  bit32           noCmdRcvd;
122  bit32           noStartIo;
123  bit32           noSendRsp;
124  bit32           noCompleted;
125} ttdsaXchgData_t;
126
127
128