This source file includes following definitions.
- hvc_get_chars
- hvc_put_chars
1
2
3
4
5
6
7
8
9
10
11
12
13 #include <linux/kernel.h>
14 #include <linux/export.h>
15 #include <linux/errno.h>
16 #include <asm/hvcall.h>
17 #include <asm/hvconsole.h>
18 #include <asm/plpar_wrappers.h>
19
20
21
22
23
24
25
26
27
28 int hvc_get_chars(uint32_t vtermno, char *buf, int count)
29 {
30 long ret;
31 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
32 unsigned long *lbuf = (unsigned long *)buf;
33
34 ret = plpar_hcall(H_GET_TERM_CHAR, retbuf, vtermno);
35 lbuf[0] = be64_to_cpu(retbuf[1]);
36 lbuf[1] = be64_to_cpu(retbuf[2]);
37
38 if (ret == H_SUCCESS)
39 return retbuf[0];
40
41 return 0;
42 }
43
44 EXPORT_SYMBOL(hvc_get_chars);
45
46
47
48
49
50
51
52
53
54
55 int hvc_put_chars(uint32_t vtermno, const char *buf, int count)
56 {
57 unsigned long *lbuf = (unsigned long *) buf;
58 long ret;
59
60
61
62 if (count > MAX_VIO_PUT_CHARS)
63 count = MAX_VIO_PUT_CHARS;
64
65 ret = plpar_hcall_norets(H_PUT_TERM_CHAR, vtermno, count,
66 cpu_to_be64(lbuf[0]),
67 cpu_to_be64(lbuf[1]));
68 if (ret == H_SUCCESS)
69 return count;
70 if (ret == H_BUSY)
71 return -EAGAIN;
72 return -EIO;
73 }
74
75 EXPORT_SYMBOL(hvc_put_chars);