]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/s390/cio/chsc.h
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[mirror_ubuntu-bionic-kernel.git] / drivers / s390 / cio / chsc.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
1da177e4
LT
2#ifndef S390_CHSC_H
3#define S390_CHSC_H
4
f86635fa
PO
5#include <linux/types.h>
6#include <linux/device.h>
382b7366 7#include <asm/css_chars.h>
e5854a58 8#include <asm/chpid.h>
9d92a7e1
CH
9#include <asm/chsc.h>
10#include <asm/schid.h>
da5b6cb1 11#include <asm/qdio.h>
f86635fa 12
fb6958a5
CH
13#define CHSC_SDA_OC_MSS 0x2
14
495a5b45
CH
15#define NR_MEASUREMENT_CHARS 5
16struct cmg_chars {
17 u32 values[NR_MEASUREMENT_CHARS];
0f008aa3 18} __attribute__ ((packed));
495a5b45
CH
19
20#define NR_MEASUREMENT_ENTRIES 8
21struct cmg_entry {
22 u32 values[NR_MEASUREMENT_ENTRIES];
0f008aa3 23} __attribute__ ((packed));
495a5b45 24
ce322ccd
SO
25struct channel_path_desc_fmt1 {
26 u8 flags;
27 u8 lsn;
28 u8 desc;
29 u8 chpid;
30 u32:24;
31 u8 chpp;
ba54229d
PO
32 u32 unused[2];
33 u16 chid;
34 u32:16;
ce322ccd
SO
35 u16 mdc;
36 u16:13;
37 u8 r:1;
38 u8 s:1;
39 u8 f:1;
40 u32 zeros[2];
41} __attribute__ ((packed));
42
e6b6e10a 43struct channel_path;
1da177e4 44
1da177e4
LT
45struct css_chsc_char {
46 u64 res;
495a5b45
CH
47 u64 : 20;
48 u32 secm : 1; /* bit 84 */
49 u32 : 1;
50 u32 scmc : 1; /* bit 86 */
51 u32 : 20;
1da177e4
LT
52 u32 scssc : 1; /* bit 107 */
53 u32 scsscf : 1; /* bit 108 */
1c59a861
EC
54 u32:7;
55 u32 pnso:1; /* bit 116 */
56 u32:11;
1da177e4
LT
57}__attribute__((packed));
58
1da177e4
LT
59extern struct css_chsc_char css_chsc_characteristics;
60
7ad6a249
PO
61struct chsc_ssd_info {
62 u8 path_mask;
63 u8 fla_valid_mask;
64 struct chp_id chpid[8];
65 u16 fla[8];
66};
906c9768 67
da5b6cb1
SO
68struct chsc_ssqd_area {
69 struct chsc_header request;
70 u16:10;
71 u8 ssid:2;
72 u8 fmt:4;
73 u16 first_sch;
74 u16:16;
75 u16 last_sch;
76 u32:32;
77 struct chsc_header response;
78 u32:32;
79 struct qdio_ssqd_desc qdio_ssqd;
80} __packed;
81
ca4ba153
SO
82struct chsc_scssc_area {
83 struct chsc_header request;
84 u16 operation_code;
85 u16:16;
86 u32:32;
87 u32:32;
88 u64 summary_indicator_addr;
89 u64 subchannel_indicator_addr;
90 u32 ks:4;
91 u32 kc:4;
92 u32:21;
93 u32 isc:3;
94 u32 word_with_d_bit;
95 u32:32;
96 struct subchannel_id schid;
97 u32 reserved[1004];
98 struct chsc_header response;
99 u32:32;
100} __packed;
101
906c9768
SO
102struct chsc_scpd {
103 struct chsc_header request;
104 u32:2;
105 u32 m:1;
106 u32 c:1;
107 u32 fmt:4;
108 u32 cssid:8;
109 u32:4;
110 u32 rfmt:4;
111 u32 first_chpid:8;
112 u32:24;
113 u32 last_chpid:8;
114 u32 zeroes1;
115 struct chsc_header response;
687cb7f2
SO
116 u32:32;
117 u8 data[0];
118} __packed;
906c9768 119
18e22a17
SO
120struct chsc_sda_area {
121 struct chsc_header request;
122 u8 :4;
123 u8 format:4;
124 u8 :8;
125 u16 operation_code;
126 u32 :32;
127 u32 :32;
128 u32 operation_data_area[252];
129 struct chsc_header response;
130 u32 :4;
131 u32 format2:4;
132 u32 :24;
133} __packed __aligned(PAGE_SIZE);
906c9768 134
7ad6a249
PO
135extern int chsc_get_ssd_info(struct subchannel_id schid,
136 struct chsc_ssd_info *ssd);
1da177e4 137extern int chsc_determine_css_characteristics(void);
34aec07c
SO
138extern int chsc_init(void);
139extern void chsc_init_cleanup(void);
1da177e4 140
18e22a17 141int __chsc_enable_facility(struct chsc_sda_area *sda_area, int operation_code);
fb6958a5 142extern int chsc_enable_facility(int);
495a5b45
CH
143struct channel_subsystem;
144extern int chsc_secm(struct channel_subsystem *, int);
34196f82 145int __chsc_do_secm(struct channel_subsystem *css, int enable);
fb6958a5 146
e6b6e10a 147int chsc_chp_vary(struct chp_id chpid, int on);
9d92a7e1 148int chsc_determine_channel_path_desc(struct chp_id chpid, int fmt, int rfmt,
906c9768 149 int c, int m, void *page);
9d92a7e1
CH
150int chsc_determine_base_channel_path_desc(struct chp_id chpid,
151 struct channel_path_desc *desc);
ce322ccd
SO
152int chsc_determine_fmt1_channel_path_desc(struct chp_id chpid,
153 struct channel_path_desc_fmt1 *desc);
83b3370c 154void chsc_chp_online(struct chp_id chpid);
e6b6e10a
PO
155void chsc_chp_offline(struct chp_id chpid);
156int chsc_get_channel_measurement_chars(struct channel_path *chp);
da5b6cb1 157int chsc_ssqd(struct subchannel_id schid, struct chsc_ssqd_area *ssqd);
ca4ba153
SO
158int chsc_sadc(struct subchannel_id schid, struct chsc_scssc_area *scssc,
159 u64 summary_indicator_addr, u64 subchannel_indicator_addr);
dae39843
CH
160int chsc_error_from_response(int response);
161
fd0457a6
ME
162int chsc_siosl(struct subchannel_id schid);
163
184b08af
SO
164/* Functions and definitions to query storage-class memory. */
165struct sale {
166 u64 sa;
167 u32 p:4;
168 u32 op_state:4;
169 u32 data_state:4;
170 u32 rank:4;
171 u32 r:1;
172 u32:7;
173 u32 rid:8;
174 u32:32;
175} __packed;
176
177struct chsc_scm_info {
178 struct chsc_header request;
179 u32:32;
180 u64 reqtok;
181 u32 reserved1[4];
182 struct chsc_header response;
183 u64:56;
184 u8 rq;
185 u32 mbc;
186 u64 msa;
187 u16 is;
188 u16 mmc;
189 u32 mci;
190 u64 nr_scm_ini;
191 u64 nr_scm_unini;
192 u32 reserved2[10];
193 u64 restok;
194 struct sale scmal[248];
195} __packed;
196
197int chsc_scm_info(struct chsc_scm_info *scm_area, u64 token);
198
1c59a861
EC
199struct chsc_brinfo_resume_token {
200 u64 t1;
201 u64 t2;
202} __packed;
203
204struct chsc_brinfo_naihdr {
205 struct chsc_brinfo_resume_token resume_token;
206 u32:32;
207 u32 instance;
208 u32:24;
209 u8 naids;
210 u32 reserved[3];
211} __packed;
212
213struct chsc_pnso_area {
214 struct chsc_header request;
215 u8:2;
216 u8 m:1;
217 u8:5;
218 u8:2;
219 u8 ssid:2;
220 u8 fmt:4;
221 u16 sch;
222 u8:8;
223 u8 cssid;
224 u16:16;
225 u8 oc;
226 u32:24;
227 struct chsc_brinfo_resume_token resume_token;
228 u32 n:1;
229 u32:31;
230 u32 reserved[3];
231 struct chsc_header response;
232 u32:32;
233 struct chsc_brinfo_naihdr naihdr;
234 union {
235 struct qdio_brinfo_entry_l3_ipv6 l3_ipv6[0];
236 struct qdio_brinfo_entry_l3_ipv4 l3_ipv4[0];
237 struct qdio_brinfo_entry_l2 l2[0];
238 } entries;
239} __packed;
240
241int chsc_pnso_brinfo(struct subchannel_id schid,
242 struct chsc_pnso_area *brinfo_area,
243 struct chsc_brinfo_resume_token resume_token,
244 int cnc);
245
e2e0de9b
SO
246int __init chsc_get_cssid(int idx);
247
40ff4cc0
SO
248#ifdef CONFIG_SCM_BUS
249int scm_update_information(void);
aebfa669 250int scm_process_availability_information(void);
40ff4cc0 251#else /* CONFIG_SCM_BUS */
58fece78 252static inline int scm_update_information(void) { return 0; }
aebfa669 253static inline int scm_process_availability_information(void) { return 0; }
40ff4cc0
SO
254#endif /* CONFIG_SCM_BUS */
255
256
1da177e4 257#endif