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
,
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 static inline long plpar_page_set_loaned(unsigned long vpa
)
47 return plpar_hcall_norets(H_PAGE_INIT
, H_PAGE_SET_LOANED
, vpa
, 0);
50 static inline long plpar_page_set_active(unsigned long vpa
)
52 return plpar_hcall_norets(H_PAGE_INIT
, H_PAGE_SET_ACTIVE
, vpa
, 0);
55 extern void vpa_init(int cpu
);
57 static inline long plpar_pte_enter(unsigned long flags
,
58 unsigned long hpte_group
, unsigned long hpte_v
,
59 unsigned long hpte_r
, unsigned long *slot
)
62 unsigned long retbuf
[PLPAR_HCALL_BUFSIZE
];
64 rc
= plpar_hcall(H_ENTER
, retbuf
, flags
, hpte_group
, hpte_v
, hpte_r
);
71 static inline long plpar_pte_remove(unsigned long flags
, unsigned long ptex
,
72 unsigned long avpn
, unsigned long *old_pteh_ret
,
73 unsigned long *old_ptel_ret
)
76 unsigned long retbuf
[PLPAR_HCALL_BUFSIZE
];
78 rc
= plpar_hcall(H_REMOVE
, retbuf
, flags
, ptex
, avpn
);
80 *old_pteh_ret
= retbuf
[0];
81 *old_ptel_ret
= retbuf
[1];
86 /* plpar_pte_remove_raw can be called in real mode. It calls plpar_hcall_raw */
87 static inline long plpar_pte_remove_raw(unsigned long flags
, unsigned long ptex
,
88 unsigned long avpn
, unsigned long *old_pteh_ret
,
89 unsigned long *old_ptel_ret
)
92 unsigned long retbuf
[PLPAR_HCALL_BUFSIZE
];
94 rc
= plpar_hcall_raw(H_REMOVE
, retbuf
, flags
, ptex
, avpn
);
96 *old_pteh_ret
= retbuf
[0];
97 *old_ptel_ret
= retbuf
[1];
102 static inline long plpar_pte_read(unsigned long flags
, unsigned long ptex
,
103 unsigned long *old_pteh_ret
, unsigned long *old_ptel_ret
)
106 unsigned long retbuf
[PLPAR_HCALL_BUFSIZE
];
108 rc
= plpar_hcall(H_READ
, retbuf
, flags
, ptex
);
110 *old_pteh_ret
= retbuf
[0];
111 *old_ptel_ret
= retbuf
[1];
116 /* plpar_pte_read_raw can be called in real mode. It calls plpar_hcall_raw */
117 static inline long plpar_pte_read_raw(unsigned long flags
, unsigned long ptex
,
118 unsigned long *old_pteh_ret
, unsigned long *old_ptel_ret
)
121 unsigned long retbuf
[PLPAR_HCALL_BUFSIZE
];
123 rc
= plpar_hcall_raw(H_READ
, retbuf
, flags
, ptex
);
125 *old_pteh_ret
= retbuf
[0];
126 *old_ptel_ret
= retbuf
[1];
131 static inline long plpar_pte_protect(unsigned long flags
, unsigned long ptex
,
134 return plpar_hcall_norets(H_PROTECT
, flags
, ptex
, avpn
);
137 static inline long plpar_tce_get(unsigned long liobn
, unsigned long ioba
,
138 unsigned long *tce_ret
)
141 unsigned long retbuf
[PLPAR_HCALL_BUFSIZE
];
143 rc
= plpar_hcall(H_GET_TCE
, retbuf
, liobn
, ioba
);
145 *tce_ret
= retbuf
[0];
150 static inline long plpar_tce_put(unsigned long liobn
, unsigned long ioba
,
151 unsigned long tceval
)
153 return plpar_hcall_norets(H_PUT_TCE
, liobn
, ioba
, tceval
);
156 static inline long plpar_tce_put_indirect(unsigned long liobn
,
157 unsigned long ioba
, unsigned long page
, unsigned long count
)
159 return plpar_hcall_norets(H_PUT_TCE_INDIRECT
, liobn
, ioba
, page
, count
);
162 static inline long plpar_tce_stuff(unsigned long liobn
, unsigned long ioba
,
163 unsigned long tceval
, unsigned long count
)
165 return plpar_hcall_norets(H_STUFF_TCE
, liobn
, ioba
, tceval
, count
);
168 static inline long plpar_get_term_char(unsigned long termno
,
169 unsigned long *len_ret
, char *buf_ret
)
172 unsigned long retbuf
[PLPAR_HCALL_BUFSIZE
];
173 unsigned long *lbuf
= (unsigned long *)buf_ret
; /* TODO: alignment? */
175 rc
= plpar_hcall(H_GET_TERM_CHAR
, retbuf
, termno
);
177 *len_ret
= retbuf
[0];
184 static inline long plpar_put_term_char(unsigned long termno
, unsigned long len
,
187 unsigned long *lbuf
= (unsigned long *)buffer
; /* TODO: alignment? */
188 return plpar_hcall_norets(H_PUT_TERM_CHAR
, termno
, len
, lbuf
[0],
192 static inline long plpar_eoi(unsigned long xirr
)
194 return plpar_hcall_norets(H_EOI
, xirr
);
197 static inline long plpar_cppr(unsigned long cppr
)
199 return plpar_hcall_norets(H_CPPR
, cppr
);
202 static inline long plpar_ipi(unsigned long servernum
, unsigned long mfrr
)
204 return plpar_hcall_norets(H_IPI
, servernum
, mfrr
);
207 static inline long plpar_xirr(unsigned long *xirr_ret
)
210 unsigned long retbuf
[PLPAR_HCALL_BUFSIZE
];
212 rc
= plpar_hcall(H_XIRR
, retbuf
);
214 *xirr_ret
= retbuf
[0];
219 #endif /* _PSERIES_PLPAR_WRAPPERS_H */