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