1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */
2c99ec973SAlexander Graf /*
3c99ec973SAlexander Graf  * ePAPR hcall interface
4c99ec973SAlexander Graf  *
5c99ec973SAlexander Graf  * Copyright 2008-2011 Freescale Semiconductor, Inc.
6c99ec973SAlexander Graf  *
7c99ec973SAlexander Graf  * Author: Timur Tabi <timur@freescale.com>
8c99ec973SAlexander Graf  *
9c99ec973SAlexander Graf  * This file is provided under a dual BSD/GPL license.  When using or
10c99ec973SAlexander Graf  * redistributing this file, you may do so under either license.
11c99ec973SAlexander Graf  *
12c99ec973SAlexander Graf  * Redistribution and use in source and binary forms, with or without
13c99ec973SAlexander Graf  * modification, are permitted provided that the following conditions are met:
14c99ec973SAlexander Graf  *     * Redistributions of source code must retain the above copyright
15c99ec973SAlexander Graf  *       notice, this list of conditions and the following disclaimer.
16c99ec973SAlexander Graf  *     * Redistributions in binary form must reproduce the above copyright
17c99ec973SAlexander Graf  *       notice, this list of conditions and the following disclaimer in the
18c99ec973SAlexander Graf  *       documentation and/or other materials provided with the distribution.
19c99ec973SAlexander Graf  *     * Neither the name of Freescale Semiconductor nor the
20c99ec973SAlexander Graf  *       names of its contributors may be used to endorse or promote products
21c99ec973SAlexander Graf  *       derived from this software without specific prior written permission.
22c99ec973SAlexander Graf  *
23c99ec973SAlexander Graf  *
24c99ec973SAlexander Graf  * ALTERNATIVELY, this software may be distributed under the terms of the
25c99ec973SAlexander Graf  * GNU General Public License ("GPL") as published by the Free Software
26c99ec973SAlexander Graf  * Foundation, either version 2 of that License or (at your option) any
27c99ec973SAlexander Graf  * later version.
28c99ec973SAlexander Graf  *
29c99ec973SAlexander Graf  * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
30c99ec973SAlexander Graf  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
31c99ec973SAlexander Graf  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
32c99ec973SAlexander Graf  * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
33c99ec973SAlexander Graf  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
34c99ec973SAlexander Graf  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35c99ec973SAlexander Graf  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
36c99ec973SAlexander Graf  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37c99ec973SAlexander Graf  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
38c99ec973SAlexander Graf  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39c99ec973SAlexander Graf  */
40c99ec973SAlexander Graf 
4163a19091SAlexander Graf #ifndef _UAPI_ASM_POWERPC_EPAPR_HCALLS_H
4263a19091SAlexander Graf #define _UAPI_ASM_POWERPC_EPAPR_HCALLS_H
4363a19091SAlexander Graf 
4463a19091SAlexander Graf #define EV_BYTE_CHANNEL_SEND		1
4563a19091SAlexander Graf #define EV_BYTE_CHANNEL_RECEIVE		2
4663a19091SAlexander Graf #define EV_BYTE_CHANNEL_POLL		3
4763a19091SAlexander Graf #define EV_INT_SET_CONFIG		4
4863a19091SAlexander Graf #define EV_INT_GET_CONFIG		5
4963a19091SAlexander Graf #define EV_INT_SET_MASK			6
5063a19091SAlexander Graf #define EV_INT_GET_MASK			7
5163a19091SAlexander Graf #define EV_INT_IACK			9
5263a19091SAlexander Graf #define EV_INT_EOI			10
5363a19091SAlexander Graf #define EV_INT_SEND_IPI			11
5463a19091SAlexander Graf #define EV_INT_SET_TASK_PRIORITY	12
5563a19091SAlexander Graf #define EV_INT_GET_TASK_PRIORITY	13
5663a19091SAlexander Graf #define EV_DOORBELL_SEND		14
5763a19091SAlexander Graf #define EV_MSGSND			15
5863a19091SAlexander Graf #define EV_IDLE				16
5963a19091SAlexander Graf 
6063a19091SAlexander Graf /* vendor ID: epapr */
6163a19091SAlexander Graf #define EV_LOCAL_VENDOR_ID		0	/* for private use */
6263a19091SAlexander Graf #define EV_EPAPR_VENDOR_ID		1
6363a19091SAlexander Graf #define EV_FSL_VENDOR_ID		2	/* Freescale Semiconductor */
6463a19091SAlexander Graf #define EV_IBM_VENDOR_ID		3	/* IBM */
6563a19091SAlexander Graf #define EV_GHS_VENDOR_ID		4	/* Green Hills Software */
6663a19091SAlexander Graf #define EV_ENEA_VENDOR_ID		5	/* Enea */
6763a19091SAlexander Graf #define EV_WR_VENDOR_ID			6	/* Wind River Systems */
6863a19091SAlexander Graf #define EV_AMCC_VENDOR_ID		7	/* Applied Micro Circuits */
6963a19091SAlexander Graf #define EV_KVM_VENDOR_ID		42	/* KVM */
7063a19091SAlexander Graf 
7163a19091SAlexander Graf /* The max number of bytes that a byte channel can send or receive per call */
7263a19091SAlexander Graf #define EV_BYTE_CHANNEL_MAX_BYTES	16
7363a19091SAlexander Graf 
7463a19091SAlexander Graf 
7563a19091SAlexander Graf #define _EV_HCALL_TOKEN(id, num) (((id) << 16) | (num))
7663a19091SAlexander Graf #define EV_HCALL_TOKEN(hcall_num) _EV_HCALL_TOKEN(EV_EPAPR_VENDOR_ID, hcall_num)
7763a19091SAlexander Graf 
7863a19091SAlexander Graf /* epapr return codes */
7963a19091SAlexander Graf #define EV_SUCCESS		0
8063a19091SAlexander Graf #define EV_EPERM		1	/* Operation not permitted */
8163a19091SAlexander Graf #define EV_ENOENT		2	/*  Entry Not Found */
82446957baSAdam Buchbinder #define EV_EIO			3	/* I/O error occurred */
8363a19091SAlexander Graf #define EV_EAGAIN		4	/* The operation had insufficient
8463a19091SAlexander Graf 					 * resources to complete and should be
8563a19091SAlexander Graf 					 * retried
86c99ec973SAlexander Graf 					 */
8763a19091SAlexander Graf #define EV_ENOMEM		5	/* There was insufficient memory to
8863a19091SAlexander Graf 					 * complete the operation */
8963a19091SAlexander Graf #define EV_EFAULT		6	/* Bad guest address */
9063a19091SAlexander Graf #define EV_ENODEV		7	/* No such device */
9163a19091SAlexander Graf #define EV_EINVAL		8	/* An argument supplied to the hcall
9263a19091SAlexander Graf 					   was out of range or invalid */
93446957baSAdam Buchbinder #define EV_INTERNAL		9	/* An internal error occurred */
9463a19091SAlexander Graf #define EV_CONFIG		10	/* A configuration error was detected */
9563a19091SAlexander Graf #define EV_INVALID_STATE	11	/* The object is in an invalid state */
9663a19091SAlexander Graf #define EV_UNIMPLEMENTED	12	/* Unimplemented hypercall */
9763a19091SAlexander Graf #define EV_BUFFER_OVERFLOW	13	/* Caller-supplied buffer too small */
98c99ec973SAlexander Graf 
9963a19091SAlexander Graf #endif /* _UAPI_ASM_POWERPC_EPAPR_HCALLS_H */
100