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