early_printk is a so much saner thing.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
        bool "DECstations"
        select BOOT_ELF32
        select DMA_NONCOHERENT
-       select EARLY_PRINTK
+       select SYS_HAS_EARLY_PRINTK
        select IRQ_CPU
        select SYS_HAS_CPU_R3000
        select SYS_HAS_CPU_R4X00
 config LASAT
        bool "LASAT Networks platforms"
        select DMA_NONCOHERENT
+       select SYS_HAS_EARLY_PRINTK
        select HW_HAS_PCI
        select MIPS_GT64120
        select MIPS_NILE4
        bool "MIPS Atlas board"
        select BOOT_ELF32
        select DMA_NONCOHERENT
+       select SYS_HAS_EARLY_PRINTK
        select IRQ_CPU
        select HW_HAS_PCI
        select MIPS_BOARDS_GEN
        select SYS_HAS_CPU_MIPS64_R1
        select SYS_HAS_CPU_NEVADA
        select SYS_HAS_CPU_RM7000
+       select SYS_HAS_EARLY_PRINTK
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_64BIT_KERNEL
        select SYS_SUPPORTS_BIG_ENDIAN
        depends on EXPERIMENTAL
        select IRQ_CPU
        select DMA_NONCOHERENT
+       select SYS_HAS_EARLY_PRINTK
        select MIPS_BOARDS_GEN
        select SYS_HAS_CPU_MIPS32_R1
        select SYS_HAS_CPU_MIPS32_R2
 config MIPS_SIM
        bool 'MIPS simulator (MIPSsim)'
        select DMA_NONCOHERENT
+       select SYS_HAS_EARLY_PRINTK
        select IRQ_CPU
        select SYS_HAS_CPU_MIPS32_R1
        select SYS_HAS_CPU_MIPS32_R2
+       select SYS_HAS_EARLY_PRINTK
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_BIG_ENDIAN
        select SYS_SUPPORTS_LITTLE_ENDIAN
        select RM7000_CPU_SCACHE
        select SWAP_IO_SPACE
        select SYS_HAS_CPU_RM9000
+       select SYS_HAS_EARLY_PRINTK
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_64BIT_KERNEL
        select SYS_SUPPORTS_BIG_ENDIAN
        select IRQ_CPU_RM9K
        select SWAP_IO_SPACE
        select SYS_HAS_CPU_RM9000
+       select SYS_HAS_EARLY_PRINTK
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_64BIT_KERNEL
        select SYS_SUPPORTS_BIG_ENDIAN
        select SWAP_IO_SPACE
        select SYS_HAS_CPU_R4X00
        select SYS_HAS_CPU_R5000
+       select SYS_HAS_EARLY_PRINTK
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_64BIT_KERNEL
        select SYS_SUPPORTS_BIG_ENDIAN
        select ARC64
        select BOOT_ELF64
        select DMA_IP27
-       select EARLY_PRINTK
+       select SYS_HAS_EARLY_PRINTK
        select HW_HAS_PCI
        select NR_CPUS_DEFAULT_64
        select PCI_DOMAINS
        select SYS_HAS_CPU_R5000
        select SYS_HAS_CPU_R10000
        select R5000_CPU_SCACHE
+       select SYS_HAS_EARLY_PRINTK
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL
        select SYS_SUPPORTS_BIG_ENDIAN
        bool
 
 config EARLY_PRINTK
+       bool "Early printk" if EMBEDDED && DEBUG_KERNEL
+       depends on SYS_HAS_EARLY_PRINTK
+       default y
+       help
+         This option enables special console drivers which allow the kernel
+         to print messages very early in the bootup process.
+
+         This is useful for kernel debugging when your machine crashes very
+         early before the console code is initialized. For normal operation
+         it is not recommended because it looks on some machines ugly and
+         oesn't cooperate with an X server. You should normally N here,
+         unless you want to debug such a crash.
+
+config SYS_HAS_EARLY_PRINTK
        bool
 
 config GENERIC_ISA_DMA
        select DMA_NONCOHERENT
        select HW_HAS_PCI
        select SYS_HAS_CPU_MIPS32_R1
+       select SYS_HAS_EARLY_PRINTK
        select SYS_SUPPORTS_32BIT_KERNEL
        select GENERIC_HARDIRQS_NO__DO_IRQ
        select SYS_SUPPORTS_KGDB
 
 config ARC_CONSOLE
        bool "ARC console support"
-       depends on SGI_IP22 || SNI_RM
+       depends on SGI_IP22 || (SNI_RM && CPU_LITTLE_ENDIAN)
 
 config ARC_MEMORY
        bool
 
        ArcWrite(1, &it, 1, &cnt);
        bc_enable();
 }
-
-char prom_getchar(void)
-{
-       ULONG cnt;
-       CHAR c;
-
-       bc_disable();
-       ArcRead(0, &c, 1, &cnt);
-       bc_enable();
-
-       return c;
-}
-
-void prom_printf(char *fmt, ...)
-{
-       va_list args;
-       char ppbuf[1024];
-       char *bptr;
-
-       va_start(args, fmt);
-       vsprintf(ppbuf, fmt, args);
-
-       bptr = ppbuf;
-
-       while (*bptr != 0) {
-               if (*bptr == '\n')
-                       prom_putchar('\r');
-
-               prom_putchar(*bptr++);
-       }
-       va_end(args);
-}
 
 {
        PSYSTEM_PARAMETER_BLOCK pb = PROMBLOCK;
        romvec = ROMVECTOR;
+       ULONG cnt;
+       CHAR c;
+
        prom_argc = fw_arg0;
        _prom_argv = (LONG *) fw_arg1;
        _prom_envp = (LONG *) fw_arg2;
 
        if (pb->magic != 0x53435241) {
-               prom_printf("Aieee, bad prom vector magic %08lx\n", pb->magic);
+               printk(KERN_CRIT "Aieee, bad prom vector magic %08lx\n", pb->magic);
                while(1)
                        ;
        }
        prom_meminit();
 
 #ifdef DEBUG_PROM_INIT
-       prom_printf("Press a key to reboot\n");
-       prom_getchar();
+       pr_info("Press a key to reboot\n");
+       ArcRead(0, &c, 1, &cnt);
        ArcEnterInteractiveMode();
 #endif
 }
 
 #ifdef DEBUG
        int i = 0;
 
