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