drivers/dma/dma-axi-dmac.c
Source file repositories/reference/linux-study-clean/drivers/dma/dma-axi-dmac.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/dma/dma-axi-dmac.c- Extension
.c- Size
- 36362 bytes
- Lines
- 1336
- Domain
- Driver Families
- Bucket
- drivers/dma
- 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/adi-axi-common.hlinux/bitfield.hlinux/cleanup.hlinux/clk.hlinux/device.hlinux/dma-mapping.hlinux/dmaengine.hlinux/err.hlinux/interrupt.hlinux/io.hlinux/kernel.hlinux/module.hlinux/of.hlinux/of_dma.hlinux/of_address.hlinux/platform_device.hlinux/regmap.hlinux/slab.hdt-bindings/dma/axi-dmac.hdmaengine.hvirt-dma.h
Detected Declarations
struct axi_dmac_hw_descstruct axi_dmac_sgstruct axi_dmac_descstruct axi_dmac_chanstruct axi_dmacfunction axi_dmac_writefunction axi_dmac_readfunction axi_dmac_src_is_memfunction axi_dmac_dest_is_memfunction axi_dmac_check_lenfunction axi_dmac_check_addrfunction axi_dmac_start_transferfunction axi_dmac_total_sg_bytesfunction axi_dmac_dequeue_partial_xfersfunction list_for_each_entryfunction axi_dmac_compute_residuefunction axi_dmac_handle_cyclic_eotfunction axi_dmac_transfer_donefunction axi_dmac_interrupt_handlerfunction axi_dmac_terminate_allfunction axi_dmac_synchronizefunction axi_dmac_issue_pendingfunction axi_dmac_alloc_descfunction axi_dmac_free_descfunction axi_dmac_prep_peripheral_dma_vecfunction for_each_sgfunction axi_dmac_free_chan_resourcesfunction axi_dmac_desc_freefunction axi_dmac_regmap_rdwrfunction axi_dmac_adjust_chan_paramsfunction axi_dmac_parse_chan_dtfunction axi_dmac_parse_dtfunction for_each_child_of_node_scopedfunction axi_dmac_read_chan_configfunction axi_dmac_detect_capsfunction axi_dmac_tasklet_killfunction axi_dmac_free_dma_controllerfunction axi_dmac_probe
Annotated Snippet
struct axi_dmac_hw_desc {
u32 flags;
u32 id;
u64 dest_addr;
u64 src_addr;
u64 next_sg_addr;
u32 y_len;
u32 x_len;
u32 src_stride;
u32 dst_stride;
u64 __pad[2];
};
struct axi_dmac_sg {
unsigned int partial_len;
bool schedule_when_free;
struct axi_dmac_hw_desc *hw;
dma_addr_t hw_phys;
};
struct axi_dmac_desc {
struct virt_dma_desc vdesc;
struct axi_dmac_chan *chan;
bool cyclic;
bool cyclic_eot;
bool have_partial_xfer;
unsigned int num_submitted;
unsigned int num_completed;
unsigned int num_sgs;
struct axi_dmac_sg sg[] __counted_by(num_sgs);
};
struct axi_dmac_chan {
struct virt_dma_chan vchan;
struct axi_dmac_desc *next_desc;
struct list_head active_descs;
enum dma_transfer_direction direction;
unsigned int src_width;
unsigned int dest_width;
unsigned int src_type;
unsigned int dest_type;
unsigned int max_length;
unsigned int address_align_mask;
unsigned int length_align_mask;
bool hw_partial_xfer;
bool hw_cyclic;
bool hw_2d;
bool hw_sg;
bool hw_cyclic_hotfix;
};
struct axi_dmac {
void __iomem *base;
int irq;
struct clk *clk;
struct dma_device dma_dev;
struct axi_dmac_chan chan;
};
static struct axi_dmac *chan_to_axi_dmac(struct axi_dmac_chan *chan)
{
return container_of(chan->vchan.chan.device, struct axi_dmac,
dma_dev);
}
static struct axi_dmac_chan *to_axi_dmac_chan(struct dma_chan *c)
{
return container_of(c, struct axi_dmac_chan, vchan.chan);
}
static struct axi_dmac_desc *to_axi_dmac_desc(struct virt_dma_desc *vdesc)
{
return container_of(vdesc, struct axi_dmac_desc, vdesc);
}
static void axi_dmac_write(struct axi_dmac *axi_dmac, unsigned int reg,
unsigned int val)
{
writel(val, axi_dmac->base + reg);
}
Annotation
- Immediate include surface: `linux/adi-axi-common.h`, `linux/bitfield.h`, `linux/cleanup.h`, `linux/clk.h`, `linux/device.h`, `linux/dma-mapping.h`, `linux/dmaengine.h`, `linux/err.h`.
- Detected declarations: `struct axi_dmac_hw_desc`, `struct axi_dmac_sg`, `struct axi_dmac_desc`, `struct axi_dmac_chan`, `struct axi_dmac`, `function axi_dmac_write`, `function axi_dmac_read`, `function axi_dmac_src_is_mem`, `function axi_dmac_dest_is_mem`, `function axi_dmac_check_len`.
- Atlas domain: Driver Families / drivers/dma.
- 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.