aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2005-11-30 00:54:12 -0500
committerPaul Mackerras <paulus@samba.org>2006-01-08 22:51:22 -0500
commitbb6b9b28d6847bc71f910e2e82c9040ff4b97ec0 (patch)
tree97b0acaade2d32ddb37147ff5112318f6c292cf8 /arch/powerpc
parent54b9a9aedc990dd2aefc45ab16d84f245cb7d8d0 (diff)
[PATCH] powerpc: udbg updates
The udbg low level io layer has an issue with udbg_getc() returning a char (unsigned on ppc) instead of an int, thus the -1 if you had no available input device could end up turned into 0xff, filling your display with bogus characters. This fixes it, along with adding a little blob to xmon to do a delay before exiting when getting an EOF and fixing the detection of ADB keyboards in udbg_adb.c Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/kernel/prom_parse.c2
-rw-r--r--arch/powerpc/kernel/udbg.c11
-rw-r--r--arch/powerpc/kernel/udbg_16550.c4
-rw-r--r--arch/powerpc/platforms/powermac/udbg_adb.c8
-rw-r--r--arch/powerpc/platforms/powermac/udbg_scc.c4
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c4
-rw-r--r--arch/powerpc/xmon/xmon.c4
7 files changed, 21 insertions, 16 deletions
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c
index 9c2a5be7a56a..23c85af53d47 100644
--- a/arch/powerpc/kernel/prom_parse.c
+++ b/arch/powerpc/kernel/prom_parse.c
@@ -276,7 +276,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
276 276
277 finish: 277 finish:
278 of_dump_addr("OF: parent translation for:", addr, pna); 278 of_dump_addr("OF: parent translation for:", addr, pna);
279 DBG("OF: with offset: %lx\n", offset); 279 DBG("OF: with offset: "PRu64"\n", offset);
280 280
281 /* Translate it into parent bus space */ 281 /* Translate it into parent bus space */
282 return pbus->translate(addr, offset, pna); 282 return pbus->translate(addr, offset, pna);
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c
index cc2df5e61bb0..a058285a70e7 100644
--- a/arch/powerpc/kernel/udbg.c
+++ b/arch/powerpc/kernel/udbg.c
@@ -17,7 +17,7 @@
17#include <asm/processor.h> 17#include <asm/processor.h>
18 18
19void (*udbg_putc)(char c); 19void (*udbg_putc)(char c);
20char (*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 }
diff --git a/arch/powerpc/kernel/udbg_16550.c b/arch/powerpc/kernel/udbg_16550.c
index 28a58da5592c..e58c048a7b19 100644
--- a/arch/powerpc/kernel/udbg_16550.c
+++ b/arch/powerpc/kernel/udbg_16550.c
@@ -69,14 +69,14 @@ static int udbg_550_getc_poll(void)
69 return -1; 69 return -1;
70} 70}
71 71
72static char udbg_550_getc(void) 72static int udbg_550_getc(void)
73{ 73{
74 if (udbg_comport) { 74 if (udbg_comport) {
75 while ((in_8(&udbg_comport->lsr) & LSR_DR) == 0) 75 while ((in_8(&udbg_comport->lsr) & LSR_DR) == 0)
76 /* wait for char */; 76 /* wait for char */;
77 return in_8(&udbg_comport->rbr); 77 return in_8(&udbg_comport->rbr);
78 } 78 }
79 return 0; 79 return -1;
80} 80}
81 81
82void udbg_init_uart(void __iomem *comport, unsigned int speed, 82void udbg_init_uart(void __iomem *comport, unsigned int speed,
diff --git a/arch/powerpc/platforms/powermac/udbg_adb.c b/arch/powerpc/platforms/powermac/udbg_adb.c
index 3d5ed23bf0e0..06c8265c2baf 100644
--- a/arch/powerpc/platforms/powermac/udbg_adb.c
+++ b/arch/powerpc/platforms/powermac/udbg_adb.c
@@ -29,7 +29,7 @@
29 */ 29 */
30 30
31static void (*udbg_adb_old_putc)(char c); 31static void (*udbg_adb_old_putc)(char c);
32static char (*udbg_adb_old_getc)(void); 32static int (*udbg_adb_old_getc)(void);
33static int (*udbg_adb_old_getc_poll)(void); 33static int (*udbg_adb_old_getc_poll)(void);
34 34
35static enum { 35static enum {
@@ -73,7 +73,7 @@ static unsigned char xmon_shift_keytab[128] =
73 "\0.\0*\0+\0\0\0\0\0/\r\0-\0" /* 0x40 - 0x4f */ 73 "\0.\0*\0+\0\0\0\0\0/\r\0-\0" /* 0x40 - 0x4f */
74 "\0\0000123456789\0\0\0"; /* 0x50 - 0x5f */ 74 "\0\0000123456789\0\0\0"; /* 0x50 - 0x5f */
75 75
76static char udbg_adb_local_getc(void) 76static int udbg_adb_local_getc(void)
77{ 77{
78 int k, t, on; 78 int k, t, on;
79 79
@@ -116,7 +116,7 @@ static char udbg_adb_local_getc(void)
116} 116}
117#endif /* CONFIG_BOOTX_TEXT */ 117#endif /* CONFIG_BOOTX_TEXT */
118 118
119static char udbg_adb_getc(void) 119static int udbg_adb_getc(void)
120{ 120{
121#ifdef CONFIG_BOOTX_TEXT 121#ifdef CONFIG_BOOTX_TEXT
122 if (udbg_adb_use_btext && input_type != input_adb_none) 122 if (udbg_adb_use_btext && input_type != input_adb_none)
@@ -195,7 +195,7 @@ int udbg_adb_init(int force_btext)
195 */ 195 */
196 for (np = NULL; (np = of_find_node_by_name(np, "keyboard")) != NULL;) { 196 for (np = NULL; (np = of_find_node_by_name(np, "keyboard")) != NULL;) {
197 struct device_node *parent = of_get_parent(np); 197 struct device_node *parent = of_get_parent(np);
198 int found = (parent && !strcmp(parent->type, "adb") == 0); 198 int found = (parent && strcmp(parent->type, "adb") == 0);
199 of_node_put(parent); 199 of_node_put(parent);
200 if (found) 200 if (found)
201 break; 201 break;
diff --git a/arch/powerpc/platforms/powermac/udbg_scc.c b/arch/powerpc/platforms/powermac/udbg_scc.c
index df6dec49c4c7..e87d53acfb61 100644
--- a/arch/powerpc/platforms/powermac/udbg_scc.c
+++ b/arch/powerpc/platforms/powermac/udbg_scc.c
@@ -47,14 +47,14 @@ static int udbg_scc_getc_poll(void)
47 return -1; 47 return -1;
48} 48}
49 49
50static char udbg_scc_getc(void) 50static int udbg_scc_getc(void)
51{ 51{
52 if (sccc) { 52 if (sccc) {
53 while ((in_8(sccc) & SCC_RXRDY) == 0) 53 while ((in_8(sccc) & SCC_RXRDY) == 0)
54 ; 54 ;
55 return in_8(sccd); 55 return in_8(sccd);
56 } 56 }
57 return 0; 57 return -1;
58} 58}
59 59
60static unsigned char scc_inittab[] = { 60static unsigned char scc_inittab[] = {
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 615ffb961059..1fe445ab78a6 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -112,7 +112,7 @@ static int udbg_hvsi_getc_poll(void)
112 return ch; 112 return ch;
113} 113}
114 114
115static char udbg_hvsi_getc(void) 115static int udbg_hvsi_getc(void)
116{ 116{
117 int ch; 117 int ch;
118 for (;;) { 118 for (;;) {
@@ -173,7 +173,7 @@ static int udbg_getc_pollLP(void)
173 return ch; 173 return ch;
174} 174}
175 175
176static char udbg_getcLP(void) 176static int udbg_getcLP(void)
177{ 177{
178 int ch; 178 int ch;
179 for (;;) { 179 for (;;) {
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index c45a6ad5f3b7..465b75c5647e 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -450,7 +450,6 @@ int xmon_core(struct pt_regs *regs, int fromipi)
450 leave: 450 leave:
451 cpu_clear(cpu, cpus_in_xmon); 451 cpu_clear(cpu, cpus_in_xmon);
452 xmon_fault_jmp[cpu] = NULL; 452 xmon_fault_jmp[cpu] = NULL;
453
454#else 453#else
455 /* UP is simple... */ 454 /* UP is simple... */
456 if (in_xmon) { 455 if (in_xmon) {
@@ -805,7 +804,10 @@ cmds(struct pt_regs *excp)
805 break; 804 break;
806 case 'x': 805 case 'x':
807 case 'X': 806 case 'X':
807 return cmd;
808 case EOF: 808 case EOF:
809 printf(" <no input ...>\n");
810 mdelay(2000);
809 return cmd; 811 return cmd;
810 case '?': 812 case '?':
811 printf(help_string); 813 printf(help_string);