Lines Matching +full:dma +full:- +full:mem

2 *Copyright (c) 2014 PMC-Sierra, Inc.  All rights reserved. 
23 This program is part of PMC-Sierra initiator/target device driver.
25 PMC-Sierra storage network initiator hardware.
37 Busy wait for number of mili-seconds
39 U32 MiliSeconds (IN) Number of mili-seconds to delay
52 Allocate DMA memory which will be divided among proper pointers in
57 AGTIAPI_SUCCESS - success
58 AGTIAPI_FAIL - fail
62 struct agtiapi_softc *pmsc = thisCardInst->pCard; in agtiapi_typhAlloc()
65 if( bus_dma_tag_create( bus_get_dma_tag(pmsc->my_dev), // parent in agtiapi_typhAlloc()
72 pmsc->typhn, // maxsize (size) in agtiapi_typhAlloc()
74 pmsc->typhn, // maxsegsize in agtiapi_typhAlloc()
78 &pmsc->typh_dmat ) ) { in agtiapi_typhAlloc()
79 printf( "agtiapi_typhAlloc: Can't create no-cache mem tag\n" ); in agtiapi_typhAlloc()
83 if( bus_dmamem_alloc( pmsc->typh_dmat, in agtiapi_typhAlloc()
84 &pmsc->typh_mem, in agtiapi_typhAlloc()
86 &pmsc->typh_mapp ) ) { in agtiapi_typhAlloc()
87 printf( "agtiapi_typhAlloc: Cannot allocate cache mem %d\n", in agtiapi_typhAlloc()
88 pmsc->typhn ); in agtiapi_typhAlloc()
92 if ( bus_dmamap_load( pmsc->typh_dmat, in agtiapi_typhAlloc()
93 pmsc->typh_mapp, in agtiapi_typhAlloc()
94 pmsc->typh_mem, in agtiapi_typhAlloc()
95 pmsc->typhn, in agtiapi_typhAlloc()
97 &pmsc->typh_busaddr, in agtiapi_typhAlloc()
98 0 ) || !pmsc->typh_busaddr ) { in agtiapi_typhAlloc()
100 if( pmsc->typh_busaddr ) break; in agtiapi_typhAlloc()
104 if( ! pmsc->typh_busaddr ) { in agtiapi_typhAlloc()
105 printf( "agtiapi_typhAlloc: cache mem won't load %d\n", in agtiapi_typhAlloc()
106 pmsc->typhn ); in agtiapi_typhAlloc()
111 pmsc->typhIdx = 0; in agtiapi_typhAlloc()
112 pmsc->tyPhsIx = 0; in agtiapi_typhAlloc()
126 AGTIAPI_SUCCESS - success
127 AGTIAPI_FAIL - fail
132 struct agtiapi_softc *pmsc = thisCardInst->pCard; in agtiapi_InitResource()
133 device_t devx = thisCardInst->pPCIDev; in agtiapi_InitResource()
144 AGTIAPI_PRINTK( "agtiapi_InitResource: dma alloc MemSpan %p -- %p\n", in agtiapi_InitResource()
145 (void*) pmsc->typh_busaddr, in agtiapi_InitResource()
146 (void*) ( (U32_64)pmsc->typh_busaddr + pmsc->typhn ) ); in agtiapi_InitResource()
149 // bar 0 and 1 - logical BAR0 in agtiapi_InitResource()
150 // bar 2 and 3 - logical BAR1 in agtiapi_InitResource()
151 // bar4 - logical BAR2 in agtiapi_InitResource()
152 // bar5 - logical BAR3 in agtiapi_InitResource()
153 // Skiping the assignments for bar 1 and bar 3 (making bar 0, 2 64-bit): in agtiapi_InitResource()
159 thisCardInst->pciMemBaseRIDSpc[lBar] = PCIR_BAR(bar); in agtiapi_InitResource()
160 thisCardInst->pciMemBaseRscSpc[lBar] = in agtiapi_InitResource()
163 &(thisCardInst->pciMemBaseRIDSpc[lBar]), in agtiapi_InitResource()
166 thisCardInst->pciMemBaseRscSpc[lBar] ); in agtiapi_InitResource()
167 if ( thisCardInst->pciMemBaseRscSpc[lBar] != NULL ) { in agtiapi_InitResource()
168 thisCardInst->pciMemVirtAddrSpc[lBar] = in agtiapi_InitResource()
170 thisCardInst->pciMemBaseRscSpc[lBar] ); in agtiapi_InitResource()
171 thisCardInst->pciMemBaseSpc[lBar] = in agtiapi_InitResource()
173 thisCardInst->pciMemBaseRIDSpc[lBar]); in agtiapi_InitResource()
174 thisCardInst->pciMemSizeSpc[lBar] = in agtiapi_InitResource()
176 thisCardInst->pciMemBaseRIDSpc[lBar] ); in agtiapi_InitResource()
179 (long unsigned int)thisCardInst->pciMemVirtAddrSpc[lBar], in agtiapi_InitResource()
180 thisCardInst->pciMemSizeSpc[lBar] ); in agtiapi_InitResource()
183 thisCardInst->pciMemVirtAddrSpc[lBar] = 0; in agtiapi_InitResource()
184 thisCardInst->pciMemBaseSpc[lBar] = 0; in agtiapi_InitResource()
185 thisCardInst->pciMemSizeSpc[lBar] = 0; in agtiapi_InitResource()
189 thisCardInst->pciMemVirtAddr = thisCardInst->pciMemVirtAddrSpc[0]; in agtiapi_InitResource()
190 thisCardInst->pciMemSize = thisCardInst->pciMemSizeSpc[0]; in agtiapi_InitResource()
191 thisCardInst->pciMemBase = thisCardInst->pciMemBaseSpc[0]; in agtiapi_InitResource()
197 pRscInfo = &thisCardInst->tiRscInfo; in agtiapi_InitResource()
198 pRscInfo->tiLoLevelResource.loLevelOption.pciFunctionNumber = in agtiapi_InitResource()
208 if (pRscInfo->tiLoLevelResource.loLevelMem.count != 0) { in agtiapi_InitResource()
210 // pRscInfo->tiLoLevelResource.loLevelMem.count); in agtiapi_InitResource()
213 pRscInfo->tiLoLevelResource.loLevelOption.usecsPerTick = uSecPerTick; in agtiapi_InitResource()
215 "pRscInfo->tiLoLevelResource.loLevelOption.usecsPerTick" in agtiapi_InitResource()
217 pRscInfo->tiLoLevelResource.loLevelOption.usecsPerTick ); in agtiapi_InitResource()
218 for( numVal = 0; numVal < pRscInfo->tiLoLevelResource.loLevelMem.count; in agtiapi_InitResource()
220 if( pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].totalLength == in agtiapi_InitResource()
227 if ( pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].alignment < in agtiapi_InitResource()
230 pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].alignment = in agtiapi_InitResource()
233 if( ((pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].type in agtiapi_InitResource()
235 ((pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].type in agtiapi_InitResource()
237 if ( thisCardInst->dmaIndex >= in agtiapi_InitResource()
238 sizeof(thisCardInst->tiDmaMem) / in agtiapi_InitResource()
239 sizeof(thisCardInst->tiDmaMem[0]) ) { in agtiapi_InitResource()
241 thisCardInst->dmaIndex ); in agtiapi_InitResource()
244 thisCardInst->tiDmaMem[thisCardInst->dmaIndex].type = in agtiapi_InitResource()
246 pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].type in agtiapi_InitResource()
252 &thisCardInst->tiDmaMem[thisCardInst->dmaIndex].dmaVirtAddr, in agtiapi_InitResource()
253 &thisCardInst->tiDmaMem[thisCardInst->dmaIndex].dmaPhysAddr, in agtiapi_InitResource()
254 &pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].virtPtr, in agtiapi_InitResource()
255 &pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal]. in agtiapi_InitResource()
257 &pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal]. in agtiapi_InitResource()
259 pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].totalLength, in agtiapi_InitResource()
260 thisCardInst->tiDmaMem[thisCardInst->dmaIndex].type, in agtiapi_InitResource()
261 pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].alignment) in agtiapi_InitResource()
265 thisCardInst->tiDmaMem[thisCardInst->dmaIndex].memSize = in agtiapi_InitResource()
266 pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].totalLength; in agtiapi_InitResource()
267 //AGTIAPI_INIT("agtiapi_InitResource: LoMem %d dmaIndex=%d DMA virt" in agtiapi_InitResource()
269 // numVal, pCardInfo->dmaIndex, in agtiapi_InitResource()
270 // pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].virtPtr, in agtiapi_InitResource()
271 // pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].physAddrLower, in agtiapi_InitResource()
272 // pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].totalLength, in agtiapi_InitResource()
273 // pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].alignment); in agtiapi_InitResource()
274 thisCardInst->dmaIndex++; in agtiapi_InitResource()
276 else if ( (pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].type & in agtiapi_InitResource()
278 if (thisCardInst->cacheIndex >= in agtiapi_InitResource()
279 sizeof(thisCardInst->tiCachedMem) / in agtiapi_InitResource()
280 sizeof(thisCardInst->tiCachedMem[0])) { in agtiapi_InitResource()
282 thisCardInst->cacheIndex ); in agtiapi_InitResource()
286 &thisCardInst->tiCachedMem[thisCardInst->cacheIndex], in agtiapi_InitResource()
288 &pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].virtPtr, in agtiapi_InitResource()
291 pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].totalLength, in agtiapi_InitResource()
293 pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].alignment) in agtiapi_InitResource()
300 // numVal, pCardInfo->cacheIndex, in agtiapi_InitResource()
301 // pCardInfo->tiCachedMem[pCardInfo->cacheIndex], in agtiapi_InitResource()
302 // pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].virtPtr, in agtiapi_InitResource()
303 // pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].totalLength, in agtiapi_InitResource()
304 // pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].alignment); in agtiapi_InitResource()
306 thisCardInst->cacheIndex++; in agtiapi_InitResource()
308 else if ( ((pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].type in agtiapi_InitResource()
316 pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].type); in agtiapi_InitResource()
324 if ( pmsc->flags & AGTIAPI_INITIATOR ) { in agtiapi_InitResource()
325 if ( pRscInfo->tiInitiatorResource.initiatorMem.count != 0 ) { in agtiapi_InitResource()
327 // pRscInfo->tiInitiatorResource.initiatorMem.count); in agtiapi_InitResource()
329 (U32)( pRscInfo->tiInitiatorResource.initiatorOption.usecsPerTick in agtiapi_InitResource()
331 if( pRscInfo->tiInitiatorResource.initiatorOption.usecsPerTick in agtiapi_InitResource()
333 pRscInfo->tiInitiatorResource.initiatorOption.usecsPerTick = in agtiapi_InitResource()
336 pRscInfo->tiInitiatorResource.initiatorOption.usecsPerTick = in agtiapi_InitResource()
339 numVal < pRscInfo->tiInitiatorResource.initiatorMem.count; in agtiapi_InitResource()
342 if( pRscInfo->tiInitiatorResource.initiatorMem.tdCachedMem[numVal]. in agtiapi_InitResource()
344 pRscInfo->tiInitiatorResource.initiatorMem.tdCachedMem[numVal]. in agtiapi_InitResource()
347 if( thisCardInst->cacheIndex >= in agtiapi_InitResource()
348 sizeof( thisCardInst->tiCachedMem) / in agtiapi_InitResource()
349 sizeof( thisCardInst->tiCachedMem[0])) { in agtiapi_InitResource()
351 thisCardInst->cacheIndex ); in agtiapi_InitResource()
356 (void *)&thisCardInst->tiCachedMem[thisCardInst->cacheIndex], in agtiapi_InitResource()
358 &pRscInfo->tiInitiatorResource.initiatorMem. in agtiapi_InitResource()
362 pRscInfo->tiInitiatorResource.initiatorMem.tdCachedMem[numVal]. in agtiapi_InitResource()
365 pRscInfo->tiInitiatorResource.initiatorMem.tdCachedMem[numVal]. in agtiapi_InitResource()
373 // pCardInfo->cacheIndex, in agtiapi_InitResource()
374 // pCardInfo->tiCachedMem[pCardInfo->cacheIndex], in agtiapi_InitResource()
375 // pRscInfo->tiInitiatorResource.initiatorMem.tdCachedMem[numVal]. in agtiapi_InitResource()
377 //pRscInfo->tiInitiatorResource.initiatorMem.tdCachedMem[numVal]. in agtiapi_InitResource()
379 // pRscInfo->tiInitiatorResource.initiatorMem.tdCachedMem[numVal]. in agtiapi_InitResource()
381 thisCardInst->cacheIndex++; in agtiapi_InitResource()
388 if (pRscInfo->tiSharedMem.tdSharedCachedMem1.totalLength != 0) { in agtiapi_InitResource()
390 if( pRscInfo->tiSharedMem.tdSharedCachedMem1.alignment < in agtiapi_InitResource()
392 pRscInfo->tiSharedMem.tdSharedCachedMem1.alignment = AGTIAPI_64BIT_ALIGN; in agtiapi_InitResource()
394 if( (pRscInfo->tiSharedMem.tdSharedCachedMem1.type & (BIT(0) | BIT(1))) in agtiapi_InitResource()
396 if( thisCardInst->dmaIndex >= in agtiapi_InitResource()
397 sizeof(thisCardInst->tiDmaMem) / sizeof(thisCardInst->tiDmaMem[0]) ) { in agtiapi_InitResource()
398 AGTIAPI_PRINTK( "Invalid dmaIndex %d ERROR\n", thisCardInst->dmaIndex); in agtiapi_InitResource()
401 if( agtiapi_MemAlloc( thisCardInst, (void *)&thisCardInst-> in agtiapi_InitResource()
402 tiDmaMem[thisCardInst->dmaIndex].dmaVirtAddr, in agtiapi_InitResource()
403 &thisCardInst->tiDmaMem[thisCardInst->dmaIndex]. in agtiapi_InitResource()
405 &pRscInfo->tiSharedMem.tdSharedCachedMem1.virtPtr, in agtiapi_InitResource()
406 &pRscInfo->tiSharedMem.tdSharedCachedMem1. in agtiapi_InitResource()
408 &pRscInfo->tiSharedMem.tdSharedCachedMem1. in agtiapi_InitResource()
410 pRscInfo->tiSharedMem.tdSharedCachedMem1. in agtiapi_InitResource()
413 pRscInfo->tiSharedMem.tdSharedCachedMem1.alignment) in agtiapi_InitResource()
417 thisCardInst->tiDmaMem[thisCardInst->dmaIndex].memSize = in agtiapi_InitResource()
418 pRscInfo->tiSharedMem.tdSharedCachedMem1.totalLength + in agtiapi_InitResource()
419 pRscInfo->tiSharedMem.tdSharedCachedMem1.alignment; in agtiapi_InitResource()
420 // printf( "agtiapi_InitResource: SharedMem DmaIndex=%d DMA " in agtiapi_InitResource()
422 // thisCardInst->dmaIndex, in agtiapi_InitResource()
423 // thisCardInst->tiDmaMem[thisCardInst->dmaIndex].dmaVirtAddr, in agtiapi_InitResource()
424 // pRscInfo->tiSharedMem.tdSharedCachedMem1.virtPtr, in agtiapi_InitResource()
425 // pRscInfo->tiSharedMem.tdSharedCachedMem1.physAddrLower, in agtiapi_InitResource()
426 // pRscInfo->tiSharedMem.tdSharedCachedMem1.alignment); in agtiapi_InitResource()
427 thisCardInst->dmaIndex++; in agtiapi_InitResource()
429 else if( (pRscInfo->tiSharedMem.tdSharedCachedMem1.type & in agtiapi_InitResource()
432 if( thisCardInst->cacheIndex >= in agtiapi_InitResource()
433 sizeof(thisCardInst->tiCachedMem) / in agtiapi_InitResource()
434 sizeof(thisCardInst->tiCachedMem[0]) ) { in agtiapi_InitResource()
435 AGTIAPI_PRINTK( "Invalid cacheIndex %d ERROR\n", thisCardInst->cacheIndex); in agtiapi_InitResource()
438 if( agtiapi_MemAlloc( thisCardInst, (void *)&thisCardInst-> in agtiapi_InitResource()
439 tiCachedMem[thisCardInst->cacheIndex], in agtiapi_InitResource()
441 &pRscInfo->tiSharedMem.tdSharedCachedMem1.virtPtr, in agtiapi_InitResource()
444 pRscInfo-> in agtiapi_InitResource()
447 pRscInfo->tiSharedMem.tdSharedCachedMem1.alignment) in agtiapi_InitResource()
452 // thisCardInst->cacheIndex, in agtiapi_InitResource()
453 // thisCardInst->tiCachedMem[thisCardInst->cacheIndex], in agtiapi_InitResource()
454 // pRscInfo->tiSharedMem.tdSharedCachedMem1.virtPtr, in agtiapi_InitResource()
455 // pRscInfo->tiSharedMem.tdSharedCachedMem1.totalLength, in agtiapi_InitResource()
456 // pRscInfo->tiSharedMem.tdSharedCachedMem1.alignment); in agtiapi_InitResource()
459 thisCardInst->cacheIndex, in agtiapi_InitResource()
460 thisCardInst->tiCachedMem[thisCardInst->cacheIndex], in agtiapi_InitResource()
461 pRscInfo->tiSharedMem.tdSharedCachedMem1.virtPtr, in agtiapi_InitResource()
462 pRscInfo->tiSharedMem.tdSharedCachedMem1.totalLength, in agtiapi_InitResource()
463 pRscInfo->tiSharedMem.tdSharedCachedMem1.alignment ); in agtiapi_InitResource()
464 thisCardInst->cacheIndex++; in agtiapi_InitResource()
480 Determine the amount of DMA (non-cache) memory resources which will be
485 size of DMA memory which call to agtiapi_InitResource() will consume
492 struct agtiapi_softc *pmsc = thisCardInst->pCard; in agtiapi_ScopeDMARes()
499 pRscInfo = &thisCardInst->tiRscInfo; in agtiapi_ScopeDMARes()
501 if (pRscInfo->tiLoLevelResource.loLevelMem.count != 0) { in agtiapi_ScopeDMARes()
502 for( numVal = 0; numVal < pRscInfo->tiLoLevelResource.loLevelMem.count; in agtiapi_ScopeDMARes()
504 if( pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].totalLength == in agtiapi_ScopeDMARes()
510 lTmpAlign = pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].alignment; in agtiapi_ScopeDMARes()
513 //pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].alignment = in agtiapi_ScopeDMARes()
516 if( ((pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].type in agtiapi_ScopeDMARes()
518 ((pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].type in agtiapi_ScopeDMARes()
520 //thisCardInst->tiDmaMem[thisCardInst->dmaIndex].type = in agtiapi_ScopeDMARes()
523 pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].type in agtiapi_ScopeDMARes()
530 pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].totalLength; in agtiapi_ScopeDMARes()
535 else if ( ( pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].type & in agtiapi_ScopeDMARes()
538 if( thisCardInst->cacheIndex >= in agtiapi_ScopeDMARes()
539 sizeof(thisCardInst->tiCachedMem) / in agtiapi_ScopeDMARes()
540 sizeof(thisCardInst->tiCachedMem[0]) ) { in agtiapi_ScopeDMARes()
542 thisCardInst->cacheIndex ); in agtiapi_ScopeDMARes()
549 pRscInfo->tiLoLevelResource.loLevelMem.mem[numVal].type ); in agtiapi_ScopeDMARes()
559 if (pRscInfo->tiSharedMem.tdSharedCachedMem1.totalLength != 0) { in agtiapi_ScopeDMARes()
561 lTmpAlign = pRscInfo->tiSharedMem.tdSharedCachedMem1.alignment; in agtiapi_ScopeDMARes()
563 //pRscInfo->tiSharedMem.tdSharedCachedMem1.alignment=AGTIAPI_64BIT_ALIGN; in agtiapi_ScopeDMARes()
566 if( (pRscInfo->tiSharedMem.tdSharedCachedMem1.type & (BIT(0) | BIT(1))) in agtiapi_ScopeDMARes()
568 lTmpLen = pRscInfo->tiSharedMem.tdSharedCachedMem1.totalLength; in agtiapi_ScopeDMARes()
572 else if( (pRscInfo->tiSharedMem.tdSharedCachedMem1.type & in agtiapi_ScopeDMARes()
580 pmsc->typhn = lAllMem; in agtiapi_ScopeDMARes()
591 dev = pCardInfo->pPCIDev; in agtiapi_ReleasePCIMem()
594 tmpRid = pCardInfo->pciMemBaseRIDSpc[bar]; in agtiapi_ReleasePCIMem()
595 tmpRsc = pCardInfo->pciMemBaseRscSpc[bar]; in agtiapi_ReleasePCIMem()
611 dma_addr_t *pDmaAddr (OUT) Allocated dma memory physical address
619 AGTIAPI_SUCCESS - success
620 AGTIAPI_FAIL - fail
634 alignOffset = Align - 1; in agtiapi_MemAlloc()
636 // printf( "agtiapi_MemAlloc: debug find mem TYPE, %d vs. CACHE %d, DMA %d \n", in agtiapi_MemAlloc()
644 struct agtiapi_softc *pmsc = thisCardInst->pCard; // get card reference in agtiapi_MemAlloc()
647 *VirtAlloc = (void*)( (U64)pmsc->typh_mem + pmsc->typhIdx ); in agtiapi_MemAlloc()
650 residAlign = (U64)*VirtAddr - (U64)*VirtAlloc; // find alignment needed in agtiapi_MemAlloc()
651 pmsc->typhIdx += residAlign + MemSize; // update index in agtiapi_MemAlloc()
654 pDmaAddr = (vm_paddr_t*)( (U64)pmsc->typh_busaddr + pmsc->tyPhsIx ); in agtiapi_MemAlloc()
658 residAlign = (U64)lPhysAligned - (U64)pDmaAddr; // find alignment needed in agtiapi_MemAlloc()
659 pmsc->tyPhsIx += residAlign + MemSize; // update index in agtiapi_MemAlloc()
664 // pmsc->tyPhsIx, MemSize, residAlign, pDmaAddr, lPhysAligned, in agtiapi_MemAlloc()
690 for( idx = 0; idx < pCardInfo->cacheIndex; idx++ ) { in agtiapi_MemFree()
691 if( pCardInfo->tiCachedMem[idx] ) { in agtiapi_MemFree()
692 free( pCardInfo->tiCachedMem[idx], M_PMC_MMAL ); in agtiapi_MemFree()
693 AGTIAPI_PRINTK( "agtiapi_MemFree: TI_CACHED_MEM Mem[%d] %p\n", in agtiapi_MemFree()
694 idx, pCardInfo->tiCachedMem[idx] ); in agtiapi_MemFree()
699 struct agtiapi_softc *pmsc = pCardInfo->pCard; // get card reference in agtiapi_MemFree()
700 if( pmsc->typh_busaddr != 0 ) { in agtiapi_MemFree()
701 bus_dmamap_unload( pmsc->typh_dmat, pmsc->typh_mapp ); in agtiapi_MemFree()
703 if( pmsc->typh_mem != NULL ) { in agtiapi_MemFree()
704 bus_dmamem_free( pmsc->typh_dmat, pmsc->typh_mem, pmsc->typh_mapp ); in agtiapi_MemFree()
706 if( pmsc->typh_dmat != NULL ) { in agtiapi_MemFree()
707 bus_dma_tag_destroy( pmsc->typh_dmat ); in agtiapi_MemFree()
710 // pCardInfo->dmaIndex in agtiapi_MemFree()
711 // pCardInfo->tiDmaMem[idx].dmaVirtAddr in agtiapi_MemFree()
712 // pCardInfo->tiDmaMem[idx].memSize in agtiapi_MemFree()
713 // pCardInfo->tiDmaMem[idx].type == TI_CACHED_DMA_MEM in agtiapi_MemFree()
714 // pCardInfo->tiDmaMem[idx].type == TI_DMA_MEM in agtiapi_MemFree()
720 if( pCardInfo->dynamicMem[idx].dmaVirtAddr != NULL ) { in agtiapi_MemFree()
723 idx, pCardInfo->dynamicMem[idx].dmaVirtAddr, in agtiapi_MemFree()
724 (long unsigned int)pCardInfo->dynamicMem[idx].dmaPhysAddr, in agtiapi_MemFree()
725 pCardInfo->dynamicMem[idx].memSize ); in agtiapi_MemFree()
726 if( pCardInfo->dynamicMem[idx].dmaPhysAddr ) in agtiapi_MemFree()
728 pCardInfo->dynamicMem[idx].dmaVirtAddr, in agtiapi_MemFree()
729 pCardInfo->dynamicMem[idx].memSize, ... ); in agtiapi_MemFree()
741 sets thisCardInst->cardIdIndex to structure variant consistent with card.
748 0 - success
772 thisCardInst->cardIdIndex = idx; in agtiapi_ProbeCard()
773 thisCardInst->pPCIDev = dev; in agtiapi_ProbeCard()
774 thisCardInst->cardNameIndex = ag_card_type[idx].cardNameIndex; in agtiapi_ProbeCard()
775 thisCardInst->cardID = in agtiapi_ProbeCard()
778 thisCardInst->pPCIDev, thisCardInst ); in agtiapi_ProbeCard()