arm64: dts: Revert "specify console via command line"
[linux/fpc-iii.git] / arch / arm / kernel / early_printk.c
blob03239ca0d5ce2f6c51f2f5c8ff1df65d03f9b473
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * linux/arch/arm/kernel/early_printk.c
5 * Copyright (C) 2009 Sascha Hauer <s.hauer@pengutronix.de>
6 */
8 #include <linux/kernel.h>
9 #include <linux/console.h>
10 #include <linux/init.h>
11 #include <linux/string.h>
13 extern void printascii(const char *);
15 static void early_write(const char *s, unsigned n)
17 char buf[128];
18 while (n) {
19 unsigned l = min(n, sizeof(buf)-1);
20 memcpy(buf, s, l);
21 buf[l] = 0;
22 s += l;
23 n -= l;
24 printascii(buf);
28 static void early_console_write(struct console *con, const char *s, unsigned n)
30 early_write(s, n);
33 static struct console early_console_dev = {
34 .name = "earlycon",
35 .write = early_console_write,
36 .flags = CON_PRINTBUFFER | CON_BOOT,
37 .index = -1,
40 static int __init setup_early_printk(char *buf)
42 early_console = &early_console_dev;
43 register_console(&early_console_dev);
44 return 0;
47 early_param("earlyprintk", setup_early_printk);