| 1 | /* |
| 2 | Copyright (c) 2012, Broadcom Europe Ltd |
| 3 | All rights reserved. |
| 4 | |
| 5 | Redistribution and use in source and binary forms, with or without |
| 6 | modification, are permitted provided that the following conditions are met: |
| 7 | * Redistributions of source code must retain the above copyright |
| 8 | notice, this list of conditions and the following disclaimer. |
| 9 | * Redistributions in binary form must reproduce the above copyright |
| 10 | notice, this list of conditions and the following disclaimer in the |
| 11 | documentation and/or other materials provided with the distribution. |
| 12 | * Neither the name of the copyright holder nor the |
| 13 | names of its contributors may be used to endorse or promote products |
| 14 | derived from this software without specific prior written permission. |
| 15 | |
| 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY |
| 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 | */ |
| 27 | |
| 28 | #ifndef VCHIQ_IOCTLS_H |
| 29 | #define VCHIQ_IOCTLS_H |
| 30 | |
| 31 | #include <linux/ioctl.h> |
| 32 | #include "vchiq_if.h" |
| 33 | |
| 34 | #define VCHIQ_IOC_MAGIC 0xc4 |
| 35 | #define VCHIQ_INVALID_HANDLE (~0) |
| 36 | |
| 37 | typedef struct { |
| 38 | VCHIQ_SERVICE_PARAMS_T params; |
| 39 | int is_open; |
| 40 | int is_vchi; |
| 41 | unsigned int handle; /* OUT */ |
| 42 | } VCHIQ_CREATE_SERVICE_T; |
| 43 | |
| 44 | typedef struct { |
| 45 | unsigned int handle; |
| 46 | unsigned int count; |
| 47 | const VCHIQ_ELEMENT_T *elements; |
| 48 | } VCHIQ_QUEUE_MESSAGE_T; |
| 49 | |
| 50 | typedef struct { |
| 51 | unsigned int handle; |
| 52 | void *data; |
| 53 | unsigned int size; |
| 54 | void *userdata; |
| 55 | VCHIQ_BULK_MODE_T mode; |
| 56 | } VCHIQ_QUEUE_BULK_TRANSFER_T; |
| 57 | |
| 58 | typedef struct { |
| 59 | VCHIQ_REASON_T reason; |
| 60 | VCHIQ_HEADER_T *; |
| 61 | void *service_userdata; |
| 62 | void *bulk_userdata; |
| 63 | } VCHIQ_COMPLETION_DATA_T; |
| 64 | |
| 65 | typedef struct { |
| 66 | unsigned int count; |
| 67 | VCHIQ_COMPLETION_DATA_T *buf; |
| 68 | unsigned int msgbufsize; |
| 69 | unsigned int msgbufcount; /* IN/OUT */ |
| 70 | void **msgbufs; |
| 71 | } VCHIQ_AWAIT_COMPLETION_T; |
| 72 | |
| 73 | typedef struct { |
| 74 | unsigned int handle; |
| 75 | int blocking; |
| 76 | unsigned int bufsize; |
| 77 | void *buf; |
| 78 | } VCHIQ_DEQUEUE_MESSAGE_T; |
| 79 | |
| 80 | typedef struct { |
| 81 | unsigned int config_size; |
| 82 | VCHIQ_CONFIG_T *pconfig; |
| 83 | } VCHIQ_GET_CONFIG_T; |
| 84 | |
| 85 | typedef struct { |
| 86 | unsigned int handle; |
| 87 | VCHIQ_SERVICE_OPTION_T option; |
| 88 | int value; |
| 89 | } VCHIQ_SET_SERVICE_OPTION_T; |
| 90 | |
| 91 | typedef struct { |
| 92 | void *virt_addr; |
| 93 | size_t num_bytes; |
| 94 | } VCHIQ_DUMP_MEM_T; |
| 95 | |
| 96 | #define VCHIQ_IOC_CONNECT _IO(VCHIQ_IOC_MAGIC, 0) |
| 97 | #define VCHIQ_IOC_SHUTDOWN _IO(VCHIQ_IOC_MAGIC, 1) |
| 98 | #define VCHIQ_IOC_CREATE_SERVICE _IOWR(VCHIQ_IOC_MAGIC, 2, VCHIQ_CREATE_SERVICE_T) |
| 99 | #define VCHIQ_IOC_REMOVE_SERVICE _IO(VCHIQ_IOC_MAGIC, 3) |
| 100 | #define VCHIQ_IOC_QUEUE_MESSAGE _IOW(VCHIQ_IOC_MAGIC, 4, VCHIQ_QUEUE_MESSAGE_T) |
| 101 | #define VCHIQ_IOC_QUEUE_BULK_TRANSMIT _IOWR(VCHIQ_IOC_MAGIC, 5, VCHIQ_QUEUE_BULK_TRANSFER_T) |
| 102 | #define VCHIQ_IOC_QUEUE_BULK_RECEIVE _IOWR(VCHIQ_IOC_MAGIC, 6, VCHIQ_QUEUE_BULK_TRANSFER_T) |
| 103 | #define VCHIQ_IOC_AWAIT_COMPLETION _IOWR(VCHIQ_IOC_MAGIC, 7, VCHIQ_AWAIT_COMPLETION_T) |
| 104 | #define VCHIQ_IOC_DEQUEUE_MESSAGE _IOWR(VCHIQ_IOC_MAGIC, 8, VCHIQ_DEQUEUE_MESSAGE_T) |
| 105 | #define VCHIQ_IOC_GET_CLIENT_ID _IO(VCHIQ_IOC_MAGIC, 9) |
| 106 | #define VCHIQ_IOC_GET_CONFIG _IOWR(VCHIQ_IOC_MAGIC, 10, VCHIQ_GET_CONFIG_T) |
| 107 | #define VCHIQ_IOC_CLOSE_SERVICE _IO(VCHIQ_IOC_MAGIC, 11) |
| 108 | #define VCHIQ_IOC_USE_SERVICE _IO(VCHIQ_IOC_MAGIC, 12) |
| 109 | #define VCHIQ_IOC_RELEASE_SERVICE _IO(VCHIQ_IOC_MAGIC, 13) |
| 110 | #define VCHIQ_IOC_SET_SERVICE_OPTION _IOW(VCHIQ_IOC_MAGIC, 14, VCHIQ_SET_SERVICE_OPTION_T) |
| 111 | #define VCHIQ_IOC_DUMP_PHYS_MEM _IOW(VCHIQ_IOC_MAGIC, 15, VCHIQ_DUMP_MEM_T) |
| 112 | #define VCHIQ_IOC_LIB_VERSION _IO(VCHIQ_IOC_MAGIC, 16) |
| 113 | #define VCHIQ_IOC_CLOSE_DELIVERED _IO(VCHIQ_IOC_MAGIC, 17) |
| 114 | #define VCHIQ_IOC_MAX 17 |
| 115 | |
| 116 | #endif |
| 117 | |