chsc.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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 : 19;
  57. }__attribute__((packed));
  58. extern struct css_chsc_char css_chsc_characteristics;
  59. struct chsc_ssd_info {
  60. u8 path_mask;
  61. u8 fla_valid_mask;
  62. struct chp_id chpid[8];
  63. u16 fla[8];
  64. };
  65. struct chsc_ssqd_area {
  66. struct chsc_header request;
  67. u16:10;
  68. u8 ssid:2;
  69. u8 fmt:4;
  70. u16 first_sch;
  71. u16:16;
  72. u16 last_sch;
  73. u32:32;
  74. struct chsc_header response;
  75. u32:32;
  76. struct qdio_ssqd_desc qdio_ssqd;
  77. } __packed;
  78. struct chsc_scpd {
  79. struct chsc_header request;
  80. u32:2;
  81. u32 m:1;
  82. u32 c:1;
  83. u32 fmt:4;
  84. u32 cssid:8;
  85. u32:4;
  86. u32 rfmt:4;
  87. u32 first_chpid:8;
  88. u32:24;
  89. u32 last_chpid:8;
  90. u32 zeroes1;
  91. struct chsc_header response;
  92. u8 data[PAGE_SIZE - 20];
  93. } __attribute__ ((packed));
  94. extern int chsc_get_ssd_info(struct subchannel_id schid,
  95. struct chsc_ssd_info *ssd);
  96. extern int chsc_determine_css_characteristics(void);
  97. extern int chsc_init(void);
  98. extern void chsc_init_cleanup(void);
  99. extern int chsc_enable_facility(int);
  100. struct channel_subsystem;
  101. extern int chsc_secm(struct channel_subsystem *, int);
  102. int __chsc_do_secm(struct channel_subsystem *css, int enable);
  103. int chsc_chp_vary(struct chp_id chpid, int on);
  104. int chsc_determine_channel_path_desc(struct chp_id chpid, int fmt, int rfmt,
  105. int c, int m, void *page);
  106. int chsc_determine_base_channel_path_desc(struct chp_id chpid,
  107. struct channel_path_desc *desc);
  108. int chsc_determine_fmt1_channel_path_desc(struct chp_id chpid,
  109. struct channel_path_desc_fmt1 *desc);
  110. void chsc_chp_online(struct chp_id chpid);
  111. void chsc_chp_offline(struct chp_id chpid);
  112. int chsc_get_channel_measurement_chars(struct channel_path *chp);
  113. int chsc_ssqd(struct subchannel_id schid, struct chsc_ssqd_area *ssqd);
  114. int chsc_error_from_response(int response);
  115. int chsc_siosl(struct subchannel_id schid);
  116. /* Functions and definitions to query storage-class memory. */
  117. struct sale {
  118. u64 sa;
  119. u32 p:4;
  120. u32 op_state:4;
  121. u32 data_state:4;
  122. u32 rank:4;
  123. u32 r:1;
  124. u32:7;
  125. u32 rid:8;
  126. u32:32;
  127. } __packed;
  128. struct chsc_scm_info {
  129. struct chsc_header request;
  130. u32:32;
  131. u64 reqtok;
  132. u32 reserved1[4];
  133. struct chsc_header response;
  134. u64:56;
  135. u8 rq;
  136. u32 mbc;
  137. u64 msa;
  138. u16 is;
  139. u16 mmc;
  140. u32 mci;
  141. u64 nr_scm_ini;
  142. u64 nr_scm_unini;
  143. u32 reserved2[10];
  144. u64 restok;
  145. struct sale scmal[248];
  146. } __packed;
  147. int chsc_scm_info(struct chsc_scm_info *scm_area, u64 token);
  148. #ifdef CONFIG_SCM_BUS
  149. int scm_update_information(void);
  150. int scm_process_availability_information(void);
  151. #else /* CONFIG_SCM_BUS */
  152. static inline int scm_update_information(void) { return 0; }
  153. static inline int scm_process_availability_information(void) { return 0; }
  154. #endif /* CONFIG_SCM_BUS */
  155. #endif