1 /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ 2 #ifndef UAPI_UFS_IOCTL_H_ 3 #define UAPI_UFS_IOCTL_H_ 4 5 #include <linux/types.h> 6 7 /* 8 * IOCTL opcode for ufs queries has the following opcode after 9 * SCSI_IOCTL_GET_PCI 10 */ 11 #define UFS_IOCTL_QUERY 0x5388 12 13 /** 14 * struct ufs_ioctl_query_data - used to transfer data to and from user via 15 * ioctl 16 * @opcode: type of data to query (descriptor/attribute/flag) 17 * @idn: id of the data structure 18 * @buf_size: number of allocated bytes/data size on return 19 * @buffer: data location 20 * 21 * Received: buffer and buf_size (available space for transferred data) 22 * Submitted: opcode, idn, length, buf_size 23 */ 24 struct ufs_ioctl_query_data { 25 /* 26 * User should select one of the opcode defined in "enum query_opcode". 27 * Please check include/uapi/scsi/ufs/ufs.h for the definition of it. 28 * Note that only UPIU_QUERY_OPCODE_READ_DESC, 29 * UPIU_QUERY_OPCODE_READ_ATTR & UPIU_QUERY_OPCODE_READ_FLAG are 30 * supported as of now. All other query_opcode would be considered 31 * invalid. 32 * As of now only read query operations are supported. 33 */ 34 __u32 opcode; 35 /* 36 * User should select one of the idn from "enum flag_idn" or "enum 37 * attr_idn" or "enum desc_idn" based on whether opcode above is 38 * attribute, flag or descriptor. 39 * Please check include/uapi/scsi/ufs/ufs.h for the definition of it. 40 */ 41 __u8 idn; 42 /* 43 * User should specify the size of the buffer (buffer[0] below) where 44 * it wants to read the query data (attribute/flag/descriptor). 45 * As we might end up reading less data then what is specified in 46 * buf_size. So we are updating buf_size to what exactly we have read. 47 */ 48 __u16 buf_size; 49 /* 50 * placeholder for the start of the data buffer where kernel will copy 51 * the query data (attribute/flag/descriptor) read from the UFS device 52 * Note: 53 * For Read/Write Attribute you will have to allocate 4 bytes 54 * For Read/Write Flag you will have to allocate 1 byte 55 */ 56 __u8 buffer[0]; 57 }; 58 59 #endif /* UAPI_UFS_IOCTL_H_ */ 60