drivers/rapidio/devices/tsi721_dma.c
Source file repositories/reference/linux-study-clean/drivers/rapidio/devices/tsi721_dma.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/rapidio/devices/tsi721_dma.c- Extension
.c- Size
- 27929 bytes
- Lines
- 1044
- Domain
- Driver Families
- Bucket
- drivers/rapidio
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/io.hlinux/errno.hlinux/init.hlinux/ioport.hlinux/kernel.hlinux/module.hlinux/pci.hlinux/rio.hlinux/rio_drv.hlinux/dma-mapping.hlinux/interrupt.hlinux/kfifo.hlinux/sched.hlinux/delay.h../../dma/dmaengine.htsi721.h
Detected Declarations
function tsi721_bdma_ch_initfunction tsi721_bdma_ch_freefunction tsi721_bdma_interrupt_enablefunction tsi721_dma_is_idlefunction tsi721_bdma_handlerfunction tsi721_bdma_msixfunction tsi721_start_dmafunction tsi721_desc_fill_initfunction tsi721_desc_fill_endfunction tsi721_dma_tx_errfunction tsi721_clr_statfunction tsi721_submit_sgfunction for_each_sgfunction tsi721_advance_workfunction tsi721_dma_taskletfunction tsi721_tx_submitfunction tsi721_alloc_chan_resourcesfunction tsi721_sync_dma_irqfunction tsi721_free_chan_resourcesfunction tsi721_tx_statusfunction tsi721_issue_pendingfunction tsi721_terminate_allfunction tsi721_dma_stopfunction tsi721_dma_stop_allfunction tsi721_register_dmafunction tsi721_unregister_dmafunction list_for_each_entry_safe
Annotated Snippet
if (rc) {
tsi_debug(DMA, &bdma_chan->dchan.dev->device,
"Unable to get MSI-X for DMAC%d-DONE",
bdma_chan->id);
goto err_out;
}
idx = TSI721_VECT_DMA0_INT + bdma_chan->id;
rc = request_irq(priv->msix[idx].vector, tsi721_bdma_msix, 0,
priv->msix[idx].irq_name, (void *)bdma_chan);
if (rc) {
tsi_debug(DMA, &bdma_chan->dchan.dev->device,
"Unable to get MSI-X for DMAC%d-INT",
bdma_chan->id);
free_irq(
priv->msix[TSI721_VECT_DMA0_DONE +
bdma_chan->id].vector,
(void *)bdma_chan);
}
err_out:
if (rc) {
/* Free space allocated for DMA descriptors */
dma_free_coherent(dev,
(bd_num + 1) * sizeof(struct tsi721_dma_desc),
bd_ptr, bd_phys);
bdma_chan->bd_base = NULL;
/* Free space allocated for status descriptors */
dma_free_coherent(dev,
sts_size * sizeof(struct tsi721_dma_sts),
sts_ptr, sts_phys);
bdma_chan->sts_base = NULL;
return -EIO;
}
}
#endif /* CONFIG_PCI_MSI */
/* Toggle DMA channel initialization */
iowrite32(TSI721_DMAC_CTL_INIT, bdma_chan->regs + TSI721_DMAC_CTL);
ioread32(bdma_chan->regs + TSI721_DMAC_CTL);
bdma_chan->wr_count = bdma_chan->wr_count_next = 0;
bdma_chan->sts_rdptr = 0;
udelay(10);
return 0;
}
static int tsi721_bdma_ch_free(struct tsi721_bdma_chan *bdma_chan)
{
u32 ch_stat;
#ifdef CONFIG_PCI_MSI
struct tsi721_device *priv = to_tsi721(bdma_chan->dchan.device);
#endif
if (!bdma_chan->bd_base)
return 0;
/* Check if DMA channel still running */
ch_stat = ioread32(bdma_chan->regs + TSI721_DMAC_STS);
if (ch_stat & TSI721_DMAC_STS_RUN)
return -EFAULT;
/* Put DMA channel into init state */
iowrite32(TSI721_DMAC_CTL_INIT, bdma_chan->regs + TSI721_DMAC_CTL);
#ifdef CONFIG_PCI_MSI
if (priv->flags & TSI721_USING_MSIX) {
free_irq(priv->msix[TSI721_VECT_DMA0_DONE +
bdma_chan->id].vector, (void *)bdma_chan);
free_irq(priv->msix[TSI721_VECT_DMA0_INT +
bdma_chan->id].vector, (void *)bdma_chan);
}
#endif /* CONFIG_PCI_MSI */
/* Free space allocated for DMA descriptors */
dma_free_coherent(bdma_chan->dchan.device->dev,
(bdma_chan->bd_num + 1) * sizeof(struct tsi721_dma_desc),
bdma_chan->bd_base, bdma_chan->bd_phys);
bdma_chan->bd_base = NULL;
/* Free space allocated for status FIFO */
dma_free_coherent(bdma_chan->dchan.device->dev,
bdma_chan->sts_size * sizeof(struct tsi721_dma_sts),
bdma_chan->sts_base, bdma_chan->sts_phys);
bdma_chan->sts_base = NULL;
return 0;
Annotation
- Immediate include surface: `linux/io.h`, `linux/errno.h`, `linux/init.h`, `linux/ioport.h`, `linux/kernel.h`, `linux/module.h`, `linux/pci.h`, `linux/rio.h`.
- Detected declarations: `function tsi721_bdma_ch_init`, `function tsi721_bdma_ch_free`, `function tsi721_bdma_interrupt_enable`, `function tsi721_dma_is_idle`, `function tsi721_bdma_handler`, `function tsi721_bdma_msix`, `function tsi721_start_dma`, `function tsi721_desc_fill_init`, `function tsi721_desc_fill_end`, `function tsi721_dma_tx_err`.
- Atlas domain: Driver Families / drivers/rapidio.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.