aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/paravirt/serial.c
diff options
context:
space:
mode:
authorJames Morris <james.l.morris@oracle.com>2014-07-17 02:10:27 +1000
committerJames Morris <james.l.morris@oracle.com>2014-07-17 02:10:27 +1000
commitbd89bb78f35fd175db7a9cfc504d789b6ca0f7b0 (patch)
treedee9f8b31f3d6d2fb141541da88e1cc1329b017e /arch/mips/paravirt/serial.c
parentMerge commit 'v3.15' into next (diff)
parentLinux 3.16-rc5 (diff)
downloadlinux-dev-bd89bb78f35fd175db7a9cfc504d789b6ca0f7b0.tar.xz
linux-dev-bd89bb78f35fd175db7a9cfc504d789b6ca0f7b0.zip
Sync with the changes pushed by Serge in the last merge window.
Diffstat (limited to 'arch/mips/paravirt/serial.c')
-rw-r--r--arch/mips/paravirt/serial.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/arch/mips/paravirt/serial.c b/arch/mips/paravirt/serial.c
new file mode 100644
index 000000000000..02b665c02272
--- /dev/null
+++ b/arch/mips/paravirt/serial.c
@@ -0,0 +1,40 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2013 Cavium, Inc.
+ */
+
+#include <linux/kernel.h>
+#include <linux/virtio_console.h>
+#include <linux/kvm_para.h>
+
+/*
+ * Emit one character to the boot console.
+ */
+int prom_putchar(char c)
+{
+ kvm_hypercall3(KVM_HC_MIPS_CONSOLE_OUTPUT, 0 /* port 0 */,
+ (unsigned long)&c, 1 /* len == 1 */);
+
+ return 1;
+}
+
+#ifdef CONFIG_VIRTIO_CONSOLE
+static int paravirt_put_chars(u32 vtermno, const char *buf, int count)
+{
+ kvm_hypercall3(KVM_HC_MIPS_CONSOLE_OUTPUT, vtermno,
+ (unsigned long)buf, count);
+
+ return count;
+}
+
+static int __init paravirt_cons_init(void)
+{
+ virtio_cons_early_init(paravirt_put_chars);
+ return 0;
+}
+core_initcall(paravirt_cons_init);
+
+#endif