1bf215546Sopenharmony_ci/* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */ 2bf215546Sopenharmony_ci/* 3bf215546Sopenharmony_ci * Copyright (C) 2012 Google, Inc. 4bf215546Sopenharmony_ci * 5bf215546Sopenharmony_ci * This program is distributed in the hope that it will be useful, 6bf215546Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 7bf215546Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 8bf215546Sopenharmony_ci * GNU General Public License for more details. 9bf215546Sopenharmony_ci * 10bf215546Sopenharmony_ci */ 11bf215546Sopenharmony_ci 12bf215546Sopenharmony_ci#ifndef _UAPI_LINUX_SYNC_H 13bf215546Sopenharmony_ci#define _UAPI_LINUX_SYNC_H 14bf215546Sopenharmony_ci 15bf215546Sopenharmony_ci#if defined(__linux__) 16bf215546Sopenharmony_ci 17bf215546Sopenharmony_ci#include <linux/ioctl.h> 18bf215546Sopenharmony_ci#include <linux/types.h> 19bf215546Sopenharmony_ci 20bf215546Sopenharmony_ci#else /* One of the BSDs */ 21bf215546Sopenharmony_ci 22bf215546Sopenharmony_ci#include <sys/types.h> 23bf215546Sopenharmony_ci#include <sys/ioccom.h> 24bf215546Sopenharmony_ci 25bf215546Sopenharmony_citypedef int8_t __s8; 26bf215546Sopenharmony_citypedef uint8_t __u8; 27bf215546Sopenharmony_citypedef int16_t __s16; 28bf215546Sopenharmony_citypedef uint16_t __u16; 29bf215546Sopenharmony_citypedef int32_t __s32; 30bf215546Sopenharmony_citypedef uint32_t __u32; 31bf215546Sopenharmony_citypedef int64_t __s64; 32bf215546Sopenharmony_citypedef uint64_t __u64; 33bf215546Sopenharmony_ci 34bf215546Sopenharmony_ci#endif 35bf215546Sopenharmony_ci 36bf215546Sopenharmony_ci/** 37bf215546Sopenharmony_ci * struct sync_merge_data - data passed to merge ioctl 38bf215546Sopenharmony_ci * @name: name of new fence 39bf215546Sopenharmony_ci * @fd2: file descriptor of second fence 40bf215546Sopenharmony_ci * @fence: returns the fd of the new fence to userspace 41bf215546Sopenharmony_ci * @flags: merge_data flags 42bf215546Sopenharmony_ci * @pad: padding for 64-bit alignment, should always be zero 43bf215546Sopenharmony_ci */ 44bf215546Sopenharmony_cistruct sync_merge_data { 45bf215546Sopenharmony_ci char name[32]; 46bf215546Sopenharmony_ci __s32 fd2; 47bf215546Sopenharmony_ci __s32 fence; 48bf215546Sopenharmony_ci __u32 flags; 49bf215546Sopenharmony_ci __u32 pad; 50bf215546Sopenharmony_ci}; 51bf215546Sopenharmony_ci 52bf215546Sopenharmony_ci/** 53bf215546Sopenharmony_ci * struct sync_fence_info - detailed fence information 54bf215546Sopenharmony_ci * @obj_name: name of parent sync_timeline 55bf215546Sopenharmony_ci* @driver_name: name of driver implementing the parent 56bf215546Sopenharmony_ci* @status: status of the fence 0:active 1:signaled <0:error 57bf215546Sopenharmony_ci * @flags: fence_info flags 58bf215546Sopenharmony_ci * @timestamp_ns: timestamp of status change in nanoseconds 59bf215546Sopenharmony_ci */ 60bf215546Sopenharmony_cistruct sync_fence_info { 61bf215546Sopenharmony_ci char obj_name[32]; 62bf215546Sopenharmony_ci char driver_name[32]; 63bf215546Sopenharmony_ci __s32 status; 64bf215546Sopenharmony_ci __u32 flags; 65bf215546Sopenharmony_ci __u64 timestamp_ns; 66bf215546Sopenharmony_ci}; 67bf215546Sopenharmony_ci 68bf215546Sopenharmony_ci/** 69bf215546Sopenharmony_ci * struct sync_file_info - data returned from fence info ioctl 70bf215546Sopenharmony_ci * @name: name of fence 71bf215546Sopenharmony_ci * @status: status of fence. 1: signaled 0:active <0:error 72bf215546Sopenharmony_ci * @flags: sync_file_info flags 73bf215546Sopenharmony_ci * @num_fences number of fences in the sync_file 74bf215546Sopenharmony_ci * @pad: padding for 64-bit alignment, should always be zero 75bf215546Sopenharmony_ci * @sync_fence_info: pointer to array of structs sync_fence_info with all 76bf215546Sopenharmony_ci * fences in the sync_file 77bf215546Sopenharmony_ci */ 78bf215546Sopenharmony_cistruct sync_file_info { 79bf215546Sopenharmony_ci char name[32]; 80bf215546Sopenharmony_ci __s32 status; 81bf215546Sopenharmony_ci __u32 flags; 82bf215546Sopenharmony_ci __u32 num_fences; 83bf215546Sopenharmony_ci __u32 pad; 84bf215546Sopenharmony_ci 85bf215546Sopenharmony_ci __u64 sync_fence_info; 86bf215546Sopenharmony_ci}; 87bf215546Sopenharmony_ci 88bf215546Sopenharmony_ci#define SYNC_IOC_MAGIC '>' 89bf215546Sopenharmony_ci 90bf215546Sopenharmony_ci/** 91bf215546Sopenharmony_ci * Opcodes 0, 1 and 2 were burned during a API change to avoid users of the 92bf215546Sopenharmony_ci * old API to get weird errors when trying to handling sync_files. The API 93bf215546Sopenharmony_ci * change happened during the de-stage of the Sync Framework when there was 94bf215546Sopenharmony_ci * no upstream users available. 95bf215546Sopenharmony_ci */ 96bf215546Sopenharmony_ci 97bf215546Sopenharmony_ci/** 98bf215546Sopenharmony_ci * DOC: SYNC_IOC_MERGE - merge two fences 99bf215546Sopenharmony_ci * 100bf215546Sopenharmony_ci * Takes a struct sync_merge_data. Creates a new fence containing copies of 101bf215546Sopenharmony_ci * the sync_pts in both the calling fd and sync_merge_data.fd2. Returns the 102bf215546Sopenharmony_ci * new fence's fd in sync_merge_data.fence 103bf215546Sopenharmony_ci */ 104bf215546Sopenharmony_ci#define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data) 105bf215546Sopenharmony_ci 106bf215546Sopenharmony_ci/** 107bf215546Sopenharmony_ci * DOC: SYNC_IOC_FILE_INFO - get detailed information on a sync_file 108bf215546Sopenharmony_ci * 109bf215546Sopenharmony_ci * Takes a struct sync_file_info. If num_fences is 0, the field is updated 110bf215546Sopenharmony_ci * with the actual number of fences. If num_fences is > 0, the system will 111bf215546Sopenharmony_ci * use the pointer provided on sync_fence_info to return up to num_fences of 112bf215546Sopenharmony_ci * struct sync_fence_info, with detailed fence information. 113bf215546Sopenharmony_ci */ 114bf215546Sopenharmony_ci#define SYNC_IOC_FILE_INFO _IOWR(SYNC_IOC_MAGIC, 4, struct sync_file_info) 115bf215546Sopenharmony_ci 116bf215546Sopenharmony_ci#endif /* _UAPI_LINUX_SYNC_H */ 117