arch/arc/kernel/setup.c
Source file repositories/reference/linux-study-clean/arch/arc/kernel/setup.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arc/kernel/setup.c- Extension
.c- Size
- 16514 bytes
- Lines
- 655
- Domain
- Architecture Layer
- Bucket
- arch/arc
- 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/seq_file.hlinux/fs.hlinux/delay.hlinux/root_dev.hlinux/clk.hlinux/clocksource.hlinux/console.hlinux/module.hlinux/sizes.hlinux/cpu.hlinux/of_clk.hlinux/of_fdt.hlinux/of.hlinux/cache.huapi/linux/mount.hasm/sections.hasm/arcregs.hasm/asserts.hasm/tlb.hasm/setup.hasm/page.hasm/irq.hasm/unwind.hasm/mach_desc.hasm/smp.hasm/dsp-impl.hsoc/arc/mcip.h
Detected Declarations
struct cpuinfo_arcfunction arcompact_mumbojumbofunction arcv2_mumbojumbofunction chk_opt_strictfunction chk_opt_weakfunction arc_chk_core_configfunction setup_processorfunction uboot_arg_invalidfunction handle_uboot_argsfunction setup_archfunction start_kernelfunction customize_machinefunction init_late_machinefunction show_cpuinfofunction c_stopfunction topology_initmodule init topology_init
Annotated Snippet
* Called from start_kernel() - boot CPU only
*/
void __init time_init(void)
{
of_clk_init(NULL);
timer_probe();
}
static int __init customize_machine(void)
{
if (machine_desc->init_machine)
machine_desc->init_machine();
return 0;
}
arch_initcall(customize_machine);
static int __init init_late_machine(void)
{
if (machine_desc->init_late)
machine_desc->init_late();
return 0;
}
late_initcall(init_late_machine);
/*
* Get CPU information for use by the procfs.
*/
#define cpu_to_ptr(c) ((void *)(0xFFFF0000 | (unsigned int)(c)))
#define ptr_to_cpu(p) (~0xFFFF0000UL & (unsigned int)(p))
static int show_cpuinfo(struct seq_file *m, void *v)
{
char *str;
int cpu_id = ptr_to_cpu(v);
struct device *cpu_dev = get_cpu_device(cpu_id);
struct cpuinfo_arc info;
struct clk *cpu_clk;
unsigned long freq = 0;
if (!cpu_online(cpu_id)) {
seq_printf(m, "processor [%d]\t: Offline\n", cpu_id);
goto done;
}
str = (char *)__get_free_page(GFP_KERNEL);
if (!str)
goto done;
seq_printf(m, arc_cpu_mumbojumbo(cpu_id, &info, str, PAGE_SIZE));
cpu_clk = clk_get(cpu_dev, NULL);
if (IS_ERR(cpu_clk)) {
seq_printf(m, "CPU speed \t: Cannot get clock for processor [%d]\n",
cpu_id);
} else {
freq = clk_get_rate(cpu_clk);
}
if (freq)
seq_printf(m, "CPU speed\t: %lu.%02lu Mhz\n",
freq / 1000000, (freq / 10000) % 100);
seq_printf(m, "Bogo MIPS\t: %lu.%02lu\n",
loops_per_jiffy / (500000 / HZ),
(loops_per_jiffy / (5000 / HZ)) % 100);
seq_printf(m, arc_platform_smp_cpuinfo());
free_page((unsigned long)str);
done:
seq_printf(m, "\n");
return 0;
}
static void *c_start(struct seq_file *m, loff_t *pos)
{
/*
* Callback returns cpu-id to iterator for show routine, NULL to stop.
* However since NULL is also a valid cpu-id (0), we use a round-about
* way to pass it w/o having to kmalloc/free a 2 byte string.
* Encode cpu-id as 0xFFcccc, which is decoded by show routine.
*/
return *pos < nr_cpu_ids ? cpu_to_ptr(*pos) : NULL;
}
static void *c_next(struct seq_file *m, void *v, loff_t *pos)
{
++*pos;
Annotation
- Immediate include surface: `linux/seq_file.h`, `linux/fs.h`, `linux/delay.h`, `linux/root_dev.h`, `linux/clk.h`, `linux/clocksource.h`, `linux/console.h`, `linux/module.h`.
- Detected declarations: `struct cpuinfo_arc`, `function arcompact_mumbojumbo`, `function arcv2_mumbojumbo`, `function chk_opt_strict`, `function chk_opt_weak`, `function arc_chk_core_config`, `function setup_processor`, `function uboot_arg_invalid`, `function handle_uboot_args`, `function setup_arch`.
- Atlas domain: Architecture Layer / arch/arc.
- 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.