eadm.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. #ifndef _ASM_S390_EADM_H
  2. #define _ASM_S390_EADM_H
  3. #include <linux/types.h>
  4. #include <linux/device.h>
  5. struct arqb {
  6. u64 data;
  7. u16 fmt:4;
  8. u16:12;
  9. u16 cmd_code;
  10. u16:16;
  11. u16 msb_count;
  12. u32 reserved[12];
  13. } __packed;
  14. #define ARQB_CMD_MOVE 1
  15. struct arsb {
  16. u16 fmt:4;
  17. u32:28;
  18. u8 ef;
  19. u8:8;
  20. u8 ecbi;
  21. u8:8;
  22. u8 fvf;
  23. u16:16;
  24. u8 eqc;
  25. u32:32;
  26. u64 fail_msb;
  27. u64 fail_aidaw;
  28. u64 fail_ms;
  29. u64 fail_scm;
  30. u32 reserved[4];
  31. } __packed;
  32. #define EQC_WR_PROHIBIT 22
  33. struct msb {
  34. u8 fmt:4;
  35. u8 oc:4;
  36. u8 flags;
  37. u16:12;
  38. u16 bs:4;
  39. u32 blk_count;
  40. u64 data_addr;
  41. u64 scm_addr;
  42. u64:64;
  43. } __packed;
  44. struct aidaw {
  45. u8 flags;
  46. u32 :24;
  47. u32 :32;
  48. u64 data_addr;
  49. } __packed;
  50. #define MSB_OC_CLEAR 0
  51. #define MSB_OC_READ 1
  52. #define MSB_OC_WRITE 2
  53. #define MSB_OC_RELEASE 3
  54. #define MSB_FLAG_BNM 0x80
  55. #define MSB_FLAG_IDA 0x40
  56. #define MSB_BS_4K 0
  57. #define MSB_BS_1M 1
  58. #define AOB_NR_MSB 124
  59. struct aob {
  60. struct arqb request;
  61. struct arsb response;
  62. struct msb msb[AOB_NR_MSB];
  63. } __packed __aligned(PAGE_SIZE);
  64. struct aob_rq_header {
  65. struct scm_device *scmdev;
  66. char data[0];
  67. };
  68. struct scm_device {
  69. u64 address;
  70. u64 size;
  71. unsigned int nr_max_block;
  72. struct device dev;
  73. struct {
  74. unsigned int persistence:4;
  75. unsigned int oper_state:4;
  76. unsigned int data_state:4;
  77. unsigned int rank:4;
  78. unsigned int release:1;
  79. unsigned int res_id:8;
  80. } __packed attrs;
  81. };
  82. #define OP_STATE_GOOD 1
  83. #define OP_STATE_TEMP_ERR 2
  84. #define OP_STATE_PERM_ERR 3
  85. enum scm_event {SCM_CHANGE, SCM_AVAIL};
  86. struct scm_driver {
  87. struct device_driver drv;
  88. int (*probe) (struct scm_device *scmdev);
  89. int (*remove) (struct scm_device *scmdev);
  90. void (*notify) (struct scm_device *scmdev, enum scm_event event);
  91. void (*handler) (struct scm_device *scmdev, void *data, int error);
  92. };
  93. int scm_driver_register(struct scm_driver *scmdrv);
  94. void scm_driver_unregister(struct scm_driver *scmdrv);
  95. int eadm_start_aob(struct aob *aob);
  96. void scm_irq_handler(struct aob *aob, int error);
  97. #endif /* _ASM_S390_EADM_H */