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
51 osGLOBAL bit32 ostiGetTransportParam(
52 tiRoot_t *tiRoot,
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
65 osGLOBAL void ostiPortEvent(
66 tiRoot_t *tiRoot,
67 tiPortEvent_t eventType,
68 bit32 status,
69 void *pParm
70 );
71
72 osGLOBAL bit32 ostiTimeStamp( tiRoot_t *tiRoot);
73 osGLOBAL bit64 ostiTimeStamp64( tiRoot_t *tiRoot);
74
75 osGLOBAL FORCEINLINE bit32 ostiChipConfigReadBit32(
76 tiRoot_t *tiRoot,
77 bit32 chipConfigOffset
78 );
79
80 osGLOBAL FORCEINLINE void ostiChipConfigWriteBit32(
81 tiRoot_t *tiRoot,
82 bit32 chipConfigOffset,
83 bit32 chipConfigValue
84 );
85
86 osGLOBAL FORCEINLINE bit32 ostiChipReadBit32(
87 tiRoot_t *tiRoot,
88 bit32 chipOffset
89 );
90
91 osGLOBAL FORCEINLINE void ostiChipWriteBit32(
92 tiRoot_t *tiRoot,
93 bit32 chipOffset,
94 bit32 chipValue
95 );
96
97 osGLOBAL FORCEINLINE bit8 ostiChipReadBit8(
98 tiRoot_t *tiRoot,
99 bit32 chipOffset
100 );
101
102 osGLOBAL FORCEINLINE void ostiChipWriteBit8(
103 tiRoot_t *tiRoot,
104 bit32 chipOffset,
105 bit8 chipValue
106 );
107
108 osGLOBAL void ostiFlashReadBlock(
109 tiRoot_t *tiRoot,
110 bit32 flashOffset,
111 void *buffer,
112 bit32 bufferLen
113 );
114
115 osGLOBAL FORCEINLINE
116 tiDeviceHandle_t*
117 ostiGetDevHandleFromSasAddr(
118 tiRoot_t *root,
119 unsigned char *sas_addr
120 );
121
122 osGLOBAL FORCEINLINE void ostidisableEncryption(tiRoot_t *root);
123
124 osGLOBAL FORCEINLINE void ostiSingleThreadedEnter(
125 tiRoot_t *tiRoot,
126 bit32 queueId
127 );
128
129 osGLOBAL FORCEINLINE void ostiSingleThreadedLeave(
130 tiRoot_t *tiRoot,
131 bit32 queueId
132 );
133
134
135 osGLOBAL bit32 ostiNumOfLUNIOCTLreq(tiRoot_t *root,
136 void *param1,
137 void *param2,
138 void **tiRequestBody,
139 tiIORequest_t **tiIORequest
140 );
141
142 #ifdef PERF_COUNT
143 osGLOBAL void ostiEnter(tiRoot_t *ptiRoot, bit32 layer, int io);
144 osGLOBAL 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
156 osGLOBAL void ostiStallThread(
157 tiRoot_t *tiRoot,
158 bit32 microseconds
159 );
160
161 osGLOBAL FORCEINLINE bit8
162 ostiBitScanForward(
163 tiRoot_t *root,
164 bit32 *Index,
165 bit32 Mask
166 );
167
168 #ifdef LINUX_VERSION_CODE
169
170 osGLOBAL sbit32
171 ostiAtomicIncrement(
172 tiRoot_t *root,
173 sbit32 volatile *Addend
174 );
175
176 osGLOBAL sbit32
177 ostiAtomicDecrement(
178 tiRoot_t *root,
179 sbit32 volatile *Addend
180 );
181
182
183 osGLOBAL sbit32
184 ostiAtomicBitClear(
185 tiRoot_t *root,
186 sbit32 volatile *Destination,
187 sbit32 Value
188 );
189
190 osGLOBAL sbit32
191 ostiAtomicBitSet(
192 tiRoot_t *root,
193 sbit32 volatile *Destination,
194 sbit32 Value
195 );
196
197 osGLOBAL sbit32
198 ostiAtomicExchange(
199 tiRoot_t *root,
200 sbit32 volatile *Target,
201 sbit32 Value
202 );
203
204 #else
205
206 osGLOBAL FORCEINLINE sbit32
207 ostiInterlockedIncrement(
208 tiRoot_t *root,
209 sbit32 volatile *Addend
210 );
211
212 osGLOBAL FORCEINLINE sbit32
213 ostiInterlockedDecrement(
214 tiRoot_t *root,
215 sbit32 volatile *Addend
216 );
217
218
219 osGLOBAL FORCEINLINE sbit32
220 ostiInterlockedAnd(
221 tiRoot_t *root,
222 sbit32 volatile *Destination,
223 sbit32 Value
224 );
225
226 osGLOBAL FORCEINLINE sbit32
227 ostiInterlockedOr(
228 tiRoot_t *root,
229 sbit32 volatile *Destination,
230 sbit32 Value
231 );
232
233 osGLOBAL FORCEINLINE sbit32
234 ostiInterlockedExchange(
235 tiRoot_t *root,
236 sbit32 volatile *Target,
237 sbit32 Value
238 );
239 #endif /*LINUX_VERSION_CODE*/
240
241 osGLOBAL bit32 ostiAllocMemory(
242 tiRoot_t *tiRoot,
243 void **osMemHandle,
244 void ** virtPtr,
245 bit32 * physAddrUpper,
246 bit32 * physAddrLower,
247 bit32 alignment,
248 bit32 allocLength,
249 agBOOLEAN isCacheable
250 );
251
252 osGLOBAL bit32 ostiFreeMemory(
253 tiRoot_t *tiRoot,
254 void *osDMAHandle,
255 bit32 allocLength
256 );
257
258 osGLOBAL FORCEINLINE void ostiCacheFlush(
259 tiRoot_t *tiRoot,
260 void *osMemHandle,
261 void *virtPtr,
262 bit32 length
263 );
264
265 osGLOBAL FORCEINLINE void ostiCacheInvalidate(
266 tiRoot_t *tiRoot,
267 void *osMemHandle,
268 void *virtPtr,
269 bit32 length
270 );
271
272 osGLOBAL FORCEINLINE void ostiCachePreFlush(
273 tiRoot_t *tiRoot,
274 void *osMemHandle,
275 void *virtPtr,
276 bit32 length
277 );
278
279 /*
280 * The following two functions are for SAS/SATA
281 */
282 osGLOBAL void
283 ostiInterruptEnable(
284 tiRoot_t *ptiRoot,
285 bit32 channelNum
286 );
287
288 osGLOBAL void
289 ostiInterruptDisable(
290 tiRoot_t *ptiRoot,
291 bit32 channelNum
292 );
293
294 osGLOBAL FORCEINLINE bit32
295 ostiChipReadBit32Ext(
296 tiRoot_t *tiRoot,
297 bit32 busBaseNumber,
298 bit32 chipOffset
299 );
300
301 osGLOBAL FORCEINLINE void
302 ostiChipWriteBit32Ext(
303 tiRoot_t *tiRoot,
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 */
317 osGLOBAL void ostiInitiatorIOCompleted(
318 tiRoot_t *tiRoot,
319 tiIORequest_t *tiIORequest,
320 tiIOStatus_t status,
321 bit32 statusDetail,
322 tiSenseData_t *senseData,
323 bit32 context
324 );
325
326 osGLOBAL tiDeviceHandle_t*
327 ostiMapToDevHandle(tiRoot_t *root,
328 bit8 pathId,
329 bit8 targetId,
330 bit8 LUN
331 );
332 osGLOBAL bit32 ostiSendResetDeviceIoctl(tiRoot_t *root,
333 void *pccb,
334 bit8 pathId,
335 bit8 targetId,
336 bit8 lun,
337 unsigned long resetType
338 );
339
340 osGLOBAL void
341 ostiGetSenseKeyCount(tiRoot_t *root,
342 bit32 fIsClear,
343 void *SenseKeyCount,
344 bit32 length
345 );
346
347 osGLOBAL void
348 ostiGetSCSIStatusCount(tiRoot_t *root,
349 bit32 fIsClear,
350 void *ScsiStatusCount,
351 bit32 length
352 );
353
354 osGLOBAL bit32
355 ostiSetDeviceQueueDepth(tiRoot_t *tiRoot,
356 tiIORequest_t *tiIORequest,
357 bit32 QueueDepth
358 );
359
360
361 #ifdef FAST_IO_TEST
362 typedef void (*ostiFastSSPCb_t)(tiRoot_t *ptiRoot,
363 void *arg,
364 tiIOStatus_t IOStatus,
365 bit32 statusDetail);
366
367 void osti_FastIOCb(tiRoot_t *ptiRoot,
368 void *arg,
369 tiIOStatus_t IOStatus,
370 bit32 statusDetail);
371 #endif
372
373 osGLOBAL void
374 ostiInitiatorSMPCompleted(tiRoot_t *tiRoot,
375 tiIORequest_t *tiSMPRequest,
376 tiSMPStatus_t smpStatus,
377 bit32 tiSMPInfoLen,
378 void *tiFrameHandle,
379 bit32 context);
380 /*
381 * Initiator specific event
382 */
383 osGLOBAL void ostiInitiatorEvent (
384 tiRoot_t *tiRoot,
385 tiPortalContext_t *portalContext,
386 tiDeviceHandle_t *tiDeviceHandle,
387 tiIntrEventType_t eventType,
388 bit32 eventStatus,
389 void *parm
390 );
391
392
393 /*
394 * PMC-Sierra IOCTL semaphoring
395 */
396 osGLOBAL void ostiIOCTLClearSignal (
397 tiRoot_t *tiRoot,
398 void **agParam1,
399 void **agParam2,
400 void **agParam3
401 );
402
403 osGLOBAL void ostiIOCTLWaitForSignal (
404 tiRoot_t *tigRoot,
405 void *agParam1,
406 void *agParam2,
407 void *agParam3
408 );
409
410 osGLOBAL void ostiIOCTLSetSignal (
411 tiRoot_t *tiRoot,
412 void *agParam1,
413 void *agParam2,
414 void *agParam3
415 );
416
417 osGLOBAL void ostiIOCTLWaitForComplete (
418 tiRoot_t *tigRoot,
419 void *agParam1,
420 void *agParam2,
421 void *agParam3
422 );
423
424 osGLOBAL void ostiIOCTLComplete (
425 tiRoot_t *tiRoot,
426 void *agParam1,
427 void *agParam2,
428 void *agParam3
429 );
430
431 /*****************************************************************************
432 * Target specific Callbacks
433 *****************************************************************************/
434
435 osGLOBAL void ostiProcessScsiReq(
436 tiRoot_t *tiRoot,
437 tiTargetScsiCmnd_t *tiTgtScsiCmnd,
438 void *agFrameHandle,
439 bit32 immDataLength,
440 tiIORequest_t *tiIORequest,
441 tiDeviceHandle_t *tiDeviceHandle);
442
443 osGLOBAL void ostiNextDataPhase(
444 tiRoot_t *tiRoot,
445 tiIORequest_t *tiIORequest);
446
447 osGLOBAL void ostiTaskManagement (
448 tiRoot_t *tiRoot,
449 bit32 task,
450 bit8 *scsiLun,
451 tiIORequest_t *refTiIORequest,
452 tiIORequest_t *tiTMRequest,
453 tiDeviceHandle_t *tiDeviceHandle);
454
455 osGLOBAL void ostiTargetIOCompleted(
456 tiRoot_t *tiRoot,
457 tiIORequest_t *tiIORequest,
458 tiIOStatus_t status
459 );
460
461 osGLOBAL bit32 ostiTargetEvent (
462 tiRoot_t *tiRoot,
463 tiPortalContext_t *portalContext,
464 tiDeviceHandle_t *tiDeviceHandle,
465 tiTgtEventType_t eventType,
466 bit32 eventStatus,
467 void *parm
468 );
469
470 osGLOBAL void ostiTargetIOError(
471 tiRoot_t *tiRoot,
472 tiIORequest_t *tiIORequest,
473 tiIOStatus_t status,
474 bit32 statusDetail
475 );
476
477 osGLOBAL void ostiTargetTmCompleted(
478 tiRoot_t *tiRoot,
479 tiIORequest_t *tiTmRequest,
480 tiIOStatus_t status,
481 bit32 statusDetail
482 );
483
484 osGLOBAL void ostiPCI_TRIGGER( tiRoot_t *tiRoot );
485
486
487 #endif /* OSTIAPI_H */
Cache object: 54dbf2043fa76afeb295548cda540364
|