Commit | Line | Data |
---|---|---|
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 |
16 | struct cmg_chars { | |
17 | u32 values[NR_MEASUREMENT_CHARS]; | |
ccaabeea | 18 | }; |
495a5b45 CH |
19 | |
20 | #define NR_MEASUREMENT_ENTRIES 8 | |
21 | struct cmg_entry { | |
22 | u32 values[NR_MEASUREMENT_ENTRIES]; | |
ccaabeea | 23 | }; |
495a5b45 | 24 | |
ce322ccd SO |
25 | struct channel_path_desc_fmt1 { |
26 | u8 flags; | |
27 | u8 lsn; | |
28 | u8 desc; | |
29 | u8 chpid; | |
8b8b0915 SO |
30 | u32:16; |
31 | u8 esc; | |
ce322ccd | 32 | u8 chpp; |
ba54229d PO |
33 | u32 unused[2]; |
34 | u16 chid; | |
35 | u32:16; | |
ce322ccd SO |
36 | u16 mdc; |
37 | u16:13; | |
38 | u8 r:1; | |
39 | u8 s:1; | |
40 | u8 f:1; | |
41 | u32 zeros[2]; | |
ccaabeea | 42 | }; |
ce322ccd | 43 | |
fcc6dd4b SO |
44 | struct channel_path_desc_fmt3 { |
45 | struct channel_path_desc_fmt1 fmt1_desc; | |
46 | u8 util_str[64]; | |
47 | }; | |
48 | ||
e6b6e10a | 49 | struct channel_path; |
1da177e4 | 50 | |
1da177e4 LT |
51 | struct css_chsc_char { |
52 | u64 res; | |
495a5b45 CH |
53 | u64 : 20; |
54 | u32 secm : 1; /* bit 84 */ | |
55 | u32 : 1; | |
56 | u32 scmc : 1; /* bit 86 */ | |
57 | u32 : 20; | |
1da177e4 LT |
58 | u32 scssc : 1; /* bit 107 */ |
59 | u32 scsscf : 1; /* bit 108 */ | |
1c59a861 EC |
60 | u32:7; |
61 | u32 pnso:1; /* bit 116 */ | |
62 | u32:11; | |
ccaabeea | 63 | } __packed; |
1da177e4 | 64 | |
1da177e4 LT |
65 | extern struct css_chsc_char css_chsc_characteristics; |
66 | ||
7ad6a249 PO |
67 | struct chsc_ssd_info { |
68 | u8 path_mask; | |
69 | u8 fla_valid_mask; | |
70 | struct chp_id chpid[8]; | |
71 | u16 fla[8]; | |
72 | }; | |
906c9768 | 73 | |
da5b6cb1 SO |
74 | struct chsc_ssqd_area { |
75 | struct chsc_header request; | |
76 | u16:10; | |
77 | u8 ssid:2; | |
78 | u8 fmt:4; | |
79 | u16 first_sch; | |
80 | u16:16; | |
81 | u16 last_sch; | |
82 | u32:32; | |
83 | struct chsc_header response; | |
84 | u32:32; | |
85 | struct qdio_ssqd_desc qdio_ssqd; | |
ccaabeea | 86 | } __packed __aligned(PAGE_SIZE); |
da5b6cb1 | 87 | |
ca4ba153 SO |
88 | struct chsc_scssc_area { |
89 | struct chsc_header request; | |
90 | u16 operation_code; | |
91 | u16:16; | |
92 | u32:32; | |
93 | u32:32; | |
94 | u64 summary_indicator_addr; | |
95 | u64 subchannel_indicator_addr; | |
96 | u32 ks:4; | |
97 | u32 kc:4; | |
98 | u32:21; | |
99 | u32 isc:3; | |
100 | u32 word_with_d_bit; | |
101 | u32:32; | |
102 | struct subchannel_id schid; | |
103 | u32 reserved[1004]; | |
104 | struct chsc_header response; | |
105 | u32:32; | |
ccaabeea | 106 | } __packed __aligned(PAGE_SIZE); |
ca4ba153 | 107 | |
906c9768 SO |
108 | struct chsc_scpd { |
109 | struct chsc_header request; | |
110 | u32:2; | |
111 | u32 m:1; | |
112 | u32 c:1; | |
113 | u32 fmt:4; | |
114 | u32 cssid:8; | |
115 | u32:4; | |
116 | u32 rfmt:4; | |
117 | u32 first_chpid:8; | |
118 | u32:24; | |
119 | u32 last_chpid:8; | |
120 | u32 zeroes1; | |
121 | struct chsc_header response; | |
687cb7f2 SO |
122 | u32:32; |
123 | u8 data[0]; | |
ccaabeea | 124 | } __packed __aligned(PAGE_SIZE); |
906c9768 | 125 | |
18e22a17 SO |
126 | struct chsc_sda_area { |
127 | struct chsc_header request; | |
128 | u8 :4; | |
129 | u8 format:4; | |
130 | u8 :8; | |
131 | u16 operation_code; | |
132 | u32 :32; | |
133 | u32 :32; | |
134 | u32 operation_data_area[252]; | |
135 | struct chsc_header response; | |
136 | u32 :4; | |
137 | u32 format2:4; | |
138 | u32 :24; | |
139 | } __packed __aligned(PAGE_SIZE); | |
906c9768 | 140 | |
7ad6a249 PO |
141 | extern int chsc_get_ssd_info(struct subchannel_id schid, |
142 | struct chsc_ssd_info *ssd); | |
1da177e4 | 143 | extern int chsc_determine_css_characteristics(void); |
34aec07c SO |
144 | extern int chsc_init(void); |
145 | extern void chsc_init_cleanup(void); | |
1da177e4 | 146 | |
18e22a17 | 147 | int __chsc_enable_facility(struct chsc_sda_area *sda_area, int operation_code); |
fb6958a5 | 148 | extern int chsc_enable_facility(int); |
495a5b45 CH |
149 | struct channel_subsystem; |
150 | extern int chsc_secm(struct channel_subsystem *, int); | |
34196f82 | 151 | int __chsc_do_secm(struct channel_subsystem *css, int enable); |
fb6958a5 | 152 | |
e6b6e10a | 153 | int chsc_chp_vary(struct chp_id chpid, int on); |
9d92a7e1 | 154 | int chsc_determine_channel_path_desc(struct chp_id chpid, int fmt, int rfmt, |
906c9768 | 155 | int c, int m, void *page); |
ded27d8d SO |
156 | int chsc_determine_fmt0_channel_path_desc(struct chp_id chpid, |
157 | struct channel_path_desc_fmt0 *desc); | |
ce322ccd SO |
158 | int chsc_determine_fmt1_channel_path_desc(struct chp_id chpid, |
159 | struct channel_path_desc_fmt1 *desc); | |
fcc6dd4b SO |
160 | int chsc_determine_fmt3_channel_path_desc(struct chp_id chpid, |
161 | struct channel_path_desc_fmt3 *desc); | |
83b3370c | 162 | void chsc_chp_online(struct chp_id chpid); |
e6b6e10a PO |
163 | void chsc_chp_offline(struct chp_id chpid); |
164 | int chsc_get_channel_measurement_chars(struct channel_path *chp); | |
da5b6cb1 | 165 | int chsc_ssqd(struct subchannel_id schid, struct chsc_ssqd_area *ssqd); |
ca4ba153 | 166 | int chsc_sadc(struct subchannel_id schid, struct chsc_scssc_area *scssc, |
92892240 JW |
167 | u64 summary_indicator_addr, u64 subchannel_indicator_addr, |
168 | u8 isc); | |
3dec1922 | 169 | int chsc_sgib(u32 origin); |
dae39843 CH |
170 | int chsc_error_from_response(int response); |
171 | ||
fd0457a6 ME |
172 | int chsc_siosl(struct subchannel_id schid); |
173 | ||
184b08af SO |
174 | /* Functions and definitions to query storage-class memory. */ |
175 | struct sale { | |
176 | u64 sa; | |
177 | u32 p:4; | |
178 | u32 op_state:4; | |
179 | u32 data_state:4; | |
180 | u32 rank:4; | |
181 | u32 r:1; | |
182 | u32:7; | |
183 | u32 rid:8; | |
184 | u32:32; | |
185 | } __packed; | |
186 | ||
187 | struct chsc_scm_info { | |
188 | struct chsc_header request; | |
189 | u32:32; | |
190 | u64 reqtok; | |
191 | u32 reserved1[4]; | |
192 | struct chsc_header response; | |
193 | u64:56; | |
194 | u8 rq; | |
195 | u32 mbc; | |
196 | u64 msa; | |
197 | u16 is; | |
198 | u16 mmc; | |
199 | u32 mci; | |
200 | u64 nr_scm_ini; | |
201 | u64 nr_scm_unini; | |
202 | u32 reserved2[10]; | |
203 | u64 restok; | |
204 | struct sale scmal[248]; | |
ccaabeea | 205 | } __packed __aligned(PAGE_SIZE); |
184b08af SO |
206 | |
207 | int chsc_scm_info(struct chsc_scm_info *scm_area, u64 token); | |
208 | ||
4fea49a7 AW |
209 | int chsc_pnso(struct subchannel_id schid, struct chsc_pnso_area *pnso_area, |
210 | u8 oc, struct chsc_pnso_resume_token resume_token, int cnc); | |
1c59a861 | 211 | |
b983aa1f | 212 | int __init chsc_get_cssid_iid(int idx, u8 *cssid, u8 *iid); |
e2e0de9b | 213 | |
40ff4cc0 SO |
214 | #ifdef CONFIG_SCM_BUS |
215 | int scm_update_information(void); | |
aebfa669 | 216 | int scm_process_availability_information(void); |
40ff4cc0 | 217 | #else /* CONFIG_SCM_BUS */ |
58fece78 | 218 | static inline int scm_update_information(void) { return 0; } |
aebfa669 | 219 | static inline int scm_process_availability_information(void) { return 0; } |
40ff4cc0 SO |
220 | #endif /* CONFIG_SCM_BUS */ |
221 | ||
222 | ||
1da177e4 | 223 | #endif |