drivers/dma/imx-sdma.c
Source file repositories/reference/linux-study-clean/drivers/dma/imx-sdma.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/dma/imx-sdma.c- Extension
.c- Size
- 66436 bytes
- Lines
- 2431
- 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/init.hlinux/iopoll.hlinux/module.hlinux/types.hlinux/bitfield.hlinux/bitops.hlinux/mm.hlinux/interrupt.hlinux/clk.hlinux/delay.hlinux/sched.hlinux/semaphore.hlinux/spinlock.hlinux/device.hlinux/genalloc.hlinux/dma-mapping.hlinux/firmware.hlinux/slab.hlinux/platform_device.hlinux/dmaengine.hlinux/of.hlinux/of_address.hlinux/of_dma.hlinux/workqueue.hasm/irq.hlinux/dma/imx-dma.hlinux/regmap.hlinux/mfd/syscon.hlinux/mfd/syscon/imx6q-iomuxc-gpr.hdmaengine.hvirt-dma.h
Detected Declarations
struct sdma_script_start_addrsstruct sdma_mode_countstruct sdma_buffer_descriptorstruct sdma_channel_controlstruct sdma_state_registersstruct sdma_context_datastruct sdma_enginestruct sdma_descstruct sdma_channelstruct sdma_firmware_headerstruct sdma_driver_datastruct sdma_enginefunction chnenbl_ofsfunction sdma_config_ownershipfunction is_sdma_channel_enabledfunction sdma_enable_channelfunction sdma_run_channel0function sdma_load_scriptfunction sdma_event_enablefunction sdma_event_disablefunction sdma_start_descfunction sdma_update_channel_loopfunction availablefunction mxc_sdma_handle_channel_normalfunction sdma_int_handlerfunction sdma_get_pcfunction sdma_load_contextfunction sdma_disable_channelfunction sdma_channel_terminate_workfunction sdma_terminate_allfunction sdma_channel_synchronizefunction sdma_set_watermarklevel_for_p2pfunction LWMLfunction sdma_set_watermarklevel_for_saisfunction sdma_config_channelfunction sdma_set_channel_priorityfunction sdma_request_channel0function sdma_alloc_bdfunction sdma_free_bdfunction sdma_desc_freefunction sdma_alloc_chan_resourcesfunction dma_request_channelfunction sdma_free_chan_resourcesfunction for_each_sgfunction sdma_config_writefunction sdma_configfunction sdma_tx_statusfunction sdma_issue_pending
Annotated Snippet
struct sdma_script_start_addrs {
s32 ap_2_ap_addr;
s32 ap_2_bp_addr;
s32 ap_2_ap_fixed_addr;
s32 bp_2_ap_addr;
s32 loopback_on_dsp_side_addr;
s32 mcu_interrupt_only_addr;
s32 firi_2_per_addr;
s32 firi_2_mcu_addr;
s32 per_2_firi_addr;
s32 mcu_2_firi_addr;
s32 uart_2_per_addr;
s32 uart_2_mcu_addr;
s32 per_2_app_addr;
s32 mcu_2_app_addr;
s32 per_2_per_addr;
s32 uartsh_2_per_addr;
s32 uartsh_2_mcu_addr;
s32 per_2_shp_addr;
s32 mcu_2_shp_addr;
s32 ata_2_mcu_addr;
s32 mcu_2_ata_addr;
s32 app_2_per_addr;
s32 app_2_mcu_addr;
s32 shp_2_per_addr;
s32 shp_2_mcu_addr;
s32 mshc_2_mcu_addr;
s32 mcu_2_mshc_addr;
s32 spdif_2_mcu_addr;
s32 mcu_2_spdif_addr;
s32 asrc_2_mcu_addr;
s32 ext_mem_2_ipu_addr;
s32 descrambler_addr;
s32 dptc_dvfs_addr;
s32 utra_addr;
s32 ram_code_start_addr;
/* End of v1 array */
union { s32 v1_end; s32 mcu_2_ssish_addr; };
s32 ssish_2_mcu_addr;
s32 hdmi_dma_addr;
/* End of v2 array */
union { s32 v2_end; s32 zcanfd_2_mcu_addr; };
s32 zqspi_2_mcu_addr;
s32 mcu_2_ecspi_addr;
s32 mcu_2_sai_addr;
s32 sai_2_mcu_addr;
s32 uart_2_mcu_rom_addr;
s32 uartsh_2_mcu_rom_addr;
s32 i2c_2_mcu_addr;
s32 mcu_2_i2c_addr;
/* End of v3 array */
union { s32 v3_end; s32 mcu_2_zqspi_addr; };
/* End of v4 array */
s32 v4_end[];
};
/*
* Mode/Count of data node descriptors - IPCv2
*/
struct sdma_mode_count {
#define SDMA_BD_MAX_CNT 0xffff
u32 count : 16; /* size of the buffer pointed by this BD */
u32 status : 8; /* E,R,I,C,W,D status bits stored here */
u32 command : 8; /* command mostly used for channel 0 */
};
/*
* Buffer descriptor
*/
struct sdma_buffer_descriptor {
struct sdma_mode_count mode;
u32 buffer_addr; /* address of the buffer described */
u32 ext_buffer_addr; /* extended buffer address */
} __attribute__ ((packed));
/**
* struct sdma_channel_control - Channel control Block
*
* @current_bd_ptr: current buffer descriptor processed
* @base_bd_ptr: first element of buffer descriptor array
* @unused: padding. The SDMA engine expects an array of 128 byte
* control blocks
*/
struct sdma_channel_control {
u32 current_bd_ptr;
u32 base_bd_ptr;
u32 unused[2];
} __attribute__ ((packed));
/**
Annotation
- Immediate include surface: `linux/init.h`, `linux/iopoll.h`, `linux/module.h`, `linux/types.h`, `linux/bitfield.h`, `linux/bitops.h`, `linux/mm.h`, `linux/interrupt.h`.
- Detected declarations: `struct sdma_script_start_addrs`, `struct sdma_mode_count`, `struct sdma_buffer_descriptor`, `struct sdma_channel_control`, `struct sdma_state_registers`, `struct sdma_context_data`, `struct sdma_engine`, `struct sdma_desc`, `struct sdma_channel`, `struct sdma_firmware_header`.
- 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.