Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  *    Copyright IBM Corp. 2017
0004  */
0005 
0006 #include <linux/console.h>
0007 #include <linux/kernel.h>
0008 #include <linux/init.h>
0009 #include <asm/sclp.h>
0010 
0011 static void sclp_early_write(struct console *con, const char *s, unsigned int len)
0012 {
0013     __sclp_early_printk(s, len);
0014 }
0015 
0016 static struct console sclp_early_console = {
0017     .name  = "earlysclp",
0018     .write = sclp_early_write,
0019     .flags = CON_PRINTBUFFER | CON_BOOT,
0020     .index = -1,
0021 };
0022 
0023 static int __init setup_early_printk(char *buf)
0024 {
0025     if (early_console)
0026         return 0;
0027     /* Accept only "earlyprintk" and "earlyprintk=sclp" */
0028     if (buf && !str_has_prefix(buf, "sclp"))
0029         return 0;
0030     if (!sclp.has_linemode && !sclp.has_vt220)
0031         return 0;
0032     early_console = &sclp_early_console;
0033     register_console(early_console);
0034     return 0;
0035 }
0036 early_param("earlyprintk", setup_early_printk);