tree 66f218e641e87a0ca9ade7601345229b6557761e
parent 7f853352e79bf57c4ee279b7458ed0c072e2be76
author Milton Miller <[EMAIL PROTECTED]> Tue, 06 Sep 2005 11:56:42 +1000
committer Paul Mackerras <[EMAIL PROTECTED]> Tue, 06 Sep 2005 16:07:36 +1000

[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 <[EMAIL PROTECTED]>
Signed-off-by: Anton Blanchard <[EMAIL PROTECTED]>
Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>

 arch/ppc64/kernel/pSeries_lpar.c |   18 +++++++++---------
 arch/ppc64/kernel/pmac_setup.c   |    9 +++------
 arch/ppc64/kernel/setup.c        |    8 +-------
 arch/ppc64/kernel/udbg.c         |   16 ++++++++++------
 arch/ppc64/kernel/udbg_16550.c   |   12 ++++++------
 arch/ppc64/kernel/udbg_scc.c     |   12 ++++++------
 arch/ppc64/xmon/start.c          |    4 ++--
 include/asm-ppc64/machdep.h      |    5 -----
 include/asm-ppc64/udbg.h         |   25 ++++++++++++++-----------
 9 files changed, 51 insertions(+), 58 deletions(-)

diff --git a/arch/ppc64/kernel/pSeries_lpar.c b/arch/ppc64/kernel/pSeries_lpar.c
--- a/arch/ppc64/kernel/pSeries_lpar.c
+++ b/arch/ppc64/kernel/pSeries_lpar.c
@@ -192,9 +192,9 @@ static unsigned char udbg_getcLP(void)
 void udbg_init_debug_lpar(void)
 {
        vtermno = 0;
-       ppc_md.udbg_putc = udbg_putcLP;
-       ppc_md.udbg_getc = udbg_getcLP;
-       ppc_md.udbg_getc_poll = udbg_getc_pollLP;
+       udbg_putc = udbg_putcLP;
+       udbg_getc = udbg_getcLP;
+       udbg_getc_poll = udbg_getc_pollLP;
 }
 
 /* returns 0 if couldn't find or use /chosen/stdout as console */
@@ -227,18 +227,18 @@ int find_udbg_vterm(void)
                        termno = (u32 *)get_property(stdout_node, "reg", NULL);
                        if (termno) {
                                vtermno = termno[0];
-                               ppc_md.udbg_putc = udbg_putcLP;
-                               ppc_md.udbg_getc = udbg_getcLP;
-                               ppc_md.udbg_getc_poll = udbg_getc_pollLP;
+                               udbg_putc = udbg_putcLP;
+                               udbg_getc = udbg_getcLP;
+                               udbg_getc_poll = udbg_getc_pollLP;
                                found = 1;
                        }
                } else if (device_is_compatible(stdout_node, 
"hvterm-protocol")) {
                        termno = (u32 *)get_property(stdout_node, "reg", NULL);
                        if (termno) {
                                vtermno = termno[0];
-                               ppc_md.udbg_putc = udbg_hvsi_putc;
-                               ppc_md.udbg_getc = udbg_hvsi_getc;
-                               ppc_md.udbg_getc_poll = udbg_hvsi_getc_poll;
+                               udbg_putc = udbg_hvsi_putc;
+                               udbg_getc = udbg_hvsi_getc;
+                               udbg_getc_poll = udbg_hvsi_getc_poll;
                                found = 1;
                        }
                }
diff --git a/arch/ppc64/kernel/pmac_setup.c b/arch/ppc64/kernel/pmac_setup.c
--- 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)
                sccdbg = 1;
                        udbg_init_scc(NULL);
                }
