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* $FreeBSD$
22285809Sscottl*
23285809Sscottl********************************************************************************/
24285809Sscottl/********************************************************************************
25285809Sscottl**
26285809Sscottl** Version Control Information:
27285809Sscottl**
28285809Sscottl**
29285809Sscottl*******************************************************************************/
30285809Sscottl/********************************************************************************
31285809Sscottl**
32285809Sscottl**   titypes.h
33285809Sscottl**
34285809Sscottl**   Abstract:   This module contains data structure definition used
35285809Sscottl**               by the Transport Independent API (TIAPI) Layer.
36285809Sscottl**
37285809Sscottl********************************************************************************/
38285809Sscottl
39285809Sscottl#include <dev/pms/RefTisa/tisa/api/tidefs.h>
40285809Sscottl
41285809Sscottl#ifndef TITYPES_H
42285809Sscottl#define TITYPES_H
43285809Sscottl
44285809Sscottl/*****************************************************************************
45285809Sscottl * SHARED TYPES
46285809Sscottl *****************************************************************************/
47285809Sscottl
48285809Sscottltypedef struct tiPortalContext
49285809Sscottl{
50285809Sscottl  void    *osData;
51285809Sscottl  void    *tdData;
52285809Sscottl} tiPortalContext_t;
53285809Sscottl
54285809Sscottltypedef struct tiDeviceHandle
55285809Sscottl{
56285809Sscottl  void    *osData;
57285809Sscottl  void    *tdData;
58285809Sscottl} tiDeviceHandle_t;
59285809Sscottl
60285809Sscottltypedef struct tiRoot
61285809Sscottl{
62285809Sscottl  void    *osData;
63285809Sscottl  void    *tdData;
64285809Sscottl} tiRoot_t;
65285809Sscottl
66285809Sscottltypedef struct tiMem
67285809Sscottl{
68285809Sscottl  void    *virtPtr;
69285809Sscottl  void    *osHandle;
70285809Sscottl  bit32   physAddrUpper;
71285809Sscottl  bit32   physAddrLower;
72285809Sscottl  bit32   totalLength;
73285809Sscottl  bit32   numElements;
74285809Sscottl  bit32   singleElementLength;
75285809Sscottl  bit32   alignment;
76285809Sscottl  bit32   type;
77285809Sscottl  bit32   reserved;
78285809Sscottl} tiMem_t;
79285809Sscottl
80285809Sscottltypedef struct tiLoLevelMem
81285809Sscottl{
82285809Sscottl  bit32       count;
83285809Sscottl  tiMem_t     mem[MAX_LL_LAYER_MEM_DESCRIPTORS];
84285809Sscottl} tiLoLevelMem_t;
85285809Sscottl
86285809Sscottltypedef struct tiLoLevelOption
87285809Sscottl{
88285809Sscottl  bit32       usecsPerTick;
89285809Sscottl  bit32       numOfQueuesPerPort;
90285809Sscottl  bit32       mutexLockUsage;
91285809Sscottl  bit32       pciFunctionNumber;
92285809Sscottl  bit32       maxPortContext;
93285809Sscottl  bit32       maxNumOSLocks;
94285809Sscottl  agBOOLEAN   encryption;
95285809Sscottl  bit32       maxInterruptVectors;
96285809Sscottl  bit32       flag;
97285809Sscottl  bit32       max_MSI_InterruptVectors;
98285809Sscottl#ifdef SA_ENABLE_PCI_TRIGGER
99285809Sscottl  bit32       PCI_trigger;
100285809Sscottl#endif /* SA_ENABLE_PCI_TRIGGER */
101285809Sscottl
102285809Sscottl} tiLoLevelOption_t;
103285809Sscottl
104285809Sscottltypedef struct tiLoLevelResource
105285809Sscottl{
106285809Sscottl  tiLoLevelOption_t   loLevelOption;
107285809Sscottl  tiLoLevelMem_t      loLevelMem;
108285809Sscottl} tiLoLevelResource_t;
109285809Sscottl
110285809Sscottltypedef struct tiTdSharedMem
111285809Sscottl{
112285809Sscottl  tiMem_t     tdSharedCachedMem1;
113285809Sscottl} tiTdSharedMem_t;
114285809Sscottl
115285809Sscottltypedef struct tiIORequest
116285809Sscottl{
117285809Sscottl  void    *osData;
118285809Sscottl  void    *tdData;
119285809Sscottl} tiIORequest_t;
120285809Sscottl
121285809Sscottltypedef struct tiSgl_s
122285809Sscottl{
123285809Sscottl  bit32   lower;
124285809Sscottl  bit32   upper;
125285809Sscottl  bit32   len;
126285809Sscottl  bit32   type;
127285809Sscottl} tiSgl_t;
128285809Sscottl
129285809Sscottltypedef struct tiSenseData
130285809Sscottl{
131285809Sscottl  void    *senseData;
132285809Sscottl  bit8    senseLen;
133285809Sscottl} tiSenseData_t;
134285809Sscottl
135285809Sscottltypedef struct tiIOCTLPayload
136285809Sscottl{
137285809Sscottl  bit32       Signature;
138285809Sscottl  bit16       MajorFunction;
139285809Sscottl  bit16       MinorFunction;
140285809Sscottl  bit16       Length;
141285809Sscottl  bit16       Status;
142285809Sscottl  bit32       Reserved; /* required for 64 bit alignment */
143285809Sscottl  bit8        FunctionSpecificArea[1];
144285809Sscottl}tiIOCTLPayload_t;
145285809Sscottl
146285809Sscottl
147285809Sscottltypedef struct tiIOCTLPayload_wwn
148285809Sscottl{
149285809Sscottl  bit32       Signature;
150285809Sscottl  bit16       MajorFunction;
151285809Sscottl  bit16       MinorFunction;
152285809Sscottl  bit16       Length;
153285809Sscottl  bit16       Status;
154285809Sscottl  bit32       Reserved; /* required for 64 bit alignment */
155285809Sscottl  bit8        FunctionSpecificArea[8];
156285809Sscottl}tiIOCTLPayload_wwn_t;
157285809Sscottl
158285809Sscottltypedef struct tiPortInfo
159285809Sscottl{
160285809Sscottl  char  *name;
161285809Sscottl  char  *address;
162285809Sscottl  char  *localName;
163285809Sscottl  char  *remoteName;
164285809Sscottl  bit32 localNameLen;
165285809Sscottl  bit32 remoteNameLen;
166285809Sscottl} tiPortInfo_t;
167285809Sscottl
168285809Sscottltypedef struct tiDif_s
169285809Sscottl{
170285809Sscottl  agBOOLEAN   enableDIFPerLA;
171285809Sscottl  bit32       flags;
172285809Sscottl  bit16       initialIOSeed;
173285809Sscottl  bit16       reserved;
174285809Sscottl  bit32       DIFPerLAAddrLo;
175285809Sscottl  bit32       DIFPerLAAddrHi;
176285809Sscottl  bit16       DIFPerLARegion0SecCount;
177285809Sscottl  bit16       DIFPerLANumOfRegions;
178285809Sscottl  bit8        udtArray[DIF_UDT_SIZE];
179285809Sscottl  bit8        udtrArray[DIF_UDT_SIZE];
180285809Sscottl} tiDif_t;
181285809Sscottl
182285809Sscottl#define DIF_INSERT                  0
183285809Sscottl#define DIF_VERIFY_FORWARD          1
184285809Sscottl#define DIF_VERIFY_DELETE           2
185285809Sscottl#define DIF_VERIFY_REPLACE          3
186285809Sscottl#define DIF_VERIFY_UDT_REPLACE_CRC  5
187285809Sscottl#define DIF_REPLACE_UDT_REPLACE_CRC 7
188285809Sscottl
189285809Sscottl#define DIF_BLOCK_SIZE_512          0x00
190285809Sscottl#define DIF_BLOCK_SIZE_520          0x01
191285809Sscottl#define DIF_BLOCK_SIZE_4096         0x02
192285809Sscottl#define DIF_BLOCK_SIZE_4160         0x03
193285809Sscottl
194285809Sscottl#define DIF_ACTION_FLAG_MASK        0x00000007 /* 0 - 2 */
195285809Sscottl#define DIF_CRC_VERIFICATION        0x00000008 /* 3 */
196285809Sscottl#define DIF_CRC_INVERSION           0x00000010 /* 4 */
197285809Sscottl#define DIF_CRC_IO_SEED             0x00000020 /* 5 */
198285809Sscottl#define DIF_UDT_REF_BLOCK_COUNT     0x00000040 /* 6 */
199285809Sscottl#define DIF_UDT_APP_BLOCK_COUNT     0x00000080 /* 7 */
200285809Sscottl#define DIF_UDTR_REF_BLOCK_COUNT    0x00000100 /* 8 */
201285809Sscottl#define DIF_UDTR_APP_BLOCK_COUNT    0x00000200 /* 9 */
202285809Sscottl#define DIF_CUST_APP_TAG            0x00000C00 /* 10 - 11 */
203285809Sscottl#define DIF_FLAG_RESERVED           0x0000F000 /* 12 - 15 */
204285809Sscottl#define DIF_DATA_BLOCK_SIZE_MASK    0x000F0000 /* 16 - 19 */
205285809Sscottl#define DIF_DATA_BLOCK_SIZE_SHIFT   16
206285809Sscottl#define DIF_TAG_VERIFY_MASK         0x03F00000 /* 20 - 25 */
207285809Sscottl#define DIF_TAG_UPDATE_MASK         0xFC000000 /* 26 - 31 */
208285809Sscottl
209285809Sscottl
210285809Sscottl#define NORMAL_BLOCK_SIZE_512       512
211285809Sscottl#define NORMAL_BLOCK_SIZE_4K        4096
212285809Sscottl
213285809Sscottl#define DIF_PHY_BLOCK_SIZE_512      512
214285809Sscottl#define DIF_PHY_BLOCK_SIZE_520      520
215285809Sscottl#define DIF_PHY_BLOCK_SIZE_4096     4096
216285809Sscottl#define DIF_PHY_BLOCK_SIZE_4160     4160
217285809Sscottl
218285809Sscottl#define DIF_LOGIC_BLOCK_SIZE_520    520
219285809Sscottl#define DIF_LOGIC_BLOCK_SIZE_528    528
220285809Sscottl#define DIF_LOGIC_BLOCK_SIZE_4104   4104
221285809Sscottl#define DIF_LOGIC_BLOCK_SIZE_4168   4168
222285809Sscottl
223285809Sscottl
224285809Sscottl
225285809Sscottl
226285809Sscottltypedef struct tiDetailedDeviceInfo
227285809Sscottl{
228285809Sscottl  bit8    devType_S_Rate;
229285809Sscottl    /* Bit 6-7: reserved
230285809Sscottl       Bit 4-5: Two bits flag to specify a SAS or SATA (STP) device:
231285809Sscottl                00: SATA or STP device
232285809Sscottl                01: SSP or SMP device
233285809Sscottl                10: Direct SATA device
234285809Sscottl       Bit 0-3: Connection Rate field when opening the device.
235285809Sscottl                Code Description:
236285809Sscottl        00h:  Device has not been registered
237285809Sscottl                08h:  1,5 Gbps
238285809Sscottl                09h:  3,0 Gbps
239285809Sscottl                0ah:  6.0 Gbps
240285809Sscottl                All others Reserved
241285809Sscottl    */
242285809Sscottl  bit8    reserved1;
243285809Sscottl  bit16   reserved2;
244285809Sscottl} tiDetailedDeviceInfo_t;
245285809Sscottl
246285809Sscottltypedef struct tiDeviceInfo
247285809Sscottl{
248285809Sscottl  char                   *localName;
249285809Sscottl  char                   *localAddress;
250285809Sscottl  char                   *remoteName;
251285809Sscottl  char                   *remoteAddress;
252285809Sscottl  bit16                  osAddress1;
253285809Sscottl  bit16                  osAddress2;
254285809Sscottl  bit32                  loginState;
255285809Sscottl  tiDetailedDeviceInfo_t info;
256285809Sscottl} tiDeviceInfo_t;
257285809Sscottl
258285809Sscottl
259285809Sscottl#define KEK_BLOB_SIZE           48
260285809Sscottl#define KEK_AUTH_SIZE           40
261285809Sscottl#define KEK_MAX_TABLE_ENTRIES   8
262285809Sscottl
263285809Sscottl#define DEK_MAX_TABLES          2
264285809Sscottl#define DEK_MAX_TABLE_ENTRIES   (1024*4)
265285809Sscottl
266285809Sscottl#define DEK_BLOB_SIZE_07        72
267285809Sscottl#define DEK_BLOB_SIZE_08        80
268285809Sscottl
269285809Sscottl#define OPERATOR_ROLE_ID_SIZE   1024
270285809Sscottl
271285809Sscottl#define HMAC_SECRET_KEY_SIZE    72
272285809Sscottl
273285809Sscottltypedef struct tiEncryptKekBlob
274285809Sscottl{
275285809Sscottl  bit8    kekBlob[KEK_BLOB_SIZE];
276285809Sscottl} tiEncryptKekBlob_t;
277285809Sscottl
278285809Sscottltypedef struct tiEncryptDekBlob
279285809Sscottl{
280285809Sscottl  bit8    dekBlob[DEK_BLOB_SIZE_08];
281285809Sscottl} tiEncryptDekBlob_t;
282285809Sscottl
283285809Sscottltypedef struct DEK_Table_s {
284285809Sscottl  tiEncryptDekBlob_t  Dek[DEK_MAX_TABLE_ENTRIES];
285285809Sscottl}tiDEK_Table_t;
286285809Sscottl
287285809Sscottltypedef struct DEK_Tables_s {
288285809Sscottl  tiDEK_Table_t  DekTable[DEK_MAX_TABLES];
289285809Sscottl} tiDEK_Tables_t;
290285809Sscottl
291285809Sscottl/*sTSDK  4.38  */
292285809Sscottl#define OPR_MGMT_ID_STRING_SIZE 31
293285809Sscottl
294285809Sscottltypedef struct tiID_s {
295285809Sscottl   bit8   ID[OPR_MGMT_ID_STRING_SIZE];
296285809Sscottl} tiID_t;
297285809Sscottl
298285809Sscottltypedef struct tiEncryptInfo
299285809Sscottl{
300285809Sscottl  bit32   securityCipherMode;
301285809Sscottl  bit32   status;
302285809Sscottl  bit32   sectorSize[6];
303285809Sscottl} tiEncryptInfo_t;
304285809Sscottl
305285809Sscottltypedef struct tiEncryptPort
306285809Sscottl{
307285809Sscottl  bit32   encryptEvent;
308285809Sscottl  bit32   subEvent;
309285809Sscottl  void    *pData;
310285809Sscottl} tiEncryptPort_t;
311285809Sscottl
312285809Sscottltypedef struct tiEncryptDek
313285809Sscottl{
314285809Sscottl  bit32    dekTable;
315285809Sscottl  bit32    dekIndex;
316285809Sscottl} tiEncryptDek_t;
317285809Sscottl
318285809Sscottltypedef struct tiEncrypt
319285809Sscottl{
320285809Sscottl    tiEncryptDek_t dekInfo;
321285809Sscottl    bit32          kekIndex;
322285809Sscottl    agBOOLEAN      keyTagCheck;
323285809Sscottl    agBOOLEAN      enableEncryptionPerLA;
324285809Sscottl    bit32          sectorSizeIndex;
325285809Sscottl    bit32          encryptMode;
326285809Sscottl    bit32          keyTag_W0;
327285809Sscottl    bit32          keyTag_W1;
328285809Sscottl    bit32          tweakVal_W0;
329285809Sscottl    bit32          tweakVal_W1;
330285809Sscottl    bit32          tweakVal_W2;
331285809Sscottl    bit32          tweakVal_W3;
332285809Sscottl    bit32          EncryptionPerLAAddrLo;
333285809Sscottl    bit32          EncryptionPerLAAddrHi;
334285809Sscottl    bit16          EncryptionPerLRegion0SecCount;
335285809Sscottl    bit16          reserved;
336285809Sscottl} tiEncrypt_t;
337285809Sscottl
338285809Sscottltypedef struct tiHWEventMode_s
339285809Sscottl{
340285809Sscottl    bit32          modePageOperation;
341285809Sscottl    bit32          status;
342285809Sscottl    bit32          modePageLen;
343285809Sscottl    void           *modePage;
344285809Sscottl    void           *context;
345285809Sscottl} tiHWEventMode_t;
346285809Sscottl
347285809Sscottl/*****************************************************************************
348285809Sscottl * INITIATOR TYPES
349285809Sscottl *****************************************************************************/
350285809Sscottl
351285809Sscottltypedef struct tiInitiatorMem
352285809Sscottl{
353285809Sscottl  bit32       count;
354285809Sscottl  tiMem_t     tdCachedMem[6];
355285809Sscottl} tiInitiatorMem_t;
356285809Sscottl
357285809Sscottltypedef struct tiInitiatorOption
358285809Sscottl{
359285809Sscottl  bit32       usecsPerTick;
360285809Sscottl  bit32       pageSize;
361285809Sscottl  tiMem_t     dynamicDmaMem;
362285809Sscottl  tiMem_t     dynamicCachedMem;
363285809Sscottl  bit32       ioRequestBodySize;
364285809Sscottl} tiInitiatorOption_t;
365285809Sscottl
366285809Sscottl
367285809Sscottltypedef struct tiInitiatorResource
368285809Sscottl{
369285809Sscottl  tiInitiatorOption_t     initiatorOption;
370285809Sscottl  tiInitiatorMem_t        initiatorMem;
371285809Sscottl} tiInitiatorResource_t;
372285809Sscottl
373285809Sscottltypedef struct tiLUN
374285809Sscottl{
375285809Sscottl  bit8    lun[8];
376285809Sscottl} tiLUN_t;
377285809Sscottl
378285809Sscottltypedef struct tiIniScsiCmnd
379285809Sscottl{
380285809Sscottl  tiLUN_t     lun;
381285809Sscottl  bit32       expDataLength;
382285809Sscottl  bit32       taskAttribute;
383285809Sscottl  bit32       crn;
384285809Sscottl  bit8        cdb[16];
385285809Sscottl} tiIniScsiCmnd_t;
386285809Sscottl
387285809Sscottltypedef struct tiScsiInitiatorRequest
388285809Sscottl{
389285809Sscottl  void                *sglVirtualAddr;
390285809Sscottl  tiIniScsiCmnd_t     scsiCmnd;
391285809Sscottl  tiSgl_t             agSgl1;
392285809Sscottl  tiDataDirection_t   dataDirection;
393285809Sscottl} tiScsiInitiatorRequest_t;
394285809Sscottl
395285809Sscottl/* This is the standard request body for I/O that requires DIF or encryption. */
396285809Sscottltypedef struct tiSuperScsiInitiatorRequest
397285809Sscottl{
398285809Sscottl  void                *sglVirtualAddr;
399285809Sscottl  tiIniScsiCmnd_t     scsiCmnd;
400285809Sscottl  tiSgl_t             agSgl1;
401285809Sscottl  tiDataDirection_t   dataDirection;
402285809Sscottl  bit32               flags;
403285809Sscottl#ifdef CCBUILD_INDIRECT_CDB
404285809Sscottl  bit32               IndCDBLowAddr;       /* The low physical address of indirect CDB buffer in host memory */
405285809Sscottl  bit32               IndCDBHighAddr;      /* The high physical address of indirect CDB buffer in host memory */
406285809Sscottl  bit32               IndCDBLength;        /* Indirect CDB length */
407285809Sscottl  void                *IndCDBBuffer;       /* Indirect SSPIU buffer */
408285809Sscottl#endif
409285809Sscottl  tiDif_t             Dif;
410285809Sscottl  tiEncrypt_t         Encrypt;
411285809Sscottl} tiSuperScsiInitiatorRequest_t;
412285809Sscottl
413285809Sscottltypedef struct tiSMPFrame
414285809Sscottl{
415285809Sscottl  void        *outFrameBuf;
416285809Sscottl  bit32       outFrameAddrUpper32;
417285809Sscottl  bit32       outFrameAddrLower32;
418285809Sscottl  bit32       outFrameLen;
419285809Sscottl  bit32       inFrameAddrUpper32;
420285809Sscottl  bit32       inFrameAddrLower32;
421285809Sscottl  bit32       inFrameLen;
422285809Sscottl  bit32       expectedRespLen;
423285809Sscottl  bit32       flag;
424285809Sscottl} tiSMPFrame_t;
425285809Sscottltypedef struct tiEVTData
426285809Sscottl{
427285809Sscottl  bit32   SequenceNo;
428285809Sscottl  bit32   TimeStamp;
429285809Sscottl  bit32   Source;
430285809Sscottl  bit32   Code;
431285809Sscottl  bit8    Reserved;
432285809Sscottl  bit8    BinaryDataLength;
433285809Sscottl  bit8    DataAndMessage[EVENTLOG_MAX_MSG_LEN];
434285809Sscottl} tiEVTData_t;
435285809Sscottl
436285809Sscottltypedef bit32 (*IsrHandler_t)(
437285809Sscottl                        tiRoot_t    *tiRoot,
438285809Sscottl                        bit32       channelNum
439285809Sscottl                        );
440285809Sscottltypedef void (*DeferedHandler_t)(
441285809Sscottl                        tiRoot_t    *tiRoot,
442285809Sscottl                        bit32       channelNum,
443285809Sscottl                        bit32       count,
444285809Sscottl                        bit32       context
445285809Sscottl                        );
446285809Sscottl
447285809Sscottl/*****************************************************************************
448285809Sscottl * TARGET TYPES
449285809Sscottl *****************************************************************************/
450285809Sscottl
451285809Sscottltypedef struct tiTargetMem {
452285809Sscottl  bit32     count;
453285809Sscottl  tiMem_t   tdMem[10];
454285809Sscottl} tiTargetMem_t;
455285809Sscottl
456285809Sscottltypedef struct tiTargetOption {
457285809Sscottl  bit32     usecsPerTick;
458285809Sscottl  bit32     pageSize;
459285809Sscottl  bit32     numLgns;
460285809Sscottl  bit32     numSessions;
461285809Sscottl  bit32     numXchgs;
462285809Sscottl  tiMem_t   dynamicDmaMem;
463285809Sscottl  tiMem_t   dynamicCachedMem;
464285809Sscottl} tiTargetOption_t;
465285809Sscottl
466285809Sscottltypedef struct
467285809Sscottl{
468285809Sscottl  tiTargetOption_t     targetOption;
469285809Sscottl  tiTargetMem_t        targetMem;
470285809Sscottl} tiTargetResource_t;
471285809Sscottl
472285809Sscottltypedef struct
473285809Sscottl{
474285809Sscottl  bit8      *reqCDB;
475285809Sscottl  bit8      *scsiLun;
476285809Sscottl  bit32     taskAttribute;
477285809Sscottl  bit32     taskId;
478285809Sscottl  bit32     crn;
479285809Sscottl} tiTargetScsiCmnd_t;
480285809Sscottl
481285809Sscottltypedef struct tiSuperScsiTargetRequest
482285809Sscottl{
483285809Sscottl  bit32               flags;
484285809Sscottl  tiDif_t             Dif;
485285809Sscottl  tiEncrypt_t         Encrypt;
486285809Sscottl  tiSgl_t             agSgl;
487285809Sscottl  void                *sglVirtualAddr;
488285809Sscottl  tiSgl_t             agSglMirror;
489285809Sscottl  void                *sglVirtualAddrMirror;
490285809Sscottl  bit32               Offset;
491285809Sscottl  bit32               DataLength;
492285809Sscottl} tiSuperScsiTargetRequest_t;
493285809Sscottl
494285809Sscottl/* SPCv controller mode page definitions */
495285809Sscottltypedef struct tiEncryptGeneralPage_s {
496285809Sscottl  bit32             pageCode;           /* 0x20 */
497285809Sscottl  bit32             numberOfDeks;
498285809Sscottl} tiEncryptGeneralPage_t;
499285809Sscottl
500285809Sscottl#define TD_ENC_CONFIG_PAGE_KEK_NUMBER 0x0000FF00
501285809Sscottl#define TD_ENC_CONFIG_PAGE_KEK_SHIFT  8
502285809Sscottl
503285809Sscottltypedef struct tiEncryptDekConfigPage
504285809Sscottl{
505285809Sscottl  bit32 pageCode;                      /* 0x21 */
506285809Sscottl  bit32 table0AddrLo;
507285809Sscottl  bit32 table0AddrHi;
508285809Sscottl  bit32 table0Entries;
509285809Sscottl  bit32 table0Config;
510285809Sscottl  bit32 table1AddrLo;
511285809Sscottl  bit32 table1AddrHi;
512285809Sscottl  bit32 table1Entries;
513285809Sscottl  bit32 table1Config;
514285809Sscottl} tiEncryptDekConfigPage_t;
515285809Sscottl
516285809Sscottl#define TD_ENC_DEK_CONFIG_PAGE_DEK_TABLE_NUMBER 0xF0000000
517285809Sscottl#define TD_ENC_DEK_CONFIG_PAGE_DEK_CACHE_WAYS   0x0F000000
518285809Sscottl#define TD_ENC_DEK_CONFIG_PAGE_DPR              0x00000200
519285809Sscottl#define TD_ENC_DEK_CONFIG_PAGE_DER              0x00000100
520285809Sscottl#define TD_ENC_DEK_CONFIG_PAGE_DEK_CACHE_SHIFT  24
521285809Sscottl#define TD_ENC_DEK_CONFIG_PAGE_DEK_TABLE_SHIFT  28
522285809Sscottl#define TD_ENC_DEK_CONFIG_PAGE_DEK_HDP_SHIFT    8
523285809Sscottl
524285809Sscottl
525285809Sscottl/* CCS (Current Crypto Services)  and NOPR (Number of Operators) are valid only in GET_CONTROLLER_CONFIG */
526285809Sscottl/* NAR, CORCAP and USRCAP are valid only when AUT==1 */
527285809Sscottltypedef struct tiEncryptControlParamPage_s {
528285809Sscottl  bit32          PageCode;           /* 0x22 */
529285809Sscottl  bit32          CORCAP;             /* Crypto Officer Role Capabilities */
530285809Sscottl  bit32          USRCAP;             /* User Role Capabilities */
531285809Sscottl  bit32          CCS;                /* Current Crypto Services */
532285809Sscottl  bit32          NOPR;               /* Number of Operators */
533285809Sscottl} tiEncryptControlParamPage_t;
534285809Sscottl
535285809Sscottltypedef struct tiEncryptHMACConfigPage_s
536285809Sscottl{
537285809Sscottl  bit32  PageCode;
538285809Sscottl  bit32  CustomerTag;
539285809Sscottl  bit32  KeyAddrLo;
540285809Sscottl  bit32  KeyAddrHi;
541285809Sscottl} tiEncryptHMACConfigPage_t;
542285809Sscottl
543285809Sscottltypedef struct tiInterruptConfigPage_s {
544285809Sscottl   bit32  pageCode;                        /* 0x05 */
545285809Sscottl   bit32  vectorMask;
546285809Sscottl   bit32  reserved;
547285809Sscottl   bit32  ICTC0;
548285809Sscottl   bit32  ICTC1;
549285809Sscottl   bit32  ICTC2;
550285809Sscottl   bit32  ICTC3;
551285809Sscottl   bit32  ICTC4;
552285809Sscottl   bit32  ICTC5;
553285809Sscottl   bit32  ICTC6;
554285809Sscottl   bit32  ICTC7;
555285809Sscottl} tiInterruptConfigPage_t;
556285809Sscottl
557285809Sscottl/* brief data structure for SAS protocol timer configuration page. */
558285809Sscottltypedef struct  tiSASProtocolTimerConfigurationPage_s{
559285809Sscottl  bit32 pageCode;                       /* 0x04 */
560285809Sscottl  bit32 MST_MSI;
561285809Sscottl  bit32 STP_SSP_MCT_TMO;
562285809Sscottl  bit32 STP_FRM_TMO;
563285809Sscottl  bit32 STP_IDLE_TMO;
564285809Sscottl  bit32 OPNRJT_RTRY_INTVL;
565285809Sscottl  bit32 Data_Cmd_OPNRJT_RTRY_TMO;
566285809Sscottl  bit32 Data_Cmd_OPNRJT_RTRY_THR;
567285809Sscottl} tiSASProtocolTimerConfigurationPage_t;
568285809Sscottl
569285809Sscottl/*sTSDK 4.19   */
570285809Sscottl
571285809Sscottl/* The command is for an operator to login to/logout from SPCve. */
572285809Sscottl/* Only when all IOs are quiesced, can an operator logout. */
573285809Sscottltypedef struct tiOperatorCommandSet_s {
574285809Sscottl  bit32 OPRIDX_PIN_ACS;    /* Access type (ACS) [4 bits] */
575285809Sscottl                          /* KEYopr pinned in the KEK RAM (PIN) [1 bit] */
576285809Sscottl                          /* KEYopr Index in the KEK RAM (OPRIDX) [8 bits] */
577285809Sscottl  bit8   cert[40];          /* Operator Certificate (CERT) [40 bytes] */
578285809Sscottl  bit32 reserved[3];       /* reserved */
579285809Sscottl} tiOperatorCommandSet_t;
580285809Sscottl
581285809Sscottl#define FIPS_SELFTEST_MAX_MSG_LEN       (128*1024)
582285809Sscottl#define FIPS_SELFTEST_MAX_DIGEST_SIZE   64
583285809Sscottl
584285809Sscottltypedef struct tiEncryptSelfTestDescriptor_s {
585285809Sscottl  bit32         AESNTC_AESPTC;       /* AES Negative/Positive Test Case Bit Map */
586285809Sscottl  bit32         KWPNTC_PKWPPTC;      /* Key Wrap Negative/Positive Test Case Bit Map */
587285809Sscottl  bit32         HMACNTC_HMACPTC;     /* HMAC Negative Test Case Bit Map */
588285809Sscottl} tiEncryptSelfTestDescriptor_t;
589285809Sscottl
590285809Sscottltypedef struct  tiEncryptSelfTestResult_s{
591285809Sscottl  bit32         AESNTCS_AESPTCS;       /* AES Negative/Positive Test Case Status */
592285809Sscottl  bit32         KWPNTCS_PKWPPTCS;      /* Key Wrap Negative/Positive Test Case Status */
593285809Sscottl  bit32         HMACNTCS_HMACPTCS;     /* HMAC Negative Test Case Status */
594285809Sscottl} tiEncryptSelfTestResult_t;
595285809Sscottl
596285809Sscottl/*
597285809Sscottl   Tell SPCve controller the underlying SHA algorithm, where to fetch the message,
598285809Sscottl   the size of the message, where to store the digest, where to fetch the secret key and the size of the key.
599285809Sscottl*/
600285809Sscottltypedef struct tiEncryptHMACTestDescriptor_s
601285809Sscottl{
602285809Sscottl   bit32    Tlen_SHAAlgo;
603285809Sscottl   bit32    MsgAddrLo;
604285809Sscottl   bit32    MsgAddrHi;
605285809Sscottl   bit32    MsgLen;
606285809Sscottl   bit32    DigestAddrLo;
607285809Sscottl   bit32    DigestAddrHi;
608285809Sscottl   bit32    KeyAddrLo;
609285809Sscottl   bit32    KeyAddrHi;
610285809Sscottl   bit32    KeyLen;
611285809Sscottl} tiEncryptHMACTestDescriptor_t;
612285809Sscottl
613285809Sscottltypedef struct tiEncryptHMACTestResult_s
614285809Sscottl{
615285809Sscottl  bit32  Tlen_SHAAlgo;
616285809Sscottl   bit32    Reserved[12];
617285809Sscottl} tiEncryptHMACTestResult_t;
618285809Sscottl
619285809Sscottltypedef struct tiEncryptSHATestDescriptor_s
620285809Sscottl{
621285809Sscottl   bit32    Dword0;
622285809Sscottl   bit32    MsgAddrLo;
623285809Sscottl   bit32    MsgAddrHi;
624285809Sscottl   bit32    MsgLen;
625285809Sscottl   bit32    DigestAddrLo;
626285809Sscottl   bit32    DigestAddrHi;
627285809Sscottl} tiEncryptSHATestDescriptor_t;
628285809Sscottl
629285809Sscottltypedef struct tiEncryptSHATestResult_s
630285809Sscottl{
631285809Sscottl   bit32    Dword0;
632285809Sscottl   bit32    Dword[12];
633285809Sscottl} tiEncryptSHATestResult_t;
634285809Sscottl
635285809Sscottl
636285809Sscottl#endif  /* TITYPES_H */
637