kbuild: Fix instrumentation removal breakage on avr32
[wrt350n-kernel.git] / arch / powerpc / platforms / pseries / plpar_wrappers.h
blobd8680b589dc96c325afb09725c47f5c6a008a3e6
1 #ifndef _PSERIES_PLPAR_WRAPPERS_H
2 #define _PSERIES_PLPAR_WRAPPERS_H
4 #include <asm/hvcall.h>
6 static inline long poll_pending(void)
8 return plpar_hcall_norets(H_POLL_PENDING);
11 static inline long cede_processor(void)
13 return plpar_hcall_norets(H_CEDE);
16 static inline long vpa_call(unsigned long flags, unsigned long cpu,
17 unsigned long vpa)
19 /* flags are in bits 16-18 (counting from most significant bit) */
20 flags = flags << (63 - 18);
22 return plpar_hcall_norets(H_REGISTER_VPA, flags, cpu, vpa);
25 static inline long unregister_vpa(unsigned long cpu, unsigned long vpa)
27 return vpa_call(0x5, cpu, vpa);
30 static inline long register_vpa(unsigned long cpu, unsigned long vpa)
32 return vpa_call(0x1, cpu, vpa);
35 static inline long unregister_slb_shadow(unsigned long cpu, unsigned long vpa)
37 return vpa_call(0x7, cpu, vpa);
40 static inline long register_slb_shadow(unsigned long cpu, unsigned long vpa)
42 return vpa_call(0x3, cpu, vpa);
45 extern void vpa_init(int cpu);
47 static inline long plpar_pte_enter(unsigned long flags,
48 unsigned long hpte_group, unsigned long hpte_v,
49 unsigned long hpte_r, unsigned long *slot)
51 long rc;
52 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
54 rc = plpar_hcall(H_ENTER, retbuf, flags, hpte_group, hpte_v, hpte_r);
56 *slot = retbuf[0];
58 return rc;
61 static inline long plpar_pte_remove(unsigned long flags, unsigned long ptex,
62 unsigned long avpn, unsigned long *old_pteh_ret,
63 unsigned long *old_ptel_ret)
65 long rc;
66 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
68 rc = plpar_hcall(H_REMOVE, retbuf, flags, ptex, avpn);
70 *old_pteh_ret = retbuf[0];
71 *old_ptel_ret = retbuf[1];
73 return rc;
76 /* plpar_pte_remove_raw can be called in real mode. It calls plpar_hcall_raw */
77 static inline long plpar_pte_remove_raw(unsigned long flags, unsigned long ptex,
78 unsigned long avpn, unsigned long *old_pteh_ret,
79 unsigned long *old_ptel_ret)
81 long rc;
82 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
84 rc = plpar_hcall_raw(H_REMOVE, retbuf, flags, ptex, avpn);
86 *old_pteh_ret = retbuf[0];
87 *old_ptel_ret = retbuf[1];
89 return rc;
92 static inline long plpar_pte_read(unsigned long flags, unsigned long ptex,
93 unsigned long *old_pteh_ret, unsigned long *old_ptel_ret)
95 long rc;
96 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
98 rc = plpar_hcall(H_READ, retbuf, flags, ptex);
100 *old_pteh_ret = retbuf[0];
101 *old_ptel_ret = retbuf[1];
103 return rc;
106 /* plpar_pte_read_raw can be called in real mode. It calls plpar_hcall_raw */
107 static inline long plpar_pte_read_raw(unsigned long flags, unsigned long ptex,
108 unsigned long *old_pteh_ret, unsigned long *old_ptel_ret)
110 long rc;
111 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
113 rc = plpar_hcall_raw(H_READ, retbuf, flags, ptex);
115 *old_pteh_ret = retbuf[0];
116 *old_ptel_ret = retbuf[1];
118 return rc;
121 static inline long plpar_pte_protect(unsigned long flags, unsigned long ptex,
122 unsigned long avpn)
124 return plpar_hcall_norets(H_PROTECT, flags, ptex, avpn);
127 static inline long plpar_tce_get(unsigned long liobn, unsigned long ioba,
128 unsigned long *tce_ret)
130 long rc;
131 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
133 rc = plpar_hcall(H_GET_TCE, retbuf, liobn, ioba);
135 *tce_ret = retbuf[0];
137 return rc;
140 static inline long plpar_tce_put(unsigned long liobn, unsigned long ioba,
141 unsigned long tceval)
143 return plpar_hcall_norets(H_PUT_TCE, liobn, ioba, tceval);
146 static inline long plpar_tce_put_indirect(unsigned long liobn,
147 unsigned long ioba, unsigned long page, unsigned long count)
149 return plpar_hcall_norets(H_PUT_TCE_INDIRECT, liobn, ioba, page, count);
152 static inline long plpar_tce_stuff(unsigned long liobn, unsigned long ioba,
153 unsigned long tceval, unsigned long count)
155 return plpar_hcall_norets(H_STUFF_TCE, liobn, ioba, tceval, count);
158 static inline long plpar_get_term_char(unsigned long termno,
159 unsigned long *len_ret, char *buf_ret)
161 long rc;
162 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
163 unsigned long *lbuf = (unsigned long *)buf_ret; /* TODO: alignment? */
165 rc = plpar_hcall(H_GET_TERM_CHAR, retbuf, termno);
167 *len_ret = retbuf[0];
168 lbuf[0] = retbuf[1];
169 lbuf[1] = retbuf[2];
171 return rc;
174 static inline long plpar_put_term_char(unsigned long termno, unsigned long len,
175 const char *buffer)
177 unsigned long *lbuf = (unsigned long *)buffer; /* TODO: alignment? */
178 return plpar_hcall_norets(H_PUT_TERM_CHAR, termno, len, lbuf[0],
179 lbuf[1]);
182 static inline long plpar_eoi(unsigned long xirr)
184 return plpar_hcall_norets(H_EOI, xirr);
187 static inline long plpar_cppr(unsigned long cppr)
189 return plpar_hcall_norets(H_CPPR, cppr);
192 static inline long plpar_ipi(unsigned long servernum, unsigned long mfrr)
194 return plpar_hcall_norets(H_IPI, servernum, mfrr);
197 static inline long plpar_xirr(unsigned long *xirr_ret)
199 long rc;
200 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
202 rc = plpar_hcall(H_XIRR, retbuf);
204 *xirr_ret = retbuf[0];
206 return rc;
209 #endif /* _PSERIES_PLPAR_WRAPPERS_H */