Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / SLOF / lib / libhvcall / libhvcall.h
1 #ifndef __LIBHVCALL_H__
2 #define __LIBHVCALL_H__
3
4 #define H_SUCCESS               0
5 #define H_HARDWARE              -1
6
7 #define H_GET_TCE               0x1C
8 #define H_PUT_TCE               0x20
9 #define H_LOGICAL_CI_LOAD       0x3c
10 #define H_LOGICAL_CI_STORE      0x40
11 #define H_GET_TERM_CHAR         0x54
12 #define H_PUT_TERM_CHAR         0x58
13 #define H_REG_CRQ               0xFC
14 #define H_FREE_CRQ              0x100
15 #define H_SEND_CRQ              0x108
16 #define H_REGISTER_LOGICAL_LAN  0x114
17 #define H_FREE_LOGICAL_LAN      0x118
18 #define H_ADD_LOGICAL_LAN_BUFFER 0x11C
19 #define H_SEND_LOGICAL_LAN      0x120
20
21 /* KVM specific ones */
22 #define KVMPPC_HCALL_BASE       0xf000
23 #define KVMPPC_H_RTAS           (KVMPPC_HCALL_BASE + 0x0)
24 #define KVMPPC_H_LOGICAL_MEMOP  (KVMPPC_HCALL_BASE + 0x1)
25 /* Client Architecture support */
26 #define KVMPPC_H_CAS            (KVMPPC_HCALL_BASE + 0x2)
27 #define KVMPPC_H_RTAS_UPDATE    (KVMPPC_HCALL_BASE + 0x3)
28 #define KVMPPC_H_REPORT_MC_ERR  (KVMPPC_HCALL_BASE + 0x4)
29 #define KVMPPC_HCALL_MAX        KVMPPC_H_NMI_MCE
30
31 #ifndef __ASSEMBLY__
32
33 extern long hv_generic(unsigned long opcode, ...);
34
35 extern void hv_putchar(char c, int hvtermno);
36 extern char hv_getchar(int hvtermno);
37 extern char hv_haschar(int hvtermno);
38 extern void get_print_banner(unsigned long addr);
39
40 extern int hv_send_crq(unsigned int unit, uint64_t *msgaddr);
41
42 static inline long hv_reg_crq(unsigned int unit, unsigned long qaddr,
43                               unsigned long qsize)
44 {
45         return hv_generic(H_REG_CRQ, unit, qaddr, qsize);
46 }
47
48 static inline void hv_free_crq(unsigned int unit)
49 {
50         hv_generic(H_FREE_CRQ, unit);
51 }
52
53 extern long  hv_send_logical_lan(unsigned long unit_address,
54                                  unsigned long desc1, unsigned long desc2,
55                                  unsigned long desc3, unsigned long desc4,
56                                  unsigned long desc5, unsigned long desc6);
57
58 static inline long h_register_logical_lan(unsigned long unit_address,
59                                           unsigned long buf_list,
60                                           unsigned long rec_q,
61                                           unsigned long filter_list,
62                                           unsigned long mac_address)
63 {
64         return hv_generic(H_REGISTER_LOGICAL_LAN, unit_address,
65                           buf_list, rec_q, filter_list, mac_address);
66 }
67
68 static inline long h_free_logical_lan(unsigned long unit_address)
69 {
70         return hv_generic(H_FREE_LOGICAL_LAN, unit_address);
71 }
72
73 static inline long h_add_logical_lan_buffer(unsigned long unit_address,
74                                             unsigned long buffer)
75 {
76         return hv_generic(H_ADD_LOGICAL_LAN_BUFFER, unit_address, buffer);
77 }
78
79 #define HV_RTAS_MAX_ARGRET      5
80
81 struct hv_rtas_call {
82         uint32_t token;
83         uint32_t nargs;
84         uint32_t nrets;
85         uint32_t argret[HV_RTAS_MAX_ARGRET];
86 };
87
88 static inline unsigned long h_rtas(struct hv_rtas_call *rtas_buf)
89 {
90         return hv_generic(KVMPPC_H_RTAS, (unsigned long)rtas_buf);
91 }
92
93 extern unsigned long hv_logical_ci_load(unsigned long size, unsigned long addr);
94 extern unsigned long hv_logical_ci_store(unsigned long size, unsigned long addr,
95                                          unsigned long value);
96
97 extern unsigned long hv_logical_memop(unsigned long dst, unsigned long src,
98                                       unsigned long esize, unsigned long count,
99                                       unsigned long op);
100 extern int patch_broken_sc1(void *start, void *end, uint32_t *test_ins);
101
102 extern unsigned long hv_cas(unsigned long vec, unsigned long buf,
103                         unsigned long size);
104
105 #endif /* __ASSEMBLY__ */
106
107 #endif /* __LIBHVCALL_H__ */