-       prom_printf("ARCS MEMORY DESCRIPTOR dump:\n");
+       printk("ARCS MEMORY DESCRIPTOR dump:\n");
        p = ArcGetMemoryDescriptor(PROM_NULL_MDESC);
        while(p) {
-               prom_printf("[%d,%p]: base<%08lx> pages<%08lx> type<%s>\n",
-                           i, p, p->base, p->pages, mtypes(p->type));
+               printk("[%d,%p]: base<%08lx> pages<%08lx> type<%s>\n",
+                      i, p, p->base, p->pages, mtypes(p->type));
                p = ArcGetMemoryDescriptor(p);
                i++;
        }
 
 static void __init
 dump_component(pcomponent *p)
 {
-       prom_printf("[%p]:class<%s>type<%s>flags<%s>ver<%d>rev<%d>",
-                   p, classes[p->class], types[p->type],
-                   iflags[p->iflags], p->vers, p->rev);
-       prom_printf("key<%08lx>\n\tamask<%08lx>cdsize<%d>ilen<%d>iname<%s>\n",
-                   p->key, p->amask, (int)p->cdsize, (int)p->ilen, p->iname);
+       printk("[%p]:class<%s>type<%s>flags<%s>ver<%d>rev<%d>",
+              p, classes[p->class], types[p->type],
+              iflags[p->iflags], p->vers, p->rev);
+       printk("key<%08lx>\n\tamask<%08lx>cdsize<%d>ilen<%d>iname<%s>\n",
+              p->key, p->amask, (int)p->cdsize, (int)p->ilen, p->iname);
 }
 
 static void __init
 
 
        COBALT_UART[UART_TX] = c;
 }
-
-static void cons_write(struct console *c, const char *s, unsigned n)
-{
-       while(n-- && *s)
-               putchar(*s++);
-}
-
-static struct console cons_info =
-{
-       .name   = "uart",
-       .write  = cons_write,
-       .flags  = CON_PRINTBUFFER | CON_BOOT,
-       .index  = -1,
-};
-
-void __init cobalt_early_console(void)
-{
-       register_console(&cons_info);
-
-       printk("Cobalt: early console registered\n");
-}
-
-void __init disable_early_printk(void)
-{
-       unregister_console(&cons_info);
-}
 
 #endif
 
        if (cobalt_board_id > COBALT_BRD_ID_RAQ1) {
-#ifdef CONFIG_EARLY_PRINTK
-               cobalt_early_console();
-#endif
-
 #ifdef CONFIG_SERIAL_8250
                uart.line       = 0;
                uart.type       = PORT_UNKNOWN;
 
 
 #include <asm/dec/prom.h>
 
-static void __init prom_console_write(struct console *con, const char *s,
-                                     unsigned int c)
+void prom_putchar(char c)
 {
-       static char sfmt[] __initdata = "%%%us";
-       char fmt[13];
+       char s[2];
 
-       snprintf(fmt, sizeof(fmt), sfmt, c);
-       prom_printf(fmt, s);
-}
-
-static struct console promcons __initdata = {
-       .name   = "prom",
-       .write  = prom_console_write,
-       .flags  = CON_PRINTBUFFER,
-       .index  = -1,
-};
-
-static int promcons_output __initdata = 0;
-
-void __init register_prom_console(void)
-{
-       if (!promcons_output) {
-               promcons_output = 1;
-               register_console(&promcons);
-       }
-}
+       s[0] = c;
+       s[1] = '\0';
 
-void __init unregister_prom_console(void)
-{
-       if (promcons_output) {
-               unregister_console(&promcons);
-               promcons_output = 0;
-       }
+       prom_printf( s);
 }
-
-void disable_early_printk(void)
-       __attribute__((alias("unregister_prom_console")));
 
        }
 }
 
