aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/udbg.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-01-09 13:03:44 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-09 13:03:44 -0500
commit6150c32589d1976ca8a5c987df951088c05a7542 (patch)
tree94073696576323ff966e365d8c47b8ecd8372f97 /arch/powerpc/kernel/udbg.c
parent44637a12f80b80157d9c1bc5b7d6ef09c9e05713 (diff)
parentbe42d5fa3772241b8ecebd443f1fb36247959c54 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc-merge
Diffstat (limited to 'arch/powerpc/kernel/udbg.c')
-rw-r--r--arch/powerpc/kernel/udbg.c27
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
19void (*udbg_putc)(unsigned char c); 19void (*udbg_putc)(char c);
20unsigned char (*udbg_getc)(void); 20int (*udbg_getc)(void);
21int (*udbg_getc_poll)(void); 21int (*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
58int udbg_read(char *buf, int buflen) 58int 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
79void udbg_printf(const char *fmt, ...) 82void 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
93void __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,
99static struct console udbg_console = { 108static 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
108void __init disable_early_printk(void) 117void __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 */
117void register_early_udbg_console(void) 128void 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}