Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _PPC64_PLPAR_WRAPPERS_H |
| 2 | #define _PPC64_PLPAR_WRAPPERS_H |
| 3 | |
| 4 | #include <asm/hvcall.h> |
| 5 | |
| 6 | static inline long poll_pending(void) |
| 7 | { |
| 8 | unsigned long dummy; |
| 9 | return plpar_hcall(H_POLL_PENDING, 0, 0, 0, 0, |
| 10 | &dummy, &dummy, &dummy); |
| 11 | } |
| 12 | |
| 13 | static inline long prod_processor(void) |
| 14 | { |
| 15 | plpar_hcall_norets(H_PROD); |
| 16 | return(0); |
| 17 | } |
| 18 | |
| 19 | static inline long cede_processor(void) |
| 20 | { |
| 21 | plpar_hcall_norets(H_CEDE); |
| 22 | return(0); |
| 23 | } |
| 24 | |
| 25 | static inline long register_vpa(unsigned long flags, unsigned long proc, |
| 26 | unsigned long vpa) |
| 27 | { |
| 28 | return plpar_hcall_norets(H_REGISTER_VPA, flags, proc, vpa); |
| 29 | } |
| 30 | |
| 31 | void vpa_init(int cpu); |
| 32 | |
| 33 | static inline long plpar_pte_remove(unsigned long flags, |
| 34 | unsigned long ptex, |
| 35 | unsigned long avpn, |
| 36 | unsigned long *old_pteh_ret, |
| 37 | unsigned long *old_ptel_ret) |
| 38 | { |
| 39 | unsigned long dummy; |
| 40 | return plpar_hcall(H_REMOVE, flags, ptex, avpn, 0, |
| 41 | old_pteh_ret, old_ptel_ret, &dummy); |
| 42 | } |
| 43 | |
| 44 | static inline long plpar_pte_read(unsigned long flags, |
| 45 | unsigned long ptex, |
| 46 | unsigned long *old_pteh_ret, unsigned long *old_ptel_ret) |
| 47 | { |
| 48 | unsigned long dummy; |
| 49 | return plpar_hcall(H_READ, flags, ptex, 0, 0, |
| 50 | old_pteh_ret, old_ptel_ret, &dummy); |
| 51 | } |
| 52 | |
| 53 | static inline long plpar_pte_protect(unsigned long flags, |
| 54 | unsigned long ptex, |
| 55 | unsigned long avpn) |
| 56 | { |
| 57 | return plpar_hcall_norets(H_PROTECT, flags, ptex, avpn); |
| 58 | } |
| 59 | |
| 60 | static inline long plpar_tce_get(unsigned long liobn, |
| 61 | unsigned long ioba, |
| 62 | unsigned long *tce_ret) |
| 63 | { |
| 64 | unsigned long dummy; |
| 65 | return plpar_hcall(H_GET_TCE, liobn, ioba, 0, 0, |
| 66 | tce_ret, &dummy, &dummy); |
| 67 | } |
| 68 | |
| 69 | static inline long plpar_tce_put(unsigned long liobn, |
| 70 | unsigned long ioba, |
| 71 | unsigned long tceval) |
| 72 | { |
| 73 | return plpar_hcall_norets(H_PUT_TCE, liobn, ioba, tceval); |
| 74 | } |
| 75 | |
| 76 | static inline long plpar_tce_put_indirect(unsigned long liobn, |
| 77 | unsigned long ioba, |
| 78 | unsigned long page, |
| 79 | unsigned long count) |
| 80 | { |
| 81 | return plpar_hcall_norets(H_PUT_TCE_INDIRECT, liobn, ioba, page, count); |
| 82 | } |
| 83 | |
| 84 | static inline long plpar_tce_stuff(unsigned long liobn, |
| 85 | unsigned long ioba, |
| 86 | unsigned long tceval, |
| 87 | unsigned long count) |
| 88 | { |
| 89 | return plpar_hcall_norets(H_STUFF_TCE, liobn, ioba, tceval, count); |
| 90 | } |
| 91 | |
| 92 | static inline long plpar_get_term_char(unsigned long termno, |
| 93 | unsigned long *len_ret, |
| 94 | char *buf_ret) |
| 95 | { |
| 96 | unsigned long *lbuf = (unsigned long *)buf_ret; /* ToDo: alignment? */ |
| 97 | return plpar_hcall(H_GET_TERM_CHAR, termno, 0, 0, 0, |
| 98 | len_ret, lbuf+0, lbuf+1); |
| 99 | } |
| 100 | |
| 101 | static inline long plpar_put_term_char(unsigned long termno, |
| 102 | unsigned long len, |
| 103 | const char *buffer) |
| 104 | { |
| 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]); |
| 108 | } |
| 109 | |
| 110 | |
| 111 | #endif /* _PPC64_PLPAR_WRAPPERS_H */ |