-int prom_getchar(void)
-{
-       return 0;
-}
-
 static struct console sercons = {
     .name      = "ttyS",
     .write     = prom_console_write,
 
 obj-$(CONFIG_I8253)            += i8253.o
 
 obj-$(CONFIG_KEXEC)            += machine_kexec.o relocate_kernel.o
+obj-$(CONFIG_EARLY_PRINTK)     += early_printk.o
 
 CFLAGS_cpu-bugs64.o    = $(shell if $(CC) $(CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi)
 
--- /dev/null
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2002, 2003, 06, 07 Ralf Baechle (ralf@linux-mips.org)
+ * Copyright (C) 2007 MIPS Technologies, Inc.
+ *   written by Ralf Baechle (ralf@linux-mips.org)
+ */
+#include <linux/console.h>
+#include <linux/init.h>
+
+extern void prom_putchar(char);
+
+static void early_console_write(struct console *con, const char *s, unsigned n)
+{
+       while (n-- && *s) {
+               if (*s == '\n')
+                       prom_putchar('\r');
+               prom_putchar(*s);
+               s++;
+       }
+}
+
+static struct console early_console = {
+       .name   = "early",
+       .write  = early_console_write,
+       .flags  = CON_PRINTBUFFER | CON_BOOT,
+       .index  = -1
+};
+
+void __init setup_early_printk(void)
+{
+       register_console(&early_console);
+}
+
+void __init disable_early_printk(void)
+{
+       unregister_console(&early_console);
+}
 
 {
        cpu_probe();
        prom_init();
+
+#ifdef CONFIG_EARLY_PRINTK
+       {
+               extern void setup_early_printk(void);
+
+               setup_early_printk();
+       }
+#endif
        cpu_report();
 
 #if defined(CONFIG_VT)
 
                    sizeof(struct lasat_eeprom_struct) - 4);
 
        if (crc != lasat_board_info.li_eeprom_info.crc32) {
-               prom_printf("WARNING...\nWARNING...\nEEPROM CRC does not match calculated, attempting to soldier on...\n");
+               printk(KERN_WARNING "WARNING...\nWARNING...\nEEPROM CRC does "
+                      "not match calculated, attempting to soldier on...\n");
        }
 
-       if (lasat_board_info.li_eeprom_info.version != LASAT_EEPROM_VERSION)
-       {
-               prom_printf("WARNING...\nWARNING...\nEEPROM version %d, wanted version %d, attempting to soldier on...\n",
+       if (lasat_board_info.li_eeprom_info.version != LASAT_EEPROM_VERSION) {
+               printk(KERN_WARNING "WARNING...\nWARNING...\nEEPROM version "
+                      "%d, wanted version %d, attempting to soldier on...\n",
                       (unsigned int)lasat_board_info.li_eeprom_info.version,
                       LASAT_EEPROM_VERSION);
        }
        cfg1 = lasat_board_info.li_eeprom_info.cfg[1];
 
        if ( LASAT_W0_DSCTYPE(cfg0) != 1) {
-               prom_printf("WARNING...\nWARNING...\nInvalid configuration read from EEPROM, attempting to soldier on...");
+               printk(KERN_WARNING "WARNING...\nWARNING...\n"
+                      "Invalid configuration read from EEPROM, attempting to "
+                      "soldier on...");
        }
        /* We have a valid configuration */
 
 
 #define PROM_PUTC_ADDR         PROM_JUMP_TABLE_ENTRY(1)
 #define PROM_MONITOR_ADDR      PROM_JUMP_TABLE_ENTRY(2)
 
-static void null_prom_printf(const char * fmt, ...)
-{
-}
-
 static void null_prom_display(const char *string, int pos, int clear)
 {
 }
 }
 
 /* these are functions provided by the bootloader */
-static void (* prom_putc)(char c) = null_prom_putc;
-void (* prom_printf)(const char * fmt, ...) = null_prom_printf;
+static void (* __prom_putc)(char c) = null_prom_putc;
+
+void prom_putchar(char c)
+{
+       __prom_putc(c);
+}
+
 void (* prom_display)(const char *string, int pos, int clear) =
                null_prom_display;
 void (* prom_monitor)(void) = null_prom_monitor;
 
 unsigned int lasat_ndelay_divider;
 
-#define PROM_PRINTFBUF_SIZE 256
-static char prom_printfbuf[PROM_PRINTFBUF_SIZE];
-
-static void real_prom_printf(const char * fmt, ...)
-{
-       va_list ap;
-       int len;
-       char *c = prom_printfbuf;
-       int i;
-
-       va_start(ap, fmt);
-       len = vsnprintf(prom_printfbuf, PROM_PRINTFBUF_SIZE, fmt, ap);
-       va_end(ap);
-
-       /* output overflowed the buffer */
-       if (len < 0 || len > PROM_PRINTFBUF_SIZE)
-               len = PROM_PRINTFBUF_SIZE;
-
-       for (i=0; i < len; i++) {
-               if (*c == '\n')
-                       prom_putc('\r');
-               prom_putc(*c++);
-       }
-}
-
 static void setup_prom_vectors(void)
 {
        u32 version = *(u32 *)(RESET_VECTOR + 0x90);
 
        if (version >= 307) {
                prom_display = (void *)PROM_DISPLAY_ADDR;
-               prom_putc = (void *)PROM_PUTC_ADDR;
-               prom_printf = real_prom_printf;
+               __prom_putc = (void *)PROM_PUTC_ADDR;
                prom_monitor = (void *)PROM_MONITOR_ADDR;
        }
-       prom_printf("prom vectors set up\n");
+       printk("prom vectors set up\n");
 }
 
 static struct at93c_defs at93c_defs[N_MACHTYPES] = {
        setup_prom_vectors();
 
        if (current_cpu_data.cputype == CPU_R5000) {
-               prom_printf("LASAT 200 board\n");
+               printk("LASAT 200 board\n");
                mips_machtype = MACH_LASAT_200;
                 lasat_ndelay_divider = LASAT_200_DIVIDER;
         } else {
-               prom_printf("LASAT 100 board\n");
+               printk("LASAT 100 board\n");
                mips_machtype = MACH_LASAT_100;
                 lasat_ndelay_divider = LASAT_100_DIVIDER;
         }
 
 #define PROM_H
 extern void (* prom_display)(const char *string, int pos, int clear);
 extern void (* prom_monitor)(void);
-extern void (* prom_printf)(const char * fmt, ...);
 #endif
 
        /* Switch from prom exception handler to normal mode */
        change_c0_status(ST0_BEV,0);
 
-       prom_printf("Lasat specific initialization complete\n");
+       pr_info("Lasat specific initialization complete\n");
 }
 
 # Makefile for MIPS-specific library files..
 #
 
-lib-y  += csum_partial.o memcpy.o memcpy-inatomic.o memset.o promlib.o \
-          strlen_user.o strncpy_user.o strnlen_user.o uncached.o
+lib-y  += csum_partial.o memcpy.o memcpy-inatomic.o memset.o strlen_user.o \
+          strncpy_user.o strnlen_user.o uncached.o
 
 obj-y                  += iomap.o
 obj-$(CONFIG_PCI)      += iomap-pci.o
 
+++ /dev/null
-#include <stdarg.h>
-#include <linux/kernel.h>
-
-extern void prom_putchar(char);
-
-void prom_printf(char *fmt, ...)
-{
-       va_list args;
-       char ppbuf[1024];
-       char *bptr;
-
-       va_start(args, fmt);
-       vsprintf(ppbuf, fmt, args);
-
-       bptr = ppbuf;
-
-       while (*bptr != 0) {
-               if (*bptr == '\n')
-                       prom_putchar('\r');
-
-               prom_putchar(*bptr++);
-       }
-       va_end(args);
-}
 
 # Makefile for the MIPS boards generic routines under Linux.
 #
 
-obj-y                          := reset.o display.o init.o memory.o printf.o \
+obj-y                          := reset.o display.o init.o memory.o \
                                   cmdline.o time.o
+
+obj-$(CONFIG_EARLY_PRINTK)     += console.o
 obj-$(CONFIG_PCI)              += pci.o
 obj-$(CONFIG_KGDB)             += gdb_hook.o
 
  *
  * Putting things on the screen/serial line using YAMONs facilities.
  */
+#include <linux/console.h>
 #include <linux/init.h>
-#include <linux/kernel.h>
 #include <linux/serial_reg.h>
-#include <linux/spinlock.h>
 #include <asm/io.h>
 
 #ifdef CONFIG_MIPS_ATLAS
 
        return 1;
 }
-
-char prom_getchar(void)
-{
-       while (!(serial_in(UART_LSR) & UART_LSR_DR))
-               ;
-
-       return serial_in(UART_RX);
-}
-
 
                        flow = 'r';
                sprintf (console_string, " console=ttyS0,%d%c%c%c", baud, parity, bits, flow);
                strcat (prom_getcmdline(), console_string);
-               prom_printf("Config serial console:%s\n", console_string);
+               pr_info("Config serial console:%s\n", console_string);
        }
 }
 #endif
                        generic_getDebugChar = rs_getDebugChar;
                }
 
