blob: 7e53a9c8b0b991fce45e9cc488ddcc73a0e14be4 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef S390_CHSC_H
2#define S390_CHSC_H
3
Peter Oberparleiterf86635f2007-04-27 16:01:26 +02004#include <linux/types.h>
5#include <linux/device.h>
Sebastian Ott382b7362012-08-28 16:43:36 +02006#include <asm/css_chars.h>
Peter Oberparleitere5854a52007-04-27 16:01:31 +02007#include <asm/chpid.h>
Cornelia Huck9d92a7e2008-07-14 09:59:05 +02008#include <asm/chsc.h>
9#include <asm/schid.h>
Sebastian Ottda5b6cb2013-06-05 18:58:35 +020010#include <asm/qdio.h>
Peter Oberparleiterf86635f2007-04-27 16:01:26 +020011
Cornelia Huckfb6958a2006-01-06 00:19:25 -080012#define CHSC_SDA_OC_MSS 0x2
13
Cornelia Huck495a5b42006-03-24 03:15:14 -080014#define NR_MEASUREMENT_CHARS 5
15struct cmg_chars {
16 u32 values[NR_MEASUREMENT_CHARS];
Peter Oberparleiter0f008aa2007-02-05 21:17:40 +010017} __attribute__ ((packed));
Cornelia Huck495a5b42006-03-24 03:15:14 -080018
19#define NR_MEASUREMENT_ENTRIES 8
20struct cmg_entry {
21 u32 values[NR_MEASUREMENT_ENTRIES];
Peter Oberparleiter0f008aa2007-02-05 21:17:40 +010022} __attribute__ ((packed));
Cornelia Huck495a5b42006-03-24 03:15:14 -080023
Linus Torvalds1da177e2005-04-16 15:20:36 -070024struct 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 Oberparleiter0f008aa2007-02-05 21:17:40 +010033} __attribute__ ((packed));
Linus Torvalds1da177e2005-04-16 15:20:36 -070034
Sebastian Ottce322cc2011-01-05 12:47:56 +010035struct channel_path_desc_fmt1 {
36 u8 flags;
37 u8 lsn;
38 u8 desc;
39 u8 chpid;
40 u32:24;
41 u8 chpp;
Peter Oberparleiterba542292013-05-15 13:43:29 +020042 u32 unused[2];
43 u16 chid;
44 u32:16;
Sebastian Ottce322cc2011-01-05 12:47:56 +010045 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 Oberparleitere6b6e102007-04-27 16:01:28 +020053struct channel_path;
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
Linus Torvalds1da177e2005-04-16 15:20:36 -070055struct css_chsc_char {
56 u64 res;
Cornelia Huck495a5b42006-03-24 03:15:14 -080057 u64 : 20;
58 u32 secm : 1; /* bit 84 */
59 u32 : 1;
60 u32 scmc : 1; /* bit 86 */
61 u32 : 20;
Linus Torvalds1da177e2005-04-16 15:20:36 -070062 u32 scssc : 1; /* bit 107 */
63 u32 scsscf : 1; /* bit 108 */
Eugene Crosser1c59a862013-04-24 12:00:23 +020064 u32:7;
65 u32 pnso:1; /* bit 116 */
66 u32:11;
Linus Torvalds1da177e2005-04-16 15:20:36 -070067}__attribute__((packed));
68
Linus Torvalds1da177e2005-04-16 15:20:36 -070069extern struct css_chsc_char css_chsc_characteristics;
70
Peter Oberparleiter7ad6a242007-04-27 16:01:35 +020071struct chsc_ssd_info {
72 u8 path_mask;
73 u8 fla_valid_mask;
74 struct chp_id chpid[8];
75 u16 fla[8];
76};
Sebastian Ott906c9762010-10-25 16:10:30 +020077
Sebastian Ottda5b6cb2013-06-05 18:58:35 +020078struct chsc_ssqd_area {
79 struct chsc_header request;
80 u16:10;
81 u8 ssid:2;
82 u8 fmt:4;
83 u16 first_sch;
84 u16:16;
85 u16 last_sch;
86 u32:32;
87 struct chsc_header response;
88 u32:32;
89 struct qdio_ssqd_desc qdio_ssqd;
90} __packed;
91
Sebastian Ottca4ba152013-06-05 18:59:22 +020092struct chsc_scssc_area {
93 struct chsc_header request;
94 u16 operation_code;
95 u16:16;
96 u32:32;
97 u32:32;
98 u64 summary_indicator_addr;
99 u64 subchannel_indicator_addr;
100 u32 ks:4;
101 u32 kc:4;
102 u32:21;
103 u32 isc:3;
104 u32 word_with_d_bit;
105 u32:32;
106 struct subchannel_id schid;
107 u32 reserved[1004];
108 struct chsc_header response;
109 u32:32;
110} __packed;
111
Sebastian Ott906c9762010-10-25 16:10:30 +0200112struct chsc_scpd {
113 struct chsc_header request;
114 u32:2;
115 u32 m:1;
116 u32 c:1;
117 u32 fmt:4;
118 u32 cssid:8;
119 u32:4;
120 u32 rfmt:4;
121 u32 first_chpid:8;
122 u32:24;
123 u32 last_chpid:8;
124 u32 zeroes1;
125 struct chsc_header response;
126 u8 data[PAGE_SIZE - 20];
127} __attribute__ ((packed));
128
129
Peter Oberparleiter7ad6a242007-04-27 16:01:35 +0200130extern int chsc_get_ssd_info(struct subchannel_id schid,
131 struct chsc_ssd_info *ssd);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132extern int chsc_determine_css_characteristics(void);
Sebastian Ott34aec072010-10-25 16:10:28 +0200133extern int chsc_init(void);
134extern void chsc_init_cleanup(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135
Cornelia Huckfb6958a2006-01-06 00:19:25 -0800136extern int chsc_enable_facility(int);
Cornelia Huck495a5b42006-03-24 03:15:14 -0800137struct channel_subsystem;
138extern int chsc_secm(struct channel_subsystem *, int);
Sebastian Ott34196f82010-10-25 16:10:29 +0200139int __chsc_do_secm(struct channel_subsystem *css, int enable);
Cornelia Huckfb6958a2006-01-06 00:19:25 -0800140
Peter Oberparleitere6b6e102007-04-27 16:01:28 +0200141int chsc_chp_vary(struct chp_id chpid, int on);
Cornelia Huck9d92a7e2008-07-14 09:59:05 +0200142int chsc_determine_channel_path_desc(struct chp_id chpid, int fmt, int rfmt,
Sebastian Ott906c9762010-10-25 16:10:30 +0200143 int c, int m, void *page);
Cornelia Huck9d92a7e2008-07-14 09:59:05 +0200144int chsc_determine_base_channel_path_desc(struct chp_id chpid,
145 struct channel_path_desc *desc);
Sebastian Ottce322cc2011-01-05 12:47:56 +0100146int chsc_determine_fmt1_channel_path_desc(struct chp_id chpid,
147 struct channel_path_desc_fmt1 *desc);
Peter Oberparleiter83b33702007-04-27 16:01:34 +0200148void chsc_chp_online(struct chp_id chpid);
Peter Oberparleitere6b6e102007-04-27 16:01:28 +0200149void chsc_chp_offline(struct chp_id chpid);
150int chsc_get_channel_measurement_chars(struct channel_path *chp);
Sebastian Ottda5b6cb2013-06-05 18:58:35 +0200151int chsc_ssqd(struct subchannel_id schid, struct chsc_ssqd_area *ssqd);
Sebastian Ottca4ba152013-06-05 18:59:22 +0200152int chsc_sadc(struct subchannel_id schid, struct chsc_scssc_area *scssc,
153 u64 summary_indicator_addr, u64 subchannel_indicator_addr);
Cornelia Huckdae39842008-07-17 17:16:47 +0200154int chsc_error_from_response(int response);
155
Michael Ernstfd0457a2010-08-09 18:12:50 +0200156int chsc_siosl(struct subchannel_id schid);
157
Sebastian Ott184b08a2012-08-28 16:45:42 +0200158/* Functions and definitions to query storage-class memory. */
159struct sale {
160 u64 sa;
161 u32 p:4;
162 u32 op_state:4;
163 u32 data_state:4;
164 u32 rank:4;
165 u32 r:1;
166 u32:7;
167 u32 rid:8;
168 u32:32;
169} __packed;
170
171struct chsc_scm_info {
172 struct chsc_header request;
173 u32:32;
174 u64 reqtok;
175 u32 reserved1[4];
176 struct chsc_header response;
177 u64:56;
178 u8 rq;
179 u32 mbc;
180 u64 msa;
181 u16 is;
182 u16 mmc;
183 u32 mci;
184 u64 nr_scm_ini;
185 u64 nr_scm_unini;
186 u32 reserved2[10];
187 u64 restok;
188 struct sale scmal[248];
189} __packed;
190
191int chsc_scm_info(struct chsc_scm_info *scm_area, u64 token);
192
Eugene Crosser1c59a862013-04-24 12:00:23 +0200193struct chsc_brinfo_resume_token {
194 u64 t1;
195 u64 t2;
196} __packed;
197
198struct chsc_brinfo_naihdr {
199 struct chsc_brinfo_resume_token resume_token;
200 u32:32;
201 u32 instance;
202 u32:24;
203 u8 naids;
204 u32 reserved[3];
205} __packed;
206
207struct chsc_pnso_area {
208 struct chsc_header request;
209 u8:2;
210 u8 m:1;
211 u8:5;
212 u8:2;
213 u8 ssid:2;
214 u8 fmt:4;
215 u16 sch;
216 u8:8;
217 u8 cssid;
218 u16:16;
219 u8 oc;
220 u32:24;
221 struct chsc_brinfo_resume_token resume_token;
222 u32 n:1;
223 u32:31;
224 u32 reserved[3];
225 struct chsc_header response;
226 u32:32;
227 struct chsc_brinfo_naihdr naihdr;
228 union {
229 struct qdio_brinfo_entry_l3_ipv6 l3_ipv6[0];
230 struct qdio_brinfo_entry_l3_ipv4 l3_ipv4[0];
231 struct qdio_brinfo_entry_l2 l2[0];
232 } entries;
233} __packed;
234
235int chsc_pnso_brinfo(struct subchannel_id schid,
236 struct chsc_pnso_area *brinfo_area,
237 struct chsc_brinfo_resume_token resume_token,
238 int cnc);
239
Sebastian Ott40ff4cc2012-08-28 16:47:02 +0200240#ifdef CONFIG_SCM_BUS
241int scm_update_information(void);
Sebastian Ottaebfa662013-02-28 12:07:55 +0100242int scm_process_availability_information(void);
Sebastian Ott40ff4cc2012-08-28 16:47:02 +0200243#else /* CONFIG_SCM_BUS */
Sebastian Ott58fece72013-01-28 19:34:26 +0100244static inline int scm_update_information(void) { return 0; }
Sebastian Ottaebfa662013-02-28 12:07:55 +0100245static inline int scm_process_availability_information(void) { return 0; }
Sebastian Ott40ff4cc2012-08-28 16:47:02 +0200246#endif /* CONFIG_SCM_BUS */
247
248
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249#endif