1 // SPDX-License-Identifier: GPL-2.0-only
3 * linux/arch/unicore32/kernel/early_printk.c
5 * Code specific to PKUnity SoC and UniCore ISA
7 * Copyright (C) 2001-2010 GUAN Xue-tao
9 #include <linux/console.h>
10 #include <linux/init.h>
11 #include <linux/string.h>
14 /* On-Chip-Debugger functions */
16 static void early_ocd_write(struct console
*con
, const char *s
, unsigned n
)
18 while (*s
&& n
-- > 0) {
26 static struct console early_ocd_console
= {
28 .write
= early_ocd_write
,
29 .flags
= CON_PRINTBUFFER
,
33 static int __init
setup_early_printk(char *buf
)
35 if (!buf
|| early_console
)
38 early_console
= &early_ocd_console
;
39 if (strstr(buf
, "keep"))
40 early_console
->flags
&= ~CON_BOOT
;
42 early_console
->flags
|= CON_BOOT
;
43 register_console(early_console
);
46 early_param("earlyprintk", setup_early_printk
);