chsc.h 4.9 KB

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