arch/m68k/atari/stram.c
Source file repositories/reference/linux-study-clean/arch/m68k/atari/stram.c
File Facts
- System
- Linux kernel
- Corpus path
arch/m68k/atari/stram.c- Extension
.c- Size
- 5013 bytes
- Lines
- 203
- Domain
- Architecture Layer
- Bucket
- arch/m68k
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/types.hlinux/kernel.hlinux/mm.hlinux/kdev_t.hlinux/major.hlinux/init.hlinux/slab.hlinux/vmalloc.hlinux/pagemap.hlinux/memblock.hlinux/mount.hlinux/blkdev.hlinux/module.hlinux/ioport.hasm/setup.hasm/machdep.hasm/page.hasm/atarihw.hasm/atari_stram.hasm/io.h
Detected Declarations
function atari_stram_setupfunction stram_allocfunction setup_archfunction atari_stram_map_pagesfunction atari_stram_to_physfunction atari_stram_freeexport atari_stram_to_virtexport atari_stram_to_physexport atari_stram_allocexport atari_stram_free
Annotated Snippet
if (m68k_memory[i].addr == 0) {
return;
}
}
/* Should never come here! (There is always ST-Ram!) */
panic("atari_stram_init: no ST-RAM found!");
}
/*
* This function is called from setup_arch() to reserve the pages needed for
* ST-RAM management, if the kernel resides in ST-RAM.
*/
void __init atari_stram_reserve_pages(void *start_mem)
{
if (kernel_in_stram) {
pr_debug("atari_stram pool: kernel in ST-RAM, using alloc_bootmem!\n");
stram_pool.start = (resource_size_t)memblock_alloc_low(pool_size,
PAGE_SIZE);
if (!stram_pool.start)
panic("%s: Failed to allocate %lu bytes align=%lx\n",
__func__, pool_size, PAGE_SIZE);
stram_pool.end = stram_pool.start + pool_size - 1;
request_resource(&iomem_resource, &stram_pool);
stram_virt_offset = 0;
pr_debug("atari_stram pool: size = %lu bytes, resource = %pR\n",
pool_size, &stram_pool);
pr_debug("atari_stram pool: stram_virt_offset = %lx\n",
stram_virt_offset);
}
}
/*
* This function is called as arch initcall to reserve the pages needed for
* ST-RAM management, if the kernel does not reside in ST-RAM.
*/
static int __init atari_stram_map_pages(void)
{
if (!kernel_in_stram) {
/*
* Skip page 0, as the fhe first 2 KiB are supervisor-only!
*/
pr_debug("atari_stram pool: kernel not in ST-RAM, using ioremap!\n");
stram_pool.start = PAGE_SIZE;
stram_pool.end = stram_pool.start + pool_size - 1;
request_resource(&iomem_resource, &stram_pool);
stram_virt_offset = (unsigned long) ioremap(stram_pool.start,
resource_size(&stram_pool)) - stram_pool.start;
pr_debug("atari_stram pool: size = %lu bytes, resource = %pR\n",
pool_size, &stram_pool);
pr_debug("atari_stram pool: stram_virt_offset = %lx\n",
stram_virt_offset);
}
return 0;
}
arch_initcall(atari_stram_map_pages);
void *atari_stram_to_virt(unsigned long phys)
{
return (void *)(phys + stram_virt_offset);
}
EXPORT_SYMBOL(atari_stram_to_virt);
unsigned long atari_stram_to_phys(void *virt)
{
return (unsigned long)(virt - stram_virt_offset);
}
EXPORT_SYMBOL(atari_stram_to_phys);
void *atari_stram_alloc(unsigned long size, const char *owner)
{
struct resource *res;
int error;
pr_debug("atari_stram_alloc: allocate %lu bytes\n", size);
/* round up */
size = PAGE_ALIGN(size);
res = kzalloc_obj(struct resource);
if (!res)
return NULL;
res->name = owner;
Annotation
- Immediate include surface: `linux/types.h`, `linux/kernel.h`, `linux/mm.h`, `linux/kdev_t.h`, `linux/major.h`, `linux/init.h`, `linux/slab.h`, `linux/vmalloc.h`.
- Detected declarations: `function atari_stram_setup`, `function stram_alloc`, `function setup_arch`, `function atari_stram_map_pages`, `function atari_stram_to_phys`, `function atari_stram_free`, `export atari_stram_to_virt`, `export atari_stram_to_phys`, `export atari_stram_alloc`, `export atari_stram_free`.
- Atlas domain: Architecture Layer / arch/m68k.
- Implementation status: integration 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.