Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef S390_CHSC_H |
| 2 | #define S390_CHSC_H |
| 3 | |
Peter Oberparleiter | f86635f | 2007-04-27 16:01:26 +0200 | [diff] [blame] | 4 | #include <linux/types.h> |
| 5 | #include <linux/device.h> |
Sebastian Ott | 382b736 | 2012-08-28 16:43:36 +0200 | [diff] [blame] | 6 | #include <asm/css_chars.h> |
Peter Oberparleiter | e5854a5 | 2007-04-27 16:01:31 +0200 | [diff] [blame] | 7 | #include <asm/chpid.h> |
Cornelia Huck | 9d92a7e | 2008-07-14 09:59:05 +0200 | [diff] [blame] | 8 | #include <asm/chsc.h> |
| 9 | #include <asm/schid.h> |
Sebastian Ott | da5b6cb | 2013-06-05 18:58:35 +0200 | [diff] [blame] | 10 | #include <asm/qdio.h> |
Peter Oberparleiter | f86635f | 2007-04-27 16:01:26 +0200 | [diff] [blame] | 11 | |
Cornelia Huck | fb6958a | 2006-01-06 00:19:25 -0800 | [diff] [blame] | 12 | #define CHSC_SDA_OC_MSS 0x2 |
| 13 | |
Cornelia Huck | 495a5b4 | 2006-03-24 03:15:14 -0800 | [diff] [blame] | 14 | #define NR_MEASUREMENT_CHARS 5 |
| 15 | struct cmg_chars { |
| 16 | u32 values[NR_MEASUREMENT_CHARS]; |
Peter Oberparleiter | 0f008aa | 2007-02-05 21:17:40 +0100 | [diff] [blame] | 17 | } __attribute__ ((packed)); |
Cornelia Huck | 495a5b4 | 2006-03-24 03:15:14 -0800 | [diff] [blame] | 18 | |
| 19 | #define NR_MEASUREMENT_ENTRIES 8 |
| 20 | struct cmg_entry { |
| 21 | u32 values[NR_MEASUREMENT_ENTRIES]; |
Peter Oberparleiter | 0f008aa | 2007-02-05 21:17:40 +0100 | [diff] [blame] | 22 | } __attribute__ ((packed)); |
Cornelia Huck | 495a5b4 | 2006-03-24 03:15:14 -0800 | [diff] [blame] | 23 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | struct channel_path_desc { |
| 25 | u8 flags; |
| 26 | u8 lsn; |
| 27 | u8 desc; |
| 28 | u8 chpid; |
| 29 | u8 swla; |
| 30 | u8 zeroes; |
| 31 | u8 chla; |
| 32 | u8 chpp; |
Peter Oberparleiter | 0f008aa | 2007-02-05 21:17:40 +0100 | [diff] [blame] | 33 | } __attribute__ ((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
Sebastian Ott | ce322cc | 2011-01-05 12:47:56 +0100 | [diff] [blame] | 35 | struct channel_path_desc_fmt1 { |
| 36 | u8 flags; |
| 37 | u8 lsn; |
| 38 | u8 desc; |
| 39 | u8 chpid; |
| 40 | u32:24; |
| 41 | u8 chpp; |
Peter Oberparleiter | ba54229 | 2013-05-15 13:43:29 +0200 | [diff] [blame] | 42 | u32 unused[2]; |
| 43 | u16 chid; |
| 44 | u32:16; |
Sebastian Ott | ce322cc | 2011-01-05 12:47:56 +0100 | [diff] [blame] | 45 | u16 mdc; |
| 46 | u16:13; |
| 47 | u8 r:1; |
| 48 | u8 s:1; |
| 49 | u8 f:1; |
| 50 | u32 zeros[2]; |
| 51 | } __attribute__ ((packed)); |
| 52 | |
Peter Oberparleiter | e6b6e10 | 2007-04-27 16:01:28 +0200 | [diff] [blame] | 53 | struct channel_path; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | struct css_chsc_char { |
| 56 | u64 res; |
Cornelia Huck | 495a5b4 | 2006-03-24 03:15:14 -0800 | [diff] [blame] | 57 | u64 : 20; |
| 58 | u32 secm : 1; /* bit 84 */ |
| 59 | u32 : 1; |
| 60 | u32 scmc : 1; /* bit 86 */ |
| 61 | u32 : 20; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | u32 scssc : 1; /* bit 107 */ |
| 63 | u32 scsscf : 1; /* bit 108 */ |
| 64 | u32 : 19; |
| 65 | }__attribute__((packed)); |
| 66 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | extern struct css_chsc_char css_chsc_characteristics; |
| 68 | |
Peter Oberparleiter | 7ad6a24 | 2007-04-27 16:01:35 +0200 | [diff] [blame] | 69 | struct chsc_ssd_info { |
| 70 | u8 path_mask; |
| 71 | u8 fla_valid_mask; |
| 72 | struct chp_id chpid[8]; |
| 73 | u16 fla[8]; |
| 74 | }; |
Sebastian Ott | 906c976 | 2010-10-25 16:10:30 +0200 | [diff] [blame] | 75 | |
Sebastian Ott | da5b6cb | 2013-06-05 18:58:35 +0200 | [diff] [blame] | 76 | struct chsc_ssqd_area { |
| 77 | struct chsc_header request; |
| 78 | u16:10; |
| 79 | u8 ssid:2; |
| 80 | u8 fmt:4; |
| 81 | u16 first_sch; |
| 82 | u16:16; |
| 83 | u16 last_sch; |
| 84 | u32:32; |
| 85 | struct chsc_header response; |
| 86 | u32:32; |
| 87 | struct qdio_ssqd_desc qdio_ssqd; |
| 88 | } __packed; |
| 89 | |
Sebastian Ott | ca4ba15 | 2013-06-05 18:59:22 +0200 | [diff] [blame] | 90 | struct chsc_scssc_area { |
| 91 | struct chsc_header request; |
| 92 | u16 operation_code; |
| 93 | u16:16; |
| 94 | u32:32; |
| 95 | u32:32; |
| 96 | u64 summary_indicator_addr; |
| 97 | u64 subchannel_indicator_addr; |
| 98 | u32 ks:4; |
| 99 | u32 kc:4; |
| 100 | u32:21; |
| 101 | u32 isc:3; |
| 102 | u32 word_with_d_bit; |
| 103 | u32:32; |
| 104 | struct subchannel_id schid; |
| 105 | u32 reserved[1004]; |
| 106 | struct chsc_header response; |
| 107 | u32:32; |
| 108 | } __packed; |
| 109 | |
Sebastian Ott | 906c976 | 2010-10-25 16:10:30 +0200 | [diff] [blame] | 110 | struct chsc_scpd { |
| 111 | struct chsc_header request; |
| 112 | u32:2; |
| 113 | u32 m:1; |
| 114 | u32 c:1; |
| 115 | u32 fmt:4; |
| 116 | u32 cssid:8; |
| 117 | u32:4; |
| 118 | u32 rfmt:4; |
| 119 | u32 first_chpid:8; |
| 120 | u32:24; |
| 121 | u32 last_chpid:8; |
| 122 | u32 zeroes1; |
| 123 | struct chsc_header response; |
| 124 | u8 data[PAGE_SIZE - 20]; |
| 125 | } __attribute__ ((packed)); |
| 126 | |
| 127 | |
Peter Oberparleiter | 7ad6a24 | 2007-04-27 16:01:35 +0200 | [diff] [blame] | 128 | extern int chsc_get_ssd_info(struct subchannel_id schid, |
| 129 | struct chsc_ssd_info *ssd); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | extern int chsc_determine_css_characteristics(void); |
Sebastian Ott | 34aec07 | 2010-10-25 16:10:28 +0200 | [diff] [blame] | 131 | extern int chsc_init(void); |
| 132 | extern void chsc_init_cleanup(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 133 | |
Cornelia Huck | fb6958a | 2006-01-06 00:19:25 -0800 | [diff] [blame] | 134 | extern int chsc_enable_facility(int); |
Cornelia Huck | 495a5b4 | 2006-03-24 03:15:14 -0800 | [diff] [blame] | 135 | struct channel_subsystem; |
| 136 | extern int chsc_secm(struct channel_subsystem *, int); |
Sebastian Ott | 34196f8 | 2010-10-25 16:10:29 +0200 | [diff] [blame] | 137 | int __chsc_do_secm(struct channel_subsystem *css, int enable); |
Cornelia Huck | fb6958a | 2006-01-06 00:19:25 -0800 | [diff] [blame] | 138 | |
Peter Oberparleiter | e6b6e10 | 2007-04-27 16:01:28 +0200 | [diff] [blame] | 139 | int chsc_chp_vary(struct chp_id chpid, int on); |
Cornelia Huck | 9d92a7e | 2008-07-14 09:59:05 +0200 | [diff] [blame] | 140 | int chsc_determine_channel_path_desc(struct chp_id chpid, int fmt, int rfmt, |
Sebastian Ott | 906c976 | 2010-10-25 16:10:30 +0200 | [diff] [blame] | 141 | int c, int m, void *page); |
Cornelia Huck | 9d92a7e | 2008-07-14 09:59:05 +0200 | [diff] [blame] | 142 | int chsc_determine_base_channel_path_desc(struct chp_id chpid, |
| 143 | struct channel_path_desc *desc); |
Sebastian Ott | ce322cc | 2011-01-05 12:47:56 +0100 | [diff] [blame] | 144 | int chsc_determine_fmt1_channel_path_desc(struct chp_id chpid, |
| 145 | struct channel_path_desc_fmt1 *desc); |
Peter Oberparleiter | 83b3370 | 2007-04-27 16:01:34 +0200 | [diff] [blame] | 146 | void chsc_chp_online(struct chp_id chpid); |
Peter Oberparleiter | e6b6e10 | 2007-04-27 16:01:28 +0200 | [diff] [blame] | 147 | void chsc_chp_offline(struct chp_id chpid); |
| 148 | int chsc_get_channel_measurement_chars(struct channel_path *chp); |
Sebastian Ott | da5b6cb | 2013-06-05 18:58:35 +0200 | [diff] [blame] | 149 | int chsc_ssqd(struct subchannel_id schid, struct chsc_ssqd_area *ssqd); |
Sebastian Ott | ca4ba15 | 2013-06-05 18:59:22 +0200 | [diff] [blame] | 150 | int chsc_sadc(struct subchannel_id schid, struct chsc_scssc_area *scssc, |
| 151 | u64 summary_indicator_addr, u64 subchannel_indicator_addr); |
Cornelia Huck | dae3984 | 2008-07-17 17:16:47 +0200 | [diff] [blame] | 152 | int chsc_error_from_response(int response); |
| 153 | |
Michael Ernst | fd0457a | 2010-08-09 18:12:50 +0200 | [diff] [blame] | 154 | int chsc_siosl(struct subchannel_id schid); |
| 155 | |
Sebastian Ott | 184b08a | 2012-08-28 16:45:42 +0200 | [diff] [blame] | 156 | /* Functions and definitions to query storage-class memory. */ |
| 157 | struct sale { |
| 158 | u64 sa; |
| 159 | u32 p:4; |
| 160 | u32 op_state:4; |
| 161 | u32 data_state:4; |
| 162 | u32 rank:4; |
| 163 | u32 r:1; |
| 164 | u32:7; |
| 165 | u32 rid:8; |
| 166 | u32:32; |
| 167 | } __packed; |
| 168 | |
| 169 | struct chsc_scm_info { |
| 170 | struct chsc_header request; |
| 171 | u32:32; |
| 172 | u64 reqtok; |
| 173 | u32 reserved1[4]; |
| 174 | struct chsc_header response; |
| 175 | u64:56; |
| 176 | u8 rq; |
| 177 | u32 mbc; |
| 178 | u64 msa; |
| 179 | u16 is; |
| 180 | u16 mmc; |
| 181 | u32 mci; |
| 182 | u64 nr_scm_ini; |
| 183 | u64 nr_scm_unini; |
| 184 | u32 reserved2[10]; |
| 185 | u64 restok; |
| 186 | struct sale scmal[248]; |
| 187 | } __packed; |
| 188 | |
| 189 | int chsc_scm_info(struct chsc_scm_info *scm_area, u64 token); |
| 190 | |
Sebastian Ott | 40ff4cc | 2012-08-28 16:47:02 +0200 | [diff] [blame] | 191 | #ifdef CONFIG_SCM_BUS |
| 192 | int scm_update_information(void); |
Sebastian Ott | aebfa66 | 2013-02-28 12:07:55 +0100 | [diff] [blame] | 193 | int scm_process_availability_information(void); |
Sebastian Ott | 40ff4cc | 2012-08-28 16:47:02 +0200 | [diff] [blame] | 194 | #else /* CONFIG_SCM_BUS */ |
Sebastian Ott | 58fece7 | 2013-01-28 19:34:26 +0100 | [diff] [blame] | 195 | static inline int scm_update_information(void) { return 0; } |
Sebastian Ott | aebfa66 | 2013-02-28 12:07:55 +0100 | [diff] [blame] | 196 | static inline int scm_process_availability_information(void) { return 0; } |
Sebastian Ott | 40ff4cc | 2012-08-28 16:47:02 +0200 | [diff] [blame] | 197 | #endif /* CONFIG_SCM_BUS */ |
| 198 | |
| 199 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 200 | #endif |