diff options
Diffstat (limited to 'arch/powerpc/kernel/udbg.c')
-rw-r--r-- | arch/powerpc/kernel/udbg.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c index 0d878e72fc44..558c1ceb2b93 100644 --- a/arch/powerpc/kernel/udbg.c +++ b/arch/powerpc/kernel/udbg.c | |||
@@ -16,8 +16,8 @@ | |||
16 | #include <linux/console.h> | 16 | #include <linux/console.h> |
17 | #include <asm/processor.h> | 17 | #include <asm/processor.h> |
18 | 18 | ||
19 | void (*udbg_putc)(unsigned char c); | 19 | void (*udbg_putc)(char c); |
20 | unsigned char (*udbg_getc)(void); | 20 | int (*udbg_getc)(void); |
21 | int (*udbg_getc_poll)(void); | 21 | int (*udbg_getc_poll)(void); |
22 | 22 | ||
23 | /* udbg library, used by xmon et al */ | 23 | /* udbg library, used by xmon et al */ |
@@ -57,8 +57,8 @@ int udbg_write(const char *s, int n) | |||
57 | 57 | ||
58 | int udbg_read(char *buf, int buflen) | 58 | int udbg_read(char *buf, int buflen) |
59 | { | 59 | { |
60 | char c, *p = buf; | 60 | char *p = buf; |
61 | int i; | 61 | int i, c; |
62 | 62 | ||
63 | if (!udbg_getc) | 63 | if (!udbg_getc) |
64 | return 0; | 64 | return 0; |
@@ -66,8 +66,11 @@ int udbg_read(char *buf, int buflen) | |||
66 | for (i = 0; i < buflen; ++i) { | 66 | for (i = 0; i < buflen; ++i) { |
67 | do { | 67 | do { |
68 | c = udbg_getc(); | 68 | c = udbg_getc(); |
69 | if (c == -1 && i == 0) | ||
70 | return -1; | ||
71 | |||
69 | } while (c == 0x11 || c == 0x13); | 72 | } while (c == 0x11 || c == 0x13); |
70 | if (c == 0) | 73 | if (c == 0 || c == -1) |
71 | break; | 74 | break; |
72 | *p++ = c; | 75 | *p++ = c; |
73 | } | 76 | } |
@@ -78,7 +81,7 @@ int udbg_read(char *buf, int buflen) | |||
78 | #define UDBG_BUFSIZE 256 | 81 | #define UDBG_BUFSIZE 256 |
79 | void udbg_printf(const char *fmt, ...) | 82 | void udbg_printf(const char *fmt, ...) |
80 | { | 83 | { |
81 | unsigned char buf[UDBG_BUFSIZE]; | 84 | char buf[UDBG_BUFSIZE]; |
82 | va_list args; | 85 | va_list args; |
83 | 86 | ||
84 | va_start(args, fmt); | 87 | va_start(args, fmt); |
@@ -87,6 +90,12 @@ void udbg_printf(const char *fmt, ...) | |||
87 | va_end(args); | 90 | va_end(args); |
88 | } | 91 | } |
89 | 92 | ||
93 | void __init udbg_progress(char *s, unsigned short hex) | ||
94 | { | ||
95 | udbg_puts(s); | ||
96 | udbg_puts("\n"); | ||
97 | } | ||
98 | |||
90 | /* | 99 | /* |
91 | * Early boot console based on udbg | 100 | * Early boot console based on udbg |
92 | */ | 101 | */ |
@@ -99,7 +108,7 @@ static void udbg_console_write(struct console *con, const char *s, | |||
99 | static struct console udbg_console = { | 108 | static struct console udbg_console = { |
100 | .name = "udbg", | 109 | .name = "udbg", |
101 | .write = udbg_console_write, | 110 | .write = udbg_console_write, |
102 | .flags = CON_PRINTBUFFER, | 111 | .flags = CON_PRINTBUFFER | CON_ENABLED, |
103 | .index = -1, | 112 | .index = -1, |
104 | }; | 113 | }; |
105 | 114 | ||
@@ -107,15 +116,19 @@ static int early_console_initialized; | |||
107 | 116 | ||
108 | void __init disable_early_printk(void) | 117 | void __init disable_early_printk(void) |
109 | { | 118 | { |
119 | #if 1 | ||
110 | if (!early_console_initialized) | 120 | if (!early_console_initialized) |
111 | return; | 121 | return; |
112 | unregister_console(&udbg_console); | 122 | unregister_console(&udbg_console); |
113 | early_console_initialized = 0; | 123 | early_console_initialized = 0; |
124 | #endif | ||
114 | } | 125 | } |
115 | 126 | ||
116 | /* called by setup_system */ | 127 | /* called by setup_system */ |
117 | void register_early_udbg_console(void) | 128 | void register_early_udbg_console(void) |
118 | { | 129 | { |
130 | if (early_console_initialized) | ||
131 | return; | ||
119 | early_console_initialized = 1; | 132 | early_console_initialized = 1; |
120 | register_console(&udbg_console); | 133 | register_console(&udbg_console); |
121 | } | 134 | } |