xref: /kvm-unit-tests/lib/powerpc/asm/hcall.h (revision 6842bc34fcfd218b2e937e421bd98b5cd56dd872)
1 #ifndef _ASMPOWERPC_HCALL_H_
2 #define _ASMPOWERPC_HCALL_H_
3 /*
4  * Copyright (C) 2016, Red Hat Inc, Andrew Jones <drjones@redhat.com>
5  *
6  * This work is licensed under the terms of the GNU LGPL, version 2.
7  */
8 
9 #define SC1			0x44000022
10 #define SC1_REPLACEMENT		0x7c000268
11 
12 #define H_SUCCESS		0
13 #define H_HARDWARE		-1
14 #define H_FUNCTION		-2
15 #define H_PRIVILEGE		-3
16 #define H_PARAMETER		-4
17 
18 #define H_SET_SPRG0		0x24
19 #define H_SET_DABR		0x28
20 #define H_PAGE_INIT		0x2c
21 #define H_PUT_TERM_CHAR		0x58
22 #define H_RANDOM		0x300
23 #define H_SET_MODE		0x31C
24 
25 #ifndef __ASSEMBLY__
26 /*
27  * hcall_have_broken_sc1 checks if we're on a host with a broken sc1.
28  * Returns 0 if we're not.
29  */
30 extern int hcall_have_broken_sc1(void);
31 
32 /*
33  * hcall is the hypercall wrapper function. unittests may do what
34  * they like, but the framework should make all hypercalls through
35  * here to ensure they use a working sc1 instruction. @nr is the
36  * hypercall number.
37  */
38 extern unsigned long hcall(unsigned long nr, ...);
39 
40 #endif /* !__ASSEMBLY__ */
41 #endif /* _ASMPOWERPC_HCALL_H_ */
42