2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (c) 2014 Finn Thain
9 #include <linux/kernel.h>
10 #include <linux/console.h>
11 #include <linux/init.h>
12 #include <linux/string.h>
13 #include <asm/setup.h>
15 asmlinkage void __init debug_cons_nputs(const char *s, unsigned n);
17 static void debug_cons_write(struct console *c,
18 const char *s, unsigned n)
20 debug_cons_nputs(s, n);
23 static struct console early_console_instance = {
25 .write = debug_cons_write,
26 .flags = CON_PRINTBUFFER | CON_BOOT,
30 static int __init setup_early_printk(char *buf)
32 /* MVME16x registers an early console after interrupt setup. */
36 if (early_console || buf)
39 early_console = &early_console_instance;
40 register_console(early_console);
44 early_param("earlyprintk", setup_early_printk);
47 * debug_cons_nputs() defined in arch/m68k/kernel/head.S cannot be called
48 * after init sections are discarded (for platforms that use it).
50 #if !(defined(CONFIG_SUN3) || defined(CONFIG_M68360) || \
51 defined(CONFIG_M68000) || defined(CONFIG_COLDFIRE))
53 static int __init unregister_early_console(void)
58 return unregister_console(early_console);
60 late_initcall(unregister_early_console);