arch/csky/mm/dma-mapping.c
Source file repositories/reference/linux-study-clean/arch/csky/mm/dma-mapping.c
File Facts
- System
- Linux kernel
- Corpus path
arch/csky/mm/dma-mapping.c- Extension
.c- Size
- 1900 bytes
- Lines
- 88
- Domain
- Architecture Layer
- Bucket
- arch/csky
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/cache.hlinux/dma-map-ops.hlinux/genalloc.hlinux/highmem.hlinux/io.hlinux/mm.hlinux/scatterlist.hlinux/types.hasm/cache.h
Detected Declarations
function cache_opfunction dma_wbinv_set_zero_rangefunction arch_dma_prep_coherentfunction arch_sync_dma_for_devicefunction arch_sync_dma_for_cpu
Annotated Snippet
if (PageHighMem(page)) {
start = kmap_atomic(page);
fn((unsigned long)start + offset,
(unsigned long)start + offset + len);
kunmap_atomic(start);
} else {
fn((unsigned long)start + offset,
(unsigned long)start + offset + len);
}
offset = 0;
page++;
start += PAGE_SIZE;
left -= len;
} while (left);
}
static void dma_wbinv_set_zero_range(unsigned long start, unsigned long end)
{
memset((void *)start, 0, end - start);
dma_wbinv_range(start, end);
}
void arch_dma_prep_coherent(struct page *page, size_t size)
{
cache_op(page_to_phys(page), size, dma_wbinv_set_zero_range);
}
void arch_sync_dma_for_device(phys_addr_t paddr, size_t size,
enum dma_data_direction dir)
{
switch (dir) {
case DMA_TO_DEVICE:
cache_op(paddr, size, dma_wb_range);
break;
case DMA_FROM_DEVICE:
case DMA_BIDIRECTIONAL:
cache_op(paddr, size, dma_wbinv_range);
break;
default:
BUG();
}
}
void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size,
enum dma_data_direction dir)
{
switch (dir) {
case DMA_TO_DEVICE:
return;
case DMA_FROM_DEVICE:
case DMA_BIDIRECTIONAL:
cache_op(paddr, size, dma_inv_range);
break;
default:
BUG();
}
}
Annotation
- Immediate include surface: `linux/cache.h`, `linux/dma-map-ops.h`, `linux/genalloc.h`, `linux/highmem.h`, `linux/io.h`, `linux/mm.h`, `linux/scatterlist.h`, `linux/types.h`.
- Detected declarations: `function cache_op`, `function dma_wbinv_set_zero_range`, `function arch_dma_prep_coherent`, `function arch_sync_dma_for_device`, `function arch_sync_dma_for_cpu`.
- Atlas domain: Architecture Layer / arch/csky.
- Implementation status: source implementation candidate.
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.