62#ifdef INITIATOR_DRIVER
70#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdxchg.h>
111 bit32 RetVal = 0xFFFFFFFF;
176 TI_DBG3((
"tdsaGetCardIDString: start\n"));
178 TI_DBG3((
"tdsaGetCardIDString: thisCardID 0x%x\n", thisCardID));
181 if (thisCardID == 0xFFFFFFFF)
183 TI_DBG1((
"tdGetCardIDString: No more CardIDs available\n"));
188 tdsaAllShared->CardID = thisCardID;
190 TI_DBG3((
"tdsaGetCardIDString: CardNum is %s\n", CardNum));
192 TI_DBG3((
"tdsaGetCardIDString: tdsaAllShared->CardIDString is %s\n", tdsaAllShared->CardIDString));
232 TI_DBG6((
"tiCOMGetResource start\n"));
233 TI_DBG6((
"tiCOMGetResource: loResource %p\n", loResource));
244#ifdef INITIATOR_DRIVER
246 if(initiatorResource !=
agNULL)
255 TI_DBG1((
"tiCOMGetResource: loResource is NULL, wrong\n"));
263 if(targetResource !=
agNULL)
305#ifdef TD_INT_COALESCE
306 tdsaIntCoalesceContext_t *tdsaIntCoalCxt;
317#if defined(TD_INT_COALESCE) || defined(TD_DISCOVER) || defined(TD_INTERNAL_DEBUG)
320#ifdef TD_INTERNAL_DEBUG
329 bit32 dmUsecsPerTick = 0;
330 bit32 dmMaxNumLocks = 0;
335 bit32 smUsecsPerTick = 0;
336 bit32 smMaxNumLocks = 0;
341 TI_DBG6((
"ticominit: tdsaroot\n"));
344 TI_DBG6((
"ticominit: portcontext\n"));
346 TI_DBG6((
"ticominit: device data\n"));
352 TI_DBG6((
"ticominit: IO request body\n"));
357 TI_DBG6((
"ticominit: FOR SAS\n"));
359 TI_DBG6((
"ticominit: FOR SATA\n"));
371 TI_DBG6((
"ticominit: start\n"));
374#if defined(TD_INT_COALESCE) && defined(TD_DISCOVER)
383 TI_DBG6((
"tiCOMInit: MaxTargets %d\n", MaxTargets));
386 (tdsaIntCoalesceContext_t *)((
bitptr)tdsaDeviceData
394#elif defined(TD_INT_COALESCE)
405 TI_DBG6((
"tiCOMInit: MaxTargets %d\n", MaxTargets));
408 (tdsaIntCoalesceContext_t *)((
bitptr)tdsaDeviceData
412#elif defined(TD_DISCOVER)
422 TI_DBG6((
"tiCOMInit: MaxTargets %d\n", MaxTargets));
439 TI_DBG6((
"tiCOMInit: ******* tdsaRoot %p tdsaPortContext %p tdsaDeviceData %p\n", tdsaRoot, tdsaPortContext, tdsaDeviceData));
446#ifdef INITIATOR_DRIVER
448 if(initiatorResource)
451 tdsaRoot->itdsaIni = IniAddr;
453 tdsaAllShared->
itdsaIni = tdsaRoot->itdsaIni;
462 tdsaRoot->ttdsaTgt = TgtAddr;
464 tdsaAllShared->
ttdsaTgt = tdsaRoot->ttdsaTgt;
468 TI_DBG5((
"tiCOMInit: IniAddr %p TgtAddr %p\n", IniAddr, TgtAddr));
470 TI_DBG3((
"tiCOMInit: tdsaRoot %p tdsaAllShared %p \n",tdsaRoot, tdsaAllShared));
510 tdsaAllShared->
DeviceMem = tdsaDeviceData;
515#ifdef TD_INT_COALESCE
516 tdsaAllShared->IntCoalesce = tdsaIntCoalCxt;
527#if defined(FDS_DM) && defined(FDS_SM)
535 tdsaAllShared->MaxNumDMLocks = dmMaxNumLocks;
536 TI_DBG2((
"tiCOMInit: DM MaxNumDMLocks 0x%x\n", tdsaAllShared->MaxNumDMLocks));
545 tdsaAllShared->MaxNumSMLocks = smMaxNumLocks;
546 TI_DBG2((
"tiCOMInit: SM MaxNumSMLocks 0x%x\n", tdsaAllShared->MaxNumSMLocks));
559 tdsaAllShared->MaxNumDMLocks = dmMaxNumLocks;
560 TI_DBG2((
"tiCOMInit: DM MaxNumDMLocks 0x%x\n", tdsaAllShared->MaxNumDMLocks));
572 tdsaAllShared->MaxNumSMLocks = smMaxNumLocks;
573 TI_DBG2((
"tiCOMInit: SM MaxNumSMLocks 0x%x\n", tdsaAllShared->MaxNumSMLocks));
600#ifdef TD_INTERNAL_DEBUG
609 tdsaAllShared->dmRoot.tdData = tdsaRoot;
613 tdsaAllShared->smRoot.tdData = tdsaRoot;
619 TI_DBG1((
"tdsaGetCardIDString() failed\n"));
635 TI_DBG6((
"ticominit: ******* before tdsaRoot %p tdsaPortContext %p tdsaDeviceData %p\n", tdsaRoot, tdsaPortContext, tdsaDeviceData));
644#ifdef TD_INT_COALESCE
645 tdsaIntCoalCxtInit(
tiRoot);
654#ifdef TD_INTERNAL_DEBUG
655 TI_DBG6((
"ticominit: temp 1\n"));
659 TI_DBG6((
"ticominit: pageinfo ID %d\n", page_to_fill->
id));
663 TI_DBG6((
"ticominit: devide\n"));
667 TDINIT_PRINT(
"ticominit: second pageinfo ID %d\n", page_to_fill->
id);
674#ifdef INITIATOR_DRIVER
675 if(initiatorResource !=
agNULL)
678 TI_DBG5((
"tiCOMInit: calling itdssInit\n"));
683 TI_DBG1((
"tiCOMInit: itdInit FAILED\n"));
690 if(targetResource !=
agNULL)
693 TI_DBG5 ((
"tiCOMInit: calling ttdssInit\n"));
698 TI_DBG1((
"tiCOMInit: ttdInit FAILED\n"));
732 bit32 usecsPerTick = 0;
736 bit32 maxQueueSets = 0;
737 bit32 maxNumOSLocks = 0;
743 char *pLastUsedChar =
agNULL;
744 char globalStr[] =
"Global";
745 char iniParmsStr[] =
"InitiatorParms";
746 char SwParmsStr[] =
"SWParms";
747 char OBQueueProps[] =
"OBQueueProps";
748 char IBQueueProps[] =
"IBQueueProps";
750 static char IBQueueSize[30];
751 static char OBQueueSize[30];
752 static char IBQueueEleSize[30];
753 static char OBQueueEleSize[30];
755 static char OBQueueInterruptCount[30];
756 static char OBQueueInterruptDelay[30];
757 static char OBQueueInterruptEnable[30];
758 static char IBQueuePriority[30];
770 static bit32 cardID = 0;
777 bit32 dmUsecsPerTick = 0;
778 bit32 dmMaxNumLocks = 0;
785 bit32 smUsecsPerTick = 0;
786 bit32 smMaxNumLocks = 0;
789 TI_DBG1((
"tdsaLoLevelGetResource: start \n"));
790 TI_DBG6((
"tdsaLoLevelGetResource: loResource %p\n", loResource));
794 osti_memset(&memRequirement, 0,
sizeof(memRequirement));
795 osti_memset(InboundQueueSize, 0,
sizeof(InboundQueueSize));
796 osti_memset(OutboundQueueSize, 0,
sizeof(OutboundQueueSize));
797 osti_memset(InboundQueueEleSize, 0,
sizeof(InboundQueueEleSize));
798 osti_memset(OutboundQueueEleSize, 0,
sizeof(OutboundQueueEleSize));
800 memRequirement.
count = 0;
820#ifdef SA_CONFIG_MDFD_REGISTRY
824#if defined(SALLSDK_DEBUG)
825 SwConfig.sallDebugLevel = 1;
829#ifdef SA_ENABLE_PCI_TRIGGER
830 SwConfig.PCI_trigger = 0;
835 dmMemRequirement.
count = 0;
838 dmSwConfig.DMDebugLevel = 1;
844 smMemRequirement.
count = 0;
848 smSwConfig.SMDebugLevel = 1;
853 buffLen =
sizeof(tmpBuffer);
856 SwConfig.
param3 = (
void *)&QueueConfig;
1054#if defined(SALLSDK_DEBUG)
1074 SwConfig.sallDebugLevel =
osti_strtoul (buffer, &pLastUsedChar, 0);
1078 SwConfig.sallDebugLevel =
osti_strtoul (buffer, &pLastUsedChar, 10);
1084#if defined(DM_DEBUG)
1104 dmSwConfig.DMDebugLevel =
osti_strtoul (buffer, &pLastUsedChar, 0);
1108 dmSwConfig.DMDebugLevel =
osti_strtoul (buffer, &pLastUsedChar, 10);
1113#if defined(SM_DEBUG)
1133 smSwConfig.SMDebugLevel =
osti_strtoul (buffer, &pLastUsedChar, 0);
1137 smSwConfig.SMDebugLevel =
osti_strtoul (buffer, &pLastUsedChar, 10);
1148 osti_sprintf(IBQueueEleSize,
"IBQueueElementSize%d", i);
1182 TI_DBG6((
"tdsaLoLevelGetResource: queue number %d IB queue size %d\n", i, InboundQueueSize[i]));
1216 TI_DBG6((
"tdsaLoLevelGetResource: queue number %d IB queue ele size %d\n", i, InboundQueueEleSize[i]));
1250 TI_DBG6((
"tdsaLoLevelGetResource: queue number %d priority %d\n", i, InboundQueuePriority[i]));
1266 osti_sprintf(OBQueueEleSize,
"OBQueueElementSize%d", i);
1267 osti_sprintf(OBQueueInterruptDelay,
"OBQueueInterruptDelay%d", i);
1268 osti_sprintf(OBQueueInterruptCount,
"OBQueueInterruptCount%d", i);
1269 osti_sprintf(OBQueueInterruptEnable,
"OBQueueInterruptEnable%d", i);
1300 TI_DBG6((
"tdsaLoLevelGetResource: queue number %d OB queue size %d\n", i, OutboundQueueSize[i]));
1334 TI_DBG6((
"tdsaLoLevelGetResource: queue number %d OB queue ele size %d\n", i, OutboundQueueEleSize[i]));
1354 OBQueueInterruptDelay,
1362 OutboundQueueInterruptDelay[i] = (
bit16)
osti_strtoul (buffer, &pLastUsedChar, 0);
1366 OutboundQueueInterruptDelay[i] = (
bit16)
osti_strtoul (buffer, &pLastUsedChar, 10);
1367 TI_DBG6((
"tdsaLoLevelGetResource: queue number %d interrupt delay %d\n", i, OutboundQueueInterruptDelay[i]));
1388 OBQueueInterruptCount,
1396 OutboundQueueInterruptCount[i] = (
bit16)
osti_strtoul (buffer, &pLastUsedChar, 0);
1400 OutboundQueueInterruptCount[i] = (
bit16)
osti_strtoul (buffer, &pLastUsedChar, 10);
1401 TI_DBG6((
"tdsaLoLevelGetResource: queue number %d interrupt count %d\n", i, OutboundQueueInterruptCount[i]));
1422 OBQueueInterruptEnable,
1430 OutboundQueueInterruptEnable[i] = (
bit16)
osti_strtoul (buffer, &pLastUsedChar, 0);
1431#ifdef SPC_POLLINGMODE
1432 OutboundQueueInterruptEnable[i] = 0;
1438 OutboundQueueInterruptEnable[i] = (
bit16)
osti_strtoul (buffer, &pLastUsedChar, 10);
1439#ifdef SPC_POLLINGMODE
1440 OutboundQueueInterruptEnable[i] = 0;
1443 TI_DBG2((
"tdsaLoLevelGetResource: queue number %d interrupt enable %d\n", i, OutboundQueueInterruptEnable[i]));
1464 osti_sprintf(IBQueueEleSize,
"IBQueueElementSize%d", i);
1494 TI_DBG6((
"tdsaLoLevelGetResource: queue number %d IB queue size %d\n", i, InboundQueueSize[i]));
1526 TI_DBG6((
"tdsaLoLevelGetResource: queue number %d IB queue size %d\n", i, InboundQueueEleSize[i]));
1557 TI_DBG6((
"tdsaLoLevelGetResource: card number %d queue number %d priority %d\n", cardID, i, InboundQueuePriority[i]));
1575 osti_sprintf(OBQueueEleSize,
"OBQueueElementSize%d", i);
1576 osti_sprintf(OBQueueInterruptDelay,
"OBQueueInterruptDelay%d", i);
1577 osti_sprintf(OBQueueInterruptCount,
"OBQueueInterruptCount%d", i);
1578 osti_sprintf(OBQueueInterruptEnable,
"OBQueueInterruptEnable%d", i);
1607 TI_DBG6((
"tdsaLoLevelGetResource: queue number %d OB queue size %d\n", i, OutboundQueueSize[i]));
1639 TI_DBG6((
"tdsaLoLevelGetResource: queue number %d OB queue ele size %d\n", i, OutboundQueueEleSize[i]));
1657 OBQueueInterruptDelay,
1665 OutboundQueueInterruptDelay[i] = (
bit16)
osti_strtoul (buffer, &pLastUsedChar, 0);
1669 OutboundQueueInterruptDelay[i] = (
bit16)
osti_strtoul (buffer, &pLastUsedChar, 10);
1670 TI_DBG6((
"tdsaLoLevelGetResource: card number %d queue number %d interrupt delay %d\n", cardID, i, OutboundQueueInterruptDelay[i]));
1688 OBQueueInterruptCount,
1696 OutboundQueueInterruptCount[i] = (
bit16)
osti_strtoul (buffer, &pLastUsedChar, 0);
1700 OutboundQueueInterruptCount[i] = (
bit16)
osti_strtoul (buffer, &pLastUsedChar, 10);
1701 TI_DBG6((
"tdsaLoLevelGetResource: card number %d queue number %d interrupt count %d\n", cardID, i, OutboundQueueInterruptCount[i]));
1719 OBQueueInterruptEnable,
1727 OutboundQueueInterruptEnable[i] = (
bit16)
osti_strtoul (buffer, &pLastUsedChar, 0);
1728#ifdef SPC_POLLINGMODE
1729 OutboundQueueInterruptEnable[i] = 0;
1735 OutboundQueueInterruptEnable[i] = (
bit16)
osti_strtoul (buffer, &pLastUsedChar, 10);
1736#ifdef SPC_POLLINGMODE
1737 OutboundQueueInterruptEnable[i] = 0;
1740 TI_DBG2((
"tdsaLoLevelGetResource: card number %d queue number %d interrupt count %d\n", cardID, i, OutboundQueueInterruptEnable[i]));
1751 TI_DBG6((
"tdsaLoLevelGetResource: \n"));
1979#ifdef SA_ENABLE_TRACE_FUNCTIONS
1981 TI_DBG2((
"tdsaLoLevelGetResource: SA_ENABLE_TRACE_FUNCTIONS\n"));
1991 SwConfig.TraceBufferSize = 0;
2008 SwConfig.TraceBufferSize =
osti_strtoul (buffer, &pLastUsedChar, 0);
2012 SwConfig.TraceBufferSize =
osti_strtoul (buffer, &pLastUsedChar, 10);
2014 TI_DBG2((
"tdsaLoLevelGetResource: SwConfig.TraceBufferSize %d\n",SwConfig.TraceBufferSize));
2080#if defined (FDS_DM) && defined (FDS_SM)
2097 TI_DBG1((
"tdsaLoLevelGetResource:memRequirement.count %d\n", memRequirement.
count));
2099 for (i=0;i< memRequirement.
count;i++)
2110 TI_DBG6((
"tdsaLoLevelGetResource: index %d TI_DMA_MEM\n", i));
2116 TI_DBG6((
"tdsaLoLevelGetResource: index %d TI_CACHED_MEM\n", i));
2121 TI_DBG6((
"tdsaLoLevelGetResource: index %d TI_CACHED_DMA_MEM\n", i));
2126 TI_DBG1((
"tdsaLoLevelGetResource:dmMemRequirement.count %d\n", dmMemRequirement.
count));
2128 for (i=memRequirement.
count;i< (memRequirement.
count + dmMemRequirement.
count);i++)
2139 TI_DBG6((
"tdsaLoLevelGetResource: index %d TI_DMA_MEM\n", i));
2145 TI_DBG6((
"tdsaLoLevelGetResource: index %d TI_CACHED_MEM\n", i));
2150 TI_DBG6((
"tdsaLoLevelGetResource: index %d TI_CACHED_DMA_MEM\n", i));
2155 TI_DBG1((
"tdsaLoLevelGetResource:smMemRequirement.count %d\n", smMemRequirement.
count));
2157 for (i=(memRequirement.
count + dmMemRequirement.
count);i< (memRequirement.
count + dmMemRequirement.
count + smMemRequirement.
count);i++)
2168 TI_DBG6((
"tdsaLoLevelGetResource: index %d TI_DMA_MEM\n", i));
2174 TI_DBG6((
"tdsaLoLevelGetResource: index %d TI_CACHED_MEM\n", i));
2179 TI_DBG6((
"tdsaLoLevelGetResource: index %d TI_CACHED_DMA_MEM\n", i));
2198 TI_DBG6((
"tdsaLoLevelGetResource: total memRequirement count %d TI_DMA_MEM\n", loResource->
loLevelMem.
count));
2200#elif defined(FDS_DM)
2216 TI_DBG1((
"tdsaLoLevelGetResource:memRequirement.count %d\n", memRequirement.
count));
2218 for (i=0;i< memRequirement.
count;i++)
2229 TI_DBG6((
"tdsaLoLevelGetResource: index %d TI_DMA_MEM\n", i));
2235 TI_DBG6((
"tdsaLoLevelGetResource: index %d TI_CACHED_MEM\n", i));
2240 TI_DBG6((
"tdsaLoLevelGetResource: index %d TI_CACHED_DMA_MEM\n", i));
2244 TI_DBG1((
"tdsaLoLevelGetResource:dmMemRequirement.count %d\n", dmMemRequirement.
count));
2246 for (i=memRequirement.
count;i< (memRequirement.
count + dmMemRequirement.
count);i++)
2257 TI_DBG6((
"tdsaLoLevelGetResource: index %d TI_DMA_MEM\n", i));
2263 TI_DBG6((
"tdsaLoLevelGetResource: index %d TI_CACHED_MEM\n", i));
2268 TI_DBG6((
"tdsaLoLevelGetResource: index %d TI_CACHED_DMA_MEM\n", i));
2289 TI_DBG6((
"tdsaLoLevelGetResource: total memRequirement count %d TI_DMA_MEM\n", loResource->
loLevelMem.
count));
2291#elif defined(FDS_SM)
2307 TI_DBG1((
"tdsaLoLevelGetResource:memRequirement.count %d\n", memRequirement.
count));
2309 for (i=0;i< memRequirement.
count;i++)
2320 TI_DBG6((
"tdsaLoLevelGetResource: index %d TI_DMA_MEM\n", i));
2326 TI_DBG6((
"tdsaLoLevelGetResource: index %d TI_CACHED_MEM\n", i));
2331 TI_DBG6((
"tdsaLoLevelGetResource: index %d TI_CACHED_DMA_MEM\n", i));
2335 TI_DBG1((
"tdsaLoLevelGetResource:smMemRequirement.count %d\n", smMemRequirement.
count));
2337 for (i=memRequirement.
count;i< (memRequirement.
count + smMemRequirement.
count);i++)
2348 TI_DBG6((
"tdsaLoLevelGetResource: index %d TI_DMA_MEM\n", i));
2354 TI_DBG6((
"tdsaLoLevelGetResource: index %d TI_CACHED_MEM\n", i));
2359 TI_DBG6((
"tdsaLoLevelGetResource: index %d TI_CACHED_DMA_MEM\n", i));
2380 TI_DBG6((
"tdsaLoLevelGetResource: total memRequirement count %d TI_DMA_MEM\n", loResource->
loLevelMem.
count));
2400 for (i=0;i< memRequirement.
count;i++)
2411 TI_DBG6((
"tdsaLoLevelGetResource: index %d TI_DMA_MEM\n", i));
2417 TI_DBG6((
"tdsaLoLevelGetResource: index %d TI_CACHED_MEM\n", i));
2422 TI_DBG6((
"tdsaLoLevelGetResource: index %d TI_CACHED_DMA_MEM\n", i));
2443 TI_DBG6((
"tdsaLoLevelGetResource: memRequirement.count %d TI_DMA_MEM\n", memRequirement.
count));
2482 TI_DBG6((
"tdsaSharedMemCalculate: MaxTargets %d\n", MaxTargets));
2491#ifdef TD_INT_COALESCE
2542#ifdef TD_DEBUG_ENABLE
2544 TI_DBG6((
"tdsaResetComMemFlags: start\n"));
2545 TI_DBG6((
"tdsaResetComMemFlag:: ******* tdsaRoot %p \n", tdsaRoot));
2546 TI_DBG6((
"tdsaResetComMemFlag:: ******* tdsaPortContext %p \n",tdsaPortContext));
2549 tdsaAllShared->flags.sysIntsActive =
agFALSE;
2550 tdsaAllShared->flags.resetInProgress =
agFALSE;
2574#ifdef TD_DEBUG_ENABLE
2576 TI_DBG6((
"tdssInitSASPortStartInfo: start\n"));
2578 TI_DBG6((
"tdssInitSASPortStartInfo: ******* tdsaRoot %p \n", tdsaRoot));
2579 TI_DBG6((
"tdssInitSASPortStartInfo: ******* tdsaPortContext %p \n",tdsaPortContext));
2584 tdsaAllShared->Ports[i].tiPortalContext =
agNULL;
2585 tdsaAllShared->Ports[i].portContext =
agNULL;
2586 tdsaAllShared->Ports[i].SASID.sasAddressHi[0] = 0;
2587 tdsaAllShared->Ports[i].SASID.sasAddressHi[1] = 0;
2588 tdsaAllShared->Ports[i].SASID.sasAddressHi[2] = 0;
2589 tdsaAllShared->Ports[i].SASID.sasAddressHi[3] = 0;
2590 tdsaAllShared->Ports[i].SASID.sasAddressLo[0] = 0;
2591 tdsaAllShared->Ports[i].SASID.sasAddressLo[1] = 0;
2592 tdsaAllShared->Ports[i].SASID.sasAddressLo[2] = 0;
2593 tdsaAllShared->Ports[i].SASID.sasAddressLo[3] = 0;
2594 tdsaAllShared->Ports[i].SASID.phyIdentifier = (
bit8) i;
2597 tdsaAllShared->Ports[i].flags.portStarted =
agFALSE;
2598 tdsaAllShared->Ports[i].flags.portInitialized =
agFALSE;
2599 tdsaAllShared->Ports[i].flags.portReadyForDiscoverySent =
agFALSE;
2600 tdsaAllShared->Ports[i].flags.portStoppedByOSLayer =
agFALSE;
2601 tdsaAllShared->Ports[i].flags.failPortInit =
agFALSE;
2629#ifdef TD_DEBUG_ENABLE
2632 TI_DBG6((
"tdsaInitTimers: start \n"));
2633 TI_DBG6((
"tdsaInitTimers: ******* tdsaRoot %p \n", tdsaRoot));
2634 TI_DBG6((
"tdsaInitTimers: ******* tdsaPortContext %p \n",tdsaPortContext));
2664#ifdef TD_DEBUG_ENABLE
2667 TI_DBG6((
"tdsaJumpTableInit: start \n"));
2668 TI_DBG6((
"tdsaJumpTableInit:: ******* tdsaRoot %p \n", tdsaRoot));
2669 TI_DBG6((
"tdsaJumpTableInit:: ******* tdsaPortContext %p \n",tdsaPortContext));
2679#ifdef INITIATOR_DRIVER
2680 tdsaAllShared->tdJumpTable.pSSPIOCompleted =
agNULL;
2681 tdsaAllShared->tdJumpTable.pSMPCompleted =
agNULL;
2684 tdsaAllShared->tdJumpTable.pSSPIOCompleted =
agNULL;
2687 tdsaAllShared->tdJumpTable.pSMPCompleted =
agNULL;
2689 tdsaAllShared->tdJumpTable.pGetSGLChunk =
agNULL;
2718 TI_DBG6((
"tdsaPortContextInit: start\n"));
2720 TI_DBG6((
"tdsaPortContextInit: ******* tdsaRoot %p \n", tdsaRoot));
2721 TI_DBG6((
"tdsaPortContextInit: ******* tdsaPortContext %p \n",tdsaPortContext));
2722 TI_DBG6((
"tdsaPortContextInit: ******* tdsaPortContext+1 %p \n",tdsaPortContext + 1));
2723 TI_DBG6((
"tdsaPortContextInit: ******* &tdsaPortContext[0] %p &tdsaPortContext[1] %p\n", &(tdsaPortContext[0]), &(tdsaPortContext[1])));
2734 TDLIST_INIT_HDR(&(tdsaPortContext[i].discovery.discoveringExpanderList));
2735 TDLIST_INIT_HDR(&(tdsaPortContext[i].discovery.UpdiscoveringExpanderList));
2736 tdsaPortContext[i].
discovery.
type = TDSA_DISCOVERY_OPTION_FULL_START;
2755#ifdef INITIATOR_DRIVER
2763 tdsaPortContext[i].
id = i;
2766 tdsaPortContext[i].
Count = 0;
2778 tdsaPortContext[i].dmPortContext.tdData = &(tdsaPortContext[i]);
2780 tdsaPortContext[i].UseDM =
agFALSE;
2781 tdsaPortContext[i].UpdateMCN =
agFALSE;
2787#ifdef TD_INTERNAL_DEBUG
2790 TI_DBG6((
"tdsaPortContextInit: index %d &tdsaPortContext[] %p\n", i, &(tdsaPortContext[i])));
2821 TI_DBG3((
"tdsaPortContextReInit: start\n"));
2824 discovery = &(onePortContext->
discovery);
2826 onePortContext->
discovery.
type = TDSA_DISCOVERY_OPTION_FULL_START;
2836 tdsaFreeAllExp(
tiRoot, onePortContext);
2882#ifdef INITIATOR_DRIVER
2894 onePortContext->
Count = 0;
2907 onePortContext->dmPortContext.tdData = onePortContext;
2909 onePortContext->UseDM =
agFALSE;
2910 onePortContext->UpdateMCN =
agFALSE;
2934#ifdef TD_DEBUG_ENABLE
2946 TI_DBG6((
"tdsaDeviceDataInit: start\n"));
2947 TI_DBG6((
"tdsaDeviceDataInit: ******* tdsaPortContext %p \n",tdsaPortContext));
2948 TI_DBG6((
"tdsaDeviceDataInit: ******* tdsaDeviceData %p\n", tdsaDeviceData));
2949 TI_DBG6((
"tdsaDeviceDataInit: ******* tdsaDeviceData+1 %p\n", tdsaDeviceData+1));
2950 TI_DBG6((
"tdsaDeviceDataInit: ******* &tdsaDeviceData[0] %p &tdsaDeviceData[1] %p\n", &(tdsaDeviceData[0]), &(tdsaDeviceData[1])));
2954 TI_DBG6((
"tdsaDeviceDataInit: MaxTargets %d\n", MaxTargets));
2959 for(i=0;i<(int)MaxTargets;i++)
2964 tdsaDeviceData[i].id = i;
2965 tdsaDeviceData[i].InQID = 0;
2966 tdsaDeviceData[i].OutQID = 0;
2968 tdsaDeviceData[i].agRoot =
agNULL;
2969 tdsaDeviceData[i].agDevHandle =
agNULL;
2971 tdsaDeviceData[i].pJumpTable = &(tdsaAllShared->tdJumpTable);
2972 tdsaDeviceData[i].tiDeviceHandle.osData =
agNULL;
2973 tdsaDeviceData[i].tiDeviceHandle.tdData = &(tdsaDeviceData[i]);
2974 tdsaDeviceData[i].tdPortContext =
agNULL;
2975 tdsaDeviceData[i].tdExpander =
agNULL;
2976 tdsaDeviceData[i].ExpDevice =
agNULL;
2977 tdsaDeviceData[i].phyID = 0xFF;
2978 tdsaDeviceData[i].SASAddressID.sasAddressHi = 0;
2979 tdsaDeviceData[i].SASAddressID.sasAddressLo = 0;
2980 tdsaDeviceData[i].valid =
agFALSE;
2981 tdsaDeviceData[i].valid2 =
agFALSE;
2982 tdsaDeviceData[i].processed =
agFALSE;
2983 tdsaDeviceData[i].initiator_ssp_stp_smp = 0;
2984 tdsaDeviceData[i].target_ssp_stp_smp = 0;
2985 tdsaDeviceData[i].numOfPhys = 0;
2986 tdsaDeviceData[i].registered =
agFALSE;
2987 tdsaDeviceData[i].directlyAttached =
agFALSE;
2988 tdsaDeviceData[i].SASSpecDeviceType = 0xFF;
2989 tdsaDeviceData[i].IOStart = 0;
2990 tdsaDeviceData[i].IOResponse = 0;
2991 tdsaDeviceData[i].agDeviceResetContext.osData =
agNULL;
2992 tdsaDeviceData[i].agDeviceResetContext.sdkData =
agNULL;
2993 tdsaDeviceData[i].TRflag =
agFALSE;
2994 tdsaDeviceData[i].ResetCnt = 0;
2995 tdsaDeviceData[i].OSAbortAll =
agFALSE;
2998 tdsaDeviceData[i].devMCN = 1;
2999 tdsaDeviceData[i].finalMCN = 1;
3003 tdsaDeviceData[i].SMNumOfFCA = 0;
3004 tdsaDeviceData[i].SMNumOfID = 0;
3009 TDLIST_INIT_HDR(&(tdsaDeviceData[i].satDevData.satFreeIntIoLinkList));
3010 TDLIST_INIT_HDR(&(tdsaDeviceData[i].satDevData.satActiveIntIoLinkList));
3014 tdsaDeviceData[i].satDevData.satNCQMaxIO =
SAT_NCQ_MAX;
3015 tdsaDeviceData[i].satDevData.satPendingIO = 0;
3016 tdsaDeviceData[i].satDevData.satPendingNCQIO = 0;
3017 tdsaDeviceData[i].satDevData.satPendingNONNCQIO = 0;
3018 tdsaDeviceData[i].satDevData.IDDeviceValid =
agFALSE;
3019 tdsaDeviceData[i].satDevData.freeSATAFDMATagBitmap = 0;
3020 tdsaDeviceData[i].satDevData.NumOfFCA = 0;
3021 tdsaDeviceData[i].satDevData.NumOfIDRetries = 0;
3022 tdsaDeviceData[i].satDevData.ID_Retries = 0;
3023 tdsaDeviceData[i].satDevData.IDPending =
agFALSE;
3028 osti_memset(tdsaDeviceData[i].satDevData.satMaxLBA, 0,
sizeof(tdsaDeviceData[i].satDevData.satMaxLBA));
3030 tdsaDeviceData[i].satDevData.satSaDeviceData = &tdsaDeviceData[i];
3031 satIntIO = &tdsaDeviceData[i].satDevData.satIntIo[0];
3036 &tdsaDeviceData[i].satDevData.satFreeIntIoLinkList);
3039 satIntIO = satIntIO + 1;
3046#ifdef TD_INTERNAL_DEBUG
3047 for(i=0;i<MaxTargets;i++)
3049 TI_DBG6((
"tdsaDeviceDataInit: index %d &tdsaDeviceData[] %p\n", i, &(tdsaDeviceData[i])));
3083 TI_DBG3((
"tdsaDeviceDataReInit: start\n"));
3085 oneDeviceData->
InQID = 0;
3086 oneDeviceData->
OutQID = 0;
3090 oneDeviceData->
pJumpTable = &(tdsaAllShared->tdJumpTable);
3096 oneDeviceData->
phyID = 0xFF;
3117 oneDeviceData->devMCN = 1;
3118 oneDeviceData->finalMCN = 1;
3122 oneDeviceData->SMNumOfFCA = 0;
3123 oneDeviceData->SMNumOfID = 0;
3124 if (oneDeviceData->tdIDTimer.timerRunning ==
agTRUE)
3128 &oneDeviceData->tdIDTimer
3155 TI_DBG3((
"tdsaDeviceDataReInit: in loop of internal io free, id %d\n", satIntIO->
id));
3157 satIntIO = satIntIO + 1;
3163#ifdef TD_INT_COALESCE
3185 tdsaIntCoalesceContext_t *tdsaIntCoalCxt = (tdsaIntCoalesceContext_t *)tdsaAllShared->IntCoalesce;
3190 TI_DBG2((
"tdsaIntCoalCxtInit: start\n"));
3193 TI_DBG6((
"tdsaIntCoalCxtInit: ******* sizeof(tdsaIntCoalCxt) %d 0x%x\n",
sizeof(tdsaIntCoalesceContext_t),
sizeof(tdsaIntCoalesceContext_t)));
3194 TI_DBG6((
"tdsaIntCoalCxtInit: ******* tdsaRoot %p \n", tdsaRoot));
3195 TI_DBG6((
"tdsaIntCoalCxtInit: ******* tdsaPortContext %p \n",tdsaPortContext));
3196 TI_DBG6((
"tdsaDeviceDataInit: ******* tdsaDeviceData %p\n", tdsaDeviceData));
3197 TI_DBG6((
"tdsaIntCoalCxtInit: ******* tdsaIntCoalCxt+1 %p \n", tdsaIntCoalCxt + 1));
3198 TI_DBG6((
"tdsaIntCoalCxtInit: ******* &tdsaIntCoalCxt[0] %p &tdsaIntCoalCxt[1] %p\n", &(tdsaIntCoalCxt[0]), &(tdsaIntCoalCxt[1])));
3204 TI_DBG6((
"tdsaIntCoalCxtInit: MaxTargets %d\n", MaxTargets));
3215 tdsaIntCoalCxt[0].tdsaAllShared = tdsaAllShared;
3216 tdsaIntCoalCxt[0].tiIntCoalesceCxt =
agNULL;
3217 tdsaIntCoalCxt[0].id = 0;
3225 tdsaIntCoalCxt[i].tdsaAllShared = tdsaAllShared;
3226 tdsaIntCoalCxt[i].tiIntCoalesceCxt =
agNULL;
3227 tdsaIntCoalCxt[i].id = i;
3252 TI_DBG6((
"tdsaExpanderInit: start\n"));
3254 TI_DBG6((
"tdsaExpanderInit: MaxTargets %d\n", MaxTargets));
3259 for(i=0;i<(int)MaxTargets;i++)
3275 tdsaExpander[i].
id = i;
3278 osti_memset( &(tdsaExpander[i].currentIndex), 0,
sizeof(tdsaExpander[i].currentIndex));
3279 osti_memset( &(tdsaExpander[i].upStreamPhys), 0,
sizeof(tdsaExpander[i].upStreamPhys));
3280 osti_memset( &(tdsaExpander[i].downStreamPhys), 0,
sizeof(tdsaExpander[i].downStreamPhys));
3281 osti_memset( &(tdsaExpander[i].routingAttribute), 0,
sizeof(tdsaExpander[i].routingAttribute));
3283 osti_memset( &(tdsaExpander[i].configSASAddressHiTable), 0,
sizeof(tdsaExpander[i].configSASAddressHiTable));
3284 osti_memset( &(tdsaExpander[i].configSASAddressLoTable), 0,
sizeof(tdsaExpander[i].configSASAddressLoTable));
3304 TI_DBG2((
"tdsaQueueConfigInit: start\n"));
3306 QueueConfig = &tdsaAllShared->QueueConfig;
3374 char *pLastUsedChar =
agNULL;
3376 char globalStr[] =
"Global";
3377 char iniParmsStr[] =
"InitiatorParms";
3380 TI_DBG6((
"tdssGetMaxTargetsParams: start\n"));
3385 pLastUsedChar = pLastUsedChar;
3390 buffer = &tmpBuffer[0];
3391 buffLen =
sizeof (tmpBuffer);
3417 MaxTargets =
osti_strtoul (buffer, &pLastUsedChar, 10);
3419 *pMaxTargets = MaxTargets;
3420 TI_DBG2((
"tdssGetMaxTargetsParams: MaxTargets %d\n", MaxTargets ));
3433 bit32 *pSATAOnlyMode
3442 char *pLastUsedChar =
agNULL;
3444 char globalStr[] =
"Global";
3445 char iniParmsStr[] =
"InitiatorParms";
3448 TI_DBG6((
"tdssGetSATAOnlyModeParams: start\n"));
3453 pLastUsedChar = pLastUsedChar;
3458 buffer = &tmpBuffer[0];
3459 buffLen =
sizeof (tmpBuffer);
3481 SATAOnlyMode =
osti_strtoul (buffer, &pLastUsedChar, 0);
3485 SATAOnlyMode =
osti_strtoul (buffer, &pLastUsedChar, 10);
3487 *pSATAOnlyMode = SATAOnlyMode;
osGLOBAL void dmGetRequirements(dmRoot_t *dmRoot, dmSwConfig_t *swConfig, dmMemoryRequirement_t *memoryRequirement, bit32 *usecsPerTick, bit32 *maxNumLocks)
#define MIN(a, b)
MIN macro.
#define DEFAULT_SMP_TIMEOUT
#define DEFAULT_KEY_BUFFER_SIZE
#define ITD_DSTATE_NOT_STARTED
osGLOBAL void itdssGetResource(tiRoot_t *tiRoot, tiInitiatorResource_t *initiatorResource)
osGLOBAL bit32 itdssInit(tiRoot_t *tiRoot, tiInitiatorResource_t *initiatorResource, tiTdSharedMem_t *tdSharedMem)
U32 ostiGetTransportParam(tiRoot_t *ptiRoot, S08 *key, S08 *subkey1, S08 *subkey2, S08 *subkey3, S08 *subkey4, S08 *subkey5, S08 *valueName, S08 *buffer, U32 bufferLen, U32 *lenReceived)
#define OS_ASSERT(expr, message)
#define osti_strncmp(s1, s2, n)
#define osti_strtoul(nptr, endptr, base)
#define osti_strcpy(des, src)
#define osti_memset(s, c, n)
The file defines the constants, data structure, and functions defined by LL API.
#define AGSA_CACHED_DMA_MEM
#define AGSA_MAX_OUTBOUND_Q
#define AGSA_MAX_INBOUND_Q
The file defines the declaration of tSDK APIs.
GLOBAL void saGetRequirements(agsaRoot_t *agRoot, agsaSwConfig_t *swConfig, agsaMemoryRequirement_t *memoryRequirement, bit32 *usecsPerTick, bit32 *maxNumLocks)
Get the memory and lock requirement from LL layer.
The file defines the declaration of OS APIs.
osGLOBAL void smGetRequirements(smRoot_t *smRoot, smSwConfig_t *swConfig, smMemoryRequirement_t *memoryRequirement, bit32 *usecsPerTick, bit32 *maxNumLocks)
#define SAT_DEV_STATE_NORMAL
data structure stores OS specific and LL specific context
bit32 singleElementLength
dmMem_t dmMemory[DM_NUM_MEM_CHUNKS]
satInternalIo_t satIntIo[SAT_MAX_INT_IO]
agsaSATAIdentifyData_t satIdentifyData
bit32 freeSATAFDMATagBitmap
tiIORequest_t * satOrgTiIORequest
bit32 singleElementLength
smMem_t smMemory[SM_NUM_MEM_CHUNKS]
data structure for SAS SSP IO reuqest body This structure contains IO related fields....
data structure for SAS/SATA context at TD layer
bit8 CardIDString[TD_CARD_ID_LEN]
tdsaDeviceData_t * DeviceMem
struct tdsaRootOsData_s agRootOsDataForNonInt
tdsaExpander_t * ExpanderHead
tiLoLevelResource_t loResource
struct tdsaRootOsData_s agRootOsDataForInt
tdsaHwEventSource_t eventSource[TD_MAX_NUM_PHYS]
struct itdsaIni_s * itdsaIni
struct ttdsaTgt_s * ttdsaTgt
tdsaPortContext_t * PortContextMem
data structure for SAS device list This structure maintains the device as a list and information abou...
tiDeviceHandle_t tiDeviceHandle
agsaDevHandle_t * agDevHandle
bit8 initiator_ssp_stp_smp
struct tdsaExpander_s * tdExpander
struct tdsaPortContext_s * tdPortContext
agsaContext_t agDeviceResetContext
TDSASAddressID_t SASAddressID
satDeviceData_t satDevData
tdsaJumpTable_t * pJumpTable
struct tdsaDeviceData_s * ExpDevice
bit32 deviceRetistrationRetries
bit32 configureRouteRetries
tdsaTimerRequest_t SMPBusyTimer
tdsaTimerRequest_t BCTimer
tdsaTimerRequest_t deviceRegistrationTimer
tdsaTimerRequest_t DiscoverySMPTimer
tdsaTimerRequest_t discoveryTimer
tdsaTimerRequest_t configureRouteTimer
data structure for ESGL pool information
data structure for ESLG page
bit32 configSASAddrTableIndex
bit16 numOfDownStreamPhys
bit16 currentUpStreamPhyIndex
tdsaDeviceData_t * tdDeviceToProcess
bit16 currentDownStreamPhyIndex
struct tdsaExpander_s * tdReturnginExpander
struct tdsaExpander_s * tdCurrentDownStreamExpander
tdsaDeviceData_t * tdDevice
struct tdsaExpander_s * tdUpStreamExpander
data structure for TD port context This structure maintains information about the port such as ID add...
tdsaDiscovery_t discovery
bit8 PhyIDList[TD_MAX_NUM_PHYS]
agsaPortContext_t * agPortContext
tiPortalContext_t * tiPortalContext
the root data structure for TD layer
tdsaContext_t tdsaAllShared
tiInitiatorMem_t initiatorMem
tiMem_t mem[MAX_LL_LAYER_MEM_DESCRIPTORS]
bit32 maxInterruptVectors
bit32 max_MSI_InterruptVectors
tiLoLevelOption_t loLevelOption
tiLoLevelMem_t loLevelMem
bit32 singleElementLength
tiMem_t tdSharedCachedMem1
#define DEFAULT_INBOUND_QUEUE_PRIORITY
#define DEFAULT_OUTBOUND_QUEUE_INTERRUPT_DELAY
#define DEFAULT_OUTBOUND_INTERRUPT_ENABLE
#define DEFAULT_NUM_REG_CLIENTS
#define DEFAULT_MAX_ACTIVE_IOS
#define DEFAULT_OUTBOUND_QUEUE_SIZE
#define DEFAULT_EVENT_LOG_OPTION
#define TD_OPERATION_TARGET
#define TD_MAX_INT_COALESCE
#define TD_MAX_PORT_CONTEXT
#define DEFAULT_OUTBOUND_QUEUE_ELE_SIZE
#define DEFAULT_OUTBOUND_QUEUE_INTERRUPT_COUNT
#define HOST_EVENT_LOG_SIZE
#define DEFAULT_NUM_INBOUND_QUEUE
#define DEFAULT_NUM_OUTBOUND_QUEUE
#define DEFAULT_INBOUND_QUEUE_SIZE
#define TD_OPERATION_INITIATOR
#define DEFAULT_INBOUND_QUEUE_ELE_SIZE
bit32 tdCardIDList[TD_MAX_CARD_NUM]
bit32 tdsaGetCardIDString(tiRoot_t *tiRoot)
osGLOBAL void tdssGetMaxTargetsParams(tiRoot_t *tiRoot, bit32 *pMaxTargets)
osGLOBAL void tdsaQueueConfigInit(tiRoot_t *tiRoot)
osGLOBAL void tdssGetSATAOnlyModeParams(tiRoot_t *tiRoot, bit32 *pSATAOnlyMode)
osGLOBAL void tdsaLoLevelGetResource(tiRoot_t *tiRoot, tiLoLevelResource_t *loResource)
osGLOBAL void tdsaFreeCardID(tiRoot_t *tiRoot, bit32 CardID)
osGLOBAL bit32 tiCOMInit(tiRoot_t *tiRoot, tiLoLevelResource_t *loResource, tiInitiatorResource_t *initiatorResource, tiTargetResource_t *targetResource, tiTdSharedMem_t *tdSharedMem)
osGLOBAL void tdsaSharedMemCalculate(tiRoot_t *tiRoot, tiLoLevelResource_t *loResource, tiTdSharedMem_t *tdSharedMem)
osGLOBAL void tdsaPortContextReInit(tiRoot_t *tiRoot, tdsaPortContext_t *onePortContext)
LOCAL bit32 tdsaGetCardID(tiRoot_t *tiRoot)
osGLOBAL void tiCOMGetResource(tiRoot_t *tiRoot, tiLoLevelResource_t *loResource, tiInitiatorResource_t *initiatorResource, tiTargetResource_t *targetResource, tiTdSharedMem_t *tdSharedMem)
osGLOBAL void tdsaDeviceDataReInit(tiRoot_t *tiRoot, tdsaDeviceData_t *oneDeviceData)
osGLOBAL void tdssInitSASPortStartInfo(tiRoot_t *tiRoot)
osGLOBAL void tdsaDeviceDataInit(tiRoot_t *tiRoot)
osGLOBAL void tdsaResetComMemFlags(tiRoot_t *tiRoot)
osGLOBAL void tdsaPortContextInit(tiRoot_t *tiRoot)
osGLOBAL void tdsaJumpTableInit(tiRoot_t *tiRoot)
osGLOBAL void tdsaInitTimers(tiRoot_t *tiRoot)
osGLOBAL void tdsaExpanderInit(tiRoot_t *tiRoot)
#define TDLIST_OBJECT_BASE(baseType, fieldName, fieldPtr)
#define TDLIST_ENQUEUE_AT_TAIL(toAddHdr, listHdr)
#define TDLIST_INIT_ELEMENT(hdr)
#define TDLIST_DEQUEUE_FROM_HEAD(atHeadHdr, listHdr)
#define TDLIST_ENQUEUE_AT_HEAD(toAddHdr, listHdr)
#define TDLIST_INIT_HDR(hdr)
osGLOBAL void tdsaPrintSwConfig(agsaSwConfig_t *SwConfig)
osGLOBAL void tdsaGetSwConfigParams(tiRoot_t *tiRoot)
osGLOBAL void tdsaInitTimerRequest(tiRoot_t *tiRoot, tdsaTimerRequest_t *timerRequest)
osGLOBAL void tdsaKillTimer(tiRoot_t *tiRoot, tdsaTimerRequest_t *timerRequest)
struct tdsaRoot_s tdsaRoot_t
the root data structure for TD layer
#define TD_DEFAULT_DEVICE
struct tdsaDeviceData_s tdsaDeviceData_t
data structure for SAS device list This structure maintains the device as a list and information abou...
struct tdsaExpander_s tdsaExpander_t
void(* tdssIOCompleted_t)(agsaRoot_t *, agsaIORequest_t *, bit32, bit32, agsaFrameHandle_t, bit32)
struct tdsaPortContext_s tdsaPortContext_t
data structure for TD port context This structure maintains information about the port such as ID add...
#define MAX_LL_LAYER_MEM_DESCRIPTORS
#define TI_CACHED_DMA_MEM
osGLOBAL void ttdssGetResource(tiRoot_t *tiRoot, tiTargetResource_t *targetResource)
osGLOBAL bit32 ttdssInit(tiRoot_t *tiRoot, tiTargetResource_t *targetResource, tiTdSharedMem_t *tdSharedMem)
osGLOBAL void ttdsaSSPReqReceived(agsaRoot_t *agRoot, agsaDevHandle_t *agDevHandle, agsaFrameHandle_t agFrameHandle, bit32 agInitiatorTag, bit32 parameter, bit32 agFrameLen)
osGLOBAL void ttdsaSMPReqReceived(agsaRoot_t *agRoot, agsaDevHandle_t *agDevHandle, agsaSMPFrameHeader_t *agFrameHeader, agsaFrameHandle_t agFrameHandle, bit32 agFrameLength, bit32 phyId)
union data structure specifies a request