chsc.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef S390_CHSC_H
  3. #define S390_CHSC_H
  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. #include <asm/qdio.h>
  11. #define CHSC_SDA_OC_MSS 0x2
  12. #define NR_MEASUREMENT_CHARS 5
  13. struct cmg_chars {
  14. u32 values[NR_MEASUREMENT_CHARS];
  15. };
  16. #define NR_MEASUREMENT_ENTRIES 8
  17. struct cmg_entry {
  18. u32 values[NR_MEASUREMENT_ENTRIES];
  19. };
  20. struct channel_path_desc_fmt1 {
  21. u8 flags;
  22. u8 lsn;
  23. u8 desc;
  24. u8 chpid;
  25. u32:24;
  26. u8 chpp;
  27. u32 unused[2];
  28. u16 chid;
  29. u32:16;
  30. u16 mdc;
  31. u16:13;
  32. u8 r:1;
  33. u8 s:1;
  34. u8 f:1;
  35. u32 zeros[2];
  36. };
  37. struct channel_path_desc_fmt3 {
  38. struct channel_path_desc_fmt1 fmt1_desc;
  39. u8 util_str[64];
  40. };
  41. struct channel_path;
  42. struct css_chsc_char {
  43. u64 res;
  44. u64 : 20;
  45. u32 secm : 1; /* bit 84 */
  46. u32 : 1;
  47. u32 scmc : 1; /* bit 86 */
  48. u32 : 20;
  49. u32 scssc : 1; /* bit 107 */
  50. u32 scsscf : 1; /* bit 108 */
  51. u32:7;
  52. u32 pnso:1; /* bit 116 */
  53. u32:11;
  54. } __packed;
  55. extern struct css_chsc_char css_chsc_characteristics;
  56. struct chsc_ssd_info {
  57. u8 path_mask;
  58. u8 fla_valid_mask;
  59. struct chp_id chpid[8];
  60. u16 fla[8];
  61. };
  62. struct chsc_ssqd_area {
  63. struct chsc_header request;
  64. u16:10;
  65. u8 ssid:2;
  66. u8 fmt:4;
  67. u16 first_sch;
  68. u16:16;
  69. u16 last_sch;
  70. u32:32;
  71. struct chsc_header response;
  72. u32:32;
  73. struct qdio_ssqd_desc qdio_ssqd;
  74. } __packed __aligned(PAGE_SIZE);
  75. struct chsc_scssc_area {
  76. struct chsc_header request;
  77. u16 operation_code;
  78. u16:16;
  79. u32:32;
  80. u32:32;
  81. u64 summary_indicator_addr;
  82. u64 subchannel_indicator_addr;
  83. u32 ks:4;
  84. u32 kc:4;
  85. u32:21;
  86. u32 isc:3;
  87. u32 word_with_d_bit;
  88. u32:32;
  89. struct subchannel_id schid;
  90. u32 reserved[1004];
  91. struct chsc_header response;
  92. u32:32;
  93. } __packed __aligned(PAGE_SIZE);
  94. struct chsc_scpd {
  95. struct chsc_header request;
  96. u32:2;
  97. u32 m:1;
  98. u32 c:1;
  99. u32 fmt:4;
  100. u32 cssid:8;
  101. u32:4;
  102. u32 rfmt:4;
  103. u32 first_chpid:8;
  104. u32:24;
  105. u32 last_chpid:8;
  106. u32 zeroes1;
  107. struct chsc_header response;
  108. u32:32;
  109. u8 data[0];
  110. } __packed __aligned(PAGE_SIZE);
  111. struct chsc_sda_area {
  112. struct chsc_header request;
  113. u8 :4;
  114. u8 format:4;
  115. u8 :8;
  116. u16 operation_code;
  117. u32 :32;
  118. u32 :32;
  119. u32 operation_data_area[252];
  120. struct chsc_header response;
  121. u32 :4;
  122. u32 format2:4;
  123. u32 :24;
  124. } __packed __aligned(PAGE_SIZE);
  125. extern int chsc_get_ssd_info(struct subchannel_id schid,
  126. struct chsc_ssd_info *ssd);
  127. extern int chsc_determine_css_characteristics(void);
  128. extern int chsc_init(void);
  129. extern void chsc_init_cleanup(void);
  130. int __chsc_enable_facility(struct chsc_sda_area *sda_area, int operation_code);
  131. extern int chsc_enable_facility(int);
  132. struct channel_subsystem;
  133. extern int chsc_secm(struct channel_subsystem *, int);
  134. int __chsc_do_secm(struct channel_subsystem *css, int enable);
  135. int chsc_chp_vary(struct chp_id chpid, int on);
  136. int chsc_determine_channel_path_desc(struct chp_id chpid, int fmt, int rfmt,
  137. int c, int m, void *page);
  138. int chsc_determine_fmt0_channel_path_desc(struct chp_id chpid,
  139. struct channel_path_desc_fmt0 *desc);
  140. int chsc_determine_fmt1_channel_path_desc(struct chp_id chpid,
  141. struct channel_path_desc_fmt1 *desc);
  142. int chsc_determine_fmt3_channel_path_desc(struct chp_id chpid,
  143. struct channel_path_desc_fmt3 *desc);
  144. void chsc_chp_online(struct chp_id chpid);
  145. void chsc_chp_offline(struct chp_id chpid);
  146. int chsc_get_channel_measurement_chars(struct channel_path *chp);
  147. int chsc_ssqd(struct subchannel_id schid, struct chsc_ssqd_area *ssqd);
  148. int chsc_sadc(struct subchannel_id schid, struct chsc_scssc_area *scssc,
  149. u64 summary_indicator_addr, u64 subchannel_indicator_addr);
  150. int chsc_error_from_response(int response);
  151. int chsc_siosl(struct subchannel_id schid);
  152. /* Functions and definitions to query storage-class memory. */
  153. struct sale {
  154. u64 sa;
  155. u32 p:4;
  156. u32 op_state:4;
  157. u32 data_state:4;
  158. u32 rank:4;
  159. u32 r:1;
  160. u32:7;
  161. u32 rid:8;
  162. u32:32;
  163. } __packed;
  164. struct chsc_scm_info {
  165. struct chsc_header request;
  166. u32:32;
  167. u64 reqtok;
  168. u32 reserved1[4];
  169. struct chsc_header response;
  170. u64:56;
  171. u8 rq;
  172. u32 mbc;
  173. u64 msa;
  174. u16 is;
  175. u16 mmc;
  176. u32 mci;
  177. u64 nr_scm_ini;
  178. u64 nr_scm_unini;
  179. u32 reserved2[10];
  180. u64 restok;
  181. struct sale scmal[248];
  182. } __packed __aligned(PAGE_SIZE);
  183. int chsc_scm_info(struct chsc_scm_info *scm_area, u64 token);
  184. struct chsc_brinfo_resume_token {
  185. u64 t1;
  186. u64 t2;
  187. } __packed;
  188. struct chsc_brinfo_naihdr {
  189. struct chsc_brinfo_resume_token resume_token;
  190. u32:32;
  191. u32 instance;
  192. u32:24;
  193. u8 naids;
  194. u32 reserved[3];
  195. } __packed;
  196. struct chsc_pnso_area {
  197. struct chsc_header request;
  198. u8:2;
  199. u8 m:1;
  200. u8:5;
  201. u8:2;
  202. u8 ssid:2;
  203. u8 fmt:4;
  204. u16 sch;
  205. u8:8;
  206. u8 cssid;
  207. u16:16;
  208. u8 oc;
  209. u32:24;
  210. struct chsc_brinfo_resume_token resume_token;
  211. u32 n:1;
  212. u32:31;
  213. u32 reserved[3];
  214. struct chsc_header response;
  215. u32:32;
  216. struct chsc_brinfo_naihdr naihdr;
  217. union {
  218. struct qdio_brinfo_entry_l3_ipv6 l3_ipv6[0];
  219. struct qdio_brinfo_entry_l3_ipv4 l3_ipv4[0];
  220. struct qdio_brinfo_entry_l2 l2[0];
  221. } entries;
  222. } __packed __aligned(PAGE_SIZE);
  223. int chsc_pnso_brinfo(struct subchannel_id schid,
  224. struct chsc_pnso_area *brinfo_area,
  225. struct chsc_brinfo_resume_token resume_token,
  226. int cnc);
  227. int __init chsc_get_cssid(int idx);
  228. #ifdef CONFIG_SCM_BUS
  229. int scm_update_information(void);
  230. int scm_process_availability_information(void);
  231. #else /* CONFIG_SCM_BUS */
  232. static inline int scm_update_information(void) { return 0; }
  233. static inline int scm_process_availability_information(void) { return 0; }
  234. #endif /* CONFIG_SCM_BUS */
  235. #endif