arch/mips/kernel/setup.c
Source file repositories/reference/linux-study-clean/arch/mips/kernel/setup.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/kernel/setup.c- Extension
.c- Size
- 20543 bytes
- Lines
- 834
- Domain
- Architecture Layer
- Bucket
- arch/mips
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/init.hlinux/cpu.hlinux/delay.hlinux/hex.hlinux/ioport.hlinux/export.hlinux/memblock.hlinux/initrd.hlinux/root_dev.hlinux/highmem.hlinux/console.hlinux/pfn.hlinux/debugfs.hlinux/kexec.hlinux/sizes.hlinux/device.hlinux/dma-map-ops.hlinux/decompress/generic.hlinux/of_fdt.hlinux/dmi.hlinux/crash_dump.hlinux/string.hasm/addrspace.hasm/bootinfo.hasm/bugs.hasm/cache.hasm/cdmm.hasm/cpu.hasm/debug.hasm/mmzone.hasm/sections.hasm/setup.h
Detected Declarations
function detect_memory_regionfunction rd_start_earlyfunction rd_size_earlyfunction init_initrdfunction maybe_bswap_initrdfunction decompress_methodfunction finalize_initrdfunction init_initrdfunction bootmem_initfunction bootmem_initfunction early_parse_memfunction early_parse_memmapfunction mips_reserve_vmcorefunction mips_parse_crashkernelfunction request_crashkernelfunction check_kernel_sections_memfunction bootcmdline_appendfunction bootcmdline_scan_chosenfunction bootcmdline_initfunction plat_mem_setupfunction resource_initfunction for_each_mem_rangefunction prefill_possible_mapfunction prefill_possible_mapfunction setup_archfunction debugfs_mipsfunction setcoherentiofunction setnocoherentiofunction arch_cpu_finalize_initexport cpu_dataexport mips_machtypeexport mips_io_port_baseexport __kaslr_offsetexport ARCH_PFN_OFFSET
Annotated Snippet
decompress_method((unsigned char *)(&buf), 8, NULL)) {
unsigned long i;
pr_info("Byteswapped initrd detected\n");
for (i = initrd_start; i < ALIGN(initrd_end, 8); i += 8)
swab64s((u64 *)i);
}
#endif
}
static void __init finalize_initrd(void)
{
unsigned long size = initrd_end - initrd_start;
if (size == 0) {
printk(KERN_INFO "Initrd not found or empty");
goto disable;
}
if (__pa(initrd_end) > PFN_PHYS(max_low_pfn)) {
printk(KERN_ERR "Initrd extends beyond end of memory");
goto disable;
}
maybe_bswap_initrd();
memblock_reserve(__pa(initrd_start), size);
initrd_below_start_ok = 1;
pr_info("Initial ramdisk at: 0x%lx (%lu bytes)\n",
initrd_start, size);
return;
disable:
printk(KERN_CONT " - disabling initrd\n");
initrd_start = 0;
initrd_end = 0;
}
#else /* !CONFIG_BLK_DEV_INITRD */
static unsigned long __init init_initrd(void)
{
return 0;
}
#define finalize_initrd() do {} while (0)
#endif
/*
* Initialize the bootmem allocator. It also setup initrd related data
* if needed.
*/
#if defined(CONFIG_SGI_IP27) || (defined(CONFIG_CPU_LOONGSON64) && defined(CONFIG_NUMA))
static void __init bootmem_init(void)
{
init_initrd();
finalize_initrd();
}
#else /* !CONFIG_SGI_IP27 */
static void __init bootmem_init(void)
{
phys_addr_t ramstart, ramend;
unsigned long start, end;
int i;
ramstart = memblock_start_of_DRAM();
ramend = memblock_end_of_DRAM();
/*
* Sanity check any INITRD first. We don't take it into account
* for bootmem setup initially, rely on the end-of-kernel-code
* as our memory range starting point. Once bootmem is inited we
* will reserve the area used for the initrd.
*/
init_initrd();
/* Reserve memory occupied by kernel. */
memblock_reserve(__pa_symbol(&_text),
__pa_symbol(&_end) - __pa_symbol(&_text));
/* max_low_pfn is not a number of pages but the end pfn of low mem */
#ifdef CONFIG_MIPS_AUTO_PFN_OFFSET
ARCH_PFN_OFFSET = PFN_UP(ramstart);
#else
/*
* Reserve any memory between the start of RAM and PHYS_OFFSET
Annotation
- Immediate include surface: `linux/init.h`, `linux/cpu.h`, `linux/delay.h`, `linux/hex.h`, `linux/ioport.h`, `linux/export.h`, `linux/memblock.h`, `linux/initrd.h`.
- Detected declarations: `function detect_memory_region`, `function rd_start_early`, `function rd_size_early`, `function init_initrd`, `function maybe_bswap_initrd`, `function decompress_method`, `function finalize_initrd`, `function init_initrd`, `function bootmem_init`, `function bootmem_init`.
- Atlas domain: Architecture Layer / arch/mips.
- 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.