Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef S390_CHSC_H
0003 #define S390_CHSC_H
0004 
0005 #include <linux/types.h>
0006 #include <linux/device.h>
0007 #include <asm/css_chars.h>
0008 #include <asm/chpid.h>
0009 #include <asm/chsc.h>
0010 #include <asm/schid.h>
0011 #include <asm/qdio.h>
0012 
0013 #define CHSC_SDA_OC_MSS   0x2
0014 
0015 #define NR_MEASUREMENT_CHARS 5
0016 struct cmg_chars {
0017     u32 values[NR_MEASUREMENT_CHARS];
0018 };
0019 
0020 #define NR_MEASUREMENT_ENTRIES 8
0021 struct cmg_entry {
0022     u32 values[NR_MEASUREMENT_ENTRIES];
0023 };
0024 
0025 struct channel_path_desc_fmt1 {
0026     u8 flags;
0027     u8 lsn;
0028     u8 desc;
0029     u8 chpid;
0030     u32:16;
0031     u8 esc;
0032     u8 chpp;
0033     u32 unused[2];
0034     u16 chid;
0035     u32:16;
0036     u16 mdc;
0037     u16:13;
0038     u8 r:1;
0039     u8 s:1;
0040     u8 f:1;
0041     u32 zeros[2];
0042 };
0043 
0044 struct channel_path_desc_fmt3 {
0045     struct channel_path_desc_fmt1 fmt1_desc;
0046     u8 util_str[64];
0047 };
0048 
0049 struct channel_path;
0050 
0051 struct css_chsc_char {
0052     u64 res;
0053     u64 : 20;
0054     u32 secm : 1; /* bit 84 */
0055     u32 : 1;
0056     u32 scmc : 1; /* bit 86 */
0057     u32 : 20;
0058     u32 scssc : 1;  /* bit 107 */
0059     u32 scsscf : 1; /* bit 108 */
0060     u32:7;
0061     u32 pnso:1; /* bit 116 */
0062     u32:11;
0063 } __packed;
0064 
0065 extern struct css_chsc_char css_chsc_characteristics;
0066 
0067 struct chsc_ssd_info {
0068     u8 path_mask;
0069     u8 fla_valid_mask;
0070     struct chp_id chpid[8];
0071     u16 fla[8];
0072 };
0073 
0074 struct chsc_ssqd_area {
0075     struct chsc_header request;
0076     u16:10;
0077     u8 ssid:2;
0078     u8 fmt:4;
0079     u16 first_sch;
0080     u16:16;
0081     u16 last_sch;
0082     u32:32;
0083     struct chsc_header response;
0084     u32:32;
0085     struct qdio_ssqd_desc qdio_ssqd;
0086 } __packed __aligned(PAGE_SIZE);
0087 
0088 struct chsc_scssc_area {
0089     struct chsc_header request;
0090     u16 operation_code;
0091     u16:16;
0092     u32:32;
0093     u32:32;
0094     u64 summary_indicator_addr;
0095     u64 subchannel_indicator_addr;
0096     u32 ks:4;
0097     u32 kc:4;
0098     u32:21;
0099     u32 isc:3;
0100     u32 word_with_d_bit;
0101     u32:32;
0102     struct subchannel_id schid;
0103     u32 reserved[1004];
0104     struct chsc_header response;
0105     u32:32;
0106 } __packed __aligned(PAGE_SIZE);
0107 
0108 struct chsc_scpd {
0109     struct chsc_header request;
0110     u32:2;
0111     u32 m:1;
0112     u32 c:1;
0113     u32 fmt:4;
0114     u32 cssid:8;
0115     u32:4;
0116     u32 rfmt:4;
0117     u32 first_chpid:8;
0118     u32:24;
0119     u32 last_chpid:8;
0120     u32 zeroes1;
0121     struct chsc_header response;
0122     u32:32;
0123     u8 data[0];
0124 } __packed __aligned(PAGE_SIZE);
0125 
0126 struct chsc_sda_area {
0127     struct chsc_header request;
0128     u8 :4;
0129     u8 format:4;
0130     u8 :8;
0131     u16 operation_code;
0132     u32 :32;
0133     u32 :32;
0134     u32 operation_data_area[252];
0135     struct chsc_header response;
0136     u32 :4;
0137     u32 format2:4;
0138     u32 :24;
0139 } __packed __aligned(PAGE_SIZE);
0140 
0141 extern int chsc_get_ssd_info(struct subchannel_id schid,
0142                  struct chsc_ssd_info *ssd);
0143 extern int chsc_determine_css_characteristics(void);
0144 extern int chsc_init(void);
0145 extern void chsc_init_cleanup(void);
0146 
0147 int __chsc_enable_facility(struct chsc_sda_area *sda_area, int operation_code);
0148 extern int chsc_enable_facility(int);
0149 struct channel_subsystem;
0150 extern int chsc_secm(struct channel_subsystem *, int);
0151 int __chsc_do_secm(struct channel_subsystem *css, int enable);
0152 
0153 int chsc_chp_vary(struct chp_id chpid, int on);
0154 int chsc_determine_channel_path_desc(struct chp_id chpid, int fmt, int rfmt,
0155                      int c, int m, void *page);
0156 int chsc_determine_fmt0_channel_path_desc(struct chp_id chpid,
0157                       struct channel_path_desc_fmt0 *desc);
0158 int chsc_determine_fmt1_channel_path_desc(struct chp_id chpid,
0159                       struct channel_path_desc_fmt1 *desc);
0160 int chsc_determine_fmt3_channel_path_desc(struct chp_id chpid,
0161                       struct channel_path_desc_fmt3 *desc);
0162 void chsc_chp_online(struct chp_id chpid);
0163 void chsc_chp_offline(struct chp_id chpid);
0164 int chsc_get_channel_measurement_chars(struct channel_path *chp);
0165 int chsc_ssqd(struct subchannel_id schid, struct chsc_ssqd_area *ssqd);
0166 int chsc_sadc(struct subchannel_id schid, struct chsc_scssc_area *scssc,
0167           u64 summary_indicator_addr, u64 subchannel_indicator_addr,
0168           u8 isc);
0169 int chsc_sgib(u32 origin);
0170 int chsc_error_from_response(int response);
0171 
0172 int chsc_siosl(struct subchannel_id schid);
0173 
0174 /* Functions and definitions to query storage-class memory. */
0175 struct sale {
0176     u64 sa;
0177     u32 p:4;
0178     u32 op_state:4;
0179     u32 data_state:4;
0180     u32 rank:4;
0181     u32 r:1;
0182     u32:7;
0183     u32 rid:8;
0184     u32:32;
0185 } __packed;
0186 
0187 struct chsc_scm_info {
0188     struct chsc_header request;
0189     u32:32;
0190     u64 reqtok;
0191     u32 reserved1[4];
0192     struct chsc_header response;
0193     u64:56;
0194     u8 rq;
0195     u32 mbc;
0196     u64 msa;
0197     u16 is;
0198     u16 mmc;
0199     u32 mci;
0200     u64 nr_scm_ini;
0201     u64 nr_scm_unini;
0202     u32 reserved2[10];
0203     u64 restok;
0204     struct sale scmal[248];
0205 } __packed __aligned(PAGE_SIZE);
0206 
0207 int chsc_scm_info(struct chsc_scm_info *scm_area, u64 token);
0208 
0209 int chsc_pnso(struct subchannel_id schid, struct chsc_pnso_area *pnso_area,
0210           u8 oc, struct chsc_pnso_resume_token resume_token, int cnc);
0211 
0212 int __init chsc_get_cssid_iid(int idx, u8 *cssid, u8 *iid);
0213 
0214 #ifdef CONFIG_SCM_BUS
0215 int scm_update_information(void);
0216 int scm_process_availability_information(void);
0217 #else /* CONFIG_SCM_BUS */
0218 static inline int scm_update_information(void) { return 0; }
0219 static inline int scm_process_availability_information(void) { return 0; }
0220 #endif /* CONFIG_SCM_BUS */
0221 
0222 
0223 #endif