18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * ePAPR hcall interface
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright 2008-2011 Freescale Semiconductor, Inc.
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Author: Timur Tabi <timur@freescale.com>
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * This file is provided under a dual BSD/GPL license.  When using or
108c2ecf20Sopenharmony_ci * redistributing this file, you may do so under either license.
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without
138c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions are met:
148c2ecf20Sopenharmony_ci *     * Redistributions of source code must retain the above copyright
158c2ecf20Sopenharmony_ci *       notice, this list of conditions and the following disclaimer.
168c2ecf20Sopenharmony_ci *     * Redistributions in binary form must reproduce the above copyright
178c2ecf20Sopenharmony_ci *       notice, this list of conditions and the following disclaimer in the
188c2ecf20Sopenharmony_ci *       documentation and/or other materials provided with the distribution.
198c2ecf20Sopenharmony_ci *     * Neither the name of Freescale Semiconductor nor the
208c2ecf20Sopenharmony_ci *       names of its contributors may be used to endorse or promote products
218c2ecf20Sopenharmony_ci *       derived from this software without specific prior written permission.
228c2ecf20Sopenharmony_ci *
238c2ecf20Sopenharmony_ci *
248c2ecf20Sopenharmony_ci * ALTERNATIVELY, this software may be distributed under the terms of the
258c2ecf20Sopenharmony_ci * GNU General Public License ("GPL") as published by the Free Software
268c2ecf20Sopenharmony_ci * Foundation, either version 2 of that License or (at your option) any
278c2ecf20Sopenharmony_ci * later version.
288c2ecf20Sopenharmony_ci *
298c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
308c2ecf20Sopenharmony_ci * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
318c2ecf20Sopenharmony_ci * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
328c2ecf20Sopenharmony_ci * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
338c2ecf20Sopenharmony_ci * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
348c2ecf20Sopenharmony_ci * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
358c2ecf20Sopenharmony_ci * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
368c2ecf20Sopenharmony_ci * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
378c2ecf20Sopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
388c2ecf20Sopenharmony_ci * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
398c2ecf20Sopenharmony_ci */
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#ifndef _UAPI_ASM_POWERPC_EPAPR_HCALLS_H
428c2ecf20Sopenharmony_ci#define _UAPI_ASM_POWERPC_EPAPR_HCALLS_H
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci#define EV_BYTE_CHANNEL_SEND		1
458c2ecf20Sopenharmony_ci#define EV_BYTE_CHANNEL_RECEIVE		2
468c2ecf20Sopenharmony_ci#define EV_BYTE_CHANNEL_POLL		3
478c2ecf20Sopenharmony_ci#define EV_INT_SET_CONFIG		4
488c2ecf20Sopenharmony_ci#define EV_INT_GET_CONFIG		5
498c2ecf20Sopenharmony_ci#define EV_INT_SET_MASK			6
508c2ecf20Sopenharmony_ci#define EV_INT_GET_MASK			7
518c2ecf20Sopenharmony_ci#define EV_INT_IACK			9
528c2ecf20Sopenharmony_ci#define EV_INT_EOI			10
538c2ecf20Sopenharmony_ci#define EV_INT_SEND_IPI			11
548c2ecf20Sopenharmony_ci#define EV_INT_SET_TASK_PRIORITY	12
558c2ecf20Sopenharmony_ci#define EV_INT_GET_TASK_PRIORITY	13
568c2ecf20Sopenharmony_ci#define EV_DOORBELL_SEND		14
578c2ecf20Sopenharmony_ci#define EV_MSGSND			15
588c2ecf20Sopenharmony_ci#define EV_IDLE				16
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci/* vendor ID: epapr */
618c2ecf20Sopenharmony_ci#define EV_LOCAL_VENDOR_ID		0	/* for private use */
628c2ecf20Sopenharmony_ci#define EV_EPAPR_VENDOR_ID		1
638c2ecf20Sopenharmony_ci#define EV_FSL_VENDOR_ID		2	/* Freescale Semiconductor */
648c2ecf20Sopenharmony_ci#define EV_IBM_VENDOR_ID		3	/* IBM */
658c2ecf20Sopenharmony_ci#define EV_GHS_VENDOR_ID		4	/* Green Hills Software */
668c2ecf20Sopenharmony_ci#define EV_ENEA_VENDOR_ID		5	/* Enea */
678c2ecf20Sopenharmony_ci#define EV_WR_VENDOR_ID			6	/* Wind River Systems */
688c2ecf20Sopenharmony_ci#define EV_AMCC_VENDOR_ID		7	/* Applied Micro Circuits */
698c2ecf20Sopenharmony_ci#define EV_KVM_VENDOR_ID		42	/* KVM */
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci/* The max number of bytes that a byte channel can send or receive per call */
728c2ecf20Sopenharmony_ci#define EV_BYTE_CHANNEL_MAX_BYTES	16
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci#define _EV_HCALL_TOKEN(id, num) (((id) << 16) | (num))
768c2ecf20Sopenharmony_ci#define EV_HCALL_TOKEN(hcall_num) _EV_HCALL_TOKEN(EV_EPAPR_VENDOR_ID, hcall_num)
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci/* epapr return codes */
798c2ecf20Sopenharmony_ci#define EV_SUCCESS		0
808c2ecf20Sopenharmony_ci#define EV_EPERM		1	/* Operation not permitted */
818c2ecf20Sopenharmony_ci#define EV_ENOENT		2	/*  Entry Not Found */
828c2ecf20Sopenharmony_ci#define EV_EIO			3	/* I/O error occurred */
838c2ecf20Sopenharmony_ci#define EV_EAGAIN		4	/* The operation had insufficient
848c2ecf20Sopenharmony_ci					 * resources to complete and should be
858c2ecf20Sopenharmony_ci					 * retried
868c2ecf20Sopenharmony_ci					 */
878c2ecf20Sopenharmony_ci#define EV_ENOMEM		5	/* There was insufficient memory to
888c2ecf20Sopenharmony_ci					 * complete the operation */
898c2ecf20Sopenharmony_ci#define EV_EFAULT		6	/* Bad guest address */
908c2ecf20Sopenharmony_ci#define EV_ENODEV		7	/* No such device */
918c2ecf20Sopenharmony_ci#define EV_EINVAL		8	/* An argument supplied to the hcall
928c2ecf20Sopenharmony_ci					   was out of range or invalid */
938c2ecf20Sopenharmony_ci#define EV_INTERNAL		9	/* An internal error occurred */
948c2ecf20Sopenharmony_ci#define EV_CONFIG		10	/* A configuration error was detected */
958c2ecf20Sopenharmony_ci#define EV_INVALID_STATE	11	/* The object is in an invalid state */
968c2ecf20Sopenharmony_ci#define EV_UNIMPLEMENTED	12	/* Unimplemented hypercall */
978c2ecf20Sopenharmony_ci#define EV_BUFFER_OVERFLOW	13	/* Caller-supplied buffer too small */
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci#endif /* _UAPI_ASM_POWERPC_EPAPR_HCALLS_H */
100