Commit 8d927391 authored by Milton Miller's avatar Milton Miller Committed by Paul Mackerras

[PATCH] ppc64: Consolidate early console and PPCDBG code

Consolidate the early console and PPCDBG code in udbg.c
Signed-off-by: default avatarMilton Miller <miltonm@bga.com>
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 188d2ce7
...@@ -108,7 +108,6 @@ int boot_cpuid = 0; ...@@ -108,7 +108,6 @@ int boot_cpuid = 0;
int boot_cpuid_phys = 0; int boot_cpuid_phys = 0;
dev_t boot_dev; dev_t boot_dev;
u64 ppc64_pft_size; u64 ppc64_pft_size;
u64 ppc64_debug_switch;
struct ppc64_caches ppc64_caches; struct ppc64_caches ppc64_caches;
EXPORT_SYMBOL_GPL(ppc64_caches); EXPORT_SYMBOL_GPL(ppc64_caches);
...@@ -154,34 +153,6 @@ struct screen_info screen_info = { ...@@ -154,34 +153,6 @@ struct screen_info screen_info = {
.orig_video_points = 16 .orig_video_points = 16
}; };
/*
* Initialize the PPCDBG state. Called before relocation has been enabled.
*/
void __init ppcdbg_initialize(void)
{
ppc64_debug_switch = PPC_DEBUG_DEFAULT; /* | PPCDBG_BUSWALK | */
/* PPCDBG_PHBINIT | PPCDBG_MM | PPCDBG_MMINIT | PPCDBG_TCEINIT | PPCDBG_TCE */;
}
/*
* Early boot console based on udbg
*/
static struct console udbg_console = {
.name = "udbg",
.write = udbg_console_write,
.flags = CON_PRINTBUFFER,
.index = -1,
};
static int early_console_initialized;
void __init disable_early_printk(void)
{
if (!early_console_initialized)
return;
unregister_console(&udbg_console);
early_console_initialized = 0;
}
#if defined(CONFIG_PPC_MULTIPLATFORM) && defined(CONFIG_SMP) #if defined(CONFIG_PPC_MULTIPLATFORM) && defined(CONFIG_SMP)
static int smt_enabled_cmdline; static int smt_enabled_cmdline;
...@@ -630,8 +601,7 @@ void __init setup_system(void) ...@@ -630,8 +601,7 @@ void __init setup_system(void)
/* /*
* Register early console * Register early console
*/ */
early_console_initialized = 1; register_early_udbg_console();
register_console(&udbg_console);
/* Save unparsed command line copy for /proc/cmdline */ /* Save unparsed command line copy for /proc/cmdline */
strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE); strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE);
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/console.h>
#include <asm/ppcdebug.h> #include <asm/ppcdebug.h>
#include <asm/processor.h> #include <asm/processor.h>
...@@ -21,6 +22,7 @@ void (*udbg_putc)(unsigned char c); ...@@ -21,6 +22,7 @@ void (*udbg_putc)(unsigned char c);
unsigned char (*udbg_getc)(void); unsigned char (*udbg_getc)(void);
int (*udbg_getc_poll)(void); int (*udbg_getc_poll)(void);
/* udbg library, used by xmon et al */
void udbg_puts(const char *s) void udbg_puts(const char *s)
{ {
if (udbg_putc) { if (udbg_putc) {
...@@ -75,11 +77,6 @@ int udbg_read(char *buf, int buflen) ...@@ -75,11 +77,6 @@ int udbg_read(char *buf, int buflen)
return i; return i;
} }
void udbg_console_write(struct console *con, const char *s, unsigned int n)
{
udbg_write(s, n);
}
#define UDBG_BUFSIZE 256 #define UDBG_BUFSIZE 256
void udbg_printf(const char *fmt, ...) void udbg_printf(const char *fmt, ...)
{ {
...@@ -92,6 +89,10 @@ void udbg_printf(const char *fmt, ...) ...@@ -92,6 +89,10 @@ void udbg_printf(const char *fmt, ...)
va_end(args); va_end(args);
} }
/* PPCDBG stuff */
u64 ppc64_debug_switch;
/* Special print used by PPCDBG() macro */ /* Special print used by PPCDBG() macro */
void udbg_ppcdbg(unsigned long debug_flags, const char *fmt, ...) void udbg_ppcdbg(unsigned long debug_flags, const char *fmt, ...)
{ {
...@@ -131,3 +132,43 @@ unsigned long udbg_ifdebug(unsigned long flags) ...@@ -131,3 +132,43 @@ unsigned long udbg_ifdebug(unsigned long flags)
{ {
return (flags & ppc64_debug_switch); return (flags & ppc64_debug_switch);
} }
/*
* Initialize the PPCDBG state. Called before relocation has been enabled.
*/
void __init ppcdbg_initialize(void)
{
ppc64_debug_switch = PPC_DEBUG_DEFAULT; /* | PPCDBG_BUSWALK | */
/* PPCDBG_PHBINIT | PPCDBG_MM | PPCDBG_MMINIT | PPCDBG_TCEINIT | PPCDBG_TCE */;
}
/*
* 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,
.index = -1,
};
void __init disable_early_printk(void)
{
unregister_console(&udbg_console);
}
/* called by setup_system */
void register_early_udbg_console(void)
{
register_console(&udbg_console);
}
#if 0 /* if you want to use this as a regular output console */
console_initcall(register_udbg_console);
#endif
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define __UDBG_HDR #define __UDBG_HDR
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/init.h>
/* /*
* c 2001 PPC 64 Team, IBM Corp * c 2001 PPC 64 Team, IBM Corp
...@@ -20,12 +21,11 @@ extern void udbg_puts(const char *s); ...@@ -20,12 +21,11 @@ extern void udbg_puts(const char *s);
extern int udbg_write(const char *s, int n); extern int udbg_write(const char *s, int n);
extern int udbg_read(char *buf, int buflen); extern int udbg_read(char *buf, int buflen);
struct console; extern void register_early_udbg_console(void);
extern void udbg_console_write(struct console *con, const char *s, unsigned int n);
extern void udbg_printf(const char *fmt, ...); extern void udbg_printf(const char *fmt, ...);
extern void udbg_ppcdbg(unsigned long flags, const char *fmt, ...); extern void udbg_ppcdbg(unsigned long flags, const char *fmt, ...);
extern unsigned long udbg_ifdebug(unsigned long flags); extern unsigned long udbg_ifdebug(unsigned long flags);
extern void __init ppcdbg_initialize(void);
extern void udbg_init_uart(void __iomem *comport, unsigned int speed); extern void udbg_init_uart(void __iomem *comport, unsigned int speed);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment