Commit c8f1c8be629ee34991fdba8bfe46a5c455393209

Authored by Milton Miller
Committed by Paul Mackerras
1 parent 7f853352e7

[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>

Showing 9 changed files with 51 additions and 58 deletions Side-by-side Diff

arch/ppc64/kernel/pSeries_lpar.c
... ... @@ -192,9 +192,9 @@
192 192 void udbg_init_debug_lpar(void)
193 193 {
194 194 vtermno = 0;
195   - ppc_md.udbg_putc = udbg_putcLP;
196   - ppc_md.udbg_getc = udbg_getcLP;
197   - ppc_md.udbg_getc_poll = udbg_getc_pollLP;
  195 + udbg_putc = udbg_putcLP;
  196 + udbg_getc = udbg_getcLP;
  197 + udbg_getc_poll = udbg_getc_pollLP;
198 198 }
199 199  
200 200 /* returns 0 if couldn't find or use /chosen/stdout as console */
201 201  
... ... @@ -227,18 +227,18 @@
227 227 termno = (u32 *)get_property(stdout_node, "reg", NULL);
228 228 if (termno) {
229 229 vtermno = termno[0];
230   - ppc_md.udbg_putc = udbg_putcLP;
231   - ppc_md.udbg_getc = udbg_getcLP;
232   - ppc_md.udbg_getc_poll = udbg_getc_pollLP;
  230 + udbg_putc = udbg_putcLP;
  231 + udbg_getc = udbg_getcLP;
  232 + udbg_getc_poll = udbg_getc_pollLP;
233 233 found = 1;
234 234 }
235 235 } else if (device_is_compatible(stdout_node, "hvterm-protocol")) {
236 236 termno = (u32 *)get_property(stdout_node, "reg", NULL);
237 237 if (termno) {
238 238 vtermno = termno[0];
239   - ppc_md.udbg_putc = udbg_hvsi_putc;
240   - ppc_md.udbg_getc = udbg_hvsi_getc;
241   - ppc_md.udbg_getc_poll = udbg_hvsi_getc_poll;
  239 + udbg_putc = udbg_hvsi_putc;
  240 + udbg_getc = udbg_hvsi_getc;
  241 + udbg_getc_poll = udbg_hvsi_getc_poll;
242 242 found = 1;
243 243 }
244 244 }
arch/ppc64/kernel/pmac_setup.c
... ... @@ -332,16 +332,13 @@
332 332 sccdbg = 1;
333 333 udbg_init_scc(NULL);
334 334 }
335   -
336   - else {
337 335 #ifdef CONFIG_BOOTX_TEXT
  336 + else {
338 337 init_boot_display();
339 338  
340   - ppc_md.udbg_putc = btext_putc;
341   - ppc_md.udbg_getc = NULL;
342   - ppc_md.udbg_getc_poll = NULL;
343   -#endif /* CONFIG_BOOTX_TEXT */
  339 + udbg_putc = btext_putc;
344 340 }
  341 +#endif /* CONFIG_BOOTX_TEXT */
345 342  
346 343 /* Setup interrupt mapping options */
347 344 ppc64_interrupt_controller = IC_OPEN_PIC;
arch/ppc64/kernel/setup.c
... ... @@ -89,7 +89,7 @@
89 89 #define EARLY_DEBUG_INIT() udbg_init_maple_realmode()
90 90 #define EARLY_DEBUG_INIT() udbg_init_pmac_realmode()
91 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 93 #endif
94 94  
95 95 /* extern void *stab; */
... ... @@ -424,12 +424,6 @@
424 424 for (;;);
425 425 }
426 426 ppc_md = **mach;
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 427  
434 428 DBG("Found, Initializing memory management...\n");
435 429  
arch/ppc64/kernel/udbg.c
... ... @@ -20,14 +20,18 @@
20 20 #include <asm/io.h>
21 21 #include <asm/prom.h>
22 22  
  23 +void (*udbg_putc)(unsigned char c);
  24 +unsigned char (*udbg_getc)(void);
  25 +int (*udbg_getc_poll)(void);
  26 +
