chsc.h 4.9 KB

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