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