-               prom_printf("KGDB: Using serial line /dev/ttyS%d at %d for session, "
-                           "please connect your debugger\n", line ? 1 : 0, speed);
+               pr_info("KGDB: Using serial line /dev/ttyS%d at %d for "
+                       "session, please connect your debugger\n",
+                       line ? 1 : 0, speed);
 
                {
                        char *s;
        board_nmi_handler_setup = mips_nmi_setup;
        board_ejtag_handler_setup = mips_ejtag_setup;
 
-       prom_printf("\nLINUX started...\n");
+       pr_info("\nLINUX started...\n");
        prom_init_cmdline();
        prom_meminit();
 #ifdef CONFIG_SERIAL_8250_CONSOLE
 
        /* otherwise look in the environment */
        memsize_str = prom_getenv("memsize");
        if (!memsize_str) {
-               prom_printf("memsize not set in boot prom, set to default (32Mb)\n");
+               printk(KERN_WARNING
+                      "memsize not set in boot prom, set to default (32Mb)\n");
                physical_memsize = 0x02000000;
        } else {
 #ifdef DEBUG
-               prom_printf("prom_memsize = %s\n", memsize_str);
+               pr_debug("prom_memsize = %s\n", memsize_str);
 #endif
                physical_memsize = simple_strtol(memsize_str, NULL, 0);
        }
        struct prom_pmemblock *p;
 
 #ifdef DEBUG
-       prom_printf("YAMON MEMORY DESCRIPTOR dump:\n");
+       pr_debug("YAMON MEMORY DESCRIPTOR dump:\n");
        p = prom_getmdesc();
        while (p->size) {
                int i = 0;
-               prom_printf("[%d,%p]: base<%08lx> size<%08lx> type<%s>\n",
-                           i, p, p->base, p->size, mtypes[p->type]);
+               pr_debug("[%d,%p]: base<%08lx> size<%08lx> type<%s>\n",
+                        i, p, p->base, p->size, mtypes[p->type]);
                p++;
                i++;
        }
 
 #
 # Copyright (C) 2005 MIPS Technologies, Inc.  All rights reserved.
+# Copyright (C) 2007 MIPS Technologies, Inc.
+#   written by Ralf Baechle (ralf@linux-mips.org)
 #
 # This program is free software; you can distribute it and/or modify it
 # under the terms of the GNU General Public License (Version 2) as
 # 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
 #
 
-obj-y := sim_setup.o sim_mem.o sim_time.o sim_printf.o sim_int.o sim_cmdline.o
+obj-y := sim_setup.o sim_mem.o sim_time.o sim_int.o sim_cmdline.o
+
+obj-$(CONFIG_EARLY_PRINTK) += sim_console.o
 obj-$(CONFIG_SMP) += sim_smp.o
 
 /*
- * Carsten Langgaard, carstenl@mips.com
- * Copyright (C) 1999,2000 MIPS Technologies, Inc.  All rights reserved.
- *
  *  This program is free software; you can distribute it and/or modify it
  *  under the terms of the GNU General Public License (Version 2) as
  *  published by the Free Software Foundation.
  *  with this program; if not, write to the Free Software Foundation, Inc.,
  *  59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
  *
- * Putting things on the screen/serial line using YAMONs facilities.
+ * Carsten Langgaard, carstenl@mips.com
+ * Copyright (C) 1999,2000 MIPS Technologies, Inc.  All rights reserved.
+ * Copyright (C) 2007 MIPS Technologies, Inc.
+ *   written by Ralf Baechle
  */
 #include <linux/init.h>
-#include <linux/kernel.h>
 #include <linux/serial_reg.h>
-#include <linux/spinlock.h>
 #include <asm/io.h>
-#include <asm/system.h>
 
 static inline unsigned int serial_in(int offset)
 {
        outb(value, 0x3f8 + offset);
 }
 
-int putPromChar(char c)
+void __init prom_putchar(char c)
 {
        while ((serial_in(UART_LSR) & UART_LSR_THRE) == 0)
                ;
 
        serial_out(UART_TX, c);
-
-       return 1;
-}
-
-char getPromChar(void)
-{
-       while (!(serial_in(UART_LSR) & 1))
-               ;
-
-       return serial_in(UART_RX);
-}
-
-void prom_printf(char *fmt, ...)
-{
-       va_list args;
-       int l;
-       char *p, *buf_end;
-       char buf[1024];
-
-       va_start(args, fmt);
-       l = vsprintf(buf, fmt, args); /* hopefully i < sizeof(buf) */
-       va_end(args);
-
-       buf_end = buf + l;
-
-       for (p = buf; p < buf_end; p++) {
-               /* Crude cr/nl handling is better than none */
-               if (*p == '\n')
-                       putPromChar('\r');
-               putPromChar(*p);
-       }
 }
 
        unsigned int memsize;
 
        memsize = 0x02000000;
-       prom_printf("Setting default memory size 0x%08x\n", memsize);
+       pr_info("Setting default memory size 0x%08x\n", memsize);
 
        memset(mdesc, 0, sizeof(mdesc));
 
 
        serial_init();
 
        board_time_init = sim_time_init;
-       prom_printf("Linux started...\n");
+       pr_info("Linux started...\n");
 
 #ifdef CONFIG_MIPS_MT_SMP
        sanitize_tlb_entries();
 {
        set_io_port_base(0xbfd00000);
 
-       prom_printf("\nLINUX started...\n");
+       pr_info("\nLINUX started...\n");
        prom_init_cmdline();
        prom_meminit();
 }
        s.timeout = 4;
 
        if (early_serial_setup(&s) != 0) {
-               prom_printf(KERN_ERR "Serial setup failed!\n");
+               printk(KERN_ERR "Serial setup failed!\n");
        }
 
 #endif
 
 static inline void breakout_errctl(unsigned int val)
 {
        if (val & CP0_ERRCTL_RECOVERABLE)
-               prom_printf(" recoverable");
+               printk(" recoverable");
        if (val & CP0_ERRCTL_DCACHE)
-               prom_printf(" dcache");
+               printk(" dcache");
        if (val & CP0_ERRCTL_ICACHE)
-               prom_printf(" icache");
+               printk(" icache");
        if (val & CP0_ERRCTL_MULTIBUS)
-               prom_printf(" multiple-buserr");
-       prom_printf("\n");
+               printk(" multiple-buserr");
+       printk("\n");
 }
 
 static inline void breakout_cerri(unsigned int val)
 {
        if (val & CP0_CERRI_TAG_PARITY)
-               prom_printf(" tag-parity");
+               printk(" tag-parity");
        if (val & CP0_CERRI_DATA_PARITY)
-               prom_printf(" data-parity");
+               printk(" data-parity");
        if (val & CP0_CERRI_EXTERNAL)
-               prom_printf(" external");
-       prom_printf("\n");
+               printk(" external");
+       printk("\n");
 }
 
 static inline void breakout_cerrd(unsigned int val)
 {
        switch (val & CP0_CERRD_CAUSES) {
        case CP0_CERRD_LOAD:
-               prom_printf(" load,");
+               printk(" load,");
                break;
        case CP0_CERRD_STORE:
-               prom_printf(" store,");
+               printk(" store,");
                break;
        case CP0_CERRD_FILLWB:
-               prom_printf(" fill/wb,");
+               printk(" fill/wb,");
                break;
        case CP0_CERRD_COHERENCY:
-               prom_printf(" coherency,");
+               printk(" coherency,");
                break;
        case CP0_CERRD_DUPTAG:
-               prom_printf(" duptags,");
+               printk(" duptags,");
                break;
        default:
-               prom_printf(" NO CAUSE,");
+               printk(" NO CAUSE,");
                break;
        }
        if (!(val & CP0_CERRD_TYPES))
-               prom_printf(" NO TYPE");
+               printk(" NO TYPE");
        else {
                if (val & CP0_CERRD_MULTIPLE)
-                       prom_printf(" multi-err");
+                       printk(" multi-err");
                if (val & CP0_CERRD_TAG_STATE)
-                       prom_printf(" tag-state");
+                       printk(" tag-state");
                if (val & CP0_CERRD_TAG_ADDRESS)
-                       prom_printf(" tag-address");
+                       printk(" tag-address");
                if (val & CP0_CERRD_DATA_SBE)
-                       prom_printf(" data-SBE");
+                       printk(" data-SBE");
                if (val & CP0_CERRD_DATA_DBE)
-                       prom_printf(" data-DBE");
+                       printk(" data-DBE");
                if (val & CP0_CERRD_EXTERNAL)
-                       prom_printf(" external");
+                       printk(" external");
        }
-       prom_printf("\n");
+       printk("\n");
 }
 
 #ifndef CONFIG_SIBYTE_BUS_WATCHER
                l2_tag = in64(IO_SPACE_BASE | A_L2_ECC_TAG);
 #endif
                memio_err = csr_in32(IOADDR(A_BUS_MEM_IO_ERRORS));
-               prom_printf("Bus watcher error counters: %08x %08x\n", l2_err, memio_err);
-               prom_printf("\nLast recorded signature:\n");
-               prom_printf("Request %02x from %d, answered by %d with Dcode %d\n",
+               printk("Bus watcher error counters: %08x %08x\n", l2_err, memio_err);
+               printk("\nLast recorded signature:\n");
+               printk("Request %02x from %d, answered by %d with Dcode %d\n",
                       (unsigned int)(G_SCD_BERR_TID(status) & 0x3f),
                       (int)(G_SCD_BERR_TID(status) >> 6),
                       (int)G_SCD_BERR_RID(status),
                       (int)G_SCD_BERR_DCODE(status));
 #ifdef DUMP_L2_ECC_TAG_ON_ERROR
-               prom_printf("Last L2 tag w/ bad ECC: %016llx\n", l2_tag);
+               printk("Last L2 tag w/ bad ECC: %016llx\n", l2_tag);
 #endif
        } else {
-               prom_printf("Bus watcher indicates no error\n");
+               printk("Bus watcher indicates no error\n");
        }
 }
 #else
 #else
        csr_out32(M_SCD_TRACE_CFG_FREEZE, IO_SPACE_BASE | A_SCD_TRACE_CFG);
 #endif
