This source file includes following definitions.
- hvc_sbi_tty_put
- hvc_sbi_tty_get
- hvc_sbi_init
- hvc_sbi_console_init
1
2
3
4
5
6
7
8 #include <linux/console.h>
9 #include <linux/err.h>
10 #include <linux/init.h>
11 #include <linux/moduleparam.h>
12 #include <linux/types.h>
13
14 #include <asm/sbi.h>
15
16 #include "hvc_console.h"
17
18 static int hvc_sbi_tty_put(uint32_t vtermno, const char *buf, int count)
19 {
20 int i;
21
22 for (i = 0; i < count; i++)
23 sbi_console_putchar(buf[i]);
24
25 return i;
26 }
27
28 static int hvc_sbi_tty_get(uint32_t vtermno, char *buf, int count)
29 {
30 int i, c;
31
32 for (i = 0; i < count; i++) {
33 c = sbi_console_getchar();
34 if (c < 0)
35 break;
36 buf[i] = c;
37 }
38
39 return i;
40 }
41
42 static const struct hv_ops hvc_sbi_ops = {
43 .get_chars = hvc_sbi_tty_get,
44 .put_chars = hvc_sbi_tty_put,
45 };
46
47 static int __init hvc_sbi_init(void)
48 {
49 return PTR_ERR_OR_ZERO(hvc_alloc(0, 0, &hvc_sbi_ops, 16));
50 }
51 device_initcall(hvc_sbi_init);
52
53 static int __init hvc_sbi_console_init(void)
54 {
55 hvc_instantiate(0, 0, &hvc_sbi_ops);
56
57 return 0;
58 }
59 console_initcall(hvc_sbi_console_init);