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