arch/powerpc/kernel/udbg.c
Source file repositories/reference/linux-study-clean/arch/powerpc/kernel/udbg.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/kernel/udbg.c- Extension
.c- Size
- 3778 bytes
- Lines
- 172
- 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/stdarg.hlinux/types.hlinux/sched.hlinux/console.hlinux/init.hasm/processor.hasm/udbg.h
Detected Declarations
function udbg_early_initfunction udbg_putsfunction udbg_writefunction udbg_printffunction udbg_progressfunction udbg_console_writefunction register_early_udbg_console
Annotated Snippet
if (s && *s != '\0') {
while ((c = *s++) != '\0')
udbg_putc(c);
}
if (udbg_flush)
udbg_flush();
}
#if 0
else {
printk("%s", s);
}
#endif
}
int udbg_write(const char *s, int n)
{
int remain = n;
char c;
if (!udbg_putc)
return 0;
if (s && *s != '\0') {
while (((c = *s++) != '\0') && (remain-- > 0)) {
udbg_putc(c);
}
}
if (udbg_flush)
udbg_flush();
return n - remain;
}
#define UDBG_BUFSIZE 256
void udbg_printf(const char *fmt, ...)
{
if (udbg_putc) {
char buf[UDBG_BUFSIZE];
va_list args;
va_start(args, fmt);
vsnprintf(buf, UDBG_BUFSIZE, fmt, args);
udbg_puts(buf);
va_end(args);
}
}
void __init udbg_progress(char *s, unsigned short hex)
{
udbg_puts(s);
udbg_puts("\n");
}
/*
* Early boot console based on udbg
*/
static void udbg_console_write(struct console *con, const char *s,
unsigned int n)
{
udbg_write(s, n);
}
static struct console udbg_console = {
.name = "udbg",
.write = udbg_console_write,
.flags = CON_PRINTBUFFER | CON_ENABLED | CON_BOOT | CON_ANYTIME,
.index = 0,
};
/*
* Called by setup_system after ppc_md->probe and ppc_md->early_init.
* Call it again after setting udbg_putc in ppc_md->setup_arch.
*/
void __init register_early_udbg_console(void)
{
if (early_console)
return;
if (!udbg_putc)
return;
if (strstr(boot_command_line, "udbg-immortal")) {
printk(KERN_INFO "early console immortal !\n");
udbg_console.flags &= ~CON_BOOT;
}
early_console = &udbg_console;
register_console(&udbg_console);
}
Annotation
- Immediate include surface: `linux/stdarg.h`, `linux/types.h`, `linux/sched.h`, `linux/console.h`, `linux/init.h`, `asm/processor.h`, `asm/udbg.h`.
- Detected declarations: `function udbg_early_init`, `function udbg_puts`, `function udbg_write`, `function udbg_printf`, `function udbg_progress`, `function udbg_console_write`, `function register_early_udbg_console`.
- 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.