xref: /linux/arch/s390/include/asm/qdio.h (revision bbd50e172f75b1d12ef9b1bcf593b51a44199016)
1c6557e7fSMartin Schwidefsky /*
2c6557e7fSMartin Schwidefsky  * linux/include/asm-s390/qdio.h
3c6557e7fSMartin Schwidefsky  *
4c6557e7fSMartin Schwidefsky  * Copyright 2000,2008 IBM Corp.
5c6557e7fSMartin Schwidefsky  * Author(s): Utz Bacher <utz.bacher@de.ibm.com>
6c6557e7fSMartin Schwidefsky  *	      Jan Glauber <jang@linux.vnet.ibm.com>
7c6557e7fSMartin Schwidefsky  *
8c6557e7fSMartin Schwidefsky  */
9c6557e7fSMartin Schwidefsky #ifndef __QDIO_H__
10c6557e7fSMartin Schwidefsky #define __QDIO_H__
11c6557e7fSMartin Schwidefsky 
12c6557e7fSMartin Schwidefsky #include <linux/interrupt.h>
13c6557e7fSMartin Schwidefsky #include <asm/cio.h>
14c6557e7fSMartin Schwidefsky #include <asm/ccwdev.h>
15c6557e7fSMartin Schwidefsky 
16c6557e7fSMartin Schwidefsky #define QDIO_MAX_QUEUES_PER_IRQ		32
17c6557e7fSMartin Schwidefsky #define QDIO_MAX_BUFFERS_PER_Q		128
18c6557e7fSMartin Schwidefsky #define QDIO_MAX_BUFFERS_MASK		(QDIO_MAX_BUFFERS_PER_Q - 1)
19c6557e7fSMartin Schwidefsky #define QDIO_MAX_ELEMENTS_PER_BUFFER	16
20c6557e7fSMartin Schwidefsky #define QDIO_SBAL_SIZE			256
21c6557e7fSMartin Schwidefsky 
22c6557e7fSMartin Schwidefsky #define QDIO_QETH_QFMT			0
23c6557e7fSMartin Schwidefsky #define QDIO_ZFCP_QFMT			1
24c6557e7fSMartin Schwidefsky #define QDIO_IQDIO_QFMT			2
25c6557e7fSMartin Schwidefsky 
26c6557e7fSMartin Schwidefsky /**
27c6557e7fSMartin Schwidefsky  * struct qdesfmt0 - queue descriptor, format 0
28c6557e7fSMartin Schwidefsky  * @sliba: storage list information block address
29c6557e7fSMartin Schwidefsky  * @sla: storage list address
30c6557e7fSMartin Schwidefsky  * @slsba: storage list state block address
31c6557e7fSMartin Schwidefsky  * @akey: access key for DLIB
32c6557e7fSMartin Schwidefsky  * @bkey: access key for SL
33c6557e7fSMartin Schwidefsky  * @ckey: access key for SBALs
34c6557e7fSMartin Schwidefsky  * @dkey: access key for SLSB
35c6557e7fSMartin Schwidefsky  */
36c6557e7fSMartin Schwidefsky struct qdesfmt0 {
37c6557e7fSMartin Schwidefsky 	u64 sliba;
38c6557e7fSMartin Schwidefsky 	u64 sla;
39c6557e7fSMartin Schwidefsky 	u64 slsba;
40c6557e7fSMartin Schwidefsky 	u32	 : 32;
41c6557e7fSMartin Schwidefsky 	u32 akey : 4;
42c6557e7fSMartin Schwidefsky 	u32 bkey : 4;
43c6557e7fSMartin Schwidefsky 	u32 ckey : 4;
44c6557e7fSMartin Schwidefsky 	u32 dkey : 4;
45c6557e7fSMartin Schwidefsky 	u32	 : 16;
46c6557e7fSMartin Schwidefsky } __attribute__ ((packed));
47c6557e7fSMartin Schwidefsky 
48c6557e7fSMartin Schwidefsky /**
49c6557e7fSMartin Schwidefsky  * struct qdr - queue description record (QDR)
50c6557e7fSMartin Schwidefsky  * @qfmt: queue format
51c6557e7fSMartin Schwidefsky  * @pfmt: implementation dependent parameter format
52c6557e7fSMartin Schwidefsky  * @ac: adapter characteristics
53c6557e7fSMartin Schwidefsky  * @iqdcnt: input queue descriptor count
54c6557e7fSMartin Schwidefsky  * @oqdcnt: output queue descriptor count
55c6557e7fSMartin Schwidefsky  * @iqdsz: inpout queue descriptor size
56c6557e7fSMartin Schwidefsky  * @oqdsz: output queue descriptor size
57c6557e7fSMartin Schwidefsky  * @qiba: queue information block address
58c6557e7fSMartin Schwidefsky  * @qkey: queue information block key
59c6557e7fSMartin Schwidefsky  * @qdf0: queue descriptions
60c6557e7fSMartin Schwidefsky  */
61c6557e7fSMartin Schwidefsky struct qdr {
62c6557e7fSMartin Schwidefsky 	u32 qfmt   : 8;
63c6557e7fSMartin Schwidefsky 	u32 pfmt   : 8;
64c6557e7fSMartin Schwidefsky 	u32	   : 8;
65c6557e7fSMartin Schwidefsky 	u32 ac	   : 8;
66c6557e7fSMartin Schwidefsky 	u32	   : 8;
67c6557e7fSMartin Schwidefsky 	u32 iqdcnt : 8;
68c6557e7fSMartin Schwidefsky 	u32	   : 8;
69c6557e7fSMartin Schwidefsky 	u32 oqdcnt : 8;
70c6557e7fSMartin Schwidefsky 	u32	   : 8;
71c6557e7fSMartin Schwidefsky 	u32 iqdsz  : 8;
72c6557e7fSMartin Schwidefsky 	u32	   : 8;
73c6557e7fSMartin Schwidefsky 	u32 oqdsz  : 8;
74c6557e7fSMartin Schwidefsky 	/* private: */
75c6557e7fSMartin Schwidefsky 	u32 res[9];
76c6557e7fSMartin Schwidefsky 	/* public: */
77c6557e7fSMartin Schwidefsky 	u64 qiba;
78c6557e7fSMartin Schwidefsky 	u32	   : 32;
79c6557e7fSMartin Schwidefsky 	u32 qkey   : 4;
80c6557e7fSMartin Schwidefsky 	u32	   : 28;
81c6557e7fSMartin Schwidefsky 	struct qdesfmt0 qdf0[126];
82c6557e7fSMartin Schwidefsky } __attribute__ ((packed, aligned(4096)));
83c6557e7fSMartin Schwidefsky 
84c6557e7fSMartin Schwidefsky #define QIB_AC_OUTBOUND_PCI_SUPPORTED	0x40
85c6557e7fSMartin Schwidefsky #define QIB_RFLAGS_ENABLE_QEBSM		0x80
86c6557e7fSMartin Schwidefsky 
87c6557e7fSMartin Schwidefsky /**
88c6557e7fSMartin Schwidefsky  * struct qib - queue information block (QIB)
89c6557e7fSMartin Schwidefsky  * @qfmt: queue format
90c6557e7fSMartin Schwidefsky  * @pfmt: implementation dependent parameter format
91c6557e7fSMartin Schwidefsky  * @rflags: QEBSM
92c6557e7fSMartin Schwidefsky  * @ac: adapter characteristics
93c6557e7fSMartin Schwidefsky  * @isliba: absolute address of first input SLIB
94c6557e7fSMartin Schwidefsky  * @osliba: absolute address of first output SLIB
95c6557e7fSMartin Schwidefsky  * @ebcnam: adapter identifier in EBCDIC
96c6557e7fSMartin Schwidefsky  * @parm: implementation dependent parameters
97c6557e7fSMartin Schwidefsky  */
98c6557e7fSMartin Schwidefsky struct qib {
99c6557e7fSMartin Schwidefsky 	u32 qfmt   : 8;
100c6557e7fSMartin Schwidefsky 	u32 pfmt   : 8;
101c6557e7fSMartin Schwidefsky 	u32 rflags : 8;
102c6557e7fSMartin Schwidefsky 	u32 ac	   : 8;
103c6557e7fSMartin Schwidefsky 	u32	   : 32;
104c6557e7fSMartin Schwidefsky 	u64 isliba;
105c6557e7fSMartin Schwidefsky 	u64 osliba;
106c6557e7fSMartin Schwidefsky 	u32	   : 32;
107c6557e7fSMartin Schwidefsky 	u32	   : 32;
108c6557e7fSMartin Schwidefsky 	u8 ebcnam[8];
109c6557e7fSMartin Schwidefsky 	/* private: */
110c6557e7fSMartin Schwidefsky 	u8 res[88];
111c6557e7fSMartin Schwidefsky 	/* public: */
112c6557e7fSMartin Schwidefsky 	u8 parm[QDIO_MAX_BUFFERS_PER_Q];
113c6557e7fSMartin Schwidefsky } __attribute__ ((packed, aligned(256)));
114c6557e7fSMartin Schwidefsky 
115c6557e7fSMartin Schwidefsky /**
116c6557e7fSMartin Schwidefsky  * struct slibe - storage list information block element (SLIBE)
117c6557e7fSMartin Schwidefsky  * @parms: implementation dependent parameters
118c6557e7fSMartin Schwidefsky  */
119c6557e7fSMartin Schwidefsky struct slibe {
120c6557e7fSMartin Schwidefsky 	u64 parms;
121c6557e7fSMartin Schwidefsky };
122c6557e7fSMartin Schwidefsky 
123c6557e7fSMartin Schwidefsky /**
124c6557e7fSMartin Schwidefsky  * struct slib - storage list information block (SLIB)
125c6557e7fSMartin Schwidefsky  * @nsliba: next SLIB address (if any)
126c6557e7fSMartin Schwidefsky  * @sla: SL address
127c6557e7fSMartin Schwidefsky  * @slsba: SLSB address
128c6557e7fSMartin Schwidefsky  * @slibe: SLIB elements
129c6557e7fSMartin Schwidefsky  */
130c6557e7fSMartin Schwidefsky struct slib {
131c6557e7fSMartin Schwidefsky 	u64 nsliba;
132c6557e7fSMartin Schwidefsky 	u64 sla;
133c6557e7fSMartin Schwidefsky 	u64 slsba;
134c6557e7fSMartin Schwidefsky 	/* private: */
135c6557e7fSMartin Schwidefsky 	u8 res[1000];
136c6557e7fSMartin Schwidefsky 	/* public: */
137c6557e7fSMartin Schwidefsky 	struct slibe slibe[QDIO_MAX_BUFFERS_PER_Q];
138c6557e7fSMartin Schwidefsky } __attribute__ ((packed, aligned(2048)));
139c6557e7fSMartin Schwidefsky 
140c6557e7fSMartin Schwidefsky /**
141c6557e7fSMartin Schwidefsky  * struct sbal_flags - storage block address list flags
142c6557e7fSMartin Schwidefsky  * @last: last entry
143c6557e7fSMartin Schwidefsky  * @cont: contiguous storage
144c6557e7fSMartin Schwidefsky  * @frag: fragmentation
145c6557e7fSMartin Schwidefsky  */
146c6557e7fSMartin Schwidefsky struct sbal_flags {
147c6557e7fSMartin Schwidefsky 	u8	: 1;
148c6557e7fSMartin Schwidefsky 	u8 last : 1;
149c6557e7fSMartin Schwidefsky 	u8 cont : 1;
150c6557e7fSMartin Schwidefsky 	u8	: 1;
151c6557e7fSMartin Schwidefsky 	u8 frag : 2;
152c6557e7fSMartin Schwidefsky 	u8	: 2;
153c6557e7fSMartin Schwidefsky } __attribute__ ((packed));
154c6557e7fSMartin Schwidefsky 
155c6557e7fSMartin Schwidefsky #define SBAL_FLAGS_FIRST_FRAG		0x04000000UL
156c6557e7fSMartin Schwidefsky #define SBAL_FLAGS_MIDDLE_FRAG		0x08000000UL
157c6557e7fSMartin Schwidefsky #define SBAL_FLAGS_LAST_FRAG		0x0c000000UL
158c6557e7fSMartin Schwidefsky #define SBAL_FLAGS_LAST_ENTRY		0x40000000UL
159c6557e7fSMartin Schwidefsky #define SBAL_FLAGS_CONTIGUOUS		0x20000000UL
160c6557e7fSMartin Schwidefsky 
161c6557e7fSMartin Schwidefsky #define SBAL_FLAGS0_DATA_CONTINUATION	0x20UL
162c6557e7fSMartin Schwidefsky 
163c6557e7fSMartin Schwidefsky /* Awesome OpenFCP extensions */
164c6557e7fSMartin Schwidefsky #define SBAL_FLAGS0_TYPE_STATUS		0x00UL
165c6557e7fSMartin Schwidefsky #define SBAL_FLAGS0_TYPE_WRITE		0x08UL
166c6557e7fSMartin Schwidefsky #define SBAL_FLAGS0_TYPE_READ		0x10UL
167c6557e7fSMartin Schwidefsky #define SBAL_FLAGS0_TYPE_WRITE_READ	0x18UL
168c6557e7fSMartin Schwidefsky #define SBAL_FLAGS0_MORE_SBALS		0x04UL
169c6557e7fSMartin Schwidefsky #define SBAL_FLAGS0_COMMAND		0x02UL
170c6557e7fSMartin Schwidefsky #define SBAL_FLAGS0_LAST_SBAL		0x00UL
171c6557e7fSMartin Schwidefsky #define SBAL_FLAGS0_ONLY_SBAL		SBAL_FLAGS0_COMMAND
172c6557e7fSMartin Schwidefsky #define SBAL_FLAGS0_MIDDLE_SBAL		SBAL_FLAGS0_MORE_SBALS
173c6557e7fSMartin Schwidefsky #define SBAL_FLAGS0_FIRST_SBAL SBAL_FLAGS0_MORE_SBALS | SBAL_FLAGS0_COMMAND
174c6557e7fSMartin Schwidefsky #define SBAL_FLAGS0_PCI			0x40
175c6557e7fSMartin Schwidefsky 
176c6557e7fSMartin Schwidefsky /**
177c6557e7fSMartin Schwidefsky  * struct sbal_sbalf_0 - sbal flags for sbale 0
178c6557e7fSMartin Schwidefsky  * @pci: PCI indicator
179c6557e7fSMartin Schwidefsky  * @cont: data continuation
180c6557e7fSMartin Schwidefsky  * @sbtype: storage-block type (FCP)
181c6557e7fSMartin Schwidefsky  */
182c6557e7fSMartin Schwidefsky struct sbal_sbalf_0 {
183c6557e7fSMartin Schwidefsky 	u8	  : 1;
184c6557e7fSMartin Schwidefsky 	u8 pci	  : 1;
185c6557e7fSMartin Schwidefsky 	u8 cont   : 1;
186c6557e7fSMartin Schwidefsky 	u8 sbtype : 2;
187c6557e7fSMartin Schwidefsky 	u8	  : 3;
188c6557e7fSMartin Schwidefsky } __attribute__ ((packed));
189c6557e7fSMartin Schwidefsky 
190c6557e7fSMartin Schwidefsky /**
191c6557e7fSMartin Schwidefsky  * struct sbal_sbalf_1 - sbal flags for sbale 1
192c6557e7fSMartin Schwidefsky  * @key: storage key
193c6557e7fSMartin Schwidefsky  */
194c6557e7fSMartin Schwidefsky struct sbal_sbalf_1 {
195c6557e7fSMartin Schwidefsky 	u8     : 4;
196c6557e7fSMartin Schwidefsky 	u8 key : 4;
197c6557e7fSMartin Schwidefsky } __attribute__ ((packed));
198c6557e7fSMartin Schwidefsky 
199c6557e7fSMartin Schwidefsky /**
200c6557e7fSMartin Schwidefsky  * struct sbal_sbalf_14 - sbal flags for sbale 14
201c6557e7fSMartin Schwidefsky  * @erridx: error index
202c6557e7fSMartin Schwidefsky  */
203c6557e7fSMartin Schwidefsky struct sbal_sbalf_14 {
204c6557e7fSMartin Schwidefsky 	u8	  : 4;
205c6557e7fSMartin Schwidefsky 	u8 erridx : 4;
206c6557e7fSMartin Schwidefsky } __attribute__ ((packed));
207c6557e7fSMartin Schwidefsky 
208c6557e7fSMartin Schwidefsky /**
209c6557e7fSMartin Schwidefsky  * struct sbal_sbalf_15 - sbal flags for sbale 15
210c6557e7fSMartin Schwidefsky  * @reason: reason for error state
211c6557e7fSMartin Schwidefsky  */
212c6557e7fSMartin Schwidefsky struct sbal_sbalf_15 {
213c6557e7fSMartin Schwidefsky 	u8 reason;
214c6557e7fSMartin Schwidefsky } __attribute__ ((packed));
215c6557e7fSMartin Schwidefsky 
216c6557e7fSMartin Schwidefsky /**
217c6557e7fSMartin Schwidefsky  * union sbal_sbalf - storage block address list flags
218c6557e7fSMartin Schwidefsky  * @i0: sbalf0
219c6557e7fSMartin Schwidefsky  * @i1: sbalf1
220c6557e7fSMartin Schwidefsky  * @i14: sbalf14
221c6557e7fSMartin Schwidefsky  * @i15: sblaf15
222c6557e7fSMartin Schwidefsky  * @value: raw value
223c6557e7fSMartin Schwidefsky  */
224c6557e7fSMartin Schwidefsky union sbal_sbalf {
225c6557e7fSMartin Schwidefsky 	struct sbal_sbalf_0  i0;
226c6557e7fSMartin Schwidefsky 	struct sbal_sbalf_1  i1;
227c6557e7fSMartin Schwidefsky 	struct sbal_sbalf_14 i14;
228c6557e7fSMartin Schwidefsky 	struct sbal_sbalf_15 i15;
229c6557e7fSMartin Schwidefsky 	u8 value;
230c6557e7fSMartin Schwidefsky };
231c6557e7fSMartin Schwidefsky 
232c6557e7fSMartin Schwidefsky /**
233c6557e7fSMartin Schwidefsky  * struct qdio_buffer_element - SBAL entry
234c6557e7fSMartin Schwidefsky  * @flags: flags
235c6557e7fSMartin Schwidefsky  * @length: length
236c6557e7fSMartin Schwidefsky  * @addr: address
237c6557e7fSMartin Schwidefsky */
238c6557e7fSMartin Schwidefsky struct qdio_buffer_element {
239c6557e7fSMartin Schwidefsky 	u32 flags;
240c6557e7fSMartin Schwidefsky 	u32 length;
241c6557e7fSMartin Schwidefsky #ifdef CONFIG_32BIT
242c6557e7fSMartin Schwidefsky 	/* private: */
243c6557e7fSMartin Schwidefsky 	void *reserved;
244c6557e7fSMartin Schwidefsky 	/* public: */
245c6557e7fSMartin Schwidefsky #endif
246c6557e7fSMartin Schwidefsky 	void *addr;
247c6557e7fSMartin Schwidefsky } __attribute__ ((packed, aligned(16)));
248c6557e7fSMartin Schwidefsky 
249c6557e7fSMartin Schwidefsky /**
250c6557e7fSMartin Schwidefsky  * struct qdio_buffer - storage block address list (SBAL)
251c6557e7fSMartin Schwidefsky  * @element: SBAL entries
252c6557e7fSMartin Schwidefsky  */
253c6557e7fSMartin Schwidefsky struct qdio_buffer {
254c6557e7fSMartin Schwidefsky 	struct qdio_buffer_element element[QDIO_MAX_ELEMENTS_PER_BUFFER];
255c6557e7fSMartin Schwidefsky } __attribute__ ((packed, aligned(256)));
256c6557e7fSMartin Schwidefsky 
257c6557e7fSMartin Schwidefsky /**
258c6557e7fSMartin Schwidefsky  * struct sl_element - storage list entry
259c6557e7fSMartin Schwidefsky  * @sbal: absolute SBAL address
260c6557e7fSMartin Schwidefsky  */
261c6557e7fSMartin Schwidefsky struct sl_element {
262c6557e7fSMartin Schwidefsky #ifdef CONFIG_32BIT
263c6557e7fSMartin Schwidefsky 	/* private: */
264c6557e7fSMartin Schwidefsky 	unsigned long reserved;
265c6557e7fSMartin Schwidefsky 	/* public: */
266c6557e7fSMartin Schwidefsky #endif
267c6557e7fSMartin Schwidefsky 	unsigned long sbal;
268c6557e7fSMartin Schwidefsky } __attribute__ ((packed));
269c6557e7fSMartin Schwidefsky 
270c6557e7fSMartin Schwidefsky /**
271c6557e7fSMartin Schwidefsky  * struct sl - storage list (SL)
272c6557e7fSMartin Schwidefsky  * @element: SL entries
273c6557e7fSMartin Schwidefsky  */
274c6557e7fSMartin Schwidefsky struct sl {
275c6557e7fSMartin Schwidefsky 	struct sl_element element[QDIO_MAX_BUFFERS_PER_Q];
276c6557e7fSMartin Schwidefsky } __attribute__ ((packed, aligned(1024)));
277c6557e7fSMartin Schwidefsky 
278c6557e7fSMartin Schwidefsky /**
279c6557e7fSMartin Schwidefsky  * struct slsb - storage list state block (SLSB)
280c6557e7fSMartin Schwidefsky  * @val: state per buffer
281c6557e7fSMartin Schwidefsky  */
282c6557e7fSMartin Schwidefsky struct slsb {
283c6557e7fSMartin Schwidefsky 	u8 val[QDIO_MAX_BUFFERS_PER_Q];
284c6557e7fSMartin Schwidefsky } __attribute__ ((packed, aligned(256)));
285c6557e7fSMartin Schwidefsky 
286c6557e7fSMartin Schwidefsky struct qdio_ssqd_desc {
287c6557e7fSMartin Schwidefsky 	u8 flags;
288c6557e7fSMartin Schwidefsky 	u8:8;
289c6557e7fSMartin Schwidefsky 	u16 sch;
290c6557e7fSMartin Schwidefsky 	u8 qfmt;
291c6557e7fSMartin Schwidefsky 	u8 parm;
292c6557e7fSMartin Schwidefsky 	u8 qdioac1;
293c6557e7fSMartin Schwidefsky 	u8 sch_class;
294c6557e7fSMartin Schwidefsky 	u8 pcnt;
295c6557e7fSMartin Schwidefsky 	u8 icnt;
296c6557e7fSMartin Schwidefsky 	u8:8;
297c6557e7fSMartin Schwidefsky 	u8 ocnt;
298c6557e7fSMartin Schwidefsky 	u8:8;
299c6557e7fSMartin Schwidefsky 	u8 mbccnt;
300c6557e7fSMartin Schwidefsky 	u16 qdioac2;
301c6557e7fSMartin Schwidefsky 	u64 sch_token;
3027a0f4755SKlaus-Dieter Wacker 	u8 mro;
3037a0f4755SKlaus-Dieter Wacker 	u8 mri;
3047a0f4755SKlaus-Dieter Wacker 	u8:8;
3057a0f4755SKlaus-Dieter Wacker 	u8 sbalic;
3067a0f4755SKlaus-Dieter Wacker 	u16:16;
3077a0f4755SKlaus-Dieter Wacker 	u8:8;
3087a0f4755SKlaus-Dieter Wacker 	u8 mmwc;
309c6557e7fSMartin Schwidefsky } __attribute__ ((packed));
310c6557e7fSMartin Schwidefsky 
311c6557e7fSMartin Schwidefsky /* params are: ccw_device, qdio_error, queue_number,
312c6557e7fSMartin Schwidefsky    first element processed, number of elements processed, int_parm */
313c6557e7fSMartin Schwidefsky typedef void qdio_handler_t(struct ccw_device *, unsigned int, int,
314c6557e7fSMartin Schwidefsky 			    int, int, unsigned long);
315c6557e7fSMartin Schwidefsky 
316c6557e7fSMartin Schwidefsky /* qdio errors reported to the upper-layer program */
317c6557e7fSMartin Schwidefsky #define QDIO_ERROR_SIGA_ACCESS_EXCEPTION	0x10
318c6557e7fSMartin Schwidefsky #define QDIO_ERROR_SIGA_BUSY			0x20
319c6557e7fSMartin Schwidefsky #define QDIO_ERROR_ACTIVATE_CHECK_CONDITION	0x40
320c6557e7fSMartin Schwidefsky #define QDIO_ERROR_SLSB_STATE			0x80
321c6557e7fSMartin Schwidefsky 
322c6557e7fSMartin Schwidefsky /* for qdio_initialize */
323c6557e7fSMartin Schwidefsky #define QDIO_INBOUND_0COPY_SBALS		0x01
324c6557e7fSMartin Schwidefsky #define QDIO_OUTBOUND_0COPY_SBALS		0x02
325c6557e7fSMartin Schwidefsky #define QDIO_USE_OUTBOUND_PCIS			0x04
326c6557e7fSMartin Schwidefsky 
327c6557e7fSMartin Schwidefsky /* for qdio_cleanup */
328c6557e7fSMartin Schwidefsky #define QDIO_FLAG_CLEANUP_USING_CLEAR		0x01
329c6557e7fSMartin Schwidefsky #define QDIO_FLAG_CLEANUP_USING_HALT		0x02
330c6557e7fSMartin Schwidefsky 
331c6557e7fSMartin Schwidefsky /**
332c6557e7fSMartin Schwidefsky  * struct qdio_initialize - qdio initalization data
333c6557e7fSMartin Schwidefsky  * @cdev: associated ccw device
334c6557e7fSMartin Schwidefsky  * @q_format: queue format
335c6557e7fSMartin Schwidefsky  * @adapter_name: name for the adapter
336c6557e7fSMartin Schwidefsky  * @qib_param_field_format: format for qib_parm_field
337c6557e7fSMartin Schwidefsky  * @qib_param_field: pointer to 128 bytes or NULL, if no param field
338c6557e7fSMartin Schwidefsky  * @input_slib_elements: pointer to no_input_qs * 128 words of data or NULL
339c6557e7fSMartin Schwidefsky  * @output_slib_elements: pointer to no_output_qs * 128 words of data or NULL
340c6557e7fSMartin Schwidefsky  * @no_input_qs: number of input queues
341c6557e7fSMartin Schwidefsky  * @no_output_qs: number of output queues
342c6557e7fSMartin Schwidefsky  * @input_handler: handler to be called for input queues
343c6557e7fSMartin Schwidefsky  * @output_handler: handler to be called for output queues
344c6557e7fSMartin Schwidefsky  * @int_parm: interruption parameter
345c6557e7fSMartin Schwidefsky  * @flags: initialization flags
346c6557e7fSMartin Schwidefsky  * @input_sbal_addr_array:  address of no_input_qs * 128 pointers
347c6557e7fSMartin Schwidefsky  * @output_sbal_addr_array: address of no_output_qs * 128 pointers
348c6557e7fSMartin Schwidefsky  */
349c6557e7fSMartin Schwidefsky struct qdio_initialize {
350c6557e7fSMartin Schwidefsky 	struct ccw_device *cdev;
351c6557e7fSMartin Schwidefsky 	unsigned char q_format;
352c6557e7fSMartin Schwidefsky 	unsigned char adapter_name[8];
353c6557e7fSMartin Schwidefsky 	unsigned int qib_param_field_format;
354c6557e7fSMartin Schwidefsky 	unsigned char *qib_param_field;
355c6557e7fSMartin Schwidefsky 	unsigned long *input_slib_elements;
356c6557e7fSMartin Schwidefsky 	unsigned long *output_slib_elements;
357c6557e7fSMartin Schwidefsky 	unsigned int no_input_qs;
358c6557e7fSMartin Schwidefsky 	unsigned int no_output_qs;
359c6557e7fSMartin Schwidefsky 	qdio_handler_t *input_handler;
360c6557e7fSMartin Schwidefsky 	qdio_handler_t *output_handler;
361c6557e7fSMartin Schwidefsky 	unsigned long int_parm;
362c6557e7fSMartin Schwidefsky 	unsigned long flags;
363c6557e7fSMartin Schwidefsky 	void **input_sbal_addr_array;
364c6557e7fSMartin Schwidefsky 	void **output_sbal_addr_array;
365c6557e7fSMartin Schwidefsky };
366c6557e7fSMartin Schwidefsky 
367c6557e7fSMartin Schwidefsky #define QDIO_STATE_INACTIVE		0x00000002 /* after qdio_cleanup */
368c6557e7fSMartin Schwidefsky #define QDIO_STATE_ESTABLISHED		0x00000004 /* after qdio_establish */
369c6557e7fSMartin Schwidefsky #define QDIO_STATE_ACTIVE		0x00000008 /* after qdio_activate */
370c6557e7fSMartin Schwidefsky #define QDIO_STATE_STOPPED		0x00000010 /* after queues went down */
371c6557e7fSMartin Schwidefsky 
372c6557e7fSMartin Schwidefsky #define QDIO_FLAG_SYNC_INPUT		0x01
373c6557e7fSMartin Schwidefsky #define QDIO_FLAG_SYNC_OUTPUT		0x02
374c6557e7fSMartin Schwidefsky #define QDIO_FLAG_PCI_OUT		0x10
375c6557e7fSMartin Schwidefsky 
376*bbd50e17SJan Glauber extern int qdio_initialize(struct qdio_initialize *);
377*bbd50e17SJan Glauber extern int qdio_allocate(struct qdio_initialize *);
378*bbd50e17SJan Glauber extern int qdio_establish(struct qdio_initialize *);
379c6557e7fSMartin Schwidefsky extern int qdio_activate(struct ccw_device *);
380c6557e7fSMartin Schwidefsky 
381*bbd50e17SJan Glauber extern int do_QDIO(struct ccw_device *cdev, unsigned int callflags,
382*bbd50e17SJan Glauber 		   int q_nr, int bufnr, int count);
383*bbd50e17SJan Glauber extern int qdio_cleanup(struct ccw_device*, int);
384*bbd50e17SJan Glauber extern int qdio_shutdown(struct ccw_device*, int);
385c6557e7fSMartin Schwidefsky extern int qdio_free(struct ccw_device *);
386*bbd50e17SJan Glauber extern int qdio_get_ssqd_desc(struct ccw_device *dev, struct qdio_ssqd_desc*);
387c6557e7fSMartin Schwidefsky 
388c6557e7fSMartin Schwidefsky #endif /* __QDIO_H__ */
389