1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/types.h>
6 #include <linux/device.h>
7 #include <asm/css_chars.h>
10 #include <asm/schid.h>
13 #define CHSC_SDA_OC_MSS 0x2
15 #define NR_MEASUREMENT_CHARS 5
17 u32 values[NR_MEASUREMENT_CHARS];
20 #define NR_MEASUREMENT_ENTRIES 8
22 u32 values[NR_MEASUREMENT_ENTRIES];
25 struct channel_path_desc_fmt1 {
43 struct channel_path_desc_fmt3 {
44 struct channel_path_desc_fmt1 fmt1_desc;
50 struct css_chsc_char {
53 u32 secm : 1; /* bit 84 */
55 u32 scmc : 1; /* bit 86 */
57 u32 scssc : 1; /* bit 107 */
58 u32 scsscf : 1; /* bit 108 */
60 u32 pnso:1; /* bit 116 */
64 extern struct css_chsc_char css_chsc_characteristics;
66 struct chsc_ssd_info {
69 struct chp_id chpid[8];
73 struct chsc_ssqd_area {
74 struct chsc_header request;
82 struct chsc_header response;
84 struct qdio_ssqd_desc qdio_ssqd;
85 } __packed __aligned(PAGE_SIZE);
87 struct chsc_scssc_area {
88 struct chsc_header request;
93 u64 summary_indicator_addr;
94 u64 subchannel_indicator_addr;
101 struct subchannel_id schid;
103 struct chsc_header response;
105 } __packed __aligned(PAGE_SIZE);
108 struct chsc_header request;
120 struct chsc_header response;
123 } __packed __aligned(PAGE_SIZE);
125 struct chsc_sda_area {
126 struct chsc_header request;
133 u32 operation_data_area[252];
134 struct chsc_header response;
138 } __packed __aligned(PAGE_SIZE);
140 extern int chsc_get_ssd_info(struct subchannel_id schid,
141 struct chsc_ssd_info *ssd);
142 extern int chsc_determine_css_characteristics(void);
143 extern int chsc_init(void);
144 extern void chsc_init_cleanup(void);
146 int __chsc_enable_facility(struct chsc_sda_area *sda_area, int operation_code);
147 extern int chsc_enable_facility(int);
148 struct channel_subsystem;
149 extern int chsc_secm(struct channel_subsystem *, int);
150 int __chsc_do_secm(struct channel_subsystem *css, int enable);
152 int chsc_chp_vary(struct chp_id chpid, int on);
153 int chsc_determine_channel_path_desc(struct chp_id chpid, int fmt, int rfmt,
154 int c, int m, void *page);
155 int chsc_determine_fmt0_channel_path_desc(struct chp_id chpid,
156 struct channel_path_desc_fmt0 *desc);
157 int chsc_determine_fmt1_channel_path_desc(struct chp_id chpid,
158 struct channel_path_desc_fmt1 *desc);
159 int chsc_determine_fmt3_channel_path_desc(struct chp_id chpid,
160 struct channel_path_desc_fmt3 *desc);
161 void chsc_chp_online(struct chp_id chpid);
162 void chsc_chp_offline(struct chp_id chpid);
163 int chsc_get_channel_measurement_chars(struct channel_path *chp);
164 int chsc_ssqd(struct subchannel_id schid, struct chsc_ssqd_area *ssqd);
165 int chsc_sadc(struct subchannel_id schid, struct chsc_scssc_area *scssc,
166 u64 summary_indicator_addr, u64 subchannel_indicator_addr,
168 int chsc_sgib(u32 origin);
169 int chsc_error_from_response(int response);
171 int chsc_siosl(struct subchannel_id schid);
173 /* Functions and definitions to query storage-class memory. */
186 struct chsc_scm_info {
187 struct chsc_header request;
191 struct chsc_header response;
203 struct sale scmal[248];
204 } __packed __aligned(PAGE_SIZE);
206 int chsc_scm_info(struct chsc_scm_info *scm_area, u64 token);
208 struct chsc_brinfo_resume_token {
213 struct chsc_brinfo_naihdr {
214 struct chsc_brinfo_resume_token resume_token;
222 struct chsc_pnso_area {
223 struct chsc_header request;
236 struct chsc_brinfo_resume_token resume_token;
240 struct chsc_header response;
242 struct chsc_brinfo_naihdr naihdr;
244 struct qdio_brinfo_entry_l3_ipv6 l3_ipv6[0];
245 struct qdio_brinfo_entry_l3_ipv4 l3_ipv4[0];
246 struct qdio_brinfo_entry_l2 l2[0];
248 } __packed __aligned(PAGE_SIZE);
250 int chsc_pnso_brinfo(struct subchannel_id schid,
251 struct chsc_pnso_area *brinfo_area,
252 struct chsc_brinfo_resume_token resume_token,
255 int __init chsc_get_cssid(int idx);
257 #ifdef CONFIG_SCM_BUS
258 int scm_update_information(void);
259 int scm_process_availability_information(void);
260 #else /* CONFIG_SCM_BUS */
261 static inline int scm_update_information(void) { return 0; }
262 static inline int scm_process_availability_information(void) { return 0; }
263 #endif /* CONFIG_SCM_BUS */