xref: /linux/arch/s390/kernel/early_printk.c (revision e5c86679d5e864947a52fb31e45a425dea3e7fa9)
1 /*
2  *    Copyright IBM Corp. 2017
3  */
4 
5 #include <linux/console.h>
6 #include <linux/kernel.h>
7 #include <linux/init.h>
8 #include <asm/sclp.h>
9 
10 static void sclp_early_write(struct console *con, const char *s, unsigned int len)
11 {
12 	__sclp_early_printk(s, len);
13 }
14 
15 static struct console sclp_early_console = {
16 	.name  = "earlysclp",
17 	.write = sclp_early_write,
18 	.flags = CON_PRINTBUFFER | CON_BOOT,
19 	.index = -1,
20 };
21 
22 static int __init setup_early_printk(char *buf)
23 {
24 	if (early_console)
25 		return 0;
26 	/* Accept only "earlyprintk" and "earlyprintk=sclp" */
27 	if (buf && strncmp(buf, "sclp", 4))
28 		return 0;
29 	if (!sclp.has_linemode && !sclp.has_vt220)
30 		return 0;
31 	early_console = &sclp_early_console;
32 	register_console(early_console);
33 	return 0;
34 }
35 early_param("earlyprintk", setup_early_printk);
36