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