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 {
44 struct channel_path_desc_fmt3 {
45 struct channel_path_desc_fmt1 fmt1_desc;
51 struct css_chsc_char {
54 u32 secm : 1; /* bit 84 */
56 u32 scmc : 1; /* bit 86 */
58 u32 scssc : 1; /* bit 107 */
59 u32 scsscf : 1; /* bit 108 */
61 u32 pnso:1; /* bit 116 */
65 extern struct css_chsc_char css_chsc_characteristics;
67 struct chsc_ssd_info {
70 struct chp_id chpid[8];
74 struct chsc_ssqd_area {
75 struct chsc_header request;
83 struct chsc_header response;
85 struct qdio_ssqd_desc qdio_ssqd;
86 } __packed __aligned(PAGE_SIZE);
88 struct chsc_scssc_area {
89 struct chsc_header request;
94 u64 summary_indicator_addr;
95 u64 subchannel_indicator_addr;
102 struct subchannel_id schid;
104 struct chsc_header response;
106 } __packed __aligned(PAGE_SIZE);
109 struct chsc_header request;
121 struct chsc_header response;
124 } __packed __aligned(PAGE_SIZE);
126 struct chsc_sda_area {
127 struct chsc_header request;
134 u32 operation_data_area[252];
135 struct chsc_header response;
139 } __packed __aligned(PAGE_SIZE);
141 extern int chsc_get_ssd_info(struct subchannel_id schid,
142 struct chsc_ssd_info *ssd);
143 extern int chsc_determine_css_characteristics(void);
144 extern int chsc_init(void);
145 extern void chsc_init_cleanup(void);
147 int __chsc_enable_facility(struct chsc_sda_area *sda_area, int operation_code);
148 extern int chsc_enable_facility(int);
149 struct channel_subsystem;
150 extern int chsc_secm(struct channel_subsystem *, int);
151 int __chsc_do_secm(struct channel_subsystem *css, int enable);
153 int chsc_chp_vary(struct chp_id chpid, int on);
154 int chsc_determine_channel_path_desc(struct chp_id chpid, int fmt, int rfmt,
155 int c, int m, void *page);
156 int chsc_determine_fmt0_channel_path_desc(struct chp_id chpid,
157 struct channel_path_desc_fmt0 *desc);
158 int chsc_determine_fmt1_channel_path_desc(struct chp_id chpid,
159 struct channel_path_desc_fmt1 *desc);
160 int chsc_determine_fmt3_channel_path_desc(struct chp_id chpid,
161 struct channel_path_desc_fmt3 *desc);
162 void chsc_chp_online(struct chp_id chpid);
163 void chsc_chp_offline(struct chp_id chpid);
164 int chsc_get_channel_measurement_chars(struct channel_path *chp);
165 int chsc_ssqd(struct subchannel_id schid, struct chsc_ssqd_area *ssqd);
166 int chsc_sadc(struct subchannel_id schid, struct chsc_scssc_area *scssc,
167 u64 summary_indicator_addr, u64 subchannel_indicator_addr,
169 int chsc_sgib(u32 origin);
170 int chsc_error_from_response(int response);
172 int chsc_siosl(struct subchannel_id schid);
174 /* Functions and definitions to query storage-class memory. */
187 struct chsc_scm_info {
188 struct chsc_header request;
192 struct chsc_header response;
204 struct sale scmal[248];
205 } __packed __aligned(PAGE_SIZE);
207 int chsc_scm_info(struct chsc_scm_info *scm_area, u64 token);
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);
212 int __init chsc_get_cssid_iid(int idx, u8 *cssid, u8 *iid);
214 #ifdef CONFIG_SCM_BUS
215 int scm_update_information(void);
216 int scm_process_availability_information(void);
217 #else /* CONFIG_SCM_BUS */
218 static inline int scm_update_information(void) { return 0; }
219 static inline int scm_process_availability_information(void) { return 0; }
220 #endif /* CONFIG_SCM_BUS */