aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ppc64')
-rw-r--r--arch/ppc64/kernel/setup.c32
-rw-r--r--arch/ppc64/kernel/udbg.c51
2 files changed, 47 insertions, 36 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;
108int boot_cpuid_phys = 0; 108int boot_cpuid_phys = 0;
109dev_t boot_dev; 109dev_t boot_dev;
110u64 ppc64_pft_size; 110u64 ppc64_pft_size;
111u64 ppc64_debug_switch;
112 111
113struct ppc64_caches ppc64_caches; 112struct ppc64_caches ppc64_caches;
114EXPORT_SYMBOL_GPL(ppc64_caches); 113EXPORT_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 */
160void __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 */
169static struct console udbg_console = {
170 .name = "udbg",
171 .write = udbg_console_write,
172 .flags = CON_PRINTBUFFER,
173 .index = -1,
174};
175static int early_console_initialized;
176
177void __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
187static int smt_enabled_cmdline; 158static 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);
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