diag.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. /*
  2. * s390 diagnose functions
  3. *
  4. * Copyright IBM Corp. 2007
  5. * Author(s): Michael Holzheu <holzheu@de.ibm.com>
  6. */
  7. #ifndef _ASM_S390_DIAG_H
  8. #define _ASM_S390_DIAG_H
  9. #include <linux/percpu.h>
  10. enum diag_stat_enum {
  11. DIAG_STAT_X008,
  12. DIAG_STAT_X00C,
  13. DIAG_STAT_X010,
  14. DIAG_STAT_X014,
  15. DIAG_STAT_X044,
  16. DIAG_STAT_X064,
  17. DIAG_STAT_X09C,
  18. DIAG_STAT_X0DC,
  19. DIAG_STAT_X204,
  20. DIAG_STAT_X210,
  21. DIAG_STAT_X224,
  22. DIAG_STAT_X250,
  23. DIAG_STAT_X258,
  24. DIAG_STAT_X288,
  25. DIAG_STAT_X2C4,
  26. DIAG_STAT_X2FC,
  27. DIAG_STAT_X304,
  28. DIAG_STAT_X308,
  29. DIAG_STAT_X500,
  30. NR_DIAG_STAT
  31. };
  32. void diag_stat_inc(enum diag_stat_enum nr);
  33. void diag_stat_inc_norecursion(enum diag_stat_enum nr);
  34. /*
  35. * Diagnose 10: Release page range
  36. */
  37. static inline void diag10_range(unsigned long start_pfn, unsigned long num_pfn)
  38. {
  39. unsigned long start_addr, end_addr;
  40. start_addr = start_pfn << PAGE_SHIFT;
  41. end_addr = (start_pfn + num_pfn - 1) << PAGE_SHIFT;
  42. diag_stat_inc(DIAG_STAT_X010);
  43. asm volatile(
  44. "0: diag %0,%1,0x10\n"
  45. "1: nopr %%r7\n"
  46. EX_TABLE(0b, 1b)
  47. EX_TABLE(1b, 1b)
  48. : : "a" (start_addr), "a" (end_addr));
  49. }
  50. /*
  51. * Diagnose 14: Input spool file manipulation
  52. */
  53. extern int diag14(unsigned long rx, unsigned long ry1, unsigned long subcode);
  54. /*
  55. * Diagnose 210: Get information about a virtual device
  56. */
  57. struct diag210 {
  58. u16 vrdcdvno; /* device number (input) */
  59. u16 vrdclen; /* data block length (input) */
  60. u8 vrdcvcla; /* virtual device class (output) */
  61. u8 vrdcvtyp; /* virtual device type (output) */
  62. u8 vrdcvsta; /* virtual device status (output) */
  63. u8 vrdcvfla; /* virtual device flags (output) */
  64. u8 vrdcrccl; /* real device class (output) */
  65. u8 vrdccrty; /* real device type (output) */
  66. u8 vrdccrmd; /* real device model (output) */
  67. u8 vrdccrft; /* real device feature (output) */
  68. } __attribute__((packed, aligned(4)));
  69. extern int diag210(struct diag210 *addr);
  70. /* bit is set in flags, when physical cpu info is included in diag 204 data */
  71. #define DIAG204_LPAR_PHYS_FLG 0x80
  72. #define DIAG204_LPAR_NAME_LEN 8 /* lpar name len in diag 204 data */
  73. #define DIAG204_CPU_NAME_LEN 16 /* type name len of cpus in diag224 name table */
  74. /* diag 204 subcodes */
  75. enum diag204_sc {
  76. DIAG204_SUBC_STIB4 = 4,
  77. DIAG204_SUBC_RSI = 5,
  78. DIAG204_SUBC_STIB6 = 6,
  79. DIAG204_SUBC_STIB7 = 7
  80. };
  81. /* The two available diag 204 data formats */
  82. enum diag204_format {
  83. DIAG204_INFO_SIMPLE = 0,
  84. DIAG204_INFO_EXT = 0x00010000
  85. };
  86. enum diag204_cpu_flags {
  87. DIAG204_CPU_ONLINE = 0x20,
  88. DIAG204_CPU_CAPPED = 0x40,
  89. };
  90. struct diag204_info_blk_hdr {
  91. __u8 npar;
  92. __u8 flags;
  93. __u16 tslice;
  94. __u16 phys_cpus;
  95. __u16 this_part;
  96. __u64 curtod;
  97. } __packed;
  98. struct diag204_x_info_blk_hdr {
  99. __u8 npar;
  100. __u8 flags;
  101. __u16 tslice;
  102. __u16 phys_cpus;
  103. __u16 this_part;
  104. __u64 curtod1;
  105. __u64 curtod2;
  106. char reserved[40];
  107. } __packed;
  108. struct diag204_part_hdr {
  109. __u8 pn;
  110. __u8 cpus;
  111. char reserved[6];
  112. char part_name[DIAG204_LPAR_NAME_LEN];
  113. } __packed;
  114. struct diag204_x_part_hdr {
  115. __u8 pn;
  116. __u8 cpus;
  117. __u8 rcpus;
  118. __u8 pflag;
  119. __u32 mlu;
  120. char part_name[DIAG204_LPAR_NAME_LEN];
  121. char lpc_name[8];
  122. char os_name[8];
  123. __u64 online_cs;
  124. __u64 online_es;
  125. __u8 upid;
  126. __u8 reserved:3;
  127. __u8 mtid:5;
  128. char reserved1[2];
  129. __u32 group_mlu;
  130. char group_name[8];
  131. char hardware_group_name[8];
  132. char reserved2[24];
  133. } __packed;
  134. struct diag204_cpu_info {
  135. __u16 cpu_addr;
  136. char reserved1[2];
  137. __u8 ctidx;
  138. __u8 cflag;
  139. __u16 weight;
  140. __u64 acc_time;
  141. __u64 lp_time;
  142. } __packed;
  143. struct diag204_x_cpu_info {
  144. __u16 cpu_addr;
  145. char reserved1[2];
  146. __u8 ctidx;
  147. __u8 cflag;
  148. __u16 weight;
  149. __u64 acc_time;
  150. __u64 lp_time;
  151. __u16 min_weight;
  152. __u16 cur_weight;
  153. __u16 max_weight;
  154. char reseved2[2];
  155. __u64 online_time;
  156. __u64 wait_time;
  157. __u32 pma_weight;
  158. __u32 polar_weight;
  159. __u32 cpu_type_cap;
  160. __u32 group_cpu_type_cap;
  161. char reserved3[32];
  162. } __packed;
  163. struct diag204_phys_hdr {
  164. char reserved1[1];
  165. __u8 cpus;
  166. char reserved2[6];
  167. char mgm_name[8];
  168. } __packed;
  169. struct diag204_x_phys_hdr {
  170. char reserved1[1];
  171. __u8 cpus;
  172. char reserved2[6];
  173. char mgm_name[8];
  174. char reserved3[80];
  175. } __packed;
  176. struct diag204_phys_cpu {
  177. __u16 cpu_addr;
  178. char reserved1[2];
  179. __u8 ctidx;
  180. char reserved2[3];
  181. __u64 mgm_time;
  182. char reserved3[8];
  183. } __packed;
  184. struct diag204_x_phys_cpu {
  185. __u16 cpu_addr;
  186. char reserved1[2];
  187. __u8 ctidx;
  188. char reserved2[1];
  189. __u16 weight;
  190. __u64 mgm_time;
  191. char reserved3[80];
  192. } __packed;
  193. struct diag204_x_part_block {
  194. struct diag204_x_part_hdr hdr;
  195. struct diag204_x_cpu_info cpus[];
  196. } __packed;
  197. struct diag204_x_phys_block {
  198. struct diag204_x_phys_hdr hdr;
  199. struct diag204_x_phys_cpu cpus[];
  200. } __packed;
  201. int diag204(unsigned long subcode, unsigned long size, void *addr);
  202. int diag224(void *ptr);
  203. #endif /* _ASM_S390_DIAG_H */