diff options
-rw-r--r-- | arch/ppc64/kernel/setup.c | 32 | ||||
-rw-r--r-- | arch/ppc64/kernel/udbg.c | 51 | ||||
-rw-r--r-- | include/asm-ppc64/udbg.h | 6 |
3 files changed, 50 insertions, 39 deletions
diff --git a/arch/ppc64/kernel/setup.c b/arch/ppc64/kernel/setup.c index 059cca2e2538..aff408bffdd5 100644 --- a/arch/ppc64/kernel/setup.c +++ b/arch/ppc64/kernel/setup.c | |||
@@ -108,7 +108,6 @@ int boot_cpuid = 0; | |||
108 | int boot_cpuid_phys = 0; | 108 | int boot_cpuid_phys = 0; |
109 | dev_t boot_dev; | 109 | dev_t boot_dev; |
110 | u64 ppc64_pft_size; | 110 | u64 ppc64_pft_size; |
111 | u64 ppc64_debug_switch; | ||
112 | 111 | ||
113 | struct ppc64_caches ppc64_caches; | 112 | struct ppc64_caches ppc64_caches; |
114 | EXPORT_SYMBOL_GPL(ppc64_caches); | 113 | EXPORT_SYMBOL_GPL(ppc64_caches); |
@@ -154,34 +153,6 @@ struct screen_info screen_info = { | |||
154 | .orig_video_points = 16 | 153 | .orig_video_points = 16 |
155 | }; | 154 | }; |
156 | 155 | ||
157 | /* | ||
158 | * Initialize the PPCDBG state. Called before relocation has been enabled. | ||
159 | */ | ||
160 | void __init ppcdbg_initialize(void) | ||
161 | { | ||
162 | ppc64_debug_switch = PPC_DEBUG_DEFAULT; /* | PPCDBG_BUSWALK | */ | ||
163 | /* PPCDBG_PHBINIT | PPCDBG_MM | PPCDBG_MMINIT | PPCDBG_TCEINIT | PPCDBG_TCE */; | ||
164 | } | ||
165 | |||
166 | /* | ||
167 | * Early boot console based on udbg | ||
168 | */ | ||
169 | static struct console udbg_console = { | ||
170 | .name = "udbg", | ||
171 | .write = udbg_console_write, | ||
172 | .flags = CON_PRINTBUFFER, | ||
173 | .index = -1, | ||
174 | }; | ||
175 | static int early_console_initialized; | ||
176 | |||
177 | void __init disable_early_printk(void) | ||
178 | { | ||
179 | if (!early_console_initialized) | ||
180 | return; | ||
181 | unregister_console(&udbg_console); | ||
182 | early_console_initialized = 0; | ||
183 | } | ||
184 | |||
185 | #if defined(CONFIG_PPC_MULTIPLATFORM) && defined(CONFIG_SMP) | 156 | #if defined(CONFIG_PPC_MULTIPLATFORM) && defined(CONFIG_SMP) |
186 | 157 | ||
187 | static int smt_enabled_cmdline; | 158 | static int smt_enabled_cmdline; |
@@ -630,8 +601,7 @@ void __init setup_system(void) | |||
630 | /* | 601 | /* |
631 | * Register early console | 602 | * Register early console |
632 | */ | 603 | */ |
633 | early_console_initialized = 1; | 604 | register_early_udbg_console(); |
634 | register_console(&udbg_console); | ||
635 | 605 | ||
636 | /* Save unparsed command line copy for /proc/cmdline */ | 606 | /* Save unparsed command line copy for /proc/cmdline */ |
637 | strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE); | 607 | strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE); |
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); | |||
21 | unsigned char (*udbg_getc)(void); | 22 | unsigned char (*udbg_getc)(void); |
22 | int (*udbg_getc_poll)(void); | 23 | int (*udbg_getc_poll)(void); |
23 | 24 | ||
25 | /* udbg library, used by xmon et al */ | ||
24 | void udbg_puts(const char *s) | 26 | void 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 | ||
78 | void 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 |
84 | void udbg_printf(const char *fmt, ...) | 81 | void 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 | |||
94 | u64 ppc64_debug_switch; | ||
95 | |||
95 | /* Special print used by PPCDBG() macro */ | 96 | /* Special print used by PPCDBG() macro */ |
96 | void udbg_ppcdbg(unsigned long debug_flags, const char *fmt, ...) | 97 | void 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 | */ | ||
139 | void __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 | */ | ||
148 | static void udbg_console_write(struct console *con, const char *s, | ||
149 | unsigned int n) | ||
150 | { | ||
151 | udbg_write(s, n); | ||
152 | } | ||
153 | |||
154 | static struct console udbg_console = { | ||
155 | .name = "udbg", | ||
156 | .write = udbg_console_write, | ||
157 | .flags = CON_PRINTBUFFER, | ||
158 | .index = -1, | ||
159 | }; | ||
160 | |||
161 | void __init disable_early_printk(void) | ||
162 | { | ||
163 | unregister_console(&udbg_console); | ||
164 | } | ||
165 | |||
166 | /* called by setup_system */ | ||
167 | void 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 */ | ||
173 | console_initcall(register_udbg_console); | ||
174 | #endif | ||
diff --git a/include/asm-ppc64/udbg.h b/include/asm-ppc64/udbg.h index 2cf1e87fd7d2..c786604aef02 100644 --- a/include/asm-ppc64/udbg.h +++ b/include/asm-ppc64/udbg.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __UDBG_HDR | 2 | #define __UDBG_HDR |
3 | 3 | ||
4 | #include <linux/compiler.h> | 4 | #include <linux/compiler.h> |
5 | #include <linux/init.h> | ||
5 | 6 | ||
6 | /* | 7 | /* |
7 | * c 2001 PPC 64 Team, IBM Corp | 8 | * c 2001 PPC 64 Team, IBM Corp |
@@ -20,12 +21,11 @@ extern void udbg_puts(const char *s); | |||
20 | extern int udbg_write(const char *s, int n); | 21 | extern int udbg_write(const char *s, int n); |
21 | extern int udbg_read(char *buf, int buflen); | 22 | extern int udbg_read(char *buf, int buflen); |
22 | 23 | ||
23 | struct console; | 24 | extern void register_early_udbg_console(void); |
24 | extern void udbg_console_write(struct console *con, const char *s, unsigned int n); | ||
25 | extern void udbg_printf(const char *fmt, ...); | 25 | extern void udbg_printf(const char *fmt, ...); |
26 | extern void udbg_ppcdbg(unsigned long flags, const char *fmt, ...); | 26 | extern void udbg_ppcdbg(unsigned long flags, const char *fmt, ...); |
27 | extern unsigned long udbg_ifdebug(unsigned long flags); | 27 | extern unsigned long udbg_ifdebug(unsigned long flags); |
28 | 28 | extern void __init ppcdbg_initialize(void); | |
29 | 29 | ||
30 | extern void udbg_init_uart(void __iomem *comport, unsigned int speed); | 30 | extern void udbg_init_uart(void __iomem *comport, unsigned int speed); |
31 | #endif | 31 | #endif |