[ARM] Support register switch in nommu mode
[linux-2.6/verdex.git] / arch / powerpc / platforms / pseries / plpar_wrappers.h
blob3bd1b3e0600362237c410bbb7f008a67ddd68862
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 unsigned long dummy;
9 return plpar_hcall(H_POLL_PENDING, 0, 0, 0, 0, &dummy, &dummy, &dummy);
12 static inline long prod_processor(void)
14 plpar_hcall_norets(H_PROD);
15 return 0;
18 static inline long cede_processor(void)
20 plpar_hcall_norets(H_CEDE);
21 return 0;
24 static inline long vpa_call(unsigned long flags, unsigned long cpu,
25 unsigned long vpa)
27 /* flags are in bits 16-18 (counting from most significant bit) */
28 flags = flags << (63 - 18);
30 return plpar_hcall_norets(H_REGISTER_VPA, flags, cpu, vpa);
33 static inline long unregister_vpa(unsigned long cpu, unsigned long vpa)
35 return vpa_call(0x5, cpu, vpa);
38 static inline long register_vpa(unsigned long cpu, unsigned long vpa)
40 return vpa_call(0x1, cpu, vpa);
43 extern void vpa_init(int cpu);
45 static inline long plpar_pte_remove(unsigned long flags, unsigned long ptex,
46 unsigned long avpn, unsigned long *old_pteh_ret,
47 unsigned long *old_ptel_ret)
49 unsigned long dummy;
50 return plpar_hcall(H_REMOVE, flags, ptex, avpn, 0, old_pteh_ret,
51 old_ptel_ret, &dummy);
54 static inline long plpar_pte_read(unsigned long flags, unsigned long ptex,
55 unsigned long *old_pteh_ret, unsigned long *old_ptel_ret)
57 unsigned long dummy;
58 return plpar_hcall(H_READ, flags, ptex, 0, 0, old_pteh_ret,
59 old_ptel_ret, &dummy);
62 static inline long plpar_pte_protect(unsigned long flags, unsigned long ptex,
63 unsigned long avpn)
65 return plpar_hcall_norets(H_PROTECT, flags, ptex, avpn);
68 static inline long plpar_tce_get(unsigned long liobn, unsigned long ioba,
69 unsigned long *tce_ret)
71 unsigned long dummy;
72 return plpar_hcall(H_GET_TCE, liobn, ioba, 0, 0, tce_ret, &dummy,
73 &dummy);
76 static inline long plpar_tce_put(unsigned long liobn, unsigned long ioba,
77 unsigned long tceval)
79 return plpar_hcall_norets(H_PUT_TCE, liobn, ioba, tceval);
82 static inline long plpar_tce_put_indirect(unsigned long liobn,
83 unsigned long ioba, unsigned long page, unsigned long count)
85 return plpar_hcall_norets(H_PUT_TCE_INDIRECT, liobn, ioba, page, count);
88 static inline long plpar_tce_stuff(unsigned long liobn, unsigned long ioba,
89 unsigned long tceval, unsigned long count)
91 return plpar_hcall_norets(H_STUFF_TCE, liobn, ioba, tceval, count);
94 static inline long plpar_get_term_char(unsigned long termno,
95 unsigned long *len_ret, char *buf_ret)
97 unsigned long *lbuf = (unsigned long *)buf_ret; /* TODO: alignment? */
98 return plpar_hcall(H_GET_TERM_CHAR, termno, 0, 0, 0, len_ret,
99 lbuf + 0, lbuf + 1);
102 static inline long plpar_put_term_char(unsigned long termno, unsigned long len,
103 const char *buffer)
105 unsigned long *lbuf = (unsigned long *)buffer; /* TODO: alignment? */
106 return plpar_hcall_norets(H_PUT_TERM_CHAR, termno, len, lbuf[0],
107 lbuf[1]);
110 #endif /* _PSERIES_PLPAR_WRAPPERS_H */