1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 2 /* Copyright (c) 2010-2012 Broadcom. All rights reserved. */ 3 4 #ifndef VCHIQ_IOCTLS_H 5 #define VCHIQ_IOCTLS_H 6 7 #include <linux/ioctl.h> 8 9 #include "../../include/linux/raspberrypi/vchiq.h" 10 11 #define VCHIQ_IOC_MAGIC 0xc4 12 #define VCHIQ_INVALID_HANDLE (~0) 13 14 struct vchiq_service_params { 15 int fourcc; 16 int __user (*callback)(enum vchiq_reason reason, 17 struct vchiq_header *header, 18 unsigned int handle, 19 void *bulk_userdata); 20 void __user *userdata; 21 short version; /* Increment for non-trivial changes */ 22 short version_min; /* Update for incompatible changes */ 23 }; 24 25 struct vchiq_create_service { 26 struct vchiq_service_params params; 27 int is_open; 28 int is_vchi; 29 unsigned int handle; /* OUT */ 30 }; 31 32 struct vchiq_queue_message { 33 unsigned int handle; 34 unsigned int count; 35 const struct vchiq_element __user *elements; 36 }; 37 38 struct vchiq_queue_bulk_transfer { 39 unsigned int handle; 40 void __user *data; 41 unsigned int size; 42 void __user *userdata; 43 enum vchiq_bulk_mode mode; 44 }; 45 46 struct vchiq_completion_data { 47 enum vchiq_reason reason; 48 struct vchiq_header __user *header; 49 void __user *service_userdata; 50 void __user *bulk_userdata; 51 }; 52 53 struct vchiq_await_completion { 54 unsigned int count; 55 struct vchiq_completion_data __user *buf; 56 unsigned int msgbufsize; 57 unsigned int msgbufcount; /* IN/OUT */ 58 void * __user *msgbufs; 59 }; 60 61 struct vchiq_dequeue_message { 62 unsigned int handle; 63 int blocking; 64 unsigned int bufsize; 65 void __user *buf; 66 }; 67 68 struct vchiq_get_config { 69 unsigned int config_size; 70 struct vchiq_config __user *pconfig; 71 }; 72 73 struct vchiq_set_service_option { 74 unsigned int handle; 75 enum vchiq_service_option option; 76 int value; 77 }; 78 79 struct vchiq_dump_mem { 80 void __user *virt_addr; 81 size_t num_bytes; 82 }; 83 84 #define VCHIQ_IOC_CONNECT _IO(VCHIQ_IOC_MAGIC, 0) 85 #define VCHIQ_IOC_SHUTDOWN _IO(VCHIQ_IOC_MAGIC, 1) 86 #define VCHIQ_IOC_CREATE_SERVICE \ 87 _IOWR(VCHIQ_IOC_MAGIC, 2, struct vchiq_create_service) 88 #define VCHIQ_IOC_REMOVE_SERVICE _IO(VCHIQ_IOC_MAGIC, 3) 89 #define VCHIQ_IOC_QUEUE_MESSAGE \ 90 _IOW(VCHIQ_IOC_MAGIC, 4, struct vchiq_queue_message) 91 #define VCHIQ_IOC_QUEUE_BULK_TRANSMIT \ 92 _IOWR(VCHIQ_IOC_MAGIC, 5, struct vchiq_queue_bulk_transfer) 93 #define VCHIQ_IOC_QUEUE_BULK_RECEIVE \ 94 _IOWR(VCHIQ_IOC_MAGIC, 6, struct vchiq_queue_bulk_transfer) 95 #define VCHIQ_IOC_AWAIT_COMPLETION \ 96 _IOWR(VCHIQ_IOC_MAGIC, 7, struct vchiq_await_completion) 97 #define VCHIQ_IOC_DEQUEUE_MESSAGE \ 98 _IOWR(VCHIQ_IOC_MAGIC, 8, struct vchiq_dequeue_message) 99 #define VCHIQ_IOC_GET_CLIENT_ID _IO(VCHIQ_IOC_MAGIC, 9) 100 #define VCHIQ_IOC_GET_CONFIG \ 101 _IOWR(VCHIQ_IOC_MAGIC, 10, struct vchiq_get_config) 102 #define VCHIQ_IOC_CLOSE_SERVICE _IO(VCHIQ_IOC_MAGIC, 11) 103 #define VCHIQ_IOC_USE_SERVICE _IO(VCHIQ_IOC_MAGIC, 12) 104 #define VCHIQ_IOC_RELEASE_SERVICE _IO(VCHIQ_IOC_MAGIC, 13) 105 #define VCHIQ_IOC_SET_SERVICE_OPTION \ 106 _IOW(VCHIQ_IOC_MAGIC, 14, struct vchiq_set_service_option) 107 #define VCHIQ_IOC_DUMP_PHYS_MEM \ 108 _IOW(VCHIQ_IOC_MAGIC, 15, struct vchiq_dump_mem) 109 #define VCHIQ_IOC_LIB_VERSION _IO(VCHIQ_IOC_MAGIC, 16) 110 #define VCHIQ_IOC_CLOSE_DELIVERED _IO(VCHIQ_IOC_MAGIC, 17) 111 #define VCHIQ_IOC_MAX 17 112 113 #endif 114