drivers/dma/fsl-qdma.c
Source file repositories/reference/linux-study-clean/drivers/dma/fsl-qdma.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/dma/fsl-qdma.c- Extension
.c- Size
- 36220 bytes
- Lines
- 1292
- 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/module.hlinux/delay.hlinux/of.hlinux/of_dma.hlinux/dma-mapping.hlinux/platform_device.hvirt-dma.hfsldma.h
Detected Declarations
struct fsl_qdma_formatstruct fsl_pre_statusstruct fsl_qdma_chanstruct fsl_qdma_queuestruct fsl_qdma_compstruct fsl_qdma_enginefunction qdma_ccdf_addr_get64function qdma_desc_addr_set64function qdma_ccdf_get_queuefunction qdma_ccdf_get_offsetfunction qdma_ccdf_set_formatfunction qdma_ccdf_get_statusfunction qdma_ccdf_set_serfunction qdma_csgf_set_lenfunction qdma_csgf_set_ffunction qdma_readlfunction qdma_writelfunction fsl_qdma_free_chan_resourcesfunction list_for_each_entry_safefunction list_for_each_entry_safefunction fsl_qdma_comp_fill_memcpyfunction fsl_qdma_pre_request_enqueue_descfunction fsl_qdma_haltfunction fsl_qdma_queue_transfer_completefunction fsl_qdma_error_handlerfunction fsl_qdma_queue_handlerfunction fsl_qdma_irq_initfunction fsl_qdma_irq_exitfunction fsl_qdma_reg_initfunction fsl_qdma_prep_memcpyfunction fsl_qdma_enqueue_descfunction fsl_qdma_free_descfunction fsl_qdma_issue_pendingfunction fsl_qdma_synchronizefunction fsl_qdma_terminate_allfunction fsl_qdma_alloc_chan_resourcesfunction fsl_qdma_probefunction fsl_qdma_cleanup_vchanfunction list_for_each_entry_safefunction fsl_qdma_remove
Annotated Snippet
struct fsl_qdma_format {
__le32 status;
__le32 cfg;
union {
struct {
__le32 addr_lo;
u8 addr_hi;
u8 __reserved1[2];
u8 cfg8b_w1;
} __packed;
struct {
__le32 __reserved2;
__le32 cmd;
} __packed;
__le64 data;
};
} __packed;
/* qDMA status notification pre information */
struct fsl_pre_status {
u64 addr;
u8 queue;
};
static DEFINE_PER_CPU(struct fsl_pre_status, pre);
struct fsl_qdma_chan {
struct virt_dma_chan vchan;
struct virt_dma_desc vdesc;
enum dma_status status;
struct fsl_qdma_engine *qdma;
struct fsl_qdma_queue *queue;
};
struct fsl_qdma_queue {
struct fsl_qdma_format *virt_head;
struct fsl_qdma_format *virt_tail;
struct list_head comp_used;
struct list_head comp_free;
struct dma_pool *comp_pool;
struct dma_pool *desc_pool;
spinlock_t queue_lock;
dma_addr_t bus_addr;
u32 n_cq;
u32 id;
struct fsl_qdma_format *cq;
void __iomem *block_base;
};
struct fsl_qdma_comp {
dma_addr_t bus_addr;
dma_addr_t desc_bus_addr;
struct fsl_qdma_format *virt_addr;
struct fsl_qdma_format *desc_virt_addr;
struct fsl_qdma_chan *qchan;
struct virt_dma_desc vdesc;
struct list_head list;
};
struct fsl_qdma_engine {
struct dma_device dma_dev;
void __iomem *ctrl_base;
void __iomem *status_base;
void __iomem *block_base;
u32 n_chans;
u32 n_queues;
struct mutex fsl_qdma_mutex;
int error_irq;
int *queue_irq;
u32 feature;
struct fsl_qdma_queue *queue;
struct fsl_qdma_queue **status;
struct fsl_qdma_chan *chans;
int block_number;
int block_offset;
int irq_base;
int desc_allocated;
};
static inline u64
qdma_ccdf_addr_get64(const struct fsl_qdma_format *ccdf)
{
return le64_to_cpu(ccdf->data) & (U64_MAX >> 24);
}
static inline void
qdma_desc_addr_set64(struct fsl_qdma_format *ccdf, u64 addr)
{
ccdf->addr_hi = upper_32_bits(addr);
Annotation
- Immediate include surface: `linux/module.h`, `linux/delay.h`, `linux/of.h`, `linux/of_dma.h`, `linux/dma-mapping.h`, `linux/platform_device.h`, `virt-dma.h`, `fsldma.h`.
- Detected declarations: `struct fsl_qdma_format`, `struct fsl_pre_status`, `struct fsl_qdma_chan`, `struct fsl_qdma_queue`, `struct fsl_qdma_comp`, `struct fsl_qdma_engine`, `function qdma_ccdf_addr_get64`, `function qdma_desc_addr_set64`, `function qdma_ccdf_get_queue`, `function qdma_ccdf_get_offset`.
- 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.