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