aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/pseries/plpar_wrappers.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms/pseries/plpar_wrappers.h')
-rw-r--r--arch/powerpc/platforms/pseries/plpar_wrappers.h97
1 files changed, 80 insertions, 17 deletions
diff --git a/arch/powerpc/platforms/pseries/plpar_wrappers.h b/arch/powerpc/platforms/pseries/plpar_wrappers.h
index 3bd1b3e06003..ebd15de7597e 100644
--- a/arch/powerpc/platforms/pseries/plpar_wrappers.h
+++ b/arch/powerpc/platforms/pseries/plpar_wrappers.h
@@ -5,20 +5,17 @@
5 5
6static inline long poll_pending(void) 6static inline long poll_pending(void)
7{ 7{
8 unsigned long dummy; 8 return plpar_hcall_norets(H_POLL_PENDING);
9 return plpar_hcall(H_POLL_PENDING, 0, 0, 0, 0, &dummy, &dummy, &dummy);
10} 9}
11 10
12static inline long prod_processor(void) 11static inline long prod_processor(void)
13{ 12{
14 plpar_hcall_norets(H_PROD); 13 return plpar_hcall_norets(H_PROD);
15 return 0;
16} 14}
17 15
18static inline long cede_processor(void) 16static inline long cede_processor(void)
19{ 17{
20 plpar_hcall_norets(H_CEDE); 18 return plpar_hcall_norets(H_CEDE);
21 return 0;
22} 19}
23 20
24static inline long vpa_call(unsigned long flags, unsigned long cpu, 21static inline long vpa_call(unsigned long flags, unsigned long cpu,
@@ -42,21 +39,47 @@ static inline long register_vpa(unsigned long cpu, unsigned long vpa)
42 39
43extern void vpa_init(int cpu); 40extern void vpa_init(int cpu);
44 41
42static inline long plpar_pte_enter(unsigned long flags,
43 unsigned long hpte_group, unsigned long hpte_v,
44 unsigned long hpte_r, unsigned long *slot)
45{
46 long rc;
47 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
48
49 rc = plpar_hcall(H_ENTER, retbuf, flags, hpte_group, hpte_v, hpte_r);
50
51 *slot = retbuf[0];
52
53 return rc;
54}
55
45static inline long plpar_pte_remove(unsigned long flags, unsigned long ptex, 56static inline long plpar_pte_remove(unsigned long flags, unsigned long ptex,
46 unsigned long avpn, unsigned long *old_pteh_ret, 57 unsigned long avpn, unsigned long *old_pteh_ret,
47 unsigned long *old_ptel_ret) 58 unsigned long *old_ptel_ret)
48{ 59{
49 unsigned long dummy; 60 long rc;
50 return plpar_hcall(H_REMOVE, flags, ptex, avpn, 0, old_pteh_ret, 61 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
51 old_ptel_ret, &dummy); 62
63 rc = plpar_hcall(H_REMOVE, retbuf, flags, ptex, avpn);
64
65 *old_pteh_ret = retbuf[0];
66 *old_ptel_ret = retbuf[1];
67
68 return rc;
52} 69}
53 70
54static inline long plpar_pte_read(unsigned long flags, unsigned long ptex, 71static inline long plpar_pte_read(unsigned long flags, unsigned long ptex,
55 unsigned long *old_pteh_ret, unsigned long *old_ptel_ret) 72 unsigned long *old_pteh_ret, unsigned long *old_ptel_ret)
56{ 73{
57 unsigned long dummy; 74 long rc;
58 return plpar_hcall(H_READ, flags, ptex, 0, 0, old_pteh_ret, 75 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
59 old_ptel_ret, &dummy); 76
77 rc = plpar_hcall(H_READ, retbuf, flags, ptex);
78
79 *old_pteh_ret = retbuf[0];
80 *old_ptel_ret = retbuf[1];
81
82 return rc;
60} 83}
61 84
62static inline long plpar_pte_protect(unsigned long flags, unsigned long ptex, 85static inline long plpar_pte_protect(unsigned long flags, unsigned long ptex,
@@ -68,9 +91,14 @@ static inline long plpar_pte_protect(unsigned long flags, unsigned long ptex,
68static inline long plpar_tce_get(unsigned long liobn, unsigned long ioba, 91static inline long plpar_tce_get(unsigned long liobn, unsigned long ioba,
69 unsigned long *tce_ret) 92 unsigned long *tce_ret)
70{ 93{
71 unsigned long dummy; 94 long rc;
72 return plpar_hcall(H_GET_TCE, liobn, ioba, 0, 0, tce_ret, &dummy, 95 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
73 &dummy); 96
97 rc = plpar_hcall(H_GET_TCE, retbuf, liobn, ioba);
98
99 *tce_ret = retbuf[0];
100
101 return rc;
74} 102}
75 103
76static inline long plpar_tce_put(unsigned long liobn, unsigned long ioba, 104static inline long plpar_tce_put(unsigned long liobn, unsigned long ioba,
@@ -94,9 +122,17 @@ static inline long plpar_tce_stuff(unsigned long liobn, unsigned long ioba,
94static inline long plpar_get_term_char(unsigned long termno, 122static inline long plpar_get_term_char(unsigned long termno,
95 unsigned long *len_ret, char *buf_ret) 123 unsigned long *len_ret, char *buf_ret)
96{ 124{
125 long rc;
126 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
97 unsigned long *lbuf = (unsigned long *)buf_ret; /* TODO: alignment? */ 127 unsigned long *lbuf = (unsigned long *)buf_ret; /* TODO: alignment? */
98 return plpar_hcall(H_GET_TERM_CHAR, termno, 0, 0, 0, len_ret, 128
99 lbuf + 0, lbuf + 1); 129 rc = plpar_hcall(H_GET_TERM_CHAR, retbuf, termno);
130
131 *len_ret = retbuf[0];
132 lbuf[0] = retbuf[1];
133 lbuf[1] = retbuf[2];
134
135 return rc;
100} 136}
101 137
102static inline long plpar_put_term_char(unsigned long termno, unsigned long len, 138static inline long plpar_put_term_char(unsigned long termno, unsigned long len,
@@ -107,4 +143,31 @@ static inline long plpar_put_term_char(unsigned long termno, unsigned long len,
107 lbuf[1]); 143 lbuf[1]);
108} 144}
109 145
146static inline long plpar_eoi(unsigned long xirr)
147{
148 return plpar_hcall_norets(H_EOI, xirr);
149}
150
151static inline long plpar_cppr(unsigned long cppr)
152{
153 return plpar_hcall_norets(H_CPPR, cppr);
154}
155
156static inline long plpar_ipi(unsigned long servernum, unsigned long mfrr)
157{
158 return plpar_hcall_norets(H_IPI, servernum, mfrr);
159}
160
161static inline long plpar_xirr(unsigned long *xirr_ret)
162{
163 long rc;
164 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
165
166 rc = plpar_hcall(H_XIRR, retbuf);
167
168 *xirr_ret = retbuf[0];
169
170 return rc;
171}
172
110#endif /* _PSERIES_PLPAR_WRAPPERS_H */ 173#endif /* _PSERIES_PLPAR_WRAPPERS_H */