arch/mips/generic/init.c
Source file repositories/reference/linux-study-clean/arch/mips/generic/init.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/generic/init.c- Extension
.c- Size
- 4172 bytes
- Lines
- 205
- Domain
- Architecture Layer
- Bucket
- arch/mips
- 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/clk.hlinux/clocksource.hlinux/init.hlinux/irqchip.hlinux/of_clk.hlinux/of_fdt.hasm/bootinfo.hasm/fw/fw.hasm/irq_cpu.hasm/machine.hasm/mips-cps.hasm/prom.hasm/smp-ops.hasm/time.h
Detected Declarations
function prom_initfunction for_each_mips_machinefunction for_each_mips_machinefunction plat_fdt_relocatedfunction plat_mem_setupfunction device_tree_initfunction apply_mips_fdt_fixupsfunction plat_time_initfunction arch_init_irq
Annotated Snippet
for_each_mips_machine(check_mach) {
match = mips_machine_is_compatible(check_mach, fdt);
if (match) {
mach = check_mach;
mach_match_data = match->data;
break;
}
}
} else if (IS_ENABLED(CONFIG_LEGACY_BOARDS)) {
/*
* We weren't booted using the UHI boot protocol, but do
* support some number of boards with legacy boot protocols.
* Attempt to find the right one.
*/
for_each_mips_machine(check_mach) {
if (!check_mach->detect)
continue;
if (!check_mach->detect())
continue;
mach = check_mach;
}
/*
* If we don't recognise the machine then we can't continue, so
* die here.
*/
BUG_ON(!mach);
/* Retrieve the machine's FDT */
fdt = mach->fdt;
}
return (void *)fdt;
}
#ifdef CONFIG_RELOCATABLE
void __init plat_fdt_relocated(void *new_location)
{
/*
* reset fdt as the cached value would point to the location
* before relocations happened and update the location argument
* if it was passed using UHI
*/
fdt = NULL;
if (fw_arg0 == -2)
fw_arg1 = (unsigned long)new_location;
}
#endif /* CONFIG_RELOCATABLE */
void __init plat_mem_setup(void)
{
if (mach && mach->fixup_fdt)
fdt = mach->fixup_fdt(fdt, mach_match_data);
fw_init_cmdline();
__dt_setup_arch((void *)fdt);
}
void __init device_tree_init(void)
{
unflatten_and_copy_device_tree();
mips_cpc_probe();
if (!register_cps_smp_ops())
return;
if (!register_vsmp_smp_ops())
return;
register_up_smp_ops();
}
int __init apply_mips_fdt_fixups(void *fdt_out, size_t fdt_out_size,
const void *fdt_in,
const struct mips_fdt_fixup *fixups)
{
int err;
err = fdt_open_into(fdt_in, fdt_out, fdt_out_size);
if (err) {
pr_err("Failed to open FDT\n");
return err;
}
for (; fixups->apply; fixups++) {
err = fixups->apply(fdt_out);
if (err) {
Annotation
- Immediate include surface: `linux/clk.h`, `linux/clocksource.h`, `linux/init.h`, `linux/irqchip.h`, `linux/of_clk.h`, `linux/of_fdt.h`, `asm/bootinfo.h`, `asm/fw/fw.h`.
- Detected declarations: `function prom_init`, `function for_each_mips_machine`, `function for_each_mips_machine`, `function plat_fdt_relocated`, `function plat_mem_setup`, `function device_tree_init`, `function apply_mips_fdt_fixups`, `function plat_time_init`, `function arch_init_irq`.
- Atlas domain: Architecture Layer / arch/mips.
- 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.