1285809Sscottl/*******************************************************************************
2285809Sscottl*Copyright (c) 2014 PMC-Sierra, Inc.  All rights reserved.
3285809Sscottl*
4285809Sscottl*Redistribution and use in source and binary forms, with or without modification, are permitted provided
5285809Sscottl*that the following conditions are met:
6285809Sscottl*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
7285809Sscottl*following disclaimer.
8285809Sscottl*2. Redistributions in binary form must reproduce the above copyright notice,
9285809Sscottl*this list of conditions and the following disclaimer in the documentation and/or other materials provided
10285809Sscottl*with the distribution.
11285809Sscottl*
12285809Sscottl*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
13285809Sscottl*WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14285809Sscottl*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
15285809Sscottl*FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16285809Sscottl*NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
17285809Sscottl*BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
18285809Sscottl*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
19285809Sscottl*SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
20285809Sscottl
21285809Sscottl********************************************************************************/
22285809Sscottl/*******************************************************************************/
23285809Sscottl/** \file
24285809Sscottl *
25285809Sscottl * $RCSfile: ttdtxchg.h,v $
26285809Sscottl *
27285809Sscottl * Copyright 2006 PMC-Sierra, Inc.
28285809Sscottl *
29285809Sscottl *
30285809Sscottl * #define and data structures for SAS target in SAS/SATA TD layer
31285809Sscottl *
32285809Sscottl */
33285809Sscottl
34285809Sscottltypedef struct sas_resp_s
35285809Sscottl{
36285809Sscottl  agsaSSPResponseInfoUnit_t    agResp;
37285809Sscottl  bit8                         RespData[4];
38285809Sscottl  bit8                         SenseData[64];
39285809Sscottl} sas_resp_t;
40285809Sscottl
41285809Sscottltypedef struct smp_resp_s
42285809Sscottl{
43285809Sscottl  bit8                         RespData[1024]; /* SAS Spec */
44285809Sscottl} smp_resp_t;
45285809Sscottl
46285809Sscottl
47285809Sscottltypedef struct
48285809Sscottl{
49285809Sscottl  bit8   *virtAddr;
50285809Sscottl  bit32  phyAddrUpper;
51285809Sscottl  bit32  phyAddrLower;
52285809Sscottl  bit32  length;
53285809Sscottl} ttdsaDmaMemoryArea_t;
54285809Sscottl
55285809Sscottlstruct tdsaDeviceData_s;
56285809Sscottl
57285809Sscottl/* I/O structurre */
58285809Sscottltypedef struct ttdsaXchg_s
59285809Sscottl{
60285809Sscottl
61285809Sscottl  tdIORequestBody_t              IORequestBody; /* has to be at the top */
62285809Sscottl  tdssSMPRequestBody_t           SMPRequestBody; /* has to be at the second top */
63285809Sscottl
64285809Sscottl  tdList_t                       XchgLinks;
65285809Sscottl  /* pointer to device(initiator) for which the I/O was initiated */
66285809Sscottl  struct tdsaDeviceData_s        *DeviceData;
67285809Sscottl  struct ttdsaXchg_s             *pTMResp;
68285809Sscottl  bit32                          oustandingIos;
69285809Sscottl  bit32                          isAborting;
70285809Sscottl  bit32                          oslayerAborting;
71285809Sscottl  bit32                          isTMRequest;
72285809Sscottl  bit32                          index;         /* index of structure */
73285809Sscottl  agsaSSPCmdInfoUnit_t           agSSPCmndIU;
74285809Sscottl  agsaSSPScsiTaskMgntReq_t       agTMIU;
75285809Sscottl  /* SSPTargetRead/SSPTargetWrite             */
76285809Sscottl  bit32                          XchType;
77285809Sscottl  bit32                          FrameType; /* cmnd or TM */
78285809Sscottl  agsaRoot_t                     *agRoot;
79285809Sscottl  tiRoot_t                       *tiRoot;
80285809Sscottl  /* indicates that at the completion of this data phase, this
81285809Sscottl     exchange structure will be freed */
82285809Sscottl  bit32                          statusSent;
83285809Sscottl  bit32                          responseSent;
84285809Sscottl  bit32                          readRspCollapsed : 1;
85285809Sscottl  bit32                          wrtRspCollapsed : 1;
86285809Sscottl  bit32                          readWrtCollapsedRes : 30;
87285809Sscottl  tiTargetScsiCmnd_t             tiTgtScsiCmnd;
88285809Sscottl
89285809Sscottl  /* initiator tag a target received */
90285809Sscottl  bit16                          tag;
91285809Sscottl  bit64                          dataLen;
92285809Sscottl  bit32                          respLen;
93285809Sscottl  bit32                          smprespLen;
94285809Sscottl  ttdsaDmaMemoryArea_t           resp; /* sas response */
95285809Sscottl  ttdsaDmaMemoryArea_t           smpresp; /* sas smp response */
96285809Sscottl  bit32                          usedEsgl;
97285809Sscottl  /* for abort task io which is not founded in TD */
98285809Sscottl  bit32                          io_found;
99285809Sscottl  /* for debugging only */
100285809Sscottl  bit32                          id;
101285809Sscottl  /* PhyId for SMP*/
102285809Sscottl  bit32                          SMPphyId;
103285809Sscottl  bit32                          state;
104285809Sscottl  bit32                          TLR; /* Transport Layer Retransmit bits */
105285809Sscottl  bit32                          retries; /* retries */
106285809Sscottl  tiIORequest_t                  *tiIOToBeAbortedRequest; /* IO to be aborted */
107285809Sscottl  struct ttdsaXchg_s             *XchgToBeAborted; /* Xchg to be aborted */
108285809Sscottl} ttdsaXchg_t;
109285809Sscottl
110285809Sscottl/*************************************************************************
111285809Sscottl** now ttdssIOData_t and old tgtXchgData_t -
112285809Sscottl**************************************************************************/
113285809Sscottl
114285809Sscottltypedef struct ttdsaXchgData_s
115285809Sscottl{
116285809Sscottl  bit32           maxNumXchgs;
117285809Sscottl  tdList_t        xchgFreeList;
118285809Sscottl  tdList_t        xchgBusyList;
119285809Sscottl  bit32           noUsed;
120285809Sscottl  bit32           noFreed;
121285809Sscottl  bit32           noCmdRcvd;
122285809Sscottl  bit32           noStartIo;
123285809Sscottl  bit32           noSendRsp;
124285809Sscottl  bit32           noCompleted;
125285809Sscottl} ttdsaXchgData_t;
126285809Sscottl
127285809Sscottl
128