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