cregit-Linux how code gets into the kernel

Release 4.14 arch/powerpc/kernel/udbg.c

/*
 * polling mode stateless debugging stuff, originally for NS16550 Serial Ports
 *
 * c 2001 PPC 64 Team, IBM Corp
 *
 *      This program is free software; you can redistribute it and/or
 *      modify it under the terms of the GNU General Public License
 *      as published by the Free Software Foundation; either version
 *      2 of the License, or (at your option) any later version.
 */

#include <stdarg.h>
#include <linux/types.h>
#include <linux/sched.h>
#include <linux/console.h>
#include <linux/init.h>
#include <asm/processor.h>
#include <asm/udbg.h>


void (*udbg_putc)(char c);

void (*udbg_flush)(void);

int (*udbg_getc)(void);

int (*udbg_getc_poll)(void);

/*
 * Early debugging facilities. You can enable _one_ of these via .config,
 * if you do so your kernel _will not boot_ on anything else. Be careful.
 */

void __init udbg_early_init(void) { #if defined(CONFIG_PPC_EARLY_DEBUG_LPAR) /* For LPAR machines that have an HVC console on vterm 0 */ udbg_init_debug_lpar(); #elif defined(CONFIG_PPC_EARLY_DEBUG_LPAR_HVSI) /* For LPAR machines that have an HVSI console on vterm 0 */ udbg_init_debug_lpar_hvsi(); #elif defined(CONFIG_PPC_EARLY_DEBUG_G5) /* For use on Apple G5 machines */ udbg_init_pmac_realmode(); #elif defined(CONFIG_PPC_EARLY_DEBUG_RTAS_PANEL) /* RTAS panel debug */ udbg_init_rtas_panel(); #elif defined(CONFIG_PPC_EARLY_DEBUG_RTAS_CONSOLE) /* RTAS console debug */ udbg_init_rtas_console(); #elif defined(CONFIG_PPC_EARLY_DEBUG_MAPLE) /* Maple real mode debug */ udbg_init_maple_realmode(); #elif defined(CONFIG_PPC_EARLY_DEBUG_PAS_REALMODE) udbg_init_pas_realmode(); #elif defined(CONFIG_PPC_EARLY_DEBUG_BOOTX) udbg_init_btext(); #elif defined(CONFIG_PPC_EARLY_DEBUG_44x) /* PPC44x debug */ udbg_init_44x_as1(); #elif defined(CONFIG_PPC_EARLY_DEBUG_40x) /* PPC40x debug */ udbg_init_40x_realmode(); #elif defined(CONFIG_PPC_EARLY_DEBUG_CPM) udbg_init_cpm(); #elif defined(CONFIG_PPC_EARLY_DEBUG_USBGECKO) udbg_init_usbgecko(); #elif defined(CONFIG_PPC_EARLY_DEBUG_MEMCONS) /* In memory console */ udbg_init_memcons(); #elif defined(CONFIG_PPC_EARLY_DEBUG_EHV_BC) udbg_init_ehv_bc(); #elif defined(CONFIG_PPC_EARLY_DEBUG_PS3GELIC) udbg_init_ps3gelic(); #elif defined(CONFIG_PPC_EARLY_DEBUG_OPAL_RAW) udbg_init_debug_opal_raw(); #elif defined(CONFIG_PPC_EARLY_DEBUG_OPAL_HVSI) udbg_init_debug_opal_hvsi(); #endif #ifdef CONFIG_PPC_EARLY_DEBUG console_loglevel = 10; register_early_udbg_console(); #endif }

Contributors

PersonTokensPropCommitsCommitProp
Michael Ellerman6032.61%211.11%
Benjamin Herrenschmidt5027.17%527.78%
David Gibson189.78%211.11%
Alistair Popple115.98%211.11%
Scott Wood94.89%15.56%
Olof Johansson94.89%15.56%
Albert Herranz94.89%15.56%
Timur Tabi63.26%15.56%
Hector Martin52.72%15.56%
Linus Torvalds42.17%15.56%
Jack Miller31.63%15.56%
Total184100.00%18100.00%

/* udbg library, used by xmon et al */
void udbg_puts(const char *s) { if (udbg_putc) { char c; if (s && *s != '\0') { while ((c = *s++) != '\0') udbg_putc(c); } if (udbg_flush) udbg_flush(); } #if 0 else { printk("%s", s); } #endif }

Contributors

PersonTokensPropCommitsCommitProp
Anton Blanchard4778.33%250.00%
Andrew Klossner711.67%125.00%
Benjamin Herrenschmidt610.00%125.00%
Total60100.00%4100.00%


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; }

Contributors

PersonTokensPropCommitsCommitProp
Anton Blanchard7087.50%250.00%
Andrew Klossner78.75%125.00%
Andrew Morton33.75%125.00%
Total80100.00%4100.00%

#define UDBG_BUFSIZE 256
void udbg_printf(const char *fmt, ...) { char buf[UDBG_BUFSIZE]; va_list args; va_start(args, fmt); vsnprintf(buf, UDBG_BUFSIZE, fmt, args); udbg_puts(buf); va_end(args); }

Contributors

PersonTokensPropCommitsCommitProp
Anton Blanchard49100.00%2100.00%
Total49100.00%2100.00%


void __init udbg_progress(char *s, unsigned short hex) { udbg_puts(s); udbg_puts("\n"); }

Contributors

PersonTokensPropCommitsCommitProp
Kumar Gala24100.00%1100.00%
Total24100.00%1100.00%

/* * Early boot console based on udbg */
static void udbg_console_write(struct console *con, const char *s, unsigned int n) { udbg_write(s, n); }

Contributors

PersonTokensPropCommitsCommitProp
Milton D. Miller II27100.00%1100.00%
Total27100.00%1100.00%

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); }

Contributors

PersonTokensPropCommitsCommitProp
Milton D. Miller II2037.04%225.00%
Benjamin Herrenschmidt1527.78%112.50%
Stephen Rothwell712.96%112.50%
Gerd Hoffmann611.11%112.50%
Thomas Gleixner47.41%112.50%
Alon Bar-Lev11.85%112.50%
Kumar Gala11.85%112.50%
Total54100.00%8100.00%

#if 0 /* if you want to use this as a regular output console */ console_initcall(register_udbg_console); #endif

Overall Contributors

PersonTokensPropCommitsCommitProp
Anton Blanchard17730.26%37.32%
Milton D. Miller II11619.83%512.20%
Benjamin Herrenschmidt8013.68%1024.39%
Michael Ellerman6711.45%49.76%
Kumar Gala254.27%24.88%
Andrew Klossner233.93%12.44%
David Gibson183.08%24.88%
Alistair Popple111.88%24.88%
Albert Herranz91.54%12.44%
Scott Wood91.54%12.44%
Olof Johansson91.54%12.44%
Gerd Hoffmann81.37%12.44%
Stephen Rothwell71.20%12.44%
Timur Tabi61.03%12.44%
Hector Martin50.85%12.44%
Thomas Gleixner40.68%12.44%
Linus Torvalds40.68%12.44%
Andrew Morton30.51%12.44%
Jack Miller30.51%12.44%
Alon Bar-Lev10.17%12.44%
Total585100.00%41100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.