xref: /kvm-unit-tests/lib/powerpc/asm/hcall.h (revision 0cc3a351b925928827baa4b69cf0e46ff5837083)
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_REGISTER_VPA		0xDC
22 #define H_CEDE			0xE0
23 #define H_GET_TERM_CHAR		0x54
24 #define H_PUT_TERM_CHAR		0x58
25 #define H_RANDOM		0x300
26 #define H_SET_MODE		0x31C
27 #define H_REGISTER_PROCESS_TABLE	0x37C
28 
29 #define PTBL_NEW		0x18
30 #define PTBL_UNREGISTER		0x10
31 #define PTBL_RADIX		0x04
32 #define PTBL_GTSE		0x01
33 
34 #define KVMPPC_HCALL_BASE	0xf000
35 #define KVMPPC_H_RTAS		(KVMPPC_HCALL_BASE + 0x0)
36 
37 #ifndef __ASSEMBLER__
38 /*
39  * hcall_have_broken_sc1 checks if we're on a host with a broken sc1.
40  * Returns 0 if we're not.
41  */
42 extern int hcall_have_broken_sc1(void);
43 
44 /*
45  * hcall is the hypercall wrapper function. unittests may do what
46  * they like, but the framework should make all hypercalls through
47  * here to ensure they use a working sc1 instruction. @nr is the
48  * hypercall number.
49  */
50 extern unsigned long hcall(unsigned long nr, ...);
51 
52 #endif /* !__ASSEMBLER__ */
53 #endif /* _ASMPOWERPC_HCALL_H_ */
54