aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64/kernel/udbg.c
diff options
context:
space:
mode:
authorMilton Miller <miltonm@bga.com>2005-09-05 21:57:27 -0400
committerPaul Mackerras <paulus@samba.org>2005-09-06 02:07:37 -0400
commit8d9273918635f0301368c01b56c03a6f339e8d51 (patch)
treefbb3e266588e19bbdaf6a1af470d0a97d6373f67 /arch/ppc64/kernel/udbg.c
parent188d2ce78feac67e41e41808acda7951810f677b (diff)
[PATCH] ppc64: Consolidate early console and PPCDBG code
Consolidate the early console and PPCDBG code in udbg.c Signed-off-by: Milton Miller <miltonm@bga.com> Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/ppc64/kernel/udbg.c')
-rw-r--r--arch/ppc64/kernel/udbg.c51
1 files changed, 46 insertions, 5 deletions
diff --git a/arch/ppc64/kernel/udbg.c b/arch/ppc64/kernel/udbg.c
index 07164020f3a9..ed6766e21f5a 100644
--- a/arch/ppc64/kernel/udbg.c
+++ b/arch/ppc64/kernel/udbg.c
@@ -14,6 +14,7 @@
14#include <linux/config.h> 14#include <linux/config.h>
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/console.h>
17#include <asm/ppcdebug.h> 18#include <asm/ppcdebug.h>
18#include <asm/processor.h> 19#include <asm/processor.h>
19 20
@@ -21,6 +22,7 @@ void (*udbg_putc)(unsigned char c);
21unsigned char (*udbg_getc)(void); 22unsigned char (*udbg_getc)(void);
22int (*udbg_getc_poll)(void); 23int (*udbg_getc_poll)(void);
23 24
25/* udbg library, used by xmon et al */
24void udbg_puts(const char *s) 26void udbg_puts(const char *s)
25{ 27{
26 if (udbg_putc) { 28 if (udbg_putc) {
@@ -75,11 +77,6 @@ int udbg_read(char *buf, int buflen)
75 return i; 77 return i;
76} 78}
77 79
78void udbg_console_write(struct console *con, const char *s, unsigned int n)
79{
80 udbg_write(s, n);
81}
82
83#define UDBG_BUFSIZE 256 80#define UDBG_BUFSIZE 256
84void udbg_printf(const char *fmt, ...) 81void udbg_printf(const char *fmt, ...)
85{ 82{
@@ -92,6 +89,10 @@ void udbg_printf(const char *fmt, ...)
92 va_end(args); 89 va_end(args);
93} 90}
94 91
92/* PPCDBG stuff */
93
94u64 ppc64_debug_switch;
95
95/* Special print used by PPCDBG() macro */ 96/* Special print used by PPCDBG() macro */
96void udbg_ppcdbg(unsigned long debug_flags, const char *fmt, ...) 97void udbg_ppcdbg(unsigned long debug_flags, const char *fmt, ...)
97{ 98{
@@ -131,3 +132,43 @@ unsigned long udbg_ifdebug(unsigned long flags)
131{ 132{
132 return (flags & ppc64_debug_switch); 133 return (flags & ppc64_debug_switch);
133} 134}
135
136/*
137 * Initialize the PPCDBG state. Called before relocation has been enabled.
138 */
139void __init ppcdbg_initialize(void)
140{
141 ppc64_debug_switch = PPC_DEBUG_DEFAULT; /* | PPCDBG_BUSWALK | */
142 /* PPCDBG_PHBINIT | PPCDBG_MM | PPCDBG_MMINIT | PPCDBG_TCEINIT | PPCDBG_TCE */;
143}
144
145/*
146 * Early boot console based on udbg
147 */
148static void udbg_console_write(struct console *con, const char *s,
149 unsigned int n)
150{
151 udbg_write(s, n);
152}
153
154static struct console udbg_console = {
155 .name = "udbg",
156 .write = udbg_console_write,
157 .flags = CON_PRINTBUFFER,
158 .index = -1,
159};
160
161void __init disable_early_printk(void)
162{
163 unregister_console(&udbg_console);
164}
165
166/* called by setup_system */
167void register_early_udbg_console(void)
168{
169 register_console(&udbg_console);
170}
171
172#if 0 /* if you want to use this as a regular output console */
173console_initcall(register_udbg_console);
174#endif