arch/parisc/mm/init.c
Source file repositories/reference/linux-study-clean/arch/parisc/mm/init.c
File Facts
- System
- Linux kernel
- Corpus path
arch/parisc/mm/init.c- Extension
.c- Size
- 26349 bytes
- Lines
- 995
- Domain
- Architecture Layer
- Bucket
- arch/parisc
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/mm.hlinux/memblock.hlinux/gfp.hlinux/delay.hlinux/init.hlinux/initrd.hlinux/swap.hlinux/unistd.hlinux/nodemask.hlinux/pagemap.hlinux/compat.hlinux/execmem.hasm/pgalloc.hasm/tlb.hasm/pdc_chassis.hasm/mmzone.hasm/sections.hasm/msgbuf.hasm/sparsemem.hasm/asm-offsets.hasm/shmbuf.h
Detected Declarations
function mem_limit_funcfunction setup_bootmemfunction map_pagesfunction set_kernel_text_rwfunction free_initmemfunction mark_rodata_rofunction mem_initfunction pagetable_initfunction gateway_initfunction fixmap_initfunction arch_zone_limits_initfunction paging_initfunction alloc_btlbfunction btlb_init_per_cpufunction alloc_sidfunction free_sidfunction get_dirty_sidsfunction recycle_sidsfunction recycle_sidsfunction flush_tlb_allfunction flush_tlb_allexport parisc_vmalloc_start
Annotated Snippet
if (memcmp(cp, "mem=", 4) == 0) {
cp += 4;
limit = memparse(cp, &end);
if (end != cp)
break;
cp = end;
} else {
while (*cp != ' ' && *cp)
++cp;
while (*cp == ' ')
++cp;
}
}
if (limit < mem_limit)
mem_limit = limit;
}
#define MAX_GAP (0x40000000UL >> PAGE_SHIFT)
static void __init setup_bootmem(void)
{
unsigned long mem_max;
#ifndef CONFIG_SPARSEMEM
physmem_range_t pmem_holes[MAX_PHYSMEM_RANGES - 1];
int npmem_holes;
#endif
int i, sysram_resource_count;
disable_sr_hashing(); /* Turn off space register hashing */
/*
* Sort the ranges. Since the number of ranges is typically
* small, and performance is not an issue here, just do
* a simple insertion sort.
*/
for (i = 1; i < npmem_ranges; i++) {
int j;
for (j = i; j > 0; j--) {
if (pmem_ranges[j-1].start_pfn <
pmem_ranges[j].start_pfn) {
break;
}
swap(pmem_ranges[j-1], pmem_ranges[j]);
}
}
#ifndef CONFIG_SPARSEMEM
/*
* Throw out ranges that are too far apart (controlled by
* MAX_GAP).
*/
for (i = 1; i < npmem_ranges; i++) {
if (pmem_ranges[i].start_pfn -
(pmem_ranges[i-1].start_pfn +
pmem_ranges[i-1].pages) > MAX_GAP) {
npmem_ranges = i;
printk("Large gap in memory detected (%ld pages). "
"Consider turning on CONFIG_SPARSEMEM\n",
pmem_ranges[i].start_pfn -
(pmem_ranges[i-1].start_pfn +
pmem_ranges[i-1].pages));
break;
}
}
#endif
/* Print the memory ranges */
pr_info("Memory Ranges:\n");
for (i = 0; i < npmem_ranges; i++) {
struct resource *res = &sysram_resources[i];
unsigned long start;
unsigned long size;
size = (pmem_ranges[i].pages << PAGE_SHIFT);
start = (pmem_ranges[i].start_pfn << PAGE_SHIFT);
pr_info("%2d) Start 0x%016lx End 0x%016lx Size %6ld MB\n",
i, start, start + (size - 1), size >> 20);
/* request memory resource */
res->name = "System RAM";
res->start = start;
res->end = start + size - 1;
res->flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
request_resource(&iomem_resource, res);
Annotation
- Immediate include surface: `linux/module.h`, `linux/mm.h`, `linux/memblock.h`, `linux/gfp.h`, `linux/delay.h`, `linux/init.h`, `linux/initrd.h`, `linux/swap.h`.
- Detected declarations: `function mem_limit_func`, `function setup_bootmem`, `function map_pages`, `function set_kernel_text_rw`, `function free_initmem`, `function mark_rodata_ro`, `function mem_init`, `function pagetable_init`, `function gateway_init`, `function fixmap_init`.
- Atlas domain: Architecture Layer / arch/parisc.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.