-       prom_printf("Trace buffer frozen\n");
+       printk("Trace buffer frozen\n");
 #endif
 
-       prom_printf("Cache error exception on CPU %x:\n",
-                   (read_c0_prid() >> 25) & 0x7);
+       printk("Cache error exception on CPU %x:\n",
+              (read_c0_prid() >> 25) & 0x7);
 
        __asm__ __volatile__ (
        "       .set    push\n\t"
          "=r" (dpahi), "=r" (dpalo), "=r" (eepc));
 
        cerr_dpa = (((uint64_t)dpahi) << 32) | dpalo;
-       prom_printf(" c0_errorepc ==   %08x\n", eepc);
-       prom_printf(" c0_errctl   ==   %08x", errctl);
+       printk(" c0_errorepc ==   %08x\n", eepc);
+       printk(" c0_errctl   ==   %08x", errctl);
        breakout_errctl(errctl);
        if (errctl & CP0_ERRCTL_ICACHE) {
-               prom_printf(" c0_cerr_i   ==   %08x", cerr_i);
+               printk(" c0_cerr_i   ==   %08x", cerr_i);
                breakout_cerri(cerr_i);
                if (CP0_CERRI_IDX_VALID(cerr_i)) {
                        /* Check index of EPC, allowing for delay slot */
                        if (((eepc & SB1_CACHE_INDEX_MASK) != (cerr_i & SB1_CACHE_INDEX_MASK)) &&
                            ((eepc & SB1_CACHE_INDEX_MASK) != ((cerr_i & SB1_CACHE_INDEX_MASK) - 4)))
-                               prom_printf(" cerr_i idx doesn't match eepc\n");
+                               printk(" cerr_i idx doesn't match eepc\n");
                        else {
                                res = extract_ic(cerr_i & SB1_CACHE_INDEX_MASK,
                                                 (cerr_i & CP0_CERRI_DATA) != 0);
                                if (!(res & cerr_i))
-                                       prom_printf("...didn't see indicated icache problem\n");
+                                       printk("...didn't see indicated icache problem\n");
                        }
                }
        }
        if (errctl & CP0_ERRCTL_DCACHE) {
-               prom_printf(" c0_cerr_d   ==   %08x", cerr_d);
+               printk(" c0_cerr_d   ==   %08x", cerr_d);
                breakout_cerrd(cerr_d);
                if (CP0_CERRD_DPA_VALID(cerr_d)) {
-                       prom_printf(" c0_cerr_dpa == %010llx\n", cerr_dpa);
+                       printk(" c0_cerr_dpa == %010llx\n", cerr_dpa);
                        if (!CP0_CERRD_IDX_VALID(cerr_d)) {
                                res = extract_dc(cerr_dpa & SB1_CACHE_INDEX_MASK,
                                                 (cerr_d & CP0_CERRD_DATA) != 0);
                                if (!(res & cerr_d))
-                                       prom_printf("...didn't see indicated dcache problem\n");
+                                       printk("...didn't see indicated dcache problem\n");
                        } else {
                                if ((cerr_dpa & SB1_CACHE_INDEX_MASK) != (cerr_d & SB1_CACHE_INDEX_MASK))
-                                       prom_printf(" cerr_d idx doesn't match cerr_dpa\n");
+                                       printk(" cerr_d idx doesn't match cerr_dpa\n");
                                else {
                                        res = extract_dc(cerr_d & SB1_CACHE_INDEX_MASK,
                                                         (cerr_d & CP0_CERRD_DATA) != 0);
                                        if (!(res & cerr_d))
-                                               prom_printf("...didn't see indicated problem\n");
+                                               printk("...didn't see indicated problem\n");
                                }
                        }
                }
        uint8_t lru;
        int res = 0;
 
-       prom_printf("Icache index 0x%04x  ", addr);
+       printk("Icache index 0x%04x  ", addr);
        for (way = 0; way < 4; way++) {
                /* Index-load-tag-I */
                __asm__ __volatile__ (
                taglo = ((unsigned long long)taglohi << 32) | taglolo;
                if (way == 0) {
                        lru = (taghi >> 14) & 0xff;
-                       prom_printf("[Bank %d Set 0x%02x]  LRU > %d %d %d %d > MRU\n",
+                       printk("[Bank %d Set 0x%02x]  LRU > %d %d %d %d > MRU\n",
                                    ((addr >> 5) & 0x3), /* bank */
                                    ((addr >> 7) & 0x3f), /* index */
                                    (lru & 0x3),
                if (valid) {
                        tlo_tmp = taglo & 0xfff3ff;
                        if (((taglo >> 10) & 1) ^ range_parity(tlo_tmp, 23, 0)) {
-                               prom_printf("   ** bad parity in VTag0/G/ASID\n");
+                               printk("   ** bad parity in VTag0/G/ASID\n");
                                res |= CP0_CERRI_TAG_PARITY;
                        }
                        if (((taglo >> 11) & 1) ^ range_parity(taglo, 63, 24)) {
-                               prom_printf("   ** bad parity in R/VTag1\n");
+                               printk("   ** bad parity in R/VTag1\n");
                                res |= CP0_CERRI_TAG_PARITY;
                        }
                }
                if (valid ^ ((taghi >> 27) & 1)) {
-                       prom_printf("   ** bad parity for valid bit\n");
+                       printk("   ** bad parity for valid bit\n");
                        res |= CP0_CERRI_TAG_PARITY;
                }
-               prom_printf(" %d  [VA %016llx]  [Vld? %d]  raw tags: %08X-%016llX\n",
+               printk(" %d  [VA %016llx]  [Vld? %d]  raw tags: %08X-%016llX\n",
                            way, va, valid, taghi, taglo);
 
                if (data) {
                                : "r" ((way << 13) | addr | (offset << 3)));
                                predecode = (datahi >> 8) & 0xff;
                                if (((datahi >> 16) & 1) != (uint32_t)range_parity(predecode, 7, 0)) {
-                                       prom_printf("   ** bad parity in predecode\n");
+                                       printk("   ** bad parity in predecode\n");
                                        res |= CP0_CERRI_DATA_PARITY;
                                }
                                /* XXXKW should/could check predecode bits themselves */
                                if (((datahi >> 4) & 0xf) ^ inst_parity(insta)) {
-                                       prom_printf("   ** bad parity in instruction a\n");
+                                       printk("   ** bad parity in instruction a\n");
                                        res |= CP0_CERRI_DATA_PARITY;
                                }
                                if ((datahi & 0xf) ^ inst_parity(instb)) {
-                                       prom_printf("   ** bad parity in instruction b\n");
+                                       printk("   ** bad parity in instruction b\n");
                                        res |= CP0_CERRI_DATA_PARITY;
                                }
-                               prom_printf("  %05X-%08X%08X", datahi, insta, instb);
+                               printk("  %05X-%08X%08X", datahi, insta, instb);
                        }
-                       prom_printf("\n");
+                       printk("\n");
                }
        }
        return res;
        uint8_t ecc, lru;
        int res = 0;
 
-       prom_printf("Dcache index 0x%04x  ", addr);
+       printk("Dcache index 0x%04x  ", addr);
        for (way = 0; way < 4; way++) {
                __asm__ __volatile__ (
                "       .set    push\n\t"
                pa = (taglo & 0xFFFFFFE000ULL) | addr;
                if (way == 0) {
                        lru = (taghi >> 14) & 0xff;
-                       prom_printf("[Bank %d Set 0x%02x]  LRU > %d %d %d %d > MRU\n",
+                       printk("[Bank %d Set 0x%02x]  LRU > %d %d %d %d > MRU\n",
                                    ((addr >> 11) & 0x2) | ((addr >> 5) & 1), /* bank */
                                    ((addr >> 6) & 0x3f), /* index */
                                    (lru & 0x3),
                }
                state = (taghi >> 25) & 0x1f;
                valid = DC_TAG_VALID(state);
-               prom_printf(" %d  [PA %010llx]  [state %s (%02x)]  raw tags: %08X-%016llX\n",
+               printk(" %d  [PA %010llx]  [state %s (%02x)]  raw tags: %08X-%016llX\n",
                            way, pa, dc_state_str(state), state, taghi, taglo);
                if (valid) {
                        if (((taglo >> 11) & 1) ^ range_parity(taglo, 39, 26)) {
-                               prom_printf("   ** bad parity in PTag1\n");
+                               printk("   ** bad parity in PTag1\n");
                                res |= CP0_CERRD_TAG_ADDRESS;
                        }
                        if (((taglo >> 10) & 1) ^ range_parity(taglo, 25, 13)) {
-                               prom_printf("   ** bad parity in PTag0\n");
+                               printk("   ** bad parity in PTag0\n");
                                res |= CP0_CERRD_TAG_ADDRESS;
                        }
                } else {
                                        }
                                        res |= (bits == 1) ? CP0_CERRD_DATA_SBE : CP0_CERRD_DATA_DBE;
                                }
-                               prom_printf("  %02X-%016llX", datahi, datalo);
+                               printk("  %02X-%016llX", datahi, datalo);
                        }
-                       prom_printf("\n");
+                       printk("\n");
                        if (bad_ecc)
-                               prom_printf("  dwords w/ bad ECC: %d %d %d %d\n",
-                                           !!(bad_ecc & 8), !!(bad_ecc & 4),
-                                           !!(bad_ecc & 2), !!(bad_ecc & 1));
+                               printk("  dwords w/ bad ECC: %d %d %d %d\n",
+                                      !!(bad_ecc & 8), !!(bad_ecc & 4),
+                                      !!(bad_ecc & 2), !!(bad_ecc & 1));
                }
        }
        return res;
 
        uart->iu_thr = c;
 }
 
-char __init prom_getchar(void)
-{
-       return 0;
-}
-
 static void inline ja_console_probe(void)
 {
        struct uart_port up;
 
 
 extern int pnx8550_console_port;
 
-/* used by prom_printf */
+/* used by early printk */
 void prom_putchar(char c)
 {
        if (pnx8550_console_port != -1) {
 
 #include <uart.h>
 #include <nand.h>
 
-extern void prom_printf(char *fmt, ...);
-
 extern void __init board_setup(void);
 extern void pnx8550_machine_restart(char *);
 extern void pnx8550_machine_halt(void);
 extern struct resource iomem_resource;
 extern void pnx8550_time_init(void);
 extern void rs_kgdb_hook(int tty_no);
-extern void prom_printf(char *fmt, ...);
 extern char *prom_getcmdline(void);
 
 struct resource standard_io_resources[] = {
                argptr += strlen("console=ttyS");
                pnx8550_console_port = *argptr == '0' ? 0 : 1;
 
-               /* We must initialize the UART (console) before prom_printf */
+               /* We must initialize the UART (console) before early printk */
                /* Set LCR to 8-bit and BAUD to 38400 (no 5)                */
                ip3106_lcr(UART_BASE, pnx8550_console_port) =
                        PNX8XXX_UART_LCR_8BIT;
                argptr += strlen("kgdb=ttyS");
                line = *argptr == '0' ? 0 : 1;
                rs_kgdb_hook(line);
-               prom_printf("KGDB: Using ttyS%i for session, "
-                               "please connect your debugger\n", line ? 1 : 0);
+               pr_info("KGDB: Using ttyS%i for session, "
+                       "please connect your debugger\n", line ? 1 : 0);
        }
 #endif
        return;
 
        while ((readb_outer_space(lsr) & 0x20) == 0);
        writeb_outer_space(thr, c);
 }
-
-char __init prom_getchar(void)
-{
-       return 0;
-}
 
  * Copyright (C) 2001, 2002 Ralf Baechle
  */
 #include <linux/init.h>
-#include <linux/console.h>
-#include <linux/kdev_t.h>
-#include <linux/major.h>
-#include <linux/termios.h>
-#include <linux/sched.h>
-#include <linux/tty.h>
 
 #include <asm/page.h>
 #include <asm/semaphore.h>
        return &ioc3->sregs.uarta;
 }
 
-void prom_putchar(char c)
+void __init prom_putchar(char c)
 {
        struct ioc3_uartregs *uart = console_uart();
 
        while ((uart->iu_lsr & 0x20) == 0);
        uart->iu_thr = c;
 }
-
-static void ioc3_console_write(struct console *con, const char *s, unsigned n)
-{
-       while (n-- && *s) {
-               if (*s == '\n')
-                       prom_putchar('\r');
-               prom_putchar(*s);
-               s++;
-       }
-}
-
-static struct console ioc3_console = {
-       .name   = "ioc3",
-       .write  = ioc3_console_write,
-       .flags  = CON_PRINTBUFFER | CON_BOOT,
-       .index  = -1
-};
-
-__init void ip27_setup_console(void)
-{
-       register_console(&ioc3_console);
-}
-
-void __init disable_early_printk(void)
-{
-       unregister_console(&ioc3_console);
-}
 
 config SIBYTE_CFE
        bool "Booting from CFE"
        depends on SIBYTE_SB1xxx_SOC
+       select SYS_HAS_EARLY_PRINTK
        help
          Make use of the CFE API for enumerating available memory,
          controlling secondary CPUs, and possibly console output.
 config SIBYTE_STANDALONE
        bool
        depends on SIBYTE_SB1xxx_SOC && !SIBYTE_CFE
+       select SYS_HAS_EARLY_PRINTK
        default y
 
 config SIBYTE_STANDALONE_RAM_SIZE
 
 #ifdef CONFIG_GDB_CONSOLE
                register_gdb_console();
 #endif
-               prom_printf("Waiting for GDB on UART port %d\n", kgdb_port);
+               printk("Waiting for GDB on UART port %d\n", kgdb_port);
                set_debug_traps();
                breakpoint();
        }
 
                break;
 
            default:
-               prom_printf("Unknown part type %x\n", part_type);
+               printk("Unknown part type %x\n", part_type);
                ret = 1;
                break;
        }
                pass_str = "B0 (pass2)";
                break;
            default:
-               prom_printf("Unknown %s rev %x\n", soc_str, soc_pass);
+               printk("Unknown %s rev %x\n", soc_str, soc_pass);
                periph_rev = 1;
                pass_str = "Unknown Revision";
                break;
        soc_pass = G_SYS_REVISION(sys_rev);
 
        if (sys_rev_decode()) {
-               prom_printf("Restart after failure to identify SiByte chip\n");
+               printk("Restart after failure to identify SiByte chip\n");
                machine_restart(NULL);
        }
 
        plldiv = G_BCM1480_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG)));
        zbbus_mhz = ((plldiv >> 1) * 50) + ((plldiv & 1) * 25);
 
