chsc.h 4.8 KB

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