Path: blob/main/sys/contrib/vchiq/interface/vchiq_arm/vchiq_ioctl.h
110286 views
/**1* Copyright (c) 2010-2012 Broadcom. All rights reserved.2*3* Redistribution and use in source and binary forms, with or without4* modification, are permitted provided that the following conditions5* are met:6* 1. Redistributions of source code must retain the above copyright7* notice, this list of conditions, and the following disclaimer,8* without modification.9* 2. Redistributions in binary form must reproduce the above copyright10* notice, this list of conditions and the following disclaimer in the11* documentation and/or other materials provided with the distribution.12* 3. The names of the above-listed copyright holders may not be used13* to endorse or promote products derived from this software without14* specific prior written permission.15*16* ALTERNATIVELY, this software may be distributed under the terms of the17* GNU General Public License ("GPL") version 2, as published by the Free18* Software Foundation.19*20* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS21* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,22* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR23* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR24* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,25* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,26* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR27* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF28* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING29* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS30* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.31*/3233#ifndef VCHIQ_IOCTLS_H34#define VCHIQ_IOCTLS_H3536#include "vchiq_if.h"3738#define VCHIQ_IOC_MAGIC 0xc439#define VCHIQ_INVALID_HANDLE (~0)4041typedef struct {42VCHIQ_SERVICE_PARAMS_T params;43int is_open;44int is_vchi;45unsigned int handle; /* OUT */46} VCHIQ_CREATE_SERVICE_T;4748typedef struct {49unsigned int handle;50unsigned int count;51const VCHIQ_ELEMENT_T *elements;52} VCHIQ_QUEUE_MESSAGE_T;5354typedef struct {55unsigned int handle;56void *data;57unsigned int size;58void *userdata;59VCHIQ_BULK_MODE_T mode;60} VCHIQ_QUEUE_BULK_TRANSFER_T;6162typedef struct {63VCHIQ_REASON_T reason;64VCHIQ_HEADER_T *header;65void *service_userdata;66void *bulk_userdata;67} VCHIQ_COMPLETION_DATA_T;6869typedef struct {70unsigned int count;71VCHIQ_COMPLETION_DATA_T *buf;72unsigned int msgbufsize;73unsigned int msgbufcount; /* IN/OUT */74void **msgbufs;75} VCHIQ_AWAIT_COMPLETION_T;7677typedef struct {78unsigned int handle;79int blocking;80unsigned int bufsize;81void *buf;82} VCHIQ_DEQUEUE_MESSAGE_T;8384typedef struct {85unsigned int config_size;86VCHIQ_CONFIG_T *pconfig;87} VCHIQ_GET_CONFIG_T;8889typedef struct {90unsigned int handle;91VCHIQ_SERVICE_OPTION_T option;92int value;93} VCHIQ_SET_SERVICE_OPTION_T;9495typedef struct {96void *virt_addr;97size_t num_bytes;98} VCHIQ_DUMP_MEM_T;99100#define VCHIQ_IOC_CONNECT _IO(VCHIQ_IOC_MAGIC, 0)101#define VCHIQ_IOC_SHUTDOWN _IO(VCHIQ_IOC_MAGIC, 1)102#define VCHIQ_IOC_CREATE_SERVICE \103_IOWR(VCHIQ_IOC_MAGIC, 2, VCHIQ_CREATE_SERVICE_T)104#define VCHIQ_IOC_REMOVE_SERVICE _IO(VCHIQ_IOC_MAGIC, 3)105#define VCHIQ_IOC_QUEUE_MESSAGE \106_IOW(VCHIQ_IOC_MAGIC, 4, VCHIQ_QUEUE_MESSAGE_T)107#define VCHIQ_IOC_QUEUE_BULK_TRANSMIT \108_IOWR(VCHIQ_IOC_MAGIC, 5, VCHIQ_QUEUE_BULK_TRANSFER_T)109#define VCHIQ_IOC_QUEUE_BULK_RECEIVE \110_IOWR(VCHIQ_IOC_MAGIC, 6, VCHIQ_QUEUE_BULK_TRANSFER_T)111#define VCHIQ_IOC_AWAIT_COMPLETION \112_IOWR(VCHIQ_IOC_MAGIC, 7, VCHIQ_AWAIT_COMPLETION_T)113#define VCHIQ_IOC_DEQUEUE_MESSAGE \114_IOWR(VCHIQ_IOC_MAGIC, 8, VCHIQ_DEQUEUE_MESSAGE_T)115#define VCHIQ_IOC_GET_CLIENT_ID _IO(VCHIQ_IOC_MAGIC, 9)116#define VCHIQ_IOC_GET_CONFIG \117_IOWR(VCHIQ_IOC_MAGIC, 10, VCHIQ_GET_CONFIG_T)118#define VCHIQ_IOC_CLOSE_SERVICE _IO(VCHIQ_IOC_MAGIC, 11)119#define VCHIQ_IOC_USE_SERVICE _IO(VCHIQ_IOC_MAGIC, 12)120#define VCHIQ_IOC_RELEASE_SERVICE _IO(VCHIQ_IOC_MAGIC, 13)121#define VCHIQ_IOC_SET_SERVICE_OPTION \122_IOW(VCHIQ_IOC_MAGIC, 14, VCHIQ_SET_SERVICE_OPTION_T)123#define VCHIQ_IOC_DUMP_PHYS_MEM \124_IOW(VCHIQ_IOC_MAGIC, 15, VCHIQ_DUMP_MEM_T)125#define VCHIQ_IOC_LIB_VERSION _IO(VCHIQ_IOC_MAGIC, 16)126#define VCHIQ_IOC_CLOSE_DELIVERED _IO(VCHIQ_IOC_MAGIC, 17)127#define VCHIQ_IOC_MAX 17128129130/*131* COMPAT_FREEBSD32132*/133134typedef struct {135unsigned int config_size;136/*VCHIQ_CONFIG_T * */ uint32_t pconfig;137} VCHIQ_GET_CONFIG32_T;138139typedef struct {140unsigned int handle;141/*void * */ uint32_t data;142unsigned int size;143/*void * */ uint32_t userdata;144VCHIQ_BULK_MODE_T mode;145} VCHIQ_QUEUE_BULK_TRANSFER32_T;146147typedef struct {148unsigned int handle;149unsigned int count;150const /*VCHIQ_ELEMENT_T * */ uint32_t elements;151} VCHIQ_QUEUE_MESSAGE32_T;152153typedef struct {154unsigned int handle;155int blocking;156unsigned int bufsize;157/*void * */ uint32_t buf;158} VCHIQ_DEQUEUE_MESSAGE32_T;159160typedef struct {161/*void * */ uint32_t virt_addr;162/*size_t*/ uint32_t num_bytes;163} VCHIQ_DUMP_MEM32_T;164165typedef struct {166VCHIQ_REASON_T reason;167/* VCHIQ_HEADER_T * */ uint32_t header;168/* void * */ uint32_t service_userdata;169/* void * */ uint32_t bulk_userdata;170} VCHIQ_COMPLETION_DATA32_T;171172typedef struct {173unsigned int count;174/* VCHIQ_COMPLETION_DATA32_T * */ uint32_t buf;175unsigned int msgbufsize;176unsigned int msgbufcount; /* IN/OUT */177/* void ** */ uint32_t msgbufs;178} VCHIQ_AWAIT_COMPLETION32_T;179180typedef struct vchiq_service_params32_struct {181int fourcc;182/* VCHIQ_CALLBACK_T */ uint32_t callback;183/*void * */ uint32_t userdata;184short version; /* Increment for non-trivial changes */185short version_min; /* Update for incompatible changes */186} VCHIQ_SERVICE_PARAMS32_T;187188typedef struct {189VCHIQ_SERVICE_PARAMS32_T params;190int is_open;191int is_vchi;192unsigned int handle; /* OUT */193} VCHIQ_CREATE_SERVICE32_T;194195typedef struct {196const /*void */ uint32_t data;197unsigned int size;198} VCHIQ_ELEMENT32_T;199200201#define VCHIQ_IOC_GET_CONFIG32 \202_IOC_NEWTYPE( \203VCHIQ_IOC_GET_CONFIG, \204VCHIQ_GET_CONFIG32_T \205)206207#define VCHIQ_IOC_QUEUE_BULK_TRANSMIT32 \208_IOC_NEWTYPE( \209VCHIQ_IOC_QUEUE_BULK_TRANSMIT, \210VCHIQ_QUEUE_BULK_TRANSFER32_T \211)212213#define VCHIQ_IOC_QUEUE_BULK_RECEIVE32 \214_IOC_NEWTYPE( \215VCHIQ_IOC_QUEUE_BULK_RECEIVE, \216VCHIQ_QUEUE_BULK_TRANSFER32_T \217)218219#define VCHIQ_IOC_QUEUE_MESSAGE32 \220_IOC_NEWTYPE( \221VCHIQ_IOC_QUEUE_MESSAGE, \222VCHIQ_QUEUE_MESSAGE32_T \223)224225#define VCHIQ_IOC_DEQUEUE_MESSAGE32 \226_IOC_NEWTYPE( \227VCHIQ_IOC_DEQUEUE_MESSAGE, \228VCHIQ_DEQUEUE_MESSAGE32_T \229)230231#define VCHIQ_IOC_DUMP_PHYS_MEM32 \232_IOC_NEWTYPE( \233VCHIQ_IOC_DUMP_PHYS_MEM, \234VCHIQ_DUMP_MEM32_T \235)236237#define VCHIQ_IOC_AWAIT_COMPLETION32 \238_IOC_NEWTYPE( \239VCHIQ_IOC_AWAIT_COMPLETION, \240VCHIQ_AWAIT_COMPLETION32_T \241)242243#define VCHIQ_IOC_CREATE_SERVICE32 \244_IOC_NEWTYPE( \245VCHIQ_IOC_CREATE_SERVICE, \246VCHIQ_CREATE_SERVICE32_T \247)248249250#endif251252253