aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMilton Miller <miltonm@bga.com>2005-09-05 21:56:42 -0400
committerPaul Mackerras <paulus@samba.org>2005-09-06 02:07:36 -0400
commitc8f1c8be629ee34991fdba8bfe46a5c455393209 (patch)
tree66f218e641e87a0ca9ade7601345229b6557761e /arch
parent7f853352e79bf57c4ee279b7458ed0c072e2be76 (diff)
[PATCH] ppc64: Take udbg out of ppc_md
Take udbg out of ppc_md. Allows us to not overwrite early udbg inits when assigning ppc_md. Signed-off-by: Milton Miller <miltonm@bga.com> Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/ppc64/kernel/pSeries_lpar.c18
-rw-r--r--arch/ppc64/kernel/pmac_setup.c9
-rw-r--r--arch/ppc64/kernel/setup.c8
-rw-r--r--arch/ppc64/kernel/udbg.c16
-rw-r--r--arch/ppc64/kernel/udbg_16550.c12
-rw-r--r--arch/ppc64/kernel/udbg_scc.c12
-rw-r--r--arch/ppc64/xmon/start.c4
7 files changed, 37 insertions, 42 deletions
diff --git a/arch/ppc64/kernel/pSeries_lpar.c b/arch/ppc64/kernel/pSeries_lpar.c
index a1d5fdfea4a8..a6de83f2078f 100644
--- a/arch/ppc64/kernel/pSeries_lpar.c
+++ b/arch/ppc64/kernel/pSeries_lpar.c
@@ -192,9 +192,9 @@ static unsigned char udbg_getcLP(void)
192void udbg_init_debug_lpar(void) 192void udbg_init_debug_lpar(void)
193{ 193{
194 vtermno = 0; 194 vtermno = 0;
195 ppc_md.udbg_putc = udbg_putcLP; 195 udbg_putc = udbg_putcLP;
196 ppc_md.udbg_getc = udbg_getcLP; 196 udbg_getc = udbg_getcLP;
197 ppc_md.udbg_getc_poll = udbg_getc_pollLP; 197 udbg_getc_poll = udbg_getc_pollLP;
198} 198}
199 199
200/* returns 0 if couldn't find or use /chosen/stdout as console */ 200/* returns 0 if couldn't find or use /chosen/stdout as console */
@@ -227,18 +227,18 @@ int find_udbg_vterm(void)
227 termno = (u32 *)get_property(stdout_node, "reg", NULL); 227 termno = (u32 *)get_property(stdout_node, "reg", NULL);
228 if (termno) { 228 if (termno) {
229 vtermno = termno[0]; 229 vtermno = termno[0];
230 ppc_md.udbg_putc = udbg_putcLP; 230 udbg_putc = udbg_putcLP;
231 ppc_md.udbg_getc = udbg_getcLP; 231 udbg_getc = udbg_getcLP;
232 ppc_md.udbg_getc_poll = udbg_getc_pollLP; 232 udbg_getc_poll = udbg_getc_pollLP;
233 found = 1; 233 found = 1;
234 } 234 }
235 } else if (device_is_compatible(stdout_node, "hvterm-protocol")) { 235 } else if (device_is_compatible(stdout_node, "hvterm-protocol")) {
236 termno = (u32 *)get_property(stdout_node, "reg", NULL); 236 termno = (u32 *)get_property(stdout_node, "reg", NULL);
237 if (termno) { 237 if (termno) {
238 vtermno = termno[0]; 238 vtermno = termno[0];
239 ppc_md.udbg_putc = udbg_hvsi_putc; 239 udbg_putc = udbg_hvsi_putc;
240 ppc_md.udbg_getc = udbg_hvsi_getc; 240 udbg_getc = udbg_hvsi_getc;
241 ppc_md.udbg_getc_poll = udbg_hvsi_getc_poll; 241 udbg_getc_poll = udbg_hvsi_getc_poll;
242 found = 1; 242 found = 1;
243 } 243 }
244 } 244 }
diff --git a/arch/ppc64/kernel/pmac_setup.c b/arch/ppc64/kernel/pmac_setup.c
index d94a3143527a..e7f695dcd8c8 100644
--- a/arch/ppc64/kernel/pmac_setup.c
+++ b/arch/ppc64/kernel/pmac_setup.c
@@ -332,16 +332,13 @@ static void __init pmac_init_early(void)
332 sccdbg = 1; 332 sccdbg = 1;
333 udbg_init_scc(NULL); 333 udbg_init_scc(NULL);
334 } 334 }
335
336 else {
337#ifdef CONFIG_BOOTX_TEXT 335#ifdef CONFIG_BOOTX_TEXT
336 else {
338 init_boot_display(); 337 init_boot_display();
339 338
340 ppc_md.udbg_putc = btext_putc; 339 udbg_putc = btext_putc;
341 ppc_md.udbg_getc = NULL;
342 ppc_md.udbg_getc_poll = NULL;
343#endif /* CONFIG_BOOTX_TEXT */
344 } 340 }
341#endif /* CONFIG_BOOTX_TEXT */
345 342
346 /* Setup interrupt mapping options */ 343 /* Setup interrupt mapping options */
347 ppc64_interrupt_controller = IC_OPEN_PIC; 344 ppc64_interrupt_controller = IC_OPEN_PIC;
diff --git a/arch/ppc64/kernel/setup.c b/arch/ppc64/kernel/setup.c
index ee3b20de2e7a..059cca2e2538 100644
--- a/arch/ppc64/kernel/setup.c
+++ b/arch/ppc64/kernel/setup.c
@@ -89,7 +89,7 @@ extern void udbg_init_maple_realmode(void);
89#define EARLY_DEBUG_INIT() udbg_init_maple_realmode() 89#define EARLY_DEBUG_INIT() udbg_init_maple_realmode()
90#define EARLY_DEBUG_INIT() udbg_init_pmac_realmode() 90#define EARLY_DEBUG_INIT() udbg_init_pmac_realmode()
91#define EARLY_DEBUG_INIT() \ 91#define EARLY_DEBUG_INIT() \
92 do { ppc_md.udbg_putc = call_rtas_display_status_delay; } while(0) 92 do { udbg_putc = call_rtas_display_status_delay; } while(0)
93#endif 93#endif
94 94
95/* extern void *stab; */ 95/* extern void *stab; */
@@ -425,12 +425,6 @@ void __init early_setup(unsigned long dt_ptr)
425 } 425 }
426 ppc_md = **mach; 426 ppc_md = **mach;
427 427
428 /* our udbg callbacks got overriden by the above, let's put them
429 * back in. Ultimately, I want those things to be split from the
430 * main ppc_md
431 */
432 EARLY_DEBUG_INIT();
433
434 DBG("Found, Initializing memory management...\n"); 428 DBG("Found, Initializing memory management...\n");
435 429
436 /* 430 /*
diff --git a/arch/ppc64/kernel/udbg.c b/arch/ppc64/kernel/udbg.c
index 67e208500aea..2f82e7d7902b 100644
--- a/arch/ppc64/kernel/udbg.c
+++ b/arch/ppc64/kernel/udbg.c
@@ -20,14 +20,18 @@
20#include <asm/io.h> 20#include <asm/io.h>
21#include <asm/prom.h> 21#include <asm/prom.h>
22 22
23void (*udbg_putc)(unsigned char c);
24unsigned char (*udbg_getc)(void);
25int (*udbg_getc_poll)(void);
26
23void udbg_puts(const char *s) 27void udbg_puts(const char *s)
24{ 28{
25 if (ppc_md.udbg_putc) { 29 if (udbg_putc) {
26 char c; 30 char c;
27 31
28 if (s && *s != '\0') { 32 if (s && *s != '\0') {
29 while ((c = *s++) != '\0') 33 while ((c = *s++) != '\0')
30 ppc_md.udbg_putc(c); 34 udbg_putc(c);
31 } 35 }
32 } 36 }
33#if 0 37#if 0
@@ -42,12 +46,12 @@ int udbg_write(const char *s, int n)
42 int remain = n; 46 int remain = n;
43 char c; 47 char c;
44 48
45 if (!ppc_md.udbg_putc) 49 if (!udbg_putc)
46 return 0; 50 return 0;
47 51
48 if (s && *s != '\0') { 52 if (s && *s != '\0') {
49 while (((c = *s++) != '\0') && (remain-- > 0)) { 53 while (((c = *s++) != '\0') && (remain-- > 0)) {
50 ppc_md.udbg_putc(c); 54 udbg_putc(c);
51 } 55 }
52 } 56 }
53 57
@@ -59,12 +63,12 @@ int udbg_read(char *buf, int buflen)
59 char c, *p = buf; 63 char c, *p = buf;
60 int i; 64 int i;
61 65
62 if (!ppc_md.udbg_getc) 66 if (!udbg_getc)
63 return 0; 67 return 0;
64 68
65 for (i = 0; i < buflen; ++i) { 69 for (i = 0; i < buflen; ++i) {
66 do { 70 do {
67 c = ppc_md.udbg_getc(); 71 c = udbg_getc();
68 } while (c == 0x11 || c == 0x13); 72 } while (c == 0x11 || c == 0x13);
69 if (c == 0) 73 if (c == 0)
70 break; 74 break;
diff --git a/arch/ppc64/kernel/udbg_16550.c b/arch/ppc64/kernel/udbg_16550.c
index 46a23e34f7c9..ffe19dbecd97 100644
--- a/arch/ppc64/kernel/udbg_16550.c
+++ b/arch/ppc64/kernel/udbg_16550.c
@@ -99,9 +99,9 @@ void udbg_init_uart(void __iomem *comport, unsigned int speed)
99 out_8(&udbg_comport->lcr, 0x03); /* 8 data, 1 stop, no parity */ 99 out_8(&udbg_comport->lcr, 0x03); /* 8 data, 1 stop, no parity */
100 out_8(&udbg_comport->mcr, 0x03); /* RTS/DTR */ 100 out_8(&udbg_comport->mcr, 0x03); /* RTS/DTR */
101 out_8(&udbg_comport->fcr ,0x07); /* Clear & enable FIFOs */ 101 out_8(&udbg_comport->fcr ,0x07); /* Clear & enable FIFOs */
102 ppc_md.udbg_putc = udbg_550_putc; 102 udbg_putc = udbg_550_putc;
103 ppc_md.udbg_getc = udbg_550_getc; 103 udbg_getc = udbg_550_getc;
104 ppc_md.udbg_getc_poll = udbg_550_getc_poll; 104 udbg_getc_poll = udbg_550_getc_poll;
105 } 105 }
106} 106}
107 107
@@ -121,8 +121,8 @@ void udbg_init_maple_realmode(void)
121{ 121{
122 udbg_comport = (volatile struct NS16550 __iomem *)0xf40003f8; 122 udbg_comport = (volatile struct NS16550 __iomem *)0xf40003f8;
123 123
124 ppc_md.udbg_putc = udbg_maple_real_putc; 124 udbg_putc = udbg_maple_real_putc;
125 ppc_md.udbg_getc = NULL; 125 udbg_getc = NULL;
126 ppc_md.udbg_getc_poll = NULL; 126 udbg_getc_poll = NULL;
127} 127}
128#endif /* CONFIG_PPC_MAPLE */ 128#endif /* CONFIG_PPC_MAPLE */
diff --git a/arch/ppc64/kernel/udbg_scc.c b/arch/ppc64/kernel/udbg_scc.c
index 74c8ea2675cb..c8ba8ac287f0 100644
--- a/arch/ppc64/kernel/udbg_scc.c
+++ b/arch/ppc64/kernel/udbg_scc.c
@@ -111,9 +111,9 @@ void udbg_init_scc(struct device_node *np)
111 for (i = 0; i < sizeof(scc_inittab); ++i) 111 for (i = 0; i < sizeof(scc_inittab); ++i)
112 out_8(sccc, scc_inittab[i]); 112 out_8(sccc, scc_inittab[i]);
113 113
114 ppc_md.udbg_putc = udbg_scc_putc; 114 udbg_putc = udbg_scc_putc;
115 ppc_md.udbg_getc = udbg_scc_getc; 115 udbg_getc = udbg_scc_getc;
116 ppc_md.udbg_getc_poll = udbg_scc_getc_poll; 116 udbg_getc_poll = udbg_scc_getc_poll;
117 117
118 udbg_puts("Hello World !\n"); 118 udbg_puts("Hello World !\n");
119} 119}
@@ -132,7 +132,7 @@ void udbg_init_pmac_realmode(void)
132 sccc = (volatile u8 __iomem *)0x80013020ul; 132 sccc = (volatile u8 __iomem *)0x80013020ul;
133 sccd = (volatile u8 __iomem *)0x80013030ul; 133 sccd = (volatile u8 __iomem *)0x80013030ul;
134 134
135 ppc_md.udbg_putc = udbg_real_scc_putc; 135 udbg_putc = udbg_real_scc_putc;
136 ppc_md.udbg_getc = NULL; 136 udbg_getc = NULL;
137 ppc_md.udbg_getc_poll = NULL; 137 udbg_getc_poll = NULL;
138} 138}
diff --git a/arch/ppc64/xmon/start.c b/arch/ppc64/xmon/start.c
index 93bf8cb0a762..e50c158191e1 100644
--- a/arch/ppc64/xmon/start.c
+++ b/arch/ppc64/xmon/start.c
@@ -61,8 +61,8 @@ xmon_read(void *handle, void *ptr, int nb)
61int 61int
62xmon_read_poll(void) 62xmon_read_poll(void)
63{ 63{
64 if (ppc_md.udbg_getc_poll) 64 if (udbg_getc_poll)
65 return ppc_md.udbg_getc_poll(); 65 return udbg_getc_poll();
66 return -1; 66 return -1;
67} 67}
68 68