aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-s390/qdio.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-s390/qdio.h')
-rw-r--r--include/asm-s390/qdio.h646
1 files changed, 312 insertions, 334 deletions
diff --git a/include/asm-s390/qdio.h b/include/asm-s390/qdio.h
index 11240342a0f4..6813772171f2 100644
--- a/include/asm-s390/qdio.h
+++ b/include/asm-s390/qdio.h
@@ -1,404 +1,382 @@
1/* 1/*
2 * linux/include/asm-s390/qdio.h 2 * linux/include/asm-s390/qdio.h
3 * 3 *
4 * Linux for S/390 QDIO base support, Hipersocket base support 4 * Copyright 2000,2008 IBM Corp.
5 * version 2
6 *
7 * Copyright 2000,2002 IBM Corporation
8 * Author(s): Utz Bacher <utz.bacher@de.ibm.com> 5 * Author(s): Utz Bacher <utz.bacher@de.ibm.com>
6 * Jan Glauber <jang@linux.vnet.ibm.com>
9 * 7 *
10 */ 8 */
11#ifndef __QDIO_H__ 9#ifndef __QDIO_H__
12#define __QDIO_H__ 10#define __QDIO_H__
13 11
14/* note, that most of the typedef's are from ingo. */
15
16#include <linux/interrupt.h> 12#include <linux/interrupt.h>
17#include <asm/cio.h> 13#include <asm/cio.h>
18#include <asm/ccwdev.h> 14#include <asm/ccwdev.h>
19 15
20#define QDIO_NAME "qdio " 16#define QDIO_MAX_QUEUES_PER_IRQ 32
21 17#define QDIO_MAX_BUFFERS_PER_Q 128
22#ifndef __s390x__ 18#define QDIO_MAX_BUFFERS_MASK (QDIO_MAX_BUFFERS_PER_Q - 1)
23#define QDIO_32_BIT 19#define QDIO_MAX_ELEMENTS_PER_BUFFER 16
24#endif /* __s390x__ */ 20#define QDIO_SBAL_SIZE 256
25 21
26/**** CONSTANTS, that are relied on without using these symbols *****/ 22#define QDIO_QETH_QFMT 0
27#define QDIO_MAX_QUEUES_PER_IRQ 32 /* used in width of unsigned int */ 23#define QDIO_ZFCP_QFMT 1
28/************************ END of CONSTANTS **************************/ 24#define QDIO_IQDIO_QFMT 2
29#define QDIO_MAX_BUFFERS_PER_Q 128 /* must be a power of 2 (%x=&(x-1)*/ 25
30#define QDIO_BUF_ORDER 7 /* 2**this == number of pages used for sbals in 1 q */ 26/**
31#define QDIO_MAX_ELEMENTS_PER_BUFFER 16 27 * struct qdesfmt0 - queue descriptor, format 0
32#define SBAL_SIZE 256 28 * @sliba: storage list information block address
33 29 * @sla: storage list address
34#define QDIO_QETH_QFMT 0 30 * @slsba: storage list state block address
35#define QDIO_ZFCP_QFMT 1 31 * @akey: access key for DLIB
36#define QDIO_IQDIO_QFMT 2 32 * @bkey: access key for SL
37#define QDIO_IQDIO_QFMT_ASYNCH 3 33 * @ckey: access key for SBALs
38 34 * @dkey: access key for SLSB
39struct qdio_buffer_element{ 35 */
40 unsigned int flags;
41 unsigned int length;
42#ifdef QDIO_32_BIT
43 void *reserved;
44#endif /* QDIO_32_BIT */
45 void *addr;
46} __attribute__ ((packed,aligned(16)));
47
48struct qdio_buffer{
49 volatile struct qdio_buffer_element element[16];
50} __attribute__ ((packed,aligned(256)));
51
52
53/* params are: ccw_device, status, qdio_error, siga_error,
54 queue_number, first element processed, number of elements processed,
55 int_parm */
56typedef void qdio_handler_t(struct ccw_device *,unsigned int,unsigned int,
57 unsigned int,unsigned int,int,int,unsigned long);
58
59
60#define QDIO_STATUS_INBOUND_INT 0x01
61#define QDIO_STATUS_OUTBOUND_INT 0x02
62#define QDIO_STATUS_LOOK_FOR_ERROR 0x04
63#define QDIO_STATUS_MORE_THAN_ONE_QDIO_ERROR 0x08
64#define QDIO_STATUS_MORE_THAN_ONE_SIGA_ERROR 0x10
65#define QDIO_STATUS_ACTIVATE_CHECK_CONDITION 0x20
66
67#define QDIO_SIGA_ERROR_ACCESS_EXCEPTION 0x10
68#define QDIO_SIGA_ERROR_B_BIT_SET 0x20
69
70/* for qdio_initialize */
71#define QDIO_INBOUND_0COPY_SBALS 0x01
72#define QDIO_OUTBOUND_0COPY_SBALS 0x02
73#define QDIO_USE_OUTBOUND_PCIS 0x04
74
75/* for qdio_cleanup */
76#define QDIO_FLAG_CLEANUP_USING_CLEAR 0x01
77#define QDIO_FLAG_CLEANUP_USING_HALT 0x02
78
79struct qdio_initialize {
80 struct ccw_device *cdev;
81 unsigned char q_format;
82 unsigned char adapter_name[8];
83 unsigned int qib_param_field_format; /*adapter dependent*/
84 /* pointer to 128 bytes or NULL, if no param field */
85 unsigned char *qib_param_field; /* adapter dependent */
86 /* pointer to no_queues*128 words of data or NULL */
87 unsigned long *input_slib_elements;
88 unsigned long *output_slib_elements;
89 unsigned int min_input_threshold;
90 unsigned int max_input_threshold;
91 unsigned int min_output_threshold;
92 unsigned int max_output_threshold;
93 unsigned int no_input_qs;
94 unsigned int no_output_qs;
95 qdio_handler_t *input_handler;
96 qdio_handler_t *output_handler;
97 unsigned long int_parm;
98 unsigned long flags;
99 void **input_sbal_addr_array; /* addr of n*128 void ptrs */
100 void **output_sbal_addr_array; /* addr of n*128 void ptrs */
101};
102
103extern int qdio_initialize(struct qdio_initialize *init_data);
104extern int qdio_allocate(struct qdio_initialize *init_data);
105extern int qdio_establish(struct qdio_initialize *init_data);
106
107extern int qdio_activate(struct ccw_device *,int flags);
108
109#define QDIO_STATE_MUST_USE_OUTB_PCI 0x00000001
110#define QDIO_STATE_INACTIVE 0x00000002 /* after qdio_cleanup */
111#define QDIO_STATE_ESTABLISHED 0x00000004 /* after qdio_initialize */
112#define QDIO_STATE_ACTIVE 0x00000008 /* after qdio_activate */
113#define QDIO_STATE_STOPPED 0x00000010 /* after queues went down */
114extern unsigned long qdio_get_status(int irq);
115
116
117#define QDIO_FLAG_SYNC_INPUT 0x01
118#define QDIO_FLAG_SYNC_OUTPUT 0x02
119#define QDIO_FLAG_UNDER_INTERRUPT 0x04
120#define QDIO_FLAG_NO_INPUT_INTERRUPT_CONTEXT 0x08 /* no effect on
121 adapter interrupts */
122#define QDIO_FLAG_DONT_SIGA 0x10
123#define QDIO_FLAG_PCI_OUT 0x20
124
125extern int do_QDIO(struct ccw_device*, unsigned int flags,
126 unsigned int queue_number,
127 unsigned int qidx,unsigned int count,
128 struct qdio_buffer *buffers);
129
130extern int qdio_get_ssqd_pct(struct ccw_device*);
131extern int qdio_synchronize(struct ccw_device*, unsigned int flags,
132 unsigned int queue_number);
133
134extern int qdio_cleanup(struct ccw_device*, int how);
135extern int qdio_shutdown(struct ccw_device*, int how);
136extern int qdio_free(struct ccw_device*);
137
138unsigned char qdio_get_slsb_state(struct ccw_device*, unsigned int flag,
139 unsigned int queue_number,
140 unsigned int qidx);
141
142extern void qdio_init_scrubber(void);
143
144struct qdesfmt0 { 36struct qdesfmt0 {
145#ifdef QDIO_32_BIT 37 u64 sliba;
146 unsigned long res1; /* reserved */ 38 u64 sla;
147#endif /* QDIO_32_BIT */ 39 u64 slsba;
148 unsigned long sliba; /* storage-list-information-block 40 u32 : 32;
149 address */ 41 u32 akey : 4;
150#ifdef QDIO_32_BIT 42 u32 bkey : 4;
151 unsigned long res2; /* reserved */ 43 u32 ckey : 4;
152#endif /* QDIO_32_BIT */ 44 u32 dkey : 4;
153 unsigned long sla; /* storage-list address */ 45 u32 : 16;
154#ifdef QDIO_32_BIT
155 unsigned long res3; /* reserved */
156#endif /* QDIO_32_BIT */
157 unsigned long slsba; /* storage-list-state-block address */
158 unsigned int res4; /* reserved */
159 unsigned int akey : 4; /* access key for DLIB */
160 unsigned int bkey : 4; /* access key for SL */
161 unsigned int ckey : 4; /* access key for SBALs */
162 unsigned int dkey : 4; /* access key for SLSB */
163 unsigned int res5 : 16; /* reserved */
164} __attribute__ ((packed)); 46} __attribute__ ((packed));
165 47
166/* 48/**
167 * Queue-Description record (QDR) 49 * struct qdr - queue description record (QDR)
50 * @qfmt: queue format
51 * @pfmt: implementation dependent parameter format
52 * @ac: adapter characteristics
53 * @iqdcnt: input queue descriptor count
54 * @oqdcnt: output queue descriptor count
55 * @iqdsz: inpout queue descriptor size
56 * @oqdsz: output queue descriptor size
57 * @qiba: queue information block address
58 * @qkey: queue information block key
59 * @qdf0: queue descriptions
168 */ 60 */
169struct qdr { 61struct qdr {
170 unsigned int qfmt : 8; /* queue format */ 62 u32 qfmt : 8;
171 unsigned int pfmt : 8; /* impl. dep. parameter format */ 63 u32 pfmt : 8;
172 unsigned int res1 : 8; /* reserved */ 64 u32 : 8;
173 unsigned int ac : 8; /* adapter characteristics */ 65 u32 ac : 8;
174 unsigned int res2 : 8; /* reserved */ 66 u32 : 8;
175 unsigned int iqdcnt : 8; /* input-queue-descriptor count */ 67 u32 iqdcnt : 8;
176 unsigned int res3 : 8; /* reserved */ 68 u32 : 8;
177 unsigned int oqdcnt : 8; /* output-queue-descriptor count */ 69 u32 oqdcnt : 8;
178 unsigned int res4 : 8; /* reserved */ 70 u32 : 8;
179 unsigned int iqdsz : 8; /* input-queue-descriptor size */ 71 u32 iqdsz : 8;
180 unsigned int res5 : 8; /* reserved */ 72 u32 : 8;
181 unsigned int oqdsz : 8; /* output-queue-descriptor size */ 73 u32 oqdsz : 8;
182 unsigned int res6[9]; /* reserved */ 74 /* private: */
183#ifdef QDIO_32_BIT 75 u32 res[9];
184 unsigned long res7; /* reserved */ 76 /* public: */
185#endif /* QDIO_32_BIT */ 77 u64 qiba;
186 unsigned long qiba; /* queue-information-block address */ 78 u32 : 32;
187 unsigned int res8; /* reserved */ 79 u32 qkey : 4;
188 unsigned int qkey : 4; /* queue-information-block key */ 80 u32 : 28;
189 unsigned int res9 : 28; /* reserved */ 81 struct qdesfmt0 qdf0[126];
190/* union _qd {*/ /* why this? */ 82} __attribute__ ((packed, aligned(4096)));
191 struct qdesfmt0 qdf0[126]; 83
192/* } qd;*/ 84#define QIB_AC_OUTBOUND_PCI_SUPPORTED 0x40
193} __attribute__ ((packed,aligned(4096)));
194
195
196/*
197 * queue information block (QIB)
198 */
199#define QIB_AC_INBOUND_PCI_SUPPORTED 0x80
200#define QIB_AC_OUTBOUND_PCI_SUPPORTED 0x40
201#define QIB_RFLAGS_ENABLE_QEBSM 0x80 85#define QIB_RFLAGS_ENABLE_QEBSM 0x80
202 86
87/**
88 * struct qib - queue information block (QIB)
89 * @qfmt: queue format
90 * @pfmt: implementation dependent parameter format
91 * @rflags: QEBSM
92 * @ac: adapter characteristics
93 * @isliba: absolute address of first input SLIB
94 * @osliba: absolute address of first output SLIB
95 * @ebcnam: adapter identifier in EBCDIC
96 * @parm: implementation dependent parameters
97 */
203struct qib { 98struct qib {
204 unsigned int qfmt : 8; /* queue format */ 99 u32 qfmt : 8;
205 unsigned int pfmt : 8; /* impl. dep. parameter format */ 100 u32 pfmt : 8;
206 unsigned int rflags : 8; /* QEBSM */ 101 u32 rflags : 8;
207 unsigned int ac : 8; /* adapter characteristics */ 102 u32 ac : 8;
208 unsigned int res2; /* reserved */ 103 u32 : 32;
209#ifdef QDIO_32_BIT 104 u64 isliba;
210 unsigned long res3; /* reserved */ 105 u64 osliba;
211#endif /* QDIO_32_BIT */ 106 u32 : 32;
212 unsigned long isliba; /* absolute address of 1st 107 u32 : 32;
213 input SLIB */ 108 u8 ebcnam[8];
214#ifdef QDIO_32_BIT 109 /* private: */
215 unsigned long res4; /* reserved */ 110 u8 res[88];
216#endif /* QDIO_32_BIT */ 111 /* public: */
217 unsigned long osliba; /* absolute address of 1st 112 u8 parm[QDIO_MAX_BUFFERS_PER_Q];
218 output SLIB */ 113} __attribute__ ((packed, aligned(256)));
219 unsigned int res5; /* reserved */ 114
220 unsigned int res6; /* reserved */ 115/**
221 unsigned char ebcnam[8]; /* adapter identifier in EBCDIC */ 116 * struct slibe - storage list information block element (SLIBE)
222 unsigned char res7[88]; /* reserved */ 117 * @parms: implementation dependent parameters
223 unsigned char parm[QDIO_MAX_BUFFERS_PER_Q];
224 /* implementation dependent
225 parameters */
226} __attribute__ ((packed,aligned(256)));
227
228
229/*
230 * storage-list-information block element (SLIBE)
231 */ 118 */
232struct slibe { 119struct slibe {
233#ifdef QDIO_32_BIT 120 u64 parms;
234 unsigned long res; /* reserved */
235#endif /* QDIO_32_BIT */
236 unsigned long parms; /* implementation dependent
237 parameters */
238}; 121};
239 122
240/* 123/**
241 * storage-list-information block (SLIB) 124 * struct slib - storage list information block (SLIB)
125 * @nsliba: next SLIB address (if any)
126 * @sla: SL address
127 * @slsba: SLSB address
128 * @slibe: SLIB elements
242 */ 129 */
243struct slib { 130struct slib {
244#ifdef QDIO_32_BIT 131 u64 nsliba;
245 unsigned long res1; /* reserved */ 132 u64 sla;
246#endif /* QDIO_32_BIT */ 133 u64 slsba;
247 unsigned long nsliba; /* next SLIB address (if any) */ 134 /* private: */
248#ifdef QDIO_32_BIT 135 u8 res[1000];
249 unsigned long res2; /* reserved */ 136 /* public: */
250#endif /* QDIO_32_BIT */ 137 struct slibe slibe[QDIO_MAX_BUFFERS_PER_Q];
251 unsigned long sla; /* SL address */ 138} __attribute__ ((packed, aligned(2048)));
252#ifdef QDIO_32_BIT 139
253 unsigned long res3; /* reserved */ 140/**
254#endif /* QDIO_32_BIT */ 141 * struct sbal_flags - storage block address list flags
255 unsigned long slsba; /* SLSB address */ 142 * @last: last entry
256 unsigned char res4[1000]; /* reserved */ 143 * @cont: contiguous storage
257 struct slibe slibe[QDIO_MAX_BUFFERS_PER_Q]; /* SLIB elements */ 144 * @frag: fragmentation
258} __attribute__ ((packed,aligned(2048))); 145 */
259
260struct sbal_flags { 146struct sbal_flags {
261 unsigned char res1 : 1; /* reserved */ 147 u8 : 1;
262 unsigned char last : 1; /* last entry */ 148 u8 last : 1;
263 unsigned char cont : 1; /* contiguous storage */ 149 u8 cont : 1;
264 unsigned char res2 : 1; /* reserved */ 150 u8 : 1;
265 unsigned char frag : 2; /* fragmentation (s.below) */ 151 u8 frag : 2;
266 unsigned char res3 : 2; /* reserved */ 152 u8 : 2;
267} __attribute__ ((packed)); 153} __attribute__ ((packed));
268 154
269#define SBAL_FLAGS_FIRST_FRAG 0x04000000UL 155#define SBAL_FLAGS_FIRST_FRAG 0x04000000UL
270#define SBAL_FLAGS_MIDDLE_FRAG 0x08000000UL 156#define SBAL_FLAGS_MIDDLE_FRAG 0x08000000UL
271#define SBAL_FLAGS_LAST_FRAG 0x0c000000UL 157#define SBAL_FLAGS_LAST_FRAG 0x0c000000UL
272#define SBAL_FLAGS_LAST_ENTRY 0x40000000UL 158#define SBAL_FLAGS_LAST_ENTRY 0x40000000UL
273#define SBAL_FLAGS_CONTIGUOUS 0x20000000UL 159#define SBAL_FLAGS_CONTIGUOUS 0x20000000UL
274 160
275#define SBAL_FLAGS0_DATA_CONTINUATION 0x20UL 161#define SBAL_FLAGS0_DATA_CONTINUATION 0x20UL
276 162
277/* Awesome OpenFCP extensions */ 163/* Awesome OpenFCP extensions */
278#define SBAL_FLAGS0_TYPE_STATUS 0x00UL 164#define SBAL_FLAGS0_TYPE_STATUS 0x00UL
279#define SBAL_FLAGS0_TYPE_WRITE 0x08UL 165#define SBAL_FLAGS0_TYPE_WRITE 0x08UL
280#define SBAL_FLAGS0_TYPE_READ 0x10UL 166#define SBAL_FLAGS0_TYPE_READ 0x10UL
281#define SBAL_FLAGS0_TYPE_WRITE_READ 0x18UL 167#define SBAL_FLAGS0_TYPE_WRITE_READ 0x18UL
282#define SBAL_FLAGS0_MORE_SBALS 0x04UL 168#define SBAL_FLAGS0_MORE_SBALS 0x04UL
283#define SBAL_FLAGS0_COMMAND 0x02UL 169#define SBAL_FLAGS0_COMMAND 0x02UL
284#define SBAL_FLAGS0_LAST_SBAL 0x00UL 170#define SBAL_FLAGS0_LAST_SBAL 0x00UL
285#define SBAL_FLAGS0_ONLY_SBAL SBAL_FLAGS0_COMMAND 171#define SBAL_FLAGS0_ONLY_SBAL SBAL_FLAGS0_COMMAND
286#define SBAL_FLAGS0_MIDDLE_SBAL SBAL_FLAGS0_MORE_SBALS 172#define SBAL_FLAGS0_MIDDLE_SBAL SBAL_FLAGS0_MORE_SBALS
287#define SBAL_FLAGS0_FIRST_SBAL SBAL_FLAGS0_MORE_SBALS | SBAL_FLAGS0_COMMAND 173#define SBAL_FLAGS0_FIRST_SBAL SBAL_FLAGS0_MORE_SBALS | SBAL_FLAGS0_COMMAND
288/* Naught of interest beyond this point */ 174#define SBAL_FLAGS0_PCI 0x40
289 175
290#define SBAL_FLAGS0_PCI 0x40 176/**
177 * struct sbal_sbalf_0 - sbal flags for sbale 0
178 * @pci: PCI indicator
179 * @cont: data continuation
180 * @sbtype: storage-block type (FCP)
181 */
291struct sbal_sbalf_0 { 182struct sbal_sbalf_0 {
292 unsigned char res1 : 1; /* reserved */ 183 u8 : 1;
293 unsigned char pci : 1; /* PCI indicator */ 184 u8 pci : 1;
294 unsigned char cont : 1; /* data continuation */ 185 u8 cont : 1;
295 unsigned char sbtype: 2; /* storage-block type (OpenFCP) */ 186 u8 sbtype : 2;
296 unsigned char res2 : 3; /* reserved */ 187 u8 : 3;
297} __attribute__ ((packed)); 188} __attribute__ ((packed));
298 189
190/**
191 * struct sbal_sbalf_1 - sbal flags for sbale 1
192 * @key: storage key
193 */
299struct sbal_sbalf_1 { 194struct sbal_sbalf_1 {
300 unsigned char res1 : 4; /* reserved */ 195 u8 : 4;
301 unsigned char key : 4; /* storage key */ 196 u8 key : 4;
302} __attribute__ ((packed)); 197} __attribute__ ((packed));
303 198
199/**
200 * struct sbal_sbalf_14 - sbal flags for sbale 14
201 * @erridx: error index
202 */
304struct sbal_sbalf_14 { 203struct sbal_sbalf_14 {
305 unsigned char res1 : 4; /* reserved */ 204 u8 : 4;
306 unsigned char erridx : 4; /* error index */ 205 u8 erridx : 4;
307} __attribute__ ((packed)); 206} __attribute__ ((packed));
308 207
208/**
209 * struct sbal_sbalf_15 - sbal flags for sbale 15
210 * @reason: reason for error state
211 */
309struct sbal_sbalf_15 { 212struct sbal_sbalf_15 {
310 unsigned char reason; /* reserved */ 213 u8 reason;
311} __attribute__ ((packed)); 214} __attribute__ ((packed));
312 215
216/**
217 * union sbal_sbalf - storage block address list flags
218 * @i0: sbalf0
219 * @i1: sbalf1
220 * @i14: sbalf14
221 * @i15: sblaf15
222 * @value: raw value
223 */
313union sbal_sbalf { 224union sbal_sbalf {
314 struct sbal_sbalf_0 i0; 225 struct sbal_sbalf_0 i0;
315 struct sbal_sbalf_1 i1; 226 struct sbal_sbalf_1 i1;
316 struct sbal_sbalf_14 i14; 227 struct sbal_sbalf_14 i14;
317 struct sbal_sbalf_15 i15; 228 struct sbal_sbalf_15 i15;
318 unsigned char value; 229 u8 value;
319}; 230};
320 231
321struct sbal_element { 232/**
322 union { 233 * struct qdio_buffer_element - SBAL entry
323 struct sbal_flags bits; /* flags */ 234 * @flags: flags
324 unsigned char value; 235 * @length: length
325 } flags; 236 * @addr: address
326 unsigned int res1 : 16; /* reserved */ 237*/
327 union sbal_sbalf sbalf; /* SBAL flags */ 238struct qdio_buffer_element {
328 unsigned int res2 : 16; /* reserved */ 239 u32 flags;
329 unsigned int count : 16; /* data count */ 240 u32 length;
330#ifdef QDIO_32_BIT 241#ifdef CONFIG_32BIT
331 unsigned long res3; /* reserved */ 242 /* private: */
332#endif /* QDIO_32_BIT */ 243 void *reserved;
333 unsigned long addr; /* absolute data address */ 244 /* public: */
334} __attribute__ ((packed,aligned(16))); 245#endif
246 void *addr;
247} __attribute__ ((packed, aligned(16)));
335 248
336/* 249/**
337 * strorage-block access-list (SBAL) 250 * struct qdio_buffer - storage block address list (SBAL)
251 * @element: SBAL entries
338 */ 252 */
339struct sbal { 253struct qdio_buffer {
340 struct sbal_element element[QDIO_MAX_ELEMENTS_PER_BUFFER]; 254 struct qdio_buffer_element element[QDIO_MAX_ELEMENTS_PER_BUFFER];
341} __attribute__ ((packed,aligned(256))); 255} __attribute__ ((packed, aligned(256)));
342 256
343/* 257/**
344 * storage-list (SL) 258 * struct sl_element - storage list entry
259 * @sbal: absolute SBAL address
345 */ 260 */
346struct sl_element { 261struct sl_element {
347#ifdef QDIO_32_BIT 262#ifdef CONFIG_32BIT
348 unsigned long res; /* reserved */ 263 /* private: */
349#endif /* QDIO_32_BIT */ 264 unsigned long reserved;
350 unsigned long sbal; /* absolute SBAL address */ 265 /* public: */
266#endif
267 unsigned long sbal;
351} __attribute__ ((packed)); 268} __attribute__ ((packed));
352 269
270/**
271 * struct sl - storage list (SL)
272 * @element: SL entries
273 */
353struct sl { 274struct sl {
354 struct sl_element element[QDIO_MAX_BUFFERS_PER_Q]; 275 struct sl_element element[QDIO_MAX_BUFFERS_PER_Q];
355} __attribute__ ((packed,aligned(1024))); 276} __attribute__ ((packed, aligned(1024)));
356 277
357/* 278/**
358 * storage-list-state block (SLSB) 279 * struct slsb - storage list state block (SLSB)
280 * @val: state per buffer
359 */ 281 */
360struct slsb_flags { 282struct slsb {
361 unsigned char owner : 2; /* SBAL owner */ 283 u8 val[QDIO_MAX_BUFFERS_PER_Q];
362 unsigned char type : 1; /* buffer type */ 284} __attribute__ ((packed, aligned(256)));
363 unsigned char state : 5; /* processing state */ 285
286struct qdio_ssqd_desc {
287 u8 flags;
288 u8:8;
289 u16 sch;
290 u8 qfmt;
291 u8 parm;
292 u8 qdioac1;
293 u8 sch_class;
294 u8 pcnt;
295 u8 icnt;
296 u8:8;
297 u8 ocnt;
298 u8:8;
299 u8 mbccnt;
300 u16 qdioac2;
301 u64 sch_token;
302 u64:64;
364} __attribute__ ((packed)); 303} __attribute__ ((packed));
365 304
305/* params are: ccw_device, qdio_error, queue_number,
306 first element processed, number of elements processed, int_parm */
307typedef void qdio_handler_t(struct ccw_device *, unsigned int, int,
308 int, int, unsigned long);
366 309
367struct slsb { 310/* qdio errors reported to the upper-layer program */
368 union { 311#define QDIO_ERROR_SIGA_ACCESS_EXCEPTION 0x10
369 unsigned char val[QDIO_MAX_BUFFERS_PER_Q]; 312#define QDIO_ERROR_SIGA_BUSY 0x20
370 struct slsb_flags flags[QDIO_MAX_BUFFERS_PER_Q]; 313#define QDIO_ERROR_ACTIVATE_CHECK_CONDITION 0x40
371 } acc; 314#define QDIO_ERROR_SLSB_STATE 0x80
372} __attribute__ ((packed,aligned(256)));
373 315
374/* 316/* for qdio_initialize */
375 * SLSB values 317#define QDIO_INBOUND_0COPY_SBALS 0x01
318#define QDIO_OUTBOUND_0COPY_SBALS 0x02
319#define QDIO_USE_OUTBOUND_PCIS 0x04
320
321/* for qdio_cleanup */
322#define QDIO_FLAG_CLEANUP_USING_CLEAR 0x01
323#define QDIO_FLAG_CLEANUP_USING_HALT 0x02
324
325/**
326 * struct qdio_initialize - qdio initalization data
327 * @cdev: associated ccw device
328 * @q_format: queue format
329 * @adapter_name: name for the adapter
330 * @qib_param_field_format: format for qib_parm_field
331 * @qib_param_field: pointer to 128 bytes or NULL, if no param field
332 * @input_slib_elements: pointer to no_input_qs * 128 words of data or NULL
333 * @output_slib_elements: pointer to no_output_qs * 128 words of data or NULL
334 * @no_input_qs: number of input queues
335 * @no_output_qs: number of output queues
336 * @input_handler: handler to be called for input queues
337 * @output_handler: handler to be called for output queues
338 * @int_parm: interruption parameter
339 * @flags: initialization flags
340 * @input_sbal_addr_array: address of no_input_qs * 128 pointers
341 * @output_sbal_addr_array: address of no_output_qs * 128 pointers
376 */ 342 */
377#define SLSB_OWNER_PROG 1 343struct qdio_initialize {
378#define SLSB_OWNER_CU 2 344 struct ccw_device *cdev;
379 345 unsigned char q_format;
380#define SLSB_TYPE_INPUT 0 346 unsigned char adapter_name[8];
381#define SLSB_TYPE_OUTPUT 1 347 unsigned int qib_param_field_format;
382 348 unsigned char *qib_param_field;
383#define SLSB_STATE_NOT_INIT 0 349 unsigned long *input_slib_elements;
384#define SLSB_STATE_EMPTY 1 350 unsigned long *output_slib_elements;
385#define SLSB_STATE_PRIMED 2 351 unsigned int no_input_qs;
386#define SLSB_STATE_HALTED 0xe 352 unsigned int no_output_qs;
387#define SLSB_STATE_ERROR 0xf 353 qdio_handler_t *input_handler;
388 354 qdio_handler_t *output_handler;
389#define SLSB_P_INPUT_NOT_INIT 0x80 355 unsigned long int_parm;
390#define SLSB_P_INPUT_PROCESSING 0x81 356 unsigned long flags;
391#define SLSB_CU_INPUT_EMPTY 0x41 357 void **input_sbal_addr_array;
392#define SLSB_P_INPUT_PRIMED 0x82 358 void **output_sbal_addr_array;
393#define SLSB_P_INPUT_HALTED 0x8E 359};
394#define SLSB_P_INPUT_ERROR 0x8F 360
395 361#define QDIO_STATE_INACTIVE 0x00000002 /* after qdio_cleanup */
396#define SLSB_P_OUTPUT_NOT_INIT 0xA0 362#define QDIO_STATE_ESTABLISHED 0x00000004 /* after qdio_establish */
397#define SLSB_P_OUTPUT_EMPTY 0xA1 363#define QDIO_STATE_ACTIVE 0x00000008 /* after qdio_activate */
398#define SLSB_CU_OUTPUT_PRIMED 0x62 364#define QDIO_STATE_STOPPED 0x00000010 /* after queues went down */
399#define SLSB_P_OUTPUT_HALTED 0xAE 365
400#define SLSB_P_OUTPUT_ERROR 0xAF 366#define QDIO_FLAG_SYNC_INPUT 0x01
401 367#define QDIO_FLAG_SYNC_OUTPUT 0x02
402#define SLSB_ERROR_DURING_LOOKUP 0xFF 368#define QDIO_FLAG_PCI_OUT 0x10
369
370extern int qdio_initialize(struct qdio_initialize *init_data);
371extern int qdio_allocate(struct qdio_initialize *init_data);
372extern int qdio_establish(struct qdio_initialize *init_data);
373extern int qdio_activate(struct ccw_device *);
374
375extern int do_QDIO(struct ccw_device*, unsigned int flags,
376 int q_nr, int qidx, int count);
377extern int qdio_cleanup(struct ccw_device*, int how);
378extern int qdio_shutdown(struct ccw_device*, int how);
379extern int qdio_free(struct ccw_device *);
380extern struct qdio_ssqd_desc *qdio_get_ssqd_desc(struct ccw_device *cdev);
403 381
404#endif /* __QDIO_H__ */ 382#endif /* __QDIO_H__ */