chsc.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  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. u8 data[PAGE_SIZE - 20];
  104. } __attribute__ ((packed));
  105. struct chsc_sda_area {
  106. struct chsc_header request;
  107. u8 :4;
  108. u8 format:4;
  109. u8 :8;
  110. u16 operation_code;
  111. u32 :32;
  112. u32 :32;
  113. u32 operation_data_area[252];
  114. struct chsc_header response;
  115. u32 :4;
  116. u32 format2:4;
  117. u32 :24;
  118. } __packed __aligned(PAGE_SIZE);
  119. extern int chsc_get_ssd_info(struct subchannel_id schid,
  120. struct chsc_ssd_info *ssd);
  121. extern int chsc_determine_css_characteristics(void);
  122. extern int chsc_init(void);
  123. extern void chsc_init_cleanup(void);
  124. int __chsc_enable_facility(struct chsc_sda_area *sda_area, int operation_code);
  125. extern int chsc_enable_facility(int);
  126. struct channel_subsystem;
  127. extern int chsc_secm(struct channel_subsystem *, int);
  128. int __chsc_do_secm(struct channel_subsystem *css, int enable);
  129. int chsc_chp_vary(struct chp_id chpid, int on);
  130. int chsc_determine_channel_path_desc(struct chp_id chpid, int fmt, int rfmt,
  131. int c, int m, void *page);
  132. int chsc_determine_base_channel_path_desc(struct chp_id chpid,
  133. struct channel_path_desc *desc);
  134. int chsc_determine_fmt1_channel_path_desc(struct chp_id chpid,
  135. struct channel_path_desc_fmt1 *desc);
  136. void chsc_chp_online(struct chp_id chpid);
  137. void chsc_chp_offline(struct chp_id chpid);
  138. int chsc_get_channel_measurement_chars(struct channel_path *chp);
  139. int chsc_ssqd(struct subchannel_id schid, struct chsc_ssqd_area *ssqd);
  140. int chsc_sadc(struct subchannel_id schid, struct chsc_scssc_area *scssc,
  141. u64 summary_indicator_addr, u64 subchannel_indicator_addr);
  142. int chsc_error_from_response(int response);
  143. int chsc_siosl(struct subchannel_id schid);
  144. /* Functions and definitions to query storage-class memory. */
  145. struct sale {
  146. u64 sa;
  147. u32 p:4;
  148. u32 op_state:4;
  149. u32 data_state:4;
  150. u32 rank:4;
  151. u32 r:1;
  152. u32:7;
  153. u32 rid:8;
  154. u32:32;
  155. } __packed;
  156. struct chsc_scm_info {
  157. struct chsc_header request;
  158. u32:32;
  159. u64 reqtok;
  160. u32 reserved1[4];
  161. struct chsc_header response;
  162. u64:56;
  163. u8 rq;
  164. u32 mbc;
  165. u64 msa;
  166. u16 is;
  167. u16 mmc;
  168. u32 mci;
  169. u64 nr_scm_ini;
  170. u64 nr_scm_unini;
  171. u32 reserved2[10];
  172. u64 restok;
  173. struct sale scmal[248];
  174. } __packed;
  175. int chsc_scm_info(struct chsc_scm_info *scm_area, u64 token);
  176. struct chsc_brinfo_resume_token {
  177. u64 t1;
  178. u64 t2;
  179. } __packed;
  180. struct chsc_brinfo_naihdr {
  181. struct chsc_brinfo_resume_token resume_token;
  182. u32:32;
  183. u32 instance;
  184. u32:24;
  185. u8 naids;
  186. u32 reserved[3];
  187. } __packed;
  188. struct chsc_pnso_area {
  189. struct chsc_header request;
  190. u8:2;
  191. u8 m:1;
  192. u8:5;
  193. u8:2;
  194. u8 ssid:2;
  195. u8 fmt:4;
  196. u16 sch;
  197. u8:8;
  198. u8 cssid;
  199. u16:16;
  200. u8 oc;
  201. u32:24;
  202. struct chsc_brinfo_resume_token resume_token;
  203. u32 n:1;
  204. u32:31;
  205. u32 reserved[3];
  206. struct chsc_header response;
  207. u32:32;
  208. struct chsc_brinfo_naihdr naihdr;
  209. union {
  210. struct qdio_brinfo_entry_l3_ipv6 l3_ipv6[0];
  211. struct qdio_brinfo_entry_l3_ipv4 l3_ipv4[0];
  212. struct qdio_brinfo_entry_l2 l2[0];
  213. } entries;
  214. } __packed;
  215. int chsc_pnso_brinfo(struct subchannel_id schid,
  216. struct chsc_pnso_area *brinfo_area,
  217. struct chsc_brinfo_resume_token resume_token,
  218. int cnc);
  219. #ifdef CONFIG_SCM_BUS
  220. int scm_update_information(void);
  221. int scm_process_availability_information(void);
  222. #else /* CONFIG_SCM_BUS */
  223. static inline int scm_update_information(void) { return 0; }
  224. static inline int scm_process_availability_information(void) { return 0; }
  225. #endif /* CONFIG_SCM_BUS */
  226. #endif