-
-       else {
 #ifdef CONFIG_BOOTX_TEXT
+       else {
                init_boot_display();
 
-               ppc_md.udbg_putc = btext_putc;
-               ppc_md.udbg_getc = NULL;
-               ppc_md.udbg_getc_poll = NULL;
-#endif /* CONFIG_BOOTX_TEXT */
+               udbg_putc = btext_putc;
        }
+#endif /* CONFIG_BOOTX_TEXT */
 
        /* Setup interrupt mapping options */
        ppc64_interrupt_controller = IC_OPEN_PIC;
diff --git a/arch/ppc64/kernel/setup.c b/arch/ppc64/kernel/setup.c
--- a/arch/ppc64/kernel/setup.c
+++ b/arch/ppc64/kernel/setup.c
@@ -89,7 +89,7 @@ extern void udbg_init_maple_realmode(voi
 #define EARLY_DEBUG_INIT() udbg_init_maple_realmode()
 #define EARLY_DEBUG_INIT() udbg_init_pmac_realmode()
 #define EARLY_DEBUG_INIT()                                             \
-       do { ppc_md.udbg_putc = call_rtas_display_status_delay; } while(0)
+       do { udbg_putc = call_rtas_display_status_delay; } while(0)
 #endif
 
 /* extern void *stab; */
@@ -425,12 +425,6 @@ void __init early_setup(unsigned long dt
        }
        ppc_md = **mach;
 
-       /* our udbg callbacks got overriden by the above, let's put them
-        * back in. Ultimately, I want those things to be split from the
-        * main ppc_md
-        */
-       EARLY_DEBUG_INIT();
-
        DBG("Found, Initializing memory management...\n");
 
        /*
diff --git a/arch/ppc64/kernel/udbg.c b/arch/ppc64/kernel/udbg.c
--- a/arch/ppc64/kernel/udbg.c
+++ b/arch/ppc64/kernel/udbg.c
@@ -20,14 +20,18 @@
 #include <asm/io.h>
 #include <asm/prom.h>
 
+void (*udbg_putc)(unsigned char c);
+unsigned char (*udbg_getc)(void);
+int (*udbg_getc_poll)(void);
+
 void udbg_puts(const char *s)
 {
-       if (ppc_md.udbg_putc) {
+       if (udbg_putc) {
                char c;
 
                if (s && *s != '\0') {
                        while ((c = *s++) != '\0')
-                               ppc_md.udbg_putc(c);
+                               udbg_putc(c);
                }
        }
 #if 0
@@ -42,12 +46,12 @@ int udbg_write(const char *s, int n)
        int remain = n;
        char c;
 
-       if (!ppc_md.udbg_putc)
+       if (!udbg_putc)
                return 0;
 
        if (s && *s != '\0') {
                while (((c = *s++) != '\0') && (remain-- > 0)) {
-                       ppc_md.udbg_putc(c);
+                       udbg_putc(c);
                }
        }
 
@@ -59,12 +63,12 @@ int udbg_read(char *buf, int buflen)
        char c, *p = buf;
        int i;
 
-       if (!ppc_md.udbg_getc)
+       if (!udbg_getc)
                return 0;
 
        for (i = 0; i < buflen; ++i) {
                do {
-                       c = ppc_md.udbg_getc();
+                       c = udbg_getc();
                } while (c == 0x11 || c == 0x13);
                if (c == 0)
                        break;
diff --git a/arch/ppc64/kernel/udbg_16550.c b/arch/ppc64/kernel/udbg_16550.c
--- a/arch/ppc64/kernel/udbg_16550.c
+++ b/arch/ppc64/kernel/udbg_16550.c
@@ -99,9 +99,9 @@ void udbg_init_uart(void __iomem *compor
                out_8(&udbg_comport->lcr, 0x03);        /* 8 data, 1 stop, no 
parity */
                out_8(&udbg_comport->mcr, 0x03);        /* RTS/DTR */
                out_8(&udbg_comport->fcr ,0x07);        /* Clear & enable FIFOs 
*/
-               ppc_md.udbg_putc = udbg_550_putc;
-               ppc_md.udbg_getc = udbg_550_getc;
-               ppc_md.udbg_getc_poll = udbg_550_getc_poll;
+               udbg_putc = udbg_550_putc;
+               udbg_getc = udbg_550_getc;
+               udbg_getc_poll = udbg_550_getc_poll;
        }
 }
 
@@ -121,8 +121,8 @@ void udbg_init_maple_realmode(void)
 {
        udbg_comport = (volatile struct NS16550 __iomem *)0xf40003f8;
 
-       ppc_md.udbg_putc = udbg_maple_real_putc;
-       ppc_md.udbg_getc = NULL;
-       ppc_md.udbg_getc_poll = NULL;
+       udbg_putc = udbg_maple_real_putc;
+       udbg_getc = NULL;
+       udbg_getc_poll = NULL;
 }
 #endif /* CONFIG_PPC_MAPLE */