-       prom_printf("Broadcom SiByte %s %s @ %d MHz (SB-1A rev %d)\n",
+       printk("Broadcom SiByte %s %s @ %d MHz (SB-1A rev %d)\n",
                    soc_str, pass_str, zbbus_mhz * 2, sb1_pass);
-       prom_printf("Board type: %s\n", get_system_type());
+       printk("Board type: %s\n", get_system_type());
 }
 
                goto fail;
        }
        initrd_end = initrd_start + initrd_size;
-       prom_printf("Found initrd of %lx@%lx\n", initrd_size, initrd_start);
+       printk("Found initrd of %lx@%lx\n", initrd_size, initrd_start);
        return 1;
  fail:
-       prom_printf("Bad initrd argument.  Disabling initrd\n");
+       printk("Bad initrd argument.  Disabling initrd\n");
        initrd_start = 0;
        initrd_end = 0;
        return 1;
        }
        if (cfe_eptseal != CFE_EPTSEAL) {
                /* too early for panic to do any good */
-               prom_printf("CFE's entrypoint seal doesn't match. Spinning.");
+               printk("CFE's entrypoint seal doesn't match. Spinning.");
                while (1) ;
        }
        cfe_init(cfe_handle, cfe_ept);
                } else {
                        /* The loader should have set the command line */
                        /* too early for panic to do any good */
-                       prom_printf("LINUX_CMDLINE not defined in cfe.");
+                       printk("LINUX_CMDLINE not defined in cfe.");
                        while (1) ;
                }
        }
 
                ret = setup_bcm112x();
                break;
        default:
