1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  *    Copyright IBM Corp. 2013
4  *    Author(s): Ralf Hoppe (rhoppe@de.ibm.com)
5  */
6 
7 #ifndef _SCLP_DIAG_H
8 #define _SCLP_DIAG_H
9 
10 #include <linux/types.h>
11 
12 /* return codes for Diagnostic Test FTP Service, as indicated in member
13  * sclp_diag_ftp::ldflg
14  */
15 #define SCLP_DIAG_FTP_OK	0x80U /* success */
16 #define SCLP_DIAG_FTP_LDFAIL	0x01U /* load failed */
17 #define SCLP_DIAG_FTP_LDNPERM	0x02U /* not allowed */
18 #define SCLP_DIAG_FTP_LDRUNS	0x03U /* LD runs */
19 #define SCLP_DIAG_FTP_LDNRUNS	0x04U /* LD does not run */
20 
21 #define SCLP_DIAG_FTP_XPCX	0x80 /* PCX communication code */
22 #define SCLP_DIAG_FTP_ROUTE	4 /* routing code for new FTP service */
23 
24 /*
25  * length of Diagnostic Test FTP Service event buffer
26  */
27 #define SCLP_DIAG_FTP_EVBUF_LEN				\
28 	(offsetof(struct sclp_diag_evbuf, mdd) +	\
29 	 sizeof(struct sclp_diag_ftp))
30 
31 /**
32  * struct sclp_diag_ftp - Diagnostic Test FTP Service model-dependent data
33  * @pcx: code for PCX communication (should be 0x80)
34  * @ldflg: load flag (see defines above)
35  * @cmd: FTP command
36  * @pgsize: page size (0 = 4kB, 1 = large page size)
37  * @srcflg: source flag
38  * @spare: reserved (zeroes)
39  * @offset: file offset
40  * @fsize: file size
41  * @length: buffer size resp. bytes transferred
42  * @failaddr: failing address
43  * @bufaddr: buffer address, virtual
44  * @asce: region or segment table designation
45  * @fident: file name (ASCII, zero-terminated)
46  */
47 struct sclp_diag_ftp {
48 	u8 pcx;
49 	u8 ldflg;
50 	u8 cmd;
51 	u8 pgsize;
52 	u8 srcflg;
53 	u8 spare;
54 	u64 offset;
55 	u64 fsize;
56 	u64 length;
57 	u64 failaddr;
58 	u64 bufaddr;
59 	u64 asce;
60 
61 	u8 fident[256];
62 } __packed;
63 
64 /**
65  * struct sclp_diag_evbuf - Diagnostic Test (ET7) Event Buffer
66  * @hdr: event buffer header
67  * @route: diagnostic route
68  * @mdd: model-dependent data (@route dependent)
69  */
70 struct sclp_diag_evbuf {
71 	struct evbuf_header hdr;
72 	u16 route;
73 
74 	union {
75 		struct sclp_diag_ftp ftp;
76 	} mdd;
77 } __packed;
78 
79 /**
80  * struct sclp_diag_sccb - Diagnostic Test (ET7) SCCB
81  * @hdr: SCCB header
82  * @evbuf: event buffer
83  */
84 struct sclp_diag_sccb {
85 
86 	struct sccb_header hdr;
87 	struct sclp_diag_evbuf evbuf;
88 } __packed;
89 
90 #endif /* _SCLP_DIAG_H */
91