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 | |
Sebastian Ott | ce322cc | 2011-01-05 12:47:56 +0100 | [diff] [blame] | 24 | struct channel_path_desc_fmt1 { |
| 25 | u8 flags; |
| 26 | u8 lsn; |
| 27 | u8 desc; |
| 28 | u8 chpid; |
| 29 | u32:24; |
| 30 | u8 chpp; |
Peter Oberparleiter | ba54229 | 2013-05-15 13:43:29 +0200 | [diff] [blame] | 31 | u32 unused[2]; |
| 32 | u16 chid; |
| 33 | u32:16; |
Sebastian Ott | ce322cc | 2011-01-05 12:47:56 +0100 | [diff] [blame] | 34 | u16 mdc; |
| 35 | u16:13; |
| 36 | u8 r:1; |
| 37 | u8 s:1; |
| 38 | u8 f:1; |
| 39 | u32 zeros[2]; |
| 40 | } __attribute__ ((packed)); |
| 41 | |
Peter Oberparleiter | e6b6e10 | 2007-04-27 16:01:28 +0200 | [diff] [blame] | 42 | struct channel_path; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | struct css_chsc_char { |
| 45 | u64 res; |
Cornelia Huck | 495a5b4 | 2006-03-24 03:15:14 -0800 | [diff] [blame] | 46 | u64 : 20; |
| 47 | u32 secm : 1; /* bit 84 */ |
| 48 | u32 : 1; |
| 49 | u32 scmc : 1; /* bit 86 */ |
| 50 | u32 : 20; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | u32 scssc : 1; /* bit 107 */ |
| 52 | u32 scsscf : 1; /* bit 108 */ |
Eugene Crosser | 1c59a86 | 2013-04-24 12:00:23 +0200 | [diff] [blame] | 53 | u32:7; |
| 54 | u32 pnso:1; /* bit 116 */ |
| 55 | u32:11; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | }__attribute__((packed)); |
| 57 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | extern struct css_chsc_char css_chsc_characteristics; |
| 59 | |
Peter Oberparleiter | 7ad6a24 | 2007-04-27 16:01:35 +0200 | [diff] [blame] | 60 | struct chsc_ssd_info { |
| 61 | u8 path_mask; |
| 62 | u8 fla_valid_mask; |
| 63 | struct chp_id chpid[8]; |
| 64 | u16 fla[8]; |
| 65 | }; |
Sebastian Ott | 906c976 | 2010-10-25 16:10:30 +0200 | [diff] [blame] | 66 | |
Sebastian Ott | da5b6cb | 2013-06-05 18:58:35 +0200 | [diff] [blame] | 67 | struct chsc_ssqd_area { |
| 68 | struct chsc_header request; |
| 69 | u16:10; |
| 70 | u8 ssid:2; |
| 71 | u8 fmt:4; |
| 72 | u16 first_sch; |
| 73 | u16:16; |
| 74 | u16 last_sch; |
| 75 | u32:32; |
| 76 | struct chsc_header response; |
| 77 | u32:32; |
| 78 | struct qdio_ssqd_desc qdio_ssqd; |
| 79 | } __packed; |
| 80 | |
Sebastian Ott | ca4ba15 | 2013-06-05 18:59:22 +0200 | [diff] [blame] | 81 | struct chsc_scssc_area { |
| 82 | struct chsc_header request; |
| 83 | u16 operation_code; |
| 84 | u16:16; |
| 85 | u32:32; |
| 86 | u32:32; |
| 87 | u64 summary_indicator_addr; |
| 88 | u64 subchannel_indicator_addr; |
| 89 | u32 ks:4; |
| 90 | u32 kc:4; |
| 91 | u32:21; |
| 92 | u32 isc:3; |
| 93 | u32 word_with_d_bit; |
| 94 | u32:32; |
| 95 | struct subchannel_id schid; |
| 96 | u32 reserved[1004]; |
| 97 | struct chsc_header response; |
| 98 | u32:32; |
| 99 | } __packed; |
| 100 | |
Sebastian Ott | 906c976 | 2010-10-25 16:10:30 +0200 | [diff] [blame] | 101 | struct chsc_scpd { |
| 102 | struct chsc_header request; |
| 103 | u32:2; |
| 104 | u32 m:1; |
| 105 | u32 c:1; |
| 106 | u32 fmt:4; |
| 107 | u32 cssid:8; |
| 108 | u32:4; |
| 109 | u32 rfmt:4; |
| 110 | u32 first_chpid:8; |
| 111 | u32:24; |
| 112 | u32 last_chpid:8; |
| 113 | u32 zeroes1; |
| 114 | struct chsc_header response; |
Sebastian Ott | 687cb7f | 2016-06-21 16:26:25 +0200 | [diff] [blame] | 115 | u32:32; |
| 116 | u8 data[0]; |
| 117 | } __packed; |
Sebastian Ott | 906c976 | 2010-10-25 16:10:30 +0200 | [diff] [blame] | 118 | |
Sebastian Ott | 18e22a1 | 2015-06-29 18:39:54 +0200 | [diff] [blame] | 119 | struct chsc_sda_area { |
| 120 | struct chsc_header request; |
| 121 | u8 :4; |
| 122 | u8 format:4; |
| 123 | u8 :8; |
| 124 | u16 operation_code; |
| 125 | u32 :32; |
| 126 | u32 :32; |
| 127 | u32 operation_data_area[252]; |
| 128 | struct chsc_header response; |
| 129 | u32 :4; |
| 130 | u32 format2:4; |
| 131 | u32 :24; |
| 132 | } __packed __aligned(PAGE_SIZE); |
Sebastian Ott | 906c976 | 2010-10-25 16:10:30 +0200 | [diff] [blame] | 133 | |
Peter Oberparleiter | 7ad6a24 | 2007-04-27 16:01:35 +0200 | [diff] [blame] | 134 | extern int chsc_get_ssd_info(struct subchannel_id schid, |
| 135 | struct chsc_ssd_info *ssd); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 136 | extern int chsc_determine_css_characteristics(void); |
Sebastian Ott | 34aec07 | 2010-10-25 16:10:28 +0200 | [diff] [blame] | 137 | extern int chsc_init(void); |
| 138 | extern void chsc_init_cleanup(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 139 | |
Sebastian Ott | 18e22a1 | 2015-06-29 18:39:54 +0200 | [diff] [blame] | 140 | int __chsc_enable_facility(struct chsc_sda_area *sda_area, int operation_code); |
Cornelia Huck | fb6958a | 2006-01-06 00:19:25 -0800 | [diff] [blame] | 141 | extern int chsc_enable_facility(int); |
Cornelia Huck | 495a5b4 | 2006-03-24 03:15:14 -0800 | [diff] [blame] | 142 | struct channel_subsystem; |
| 143 | extern int chsc_secm(struct channel_subsystem *, int); |
Sebastian Ott | 34196f8 | 2010-10-25 16:10:29 +0200 | [diff] [blame] | 144 | int __chsc_do_secm(struct channel_subsystem *css, int enable); |
Cornelia Huck | fb6958a | 2006-01-06 00:19:25 -0800 | [diff] [blame] | 145 | |
Peter Oberparleiter | e6b6e10 | 2007-04-27 16:01:28 +0200 | [diff] [blame] | 146 | int chsc_chp_vary(struct chp_id chpid, int on); |
Cornelia Huck | 9d92a7e | 2008-07-14 09:59:05 +0200 | [diff] [blame] | 147 | 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] | 148 | int c, int m, void *page); |
Cornelia Huck | 9d92a7e | 2008-07-14 09:59:05 +0200 | [diff] [blame] | 149 | int chsc_determine_base_channel_path_desc(struct chp_id chpid, |
| 150 | struct channel_path_desc *desc); |
Sebastian Ott | ce322cc | 2011-01-05 12:47:56 +0100 | [diff] [blame] | 151 | int chsc_determine_fmt1_channel_path_desc(struct chp_id chpid, |
| 152 | struct channel_path_desc_fmt1 *desc); |
Peter Oberparleiter | 83b3370 | 2007-04-27 16:01:34 +0200 | [diff] [blame] | 153 | void chsc_chp_online(struct chp_id chpid); |
Peter Oberparleiter | e6b6e10 | 2007-04-27 16:01:28 +0200 | [diff] [blame] | 154 | void chsc_chp_offline(struct chp_id chpid); |
| 155 | int chsc_get_channel_measurement_chars(struct channel_path *chp); |
Sebastian Ott | da5b6cb | 2013-06-05 18:58:35 +0200 | [diff] [blame] | 156 | int chsc_ssqd(struct subchannel_id schid, struct chsc_ssqd_area *ssqd); |
Sebastian Ott | ca4ba15 | 2013-06-05 18:59:22 +0200 | [diff] [blame] | 157 | int chsc_sadc(struct subchannel_id schid, struct chsc_scssc_area *scssc, |
| 158 | u64 summary_indicator_addr, u64 subchannel_indicator_addr); |
Cornelia Huck | dae3984 | 2008-07-17 17:16:47 +0200 | [diff] [blame] | 159 | int chsc_error_from_response(int response); |
| 160 | |
Michael Ernst | fd0457a | 2010-08-09 18:12:50 +0200 | [diff] [blame] | 161 | int chsc_siosl(struct subchannel_id schid); |
| 162 | |
Sebastian Ott | 184b08a | 2012-08-28 16:45:42 +0200 | [diff] [blame] | 163 | /* Functions and definitions to query storage-class memory. */ |
| 164 | struct sale { |
| 165 | u64 sa; |
| 166 | u32 p:4; |
| 167 | u32 op_state:4; |
| 168 | u32 data_state:4; |
| 169 | u32 rank:4; |
| 170 | u32 r:1; |
| 171 | u32:7; |
| 172 | u32 rid:8; |
| 173 | u32:32; |
| 174 | } __packed; |
| 175 | |
| 176 | struct chsc_scm_info { |
| 177 | struct chsc_header request; |
| 178 | u32:32; |
| 179 | u64 reqtok; |
| 180 | u32 reserved1[4]; |
| 181 | struct chsc_header response; |
| 182 | u64:56; |
| 183 | u8 rq; |
| 184 | u32 mbc; |
| 185 | u64 msa; |
| 186 | u16 is; |
| 187 | u16 mmc; |
| 188 | u32 mci; |
| 189 | u64 nr_scm_ini; |
| 190 | u64 nr_scm_unini; |
| 191 | u32 reserved2[10]; |
| 192 | u64 restok; |
| 193 | struct sale scmal[248]; |
| 194 | } __packed; |
| 195 | |
| 196 | int chsc_scm_info(struct chsc_scm_info *scm_area, u64 token); |
| 197 | |
Eugene Crosser | 1c59a86 | 2013-04-24 12:00:23 +0200 | [diff] [blame] | 198 | struct chsc_brinfo_resume_token { |
| 199 | u64 t1; |
| 200 | u64 t2; |
| 201 | } __packed; |
| 202 | |
| 203 | struct chsc_brinfo_naihdr { |
| 204 | struct chsc_brinfo_resume_token resume_token; |
| 205 | u32:32; |
| 206 | u32 instance; |
| 207 | u32:24; |
| 208 | u8 naids; |
| 209 | u32 reserved[3]; |
| 210 | } __packed; |
| 211 | |
| 212 | struct chsc_pnso_area { |
| 213 | struct chsc_header request; |
| 214 | u8:2; |
| 215 | u8 m:1; |
| 216 | u8:5; |
| 217 | u8:2; |
| 218 | u8 ssid:2; |
| 219 | u8 fmt:4; |
| 220 | u16 sch; |
| 221 | u8:8; |
| 222 | u8 cssid; |
| 223 | u16:16; |
| 224 | u8 oc; |
| 225 | u32:24; |
| 226 | struct chsc_brinfo_resume_token resume_token; |
| 227 | u32 n:1; |
| 228 | u32:31; |
| 229 | u32 reserved[3]; |
| 230 | struct chsc_header response; |
| 231 | u32:32; |
| 232 | struct chsc_brinfo_naihdr naihdr; |
| 233 | union { |
| 234 | struct qdio_brinfo_entry_l3_ipv6 l3_ipv6[0]; |
| 235 | struct qdio_brinfo_entry_l3_ipv4 l3_ipv4[0]; |
| 236 | struct qdio_brinfo_entry_l2 l2[0]; |
| 237 | } entries; |
| 238 | } __packed; |
| 239 | |
| 240 | int chsc_pnso_brinfo(struct subchannel_id schid, |
| 241 | struct chsc_pnso_area *brinfo_area, |
| 242 | struct chsc_brinfo_resume_token resume_token, |
| 243 | int cnc); |
| 244 | |
Sebastian Ott | 40ff4cc | 2012-08-28 16:47:02 +0200 | [diff] [blame] | 245 | #ifdef CONFIG_SCM_BUS |
| 246 | int scm_update_information(void); |
Sebastian Ott | aebfa66 | 2013-02-28 12:07:55 +0100 | [diff] [blame] | 247 | int scm_process_availability_information(void); |
Sebastian Ott | 40ff4cc | 2012-08-28 16:47:02 +0200 | [diff] [blame] | 248 | #else /* CONFIG_SCM_BUS */ |
Sebastian Ott | 58fece7 | 2013-01-28 19:34:26 +0100 | [diff] [blame] | 249 | static inline int scm_update_information(void) { return 0; } |
Sebastian Ott | aebfa66 | 2013-02-28 12:07:55 +0100 | [diff] [blame] | 250 | static inline int scm_process_availability_information(void) { return 0; } |
Sebastian Ott | 40ff4cc | 2012-08-28 16:47:02 +0200 | [diff] [blame] | 251 | #endif /* CONFIG_SCM_BUS */ |
| 252 | |
| 253 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | #endif |