-               prom_printf("Unknown SOC type %x\n", soc_type);
+               printk("Unknown SOC type %x\n", soc_type);
                ret = 1;
                break;
        }
                        pass_str = "A0-A6";
                        war_pass = K_SYS_REVISION_BCM1250_PASS2;
                } else {
-                       prom_printf("Unknown BCM1250 rev %x\n", soc_pass);
+                       printk("Unknown BCM1250 rev %x\n", soc_pass);
                        ret = 1;
                }
                break;
                pass_str = "A2";
                break;
        default:
-               prom_printf("Unknown %s rev %x\n", soc_str, soc_pass);
+               printk("Unknown %s rev %x\n", soc_str, soc_pass);
                ret = 1;
        }
        return ret;
        soc_pass = G_SYS_REVISION(sys_rev);
 
        if (sys_rev_decode()) {
-               prom_printf("Restart after failure to identify SiByte chip\n");
+               printk("Restart after failure to identify SiByte chip\n");
                machine_restart(NULL);
        }
 
        plldiv = G_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG)));
        zbbus_mhz = ((plldiv >> 1) * 50) + ((plldiv & 1) * 25);
 
-       prom_printf("Broadcom SiByte %s %s @ %d MHz (SB1 rev %d)\n",
+       printk("Broadcom SiByte %s %s @ %d MHz (SB1 rev %d)\n",
                    soc_str, pass_str, zbbus_mhz * 2, sb1_pass);
-       prom_printf("Board type: %s\n", get_system_type());
+       printk("Board type: %s\n", get_system_type());
 
        switch (war_pass) {
        case K_SYS_REVISION_BCM1250_PASS1:
 #ifndef CONFIG_SB1_PASS_1_WORKAROUNDS
-               prom_printf("@@@@ This is a BCM1250 A0-A2 (Pass 1) board, "
+               printk("@@@@ This is a BCM1250 A0-A2 (Pass 1) board, "
                            "and the kernel doesn't have the proper "
                            "workarounds compiled in. @@@@\n");
                bad_config = 1;
                /* Pass 2 - easiest as default for now - so many numbers */
 #if !defined(CONFIG_SB1_PASS_2_WORKAROUNDS) || \
     !defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS)
-               prom_printf("@@@@ This is a BCM1250 A3-A10 board, and the "
+               printk("@@@@ This is a BCM1250 A3-A10 board, and the "
                            "kernel doesn't have the proper workarounds "
                            "compiled in. @@@@\n");
                bad_config = 1;
 #endif
 #ifdef CONFIG_CPU_HAS_PREFETCH
-               prom_printf("@@@@ Prefetches may be enabled in this kernel, "
+               printk("@@@@ Prefetches may be enabled in this kernel, "
                            "but are buggy on this board.  @@@@\n");
                bad_config = 1;
 #endif
                break;
        case K_SYS_REVISION_BCM1250_PASS2_2:
 #ifndef CONFIG_SB1_PASS_2_WORKAROUNDS
-               prom_printf("@@@@ This is a BCM1250 B1/B2. board, and the "
+               printk("@@@@ This is a BCM1250 B1/B2. board, and the "
                            "kernel doesn't have the proper workarounds "
                            "compiled in. @@@@\n");
                bad_config = 1;
 #endif
 #if defined(CONFIG_SB1_PASS_2_1_WORKAROUNDS) || \
     !defined(CONFIG_CPU_HAS_PREFETCH)
-               prom_printf("@@@@ This is a BCM1250 B1/B2, but the kernel is "
+               printk("@@@@ This is a BCM1250 B1/B2, but the kernel is "
                            "conservatively configured for an 'A' stepping. "
                            "@@@@\n");
 #endif
                break;
        }
        if (bad_config) {
-               prom_printf("Invalid configuration for this chip.\n");
+               printk("Invalid configuration for this chip.\n");
                machine_restart(NULL);
        }
 }
 
  * Copyright (C) 2005-2006 Thomas Bogendoerfer (tsbogend@alpha.franken.de)
  */
 
+#define DEBUG
+
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/string.h>
 #define PROM_ENTRY(x)          (PROM_VEC + (x))
 
 
-#define DEBUG
-#ifdef DEBUG
-#define DBG_PRINTF(x...)     prom_printf(x)
-#else
-#define DBG_PRINTF(x...)
-#endif
-
 static int *(*__prom_putchar)(int)        = (int *(*)(int))PROM_ENTRY(PROM_PUTCHAR);
+
+void prom_putchar(char c)
+{
+       __prom_putchar(c);
+}
+
 static char *(*__prom_getenv)(char *)     = (char *(*)(char *))PROM_ENTRY(PROM_GETENV);
 static void (*__prom_get_memconf)(void *) = (void (*)(void *))PROM_ENTRY(PROM_GET_MEMCONF);
 
        return __prom_getenv(s);
 }
 
-void prom_printf(char *fmt, ...)
-{
-       va_list args;
-       char ppbuf[1024];
-       char *bptr;
-
-       va_start(args, fmt);
-       vsprintf(ppbuf, fmt, args);
-
-       bptr = ppbuf;
-
-       while (*bptr != 0) {
-               if (*bptr == '\n')
-                       __prom_putchar('\r');
-
-               __prom_putchar(*bptr++);
-       }
-       va_end(args);
-}
-
 void __init prom_free_prom_memory(void)
 {
 }
 {
        int     i;
 
-       prom_printf("SNI IDProm dump:\n");
+       pr_debug("SNI IDProm dump:\n");
        for (i = 0; i < 256; i++) {
                if (i%16 == 0)
-                       prom_printf("%04x ", i);
+                       pr_debug("%04x ", i);
 
-               prom_printf("%02x ", *(unsigned char *) (SNI_IDPROM_BASE + i));
+               printk("%02x ", *(unsigned char *) (SNI_IDPROM_BASE + i));
 
                if (i % 16 == 15)
-                       prom_printf("\n");
+                       printk("\n");
        }
 }
 #endif
        /* MemSIZE from prom in 16MByte chunks */
        memsize = *((unsigned char *) SNI_IDPROM_MEMSIZE) * 16;
 
-       DBG_PRINTF("IDProm memsize: %lu MByte\n", memsize);
+       pr_debug("IDProm memsize: %lu MByte\n", memsize);
 
        /* get memory bank layout from prom */
        __prom_get_memconf(&memconf);
 
-       DBG_PRINTF("prom_get_mem_conf memory configuration:\n");
+       pr_debug("prom_get_mem_conf memory configuration:\n");
        for (i = 0;i < 8 && memconf[i].size; i++) {
                if (sni_brd_type == SNI_BRD_PCI_TOWER ||
                    sni_brd_type == SNI_BRD_PCI_TOWER_CPLUS) {
                                memconf[i].base -= 0x20000000;
                        }
        }
-               DBG_PRINTF("Bank%d: %08x @ %08x\n", i,
+               pr_debug("Bank%d: %08x @ %08x\n", i,
                        memconf[i].size, memconf[i].base);
                add_memory_region(memconf[i].base, memconf[i].size, BOOT_MEM_RAM);
        }
                systype = "RM300-Exx";
                break;
        }
-       DBG_PRINTF("Found SNI brdtype %02x name %s\n", sni_brd_type,systype);
+       pr_debug("Found SNI brdtype %02x name %s\n", sni_brd_type,systype);
 
 #ifdef DEBUG
        sni_idprom_dump();
 
             __delay(ns / lasat_ndelay_divider);
 }
 
-extern void (* prom_printf)(const char *fmt, ...);
-
 #endif /* !defined (_LANGUAGE_ASSEMBLY) */
 
 #define LASAT_SERVICEMODE_MAGIC_1     0xdeadbeef
 
 
 extern char *prom_getcmdline(void);
 extern char *prom_getenv(char *name);
-extern void setup_prom_printf(int tty_no);
-extern void prom_printf(char *fmt, ...);
 extern void prom_init_cmdline(void);
 extern void prom_meminit(void);
 extern void prom_fixup_mem_map(unsigned long start_mem, unsigned long end_mem);
 
 extern void prom_putchar(char c);
 extern char prom_getchar(void);
 
-/* Generic printf() using ARCS console I/O. */
-extern void prom_printf(char *fmt, ...);
-
 /* Memory descriptor management. */
 #define PROM_MAX_PMEMBLOCKS    32
 struct prom_pmemblock {
 
 extern void bcm1480_unmask_irq(int cpu, int irq);
 extern void bcm1480_smp_finish(void);
 
-extern void prom_printf(char *fmt, ...);
-
 #define AT_spin \
        __asm__ __volatile__ (          \
                ".set noat\n"           \