chsc.h 5.1 KB

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