From b84c71d300cca687c1e00cab63f0281bac0ef29f Mon Sep 17 00:00:00 2001 From: Anuj Gangwar Date: Thu, 2 May 2019 14:09:47 +0530 Subject: include: uapi: move nvhost user-interface headers Move the linux user-interface headers from include/linux/ to include/uapi/linux/. Change the path for above headers in the dependent files Bug 2062672 Change-Id: I2e116dc8f6c33f53c03fb56b923931b6e600b534 Signed-off-by: Anuj Gangwar Reviewed-on: https://git-master.nvidia.com/r/1953709 (cherry picked from commit 965ceca35c92eba011163f4c637b3b9e0f073f1a) Signed-off-by: Anuj Gangwar Reviewed-on: https://git-master.nvidia.com/r/2110116 Reviewed-by: mobile promotions Tested-by: mobile promotions --- include/uapi/linux/nvhost_ioctl.h | 499 ++++++++++++++++++++++++++++++++ include/uapi/linux/nvhost_isp_ioctl.h | 65 +++++ include/uapi/linux/nvhost_nvcsi_ioctl.h | 89 ++++++ include/uapi/linux/nvhost_nvdec_ioctl.h | 48 +++ include/uapi/linux/nvhost_nvdla_ioctl.h | 233 +++++++++++++++ include/uapi/linux/nvhost_vi_ioctl.h | 47 +++ 6 files changed, 981 insertions(+) create mode 100644 include/uapi/linux/nvhost_ioctl.h create mode 100644 include/uapi/linux/nvhost_isp_ioctl.h create mode 100644 include/uapi/linux/nvhost_nvcsi_ioctl.h create mode 100644 include/uapi/linux/nvhost_nvdec_ioctl.h create mode 100644 include/uapi/linux/nvhost_nvdla_ioctl.h create mode 100644 include/uapi/linux/nvhost_vi_ioctl.h (limited to 'include/uapi/linux') diff --git a/include/uapi/linux/nvhost_ioctl.h b/include/uapi/linux/nvhost_ioctl.h new file mode 100644 index 000000000..aa1df5c55 --- /dev/null +++ b/include/uapi/linux/nvhost_ioctl.h @@ -0,0 +1,499 @@ +/* + * include/linux/nvhost_ioctl.h + * + * Tegra graphics host driver + * + * Copyright (c) 2009-2019, NVIDIA Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __UAPI_LINUX_NVHOST_IOCTL_H +#define __UAPI_LINUX_NVHOST_IOCTL_H + +#include +#include + +#if !defined(__KERNEL__) +#define __user +#endif + +#define NVHOST_INVALID_SYNCPOINT 0xFFFFFFFF +#define NVHOST_NO_TIMEOUT (-1) +#define NVHOST_NO_CONTEXT 0x0 +#define NVHOST_IOCTL_MAGIC 'H' +#define NVHOST_PRIORITY_LOW 50 +#define NVHOST_PRIORITY_MEDIUM 100 +#define NVHOST_PRIORITY_HIGH 150 + +#define NVHOST_TIMEOUT_FLAG_DISABLE_DUMP 0 + +#define NVHOST_SUBMIT_VERSION_V0 0x0 +#define NVHOST_SUBMIT_VERSION_V1 0x1 +#define NVHOST_SUBMIT_VERSION_V2 0x2 +#define NVHOST_SUBMIT_VERSION_MAX_SUPPORTED NVHOST_SUBMIT_VERSION_V2 + +struct nvhost_cmdbuf { + __u32 mem; + __u32 offset; + __u32 words; +} __packed; + +struct nvhost_cmdbuf_ext { + __s32 pre_fence; + __u32 reserved; +}; + +struct nvhost_reloc { + __u32 cmdbuf_mem; + __u32 cmdbuf_offset; + __u32 target; + __u32 target_offset; +}; + +struct nvhost_reloc_shift { + __u32 shift; +} __packed; + +#define NVHOST_RELOC_TYPE_DEFAULT 0 +#define NVHOST_RELOC_TYPE_PITCH_LINEAR 1 +#define NVHOST_RELOC_TYPE_BLOCK_LINEAR 2 +#define NVHOST_RELOC_TYPE_NVLINK 3 +struct nvhost_reloc_type { + __u32 reloc_type; + __u32 padding; +}; + +struct nvhost_waitchk { + __u32 mem; + __u32 offset; + __u32 syncpt_id; + __u32 thresh; +}; + +struct nvhost_syncpt_incr { + __u32 syncpt_id; + __u32 syncpt_incrs; +}; + +struct nvhost_get_param_args { + __u32 value; +} __packed; + +struct nvhost_get_param_arg { + __u32 param; + __u32 value; +}; + +struct nvhost_get_client_managed_syncpt_arg { + __u64 name; + __u32 param; + __u32 value; +}; + +struct nvhost_free_client_managed_syncpt_arg { + __u32 param; + __u32 value; +}; + +struct nvhost_channel_open_args { + __s32 channel_fd; +}; + +struct nvhost_set_syncpt_name_args { + __u64 name; + __u32 syncpt_id; + __u32 padding; +}; + +struct nvhost_set_nvmap_fd_args { + __u32 fd; +} __packed; + +enum nvhost_clk_attr { + NVHOST_CLOCK = 0, + NVHOST_BW, + NVHOST_PIXELRATE, + NVHOST_BW_KHZ, +}; + +/* + * moduleid[15:0] => module id + * moduleid[24:31] => nvhost_clk_attr + */ +#define NVHOST_MODULE_ID_BIT_POS 0 +#define NVHOST_MODULE_ID_BIT_WIDTH 16 +#define NVHOST_CLOCK_ATTR_BIT_POS 24 +#define NVHOST_CLOCK_ATTR_BIT_WIDTH 8 +struct nvhost_clk_rate_args { + __u32 rate; + __u32 moduleid; +}; + +struct nvhost_set_timeout_args { + __u32 timeout; +} __packed; + +struct nvhost_set_timeout_ex_args { + __u32 timeout; + __u32 flags; +}; + +struct nvhost_set_priority_args { + __u32 priority; +} __packed; + +struct nvhost_set_error_notifier { + __u64 offset; + __u64 size; + __u32 mem; + __u32 padding; +}; + +struct nvhost32_ctrl_module_regrdwr_args { + __u32 id; + __u32 num_offsets; + __u32 block_size; + __u32 offsets; + __u32 values; + __u32 write; +}; + +struct nvhost_ctrl_module_regrdwr_args { + __u32 id; + __u32 num_offsets; + __u32 block_size; + __u32 write; + __u64 offsets; + __u64 values; +}; + +struct nvhost32_submit_args { + __u32 submit_version; + __u32 num_syncpt_incrs; + __u32 num_cmdbufs; + __u32 num_relocs; + __u32 num_waitchks; + __u32 timeout; + __u32 syncpt_incrs; + __u32 cmdbufs; + __u32 relocs; + __u32 reloc_shifts; + __u32 waitchks; + __u32 waitbases; + __u32 class_ids; + + __u32 pad[2]; /* future expansion */ + + __u32 fences; + __u32 fence; /* Return value */ +} __packed; + +#define NVHOST_SUBMIT_FLAG_SYNC_FENCE_FD 0 +#define NVHOST_SUBMIT_MAX_NUM_SYNCPT_INCRS 10 + +struct nvhost_submit_args { + __u32 submit_version; + __u32 num_syncpt_incrs; + __u32 num_cmdbufs; + __u32 num_relocs; + __u32 num_waitchks; + __u32 timeout; + __u32 flags; + __u32 fence; /* Return value */ + __u64 syncpt_incrs; + __u64 cmdbuf_exts; + + __u32 checksum_methods; + __u32 checksum_falcon_methods; + + __u64 pad[1]; /* future expansion */ + + __u64 reloc_types; + __u64 cmdbufs; + __u64 relocs; + __u64 reloc_shifts; + __u64 waitchks; + __u64 waitbases; + __u64 class_ids; + __u64 fences; +}; + +struct nvhost_set_ctxswitch_args { + __u32 num_cmdbufs_save; + __u32 num_save_incrs; + __u32 save_incrs; + __u32 save_waitbases; + __u32 cmdbuf_save; + __u32 num_cmdbufs_restore; + __u32 num_restore_incrs; + __u32 restore_incrs; + __u32 restore_waitbases; + __u32 cmdbuf_restore; + __u32 num_relocs; + __u32 relocs; + __u32 reloc_shifts; + + __u32 pad; +}; + +struct nvhost_channel_buffer { + __u32 dmabuf_fd; /* in */ + __u32 reserved0; /* reserved, must be 0 */ + __u64 reserved1[2]; /* reserved, must be 0 */ + __u64 address; /* out, device view to the buffer */ +}; + +struct nvhost_channel_unmap_buffer_args { + __u32 num_buffers; /* in, number of buffers to unmap */ + __u32 reserved; /* reserved, must be 0 */ + __u64 table_address; /* pointer to beginning of buffer */ +}; + +struct nvhost_channel_map_buffer_args { + __u32 num_buffers; /* in, number of buffers to map */ + __u32 reserved; /* reserved, must be 0 */ + __u64 table_address; /* pointer to beginning of buffer */ +}; + +#define NVHOST_IOCTL_CHANNEL_GET_SYNCPOINTS \ + _IOR(NVHOST_IOCTL_MAGIC, 2, struct nvhost_get_param_args) +#define NVHOST_IOCTL_CHANNEL_GET_WAITBASES \ + _IOR(NVHOST_IOCTL_MAGIC, 3, struct nvhost_get_param_args) +#define NVHOST_IOCTL_CHANNEL_GET_MODMUTEXES \ + _IOR(NVHOST_IOCTL_MAGIC, 4, struct nvhost_get_param_args) +#define NVHOST_IOCTL_CHANNEL_SET_NVMAP_FD \ + _IOW(NVHOST_IOCTL_MAGIC, 5, struct nvhost_set_nvmap_fd_args) +#define NVHOST_IOCTL_CHANNEL_NULL_KICKOFF \ + _IOR(NVHOST_IOCTL_MAGIC, 6, struct nvhost_get_param_args) +#define NVHOST_IOCTL_CHANNEL_GET_CLK_RATE \ + _IOWR(NVHOST_IOCTL_MAGIC, 9, struct nvhost_clk_rate_args) +#define NVHOST_IOCTL_CHANNEL_SET_CLK_RATE \ + _IOW(NVHOST_IOCTL_MAGIC, 10, struct nvhost_clk_rate_args) +#define NVHOST_IOCTL_CHANNEL_SET_TIMEOUT \ + _IOW(NVHOST_IOCTL_MAGIC, 11, struct nvhost_set_timeout_args) +#define NVHOST_IOCTL_CHANNEL_GET_TIMEDOUT \ + _IOR(NVHOST_IOCTL_MAGIC, 12, struct nvhost_get_param_args) +#define NVHOST_IOCTL_CHANNEL_SET_PRIORITY \ + _IOW(NVHOST_IOCTL_MAGIC, 13, struct nvhost_set_priority_args) +#define NVHOST32_IOCTL_CHANNEL_MODULE_REGRDWR \ + _IOWR(NVHOST_IOCTL_MAGIC, 14, struct nvhost32_ctrl_module_regrdwr_args) +#define NVHOST32_IOCTL_CHANNEL_SUBMIT \ + _IOWR(NVHOST_IOCTL_MAGIC, 15, struct nvhost32_submit_args) +#define NVHOST_IOCTL_CHANNEL_GET_SYNCPOINT \ + _IOWR(NVHOST_IOCTL_MAGIC, 16, struct nvhost_get_param_arg) +#define NVHOST_IOCTL_CHANNEL_GET_WAITBASE \ + _IOWR(NVHOST_IOCTL_MAGIC, 17, struct nvhost_get_param_arg) +#define NVHOST_IOCTL_CHANNEL_SET_TIMEOUT_EX \ + _IOWR(NVHOST_IOCTL_MAGIC, 18, struct nvhost_set_timeout_ex_args) +#define NVHOST_IOCTL_CHANNEL_GET_CLIENT_MANAGED_SYNCPOINT \ + _IOWR(NVHOST_IOCTL_MAGIC, 19, struct nvhost_get_client_managed_syncpt_arg) +#define NVHOST_IOCTL_CHANNEL_FREE_CLIENT_MANAGED_SYNCPOINT \ + _IOWR(NVHOST_IOCTL_MAGIC, 20, struct nvhost_free_client_managed_syncpt_arg) +#define NVHOST_IOCTL_CHANNEL_GET_MODMUTEX \ + _IOWR(NVHOST_IOCTL_MAGIC, 23, struct nvhost_get_param_arg) +#define NVHOST_IOCTL_CHANNEL_SET_CTXSWITCH \ + _IOWR(NVHOST_IOCTL_MAGIC, 25, struct nvhost_set_ctxswitch_args) + +/* ioctls added for 64bit compatibility */ +#define NVHOST_IOCTL_CHANNEL_SUBMIT \ + _IOWR(NVHOST_IOCTL_MAGIC, 26, struct nvhost_submit_args) +#define NVHOST_IOCTL_CHANNEL_MODULE_REGRDWR \ + _IOWR(NVHOST_IOCTL_MAGIC, 27, struct nvhost_ctrl_module_regrdwr_args) + +#define NVHOST_IOCTL_CHANNEL_MAP_BUFFER \ + _IOWR(NVHOST_IOCTL_MAGIC, 28, struct nvhost_channel_map_buffer_args) +#define NVHOST_IOCTL_CHANNEL_UNMAP_BUFFER \ + _IOWR(NVHOST_IOCTL_MAGIC, 29, struct nvhost_channel_unmap_buffer_args) + +#define NVHOST_IOCTL_CHANNEL_SET_SYNCPOINT_NAME \ + _IOW(NVHOST_IOCTL_MAGIC, 30, struct nvhost_set_syncpt_name_args) + +#define NVHOST_IOCTL_CHANNEL_SET_ERROR_NOTIFIER \ + _IOWR(NVHOST_IOCTL_MAGIC, 111, struct nvhost_set_error_notifier) +#define NVHOST_IOCTL_CHANNEL_OPEN \ + _IOR(NVHOST_IOCTL_MAGIC, 112, struct nvhost_channel_open_args) + +#define NVHOST_IOCTL_CHANNEL_LAST \ + _IOC_NR(NVHOST_IOCTL_CHANNEL_OPEN) +#define NVHOST_IOCTL_CHANNEL_MAX_ARG_SIZE sizeof(struct nvhost_submit_args) + +struct nvhost_ctrl_syncpt_read_args { + __u32 id; + __u32 value; +}; + +struct nvhost_ctrl_syncpt_incr_args { + __u32 id; +} __packed; + +struct nvhost_ctrl_syncpt_wait_args { + __u32 id; + __u32 thresh; + __s32 timeout; +} __packed; + +struct nvhost_ctrl_syncpt_waitex_args { + __u32 id; + __u32 thresh; + __s32 timeout; + __u32 value; +}; + +struct nvhost_ctrl_syncpt_waitmex_args { + __u32 id; + __u32 thresh; + __s32 timeout; + __u32 value; + __u32 tv_sec; + __u32 tv_nsec; + __u32 clock_id; + __u32 reserved; +}; + +struct nvhost_ctrl_sync_fence_info { + __u32 id; + __u32 thresh; +}; + +struct nvhost32_ctrl_sync_fence_create_args { + __u32 num_pts; + __u64 pts; /* struct nvhost_ctrl_sync_fence_info* */ + __u64 name; /* const char* */ + __s32 fence_fd; /* fd of new fence */ +}; + +struct nvhost_ctrl_sync_fence_create_args { + __u32 num_pts; + __s32 fence_fd; /* fd of new fence */ + __u64 pts; /* struct nvhost_ctrl_sync_fence_info* */ + __u64 name; /* const char* */ +}; + +struct nvhost_ctrl_sync_fence_name_args { + __u64 name; /* const char* for name */ + __s32 fence_fd; /* fd of fence */ +}; + +struct nvhost_ctrl_module_mutex_args { + __u32 id; + __u32 lock; +}; + +enum nvhost_module_id { + NVHOST_MODULE_NONE = -1, + NVHOST_MODULE_DISPLAY_A = 0, + NVHOST_MODULE_DISPLAY_B, + NVHOST_MODULE_VI, + NVHOST_MODULE_ISP, + NVHOST_MODULE_MPE, + NVHOST_MODULE_MSENC, + NVHOST_MODULE_TSEC, + NVHOST_MODULE_GPU, + NVHOST_MODULE_VIC, + NVHOST_MODULE_NVDEC, + NVHOST_MODULE_NVJPG, + NVHOST_MODULE_VII2C, + NVHOST_MODULE_NVENC1, + NVHOST_MODULE_NVDEC1, + NVHOST_MODULE_NVCSI, + NVHOST_MODULE_TSECB = (1<<16) | NVHOST_MODULE_TSEC, +}; + +struct nvhost_characteristics { +#define NVHOST_CHARACTERISTICS_GFILTER (1 << 0) +#define NVHOST_CHARACTERISTICS_RESOURCE_PER_CHANNEL_INSTANCE (1 << 1) +#define NVHOST_CHARACTERISTICS_SUPPORT_PREFENCES (1 << 2) + __u64 flags; + + __u32 num_mlocks; + __u32 num_syncpts; + + __u32 syncpts_base; + __u32 syncpts_limit; + + __u32 num_hw_pts; + __u32 padding; +}; + +struct nvhost_ctrl_get_characteristics { + __u64 nvhost_characteristics_buf_size; + __u64 nvhost_characteristics_buf_addr; +}; + +struct nvhost_ctrl_check_module_support_args { + __u32 module_id; + __u32 value; +}; + +struct nvhost_ctrl_poll_fd_create_args { + __s32 fd; + __u32 padding; +}; + +struct nvhost_ctrl_poll_fd_trigger_event_args { + __s32 fd; + __u32 id; + __u32 thresh; + __u32 padding; +}; + +#define NVHOST_IOCTL_CTRL_SYNCPT_READ \ + _IOWR(NVHOST_IOCTL_MAGIC, 1, struct nvhost_ctrl_syncpt_read_args) +#define NVHOST_IOCTL_CTRL_SYNCPT_INCR \ + _IOW(NVHOST_IOCTL_MAGIC, 2, struct nvhost_ctrl_syncpt_incr_args) +#define NVHOST_IOCTL_CTRL_SYNCPT_WAIT \ + _IOW(NVHOST_IOCTL_MAGIC, 3, struct nvhost_ctrl_syncpt_wait_args) + +#define NVHOST_IOCTL_CTRL_MODULE_MUTEX \ + _IOWR(NVHOST_IOCTL_MAGIC, 4, struct nvhost_ctrl_module_mutex_args) +#define NVHOST32_IOCTL_CTRL_MODULE_REGRDWR \ + _IOWR(NVHOST_IOCTL_MAGIC, 5, struct nvhost32_ctrl_module_regrdwr_args) + +#define NVHOST_IOCTL_CTRL_SYNCPT_WAITEX \ + _IOWR(NVHOST_IOCTL_MAGIC, 6, struct nvhost_ctrl_syncpt_waitex_args) + +#define NVHOST_IOCTL_CTRL_GET_VERSION \ + _IOR(NVHOST_IOCTL_MAGIC, 7, struct nvhost_get_param_args) + +#define NVHOST_IOCTL_CTRL_SYNCPT_READ_MAX \ + _IOWR(NVHOST_IOCTL_MAGIC, 8, struct nvhost_ctrl_syncpt_read_args) + +#define NVHOST_IOCTL_CTRL_SYNCPT_WAITMEX \ + _IOWR(NVHOST_IOCTL_MAGIC, 9, struct nvhost_ctrl_syncpt_waitmex_args) + +#define NVHOST32_IOCTL_CTRL_SYNC_FENCE_CREATE \ + _IOWR(NVHOST_IOCTL_MAGIC, 10, struct nvhost32_ctrl_sync_fence_create_args) +#define NVHOST_IOCTL_CTRL_SYNC_FENCE_CREATE \ + _IOWR(NVHOST_IOCTL_MAGIC, 11, struct nvhost_ctrl_sync_fence_create_args) +#define NVHOST_IOCTL_CTRL_MODULE_REGRDWR \ + _IOWR(NVHOST_IOCTL_MAGIC, 12, struct nvhost_ctrl_module_regrdwr_args) +#define NVHOST_IOCTL_CTRL_SYNC_FENCE_SET_NAME \ + _IOWR(NVHOST_IOCTL_MAGIC, 13, struct nvhost_ctrl_sync_fence_name_args) +#define NVHOST_IOCTL_CTRL_GET_CHARACTERISTICS \ + _IOWR(NVHOST_IOCTL_MAGIC, 14, struct nvhost_ctrl_get_characteristics) +#define NVHOST_IOCTL_CTRL_CHECK_MODULE_SUPPORT \ + _IOWR(NVHOST_IOCTL_MAGIC, 15, struct nvhost_ctrl_check_module_support_args) +#define NVHOST_IOCTL_CTRL_POLL_FD_CREATE \ + _IOR(NVHOST_IOCTL_MAGIC, 16, struct nvhost_ctrl_poll_fd_create_args) +#define NVHOST_IOCTL_CTRL_POLL_FD_TRIGGER_EVENT \ + _IOW(NVHOST_IOCTL_MAGIC, 17, struct nvhost_ctrl_poll_fd_trigger_event_args) + +#define NVHOST_IOCTL_CTRL_LAST \ + _IOC_NR(NVHOST_IOCTL_CTRL_POLL_FD_TRIGGER_EVENT) +#define NVHOST_IOCTL_CTRL_MAX_ARG_SIZE \ + sizeof(struct nvhost_ctrl_syncpt_waitmex_args) + +#endif diff --git a/include/uapi/linux/nvhost_isp_ioctl.h b/include/uapi/linux/nvhost_isp_ioctl.h new file mode 100644 index 000000000..bbad7b918 --- /dev/null +++ b/include/uapi/linux/nvhost_isp_ioctl.h @@ -0,0 +1,65 @@ +/* + * include/linux/nvhost_isp_ioctl.h + * + * Tegra ISP Driver + * + * Copyright (c) 2013-2019, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __UAPI_LINUX_NVHOST_ISP_IOCTL_H +#define __UAPI_LINUX_NVHOST_ISP_IOCTL_H + +#include +#include + +#define ISP_SOFT_ISO_CLIENT 0 +#define ISP_HARD_ISO_CLIENT 1 + +#if !defined(__KERNEL__) +#define __user +#endif + +struct isp_emc { + uint isp_bw; + uint isp_clk; + uint bpp_input; + uint bpp_output; +}; + +struct isp_la_bw { + /* Total ISP write BW in MBps, either ISO peak BW or non-ISO avg BW */ + u32 isp_la_bw; + /* is ISO or non-ISO */ + bool is_iso; +}; + +#define NVHOST_ISP_IOCTL_MAGIC 'I' + +/* + * /dev/nvhost-ctrl-isp devices + * + * Opening a '/dev/nvhost-ctrl-isp' device node creates a way to send + * ctrl ioctl to isp driver. + * + * /dev/nvhost-isp is for channel (context specific) operations. We use + * /dev/nvhost-ctrl-isp for global (context independent) operations on + * isp device. + */ + +#define NVHOST_ISP_IOCTL_SET_ISP_LA_BW \ + _IOW(NVHOST_ISP_IOCTL_MAGIC, 4, struct isp_la_bw) +#endif + diff --git a/include/uapi/linux/nvhost_nvcsi_ioctl.h b/include/uapi/linux/nvhost_nvcsi_ioctl.h new file mode 100644 index 000000000..181af2206 --- /dev/null +++ b/include/uapi/linux/nvhost_nvcsi_ioctl.h @@ -0,0 +1,89 @@ +/* + * include/linux/nvhost_nvcsi_ioctl.h + * + * Tegra NVCSI Driver + * + * Copyright (c) 2015-2019, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __UAPI_LINUX_NVHOST_NVCSI_IOCTL_H +#define __UAPI_LINUX_NVHOST_NVCSI_IOCTL_H + +#include +#include + +#if !defined(__KERNEL__) +#define __user +#endif + +/* Bitmap + * + * | PHY_2 | PHY_1 | PHY_0 | + * | 11 10 | 9 8 | 7 6 | 5 4 | 3 2 | 1 0 | + * | CILB | CILA | CILB | CILA | CILB | CILA | + */ +#define PHY_0_CIL_A_IO0 0 +#define PHY_0_CIL_A_IO1 1 +#define PHY_0_CIL_B_IO0 2 +#define PHY_0_CIL_B_IO1 3 + +#define PHY_1_CIL_A_IO0 4 +#define PHY_1_CIL_A_IO1 5 +#define PHY_1_CIL_B_IO0 6 +#define PHY_1_CIL_B_IO1 7 + +#define PHY_2_CIL_A_IO0 8 +#define PHY_2_CIL_A_IO1 9 +#define PHY_2_CIL_B_IO0 10 +#define PHY_2_CIL_B_IO1 11 + +#define PHY_3_CIL_A_IO0 12 +#define PHY_3_CIL_A_IO1 13 +#define PHY_3_CIL_B_IO0 14 +#define PHY_3_CIL_B_IO1 15 +#define NVCSI_PHY_CIL_NUM_LANE 16 + +#define PHY_DPHY_MODE 0 +#define PHY_CPHY_MODE 1 + +#define NVCSI_PHY_0_NVCSI_CIL_A_IO0 (0x1 << PHY_0_CIL_A_IO0) +#define NVCSI_PHY_0_NVCSI_CIL_A_IO1 (0x1 << PHY_0_CIL_A_IO1) +#define NVCSI_PHY_0_NVCSI_CIL_B_IO0 (0x1 << PHY_0_CIL_B_IO0) +#define NVCSI_PHY_0_NVCSI_CIL_B_IO1 (0x1 << PHY_0_CIL_B_IO1) + +#define NVCSI_PHY_1_NVCSI_CIL_A_IO0 (0x1 << PHY_1_CIL_A_IO0) +#define NVCSI_PHY_1_NVCSI_CIL_A_IO1 (0x1 << PHY_1_CIL_A_IO1) +#define NVCSI_PHY_1_NVCSI_CIL_B_IO0 (0x1 << PHY_1_CIL_B_IO0) +#define NVCSI_PHY_1_NVCSI_CIL_B_IO1 (0x1 << PHY_1_CIL_B_IO1) + +#define NVCSI_PHY_2_NVCSI_CIL_A_IO0 (0x1 << PHY_2_CIL_A_IO0) +#define NVCSI_PHY_2_NVCSI_CIL_A_IO1 (0x1 << PHY_2_CIL_A_IO1) +#define NVCSI_PHY_2_NVCSI_CIL_B_IO0 (0x1 << PHY_2_CIL_B_IO0) +#define NVCSI_PHY_2_NVCSI_CIL_B_IO1 (0x1 << PHY_2_CIL_B_IO1) + +#define NVCSI_PHY_3_NVCSI_CIL_A_IO0 (0x1 << PHY_3_CIL_A_IO0) +#define NVCSI_PHY_3_NVCSI_CIL_A_IO1 (0x1 << PHY_3_CIL_A_IO1) +#define NVCSI_PHY_3_NVCSI_CIL_B_IO0 (0x1 << PHY_3_CIL_B_IO0) +#define NVCSI_PHY_3_NVCSI_CIL_B_IO1 (0x1 << PHY_3_CIL_B_IO1) + +#define NVCSI_PHY_NUM_BRICKS 4 +#define NVHOST_NVCSI_IOCTL_MAGIC 'N' + +#define NVHOST_NVCSI_IOCTL_DESKEW_SETUP _IOW(NVHOST_NVCSI_IOCTL_MAGIC, 1, long) +#define NVHOST_NVCSI_IOCTL_DESKEW_APPLY _IOW(NVHOST_NVCSI_IOCTL_MAGIC, 2, long) +#define NVHOST_NVCSI_IOCTL_PROD_APPLY _IOW(NVHOST_NVCSI_IOCTL_MAGIC, 3, long) + +#endif diff --git a/include/uapi/linux/nvhost_nvdec_ioctl.h b/include/uapi/linux/nvhost_nvdec_ioctl.h new file mode 100644 index 000000000..ab0f71bc3 --- /dev/null +++ b/include/uapi/linux/nvhost_nvdec_ioctl.h @@ -0,0 +1,48 @@ +/* + * include/linux/nvhost_ioctl_ioctl.h + * + * Tegra IOCTL Driver + * + * Copyright (c) 2014-2019, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __UAPI_LINUX_NVHOST_IOCTL_IOCTL_H +#define __UAPI_LINUX_NVHOST_IOCTL_IOCTL_H + +#include +#include + +#if !defined(__KERNEL__) +#define __user +#endif + +#define NVHOST_NVDEC_IOCTL_MAGIC 'N' + +/* + * /dev/nvhost-ctrl-nvdec devices + * + * Opening a '/dev/nvhost-ctrl-nvdec' device node creates a way to send + * ctrl ioctl to nvdec driver. + * + * /dev/nvhost-nvdec is for channel (context specific) operations. We use + * /dev/nvhost-ctrl-nvdec for global (context independent) operations on + * nvdec device. + */ + +#define NVHOST_NVDEC_IOCTL_POWERON _IOW(NVHOST_NVDEC_IOCTL_MAGIC, 1, uint) +#define NVHOST_NVDEC_IOCTL_POWEROFF _IOW(NVHOST_NVDEC_IOCTL_MAGIC, 2, uint) + +#endif diff --git a/include/uapi/linux/nvhost_nvdla_ioctl.h b/include/uapi/linux/nvhost_nvdla_ioctl.h new file mode 100644 index 000000000..d17cf7e15 --- /dev/null +++ b/include/uapi/linux/nvhost_nvdla_ioctl.h @@ -0,0 +1,233 @@ +/* + * include/linux/nvhost_nvdla_ioctl.h + * + * Tegra NvDLA Driver + * + * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, see . + */ + +#ifndef __UAPI_LINUX_NVHOST_NVDLA_IOCTL_H +#define __UAPI_LINUX_NVHOST_NVDLA_IOCTL_H + +#include +#include + +#if !defined(__KERNEL__) +#define __user +#endif + +/** + * struct nvdla_queue_stat_args strcture + * + * @status queue status flags + * + */ +struct nvdla_queue_status_args { +#define NVDLA_QUEUE_FLAGS_SUSPEND (1 << 0) +#define NVDLA_QUEUE_FLAGS_RESUME (1 << 1) + __u64 status; +}; + +/** + * struct nvdla_ping_args structure for ping data + * + * @in_challenge challenge data to be sent + * @out_response response/CRC on challenge data from engine + * + */ +struct nvdla_ping_args { + __u32 in_challenge; + __u32 out_response; +}; + + +/** + * struct nvdla_pin_unpin_args strcture args for buffer pin/unpin + * + * @buffers list of buffers to pin/unpin'ed + * @num_buffers number of buffers count + * @reserved reserved for future use + * + */ +struct nvdla_pin_unpin_args { + __u64 buffers; + __u32 num_buffers; + __u32 reserved; +}; + +/** + * struct nvdla_submit_args structure for task submit + * + * @tasks pointer to task list + * @num_tasks number of tasks count + * @flags flags for task submit, like atomic + * @version version of task structure + * + */ +struct nvdla_submit_args { + __u64 tasks; + __u16 num_tasks; +#define MAX_TASKS_PER_SUBMIT 24 +#define NVDLA_SUBMIT_FLAGS_ATOMIC (1 << 0) + __u16 flags; + __u32 version; +}; + +/** + * struct nvdla_get_fw_ver_args strcture + * + * @version Firmware version + * + */ +struct nvdla_get_fw_ver_args { + __u32 version; +}; + +/** + * struct nvdla_get_q_status_args strcture + * + * @id queue id + * @fence fence assigned to queue + * + */ +struct nvdla_get_q_status_args { + __u32 id; + __u64 fence; +}; + +/** + * struct nvdla_mem_handle structure for memory handles + * + * @handle handle to buffer allocated in userspace + * @offset offset in buffer + * + */ +struct nvdla_mem_handle { + __u32 handle; + __u32 offset; +}; + +/** + * struct nvdla_ioctl_submit_task structure for single task information + * + * @num_prefences number of pre-fences in task + * @num_postfences number of post-fences in task + * @num_input_task_status number of input task status + * @num_output_task_status number of output task status + * @flags flags for bitwise task info embeddeing + * @reserved reserved for future use + * @prefences pointer to pre-fence struct table + * @postfences pointer to post-fence struct table + * @input_task_status pointer to input task status struct table + * @output_task_status pointer to output task status struct table + * @num_addresses total number of addressed passed in structure + * @address_list pointer to address list + * @timeout task timeout + * + */ +struct nvdla_ioctl_submit_task { + __u8 num_prefences; + __u8 num_postfences; + __u8 num_input_task_status; + __u8 num_output_task_status; +#define NVDLA_MAX_BUFFERS_PER_TASK (6144) + __u32 num_addresses; + __u16 flags; + __u16 reserved; + + __u64 prefences; + __u64 postfences; + + __u64 input_task_status; + __u64 output_task_status; + __u64 address_list; + __u64 timeout; +}; + +/** + * struct nvdla_ioctl_emu_submit_task structure for single emulator task + * information + * + * @num_postfences number of post-fences in task + * @reserved reserved for padding and future use + * @postfences pointer to post-fence struct table + * + */ +struct nvdla_ioctl_emu_submit_task { + __u32 num_postfences; + __u32 reserved; + + __u64 postfences; +}; + +/** + * struct nvdla_fence structure for passing fence information + * + * NOTE: this will be removed soon, please use generic fence type + * from nvdev_fence.h + */ +struct nvdla_fence { + __u32 type; +#define NVDLA_FENCE_TYPE_SYNCPT 0 +#define NVDLA_FENCE_TYPE_SYNC_FD 1 +#define NVDLA_FENCE_TYPE_SEMAPHORE 2 +#define NVDLA_FENCE_TYPE_TS_SEMAPHORE 3 + __u32 syncpoint_index; + __u32 syncpoint_value; + __u32 sync_fd; + __u32 sem_handle; + __u32 sem_offset; + __u32 sem_val; +}; + +/** + * struct nvdla_status_notify structure for passing status notify information + * + * @handle handle to buffer allocated in userspace + * @offset offset in buffer + * @status status + * + */ +struct nvdla_status_notify { + __u32 handle; + __u32 offset; + __u32 status; +}; + +#define NVHOST_NVDLA_IOCTL_MAGIC 'D' + +#define NVDLA_IOCTL_PING \ + _IOWR(NVHOST_NVDLA_IOCTL_MAGIC, 1, struct nvdla_ping_args) +#define NVDLA_IOCTL_PIN \ + _IOW(NVHOST_NVDLA_IOCTL_MAGIC, 2, struct nvdla_pin_unpin_args) +#define NVDLA_IOCTL_UNPIN \ + _IOW(NVHOST_NVDLA_IOCTL_MAGIC, 3, struct nvdla_pin_unpin_args) +#define NVDLA_IOCTL_SUBMIT \ + _IOW(NVHOST_NVDLA_IOCTL_MAGIC, 4, struct nvdla_submit_args) +#define NVDLA_IOCTL_SET_QUEUE_STATUS \ + _IOW(NVHOST_NVDLA_IOCTL_MAGIC, 5, struct nvdla_queue_status_args) +#define NVDLA_IOCTL_GET_FIRMWARE_VERSION \ + _IOWR(NVHOST_NVDLA_IOCTL_MAGIC, 6, struct nvdla_get_fw_ver_args) +#define NVDLA_IOCTL_GET_QUEUE_STATUS \ + _IOWR(NVHOST_NVDLA_IOCTL_MAGIC, 7, struct nvdla_get_q_status_args) +#define NVDLA_IOCTL_EMU_TASK_SUBMIT \ + _IOWR(NVHOST_NVDLA_IOCTL_MAGIC, 8, struct nvdla_submit_args) +#define NVDLA_IOCTL_LAST \ + _IOC_NR(NVDLA_IOCTL_EMU_TASK_SUBMIT) + +#define NVDLA_IOCTL_MAX_ARG_SIZE \ + sizeof(struct nvdla_pin_unpin_args) + +#endif /* __UAPI_LINUX_NVHOST_NVDLA_IOCTL_H */ diff --git a/include/uapi/linux/nvhost_vi_ioctl.h b/include/uapi/linux/nvhost_vi_ioctl.h new file mode 100644 index 000000000..659632da0 --- /dev/null +++ b/include/uapi/linux/nvhost_vi_ioctl.h @@ -0,0 +1,47 @@ +/* + * include/linux/nvhost_vi_ioctl.h + * + * Tegra VI Driver + * + * Copyright (c) 2013-2019, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __UAPI_LINUX_NVHOST_VI_IOCTL_H +#define __UAPI_LINUX_NVHOST_VI_IOCTL_H + +#include +#include + +#if !defined(__KERNEL__) +#define __user +#endif + +#define NVHOST_VI_IOCTL_MAGIC 'V' + +/* + * /dev/nvhost-ctrl-vi devices + * + * Opening a '/dev/nvhost-ctrl-vi' device node creates a way to send + * ctrl ioctl to vi driver. + * + * /dev/nvhost-vi is for channel (context specific) operations. We use + * /dev/nvhost-ctrl-vi for global (context independent) operations on + * vi device. + */ + +#define NVHOST_VI_IOCTL_ENABLE_TPG _IOW(NVHOST_VI_IOCTL_MAGIC, 1, uint) + +#endif -- cgit v1.2.2