e7ef2a683b8fbc617368ad855f4f18d6832b3eb6
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / s390 / cio / chsc.h
1 #ifndef S390_CHSC_H
2 #define S390_CHSC_H
3
4 #include <linux/types.h>
5 #include <linux/device.h>
6 #include <asm/css_chars.h>
7 #include <asm/chpid.h>
8 #include <asm/chsc.h>
9 #include <asm/schid.h>
10
11 #define CHSC_SDA_OC_MSS 0x2
12
13 struct chsc_header {
14 u16 length;
15 u16 code;
16 } __attribute__ ((packed));
17
18 #define NR_MEASUREMENT_CHARS 5
19 struct cmg_chars {
20 u32 values[NR_MEASUREMENT_CHARS];
21 } __attribute__ ((packed));
22
23 #define NR_MEASUREMENT_ENTRIES 8
24 struct cmg_entry {
25 u32 values[NR_MEASUREMENT_ENTRIES];
26 } __attribute__ ((packed));
27
28 struct channel_path_desc {
29 u8 flags;
30 u8 lsn;
31 u8 desc;
32 u8 chpid;
33 u8 swla;
34 u8 zeroes;
35 u8 chla;
36 u8 chpp;
37 } __attribute__ ((packed));
38
39 struct channel_path_desc_fmt1 {
40 u8 flags;
41 u8 lsn;
42 u8 desc;
43 u8 chpid;
44 u32:24;
45 u8 chpp;
46 u32 unused[2];
47 u16 chid;
48 u32:16;
49 u16 mdc;
50 u16:13;
51 u8 r:1;
52 u8 s:1;
53 u8 f:1;
54 u32 zeros[2];
55 } __attribute__ ((packed));
56
57 struct channel_path;
58
59 struct css_chsc_char {
60 u64 res;
61 u64 : 20;
62 u32 secm : 1; /* bit 84 */
63 u32 : 1;
64 u32 scmc : 1; /* bit 86 */
65 u32 : 20;
66 u32 scssc : 1; /* bit 107 */
67 u32 scsscf : 1; /* bit 108 */
68 u32 : 19;
69 }__attribute__((packed));
70
71 extern struct css_chsc_char css_chsc_characteristics;
72
73 struct chsc_ssd_info {
74 u8 path_mask;
75 u8 fla_valid_mask;
76 struct chp_id chpid[8];
77 u16 fla[8];
78 };
79
80 struct chsc_scpd {
81 struct chsc_header request;
82 u32:2;
83 u32 m:1;
84 u32 c:1;
85 u32 fmt:4;
86 u32 cssid:8;
87 u32:4;
88 u32 rfmt:4;
89 u32 first_chpid:8;
90 u32:24;
91 u32 last_chpid:8;
92 u32 zeroes1;
93 struct chsc_header response;
94 u8 data[PAGE_SIZE - 20];
95 } __attribute__ ((packed));
96
97
98 extern int chsc_get_ssd_info(struct subchannel_id schid,
99 struct chsc_ssd_info *ssd);
100 extern int chsc_determine_css_characteristics(void);
101 extern int chsc_init(void);
102 extern void chsc_init_cleanup(void);
103
104 extern int chsc_enable_facility(int);
105 struct channel_subsystem;
106 extern int chsc_secm(struct channel_subsystem *, int);
107 int __chsc_do_secm(struct channel_subsystem *css, int enable);
108
109 int chsc_chp_vary(struct chp_id chpid, int on);
110 int chsc_determine_channel_path_desc(struct chp_id chpid, int fmt, int rfmt,
111 int c, int m, void *page);
112 int chsc_determine_base_channel_path_desc(struct chp_id chpid,
113 struct channel_path_desc *desc);
114 int chsc_determine_fmt1_channel_path_desc(struct chp_id chpid,
115 struct channel_path_desc_fmt1 *desc);
116 void chsc_chp_online(struct chp_id chpid);
117 void chsc_chp_offline(struct chp_id chpid);
118 int chsc_get_channel_measurement_chars(struct channel_path *chp);
119
120 int chsc_error_from_response(int response);
121
122 int chsc_siosl(struct subchannel_id schid);
123
124 /* Functions and definitions to query storage-class memory. */
125 struct sale {
126 u64 sa;
127 u32 p:4;
128 u32 op_state:4;
129 u32 data_state:4;
130 u32 rank:4;
131 u32 r:1;
132 u32:7;
133 u32 rid:8;
134 u32:32;
135 } __packed;
136
137 struct chsc_scm_info {
138 struct chsc_header request;
139 u32:32;
140 u64 reqtok;
141 u32 reserved1[4];
142 struct chsc_header response;
143 u64:56;
144 u8 rq;
145 u32 mbc;
146 u64 msa;
147 u16 is;
148 u16 mmc;
149 u32 mci;
150 u64 nr_scm_ini;
151 u64 nr_scm_unini;
152 u32 reserved2[10];
153 u64 restok;
154 struct sale scmal[248];
155 } __packed;
156
157 int chsc_scm_info(struct chsc_scm_info *scm_area, u64 token);
158
159 #ifdef CONFIG_SCM_BUS
160 int scm_update_information(void);
161 int scm_process_availability_information(void);
162 #else /* CONFIG_SCM_BUS */
163 static inline int scm_update_information(void) { return 0; }
164 static inline int scm_process_availability_information(void) { return 0; }
165 #endif /* CONFIG_SCM_BUS */
166
167
168 #endif