[PATCH] W1: w1_netlink: New init/fini netlink callbacks.
[linux-2.6/verdex.git] / drivers / s390 / cio / qdio.h
blob6b8aa6a852bedb5230a9964edefca539da3c688a
1 #ifndef _CIO_QDIO_H
2 #define _CIO_QDIO_H
4 #include <asm/page.h>
6 #define VERSION_CIO_QDIO_H "$Revision: 1.33 $"
8 #ifdef CONFIG_QDIO_DEBUG
9 #define QDIO_VERBOSE_LEVEL 9
10 #else /* CONFIG_QDIO_DEBUG */
11 #define QDIO_VERBOSE_LEVEL 5
12 #endif /* CONFIG_QDIO_DEBUG */
14 #define QDIO_USE_PROCESSING_STATE
16 #ifdef CONFIG_QDIO_PERF_STATS
17 #define QDIO_PERFORMANCE_STATS
18 #endif /* CONFIG_QDIO_PERF_STATS */
20 #define QDIO_MINIMAL_BH_RELIEF_TIME 16
21 #define QDIO_TIMER_POLL_VALUE 1
22 #define IQDIO_TIMER_POLL_VALUE 1
25 * unfortunately this can't be (QDIO_MAX_BUFFERS_PER_Q*4/3) or so -- as
26 * we never know, whether we'll get initiative again, e.g. to give the
27 * transmit skb's back to the stack, however the stack may be waiting for
28 * them... therefore we define 4 as threshold to start polling (which
29 * will stop as soon as the asynchronous queue catches up)
30 * btw, this only applies to the asynchronous HiperSockets queue
32 #define IQDIO_FILL_LEVEL_TO_POLL 4
34 #define TIQDIO_THININT_ISC 3
35 #define TIQDIO_DELAY_TARGET 0
36 #define QDIO_BUSY_BIT_PATIENCE 100 /* in microsecs */
37 #define QDIO_BUSY_BIT_GIVE_UP 10000000 /* 10 seconds */
38 #define IQDIO_GLOBAL_LAPS 2 /* GLOBAL_LAPS are not used as we */
39 #define IQDIO_GLOBAL_LAPS_INT 1 /* don't global summary */
40 #define IQDIO_LOCAL_LAPS 4
41 #define IQDIO_LOCAL_LAPS_INT 1
42 #define IQDIO_GLOBAL_SUMMARY_CC_MASK 2
43 /*#define IQDIO_IQDC_INT_PARM 0x1234*/
45 #define QDIO_Q_LAPS 5
47 #define QDIO_STORAGE_KEY PAGE_DEFAULT_KEY
49 #define L2_CACHELINE_SIZE 256
50 #define INDICATORS_PER_CACHELINE (L2_CACHELINE_SIZE/sizeof(__u32))
52 #define QDIO_PERF "qdio_perf"
54 /* must be a power of 2 */
55 /*#define QDIO_STATS_NUMBER 4
57 #define QDIO_STATS_CLASSES 2
58 #define QDIO_STATS_COUNT_NEEDED 2*/
60 #define QDIO_NO_USE_COUNT_TIMEOUT (1*HZ) /* wait for 1 sec on each q before
61 exiting without having use_count
62 of the queue to 0 */
64 #define QDIO_ESTABLISH_TIMEOUT (1*HZ)
65 #define QDIO_ACTIVATE_TIMEOUT ((5*HZ)>>10)
66 #define QDIO_CLEANUP_CLEAR_TIMEOUT (20*HZ)
67 #define QDIO_CLEANUP_HALT_TIMEOUT (10*HZ)
69 enum qdio_irq_states {
70 QDIO_IRQ_STATE_INACTIVE,
71 QDIO_IRQ_STATE_ESTABLISHED,
72 QDIO_IRQ_STATE_ACTIVE,
73 QDIO_IRQ_STATE_STOPPED,
74 QDIO_IRQ_STATE_CLEANUP,
75 QDIO_IRQ_STATE_ERR,
76 NR_QDIO_IRQ_STATES,
79 /* used as intparm in do_IO: */
80 #define QDIO_DOING_SENSEID 0
81 #define QDIO_DOING_ESTABLISH 1
82 #define QDIO_DOING_ACTIVATE 2
83 #define QDIO_DOING_CLEANUP 3
85 /************************* DEBUG FACILITY STUFF *********************/
87 #define QDIO_DBF_HEX(ex,name,level,addr,len) \
88 do { \
89 if (ex) \
90 debug_exception(qdio_dbf_##name,level,(void*)(addr),len); \
91 else \
92 debug_event(qdio_dbf_##name,level,(void*)(addr),len); \
93 } while (0)
94 #define QDIO_DBF_TEXT(ex,name,level,text) \
95 do { \
96 if (ex) \
97 debug_text_exception(qdio_dbf_##name,level,text); \
98 else \
99 debug_text_event(qdio_dbf_##name,level,text); \
100 } while (0)
103 #define QDIO_DBF_HEX0(ex,name,addr,len) QDIO_DBF_HEX(ex,name,0,addr,len)
104 #define QDIO_DBF_HEX1(ex,name,addr,len) QDIO_DBF_HEX(ex,name,1,addr,len)
105 #define QDIO_DBF_HEX2(ex,name,addr,len) QDIO_DBF_HEX(ex,name,2,addr,len)
106 #ifdef CONFIG_QDIO_DEBUG
107 #define QDIO_DBF_HEX3(ex,name,addr,len) QDIO_DBF_HEX(ex,name,3,addr,len)
108 #define QDIO_DBF_HEX4(ex,name,addr,len) QDIO_DBF_HEX(ex,name,4,addr,len)
109 #define QDIO_DBF_HEX5(ex,name,addr,len) QDIO_DBF_HEX(ex,name,5,addr,len)
110 #define QDIO_DBF_HEX6(ex,name,addr,len) QDIO_DBF_HEX(ex,name,6,addr,len)
111 #else /* CONFIG_QDIO_DEBUG */
112 #define QDIO_DBF_HEX3(ex,name,addr,len) do {} while (0)
113 #define QDIO_DBF_HEX4(ex,name,addr,len) do {} while (0)
114 #define QDIO_DBF_HEX5(ex,name,addr,len) do {} while (0)
115 #define QDIO_DBF_HEX6(ex,name,addr,len) do {} while (0)
116 #endif /* CONFIG_QDIO_DEBUG */
118 #define QDIO_DBF_TEXT0(ex,name,text) QDIO_DBF_TEXT(ex,name,0,text)
119 #define QDIO_DBF_TEXT1(ex,name,text) QDIO_DBF_TEXT(ex,name,1,text)
120 #define QDIO_DBF_TEXT2(ex,name,text) QDIO_DBF_TEXT(ex,name,2,text)
121 #ifdef CONFIG_QDIO_DEBUG
122 #define QDIO_DBF_TEXT3(ex,name,text) QDIO_DBF_TEXT(ex,name,3,text)
123 #define QDIO_DBF_TEXT4(ex,name,text) QDIO_DBF_TEXT(ex,name,4,text)
124 #define QDIO_DBF_TEXT5(ex,name,text) QDIO_DBF_TEXT(ex,name,5,text)
125 #define QDIO_DBF_TEXT6(ex,name,text) QDIO_DBF_TEXT(ex,name,6,text)
126 #else /* CONFIG_QDIO_DEBUG */
127 #define QDIO_DBF_TEXT3(ex,name,text) do {} while (0)
128 #define QDIO_DBF_TEXT4(ex,name,text) do {} while (0)
129 #define QDIO_DBF_TEXT5(ex,name,text) do {} while (0)
130 #define QDIO_DBF_TEXT6(ex,name,text) do {} while (0)
131 #endif /* CONFIG_QDIO_DEBUG */
133 #define QDIO_DBF_SETUP_NAME "qdio_setup"
134 #define QDIO_DBF_SETUP_LEN 8
135 #define QDIO_DBF_SETUP_PAGES 4
136 #define QDIO_DBF_SETUP_NR_AREAS 1
137 #ifdef CONFIG_QDIO_DEBUG
138 #define QDIO_DBF_SETUP_LEVEL 6
139 #else /* CONFIG_QDIO_DEBUG */
140 #define QDIO_DBF_SETUP_LEVEL 2
141 #endif /* CONFIG_QDIO_DEBUG */
143 #define QDIO_DBF_SBAL_NAME "qdio_labs" /* sbal */
144 #define QDIO_DBF_SBAL_LEN 256
145 #define QDIO_DBF_SBAL_PAGES 4
146 #define QDIO_DBF_SBAL_NR_AREAS 2
147 #ifdef CONFIG_QDIO_DEBUG
148 #define QDIO_DBF_SBAL_LEVEL 6
149 #else /* CONFIG_QDIO_DEBUG */
150 #define QDIO_DBF_SBAL_LEVEL 2
151 #endif /* CONFIG_QDIO_DEBUG */
153 #define QDIO_DBF_TRACE_NAME "qdio_trace"
154 #define QDIO_DBF_TRACE_LEN 8
155 #define QDIO_DBF_TRACE_NR_AREAS 2
156 #ifdef CONFIG_QDIO_DEBUG
157 #define QDIO_DBF_TRACE_PAGES 16
158 #define QDIO_DBF_TRACE_LEVEL 4 /* -------- could be even more verbose here */
159 #else /* CONFIG_QDIO_DEBUG */
160 #define QDIO_DBF_TRACE_PAGES 4
161 #define QDIO_DBF_TRACE_LEVEL 2
162 #endif /* CONFIG_QDIO_DEBUG */
164 #define QDIO_DBF_SENSE_NAME "qdio_sense"
165 #define QDIO_DBF_SENSE_LEN 64
166 #define QDIO_DBF_SENSE_PAGES 2
167 #define QDIO_DBF_SENSE_NR_AREAS 1
168 #ifdef CONFIG_QDIO_DEBUG
169 #define QDIO_DBF_SENSE_LEVEL 6
170 #else /* CONFIG_QDIO_DEBUG */
171 #define QDIO_DBF_SENSE_LEVEL 2
172 #endif /* CONFIG_QDIO_DEBUG */
174 #ifdef CONFIG_QDIO_DEBUG
175 #define QDIO_TRACE_QTYPE QDIO_ZFCP_QFMT
177 #define QDIO_DBF_SLSB_OUT_NAME "qdio_slsb_out"
178 #define QDIO_DBF_SLSB_OUT_LEN QDIO_MAX_BUFFERS_PER_Q
179 #define QDIO_DBF_SLSB_OUT_PAGES 256
180 #define QDIO_DBF_SLSB_OUT_NR_AREAS 1
181 #define QDIO_DBF_SLSB_OUT_LEVEL 6
183 #define QDIO_DBF_SLSB_IN_NAME "qdio_slsb_in"
184 #define QDIO_DBF_SLSB_IN_LEN QDIO_MAX_BUFFERS_PER_Q
185 #define QDIO_DBF_SLSB_IN_PAGES 256
186 #define QDIO_DBF_SLSB_IN_NR_AREAS 1
187 #define QDIO_DBF_SLSB_IN_LEVEL 6
188 #endif /* CONFIG_QDIO_DEBUG */
190 #define QDIO_PRINTK_HEADER QDIO_NAME ": "
192 #if QDIO_VERBOSE_LEVEL>8
193 #define QDIO_PRINT_STUPID(x...) printk( KERN_DEBUG QDIO_PRINTK_HEADER x)
194 #else
195 #define QDIO_PRINT_STUPID(x...)
196 #endif
198 #if QDIO_VERBOSE_LEVEL>7
199 #define QDIO_PRINT_ALL(x...) printk( QDIO_PRINTK_HEADER x)
200 #else
201 #define QDIO_PRINT_ALL(x...)
202 #endif
204 #if QDIO_VERBOSE_LEVEL>6
205 #define QDIO_PRINT_INFO(x...) printk( QDIO_PRINTK_HEADER x)
206 #else
207 #define QDIO_PRINT_INFO(x...)
208 #endif
210 #if QDIO_VERBOSE_LEVEL>5
211 #define QDIO_PRINT_WARN(x...) printk( QDIO_PRINTK_HEADER x)
212 #else
213 #define QDIO_PRINT_WARN(x...)
214 #endif
216 #if QDIO_VERBOSE_LEVEL>4
217 #define QDIO_PRINT_ERR(x...) printk( QDIO_PRINTK_HEADER x)
218 #else
219 #define QDIO_PRINT_ERR(x...)
220 #endif
222 #if QDIO_VERBOSE_LEVEL>3
223 #define QDIO_PRINT_CRIT(x...) printk( QDIO_PRINTK_HEADER x)
224 #else
225 #define QDIO_PRINT_CRIT(x...)
226 #endif
228 #if QDIO_VERBOSE_LEVEL>2
229 #define QDIO_PRINT_ALERT(x...) printk( QDIO_PRINTK_HEADER x)
230 #else
231 #define QDIO_PRINT_ALERT(x...)
232 #endif
234 #if QDIO_VERBOSE_LEVEL>1
235 #define QDIO_PRINT_EMERG(x...) printk( QDIO_PRINTK_HEADER x)
236 #else
237 #define QDIO_PRINT_EMERG(x...)
238 #endif
240 #define HEXDUMP16(importance,header,ptr) \
241 QDIO_PRINT_##importance(header "%02x %02x %02x %02x " \
242 "%02x %02x %02x %02x %02x %02x %02x %02x " \
243 "%02x %02x %02x %02x\n",*(((char*)ptr)), \
244 *(((char*)ptr)+1),*(((char*)ptr)+2), \
245 *(((char*)ptr)+3),*(((char*)ptr)+4), \
246 *(((char*)ptr)+5),*(((char*)ptr)+6), \
247 *(((char*)ptr)+7),*(((char*)ptr)+8), \
248 *(((char*)ptr)+9),*(((char*)ptr)+10), \
249 *(((char*)ptr)+11),*(((char*)ptr)+12), \
250 *(((char*)ptr)+13),*(((char*)ptr)+14), \
251 *(((char*)ptr)+15)); \
252 QDIO_PRINT_##importance(header "%02x %02x %02x %02x %02x %02x %02x %02x " \
253 "%02x %02x %02x %02x %02x %02x %02x %02x\n", \
254 *(((char*)ptr)+16),*(((char*)ptr)+17), \
255 *(((char*)ptr)+18),*(((char*)ptr)+19), \
256 *(((char*)ptr)+20),*(((char*)ptr)+21), \
257 *(((char*)ptr)+22),*(((char*)ptr)+23), \
258 *(((char*)ptr)+24),*(((char*)ptr)+25), \
259 *(((char*)ptr)+26),*(((char*)ptr)+27), \
260 *(((char*)ptr)+28),*(((char*)ptr)+29), \
261 *(((char*)ptr)+30),*(((char*)ptr)+31));
263 /****************** END OF DEBUG FACILITY STUFF *********************/
266 * Some instructions as assembly
268 extern __inline__ int
269 do_siga_sync(unsigned int irq, unsigned int mask1, unsigned int mask2)
271 int cc;
273 #ifndef CONFIG_ARCH_S390X
274 asm volatile (
275 "lhi 0,2 \n\t"
276 "lr 1,%1 \n\t"
277 "lr 2,%2 \n\t"
278 "lr 3,%3 \n\t"
279 "siga 0 \n\t"
280 "ipm %0 \n\t"
281 "srl %0,28 \n\t"
282 : "=d" (cc)
283 : "d" (0x10000|irq), "d" (mask1), "d" (mask2)
284 : "cc", "0", "1", "2", "3"
286 #else /* CONFIG_ARCH_S390X */
287 asm volatile (
288 "lghi 0,2 \n\t"
289 "llgfr 1,%1 \n\t"
290 "llgfr 2,%2 \n\t"
291 "llgfr 3,%3 \n\t"
292 "siga 0 \n\t"
293 "ipm %0 \n\t"
294 "srl %0,28 \n\t"
295 : "=d" (cc)
296 : "d" (0x10000|irq), "d" (mask1), "d" (mask2)
297 : "cc", "0", "1", "2", "3"
299 #endif /* CONFIG_ARCH_S390X */
300 return cc;
303 extern __inline__ int
304 do_siga_input(unsigned int irq, unsigned int mask)
306 int cc;
308 #ifndef CONFIG_ARCH_S390X
309 asm volatile (
310 "lhi 0,1 \n\t"
311 "lr 1,%1 \n\t"
312 "lr 2,%2 \n\t"
313 "siga 0 \n\t"
314 "ipm %0 \n\t"
315 "srl %0,28 \n\t"
316 : "=d" (cc)
317 : "d" (0x10000|irq), "d" (mask)
318 : "cc", "0", "1", "2", "memory"
320 #else /* CONFIG_ARCH_S390X */
321 asm volatile (
322 "lghi 0,1 \n\t"
323 "llgfr 1,%1 \n\t"
324 "llgfr 2,%2 \n\t"
325 "siga 0 \n\t"
326 "ipm %0 \n\t"
327 "srl %0,28 \n\t"
328 : "=d" (cc)
329 : "d" (0x10000|irq), "d" (mask)
330 : "cc", "0", "1", "2", "memory"
332 #endif /* CONFIG_ARCH_S390X */
334 return cc;
337 extern __inline__ int
338 do_siga_output(unsigned long irq, unsigned long mask, __u32 *bb)
340 int cc;
341 __u32 busy_bit;
343 #ifndef CONFIG_ARCH_S390X
344 asm volatile (
345 "lhi 0,0 \n\t"
346 "lr 1,%2 \n\t"
347 "lr 2,%3 \n\t"
348 "siga 0 \n\t"
349 "0:"
350 "ipm %0 \n\t"
351 "srl %0,28 \n\t"
352 "srl 0,31 \n\t"
353 "lr %1,0 \n\t"
354 "1: \n\t"
355 ".section .fixup,\"ax\"\n\t"
356 "2: \n\t"
357 "lhi %0,%4 \n\t"
358 "bras 1,3f \n\t"
359 ".long 1b \n\t"
360 "3: \n\t"
361 "l 1,0(1) \n\t"
362 "br 1 \n\t"
363 ".previous \n\t"
364 ".section __ex_table,\"a\"\n\t"
365 ".align 4 \n\t"
366 ".long 0b,2b \n\t"
367 ".previous \n\t"
368 : "=d" (cc), "=d" (busy_bit)
369 : "d" (0x10000|irq), "d" (mask),
370 "i" (QDIO_SIGA_ERROR_ACCESS_EXCEPTION)
371 : "cc", "0", "1", "2", "memory"
373 #else /* CONFIG_ARCH_S390X */
374 asm volatile (
375 "lghi 0,0 \n\t"
376 "llgfr 1,%2 \n\t"
377 "llgfr 2,%3 \n\t"
378 "siga 0 \n\t"
379 "0:"
380 "ipm %0 \n\t"
381 "srl %0,28 \n\t"
382 "srl 0,31 \n\t"
383 "llgfr %1,0 \n\t"
384 "1: \n\t"
385 ".section .fixup,\"ax\"\n\t"
386 "lghi %0,%4 \n\t"
387 "jg 1b \n\t"
388 ".previous\n\t"
389 ".section __ex_table,\"a\"\n\t"
390 ".align 8 \n\t"
391 ".quad 0b,1b \n\t"
392 ".previous \n\t"
393 : "=d" (cc), "=d" (busy_bit)
394 : "d" (0x10000|irq), "d" (mask),
395 "i" (QDIO_SIGA_ERROR_ACCESS_EXCEPTION)
396 : "cc", "0", "1", "2", "memory"
398 #endif /* CONFIG_ARCH_S390X */
400 (*bb) = busy_bit;
401 return cc;
404 extern __inline__ unsigned long
405 do_clear_global_summary(void)
408 unsigned long time;
410 #ifndef CONFIG_ARCH_S390X
411 asm volatile (
412 "lhi 1,3 \n\t"
413 ".insn rre,0xb2650000,2,0 \n\t"
414 "lr %0,3 \n\t"
415 : "=d" (time) : : "cc", "1", "2", "3"
417 #else /* CONFIG_ARCH_S390X */
418 asm volatile (
419 "lghi 1,3 \n\t"
420 ".insn rre,0xb2650000,2,0 \n\t"
421 "lgr %0,3 \n\t"
422 : "=d" (time) : : "cc", "1", "2", "3"
424 #endif /* CONFIG_ARCH_S390X */
426 return time;
430 * QDIO device commands returned by extended Sense-ID
432 #define DEFAULT_ESTABLISH_QS_CMD 0x1b
433 #define DEFAULT_ESTABLISH_QS_COUNT 0x1000
434 #define DEFAULT_ACTIVATE_QS_CMD 0x1f
435 #define DEFAULT_ACTIVATE_QS_COUNT 0
438 * additional CIWs returned by extended Sense-ID
440 #define CIW_TYPE_EQUEUE 0x3 /* establish QDIO queues */
441 #define CIW_TYPE_AQUEUE 0x4 /* activate QDIO queues */
443 #define QDIO_CHSC_RESPONSE_CODE_OK 1
444 /* flags for st qdio sch data */
445 #define CHSC_FLAG_QDIO_CAPABILITY 0x80
446 #define CHSC_FLAG_VALIDITY 0x40
448 #define CHSC_FLAG_SIGA_INPUT_NECESSARY 0x40
449 #define CHSC_FLAG_SIGA_OUTPUT_NECESSARY 0x20
450 #define CHSC_FLAG_SIGA_SYNC_NECESSARY 0x10
451 #define CHSC_FLAG_SIGA_SYNC_DONE_ON_THININTS 0x08
452 #define CHSC_FLAG_SIGA_SYNC_DONE_ON_OUTB_PCIS 0x04
454 #ifdef QDIO_PERFORMANCE_STATS
455 struct qdio_perf_stats {
456 unsigned int tl_runs;
458 unsigned int siga_outs;
459 unsigned int siga_ins;
460 unsigned int siga_syncs;
461 unsigned int pcis;
462 unsigned int thinints;
463 unsigned int fast_reqs;
465 __u64 start_time_outbound;
466 unsigned int outbound_cnt;
467 unsigned int outbound_time;
468 __u64 start_time_inbound;
469 unsigned int inbound_cnt;
470 unsigned int inbound_time;
472 #endif /* QDIO_PERFORMANCE_STATS */
474 #define atomic_swap(a,b) xchg((int*)a.counter,b)
476 /* unlikely as the later the better */
477 #define SYNC_MEMORY if (unlikely(q->siga_sync)) qdio_siga_sync_q(q)
478 #define SYNC_MEMORY_ALL if (unlikely(q->siga_sync)) \
479 qdio_siga_sync(q,~0U,~0U)
480 #define SYNC_MEMORY_ALL_OUTB if (unlikely(q->siga_sync)) \
481 qdio_siga_sync(q,~0U,0)
483 #define NOW qdio_get_micros()
484 #define SAVE_TIMESTAMP(q) q->timing.last_transfer_time=NOW
485 #define GET_SAVED_TIMESTAMP(q) (q->timing.last_transfer_time)
486 #define SAVE_FRONTIER(q,val) q->last_move_ftc=val
487 #define GET_SAVED_FRONTIER(q) (q->last_move_ftc)
489 #define MY_MODULE_STRING(x) #x
491 #ifdef CONFIG_ARCH_S390X
492 #define QDIO_GET_ADDR(x) ((__u32)(unsigned long)x)
493 #else /* CONFIG_ARCH_S390X */
494 #define QDIO_GET_ADDR(x) ((__u32)(long)x)
495 #endif /* CONFIG_ARCH_S390X */
497 #ifdef CONFIG_QDIO_DEBUG
498 #define set_slsb(x,y) \
499 if(q->queue_type==QDIO_TRACE_QTYPE) { \
500 if(q->is_input_q) { \
501 QDIO_DBF_HEX2(0,slsb_in,&q->slsb,QDIO_MAX_BUFFERS_PER_Q); \
502 } else { \
503 QDIO_DBF_HEX2(0,slsb_out,&q->slsb,QDIO_MAX_BUFFERS_PER_Q); \
506 qdio_set_slsb(x,y); \
507 if(q->queue_type==QDIO_TRACE_QTYPE) { \
508 if(q->is_input_q) { \
509 QDIO_DBF_HEX2(0,slsb_in,&q->slsb,QDIO_MAX_BUFFERS_PER_Q); \
510 } else { \
511 QDIO_DBF_HEX2(0,slsb_out,&q->slsb,QDIO_MAX_BUFFERS_PER_Q); \
514 #else /* CONFIG_QDIO_DEBUG */
515 #define set_slsb(x,y) qdio_set_slsb(x,y)
516 #endif /* CONFIG_QDIO_DEBUG */
518 struct qdio_q {
519 volatile struct slsb slsb;
521 char unused[QDIO_MAX_BUFFERS_PER_Q];
523 __u32 * volatile dev_st_chg_ind;
525 int is_input_q;
526 int irq;
527 struct ccw_device *cdev;
529 unsigned int is_iqdio_q;
530 unsigned int is_thinint_q;
532 /* bit 0 means queue 0, bit 1 means queue 1, ... */
533 unsigned int mask;
534 unsigned int q_no;
536 qdio_handler_t (*handler);
538 /* points to the next buffer to be checked for having
539 * been processed by the card (outbound)
540 * or to the next buffer the program should check for (inbound) */
541 volatile int first_to_check;
542 /* and the last time it was: */
543 volatile int last_move_ftc;
545 atomic_t number_of_buffers_used;
546 atomic_t polling;
548 unsigned int siga_in;
549 unsigned int siga_out;
550 unsigned int siga_sync;
551 unsigned int siga_sync_done_on_thinints;
552 unsigned int siga_sync_done_on_outb_tis;
553 unsigned int hydra_gives_outbound_pcis;
555 /* used to save beginning position when calling dd_handlers */
556 int first_element_to_kick;
558 atomic_t use_count;
559 atomic_t is_in_shutdown;
561 void *irq_ptr;
563 #ifdef QDIO_USE_TIMERS_FOR_POLLING
564 struct timer_list timer;
565 atomic_t timer_already_set;
566 spinlock_t timer_lock;
567 #else /* QDIO_USE_TIMERS_FOR_POLLING */
568 struct tasklet_struct tasklet;
569 #endif /* QDIO_USE_TIMERS_FOR_POLLING */
571 enum qdio_irq_states state;
573 /* used to store the error condition during a data transfer */
574 unsigned int qdio_error;
575 unsigned int siga_error;
576 unsigned int error_status_flags;
578 /* list of interesting queues */
579 volatile struct qdio_q *list_next;
580 volatile struct qdio_q *list_prev;
582 struct sl *sl;
583 volatile struct sbal *sbal[QDIO_MAX_BUFFERS_PER_Q];
585 struct qdio_buffer *qdio_buffers[QDIO_MAX_BUFFERS_PER_Q];
587 unsigned long int_parm;
589 /*struct {
590 int in_bh_check_limit;
591 int threshold;
592 } threshold_classes[QDIO_STATS_CLASSES];*/
594 struct {
595 /* inbound: the time to stop polling
596 outbound: the time to kick peer */
597 int threshold; /* the real value */
599 /* outbound: last time of do_QDIO
600 inbound: last time of noticing incoming data */
601 /*__u64 last_transfer_times[QDIO_STATS_NUMBER];
602 int last_transfer_index; */
604 __u64 last_transfer_time;
605 __u64 busy_start;
606 } timing;
607 atomic_t busy_siga_counter;
608 unsigned int queue_type;
610 /* leave this member at the end. won't be cleared in qdio_fill_qs */
611 struct slib *slib; /* a page is allocated under this pointer,
612 sl points into this page, offset PAGE_SIZE/2
613 (after slib) */
614 } __attribute__ ((aligned(256)));
616 struct qdio_irq {
617 __u32 * volatile dev_st_chg_ind;
619 unsigned long int_parm;
620 int irq;
622 unsigned int is_iqdio_irq;
623 unsigned int is_thinint_irq;
624 unsigned int hydra_gives_outbound_pcis;
625 unsigned int sync_done_on_outb_pcis;
627 enum qdio_irq_states state;
629 unsigned int no_input_qs;
630 unsigned int no_output_qs;
632 unsigned char qdioac;
634 struct ccw1 ccw;
636 struct ciw equeue;
637 struct ciw aqueue;
639 struct qib qib;
641 void (*original_int_handler) (struct ccw_device *,
642 unsigned long, struct irb *);
644 /* leave these four members together at the end. won't be cleared in qdio_fill_irq */
645 struct qdr *qdr;
646 struct qdio_q *input_qs[QDIO_MAX_QUEUES_PER_IRQ];
647 struct qdio_q *output_qs[QDIO_MAX_QUEUES_PER_IRQ];
648 struct semaphore setting_up_sema;
650 #endif