1/*
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
4 * for more details.
5 *
6 * Copyright (c) 2014 Finn Thain
7 */
8
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>
14
15
16#include "../mvme147/mvme147.h"
17#include "../mvme16x/mvme16x.h"
18
19asmlinkage void __init debug_cons_nputs(struct console *c, const char *s, unsigned int n);
20
21static struct console early_console_instance = {
22 .name = "debug",
23 .flags = CON_PRINTBUFFER | CON_BOOT,
24 .index = -1
25};
26
27static int __init setup_early_printk(char *buf)
28{
29 if (early_console || buf)
30 return 0;
31
32 if (MACH_IS_MVME147)
33 early_console_instance.write = mvme147_scc_write;
34 else if (MACH_IS_MVME16x)
35 early_console_instance.write = mvme16x_cons_write;
36 else
37 early_console_instance.write = debug_cons_nputs;
38 early_console = &early_console_instance;
39 register_console(early_console);
40
41 return 0;
42}
43early_param("earlyprintk", setup_early_printk);
44
45static int __init unregister_early_console(void)
46{
47 /*
48 * debug_cons_nputs() defined in arch/m68k/kernel/head.S cannot be
49 * called after init sections are discarded (for platforms that use it).
50 */
51 if (early_console && early_console->write == debug_cons_nputs)
52 return unregister_console(early_console);
53
54 return 0;
55}
56late_initcall(unregister_early_console);
57

source code of linux/arch/m68k/kernel/early_printk.c