xref: /linux/arch/s390/include/asm/diag.h (revision b5a6b71b1901b9ca495f669c9ad86f2181960aba)
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 
36*b5a6b71bSMartin Schwidefsky void diag_stat_inc(enum diag_stat_enum nr);
37*b5a6b71bSMartin 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 
81c6557e7fSMartin Schwidefsky #endif /* _ASM_S390_DIAG_H */
82