arch/powerpc/platforms/powermac/bootx_init.c
Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/powermac/bootx_init.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/platforms/powermac/bootx_init.c- Extension
.c- Size
- 16643 bytes
- Lines
- 596
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- 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/kernel.hlinux/string.hlinux/init.hlinux/of_fdt.hgenerated/utsrelease.hasm/sections.hasm/prom.hasm/page.hasm/bootx.hasm/btext.hasm/io.hasm/setup.h
Detected Declarations
function bootx_printffunction bootx_printffunction bootx_dt_find_stringfunction bootx_dt_add_propfunction bootx_add_chosen_propsfunction bootx_add_display_propsfunction bootx_dt_add_stringfunction bootx_scan_dt_build_stringsfunction bootx_scan_dt_build_structfunction bootx_flatten_dtfunction btext_welcomefunction bootx_init
Annotated Snippet
if (*q == '\n') {
++q;
btext_flushline();
btext_drawstring("\r\n");
btext_flushline();
continue;
}
++q;
if (*q == 0)
break;
switch (*q) {
case 's':
++q;
s = va_arg(args, const char *);
if (s == NULL)
s = "<NULL>";
btext_drawstring(s);
break;
case 'x':
++q;
v = va_arg(args, unsigned long);
btext_drawhex(v);
break;
}
}
va_end(args);
}
#else /* CONFIG_BOOTX_TEXT */
static void __init bootx_printf(const char *format, ...) {}
#endif /* CONFIG_BOOTX_TEXT */
static void * __init bootx_early_getprop(unsigned long base,
unsigned long node,
char *prop)
{
struct bootx_dt_node *np = (struct bootx_dt_node *)(base + node);
u32 *ppp = &np->properties;
while(*ppp) {
struct bootx_dt_prop *pp =
(struct bootx_dt_prop *)(base + *ppp);
if (strcmp((char *)((unsigned long)pp->name + base),
prop) == 0) {
return (void *)((unsigned long)pp->value + base);
}
ppp = &pp->next;
}
return NULL;
}
#define dt_push_token(token, mem) \
do { \
*(mem) = ALIGN(*(mem),4); \
*((u32 *)*(mem)) = token; \
*(mem) += 4; \
} while(0)
static unsigned long __init bootx_dt_find_string(char *str)
{
char *s, *os;
s = os = (char *)bootx_dt_strbase;
s += 4;
while (s < (char *)bootx_dt_strend) {
if (strcmp(s, str) == 0)
return s - os;
s += strlen(s) + 1;
}
return 0;
}
static void __init bootx_dt_add_prop(char *name, void *data, int size,
unsigned long *mem_end)
{
unsigned long soff = bootx_dt_find_string(name);
if (data == NULL)
size = 0;
if (soff == 0) {
bootx_printf("WARNING: Can't find string index for <%s>\n",
name);
return;
}
if (size > 0x20000) {
bootx_printf("WARNING: ignoring large property ");
bootx_printf("%s length 0x%x\n", name, size);
return;
}
dt_push_token(OF_DT_PROP, mem_end);
dt_push_token(size, mem_end);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/string.h`, `linux/init.h`, `linux/of_fdt.h`, `generated/utsrelease.h`, `asm/sections.h`, `asm/prom.h`, `asm/page.h`.
- Detected declarations: `function bootx_printf`, `function bootx_printf`, `function bootx_dt_find_string`, `function bootx_dt_add_prop`, `function bootx_add_chosen_props`, `function bootx_add_display_props`, `function bootx_dt_add_string`, `function bootx_scan_dt_build_strings`, `function bootx_scan_dt_build_struct`, `function bootx_flatten_dt`.
- Atlas domain: Architecture Layer / arch/powerpc.
- 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.