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