arch/sparc/kernel/setup_32.c
Source file repositories/reference/linux-study-clean/arch/sparc/kernel/setup_32.c
File Facts
- System
- Linux kernel
- Corpus path
arch/sparc/kernel/setup_32.c- Extension
.c- Size
- 8927 bytes
- Lines
- 409
- Domain
- Architecture Layer
- Bucket
- arch/sparc
- 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/errno.hlinux/sched.hlinux/kernel.hlinux/mm.hlinux/stddef.hlinux/unistd.hlinux/ptrace.hlinux/slab.hlinux/initrd.hasm/smp.hlinux/user.hlinux/delay.hlinux/fs.hlinux/seq_file.hlinux/syscalls.hlinux/kdev_t.hlinux/major.hlinux/string.hlinux/init.hlinux/interrupt.hlinux/console.hlinux/spinlock.hlinux/root_dev.hlinux/cpu.hlinux/kdebug.hlinux/export.hlinux/start_kernel.huapi/linux/mount.hasm/io.hasm/processor.hasm/oplib.hasm/page.h
Detected Declarations
struct cpuid_patch_entrystruct leon_1insn_patch_entryfunction Copyrightfunction prom_console_writefunction process_switchfunction boot_flags_initfunction per_cpu_patchfunction leon_patchfunction sparc32_start_kernelfunction setup_archfunction sun_do_breakfunction topology_initfunction arch_cpu_finalize_initmodule init topology_initexport sparc_cpu_modelexport sun_do_break
Annotated Snippet
#include <linux/start_kernel.h>
#include <uapi/linux/mount.h>
#include <asm/io.h>
#include <asm/processor.h>
#include <asm/oplib.h>
#include <asm/page.h>
#include <asm/traps.h>
#include <asm/vaddrs.h>
#include <asm/mbus.h>
#include <asm/idprom.h>
#include <asm/cpudata.h>
#include <asm/setup.h>
#include <asm/cacheflush.h>
#include <asm/sections.h>
#include "kernel.h"
/* Typing sync at the prom prompt calls the function pointed to by
* romvec->pv_synchook which I set to the following function.
* This should sync all filesystems and return, for now it just
* prints out pretty messages and returns.
*/
/* Pretty sick eh? */
static void prom_sync_me(void)
{
unsigned long prom_tbr, flags;
/* XXX Badly broken. FIX! - Anton */
local_irq_save(flags);
__asm__ __volatile__("rd %%tbr, %0\n\t" : "=r" (prom_tbr));
__asm__ __volatile__("wr %0, 0x0, %%tbr\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t" : : "r" (&trapbase[0]));
prom_printf("PROM SYNC COMMAND...\n");
show_mem();
if (!is_idle_task(current)) {
local_irq_enable();
ksys_sync();
local_irq_disable();
}
prom_printf("Returning to prom\n");
__asm__ __volatile__("wr %0, 0x0, %%tbr\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t" : : "r" (prom_tbr));
local_irq_restore(flags);
}
static unsigned int boot_flags __initdata = 0;
#define BOOTME_DEBUG 0x1
/* Exported for mm/init.c:paging_init. */
unsigned long cmdline_memory_size __initdata = 0;
/* which CPU booted us (0xff = not set) */
unsigned char boot_cpu_id = 0xff; /* 0xff will make it into DATA section... */
static void
prom_console_write(struct console *con, const char *s, unsigned int n)
{
prom_write(s, n);
}
static struct console prom_early_console = {
.name = "earlyprom",
.write = prom_console_write,
.flags = CON_PRINTBUFFER | CON_BOOT,
.index = -1,
};
/*
* Process kernel command line switches that are specific to the
* SPARC or that require special low-level processing.
*/
static void __init process_switch(char c)
{
switch (c) {
case 'd':
boot_flags |= BOOTME_DEBUG;
break;
case 's':
break;
case 'h':
prom_printf("boot_flags_init: Halt!\n");
prom_halt();
Annotation
- Immediate include surface: `linux/errno.h`, `linux/sched.h`, `linux/kernel.h`, `linux/mm.h`, `linux/stddef.h`, `linux/unistd.h`, `linux/ptrace.h`, `linux/slab.h`.
- Detected declarations: `struct cpuid_patch_entry`, `struct leon_1insn_patch_entry`, `function Copyright`, `function prom_console_write`, `function process_switch`, `function boot_flags_init`, `function per_cpu_patch`, `function leon_patch`, `function sparc32_start_kernel`, `function setup_arch`.
- Atlas domain: Architecture Layer / arch/sparc.
- 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.