dma-buf-test-exporter.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. *
  3. * (C) COPYRIGHT ARM Limited. All rights reserved.
  4. *
  5. * This program is free software and is provided to you under the terms of the
  6. * GNU General Public License version 2 as published by the Free Software
  7. * Foundation, and any use by you of this program is subject to the terms
  8. * of such GNU licence.
  9. *
  10. * A copy of the licence is included with the program, and can also be obtained
  11. * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  12. * Boston, MA 02110-1301, USA.
  13. *
  14. */
  15. #ifndef _LINUX_DMA_BUF_TEST_EXPORTER_H_
  16. #define _LINUX_DMA_BUF_TEST_EXPORTER_H_
  17. #include <linux/types.h>
  18. #include <asm/ioctl.h>
  19. #define DMA_BUF_TE_VER_MAJOR 1
  20. #define DMA_BUF_TE_VER_MINOR 0
  21. #define DMA_BUF_TE_ENQ 0x642d7465
  22. #define DMA_BUF_TE_ACK 0x68692100
  23. struct dma_buf_te_ioctl_version
  24. {
  25. int op; /**< Must be set to DMA_BUF_TE_ENQ by client, driver will set it to DMA_BUF_TE_ACK */
  26. int major; /**< Major version */
  27. int minor; /**< Minor version */
  28. };
  29. struct dma_buf_te_ioctl_alloc
  30. {
  31. __u64 size; /* size of buffer to allocate, in pages */
  32. };
  33. struct dma_buf_te_ioctl_status
  34. {
  35. /* in */
  36. int fd; /* the dma_buf to query, only dma_buf objects exported by this driver is supported */
  37. /* out */
  38. int attached_devices; /* number of devices attached (active 'dma_buf_attach's) */
  39. int device_mappings; /* number of device mappings (active 'dma_buf_map_attachment's) */
  40. int cpu_mappings; /* number of cpu mappings (active 'mmap's) */
  41. };
  42. struct dma_buf_te_ioctl_set_failing
  43. {
  44. /* in */
  45. int fd; /* the dma_buf to set failure mode for, only dma_buf objects exported by this driver is supported */
  46. /* zero = no fail injection, non-zero = inject failure */
  47. int fail_attach;
  48. int fail_map;
  49. int fail_mmap;
  50. };
  51. struct dma_buf_te_ioctl_fill
  52. {
  53. int fd;
  54. unsigned int value;
  55. };
  56. #define DMA_BUF_TE_IOCTL_BASE 'E'
  57. /* Below all returning 0 if successful or -errcode except DMA_BUF_TE_ALLOC which will return fd or -errcode */
  58. #define DMA_BUF_TE_VERSION _IOR(DMA_BUF_TE_IOCTL_BASE, 0x00, struct dma_buf_te_ioctl_version)
  59. #define DMA_BUF_TE_ALLOC _IOR(DMA_BUF_TE_IOCTL_BASE, 0x01, struct dma_buf_te_ioctl_alloc)
  60. #define DMA_BUF_TE_QUERY _IOR(DMA_BUF_TE_IOCTL_BASE, 0x02, struct dma_buf_te_ioctl_status)
  61. #define DMA_BUF_TE_SET_FAILING _IOW(DMA_BUF_TE_IOCTL_BASE, 0x03, struct dma_buf_te_ioctl_set_failing)
  62. #define DMA_BUF_TE_ALLOC_CONT _IOR(DMA_BUF_TE_IOCTL_BASE, 0x04, struct dma_buf_te_ioctl_alloc)
  63. #define DMA_BUF_TE_FILL _IOR(DMA_BUF_TE_IOCTL_BASE, 0x05, struct dma_buf_te_ioctl_fill)
  64. #endif /* _LINUX_DMA_BUF_TEST_EXPORTER_H_ */