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 /*******************************************************************************/
26 * \brief The file defines the declaration of OS APIs
29 /*******************************************************************************/
31 #ifndef __SSDKOSAPI_H__
32 #define __SSDKOSAPI_H__
35 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18)
45 /***************************************************************************
46 * Definition of register access related functions start *
47 ***************************************************************************/
56 #ifndef ossaHwRegWrite
65 #ifndef ossaHwRegReadExt
67 bit32 ossaHwRegReadExt(
74 #ifndef ossaHwRegWriteExt
76 void ossaHwRegWriteExt(
84 #ifndef ossaHwRegReadConfig32
85 osGLOBAL bit32 ossaHwRegReadConfig32(
92 /***************************************************************************
93 * Definition of register access related functions end *
94 ***************************************************************************/
96 /***************************************************************************
97 * Definition of thread related functions start *
98 ***************************************************************************/
99 #ifndef ossaSingleThreadedEnter
100 GLOBAL FORCEINLINE void ossaSingleThreadedEnter(
106 #ifndef ossaSingleThreadedLeave
107 GLOBAL FORCEINLINE void ossaSingleThreadedLeave(
113 #ifndef ossaStallThread
114 GLOBAL void ossaStallThread(
119 /***************************************************************************
120 * Definition of thread related functions end *
121 ***************************************************************************/
123 /***************************************************************************
124 * Definition of interrupt related functions start *
125 ***************************************************************************/
126 #ifndef ossaDisableInterrupts
127 #define ossaDisableInterrupts(agRoot, interruptVectorIndex) \
130 agsaLLRoot_t *saROOT = (agsaLLRoot_t *)(agRoot->sdkData);\
131 saROOT->DisableInterrupts(agRoot, interruptVectorIndex); \
135 #ifndef ossaReenableInterrupts
136 #define ossaReenableInterrupts(agRoot, interruptVectorIndex) \
139 agsaLLRoot_t *saROOT = (agsaLLRoot_t *)(agRoot->sdkData); \
140 saROOT->ReEnableInterrupts(agRoot, interruptVectorIndex); \
144 /***************************************************************************
145 * Definition of interrupt related functions end *
146 ***************************************************************************/
148 /***************************************************************************
149 * Definition of cache related functions start *
150 ***************************************************************************/
151 #ifndef ossaCacheInvalidate
152 GLOBAL FORCEINLINE void ossaCacheInvalidate(
160 #ifndef ossaCacheFlush
161 GLOBAL FORCEINLINE void ossaCacheFlush(
169 #ifndef ossaCachePreFlush
170 GLOBAL FORCEINLINE void ossaCachePreFlush(
178 /***************************************************************************
179 * Definition of cache related functions end *
180 ***************************************************************************/
182 /***************************************************************************
183 * Definition of hardware related functions start *
184 ***************************************************************************/
186 GLOBAL void ossaHwCB(
188 agsaPortContext_t *agPortContext,
196 #ifndef ossaHwEventAckCB
197 GLOBAL void ossaHwEventAckCB(
199 agsaContext_t *agContext,
203 /***************************************************************************
204 * Definition of hardware related functions end *
205 ***************************************************************************/
207 /***************************************************************************
208 * Definition of SATA related functions start *
209 ***************************************************************************/
210 #ifndef ossaSATACompleted
211 GLOBAL void ossaSATACompleted(
213 agsaIORequest_t *agIORequest,
222 #ifndef ossaSATAEvent
223 GLOBAL void ossaSATAEvent(
225 agsaIORequest_t *agIORequest,
226 agsaPortContext_t *agPortContext,
227 agsaDevHandle_t *agDevHandle,
234 #ifndef ossaSATAAbortCB
235 GLOBAL void ossaSATAAbortCB(
237 agsaIORequest_t *agIORequest,
243 /***************************************************************************
244 * Definition of SATA related functions end *
245 ***************************************************************************/
248 /***************************************************************************
249 * Definition of SAS related functions start *
250 ***************************************************************************/
252 GLOBAL void ossaSSPEvent(
254 agsaIORequest_t *agIORequest,
255 agsaPortContext_t *agPortContext,
256 agsaDevHandle_t *agDevHandle,
265 ossaSMPIoctlCompleted(
267 agsaIORequest_t *agIORequest,
270 agsaFrameHandle_t agFrameHandle
273 #ifndef ossaSMPCompleted
274 GLOBAL void ossaSMPCompleted(
276 agsaIORequest_t *agIORequest,
279 agsaFrameHandle_t agFrameHandle
283 #ifndef ossaSMPReqReceived
284 GLOBAL void ossaSMPReqReceived(
286 agsaDevHandle_t *agDevHandle,
287 agsaFrameHandle_t agFrameHandle,
293 #ifndef ossaSSPCompleted
294 GLOBAL FORCEINLINE void ossaSSPCompleted(
296 agsaIORequest_t *agIORequest,
306 GLOBAL void ossaFastSSPCompleted(
308 agsaIORequest_t *cbArg,
317 #ifndef ossaSSPReqReceived
318 GLOBAL void ossaSSPReqReceived(
320 agsaDevHandle_t *agDevHandle,
321 agsaFrameHandle_t agFrameHandle,
322 bit16 agInitiatorTag,
329 ossaSSPIoctlCompleted(
331 agsaIORequest_t *agIORequest,
340 #ifndef ossaSSPAbortCB
341 GLOBAL void ossaSSPAbortCB(
343 agsaIORequest_t *agIORequest,
349 #ifndef ossaSMPAbortCB
350 GLOBAL void ossaSMPAbortCB(
352 agsaIORequest_t *agIORequest,
358 #ifndef ossaReconfigSASParamsCB
359 GLOBAL void ossaReconfigSASParamsCB(
361 agsaContext_t *agContext,
363 agsaSASReconfig_t *agSASConfig
367 /***************************************************************************
368 * Definition of SAS related functions end *
369 ***************************************************************************/
371 /***************************************************************************
372 * Definition of Discovery related functions start *
373 ***************************************************************************/
374 #ifndef ossaDiscoverSataCB
375 GLOBAL void ossaDiscoverSataCB(
377 agsaPortContext_t *agPortContext,
384 #ifndef ossaDiscoverSasCB
385 GLOBAL void ossaDiscoverSasCB(
387 agsaPortContext_t *agPortContext,
394 #ifndef ossaDeviceHandleAccept
395 GLOBAL bit32 ossaDeviceHandleAccept(
397 agsaDevHandle_t *agDevHandle,
398 agsaSASDeviceInfo_t *agDeviceInfo,
399 agsaPortContext_t *agPortContext,
400 bit32 *hostAssignedDeviceId
404 #ifndef ossaGetDeviceHandlesCB
405 GLOBAL void ossaGetDeviceHandlesCB(
407 agsaContext_t *agContext,
408 agsaPortContext_t *agPortContext,
409 agsaDevHandle_t *agDev[],
414 #ifndef ossaGetDeviceInfoCB
415 GLOBAL void ossaGetDeviceInfoCB(
417 agsaContext_t *agContext,
418 agsaDevHandle_t *agDevHandle,
424 #ifndef ossaDeviceHandleRemovedEvent
425 GLOBAL void ossaDeviceHandleRemovedEvent (
427 agsaDevHandle_t *agDevHandle,
428 agsaPortContext_t *agPortContext
432 #ifndef ossaGetDeviceStateCB
433 GLOBAL void ossaGetDeviceStateCB(
435 agsaContext_t *agContext,
436 agsaDevHandle_t *agDevHandle,
442 #ifndef ossaSetDeviceInfoCB
443 GLOBAL void ossaSetDeviceInfoCB(
445 agsaContext_t *agContext,
446 agsaDevHandle_t *agDevHandle,
453 #ifndef ossaSetDeviceStateCB
454 GLOBAL void ossaSetDeviceStateCB(
456 agsaContext_t *agContext,
457 agsaDevHandle_t *agDevHandle,
459 bit32 newDeviceState,
460 bit32 previousDeviceState
464 /***************************************************************************
465 * Definition of Discovery related functions end *
466 ***************************************************************************/
468 /***************************************************************************
469 * Definition of Misc. related functions start *
470 ***************************************************************************/
472 #ifndef ossaTimeStamp
473 GLOBAL bit32 ossaTimeStamp(agsaRoot_t *agRoot);
474 #endif /* ossaTimeStamp */
476 #ifndef ossaTimeStamp64
477 GLOBAL bit64 ossaTimeStamp64(agsaRoot_t *agRoot);
478 #endif /* ossaTimeStamp64 */
481 #ifndef ossaLocalPhyControlCB
482 GLOBAL void ossaLocalPhyControlCB(
484 agsaContext_t *agContext,
491 #ifndef ossaGetPhyProfileCB
492 GLOBAL void ossaGetPhyProfileCB(
494 agsaContext_t *agContext,
501 #ifndef ossaSetPhyProfileCB
502 GLOBAL void ossaSetPhyProfileCB(
504 agsaContext_t *agContext,
511 #ifndef ossaFwFlashUpdateCB
512 GLOBAL void ossaFwFlashUpdateCB(
514 agsaContext_t *agContext,
518 #ifndef ossaFlashExtExecuteCB
519 GLOBAL void ossaFlashExtExecuteCB(
521 agsaContext_t *agContext,
524 agsaFlashExtResponse_t *agFlashExtRsp);
528 #ifdef SPC_ENABLE_PROFILE
529 GLOBAL void ossaFwProfileCB(
531 agsaContext_t *agContext,
538 GLOBAL void ossaEchoCB(
540 agsaContext_t *agContext,
544 #ifndef ossaGpioResponseCB
545 GLOBAL void ossaGpioResponseCB(
547 agsaContext_t *agContext,
550 agsaGpioPinSetupInfo_t *gpioPinSetupInfo,
551 agsaGpioEventSetupInfo_t *gpioEventSetupInfo);
554 #ifndef ossaGpioEvent
555 GLOBAL void ossaGpioEvent(
560 #ifndef ossaSASDiagExecuteCB
561 GLOBAL void ossaSASDiagExecuteCB(
563 agsaContext_t *agContext,
569 #ifndef ossaSASDiagStartEndCB
570 GLOBAL void ossaSASDiagStartEndCB(
572 agsaContext_t *agContext,
576 #ifndef ossaGetTimeStampCB
577 GLOBAL void ossaGetTimeStampCB(
579 agsaContext_t *agContext,
580 bit32 timeStampLower,
581 bit32 timeStampUpper);
584 #ifndef ossaPortControlCB
585 GLOBAL void ossaPortControlCB(
587 agsaContext_t *agContext,
588 agsaPortContext_t *agPortContext,
593 #ifndef ossaGeneralEvent
594 GLOBAL void ossaGeneralEvent(
597 agsaContext_t *agContext,
601 #ifndef ossaGetRegisterDumpCB
602 void ossaGetRegisterDumpCB(
604 agsaContext_t *agContext,
608 GLOBAL void ossaGetForensicDataCB (
610 agsaContext_t *agContext,
612 agsaForensicData_t *forensicData
616 #ifndef ossaGetNVMDResponseCB
617 GLOBAL void ossaGetNVMDResponseCB(
619 agsaContext_t *agContext,
621 bit8 indirectPayload,
623 agsaFrameHandle_t agFrameHandle );
626 #ifndef ossaSetNVMDResponseCB
627 GLOBAL void ossaSetNVMDResponseCB(
629 agsaContext_t *agContext,
633 #ifndef ossaQueueProcessed
634 #ifdef SALLSDK_TEST_SET_OB_QUEUE
635 GLOBAL void ossaQueueProcessed(agsaRoot_t *agRoot,
640 #define ossaQueueProcessed(agRoot, queue, obpi, obci)
645 GLOBAL void ossaSGpioCB(
647 agsaContext_t *agContext,
648 agsaSGpioReqResponse_t *pSgpioResponse
652 #ifndef ossaPCIeDiagExecuteCB
653 GLOBAL void ossaPCIeDiagExecuteCB(
655 agsaContext_t *agContext,
658 agsaPCIeDiagResponse_t *resp );
661 #ifndef ossaGetDFEDataCB
662 GLOBAL void ossaGetDFEDataCB(
664 agsaContext_t *agContext,
670 #ifndef ossaVhistCaptureCB
671 GLOBAL void ossaVhistCaptureCB(
673 agsaContext_t *agContext,
678 #ifndef ossaGetIOErrorStatsCB
679 GLOBAL void ossaGetIOErrorStatsCB (
681 agsaContext_t *agContext,
683 agsaIOErrorEventStats_t *stats
687 #ifndef ossaGetIOEventStatsCB
688 GLOBAL void ossaGetIOEventStatsCB (
690 agsaContext_t *agContext,
692 agsaIOErrorEventStats_t *stats
696 #ifndef ossaOperatorManagementCB
697 GLOBAL void ossaOperatorManagementCB(
699 agsaContext_t *agContext,
706 #ifndef ossaEncryptSelftestExecuteCB
707 GLOBAL void ossaEncryptSelftestExecuteCB (
709 agsaContext_t *agContext,
718 #ifndef ossaGetOperatorCB
719 GLOBAL void ossaGetOperatorCB(
721 agsaContext_t *agContext,
731 #ifndef ossaSetOperatorCB
732 GLOBAL void ossaSetOperatorCB(
734 agsaContext_t *agContext,
741 #ifndef ossaDIFEncryptionOffloadStartCB
742 GLOBAL void ossaDIFEncryptionOffloadStartCB(
744 agsaContext_t *agContext,
746 agsaOffloadDifDetails_t *agsaOffloadDifDetails
750 /***************************************************************************
751 * Definition of Misc related functions end *
752 ***************************************************************************/
754 /***************************************************************************
755 * Definition of Debug related functions start *
756 ***************************************************************************/
757 #ifndef ossaLogTrace0
758 GLOBAL void ossaLogTrace0(
764 #ifndef ossaLogTrace1
765 GLOBAL void ossaLogTrace1(
772 #ifndef ossaLogTrace2
773 GLOBAL void ossaLogTrace2(
781 #ifndef ossaLogTrace3
782 GLOBAL void ossaLogTrace3(
791 #ifndef ossaLogTrace4
792 GLOBAL void ossaLogTrace4(
802 #ifndef ossaLogDebugString
803 GLOBAL void ossaLogDebugString(
814 #ifdef SALLSDK_OS_IOMB_LOG_ENABLE
815 GLOBAL void ossaLogIomb(agsaRoot_t *agRoot,
821 #define ossaLogIomb(a, b,c,d,e )
824 osGLOBAL void ossaPCI_TRIGGER(agsaRoot_t *agRoot );
827 osGLOBAL void ossaEnter(agsaRoot_t *agRoot, int io);
828 osGLOBAL void ossaLeave(agsaRoot_t *agRoot, int io);
829 #define OSSA_INP_ENTER(root) ossaEnter(root, 0)
830 #define OSSA_INP_LEAVE(root) ossaLeave(root, 0)
831 #define OSSA_OUT_ENTER(root) ossaEnter(root, 1)
832 #define OSSA_OUT_LEAVE(root) ossaLeave(root, 1)
834 #define OSSA_INP_ENTER(root)
835 #define OSSA_INP_LEAVE(root)
836 #define OSSA_OUT_ENTER(root)
837 #define OSSA_OUT_LEAVE(root)
839 /***************************************************************************
840 * Definition of Debug related functions end *
841 ***************************************************************************/
843 #endif /*__SSDKOSAPI_H__ */