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 function delcaration for internal used function
29 /******************************************************************************/
35 /* function declaration */
37 GLOBAL agsaTimerDesc_t *siTimerAdd(
40 agsaCallback_t pfnTimeout,
45 GLOBAL void siTimerRemove(
47 agsaTimerDesc_t *pTimer
50 GLOBAL void siTimerRemoveAll(agsaRoot_t *agRoot);
53 GLOBAL bit32 siConfiguration(agsaRoot_t *agRoot,
54 mpiConfig_t *mpiConfig,
55 agsaHwConfig_t *hwConfig,
56 agsaSwConfig_t *swConfig
59 GLOBAL bit32 mpiInitialize(agsaRoot_t *agRoot,
60 mpiMemReq_t *memoryAllocated,
64 GLOBAL bit32 mpiWaitForConfigTable(agsaRoot_t *agRoot,
65 spc_configMainDescriptor_t *config
68 GLOBAL void mpiUpdateIBQueueCfgTable(agsaRoot_t *agRoot,
69 spc_inboundQueueDescriptor_t *inQueueCfg,
70 bit32 QueueTableOffset,
74 GLOBAL void mpiUpdateOBQueueCfgTable(agsaRoot_t *agRoot,
75 spc_outboundQueueDescriptor_t *outQueueCfg,
76 bit32 QueueTableOffset,
79 GLOBAL void mpiUpdateFatalErrorTable(agsaRoot_t *agRoot,
80 bit32 FerrTableOffset,
81 bit32 lowerBaseAddress,
82 bit32 upperBaseAddress,
86 GLOBAL bit32 mpiGetPCIBarIndex(agsaRoot_t *agRoot,
90 GLOBAL bit32 mpiUnInitConfigTable(agsaRoot_t *agRoot);
92 GLOBAL void mpiReadGSTable(agsaRoot_t *agRoot,
93 spc_GSTableDescriptor_t *mpiGSTable);
95 GLOBAL void siInitResources(agsaRoot_t *agRoot,
96 agsaMemoryRequirement_t *memoryAllocated,
97 agsaHwConfig_t *hwConfig,
98 agsaSwConfig_t *swConfig,
101 GLOBAL void mpiReadCALTable(agsaRoot_t *agRoot,
102 spc_SPASTable_t *mpiCALTable,
105 GLOBAL void mpiWriteCALTable(agsaRoot_t *agRoot,
106 spc_SPASTable_t *mpiCALTable,
109 GLOBAL void mpiWriteCALAll(agsaRoot_t *agRoot,
110 agsaPhyAnalogSetupTable_t *mpiCALTable);
112 GLOBAL void mpiWrIntVecTable(agsaRoot_t *agRoot,
116 GLOBAL void mpiWrAnalogSetupTable(agsaRoot_t *agRoot,
121 GLOBAL void mpiWrPhyAttrbTable(agsaRoot_t *agRoot,
122 sasPhyAttribute_t *phyAttrib
126 GLOBAL bit32 siPhyStopCB(
130 agsaContext_t *agContext,
136 GLOBAL void siPortInvalid(
141 GLOBAL agsaDeviceDesc_t *siPortSASDeviceAdd(
144 agsaSASIdentify_t sasIdentify,
147 bit32 itNexusTimeout,
148 bit32 firstBurstSize,
153 GLOBAL void siPortDeviceRemove(
156 agsaDeviceDesc_t *pDevice,
160 GLOBAL agsaDeviceDesc_t *siPortSATADeviceAdd(
163 agsaDeviceDesc_t *pSTPBridge,
168 bit32 itNexusTimeout,
169 bit32 firstBurstSize,
174 GLOBAL void siPortDeviceListRemove(
177 agsaDeviceDesc_t *pDevice
181 GLOBAL void siSATASignatureCpy(
189 #ifdef SA_ENABLE_HDA_FUNCTIONS
190 GLOBAL bit32 siHDAMode(
193 agsaFwImg_t *userFwImg
196 GLOBAL bit32 siHDAMode_V(
199 agsaFwImg_t *userFwImg
204 GLOBAL bit32 siBar4Shift(
210 GLOBAL bit32 siSoftReset(
215 GLOBAL bit32 siSpcSoftReset(
220 GLOBAL void siChipReset(
225 GLOBAL bit32 siChipResetV(
230 GLOBAL void siChipResetSpc(
236 GLOBAL void siPrintBuffer(
243 int siIsHexDigit(char a);
244 GLOBAL FORCEINLINE void* si_memcpy(void *dst, void *src, bit32 count);
245 GLOBAL FORCEINLINE void* si_memset(void *s, int c, bit32 n);
247 GLOBAL void siDumpActiveIORequests(
252 GLOBAL void siClearActiveIORequests( agsaRoot_t *agRoot);
254 GLOBAL void siCountActiveIORequestsOnDevice( agsaRoot_t *agRoot, bit32 device );
255 GLOBAL void siClearActiveIORequestsOnDevice( agsaRoot_t *agRoot, bit32 device );
260 GLOBAL void siEventPhyUpRcvd(
263 agsaSASIdentify_t *agSASIdentify,
269 GLOBAL void siEventSATASignatureRcvd(
278 GLOBAL FORCEINLINE void siIODone(
280 agsaIORequestDesc_t *pRequest,
285 GLOBAL void siAbnormal(
287 agsaIORequestDesc_t *pRequest,
293 GLOBAL void siDifAbnormal(
295 agsaIORequestDesc_t *pRequest,
302 GLOBAL void siEventSSPResponseWtDataRcvd(
304 agsaIORequestDesc_t *pRequest,
305 agsaSSPResponseInfoUnit_t *pRespIU,
310 GLOBAL void siSMPRespRcvd(
312 agsaSMPCompletionRsp_t *pIomb,
317 GLOBAL void siEventSATAResponseWtDataRcvd(
319 agsaIORequestDesc_t *pRequest,
326 GLOBAL bit32 siRemoveDevHandle(
328 agsaDevHandle_t *agDevHandle
332 GLOBAL FORCEINLINE bit32 mpiParseOBIomb(
335 mpiMsgCategory_t category,
339 GLOBAL bit32 mpiEchoRsp(
344 GLOBAL bit32 mpiGetNVMDataRsp(
346 agsaGetNVMDataRsp_t *pIomb
349 GLOBAL bit32 mpiHWevent(
351 agsaHWEvent_SPC_OUB_t *pIomb
354 GLOBAL bit32 mpiPhyStartEvent(
356 agsaHWEvent_Phy_OUB_t *pIomb
359 GLOBAL bit32 mpiPhyStopEvent(
361 agsaHWEvent_Phy_OUB_t *pIomb
364 GLOBAL bit32 mpiSMPCompletion(
366 agsaSMPCompletionRsp_t *pIomb
369 GLOBAL bit32 mpiGetDevInfoRspSpc(
371 agsaGetDevInfoRsp_t *pIomb
374 GLOBAL bit32 mpiGetPhyProfileRsp(
376 agsaGetPhyProfileRspV_t *pIomb
379 GLOBAL bit32 mpiSetPhyProfileRsp(
381 agsaSetPhyProfileRspV_t *pIomb
384 GLOBAL bit32 mpiGetDevInfoRsp(
386 agsaGetDevInfoRspV_t *pIomb
389 GLOBAL bit32 mpiGetDevHandleRsp(
391 agsaGetDevHandleRsp_t *pIomb
394 GLOBAL bit32 mpiPhyCntrlRsp(
396 agsaLocalPhyCntrlRsp_t *pIomb
399 GLOBAL bit32 mpiDeviceRegRsp(
401 agsaDeviceRegistrationRsp_t *pIomb
404 GLOBAL bit32 mpiDeregDevHandleRsp(
406 agsaDeregDevHandleRsp_t *pIomb
409 GLOBAL FORCEINLINE bit32 mpiSSPCompletion(
414 GLOBAL FORCEINLINE bit32 mpiSATACompletion(
419 GLOBAL bit32 mpiSSPEvent(
421 agsaSSPEventRsp_t *pIomb
424 GLOBAL bit32 mpiSATAEvent(
426 agsaSATAEventRsp_t *pIomb
429 GLOBAL bit32 mpiFwFlashUpdateRsp(
431 agsaFwFlashUpdateRsp_t *payload
435 GLOBAL bit32 mpiFwExtFlashUpdateRsp(
437 agsaFwFlashOpExtRsp_t *payload
440 #ifdef SPC_ENABLE_PROFILE
441 GLOBAL bit32 mpiFwProfileRsp(
443 agsaFwProfileRsp_t *payload
446 GLOBAL bit32 mpiSetNVMDataRsp(
448 agsaSetNVMDataRsp_t *pIomb
451 GLOBAL bit32 mpiSSPAbortRsp(
453 agsaSSPAbortRsp_t *pIomb
456 GLOBAL bit32 mpiSATAAbortRsp(
458 agsaSATAAbortRsp_t *pIomb
461 GLOBAL bit32 mpiGPIORsp(
466 GLOBAL bit32 mpiGPIOEventRsp(
468 agsaGPIOEvent_t *pIomb
471 GLOBAL bit32 mpiSASDiagStartEndRsp(
473 agsaSASDiagStartEndRsp_t *pIomb
476 GLOBAL bit32 mpiSASDiagExecuteRsp(
478 agsaSASDiagExecuteRsp_t *pIomb
481 GLOBAL bit32 mpiGeneralEventRsp(
483 agsaGeneralEventRsp_t *pIomb
486 GLOBAL bit32 mpiSSPReqReceivedNotify(
488 agsaSSPReqReceivedNotify_t *pMsg1
491 GLOBAL bit32 mpiDeviceHandleArrived(
493 agsaDeviceHandleArrivedNotify_t *pMsg1
496 GLOBAL bit32 mpiGetTimeStampRsp(
498 agsaGetTimeStampRsp_t *pIomb
501 GLOBAL bit32 mpiSASHwEventAckRsp(
503 agsaSASHwEventAckRsp_t *pIomb
506 GLOBAL bit32 mpiSetDevInfoRsp(
508 agsaSetDeviceInfoRsp_t *pIomb
511 GLOBAL bit32 mpiSetDeviceStateRsp(
513 agsaSetDeviceStateRsp_t *pIomb
516 GLOBAL bit32 mpiGetDeviceStateRsp(
518 agsaGetDeviceStateRsp_t *pIomb
521 GLOBAL bit32 mpiSasReInitializeRsp(
523 agsaSasReInitializeRsp_t *pIomb
526 GLOBAL bit32 mpiSetControllerConfigRsp(
528 agsaSetControllerConfigRsp_t *pIomb
531 GLOBAL bit32 mpiGetControllerConfigRsp(
533 agsaGetControllerConfigRsp_t *pIomb
536 GLOBAL bit32 mpiKekManagementRsp(
538 agsaKekManagementRsp_t *pIomb
541 GLOBAL bit32 mpiDekManagementRsp(
543 agsaDekManagementRsp_t *pIomb
546 GLOBAL bit32 mpiOperatorManagementRsp(
548 agsaOperatorMangmenRsp_t *pIomb
551 GLOBAL bit32 mpiBistRsp(
553 agsaEncryptBistRsp_t *pIomb
556 GLOBAL bit32 mpiSetOperatorRsp(
558 agsaSetOperatorRsp_t *pIomb
561 GLOBAL bit32 mpiGetOperatorRsp(
563 agsaGetOperatorRsp_t *pIomb
566 GLOBAL bit32 mpiDifEncOffloadRsp(
568 agsaDifEncOffloadRspV_t *pIomb
571 GLOBAL bit32 mpiGetVHistRsp(
573 agsaGetVHistCapRsp_t *pIomb
578 GLOBAL bit32 mpiBuildCmd(
581 mpiMsgCategory_t category,
588 GLOBAL bit32 mpiVHistCapCmd(
590 agsaContext_t *agContext,
599 GLOBAL bit32 mpiEchoCmd(
602 agsaContext_t *agContext,
606 GLOBAL bit32 mpiGetPhyProfileCmd(
608 agsaContext_t *agContext,
614 GLOBAL bit32 mpiSetPhyProfileCmd(
616 agsaContext_t *agContext,
623 GLOBAL bit32 mpiPhyStartCmd(
627 agsaPhyConfig_t *agPhyConfig,
628 agsaSASIdentify_t *agSASIdentify,
632 GLOBAL bit32 mpiPhyStopCmd(
639 GLOBAL bit32 mpiSMPCmd(
643 agsaSMPCmd_t *payload,
648 GLOBAL bit32 mpiDeregDevHandleCmd(
650 agsaContext_t *agContext,
651 agsaDeviceDesc_t *pDevice,
657 GLOBAL bit32 mpiGetDeviceHandleCmd(
659 agsaContext_t *agContext,
667 GLOBAL bit32 mpiLocalPhyControlCmd(
675 GLOBAL bit32 mpiGetDeviceInfoCmd(
677 agsaContext_t *agContext,
683 GLOBAL bit32 mpiDevHandleAcceptCmd(
685 agsaContext_t *agContext,
694 GLOBAL bit32 mpiPortControlRsp(
696 agsaPortControlRsp_t *pIomb
699 GLOBAL bit32 mpiSMPAbortRsp(
701 agsaSMPAbortRsp_t *pIomb
704 GLOBAL bit32 siGetRegisterDumpGSM(
706 void *destinationAddress,
712 GLOBAL bit32 mpiNVMReadRegDumpCmd(
714 agsaContext_t *agContext,
723 GLOBAL bit32 mpiDeviceHandleRemoval(
725 agsaDeviceHandleRemoval_t *pMsg1);
727 GLOBAL bit32 mpiGetNVMDCmd(
729 agsaContext_t *agContext,
730 agsaNVMDData_t *NVMDInfo,
734 GLOBAL bit32 mpiSetNVMDCmd(
736 agsaContext_t *agContext,
737 agsaNVMDData_t *NVMDInfo,
741 GLOBAL bit32 mpiSetDeviceInfoCmd(
743 agsaContext_t *agContext,
748 ossaSetDeviceInfoCB_t agCB
751 GLOBAL bit32 mpiSetDeviceStateCmd(
753 agsaContext_t *agContext,
759 GLOBAL bit32 mpiGetDeviceStateCmd(
761 agsaContext_t *agContext,
766 GLOBAL bit32 mpiSasReinitializeCmd(
768 agsaContext_t *agContext,
769 agsaSASReconfig_t *agSASConfig,
773 GLOBAL bit32 mpiSGpioRsp(
775 agsaSGpioRsp_t *pInIomb
778 GLOBAL bit32 mpiPCIeDiagExecuteRsp(
783 GLOBAL bit32 mpiGetDFEDataRsp(
788 GLOBAL bit32 mpiGetVisDataRsp(
793 GLOBAL bit32 mpiSetControllerConfigCmd(
795 agsaContext_t *agContext,
796 agsaSetControllerConfigCmd_t *agControllerConfig,
801 GLOBAL bit32 mpiGetControllerConfigCmd(
803 agsaContext_t *agContext,
804 agsaGetControllerConfigCmd_t *agControllerConfig,
808 GLOBAL bit32 mpiKekManagementCmd(
810 agsaContext_t *agContext,
811 agsaKekManagementCmd_t *agKekMgmt,
815 GLOBAL bit32 mpiDekManagementCmd(
817 agsaContext_t *agContext,
818 agsaDekManagementCmd_t *agDekMgmt,
822 GLOBAL bit32 mpiOperatorManagementCmd(
825 agsaContext_t *agContext,
826 agsaOperatorMangmentCmd_t *operatorcode );
828 GLOBAL bit32 mpiEncryptBistCmd(
831 agsaContext_t *agContext,
832 agsaEncryptBist_t *bist );
834 GLOBAL bit32 mpiSetOperatorCmd(
837 agsaContext_t *agContext,
838 agsaSetOperatorCmd_t *operatorcode
841 GLOBAL bit32 mpiGetOperatorCmd(
844 agsaContext_t *agContext,
845 agsaGetOperatorCmd_t *operatorcode
848 GLOBAL bit32 mpiDIFEncryptionOffloadCmd(
850 agsaContext_t *agContext,
853 agsaDifEncPayload_t *agDifEncOffload,
854 ossaDIFEncryptionOffloadStartCB_t agCB
857 bit32 siOurMSIXInterrupt(agsaRoot_t *agRoot,bit32 interruptVectorIndex);
858 void siDisableMSIXInterrupts(agsaRoot_t *agRoot,bit32 interruptVectorIndex);
859 void siReenableMSIXInterrupts(agsaRoot_t *agRoot,bit32 interruptVectorIndex);
861 bit32 siOurMSIInterrupt(agsaRoot_t *agRoot,bit32 interruptVectorIndex);
862 void siDisableMSIInterrupts(agsaRoot_t *agRoot,bit32 interruptVectorIndex);
863 void siReenableMSIInterrupts(agsaRoot_t *agRoot,bit32 interruptVectorIndex);
866 bit32 siOurLegacyInterrupt(agsaRoot_t *agRoot,bit32 interruptVectorIndex);
867 void siDisableLegacyInterrupts(agsaRoot_t *agRoot,bit32 interruptVectorIndex);
868 void siReenableLegacyInterrupts(agsaRoot_t *agRoot,bit32 interruptVectorIndex);
870 bit32 siOurMSIX_V_Interrupt(agsaRoot_t *agRoot,bit32 interruptVectorIndex);
871 bit32 siOurMSI_V_Interrupt(agsaRoot_t *agRoot,bit32 interruptVectorIndex);
872 bit32 siOurLegacy_V_Interrupt(agsaRoot_t *agRoot,bit32 interruptVectorIndex);
874 void siDisableMSIX_V_Interrupts(agsaRoot_t *agRoot,bit32 interruptVectorIndex);
875 void siDisableMSI_V_Interrupts(agsaRoot_t *agRoot,bit32 interruptVectorIndex);
876 void siDisableLegacy_V_Interrupts(agsaRoot_t *agRoot,bit32 interruptVectorIndex);
878 void siReenableMSIX_V_Interrupts(agsaRoot_t *agRoot,bit32 interruptVectorIndex);
879 void siReenableMSI_V_Interrupts(agsaRoot_t *agRoot,bit32 interruptVectorIndex);
880 void siReenableLegacy_V_Interrupts(agsaRoot_t *agRoot,bit32 interruptVectorIndex);
883 GLOBAL void siUpdateBarOffsetTable(agsaRoot_t *agRoot, bit32 Spc_Type);
885 GLOBAL void siPciCpyMem(agsaRoot_t *agRoot,
892 GLOBAL void siHalRegWriteExt(
899 GLOBAL bit32 siHalRegReadExt( agsaRoot_t *agRoot,
904 #ifdef SA_FW_TIMER_READS_STATUS
905 bit32 siReadControllerStatus(
910 #endif /* SA_FW_TIMER_READS_STATUS */
913 #if defined(SALLSDK_DEBUG)
914 void sidump_hwConfig(agsaHwConfig_t *hwConfig);
915 void sidump_swConfig(agsaSwConfig_t *swConfig);
916 void sidump_Q_config( agsaQueueConfig_t *queueConfig );
918 GLOBAL bit32 siGetTableOffset(
920 bit32 TableOffsetInTable
923 GLOBAL bit32 siGetPciBar(
927 GLOBAL bit32 siScratchDump(agsaRoot_t *agRoot);
929 void si_macro_check(agsaRoot_t *agRoot);
931 GLOBAL bit32 si_check_V_HDA(agsaRoot_t *agRoot);
932 GLOBAL bit32 si_check_V_Ready(agsaRoot_t *agRoot);
934 GLOBAL void siPCITriger(agsaRoot_t *agRoot);
936 GLOBAL void siCheckQs(agsaRoot_t *agRoot);
939 GLOBAL bit32 smIsCfg_V_ANY( agsaRoot_t *agRoot);
940 GLOBAL bit32 smIS_SPC( agsaRoot_t *agRoot);
941 GLOBAL bit32 smIS_HIL( agsaRoot_t *agRoot);
942 GLOBAL bit32 smIS_SPC6V( agsaRoot_t *agRoot);
943 GLOBAL bit32 smIS_SPC12V( agsaRoot_t *agRoot);
944 GLOBAL bit32 smIS_SPCV( agsaRoot_t *agRoot);
945 GLOBAL bit32 smIS_ENCRYPT( agsaRoot_t *agRoot);
946 GLOBAL bit32 smIS_SPCV_2_IOP( agsaRoot_t *agRoot);
947 #endif /*__SAPROTO_H__ */