1 /*******************************************************************************
2 *Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
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
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.
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
23 ********************************************************************************/
24 /********************************************************************************
28 * Abstract: This module defines the contants, enum and #define definition used
29 * by SAT Moduled (SM).
31 ********************************************************************************/
36 /*************************************************
37 * constants for type field in smMem_t
38 *************************************************/
39 #define SM_CACHED_MEM 0x00 /**< CACHED memory type */
40 #define SM_DMA_MEM 0x01 /**< DMA memory type */
41 #define SM_CACHED_DMA_MEM 0x02 /**< CACHED DMA memory type */
43 /*************************************************
44 * constants for API return values
45 *************************************************/
52 SM_RC_VERSION_INCOMPATIBLE,
53 SM_RC_VERSION_UNTESTED,
58 SM_RC_DEVICE_BUSY, /* must be the same as tiDeviceBusy */
70 smIORetry, /* open retry timeout */
71 smIOSTPResourceBusy, /* stp resource busy */
83 smDetailDifAppTagMismatch,
84 smDetailDifRefTagMismatch,
85 smDetailDifCrcMismatch,
86 smDetailDekKeyCacheMiss,
87 smDetailCipherModeInvalid,
88 smDetailDekIVMismatch,
89 smDetailDekRamInterfaceError,
90 smDetailDekIndexOutofBounds,
95 * Data direction for I/O request
99 smDirectionIn = 0x0000,
100 smDirectionOut = 0x0001
104 * Event types for tdsmEventCB()
105 * do not change: Needs to be in sync with TISA API
109 smIntrEventTypeCnxError,
110 smIntrEventTypeDiscovery,
111 smIntrEventTypeTransportRecovery,
112 smIntrEventTypeTaskManagement,
113 smIntrEventTypeDeviceChange,
114 smIntrEventTypeLogin,
115 smIntrEventTypeLocalAbort
125 * Flags in smSuperScsiInitiatorRequest_t
127 #define SM_SCSI_INITIATOR_DIF 0x00000001
128 #define SM_SCSI_INITIATOR_ENCRYPT 0x00000002
131 * Flags in smSuperScsiInitiatorRequest_t
133 #define SM_SCSI_TARGET_DIF 0x00000001
134 #define SM_SCSI_TARGET_MIRROR 0x00000002
135 #define SM_SCSI_TARGET_ENCRYPT 0x00000004
143 typedef smContext_t smDeviceHandle_t;
145 typedef smContext_t smIORequest_t;
147 typedef smContext_t smRoot_t;
151 bit8 lun[8]; /* logical unit number */
171 bit32 singleElementLength;
177 #define SM_NUM_MEM_CHUNKS 8
181 smMem_t smMemory[SM_NUM_MEM_CHUNKS];
182 } smMemoryRequirement_t;
195 #define DIF_VERIFY_FORWARD 1
196 #define DIF_VERIFY_DELETE 2
197 #define DIF_VERIFY_REPLACE 3
198 #define DIF_VERIFY_UDT_REPLACE_CRC 5
199 #define DIF_REPLACE_UDT_REPLACE_CRC 7
201 #define DIF_UDT_SIZE 6
205 agBOOLEAN enableDIFPerLA;
209 bit32 DIFPerLAAddrLo;
210 bit32 DIFPerLAAddrHi;
211 bit16 DIFPerLARegion0SecCount;
212 bit16 DIFPerLANumOfRegions;
213 bit8 udtArray[DIF_UDT_SIZE];
214 bit8 udrtArray[DIF_UDT_SIZE];
217 typedef struct smEncryptDek {
222 typedef struct smEncrypt {
223 smEncryptDek_t dekInfo;
225 agBOOLEAN keyTagCheck;
226 agBOOLEAN enableEncryptionPerLA;
227 bit32 sectorSizeIndex;
235 bit32 EncryptionPerLAAddrLo;
236 bit32 EncryptionPerLAAddrHi;
237 bit16 EncryptionPerLRegion0SecCount;
241 typedef struct smScsiInitiatorRequest {
242 void *sglVirtualAddr;
243 smIniScsiCmnd_t scsiCmnd;
245 smDataDirection_t dataDirection;
246 } smScsiInitiatorRequest_t;
248 typedef struct smSuperScsiInitiatorRequest
250 void *sglVirtualAddr;
251 smIniScsiCmnd_t scsiCmnd;
253 smDataDirection_t dataDirection;
256 bit 2: enable encryption
259 bit 8-23: DIF SKIP Bytes
264 } smSuperScsiInitiatorRequest_t;
280 #define smBOOLEAN bit32