arch/m68k/sun3/dvma.c
Source file repositories/reference/linux-study-clean/arch/m68k/sun3/dvma.c
File Facts
- System
- Linux kernel
- Corpus path
arch/m68k/sun3/dvma.c- Extension
.c- Size
- 1290 bytes
- Lines
- 69
- Domain
- Architecture Layer
- Bucket
- arch/m68k
- 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.
Dependency Surface
linux/init.hlinux/kernel.hlinux/mm.hlinux/memblock.hlinux/list.hasm/page.hasm/sun3mmu.hasm/dvma.h
Detected Declarations
function dvma_pagefunction dvma_map_iommufunction sun3_dvma_init
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* linux/arch/m68k/sun3/dvma.c
*
* Written by Sam Creasey
*
* Sun3 IOMMU routines used for dvma accesses.
*
*/
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/memblock.h>
#include <linux/list.h>
#include <asm/page.h>
#include <asm/sun3mmu.h>
#include <asm/dvma.h>
static unsigned long ptelist[120];
static unsigned long dvma_page(unsigned long kaddr, unsigned long vaddr)
{
unsigned long pte;
unsigned long j;
pte_t ptep;
j = *(volatile unsigned long *)kaddr;
*(volatile unsigned long *)kaddr = j;
ptep = pfn_pte(virt_to_pfn((void *)kaddr), PAGE_KERNEL);
pte = pte_val(ptep);
// pr_info("dvma_remap: addr %lx -> %lx pte %08lx\n", kaddr, vaddr, pte);
if(ptelist[(vaddr & 0xff000) >> PAGE_SHIFT] != pte) {
sun3_put_pte(vaddr, pte);
ptelist[(vaddr & 0xff000) >> PAGE_SHIFT] = pte;
}
return (vaddr + (kaddr & ~PAGE_MASK));
}
int dvma_map_iommu(unsigned long kaddr, unsigned long baddr,
int len)
{
unsigned long end;
unsigned long vaddr;
vaddr = dvma_btov(baddr);
end = vaddr + len;
while(vaddr < end) {
dvma_page(kaddr, vaddr);
kaddr += PAGE_SIZE;
vaddr += PAGE_SIZE;
}
return 0;
}
void __init sun3_dvma_init(void)
{
memset(ptelist, 0, sizeof(ptelist));
}
Annotation
- Immediate include surface: `linux/init.h`, `linux/kernel.h`, `linux/mm.h`, `linux/memblock.h`, `linux/list.h`, `asm/page.h`, `asm/sun3mmu.h`, `asm/dvma.h`.
- Detected declarations: `function dvma_page`, `function dvma_map_iommu`, `function sun3_dvma_init`.
- Atlas domain: Architecture Layer / arch/m68k.
- 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.