xref: /linux/arch/s390/include/asm/qdio.h (revision 32ddf3e124ee35b70c86e239b31d30827f993d3f)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2c6557e7fSMartin Schwidefsky /*
3a53c8fabSHeiko Carstens  * Copyright IBM Corp. 2000, 2008
4c6557e7fSMartin Schwidefsky  * Author(s): Utz Bacher <utz.bacher@de.ibm.com>
5c6557e7fSMartin Schwidefsky  *	      Jan Glauber <jang@linux.vnet.ibm.com>
6c6557e7fSMartin Schwidefsky  *
7c6557e7fSMartin Schwidefsky  */
8c6557e7fSMartin Schwidefsky #ifndef __QDIO_H__
9c6557e7fSMartin Schwidefsky #define __QDIO_H__
10c6557e7fSMartin Schwidefsky 
11c6557e7fSMartin Schwidefsky #include <linux/interrupt.h>
12c6557e7fSMartin Schwidefsky #include <asm/cio.h>
13c6557e7fSMartin Schwidefsky #include <asm/ccwdev.h>
14c6557e7fSMartin Schwidefsky 
15432ac5e0SJan Glauber /* only use 4 queues to save some cachelines */
16432ac5e0SJan Glauber #define QDIO_MAX_QUEUES_PER_IRQ		4
17c6557e7fSMartin Schwidefsky #define QDIO_MAX_BUFFERS_PER_Q		128
18c6557e7fSMartin Schwidefsky #define QDIO_MAX_BUFFERS_MASK		(QDIO_MAX_BUFFERS_PER_Q - 1)
19e53edf74SJulian Wiedmann #define QDIO_BUFNR(num)			((num) & QDIO_MAX_BUFFERS_MASK)
20c6557e7fSMartin Schwidefsky #define QDIO_MAX_ELEMENTS_PER_BUFFER	16
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
284d4a3caaSJulian Wiedmann  * @sliba: absolute address of storage list information block
294d4a3caaSJulian Wiedmann  * @sla: absolute address of storage list
304d4a3caaSJulian Wiedmann  * @slsba: absolute address of storage list state block
31d655e5b4SJulian Wiedmann  * @akey: access key for SLIB
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 
48dfe5bb50SSwen Schillig #define QDR_AC_MULTI_BUFFER_ENABLE 0x01
49dfe5bb50SSwen Schillig 
50c6557e7fSMartin Schwidefsky /**
51c6557e7fSMartin Schwidefsky  * struct qdr - queue description record (QDR)
52c6557e7fSMartin Schwidefsky  * @qfmt: queue format
53c6557e7fSMartin Schwidefsky  * @ac: adapter characteristics
54c6557e7fSMartin Schwidefsky  * @iqdcnt: input queue descriptor count
55c6557e7fSMartin Schwidefsky  * @oqdcnt: output queue descriptor count
56d655e5b4SJulian Wiedmann  * @iqdsz: input queue descriptor size
57c6557e7fSMartin Schwidefsky  * @oqdsz: output queue descriptor size
584d4a3caaSJulian Wiedmann  * @qiba: absolute address of queue information block
59c6557e7fSMartin Schwidefsky  * @qkey: queue information block key
60c6557e7fSMartin Schwidefsky  * @qdf0: queue descriptions
61c6557e7fSMartin Schwidefsky  */
62c6557e7fSMartin Schwidefsky struct qdr {
63c6557e7fSMartin Schwidefsky 	u32 qfmt   : 8;
64d655e5b4SJulian Wiedmann 	u32	   : 16;
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];
82f1c1174fSHeiko Carstens } __packed __aligned(PAGE_SIZE);
83c6557e7fSMartin Schwidefsky 
84c6557e7fSMartin Schwidefsky #define QIB_AC_OUTBOUND_PCI_SUPPORTED	0x40
85c6557e7fSMartin Schwidefsky #define QIB_RFLAGS_ENABLE_QEBSM		0x80
86dcc18f48SChristof Schmitt #define QIB_RFLAGS_ENABLE_DATA_DIV	0x02
87c6557e7fSMartin Schwidefsky 
88c6557e7fSMartin Schwidefsky /**
89c6557e7fSMartin Schwidefsky  * struct qib - queue information block (QIB)
90c6557e7fSMartin Schwidefsky  * @qfmt: queue format
91c6557e7fSMartin Schwidefsky  * @pfmt: implementation dependent parameter format
92c6557e7fSMartin Schwidefsky  * @rflags: QEBSM
93c6557e7fSMartin Schwidefsky  * @ac: adapter characteristics
94*32ddf3e1SJulian Wiedmann  * @isliba: logical address of first input SLIB
95*32ddf3e1SJulian Wiedmann  * @osliba: logical address of first output SLIB
96c6557e7fSMartin Schwidefsky  * @ebcnam: adapter identifier in EBCDIC
97c6557e7fSMartin Schwidefsky  * @parm: implementation dependent parameters
98c6557e7fSMartin Schwidefsky  */
99c6557e7fSMartin Schwidefsky struct qib {
100c6557e7fSMartin Schwidefsky 	u32 qfmt   : 8;
101c6557e7fSMartin Schwidefsky 	u32 pfmt   : 8;
102c6557e7fSMartin Schwidefsky 	u32 rflags : 8;
103c6557e7fSMartin Schwidefsky 	u32 ac	   : 8;
104c6557e7fSMartin Schwidefsky 	u32	   : 32;
105c6557e7fSMartin Schwidefsky 	u64 isliba;
106c6557e7fSMartin Schwidefsky 	u64 osliba;
107c6557e7fSMartin Schwidefsky 	u32	   : 32;
108c6557e7fSMartin Schwidefsky 	u32	   : 32;
109c6557e7fSMartin Schwidefsky 	u8 ebcnam[8];
110c6557e7fSMartin Schwidefsky 	/* private: */
111c6557e7fSMartin Schwidefsky 	u8 res[88];
112c6557e7fSMartin Schwidefsky 	/* public: */
1139f494438SJulian Wiedmann 	u8 parm[128];
114c6557e7fSMartin Schwidefsky } __attribute__ ((packed, aligned(256)));
115c6557e7fSMartin Schwidefsky 
116c6557e7fSMartin Schwidefsky /**
117c6557e7fSMartin Schwidefsky  * struct slibe - storage list information block element (SLIBE)
118c6557e7fSMartin Schwidefsky  * @parms: implementation dependent parameters
119c6557e7fSMartin Schwidefsky  */
120c6557e7fSMartin Schwidefsky struct slibe {
121c6557e7fSMartin Schwidefsky 	u64 parms;
122c6557e7fSMartin Schwidefsky };
123c6557e7fSMartin Schwidefsky 
124c6557e7fSMartin Schwidefsky /**
125104ea556Sfrank.blaschka@de.ibm.com  * struct qaob - queue asynchronous operation block
126104ea556Sfrank.blaschka@de.ibm.com  * @res0: reserved parameters
127104ea556Sfrank.blaschka@de.ibm.com  * @res1: reserved parameter
128104ea556Sfrank.blaschka@de.ibm.com  * @res2: reserved parameter
129104ea556Sfrank.blaschka@de.ibm.com  * @res3: reserved parameter
130104ea556Sfrank.blaschka@de.ibm.com  * @aorc: asynchronous operation return code
131104ea556Sfrank.blaschka@de.ibm.com  * @flags: internal flags
132104ea556Sfrank.blaschka@de.ibm.com  * @cbtbs: control block type
133104ea556Sfrank.blaschka@de.ibm.com  * @sb_count: number of storage blocks
134104ea556Sfrank.blaschka@de.ibm.com  * @sba: storage block element addresses
135104ea556Sfrank.blaschka@de.ibm.com  * @dcount: size of storage block elements
136104ea556Sfrank.blaschka@de.ibm.com  * @user0: user defineable value
137104ea556Sfrank.blaschka@de.ibm.com  * @res4: reserved paramater
138104ea556Sfrank.blaschka@de.ibm.com  * @user1: user defineable value
139104ea556Sfrank.blaschka@de.ibm.com  */
140104ea556Sfrank.blaschka@de.ibm.com struct qaob {
141104ea556Sfrank.blaschka@de.ibm.com 	u64 res0[6];
142104ea556Sfrank.blaschka@de.ibm.com 	u8 res1;
143104ea556Sfrank.blaschka@de.ibm.com 	u8 res2;
144104ea556Sfrank.blaschka@de.ibm.com 	u8 res3;
145104ea556Sfrank.blaschka@de.ibm.com 	u8 aorc;
146104ea556Sfrank.blaschka@de.ibm.com 	u8 flags;
147104ea556Sfrank.blaschka@de.ibm.com 	u16 cbtbs;
148104ea556Sfrank.blaschka@de.ibm.com 	u8 sb_count;
149104ea556Sfrank.blaschka@de.ibm.com 	u64 sba[QDIO_MAX_ELEMENTS_PER_BUFFER];
150104ea556Sfrank.blaschka@de.ibm.com 	u16 dcount[QDIO_MAX_ELEMENTS_PER_BUFFER];
151104ea556Sfrank.blaschka@de.ibm.com 	u64 user0;
152104ea556Sfrank.blaschka@de.ibm.com 	u64 res4[2];
153838e4cc8SJulian Wiedmann 	u8 user1[16];
154104ea556Sfrank.blaschka@de.ibm.com } __attribute__ ((packed, aligned(256)));
155104ea556Sfrank.blaschka@de.ibm.com 
156104ea556Sfrank.blaschka@de.ibm.com /**
157c6557e7fSMartin Schwidefsky  * struct slib - storage list information block (SLIB)
158c6557e7fSMartin Schwidefsky  * @nsliba: next SLIB address (if any)
159c6557e7fSMartin Schwidefsky  * @sla: SL address
160c6557e7fSMartin Schwidefsky  * @slsba: SLSB address
161c6557e7fSMartin Schwidefsky  * @slibe: SLIB elements
162c6557e7fSMartin Schwidefsky  */
163c6557e7fSMartin Schwidefsky struct slib {
164c6557e7fSMartin Schwidefsky 	u64 nsliba;
165c6557e7fSMartin Schwidefsky 	u64 sla;
166c6557e7fSMartin Schwidefsky 	u64 slsba;
167c6557e7fSMartin Schwidefsky 	/* private: */
168c6557e7fSMartin Schwidefsky 	u8 res[1000];
169c6557e7fSMartin Schwidefsky 	/* public: */
170c6557e7fSMartin Schwidefsky 	struct slibe slibe[QDIO_MAX_BUFFERS_PER_Q];
171c6557e7fSMartin Schwidefsky } __attribute__ ((packed, aligned(2048)));
172c6557e7fSMartin Schwidefsky 
1733ec90878SJan Glauber #define SBAL_EFLAGS_LAST_ENTRY		0x40
1743ec90878SJan Glauber #define SBAL_EFLAGS_CONTIGUOUS		0x20
1753ec90878SJan Glauber #define SBAL_EFLAGS_FIRST_FRAG		0x04
1763ec90878SJan Glauber #define SBAL_EFLAGS_MIDDLE_FRAG		0x08
1773ec90878SJan Glauber #define SBAL_EFLAGS_LAST_FRAG		0x0c
1783ec90878SJan Glauber #define SBAL_EFLAGS_MASK		0x6f
179c6557e7fSMartin Schwidefsky 
1803ec90878SJan Glauber #define SBAL_SFLAGS0_PCI_REQ		0x40
1813ec90878SJan Glauber #define SBAL_SFLAGS0_DATA_CONTINUATION	0x20
182c6557e7fSMartin Schwidefsky 
183c6557e7fSMartin Schwidefsky /* Awesome OpenFCP extensions */
1843ec90878SJan Glauber #define SBAL_SFLAGS0_TYPE_STATUS	0x00
1853ec90878SJan Glauber #define SBAL_SFLAGS0_TYPE_WRITE		0x08
1863ec90878SJan Glauber #define SBAL_SFLAGS0_TYPE_READ		0x10
1873ec90878SJan Glauber #define SBAL_SFLAGS0_TYPE_WRITE_READ	0x18
1883ec90878SJan Glauber #define SBAL_SFLAGS0_MORE_SBALS		0x04
1893ec90878SJan Glauber #define SBAL_SFLAGS0_COMMAND		0x02
1903ec90878SJan Glauber #define SBAL_SFLAGS0_LAST_SBAL		0x00
1913ec90878SJan Glauber #define SBAL_SFLAGS0_ONLY_SBAL		SBAL_SFLAGS0_COMMAND
1923ec90878SJan Glauber #define SBAL_SFLAGS0_MIDDLE_SBAL	SBAL_SFLAGS0_MORE_SBALS
1933ec90878SJan Glauber #define SBAL_SFLAGS0_FIRST_SBAL (SBAL_SFLAGS0_MORE_SBALS | SBAL_SFLAGS0_COMMAND)
194c6557e7fSMartin Schwidefsky 
195c6557e7fSMartin Schwidefsky /**
196c6557e7fSMartin Schwidefsky  * struct qdio_buffer_element - SBAL entry
1973ec90878SJan Glauber  * @eflags: SBAL entry flags
1983ec90878SJan Glauber  * @scount: SBAL count
1993ec90878SJan Glauber  * @sflags: whole SBAL flags
200c6557e7fSMartin Schwidefsky  * @length: length
2012db01da8SJulian Wiedmann  * @addr: absolute data address
202c6557e7fSMartin Schwidefsky */
203c6557e7fSMartin Schwidefsky struct qdio_buffer_element {
2043ec90878SJan Glauber 	u8 eflags;
2053ec90878SJan Glauber 	/* private: */
2063ec90878SJan Glauber 	u8 res1;
2073ec90878SJan Glauber 	/* public: */
2083ec90878SJan Glauber 	u8 scount;
2093ec90878SJan Glauber 	u8 sflags;
210c6557e7fSMartin Schwidefsky 	u32 length;
2112db01da8SJulian Wiedmann 	u64 addr;
212c6557e7fSMartin Schwidefsky } __attribute__ ((packed, aligned(16)));
213c6557e7fSMartin Schwidefsky 
214c6557e7fSMartin Schwidefsky /**
215c6557e7fSMartin Schwidefsky  * struct qdio_buffer - storage block address list (SBAL)
216c6557e7fSMartin Schwidefsky  * @element: SBAL entries
217c6557e7fSMartin Schwidefsky  */
218c6557e7fSMartin Schwidefsky struct qdio_buffer {
219c6557e7fSMartin Schwidefsky 	struct qdio_buffer_element element[QDIO_MAX_ELEMENTS_PER_BUFFER];
220c6557e7fSMartin Schwidefsky } __attribute__ ((packed, aligned(256)));
221c6557e7fSMartin Schwidefsky 
222c6557e7fSMartin Schwidefsky /**
223c6557e7fSMartin Schwidefsky  * struct sl_element - storage list entry
224c6557e7fSMartin Schwidefsky  * @sbal: absolute SBAL address
225c6557e7fSMartin Schwidefsky  */
226c6557e7fSMartin Schwidefsky struct sl_element {
227e9091ffdSJulian Wiedmann 	u64 sbal;
228c6557e7fSMartin Schwidefsky } __attribute__ ((packed));
229c6557e7fSMartin Schwidefsky 
230c6557e7fSMartin Schwidefsky /**
231c6557e7fSMartin Schwidefsky  * struct sl - storage list (SL)
232c6557e7fSMartin Schwidefsky  * @element: SL entries
233c6557e7fSMartin Schwidefsky  */
234c6557e7fSMartin Schwidefsky struct sl {
235c6557e7fSMartin Schwidefsky 	struct sl_element element[QDIO_MAX_BUFFERS_PER_Q];
236c6557e7fSMartin Schwidefsky } __attribute__ ((packed, aligned(1024)));
237c6557e7fSMartin Schwidefsky 
238c6557e7fSMartin Schwidefsky /**
239c6557e7fSMartin Schwidefsky  * struct slsb - storage list state block (SLSB)
240c6557e7fSMartin Schwidefsky  * @val: state per buffer
241c6557e7fSMartin Schwidefsky  */
242c6557e7fSMartin Schwidefsky struct slsb {
243c6557e7fSMartin Schwidefsky 	u8 val[QDIO_MAX_BUFFERS_PER_Q];
244c6557e7fSMartin Schwidefsky } __attribute__ ((packed, aligned(256)));
245c6557e7fSMartin Schwidefsky 
2469cb7284fSfrank.blaschka@de.ibm.com /* qdio adapter-characteristics-1 flag */
247396c1004SJulian Wiedmann #define CHSC_AC1_INITIATE_INPUTQ	0x80
2489cb7284fSfrank.blaschka@de.ibm.com #define AC1_SIGA_INPUT_NEEDED		0x40	/* process input queues */
2499cb7284fSfrank.blaschka@de.ibm.com #define AC1_SIGA_OUTPUT_NEEDED		0x20	/* process output queues */
2509cb7284fSfrank.blaschka@de.ibm.com #define AC1_SIGA_SYNC_NEEDED		0x10	/* ask hypervisor to sync */
2519cb7284fSfrank.blaschka@de.ibm.com #define AC1_AUTOMATIC_SYNC_ON_THININT	0x08	/* set by hypervisor */
2529cb7284fSfrank.blaschka@de.ibm.com #define AC1_AUTOMATIC_SYNC_ON_OUT_PCI	0x04	/* set by hypervisor */
2539cb7284fSfrank.blaschka@de.ibm.com #define AC1_SC_QEBSM_AVAILABLE		0x02	/* available for subchannel */
2549cb7284fSfrank.blaschka@de.ibm.com #define AC1_SC_QEBSM_ENABLED		0x01	/* enabled for subchannel */
2559cb7284fSfrank.blaschka@de.ibm.com 
256050276abSSteffen Maier #define CHSC_AC2_MULTI_BUFFER_AVAILABLE	0x0080
257050276abSSteffen Maier #define CHSC_AC2_MULTI_BUFFER_ENABLED	0x0040
258104ea556Sfrank.blaschka@de.ibm.com #define CHSC_AC2_DATA_DIV_AVAILABLE	0x0010
2591917b47dSJulian Wiedmann #define CHSC_AC2_SNIFFER_AVAILABLE	0x0008
260104ea556Sfrank.blaschka@de.ibm.com #define CHSC_AC2_DATA_DIV_ENABLED	0x0002
261104ea556Sfrank.blaschka@de.ibm.com 
262104ea556Sfrank.blaschka@de.ibm.com #define CHSC_AC3_FORMAT2_CQ_AVAILABLE	0x8000
263104ea556Sfrank.blaschka@de.ibm.com 
264c6557e7fSMartin Schwidefsky struct qdio_ssqd_desc {
265c6557e7fSMartin Schwidefsky 	u8 flags;
266c6557e7fSMartin Schwidefsky 	u8:8;
267c6557e7fSMartin Schwidefsky 	u16 sch;
268c6557e7fSMartin Schwidefsky 	u8 qfmt;
269c6557e7fSMartin Schwidefsky 	u8 parm;
270c6557e7fSMartin Schwidefsky 	u8 qdioac1;
271c6557e7fSMartin Schwidefsky 	u8 sch_class;
272c6557e7fSMartin Schwidefsky 	u8 pcnt;
273c6557e7fSMartin Schwidefsky 	u8 icnt;
274c6557e7fSMartin Schwidefsky 	u8:8;
275c6557e7fSMartin Schwidefsky 	u8 ocnt;
276c6557e7fSMartin Schwidefsky 	u8:8;
277c6557e7fSMartin Schwidefsky 	u8 mbccnt;
278c6557e7fSMartin Schwidefsky 	u16 qdioac2;
279c6557e7fSMartin Schwidefsky 	u64 sch_token;
2807a0f4755SKlaus-Dieter Wacker 	u8 mro;
2817a0f4755SKlaus-Dieter Wacker 	u8 mri;
282104ea556Sfrank.blaschka@de.ibm.com 	u16 qdioac3;
2837a0f4755SKlaus-Dieter Wacker 	u16:16;
2847a0f4755SKlaus-Dieter Wacker 	u8:8;
2857a0f4755SKlaus-Dieter Wacker 	u8 mmwc;
286c6557e7fSMartin Schwidefsky } __attribute__ ((packed));
287c6557e7fSMartin Schwidefsky 
288c6557e7fSMartin Schwidefsky /* params are: ccw_device, qdio_error, queue_number,
289c6557e7fSMartin Schwidefsky    first element processed, number of elements processed, int_parm */
290c6557e7fSMartin Schwidefsky typedef void qdio_handler_t(struct ccw_device *, unsigned int, int,
291c6557e7fSMartin Schwidefsky 			    int, int, unsigned long);
292c6557e7fSMartin Schwidefsky 
293bdfd740cSJulian Wiedmann /* qdio errors reported through the queue handlers: */
2941549d13fSJan Glauber #define QDIO_ERROR_ACTIVATE			0x0001
2951549d13fSJan Glauber #define QDIO_ERROR_GET_BUF_STATE		0x0002
2961549d13fSJan Glauber #define QDIO_ERROR_SET_BUF_STATE		0x0004
297bdfd740cSJulian Wiedmann 
298bdfd740cSJulian Wiedmann /* extra info for completed SBALs: */
2991549d13fSJan Glauber #define QDIO_ERROR_SLSB_STATE			0x0100
3007940eaf2SJulian Wiedmann #define QDIO_ERROR_SLSB_PENDING			0x0200
3011549d13fSJan Glauber 
302c6557e7fSMartin Schwidefsky /* for qdio_cleanup */
303c6557e7fSMartin Schwidefsky #define QDIO_FLAG_CLEANUP_USING_CLEAR		0x01
304c6557e7fSMartin Schwidefsky #define QDIO_FLAG_CLEANUP_USING_HALT		0x02
305c6557e7fSMartin Schwidefsky 
306c6557e7fSMartin Schwidefsky /**
307b4a96015SHendrik Brueckner  * struct qdio_initialize - qdio initialization data
308c6557e7fSMartin Schwidefsky  * @q_format: queue format
309d655e5b4SJulian Wiedmann  * @qdr_ac: feature flags to set
310c6557e7fSMartin Schwidefsky  * @qib_param_field_format: format for qib_parm_field
311c6557e7fSMartin Schwidefsky  * @qib_param_field: pointer to 128 bytes or NULL, if no param field
312dcc18f48SChristof Schmitt  * @qib_rflags: rflags to set
313c6557e7fSMartin Schwidefsky  * @no_input_qs: number of input queues
314c6557e7fSMartin Schwidefsky  * @no_output_qs: number of output queues
315513251feSJulian Wiedmann  * @input_handler: handler to be called for input queues, and device-wide errors
316c6557e7fSMartin Schwidefsky  * @output_handler: handler to be called for output queues
3171ecbcfd5SJulian Wiedmann  * @irq_poll: Data IRQ polling handler
318d655e5b4SJulian Wiedmann  * @scan_threshold: # of in-use buffers that triggers scan on output queue
319c6557e7fSMartin Schwidefsky  * @int_parm: interruption parameter
320d8564e19SJulian Wiedmann  * @input_sbal_addr_array:  per-queue array, each element points to 128 SBALs
321d8564e19SJulian Wiedmann  * @output_sbal_addr_array: per-queue array, each element points to 128 SBALs
322c6557e7fSMartin Schwidefsky  */
323c6557e7fSMartin Schwidefsky struct qdio_initialize {
324c6557e7fSMartin Schwidefsky 	unsigned char q_format;
325dfe5bb50SSwen Schillig 	unsigned char qdr_ac;
326c6557e7fSMartin Schwidefsky 	unsigned int qib_param_field_format;
327c6557e7fSMartin Schwidefsky 	unsigned char *qib_param_field;
328dcc18f48SChristof Schmitt 	unsigned char qib_rflags;
329c6557e7fSMartin Schwidefsky 	unsigned int no_input_qs;
330c6557e7fSMartin Schwidefsky 	unsigned int no_output_qs;
331c6557e7fSMartin Schwidefsky 	qdio_handler_t *input_handler;
332c6557e7fSMartin Schwidefsky 	qdio_handler_t *output_handler;
3330a6e6345SJulian Wiedmann 	void (*irq_poll)(struct ccw_device *cdev, unsigned long data);
334c6557e7fSMartin Schwidefsky 	unsigned long int_parm;
335d8564e19SJulian Wiedmann 	struct qdio_buffer ***input_sbal_addr_array;
336d8564e19SJulian Wiedmann 	struct qdio_buffer ***output_sbal_addr_array;
337c6557e7fSMartin Schwidefsky };
338c6557e7fSMartin Schwidefsky 
3395245c924SSebastian Ott int qdio_alloc_buffers(struct qdio_buffer **buf, unsigned int count);
3405245c924SSebastian Ott void qdio_free_buffers(struct qdio_buffer **buf, unsigned int count);
3415245c924SSebastian Ott void qdio_reset_buffers(struct qdio_buffer **buf, unsigned int count);
3425245c924SSebastian Ott 
3433db1db93SJulian Wiedmann extern int qdio_allocate(struct ccw_device *cdev, unsigned int no_input_qs,
3443db1db93SJulian Wiedmann 			 unsigned int no_output_qs);
3451da1092dSJulian Wiedmann extern int qdio_establish(struct ccw_device *cdev,
3461da1092dSJulian Wiedmann 			  struct qdio_initialize *init_data);
347c6557e7fSMartin Schwidefsky extern int qdio_activate(struct ccw_device *);
3480a6e6345SJulian Wiedmann extern int qdio_start_irq(struct ccw_device *cdev);
3490a6e6345SJulian Wiedmann extern int qdio_stop_irq(struct ccw_device *cdev);
350b44995e5SJulian Wiedmann extern int qdio_inspect_input_queue(struct ccw_device *cdev, unsigned int nr,
351b44995e5SJulian Wiedmann 				    unsigned int *bufnr, unsigned int *error);
352b44995e5SJulian Wiedmann extern int qdio_inspect_output_queue(struct ccw_device *cdev, unsigned int nr,
353b44995e5SJulian Wiedmann 				     unsigned int *bufnr, unsigned int *error);
354a60bffe5SJulian Wiedmann extern int qdio_add_bufs_to_input_queue(struct ccw_device *cdev,
355a60bffe5SJulian Wiedmann 					unsigned int q_nr, unsigned int bufnr,
356a60bffe5SJulian Wiedmann 					unsigned int count);
357a60bffe5SJulian Wiedmann extern int qdio_add_bufs_to_output_queue(struct ccw_device *cdev,
358a60bffe5SJulian Wiedmann 					 unsigned int q_nr, unsigned int bufnr,
359a60bffe5SJulian Wiedmann 					 unsigned int count, struct qaob *aob);
360bbd50e17SJan Glauber extern int qdio_shutdown(struct ccw_device *, int);
361c6557e7fSMartin Schwidefsky extern int qdio_free(struct ccw_device *);
362d36deae7SJan Glauber extern int qdio_get_ssqd_desc(struct ccw_device *, struct qdio_ssqd_desc *);
363c6557e7fSMartin Schwidefsky 
364c6557e7fSMartin Schwidefsky #endif /* __QDIO_H__ */
365