xref: /OK3568_Linux_fs/kernel/arch/powerpc/include/uapi/asm/epapr_hcalls.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * ePAPR hcall interface
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * Copyright 2008-2011 Freescale Semiconductor, Inc.
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * Author: Timur Tabi <timur@freescale.com>
8*4882a593Smuzhiyun  *
9*4882a593Smuzhiyun  * This file is provided under a dual BSD/GPL license.  When using or
10*4882a593Smuzhiyun  * redistributing this file, you may do so under either license.
11*4882a593Smuzhiyun  *
12*4882a593Smuzhiyun  * Redistribution and use in source and binary forms, with or without
13*4882a593Smuzhiyun  * modification, are permitted provided that the following conditions are met:
14*4882a593Smuzhiyun  *     * Redistributions of source code must retain the above copyright
15*4882a593Smuzhiyun  *       notice, this list of conditions and the following disclaimer.
16*4882a593Smuzhiyun  *     * Redistributions in binary form must reproduce the above copyright
17*4882a593Smuzhiyun  *       notice, this list of conditions and the following disclaimer in the
18*4882a593Smuzhiyun  *       documentation and/or other materials provided with the distribution.
19*4882a593Smuzhiyun  *     * Neither the name of Freescale Semiconductor nor the
20*4882a593Smuzhiyun  *       names of its contributors may be used to endorse or promote products
21*4882a593Smuzhiyun  *       derived from this software without specific prior written permission.
22*4882a593Smuzhiyun  *
23*4882a593Smuzhiyun  *
24*4882a593Smuzhiyun  * ALTERNATIVELY, this software may be distributed under the terms of the
25*4882a593Smuzhiyun  * GNU General Public License ("GPL") as published by the Free Software
26*4882a593Smuzhiyun  * Foundation, either version 2 of that License or (at your option) any
27*4882a593Smuzhiyun  * later version.
28*4882a593Smuzhiyun  *
29*4882a593Smuzhiyun  * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
30*4882a593Smuzhiyun  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
31*4882a593Smuzhiyun  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
32*4882a593Smuzhiyun  * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
33*4882a593Smuzhiyun  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
34*4882a593Smuzhiyun  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35*4882a593Smuzhiyun  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
36*4882a593Smuzhiyun  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37*4882a593Smuzhiyun  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
38*4882a593Smuzhiyun  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39*4882a593Smuzhiyun  */
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun #ifndef _UAPI_ASM_POWERPC_EPAPR_HCALLS_H
42*4882a593Smuzhiyun #define _UAPI_ASM_POWERPC_EPAPR_HCALLS_H
43*4882a593Smuzhiyun 
44*4882a593Smuzhiyun #define EV_BYTE_CHANNEL_SEND		1
45*4882a593Smuzhiyun #define EV_BYTE_CHANNEL_RECEIVE		2
46*4882a593Smuzhiyun #define EV_BYTE_CHANNEL_POLL		3
47*4882a593Smuzhiyun #define EV_INT_SET_CONFIG		4
48*4882a593Smuzhiyun #define EV_INT_GET_CONFIG		5
49*4882a593Smuzhiyun #define EV_INT_SET_MASK			6
50*4882a593Smuzhiyun #define EV_INT_GET_MASK			7
51*4882a593Smuzhiyun #define EV_INT_IACK			9
52*4882a593Smuzhiyun #define EV_INT_EOI			10
53*4882a593Smuzhiyun #define EV_INT_SEND_IPI			11
54*4882a593Smuzhiyun #define EV_INT_SET_TASK_PRIORITY	12
55*4882a593Smuzhiyun #define EV_INT_GET_TASK_PRIORITY	13
56*4882a593Smuzhiyun #define EV_DOORBELL_SEND		14
57*4882a593Smuzhiyun #define EV_MSGSND			15
58*4882a593Smuzhiyun #define EV_IDLE				16
59*4882a593Smuzhiyun 
60*4882a593Smuzhiyun /* vendor ID: epapr */
61*4882a593Smuzhiyun #define EV_LOCAL_VENDOR_ID		0	/* for private use */
62*4882a593Smuzhiyun #define EV_EPAPR_VENDOR_ID		1
63*4882a593Smuzhiyun #define EV_FSL_VENDOR_ID		2	/* Freescale Semiconductor */
64*4882a593Smuzhiyun #define EV_IBM_VENDOR_ID		3	/* IBM */
65*4882a593Smuzhiyun #define EV_GHS_VENDOR_ID		4	/* Green Hills Software */
66*4882a593Smuzhiyun #define EV_ENEA_VENDOR_ID		5	/* Enea */
67*4882a593Smuzhiyun #define EV_WR_VENDOR_ID			6	/* Wind River Systems */
68*4882a593Smuzhiyun #define EV_AMCC_VENDOR_ID		7	/* Applied Micro Circuits */
69*4882a593Smuzhiyun #define EV_KVM_VENDOR_ID		42	/* KVM */
70*4882a593Smuzhiyun 
71*4882a593Smuzhiyun /* The max number of bytes that a byte channel can send or receive per call */
72*4882a593Smuzhiyun #define EV_BYTE_CHANNEL_MAX_BYTES	16
73*4882a593Smuzhiyun 
74*4882a593Smuzhiyun 
75*4882a593Smuzhiyun #define _EV_HCALL_TOKEN(id, num) (((id) << 16) | (num))
76*4882a593Smuzhiyun #define EV_HCALL_TOKEN(hcall_num) _EV_HCALL_TOKEN(EV_EPAPR_VENDOR_ID, hcall_num)
77*4882a593Smuzhiyun 
78*4882a593Smuzhiyun /* epapr return codes */
79*4882a593Smuzhiyun #define EV_SUCCESS		0
80*4882a593Smuzhiyun #define EV_EPERM		1	/* Operation not permitted */
81*4882a593Smuzhiyun #define EV_ENOENT		2	/*  Entry Not Found */
82*4882a593Smuzhiyun #define EV_EIO			3	/* I/O error occurred */
83*4882a593Smuzhiyun #define EV_EAGAIN		4	/* The operation had insufficient
84*4882a593Smuzhiyun 					 * resources to complete and should be
85*4882a593Smuzhiyun 					 * retried
86*4882a593Smuzhiyun 					 */
87*4882a593Smuzhiyun #define EV_ENOMEM		5	/* There was insufficient memory to
88*4882a593Smuzhiyun 					 * complete the operation */
89*4882a593Smuzhiyun #define EV_EFAULT		6	/* Bad guest address */
90*4882a593Smuzhiyun #define EV_ENODEV		7	/* No such device */
91*4882a593Smuzhiyun #define EV_EINVAL		8	/* An argument supplied to the hcall
92*4882a593Smuzhiyun 					   was out of range or invalid */
93*4882a593Smuzhiyun #define EV_INTERNAL		9	/* An internal error occurred */
94*4882a593Smuzhiyun #define EV_CONFIG		10	/* A configuration error was detected */
95*4882a593Smuzhiyun #define EV_INVALID_STATE	11	/* The object is in an invalid state */
96*4882a593Smuzhiyun #define EV_UNIMPLEMENTED	12	/* Unimplemented hypercall */
97*4882a593Smuzhiyun #define EV_BUFFER_OVERFLOW	13	/* Caller-supplied buffer too small */
98*4882a593Smuzhiyun 
99*4882a593Smuzhiyun #endif /* _UAPI_ASM_POWERPC_EPAPR_HCALLS_H */
100