FreeBSD kernel pms device code
sm.h
Go to the documentation of this file.
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* $FreeBSD$
22*
23********************************************************************************/
24/********************************************************************************
25**
26* sm.h
27*
28* Abstract: This module defines the contants, enum and #define definition used
29* by SAT Moduled (SM).
30*
31********************************************************************************/
32
33#ifndef SM_H
34#define SM_H
35
36/*************************************************
37 * constants for type field in smMem_t
38 *************************************************/
39#define SM_CACHED_MEM 0x00
40#define SM_DMA_MEM 0x01
41#define SM_CACHED_DMA_MEM 0x02
43/*************************************************
44 * constants for API return values
45 *************************************************/
46typedef enum
47{
58 SM_RC_DEVICE_BUSY, /* must be the same as tiDeviceBusy */
59
61
62typedef enum
63{
70 smIORetry, /* open retry timeout */
71 smIOSTPResourceBusy, /* stp resource busy */
73
74typedef enum
75{
93
94/*
95 * Data direction for I/O request
96 */
97typedef enum
98{
99 smDirectionIn = 0x0000,
100 smDirectionOut = 0x0001
102
103/*
104 * Event types for tdsmEventCB()
105 * do not change: Needs to be in sync with TISA API
106 */
107typedef enum
108{
117
118typedef enum
119{
123
124/*
125 * Flags in smSuperScsiInitiatorRequest_t
126 */
127#define SM_SCSI_INITIATOR_DIF 0x00000001
128#define SM_SCSI_INITIATOR_ENCRYPT 0x00000002
129
130/*
131 * Flags in smSuperScsiInitiatorRequest_t
132 */
133#define SM_SCSI_TARGET_DIF 0x00000001
134#define SM_SCSI_TARGET_MIRROR 0x00000002
135#define SM_SCSI_TARGET_ENCRYPT 0x00000004
136
137typedef struct {
138 void *tdData;
139 void *smData;
141
142
144
146
148
149typedef struct
150{
151 bit8 lun[8]; /* logical unit number */
152} smLUN_t;
153
154typedef struct{
159 bit8 cdb[16];
161
162
163
164typedef struct{
165 void *virtPtr;
166 void *osHandle;
175} smMem_t;
176
177#define SM_NUM_MEM_CHUNKS 8
178
179typedef struct{
183
184typedef struct{
189} smSgl_t;
190
191/*
192 * DIF operation
193 */
194#define DIF_INSERT 0
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
200
201#define DIF_UDT_SIZE 6
202
203typedef struct smDif
204{
216
217typedef struct smEncryptDek {
221
222typedef struct smEncrypt {
240
247
249{
255 bit 0-1: reserved
256 bit 2: enable encryption
257 bit 3: enable dif
258 bit 4-7: reserved
259 bit 8-23: DIF SKIP Bytes
260 bit 24-31: Reserved
261 */
265
266typedef struct{
270
271typedef struct{
274#ifdef SM_DEBUG
275 bit32 SMDebugLevel;
276#endif
278
279
280#define smBOOLEAN bit32
281
282
283
284
285
286
287
288
289
290
291#endif /* SM_H */
292
bit32 lun
Definition: encrypt_ioctl.h:3
unsigned short bit16
Definition: ostypes.h:98
unsigned int bit32
Definition: ostypes.h:99
#define agBOOLEAN
Definition: ostypes.h:146
unsigned char bit8
Definition: ostypes.h:97
smDataDirection_t
Definition: sm.h:98
@ smDirectionIn
Definition: sm.h:99
@ smDirectionOut
Definition: sm.h:100
#define DIF_UDT_SIZE
Definition: sm.h:201
struct smScsiInitiatorRequest smScsiInitiatorRequest_t
smTMEventStatus_t
Definition: sm.h:119
@ smTMFailed
Definition: sm.h:121
@ smTMOK
Definition: sm.h:120
struct smSuperScsiInitiatorRequest smSuperScsiInitiatorRequest_t
smContext_t smIORequest_t
Definition: sm.h:145
smContext_t smDeviceHandle_t
Definition: sm.h:143
struct smDif smDif_t
#define SM_NUM_MEM_CHUNKS
Definition: sm.h:177
struct smEncrypt smEncrypt_t
smIntrEventType_t
Definition: sm.h:108
@ smIntrEventTypeDeviceChange
Definition: sm.h:113
@ smIntrEventTypeTransportRecovery
Definition: sm.h:111
@ smIntrEventTypeLocalAbort
Definition: sm.h:115
@ smIntrEventTypeLogin
Definition: sm.h:114
@ smIntrEventTypeDiscovery
Definition: sm.h:110
@ smIntrEventTypeCnxError
Definition: sm.h:109
@ smIntrEventTypeTaskManagement
Definition: sm.h:112
smIOStatusDetail_t
Definition: sm.h:75
@ smDetailDifCrcMismatch
Definition: sm.h:85
@ smDetailDifMismatch
Definition: sm.h:82
@ smDetailAbortLogin
Definition: sm.h:79
@ smDetailOtherError
Definition: sm.h:91
@ smDetailNoLogin
Definition: sm.h:78
@ smDetailCipherModeInvalid
Definition: sm.h:87
@ smDetailAborted
Definition: sm.h:81
@ smDetailAbortReset
Definition: sm.h:80
@ smDetailDifRefTagMismatch
Definition: sm.h:84
@ smDetailDekIndexOutofBounds
Definition: sm.h:90
@ smDetailDekKeyCacheMiss
Definition: sm.h:86
@ smDetailBusy
Definition: sm.h:76
@ smDetailDekRamInterfaceError
Definition: sm.h:89
@ smDetailNotValid
Definition: sm.h:77
@ smDetailDifAppTagMismatch
Definition: sm.h:83
@ smDetailDekIVMismatch
Definition: sm.h:88
smStatus_t
Definition: sm.h:47
@ SM_RC_RSV1
Definition: sm.h:54
@ SM_RC_SUCCESS
Definition: sm.h:48
@ SM_RC_RSV2
Definition: sm.h:55
@ SM_RC_FAILURE
Definition: sm.h:49
@ SM_RC_NODEVICE
Definition: sm.h:51
@ SM_RC_VERSION_INCOMPATIBLE
Definition: sm.h:52
@ SM_RC_VERSION_UNTESTED
Definition: sm.h:53
@ SM_RC_DEVICE_BUSY
Definition: sm.h:58
@ SM_RC_RSV4
Definition: sm.h:57
@ SM_RC_RSV3
Definition: sm.h:56
@ SM_RC_BUSY
Definition: sm.h:50
struct smEncryptDek smEncryptDek_t
smContext_t smRoot_t
Definition: sm.h:147
smIOStatus_t
Definition: sm.h:63
@ smIODifError
Definition: sm.h:68
@ smIOSTPResourceBusy
Definition: sm.h:71
@ smIOEncryptError
Definition: sm.h:69
@ smIOFailed
Definition: sm.h:67
@ smIOUnderRun
Definition: sm.h:66
@ smIOOverRun
Definition: sm.h:65
@ smIORetry
Definition: sm.h:70
@ smIOSuccess
Definition: sm.h:64
void * tdData
Definition: sm.h:138
void * smData
Definition: sm.h:139
Definition: sm.h:204
bit32 DIFPerLAAddrHi
Definition: sm.h:210
bit16 DIFPerLANumOfRegions
Definition: sm.h:212
bit32 DIFPerLAAddrLo
Definition: sm.h:209
bit16 reserved
Definition: sm.h:208
bit16 DIFPerLARegion0SecCount
Definition: sm.h:211
agBOOLEAN enableDIFPerLA
Definition: sm.h:205
bit8 udtArray[DIF_UDT_SIZE]
Definition: sm.h:213
bit32 flag
Definition: sm.h:206
bit16 initialIOSeed
Definition: sm.h:207
bit8 udrtArray[DIF_UDT_SIZE]
Definition: sm.h:214
bit32 dekIndex
Definition: sm.h:219
bit32 dekTable
Definition: sm.h:218
Definition: sm.h:222
bit32 sectorSizeIndex
Definition: sm.h:227
bit32 tweakVal_W2
Definition: sm.h:233
bit16 reserved
Definition: sm.h:238
agBOOLEAN keyTagCheck
Definition: sm.h:225
bit32 keyTag_W1
Definition: sm.h:230
bit16 EncryptionPerLRegion0SecCount
Definition: sm.h:237
bit32 EncryptionPerLAAddrLo
Definition: sm.h:235
bit32 kekIndex
Definition: sm.h:224
agBOOLEAN enableEncryptionPerLA
Definition: sm.h:226
smEncryptDek_t dekInfo
Definition: sm.h:223
bit32 tweakVal_W0
Definition: sm.h:231
bit32 encryptMode
Definition: sm.h:228
bit32 tweakVal_W1
Definition: sm.h:232
bit32 tweakVal_W3
Definition: sm.h:234
bit32 keyTag_W0
Definition: sm.h:229
bit32 EncryptionPerLAAddrHi
Definition: sm.h:236
smLUN_t lun
Definition: sm.h:155
bit32 taskAttribute
Definition: sm.h:157
bit32 crn
Definition: sm.h:158
bit32 expDataLength
Definition: sm.h:156
Definition: sm.h:150
Definition: sm.h:164
bit32 physAddrUpper
Definition: sm.h:167
bit32 reserved
Definition: sm.h:174
bit32 numElements
Definition: sm.h:170
bit32 totalLength
Definition: sm.h:169
void * virtPtr
Definition: sm.h:165
bit32 physAddrLower
Definition: sm.h:168
bit32 alignment
Definition: sm.h:172
void * osHandle
Definition: sm.h:166
bit32 type
Definition: sm.h:173
bit32 singleElementLength
Definition: sm.h:171
void * sglVirtualAddr
Definition: sm.h:242
smDataDirection_t dataDirection
Definition: sm.h:245
smIniScsiCmnd_t scsiCmnd
Definition: sm.h:243
smSgl_t smSgl1
Definition: sm.h:244
bit8 senseLen
Definition: sm.h:268
void * senseData
Definition: sm.h:267
Definition: sm.h:184
bit32 type
Definition: sm.h:188
bit32 upper
Definition: sm.h:186
bit32 lower
Definition: sm.h:185
bit32 len
Definition: sm.h:187
smIniScsiCmnd_t scsiCmnd
Definition: sm.h:251
smDataDirection_t dataDirection
Definition: sm.h:253
smEncrypt_t Encrypt
Definition: sm.h:263
bit32 maxActiveIOs
Definition: sm.h:272
bit32 numDevHandles
Definition: sm.h:273