ioctl.h 1.9 KB

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