diff --git a/arch/ppc64/kernel/udbg_scc.c b/arch/ppc64/kernel/udbg_scc.c
--- 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 *n
        for (i = 0; i < sizeof(scc_inittab); ++i)
                out_8(sccc, scc_inittab[i]);
 
-       ppc_md.udbg_putc = udbg_scc_putc;
-       ppc_md.udbg_getc = udbg_scc_getc;
-       ppc_md.udbg_getc_poll = udbg_scc_getc_poll;
+       udbg_putc = udbg_scc_putc;
+       udbg_getc = udbg_scc_getc;
+       udbg_getc_poll = udbg_scc_getc_poll;
 
        udbg_puts("Hello World !\n");
 }
@@ -132,7 +132,7 @@ void udbg_init_pmac_realmode(void)
        sccc = (volatile u8 __iomem *)0x80013020ul;
        sccd = (volatile u8 __iomem *)0x80013030ul;
 
-       ppc_md.udbg_putc = udbg_real_scc_putc;
-       ppc_md.udbg_getc = NULL;
-       ppc_md.udbg_getc_poll = NULL;
+       udbg_putc = udbg_real_scc_putc;
+       udbg_getc = NULL;
+       udbg_getc_poll = NULL;
 }
diff --git a/arch/ppc64/xmon/start.c b/arch/ppc64/xmon/start.c
--- a/arch/ppc64/xmon/start.c
+++ b/arch/ppc64/xmon/start.c
@@ -61,8 +61,8 @@ xmon_read(void *handle, void *ptr, int n
 int
 xmon_read_poll(void)
 {
-       if (ppc_md.udbg_getc_poll)
-               return ppc_md.udbg_getc_poll();
+       if (udbg_getc_poll)
+               return udbg_getc_poll();
        return -1;
 }
  
diff --git a/include/asm-ppc64/machdep.h b/include/asm-ppc64/machdep.h
--- a/include/asm-ppc64/machdep.h
+++ b/include/asm-ppc64/machdep.h
@@ -103,11 +103,6 @@ struct machdep_calls {
 
        void            (*progress)(char *, unsigned short);
 
-       /* Debug interface.  Low level I/O to some terminal device */
-       void            (*udbg_putc)(unsigned char c);
-       unsigned char   (*udbg_getc)(void);
-       int             (*udbg_getc_poll)(void);
-
        /* Interface for platform error logging */
        void            (*log_error)(char *buf, unsigned int err_type, int 
fatal);
 
diff --git a/include/asm-ppc64/udbg.h b/include/asm-ppc64/udbg.h
--- a/include/asm-ppc64/udbg.h
+++ b/include/asm-ppc64/udbg.h
@@ -12,17 +12,20 @@
  * 2 of the License, or (at your option) any later version.
  */
 
-void udbg_init_uart(void __iomem *comport, unsigned int speed);
-void udbg_putc(unsigned char c);
-unsigned char udbg_getc(void);
-int udbg_getc_poll(void);
-void udbg_puts(const char *s);
-int udbg_write(const char *s, int n);
-int udbg_read(char *buf, int buflen);
+extern void (*udbg_putc)(unsigned char c);
+extern unsigned char (*udbg_getc)(void);
+extern int (*udbg_getc_poll)(void);
+
+extern void udbg_puts(const char *s);
+extern int udbg_write(const char *s, int n);
+extern int udbg_read(char *buf, int buflen);
+
 struct console;
-void udbg_console_write(struct console *con, const char *s, unsigned int n);
-void udbg_printf(const char *fmt, ...);
-void udbg_ppcdbg(unsigned long flags, const char *fmt, ...);
-unsigned long udbg_ifdebug(unsigned long flags);
+extern void udbg_console_write(struct console *con, const char *s, unsigned 
int n);
+extern void udbg_printf(const char *fmt, ...);
+extern void udbg_ppcdbg(unsigned long flags, const char *fmt, ...);
+extern unsigned long udbg_ifdebug(unsigned long flags);
+
 
+extern void udbg_init_uart(void __iomem *comport, unsigned int speed);
 #endif
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to