xref: /openbmc/linux/arch/um/kernel/early_printk.c (revision 0bf49ffb)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright (C) 2011 Richard Weinberger <richrd@nod.at>
4  */
5 
6 #include <linux/kernel.h>
7 #include <linux/console.h>
8 #include <linux/init.h>
9 #include <os.h>
10 
11 static void early_console_write(struct console *con, const char *s, unsigned int n)
12 {
13 	um_early_printk(s, n);
14 }
15 
16 static struct console early_console_dev = {
17 	.name = "earlycon",
18 	.write = early_console_write,
19 	.flags = CON_BOOT,
20 	.index = -1,
21 };
22 
23 static int __init setup_early_printk(char *buf)
24 {
25 	if (!early_console) {
26 		early_console = &early_console_dev;
27 		register_console(&early_console_dev);
28 	}
29 	return 0;
30 }
31 
32 early_param("earlyprintk", setup_early_printk);
33