[RFC PATCH 11/28] lkl: basic kernel console support

From: Octavian Purdila
Date: Tue Nov 03 2015 - 15:24:51 EST


Write operations are deferred to the host print operation.

Signed-off-by: Octavian Purdila <octavian.purdila@xxxxxxxxx>
---
arch/lkl/kernel/console.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
create mode 100644 arch/lkl/kernel/console.c

diff --git a/arch/lkl/kernel/console.c b/arch/lkl/kernel/console.c
new file mode 100644
index 0000000..bd3a686
--- /dev/null
+++ b/arch/lkl/kernel/console.c
@@ -0,0 +1,41 @@
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/console.h>
+#include <asm/host_ops.h>
+
+static void console_write(struct console *con, const char *str, unsigned len)
+{
+ if (lkl_ops->print)
+ lkl_ops->print(str, len);
+}
+
+#ifdef CONFIG_LKL_EARLY_CONSOLE
+static struct console lkl_boot_console = {
+ .name = "lkl_boot_console",
+ .write = console_write,
+ .flags = CON_PRINTBUFFER | CON_BOOT,
+ .index = -1,
+};
+
+int __init lkl_boot_console_init(void)
+{
+ register_console(&lkl_boot_console);
+ return 0;
+}
+early_initcall(lkl_boot_console_init);
+#endif
+
+static struct console lkl_console = {
+ .name = "lkl_console",
+ .write = console_write,
+ .flags = CON_PRINTBUFFER,
+ .index = -1,
+};
+
+int __init lkl_console_init(void)
+{
+ register_console(&lkl_console);
+ return 0;
+}
+core_initcall(lkl_console_init);
+
--
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/