chsc.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. #define CHSC_SDA_OC_MSS 0x2
  10. #define NR_MEASUREMENT_CHARS 5
  11. struct cmg_chars {
  12. u32 values[NR_MEASUREMENT_CHARS];
  13. } __attribute__ ((packed));
  14. #define NR_MEASUREMENT_ENTRIES 8
  15. struct cmg_entry {
  16. u32 values[NR_MEASUREMENT_ENTRIES];
  17. } __attribute__ ((packed));
  18. struct channel_path_desc {
  19. u8 flags;
  20. u8 lsn;
  21. u8 desc;
  22. u8 chpid;
  23. u8 swla;
  24. u8 zeroes;
  25. u8 chla;
  26. u8 chpp;
  27. } __attribute__ ((packed));
  28. struct channel_path_desc_fmt1 {
  29. u8 flags;
  30. u8 lsn;
  31. u8 desc;
  32. u8 chpid;
  33. u32:24;
  34. u8 chpp;
  35. u32 unused[2];
  36. u16 chid;
  37. u32:16;
  38. u16 mdc;
  39. u16:13;
  40. u8 r:1;
  41. u8 s:1;
  42. u8 f:1;
  43. u32 zeros[2];
  44. } __attribute__ ((packed));
  45. struct channel_path;
  46. struct css_chsc_char {
  47. u64 res;
  48. u64 : 20;
  49. u32 secm : 1; /* bit 84 */
  50. u32 : 1;
  51. u32 scmc : 1; /* bit 86 */
  52. u32 : 20;
  53. u32 scssc : 1; /* bit 107 */
  54. u32 scsscf : 1; /* bit 108 */
  55. u32 : 19;
  56. }__attribute__((packed));
  57. extern struct css_chsc_char css_chsc_characteristics;
  58. struct chsc_ssd_info {
  59. u8 path_mask;
  60. u8 fla_valid_mask;
  61. struct chp_id chpid[8];
  62. u16 fla[8];
  63. };
  64. struct chsc_scpd {
  65. struct chsc_header request;
  66. u32:2;
  67. u32 m:1;
  68. u32 c:1;
  69. u32 fmt:4;
  70. u32 cssid:8;
  71. u32:4;
  72. u32 rfmt:4;
  73. u32 first_chpid:8;
  74. u32:24;
  75. u32 last_chpid:8;
  76. u32 zeroes1;
  77. struct chsc_header response;
  78. u8 data[PAGE_SIZE - 20];
  79. } __attribute__ ((packed));
  80. extern int chsc_get_ssd_info(struct subchannel_id schid,
  81. struct chsc_ssd_info *ssd);
  82. extern int chsc_determine_css_characteristics(void);
  83. extern int chsc_init(void);
  84. extern void chsc_init_cleanup(void);
  85. extern int chsc_enable_facility(int);
  86. struct channel_subsystem;
  87. extern int chsc_secm(struct channel_subsystem *, int);
  88. int __chsc_do_secm(struct channel_subsystem *css, int enable);
  89. int chsc_chp_vary(struct chp_id chpid, int on);
  90. int chsc_determine_channel_path_desc(struct chp_id chpid, int fmt, int rfmt,
  91. int c, int m, void *page);
  92. int chsc_determine_base_channel_path_desc(struct chp_id chpid,
  93. struct channel_path_desc *desc);
  94. int chsc_determine_fmt1_channel_path_desc(struct chp_id chpid,
  95. struct channel_path_desc_fmt1 *desc);
  96. void chsc_chp_online(struct chp_id chpid);
  97. void chsc_chp_offline(struct chp_id chpid);
  98. int chsc_get_channel_measurement_chars(struct channel_path *chp);
  99. int chsc_error_from_response(int response);
  100. int chsc_siosl(struct subchannel_id schid);
  101. /* Functions and definitions to query storage-class memory. */
  102. struct sale {
  103. u64 sa;
  104. u32 p:4;
  105. u32 op_state:4;
  106. u32 data_state:4;
  107. u32 rank:4;
  108. u32 r:1;
  109. u32:7;
  110. u32 rid:8;
  111. u32:32;
  112. } __packed;
  113. struct chsc_scm_info {
  114. struct chsc_header request;
  115. u32:32;
  116. u64 reqtok;
  117. u32 reserved1[4];
  118. struct chsc_header response;
  119. u64:56;
  120. u8 rq;
  121. u32 mbc;
  122. u64 msa;
  123. u16 is;
  124. u16 mmc;
  125. u32 mci;
  126. u64 nr_scm_ini;
  127. u64 nr_scm_unini;
  128. u32 reserved2[10];
  129. u64 restok;
  130. struct sale scmal[248];
  131. } __packed;
  132. int chsc_scm_info(struct chsc_scm_info *scm_area, u64 token);
  133. #ifdef CONFIG_SCM_BUS
  134. int scm_update_information(void);
  135. int scm_process_availability_information(void);
  136. #else /* CONFIG_SCM_BUS */
  137. static inline int scm_update_information(void) { return 0; }
  138. static inline int scm_process_availability_information(void) { return 0; }
  139. #endif /* CONFIG_SCM_BUS */
  140. #endif