23 27 void udbg_puts(const char *s)
24 28 {
25   - if (ppc_md.udbg_putc) {
  29 + if (udbg_putc) {
26 30 char c;
27 31  
28 32 if (s && *s != '\0') {
29 33 while ((c = *s++) != '\0')
30   - ppc_md.udbg_putc(c);
  34 + udbg_putc(c);
31 35 }
32 36 }
33 37 #if 0
34 38  
... ... @@ -42,12 +46,12 @@
42 46 int remain = n;
43 47 char c;
44 48  
45   - if (!ppc_md.udbg_putc)
  49 + if (!udbg_putc)
46 50 return 0;
47 51  
48 52 if (s && *s != '\0') {
49 53 while (((c = *s++) != '\0') && (remain-- > 0)) {
50   - ppc_md.udbg_putc(c);
  54 + udbg_putc(c);
51 55 }
52 56 }
53 57  
54 58  
... ... @@ -59,12 +63,12 @@
59 63 char c, *p = buf;
60 64 int i;
61 65  
62   - if (!ppc_md.udbg_getc)
  66 + if (!udbg_getc)
63 67 return 0;
64 68  
65 69 for (i = 0; i < buflen; ++i) {
66 70 do {
67   - c = ppc_md.udbg_getc();
  71 + c = udbg_getc();
68 72 } while (c == 0x11 || c == 0x13);
69 73 if (c == 0)
70 74 break;
arch/ppc64/kernel/udbg_16550.c
... ... @@ -99,9 +99,9 @@
99 99 out_8(&udbg_comport->lcr, 0x03); /* 8 data, 1 stop, no parity */
100 100 out_8(&udbg_comport->mcr, 0x03); /* RTS/DTR */
101 101 out_8(&udbg_comport->fcr ,0x07); /* Clear & enable FIFOs */
102   - ppc_md.udbg_putc = udbg_550_putc;
103   - ppc_md.udbg_getc = udbg_550_getc;
104   - ppc_md.udbg_getc_poll = udbg_550_getc_poll;
  102 + udbg_putc = udbg_550_putc;
  103 + udbg_getc = udbg_550_getc;
  104 + udbg_getc_poll = udbg_550_getc_poll;
105 105 }
106 106 }
107 107  
... ... @@ -121,9 +121,9 @@
121 121 {
122 122 udbg_comport = (volatile struct NS16550 __iomem *)0xf40003f8;
123 123  
124   - ppc_md.udbg_putc = udbg_maple_real_putc;
125   - ppc_md.udbg_getc = NULL;
126   - ppc_md.udbg_getc_poll = NULL;
  124 + udbg_putc = udbg_maple_real_putc;
  125 + udbg_getc = NULL;
  126 + udbg_getc_poll = NULL;
127 127 }
128 128 #endif /* CONFIG_PPC_MAPLE */
arch/ppc64/kernel/udbg_scc.c
... ... @@ -111,9 +111,9 @@
111 111 for (i = 0; i < sizeof(scc_inittab); ++i)
112 112 out_8(sccc, scc_inittab[i]);
113 113  
114   - ppc_md.udbg_putc = udbg_scc_putc;
115   - ppc_md.udbg_getc = udbg_scc_getc;
116   - ppc_md.udbg_getc_poll = udbg_scc_getc_poll;
  114 + udbg_putc = udbg_scc_putc;
  115 + udbg_getc = udbg_scc_getc;
  116 + udbg_getc_poll = udbg_scc_getc_poll;
117 117  
118 118 udbg_puts("Hello World !\n");
119 119 }
... ... @@ -132,8 +132,8 @@
132 132 sccc = (volatile u8 __iomem *)0x80013020ul;
133 133 sccd = (volatile u8 __iomem *)0x80013030ul;
134 134  
135   - ppc_md.udbg_putc = udbg_real_scc_putc;
136   - ppc_md.udbg_getc = NULL;
137   - ppc_md.udbg_getc_poll = NULL;
  135 + udbg_putc = udbg_real_scc_putc;
  136 + udbg_getc = NULL;
  137 + udbg_getc_poll = NULL;
138 138 }
arch/ppc64/xmon/start.c
... ... @@ -61,8 +61,8 @@
61 61 int
62 62 xmon_read_poll(void)
63 63 {
64   - if (ppc_md.udbg_getc_poll)
65   - return ppc_md.udbg_getc_poll();
  64 + if (udbg_getc_poll)
  65 + return udbg_getc_poll();
66 66 return -1;
67 67 }
68 68  
include/asm-ppc64/machdep.h
... ... @@ -103,11 +103,6 @@
103 103  
104 104 void (*progress)(char *, unsigned short);
105 105  
106   - /* Debug interface. Low level I/O to some terminal device */
107   - void (*udbg_putc)(unsigned char c);
108   - unsigned char (*udbg_getc)(void);
109   - int (*udbg_getc_poll)(void);
110   -
111 106 /* Interface for platform error logging */
112 107 void (*log_error)(char *buf, unsigned int err_type, int fatal);
113 108  
include/asm-ppc64/udbg.h
... ... @@ -12,18 +12,21 @@
12 12 * 2 of the License, or (at your option) any later version.
13 13 */
14 14  
15   -void udbg_init_uart(void __iomem *comport, unsigned int speed);
16   -void udbg_putc(unsigned char c);
17   -unsigned char udbg_getc(void);
18   -int udbg_getc_poll(void);
19   -void udbg_puts(const char *s);
20   -int udbg_write(const char *s, int n);
21   -int udbg_read(char *buf, int buflen);
  15 +extern void (*udbg_putc)(unsigned char c);
  16 +extern unsigned char (*udbg_getc)(void);
  17 +extern int (*udbg_getc_poll)(void);
  18 +
  19 +extern void udbg_puts(const char *s);
  20 +extern int udbg_write(const char *s, int n);
  21 +extern int udbg_read(char *buf, int buflen);
  22 +
22 23 struct console;
23   -void udbg_console_write(struct console *con, const char *s, unsigned int n);
24   -void udbg_printf(const char *fmt, ...);
25   -void udbg_ppcdbg(unsigned long flags, const char *fmt, ...);
26   -unsigned long udbg_ifdebug(unsigned long flags);
  24 +extern void udbg_console_write(struct console *con, const char *s, unsigned int n);
  25 +extern void udbg_printf(const char *fmt, ...);
  26 +extern void udbg_ppcdbg(unsigned long flags, const char *fmt, ...);
  27 +extern unsigned long udbg_ifdebug(unsigned long flags);
27 28  
  29 +
  30 +extern void udbg_init_uart(void __iomem *comport, unsigned int speed);
28 31 #endif