cxl.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * Copyright 2014 IBM Corp.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version
  7. * 2 of the License, or (at your option) any later version.
  8. */
  9. #ifndef _UAPI_MISC_CXL_H
  10. #define _UAPI_MISC_CXL_H
  11. #include <linux/types.h>
  12. #include <linux/ioctl.h>
  13. struct cxl_ioctl_start_work {
  14. __u64 flags;
  15. __u64 work_element_descriptor;
  16. __u64 amr;
  17. __s16 num_interrupts;
  18. __s16 reserved1;
  19. __s32 reserved2;
  20. __u64 reserved3;
  21. __u64 reserved4;
  22. __u64 reserved5;
  23. __u64 reserved6;
  24. };
  25. #define CXL_START_WORK_AMR 0x0000000000000001ULL
  26. #define CXL_START_WORK_NUM_IRQS 0x0000000000000002ULL
  27. #define CXL_START_WORK_ALL (CXL_START_WORK_AMR |\
  28. CXL_START_WORK_NUM_IRQS)
  29. /* ioctl numbers */
  30. #define CXL_MAGIC 0xCA
  31. #define CXL_IOCTL_START_WORK _IOW(CXL_MAGIC, 0x00, struct cxl_ioctl_start_work)
  32. #define CXL_IOCTL_GET_PROCESS_ELEMENT _IOR(CXL_MAGIC, 0x01, __u32)
  33. #define CXL_READ_MIN_SIZE 0x1000 /* 4K */
  34. /* Events from read() */
  35. enum cxl_event_type {
  36. CXL_EVENT_RESERVED = 0,
  37. CXL_EVENT_AFU_INTERRUPT = 1,
  38. CXL_EVENT_DATA_STORAGE = 2,
  39. CXL_EVENT_AFU_ERROR = 3,
  40. };
  41. struct cxl_event_header {
  42. __u16 type;
  43. __u16 size;
  44. __u16 process_element;
  45. __u16 reserved1;
  46. };
  47. struct cxl_event_afu_interrupt {
  48. __u16 flags;
  49. __u16 irq; /* Raised AFU interrupt number */
  50. __u32 reserved1;
  51. };
  52. struct cxl_event_data_storage {
  53. __u16 flags;
  54. __u16 reserved1;
  55. __u32 reserved2;
  56. __u64 addr;
  57. __u64 dsisr;
  58. __u64 reserved3;
  59. };
  60. struct cxl_event_afu_error {
  61. __u16 flags;
  62. __u16 reserved1;
  63. __u32 reserved2;
  64. __u64 error;
  65. };
  66. struct cxl_event {
  67. struct cxl_event_header header;
  68. union {
  69. struct cxl_event_afu_interrupt irq;
  70. struct cxl_event_data_storage fault;
  71. struct cxl_event_afu_error afu_error;
  72. };
  73. };
  74. #endif /* _UAPI_MISC_CXL_H */