FreeBSD kernel pms device code
ostiapi.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** Version Control Information:
27**
28**
29*******************************************************************************/
30/********************************************************************************
31**
32** ostiapi.h
33**
34** Abstract: This module contains function prototype of the Transport
35** Independent (TIAPI) OS Callback interface.
36**
37********************************************************************************/
38
39#ifndef OSTIAPI_H
40
41#define OSTIAPI_H
42
43/*
44 * Definition for return status is defined in tiStatus_t in TIDEFS.H
45 */
46
47/*****************************************************************************
48 * Initiator/Target Shared Callbacks
49 *****************************************************************************/
50
53 char *key,
54 char *subkey1,
55 char *subkey2,
56 char *subkey3,
57 char *subkey4,
58 char *subkey5,
59 char *valueName,
60 char *buffer,
61 bit32 bufferLen,
62 bit32 *lenReceived
63 );
64
67 tiPortEvent_t eventType,
69 void *pParm
70 );
71
74
77 bit32 chipConfigOffset
78 );
79
82 bit32 chipConfigOffset,
83 bit32 chipConfigValue
84 );
85
88 bit32 chipOffset
89 );
90
93 bit32 chipOffset,
94 bit32 chipValue
95 );
96
99 bit32 chipOffset
100 );
101
104 bit32 chipOffset,
105 bit8 chipValue
106 );
107
110 bit32 flashOffset,
111 void *buffer,
112 bit32 bufferLen
113 );
114
118 tiRoot_t *root,
119 unsigned char *sas_addr
120);
121
123
126 bit32 queueId
127 );
128
131 bit32 queueId
132 );
133
134
136 void *param1,
137 void *param2,
138 void **tiRequestBody,
140 );
141
142#ifdef PERF_COUNT
143osGLOBAL void ostiEnter(tiRoot_t *ptiRoot, bit32 layer, int io);
144osGLOBAL void ostiLeave(tiRoot_t *ptiRoot, bit32 layer, int io);
145#define OSTI_INP_ENTER(root) ostiEnter(root, 2, 0)
146#define OSTI_INP_LEAVE(root) ostiLeave(root, 2, 0)
147#define OSTI_OUT_ENTER(root) ostiEnter(root, 2, 1)
148#define OSTI_OUT_LEAVE(root) ostiLeave(root, 2, 1)
149#else
150#define OSTI_INP_ENTER(root)
151#define OSTI_INP_LEAVE(root)
152#define OSTI_OUT_ENTER(root)
153#define OSTI_OUT_LEAVE(root)
154#endif
155
158 bit32 microseconds
159 );
160
163 tiRoot_t *root,
164 bit32 *Index,
165 bit32 Mask
166 );
167
168#ifdef LINUX_VERSION_CODE
169
171ostiAtomicIncrement(
172 tiRoot_t *root,
173 sbit32 volatile *Addend
174 );
175
177ostiAtomicDecrement(
178 tiRoot_t *root,
179 sbit32 volatile *Addend
180 );
181
182
184ostiAtomicBitClear(
185 tiRoot_t *root,
186 sbit32 volatile *Destination,
187 sbit32 Value
188 );
189
191ostiAtomicBitSet(
192 tiRoot_t *root,
193 sbit32 volatile *Destination,
194 sbit32 Value
195 );
196
198ostiAtomicExchange(
199 tiRoot_t *root,
200 sbit32 volatile *Target,
201 sbit32 Value
202 );
203
204#else
205
208 tiRoot_t *root,
209 sbit32 volatile *Addend
210 );
211
214 tiRoot_t *root,
215 sbit32 volatile *Addend
216 );
217
218
221 tiRoot_t *root,
222 sbit32 volatile *Destination,
223 sbit32 Value
224 );
225
228 tiRoot_t *root,
229 sbit32 volatile *Destination,
230 sbit32 Value
231 );
232
235 tiRoot_t *root,
236 sbit32 volatile *Target,
237 sbit32 Value
238 );
239#endif /*LINUX_VERSION_CODE*/
240
243 void **osMemHandle,
244 void ** virtPtr,
245 bit32 * physAddrUpper,
246 bit32 * physAddrLower,
247 bit32 alignment,
248 bit32 allocLength,
249 agBOOLEAN isCacheable
250 );
251
254 void *osDMAHandle,
255 bit32 allocLength
256 );
257
260 void *osMemHandle,
261 void *virtPtr,
262 bit32 length
263 );
264
267 void *osMemHandle,
268 void *virtPtr,
269 bit32 length
270 );
271
274 void *osMemHandle,
275 void *virtPtr,
276 bit32 length
277 );
278
279/*
280 * The following two functions are for SAS/SATA
281 */
282osGLOBAL void
284 tiRoot_t *ptiRoot,
285 bit32 channelNum
286 );
287
288osGLOBAL void
290 tiRoot_t *ptiRoot,
291 bit32 channelNum
292 );
293
297 bit32 busBaseNumber,
298 bit32 chipOffset
299 );
300
304 bit32 busBaseNumber,
305 bit32 chipOffset,
306 bit32 chipValue
307 );
308
309
310/*****************************************************************************
311 * Initiator specific Callbacks
312 *****************************************************************************/
313
314/*
315 * Initiator specific IO Completion
316 */
321 bit32 statusDetail,
322 tiSenseData_t *senseData,
323 bit32 context
324 );
325
328 bit8 pathId,
329 bit8 targetId,
330 bit8 LUN
331 );
333 void *pccb,
334 bit8 pathId,
335 bit8 targetId,
336 bit8 lun,
337 unsigned long resetType
338 );
339
340osGLOBAL void
342 bit32 fIsClear,
343 void *SenseKeyCount,
344 bit32 length
345 );
346
347osGLOBAL void
349 bit32 fIsClear,
350 void *ScsiStatusCount,
351 bit32 length
352 );
353
357 bit32 QueueDepth
358 );
359
360
361#ifdef FAST_IO_TEST
362typedef void (*ostiFastSSPCb_t)(tiRoot_t *ptiRoot,
363 void *arg,
364 tiIOStatus_t IOStatus,
365 bit32 statusDetail);
366
367void osti_FastIOCb(tiRoot_t *ptiRoot,
368 void *arg,
369 tiIOStatus_t IOStatus,
370 bit32 statusDetail);
371#endif
372
373osGLOBAL void
375 tiIORequest_t *tiSMPRequest,
376 tiSMPStatus_t smpStatus,
377 bit32 tiSMPInfoLen,
378 void *tiFrameHandle,
379 bit32 context);
380/*
381 * Initiator specific event
382 */
385 tiPortalContext_t *portalContext,
387 tiIntrEventType_t eventType,
388 bit32 eventStatus,
389 void *parm
390 );
391
392
393/*
394 * PMC-Sierra IOCTL semaphoring
395 */
398 void **agParam1,
399 void **agParam2,
400 void **agParam3
401 );
402
404 tiRoot_t *tigRoot,
405 void *agParam1,
406 void *agParam2,
407 void *agParam3
408 );
409
412 void *agParam1,
413 void *agParam2,
414 void *agParam3
415 );
416
418 tiRoot_t *tigRoot,
419 void *agParam1,
420 void *agParam2,
421 void *agParam3
422 );
423
426 void *agParam1,
427 void *agParam2,
428 void *agParam3
429 );
430
431/*****************************************************************************
432 * Target specific Callbacks
433 *****************************************************************************/
434
437 tiTargetScsiCmnd_t *tiTgtScsiCmnd,
438 void *agFrameHandle,
439 bit32 immDataLength,
442
446
449 bit32 task,
450 bit8 *scsiLun,
451 tiIORequest_t *refTiIORequest,
452 tiIORequest_t *tiTMRequest,
454
459 );
460
463 tiPortalContext_t *portalContext,
465 tiTgtEventType_t eventType,
466 bit32 eventStatus,
467 void *parm
468 );
469
474 bit32 statusDetail
475 );
476
479 tiIORequest_t *tiTmRequest,
481 bit32 statusDetail
482 );
483
485
486
487#endif /* OSTIAPI_H */
bit32 lun
Definition: encrypt_ioctl.h:3
bit32 status
Definition: encrypt_ioctl.h:12
osGLOBAL void ostiNextDataPhase(tiRoot_t *tiRoot, tiIORequest_t *tiIORequest)
osGLOBAL void ostiIOCTLWaitForSignal(tiRoot_t *tigRoot, void *agParam1, void *agParam2, void *agParam3)
Definition: lxosapi.c:118
osGLOBAL FORCEINLINE tiDeviceHandle_t * ostiGetDevHandleFromSasAddr(tiRoot_t *root, unsigned char *sas_addr)
Definition: osapi.c:364
osGLOBAL bit32 ostiSetDeviceQueueDepth(tiRoot_t *tiRoot, tiIORequest_t *tiIORequest, bit32 QueueDepth)
Definition: osapi.c:761
osGLOBAL bit32 ostiGetTransportParam(tiRoot_t *tiRoot, char *key, char *subkey1, char *subkey2, char *subkey3, char *subkey4, char *subkey5, char *valueName, char *buffer, bit32 bufferLen, bit32 *lenReceived)
Definition: lxosapi.c:464
osGLOBAL FORCEINLINE void ostiChipWriteBit32(tiRoot_t *tiRoot, bit32 chipOffset, bit32 chipValue)
Definition: lxosapi.c:214
osGLOBAL FORCEINLINE void ostiSingleThreadedLeave(tiRoot_t *tiRoot, bit32 queueId)
Definition: osapi.c:534
osGLOBAL FORCEINLINE void ostidisableEncryption(tiRoot_t *root)
osGLOBAL void ostiPortEvent(tiRoot_t *tiRoot, tiPortEvent_t eventType, bit32 status, void *pParm)
Definition: lxosapi.c:591
osGLOBAL FORCEINLINE void ostiChipWriteBit8(tiRoot_t *tiRoot, bit32 chipOffset, bit8 chipValue)
Definition: lxosapi.c:292
osGLOBAL bit32 ostiFreeMemory(tiRoot_t *tiRoot, void *osDMAHandle, bit32 allocLength)
Definition: lxosapi.c:320
osGLOBAL void ostiIOCTLClearSignal(tiRoot_t *tiRoot, void **agParam1, void **agParam2, void **agParam3)
Definition: lxosapi.c:520
osGLOBAL FORCEINLINE bit32 ostiChipReadBit32(tiRoot_t *tiRoot, bit32 chipOffset)
Definition: lxosapi.c:194
osGLOBAL void ostiInterruptDisable(tiRoot_t *ptiRoot, bit32 channelNum)
Definition: lxosapi.c:781
osGLOBAL FORCEINLINE sbit32 ostiInterlockedAnd(tiRoot_t *root, sbit32 volatile *Destination, sbit32 Value)
Definition: osapi.c:738
osGLOBAL void ostiGetSCSIStatusCount(tiRoot_t *root, bit32 fIsClear, void *ScsiStatusCount, bit32 length)
Definition: osapi.c:792
osGLOBAL bit32 ostiSendResetDeviceIoctl(tiRoot_t *root, void *pccb, bit8 pathId, bit8 targetId, bit8 lun, unsigned long resetType)
osGLOBAL FORCEINLINE sbit32 ostiInterlockedDecrement(tiRoot_t *root, sbit32 volatile *Addend)
Definition: osapi.c:729
osGLOBAL FORCEINLINE bit8 ostiChipReadBit8(tiRoot_t *tiRoot, bit32 chipOffset)
Definition: lxosapi.c:275
osGLOBAL void ostiInterruptEnable(tiRoot_t *ptiRoot, bit32 channelNum)
Definition: lxosapi.c:773
osGLOBAL void ostiIOCTLSetSignal(tiRoot_t *tiRoot, void *agParam1, void *agParam2, void *agParam3)
Definition: lxosapi.c:541
osGLOBAL void ostiFlashReadBlock(tiRoot_t *tiRoot, bit32 flashOffset, void *buffer, bit32 bufferLen)
Definition: lxosapi.c:300
osGLOBAL void ostiInitiatorEvent(tiRoot_t *tiRoot, tiPortalContext_t *portalContext, tiDeviceHandle_t *tiDeviceHandle, tiIntrEventType_t eventType, bit32 eventStatus, void *parm)
Definition: osapi.c:49
osGLOBAL void ostiTargetTmCompleted(tiRoot_t *tiRoot, tiIORequest_t *tiTmRequest, tiIOStatus_t status, bit32 statusDetail)
osGLOBAL FORCEINLINE void ostiCacheFlush(tiRoot_t *tiRoot, void *osMemHandle, void *virtPtr, bit32 length)
Definition: lxosapi.c:741
osGLOBAL bit32 ostiNumOfLUNIOCTLreq(tiRoot_t *root, void *param1, void *param2, void **tiRequestBody, tiIORequest_t **tiIORequest)
Definition: osapi.c:810
osGLOBAL bit32 ostiAllocMemory(tiRoot_t *tiRoot, void **osMemHandle, void **virtPtr, bit32 *physAddrUpper, bit32 *physAddrLower, bit32 alignment, bit32 allocLength, agBOOLEAN isCacheable)
Definition: lxosapi.c:51
osGLOBAL void ostiStallThread(tiRoot_t *tiRoot, bit32 microseconds)
Definition: lxosapi.c:691
osGLOBAL void ostiIOCTLComplete(tiRoot_t *tiRoot, void *agParam1, void *agParam2, void *agParam3)
Definition: lxosapi.c:556
osGLOBAL bit32 ostiTargetEvent(tiRoot_t *tiRoot, tiPortalContext_t *portalContext, tiDeviceHandle_t *tiDeviceHandle, tiTgtEventType_t eventType, bit32 eventStatus, void *parm)
osGLOBAL void ostiTargetIOCompleted(tiRoot_t *tiRoot, tiIORequest_t *tiIORequest, tiIOStatus_t status)
osGLOBAL void ostiTaskManagement(tiRoot_t *tiRoot, bit32 task, bit8 *scsiLun, tiIORequest_t *refTiIORequest, tiIORequest_t *tiTMRequest, tiDeviceHandle_t *tiDeviceHandle)
osGLOBAL tiDeviceHandle_t * ostiMapToDevHandle(tiRoot_t *root, bit8 pathId, bit8 targetId, bit8 LUN)
Definition: osapi.c:542
osGLOBAL void ostiProcessScsiReq(tiRoot_t *tiRoot, tiTargetScsiCmnd_t *tiTgtScsiCmnd, void *agFrameHandle, bit32 immDataLength, tiIORequest_t *tiIORequest, tiDeviceHandle_t *tiDeviceHandle)
osGLOBAL FORCEINLINE bit32 ostiChipConfigReadBit32(tiRoot_t *tiRoot, bit32 chipConfigOffset)
Definition: lxosapi.c:155
osGLOBAL void ostiPCI_TRIGGER(tiRoot_t *tiRoot)
Definition: osapi.c:803
osGLOBAL void ostiIOCTLWaitForComplete(tiRoot_t *tigRoot, void *agParam1, void *agParam2, void *agParam3)
Definition: lxosapi.c:132
osGLOBAL FORCEINLINE void ostiCacheInvalidate(tiRoot_t *tiRoot, void *osMemHandle, void *virtPtr, bit32 length)
Definition: lxosapi.c:750
osGLOBAL FORCEINLINE sbit32 ostiInterlockedOr(tiRoot_t *root, sbit32 volatile *Destination, sbit32 Value)
Definition: osapi.c:748
osGLOBAL FORCEINLINE void ostiCachePreFlush(tiRoot_t *tiRoot, void *osMemHandle, void *virtPtr, bit32 length)
Definition: lxosapi.c:759
osGLOBAL FORCEINLINE sbit32 ostiInterlockedExchange(tiRoot_t *root, sbit32 volatile *Target, sbit32 Value)
Definition: osapi.c:710
osGLOBAL void ostiInitiatorSMPCompleted(tiRoot_t *tiRoot, tiIORequest_t *tiSMPRequest, tiSMPStatus_t smpStatus, bit32 tiSMPInfoLen, void *tiFrameHandle, bit32 context)
Definition: osapi.c:420
osGLOBAL FORCEINLINE bit32 ostiChipReadBit32Ext(tiRoot_t *tiRoot, bit32 busBaseNumber, bit32 chipOffset)
Definition: lxosapi.c:232
osGLOBAL void ostiTargetIOError(tiRoot_t *tiRoot, tiIORequest_t *tiIORequest, tiIOStatus_t status, bit32 statusDetail)
osGLOBAL bit32 ostiTimeStamp(tiRoot_t *tiRoot)
Definition: lxosapi.c:707
osGLOBAL FORCEINLINE void ostiChipWriteBit32Ext(tiRoot_t *tiRoot, bit32 busBaseNumber, bit32 chipOffset, bit32 chipValue)
Definition: lxosapi.c:255
osGLOBAL FORCEINLINE bit8 ostiBitScanForward(tiRoot_t *root, bit32 *Index, bit32 Mask)
Definition: osapi.c:638
osGLOBAL FORCEINLINE void ostiSingleThreadedEnter(tiRoot_t *tiRoot, bit32 queueId)
Definition: osapi.c:514
osGLOBAL bit64 ostiTimeStamp64(tiRoot_t *tiRoot)
Definition: lxosapi.c:713
osGLOBAL void ostiGetSenseKeyCount(tiRoot_t *root, bit32 fIsClear, void *SenseKeyCount, bit32 length)
Definition: osapi.c:781
osGLOBAL void ostiInitiatorIOCompleted(tiRoot_t *tiRoot, tiIORequest_t *tiIORequest, tiIOStatus_t status, bit32 statusDetail, tiSenseData_t *senseData, bit32 context)
Definition: osapi.c:270
osGLOBAL FORCEINLINE void ostiChipConfigWriteBit32(tiRoot_t *tiRoot, bit32 chipConfigOffset, bit32 chipConfigValue)
Definition: lxosapi.c:176
osGLOBAL FORCEINLINE sbit32 ostiInterlockedIncrement(tiRoot_t *root, sbit32 volatile *Addend)
Definition: osapi.c:720
unsigned long long bit64
Definition: ostypes.h:104
#define osGLOBAL
Definition: ostypes.h:147
int sbit32
Definition: ostypes.h:102
unsigned int bit32
Definition: ostypes.h:99
#define agBOOLEAN
Definition: ostypes.h:146
#define FORCEINLINE
Definition: ostypes.h:86
unsigned char bit8
Definition: ostypes.h:97
Definition: titypes.h:61
tiPortEvent_t
Definition: tidefs.h:128
tiTgtEventType_t
Definition: tidefs.h:599
tiIOStatus_t
Definition: tidefs.h:178
tiSMPStatus_t
Definition: tidefs.h:191
tiIntrEventType_t
Definition: tidefs.h:456