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