[SCSI] qla1280: convert to use the data buffer accessors
[linux-2.6/verdex.git] / arch / powerpc / platforms / pseries / plpar_wrappers.h
blobd003c80fa31d2b4369f0021fd3a9b38ab99dd4ae
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,
22 unsigned long vpa)
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)
56 long rc;
57 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
59 rc = plpar_hcall(H_ENTER, retbuf, flags, hpte_group, hpte_v, hpte_r);
61 *slot = retbuf[0];
63 return rc;
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)
70 long rc;
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];
78 return rc;
81 /* plpar_pte_remove_raw can be called in real mode. It calls plpar_hcall_raw */
82 static inline long plpar_pte_remove_raw(unsigned long flags, unsigned long ptex,
83 unsigned long avpn, unsigned long *old_pteh_ret,
84 unsigned long *old_ptel_ret)
86 long rc;
87 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
89 rc = plpar_hcall_raw(H_REMOVE, retbuf, flags, ptex, avpn);
91 *old_pteh_ret = retbuf[0];
92 *old_ptel_ret = retbuf[1];
94 return rc;
97 static inline long plpar_pte_read(unsigned long flags, unsigned long ptex,
98 unsigned long *old_pteh_ret, unsigned long *old_ptel_ret)
100 long rc;
101 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
103 rc = plpar_hcall(H_READ, retbuf, flags, ptex);
105 *old_pteh_ret = retbuf[0];
106 *old_ptel_ret = retbuf[1];
108 return rc;
111 /* plpar_pte_read_raw can be called in real mode. It calls plpar_hcall_raw */
112 static inline long plpar_pte_read_raw(unsigned long flags, unsigned long ptex,
113 unsigned long *old_pteh_ret, unsigned long *old_ptel_ret)
115 long rc;
116 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
118 rc = plpar_hcall_raw(H_READ, retbuf, flags, ptex);
120 *old_pteh_ret = retbuf[0];
121 *old_ptel_ret = retbuf[1];
123 return rc;
126 static inline long plpar_pte_protect(unsigned long flags, unsigned long ptex,
127 unsigned long avpn)
129 return plpar_hcall_norets(H_PROTECT, flags, ptex, avpn);
132 static inline long plpar_tce_get(unsigned long liobn, unsigned long ioba,
133 unsigned long *tce_ret)
135 long rc;
136 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
138 rc = plpar_hcall(H_GET_TCE, retbuf, liobn, ioba);
140 *tce_ret = retbuf[0];
142 return rc;
145 static inline long plpar_tce_put(unsigned long liobn, unsigned long ioba,
146 unsigned long tceval)
148 return plpar_hcall_norets(H_PUT_TCE, liobn, ioba, tceval);
151 static inline long plpar_tce_put_indirect(unsigned long liobn,
152 unsigned long ioba, unsigned long page, unsigned long count)
154 return plpar_hcall_norets(H_PUT_TCE_INDIRECT, liobn, ioba, page, count);
157 static inline long plpar_tce_stuff(unsigned long liobn, unsigned long ioba,
158 unsigned long tceval, unsigned long count)
160 return plpar_hcall_norets(H_STUFF_TCE, liobn, ioba, tceval, count);
163 static inline long plpar_get_term_char(unsigned long termno,
164 unsigned long *len_ret, char *buf_ret)
166 long rc;
167 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
168 unsigned long *lbuf = (unsigned long *)buf_ret; /* TODO: alignment? */
170 rc = plpar_hcall(H_GET_TERM_CHAR, retbuf, termno);
172 *len_ret = retbuf[0];
173 lbuf[0] = retbuf[1];
174 lbuf[1] = retbuf[2];
176 return rc;
179 static inline long plpar_put_term_char(unsigned long termno, unsigned long len,
180 const char *buffer)
182 unsigned long *lbuf = (unsigned long *)buffer; /* TODO: alignment? */
183 return plpar_hcall_norets(H_PUT_TERM_CHAR, termno, len, lbuf[0],
184 lbuf[1]);
187 static inline long plpar_eoi(unsigned long xirr)
189 return plpar_hcall_norets(H_EOI, xirr);
192 static inline long plpar_cppr(unsigned long cppr)
194 return plpar_hcall_norets(H_CPPR, cppr);
197 static inline long plpar_ipi(unsigned long servernum, unsigned long mfrr)
199 return plpar_hcall_norets(H_IPI, servernum, mfrr);
202 static inline long plpar_xirr(unsigned long *xirr_ret)
204 long rc;
205 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
207 rc = plpar_hcall(H_XIRR, retbuf);
209 *xirr_ret = retbuf[0];
211 return rc;
214 #endif /* _PSERIES_PLPAR_WRAPPERS_H */