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 prod_processor(void)
13 return plpar_hcall_norets(H_PROD);
16 static inline long cede_processor(void)
18 return plpar_hcall_norets(H_CEDE);
21 static inline long vpa_call(unsigned long flags, unsigned long cpu,
24 /* flags are in bits 16-18 (counting from most significant bit) */
25 flags = flags << (63 - 18);
27 return plpar_hcall_norets(H_REGISTER_VPA, flags, cpu, vpa);
30 static inline long unregister_vpa(unsigned long cpu, unsigned long vpa)
32 return vpa_call(0x5, cpu, vpa);
35 static inline long register_vpa(unsigned long cpu, unsigned long vpa)
37 return vpa_call(0x1, cpu, vpa);
40 static inline long unregister_slb_shadow(unsigned long cpu, unsigned long vpa)
42 return vpa_call(0x7, cpu, vpa);
45 static inline long register_slb_shadow(unsigned long cpu, unsigned long vpa)
47 return vpa_call(0x3, cpu, vpa);
50 extern void vpa_init(int cpu);
52 static inline long plpar_pte_enter(unsigned long flags,
53 unsigned long hpte_group, unsigned long hpte_v,
54 unsigned long hpte_r, unsigned long *slot)
57 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
59 rc = plpar_hcall(H_ENTER, retbuf, flags, hpte_group, hpte_v, hpte_r);
66 static inline long plpar_pte_remove(unsigned long flags, unsigned long ptex,
67 unsigned long avpn, unsigned long *old_pteh_ret,
68 unsigned long *old_ptel_ret)
71 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
73 rc = plpar_hcall(H_REMOVE, retbuf, flags, ptex, avpn);
75 *old_pteh_ret = retbuf[0];
76 *old_ptel_ret = retbuf[1];
81 static inline long plpar_pte_read(unsigned long flags, unsigned long ptex,
82 unsigned long *old_pteh_ret, unsigned long *old_ptel_ret)
85 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
87 rc = plpar_hcall(H_READ, retbuf, flags, ptex);
89 *old_pteh_ret = retbuf[0];
90 *old_ptel_ret = retbuf[1];
95 static inline long plpar_pte_protect(unsigned long flags, unsigned long ptex,
98 return plpar_hcall_norets(H_PROTECT, flags, ptex, avpn);
101 static inline long plpar_tce_get(unsigned long liobn, unsigned long ioba,
102 unsigned long *tce_ret)
105 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
107 rc = plpar_hcall(H_GET_TCE, retbuf, liobn, ioba);
109 *tce_ret = retbuf[0];
114 static inline long plpar_tce_put(unsigned long liobn, unsigned long ioba,
115 unsigned long tceval)
117 return plpar_hcall_norets(H_PUT_TCE, liobn, ioba, tceval);
120 static inline long plpar_tce_put_indirect(unsigned long liobn,
121 unsigned long ioba, unsigned long page, unsigned long count)
123 return plpar_hcall_norets(H_PUT_TCE_INDIRECT, liobn, ioba, page, count);
126 static inline long plpar_tce_stuff(unsigned long liobn, unsigned long ioba,
127 unsigned long tceval, unsigned long count)
129 return plpar_hcall_norets(H_STUFF_TCE, liobn, ioba, tceval, count);
132 static inline long plpar_get_term_char(unsigned long termno,
133 unsigned long *len_ret, char *buf_ret)
136 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
137 unsigned long *lbuf = (unsigned long *)buf_ret; /* TODO: alignment? */
139 rc = plpar_hcall(H_GET_TERM_CHAR, retbuf, termno);
141 *len_ret = retbuf[0];
148 static inline long plpar_put_term_char(unsigned long termno, unsigned long len,
151 unsigned long *lbuf = (unsigned long *)buffer; /* TODO: alignment? */
152 return plpar_hcall_norets(H_PUT_TERM_CHAR, termno, len, lbuf[0],
156 static inline long plpar_eoi(unsigned long xirr)
158 return plpar_hcall_norets(H_EOI, xirr);
161 static inline long plpar_cppr(unsigned long cppr)
163 return plpar_hcall_norets(H_CPPR, cppr);
166 static inline long plpar_ipi(unsigned long servernum, unsigned long mfrr)
168 return plpar_hcall_norets(H_IPI, servernum, mfrr);
171 static inline long plpar_xirr(unsigned long *xirr_ret)
174 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
176 rc = plpar_hcall(H_XIRR, retbuf);
178 *xirr_ret = retbuf[0];
183 #endif /* _PSERIES_PLPAR_WRAPPERS_H */