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
];
33 u32 data
[NR_MEASUREMENT_CHARS
];
36 #define NR_MEASUREMENT_ENTRIES 8
38 u32 values
[NR_MEASUREMENT_ENTRIES
];
41 #define NR_EXT_MEASUREMENT_ENTRIES 16
42 struct cmg_ext_entry
{
43 u32 values
[NR_EXT_MEASUREMENT_ENTRIES
];
46 struct channel_path_desc_fmt1
{
65 struct channel_path_desc_fmt3
{
66 struct channel_path_desc_fmt1 fmt1_desc
;
72 struct css_chsc_char
{
75 u32 secm
: 1; /* bit 84 */
77 u32 scmc
: 1; /* bit 86 */
79 u32 scssc
: 1; /* bit 107 */
80 u32 scsscf
: 1; /* bit 108 */
82 u32 pnso
:1; /* bit 116 */
86 extern struct css_chsc_char css_chsc_characteristics
;
88 struct chsc_ssd_info
{
91 struct chp_id chpid
[8];
95 struct chsc_ssqd_area
{
96 struct chsc_header request
;
104 struct chsc_header response
;
106 struct qdio_ssqd_desc qdio_ssqd
;
107 } __packed
__aligned(PAGE_SIZE
);
109 struct chsc_scssc_area
{
110 struct chsc_header request
;
115 dma64_t summary_indicator_addr
;
116 dma64_t subchannel_indicator_addr
;
123 struct subchannel_id schid
;
125 struct chsc_header response
;
127 } __packed
__aligned(PAGE_SIZE
);
130 struct chsc_header request
;
142 struct chsc_header response
;
145 } __packed
__aligned(PAGE_SIZE
);
147 struct chsc_sda_area
{
148 struct chsc_header request
;
155 u32 operation_data_area
[252];
156 struct chsc_header response
;
160 } __packed
__aligned(PAGE_SIZE
);
162 extern int chsc_get_ssd_info(struct subchannel_id schid
,
163 struct chsc_ssd_info
*ssd
);
164 extern int chsc_determine_css_characteristics(void);
165 extern int chsc_init(void);
166 extern void chsc_init_cleanup(void);
168 int __chsc_enable_facility(struct chsc_sda_area
*sda_area
, int operation_code
);
169 extern int chsc_enable_facility(int);
170 struct channel_subsystem
;
171 extern int chsc_secm(struct channel_subsystem
*, int);
172 int __chsc_do_secm(struct channel_subsystem
*css
, int enable
);
174 int chsc_chp_vary(struct chp_id chpid
, int on
);
175 int chsc_determine_channel_path_desc(struct chp_id chpid
, int fmt
, int rfmt
,
176 int c
, int m
, void *page
);
177 int chsc_determine_fmt0_channel_path_desc(struct chp_id chpid
,
178 struct channel_path_desc_fmt0
*desc
);
179 int chsc_determine_fmt1_channel_path_desc(struct chp_id chpid
,
180 struct channel_path_desc_fmt1
*desc
);
181 int chsc_determine_fmt3_channel_path_desc(struct chp_id chpid
,
182 struct channel_path_desc_fmt3
*desc
);
183 void chsc_chp_online(struct chp_id chpid
);
184 void chsc_chp_offline(struct chp_id chpid
);
185 int chsc_get_channel_measurement_chars(struct channel_path
*chp
);
186 int chsc_ssqd(struct subchannel_id schid
, struct chsc_ssqd_area
*ssqd
);
187 int chsc_sadc(struct subchannel_id schid
, struct chsc_scssc_area
*scssc
,
188 dma64_t summary_indicator_addr
, dma64_t subchannel_indicator_addr
,
190 int chsc_sgib(u32 origin
);
191 int chsc_error_from_response(int response
);
193 int chsc_siosl(struct subchannel_id schid
);
195 /* Functions and definitions to query storage-class memory. */
208 struct chsc_scm_info
{
209 struct chsc_header request
;
213 struct chsc_header response
;
225 struct sale scmal
[248];
226 } __packed
__aligned(PAGE_SIZE
);
228 int chsc_scm_info(struct chsc_scm_info
*scm_area
, u64 token
);
230 int chsc_pnso(struct subchannel_id schid
, struct chsc_pnso_area
*pnso_area
,
231 u8 oc
, struct chsc_pnso_resume_token resume_token
, int cnc
);
233 int __init
chsc_get_cssid_iid(int idx
, u8
*cssid
, u8
*iid
);
235 #ifdef CONFIG_SCM_BUS
236 int scm_update_information(void);
237 int scm_process_availability_information(void);
238 #else /* CONFIG_SCM_BUS */
239 static inline int scm_update_information(void) { return 0; }
240 static inline int scm_process_availability_information(void) { return 0; }
241 #endif /* CONFIG_SCM_BUS */