xrp_kernel_defs.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * XRP driver IOCTL codes and data structures
  3. *
  4. * Copyright (c) 2015 - 2017 Cadence Design Systems, Inc.
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining
  7. * a copy of this software and associated documentation files (the
  8. * "Software"), to deal in the Software without restriction, including
  9. * without limitation the rights to use, copy, modify, merge, publish,
  10. * distribute, sublicense, and/or sell copies of the Software, and to
  11. * permit persons to whom the Software is furnished to do so, subject to
  12. * the following conditions:
  13. *
  14. * The above copyright notice and this permission notice shall be included
  15. * in all copies or substantial portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  18. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  19. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  20. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  21. * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  22. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  23. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24. *
  25. * Alternatively you can use and distribute this file under the terms of
  26. * the GNU General Public License version 2 or later.
  27. */
  28. #ifndef _XRP_KERNEL_DEFS_H
  29. #define _XRP_KERNEL_DEFS_H
  30. #define XRP_IOCTL_MAGIC 'r'
  31. #define XRP_IOCTL_ALLOC _IO(XRP_IOCTL_MAGIC, 1)
  32. #define XRP_IOCTL_FREE _IO(XRP_IOCTL_MAGIC, 2)
  33. #define XRP_IOCTL_QUEUE _IO(XRP_IOCTL_MAGIC, 3)
  34. #define XRP_IOCTL_QUEUE_NS _IO(XRP_IOCTL_MAGIC, 4)
  35. #define XRP_IOCTL_REPORT_CREATE _IO(XRP_IOCTL_MAGIC, 5)
  36. #define XRP_IOCTL_REPORT_RELEASE _IO(XRP_IOCTL_MAGIC, 6)
  37. #define XRP_IOCTL_DMABUF_IMPORT _IO(XRP_IOCTL_MAGIC, 7)
  38. #define XRP_IOCTL_DMABUF_EXPORT _IO(XRP_IOCTL_MAGIC, 8)
  39. #define XRP_IOCTL_DMABUF_RELEASE _IO(XRP_IOCTL_MAGIC, 9)
  40. #define XRP_IOCTL_DMABUF_SYNC _IO(XRP_IOCTL_MAGIC, 10)
  41. struct xrp_ioctl_alloc {
  42. __u32 size;
  43. __u32 align;
  44. __u64 addr;
  45. __u64 paddr;
  46. };
  47. enum {
  48. XRP_FLAG_READ = 0x1,
  49. XRP_FLAG_WRITE = 0x2,
  50. XRP_FLAG_READ_WRITE = 0x3,
  51. };
  52. struct xrp_ioctl_buffer {
  53. __u32 flags;
  54. __u32 size;
  55. __u64 addr;
  56. };
  57. enum {
  58. XRP_QUEUE_FLAG_NSID = 0x4,
  59. XRP_QUEUE_FLAG_PRIO = 0xff00,
  60. XRP_QUEUE_FLAG_PRIO_SHIFT = 8,
  61. XRP_QUEUE_VALID_FLAGS =
  62. XRP_QUEUE_FLAG_NSID |
  63. XRP_QUEUE_FLAG_PRIO,
  64. };
  65. struct xrp_ioctl_queue {
  66. __u32 flags;
  67. __u32 in_data_size;
  68. __u32 out_data_size;
  69. __u32 buffer_size;
  70. __u64 in_data_addr;
  71. __u64 out_data_addr;
  72. __u64 buffer_addr;
  73. __u64 nsid_addr;
  74. };
  75. struct xrp_report_buffer
  76. {
  77. __u32 report_id;
  78. __u32 data[1];
  79. };
  80. struct xrp_dma_buf{
  81. int fd;
  82. __u32 flags;
  83. __u32 size;
  84. __u64 addr;
  85. __u64 paddr;
  86. } ;
  87. // struct xrp_ioctl_report {
  88. // __u32 size;
  89. // struct xrp_report_buffer *addr;
  90. // };
  91. #endif