arch/sparc/kernel/prom_32.c
Source file repositories/reference/linux-study-clean/arch/sparc/kernel/prom_32.c
File Facts
- System
- Linux kernel
- Corpus path
arch/sparc/kernel/prom_32.c- Extension
.c- Size
- 7440 bytes
- Lines
- 325
- Domain
- Architecture Layer
- Bucket
- arch/sparc
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/types.hlinux/string.hlinux/mm.hlinux/memblock.hasm/prom.hasm/oplib.hasm/leon.hasm/leon_amba.hprom.h
Detected Declarations
function Copyrightfunction sparc32_path_componentfunction sbus_path_componentfunction pci_path_componentfunction ebus_path_componentfunction ambapp_path_componentfunction __build_path_componentfunction build_path_componentfunction of_console_initfunction for_each_node_by_typefunction of_fill_in_cpu_data
Annotated Snippet
switch (*romvec->pv_stdout) {
case PROMDEV_SCREEN:
type = "display";
break;
case PROMDEV_TTYB:
skip = 1;
fallthrough;
case PROMDEV_TTYA:
type = "serial";
break;
default:
prom_printf("Invalid PROM_V0 stdout value %u\n",
*romvec->pv_stdout);
prom_halt();
}
tmp = skip;
for_each_node_by_type(dp, type) {
if (!tmp--)
break;
}
if (!dp) {
prom_printf("Cannot find PROM_V0 console node.\n");
prom_halt();
}
of_console_device = dp;
sprintf(of_console_path, "%pOF", dp);
if (!strcmp(type, "serial")) {
strcat(of_console_path,
(skip ? ":b" : ":a"));
}
break;
default:
case PROM_V2:
case PROM_V3:
fd = *romvec->pv_v2bootargs.fd_stdout;
spin_lock_irqsave(&prom_lock, flags);
node = (*romvec->pv_v2devops.v2_inst2pkg)(fd);
restore_current();
spin_unlock_irqrestore(&prom_lock, flags);
if (!node) {
prom_printf("Cannot resolve stdout node from "
"instance %08x.\n", fd);
prom_halt();
}
dp = of_find_node_by_phandle(node);
if (!of_node_is_type(dp, "display") &&
!of_node_is_type(dp, "serial")) {
prom_printf("Console device_type is neither display "
"nor serial.\n");
prom_halt();
}
of_console_device = dp;
if (prom_vers == PROM_V2) {
sprintf(of_console_path, "%pOF", dp);
switch (*romvec->pv_stdout) {
case PROMDEV_TTYA:
strcat(of_console_path, ":a");
break;
case PROMDEV_TTYB:
strcat(of_console_path, ":b");
break;
}
} else {
const char *path;
dp = of_find_node_by_path("/");
path = of_get_property(dp, "stdout-path", NULL);
if (!path) {
prom_printf("No stdout-path in root node.\n");
prom_halt();
}
strscpy(of_console_path, path, of_console_path_sz);
}
break;
}
of_console_options = strrchr(of_console_path, ':');
if (of_console_options) {
of_console_options++;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/types.h`, `linux/string.h`, `linux/mm.h`, `linux/memblock.h`, `asm/prom.h`, `asm/oplib.h`, `asm/leon.h`.
- Detected declarations: `function Copyright`, `function sparc32_path_component`, `function sbus_path_component`, `function pci_path_component`, `function ebus_path_component`, `function ambapp_path_component`, `function __build_path_component`, `function build_path_component`, `function of_console_init`, `function for_each_node_by_type`.
- Atlas domain: Architecture Layer / arch/sparc.
- Implementation status: source 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.