2 * linux/drivers/s390/cio/qdio_main.c
4 * Linux for s390 qdio support, buffer handling, qdio API and module support.
6 * Copyright 2000,2008 IBM Corp.
7 * Author(s): Utz Bacher <utz.bacher@de.ibm.com>
8 * Jan Glauber <jang@linux.vnet.ibm.com>
9 * 2.6 cio integration by Cornelia Huck <cornelia.huck@de.ibm.com>
11 #include <linux/module.h>
12 #include <linux/init.h>
13 #include <linux/kernel.h>
14 #include <linux/timer.h>
15 #include <linux/delay.h>
16 #include <asm/atomic.h>
17 #include <asm/debug.h>
24 #include "qdio_debug.h"
26 MODULE_AUTHOR("Utz Bacher <utz.bacher@de.ibm.com>,"\
27 "Jan Glauber <jang@linux.vnet.ibm.com>");
28 MODULE_DESCRIPTION("QDIO base support");
29 MODULE_LICENSE("GPL");
31 static inline int do_siga_sync(struct subchannel_id schid
,
32 unsigned int out_mask
, unsigned int in_mask
)
34 register unsigned long __fc
asm ("0") = 2;
35 register struct subchannel_id __schid
asm ("1") = schid
;
36 register unsigned long out
asm ("2") = out_mask
;
37 register unsigned long in
asm ("3") = in_mask
;
45 : "d" (__fc
), "d" (__schid
), "d" (out
), "d" (in
) : "cc");
49 static inline int do_siga_input(struct subchannel_id schid
, unsigned int mask
)
51 register unsigned long __fc
asm ("0") = 1;
52 register struct subchannel_id __schid
asm ("1") = schid
;
53 register unsigned long __mask
asm ("2") = mask
;
61 : "d" (__fc
), "d" (__schid
), "d" (__mask
) : "cc", "memory");
66 * do_siga_output - perform SIGA-w/wt function
67 * @schid: subchannel id or in case of QEBSM the subchannel token
68 * @mask: which output queues to process
69 * @bb: busy bit indicator, set only if SIGA-w/wt could not access a buffer
70 * @fc: function code to perform
72 * Returns cc or QDIO_ERROR_SIGA_ACCESS_EXCEPTION.
73 * Note: For IQDC unicast queues only the highest priority queue is processed.
75 static inline int do_siga_output(unsigned long schid
, unsigned long mask
,
76 unsigned int *bb
, unsigned int fc
)
78 register unsigned long __fc
asm("0") = fc
;
79 register unsigned long __schid
asm("1") = schid
;
80 register unsigned long __mask
asm("2") = mask
;
81 int cc
= QDIO_ERROR_SIGA_ACCESS_EXCEPTION
;
89 : "+d" (cc
), "+d" (__fc
), "+d" (__schid
), "+d" (__mask
)
91 *bb
= ((unsigned int) __fc
) >> 31;
95 static inline int qdio_check_ccq(struct qdio_q
*q
, unsigned int ccq
)
97 /* all done or next buffer state different */
98 if (ccq
== 0 || ccq
== 32)
100 /* not all buffers processed */
101 if (ccq
== 96 || ccq
== 97)
103 /* notify devices immediately */
104 DBF_ERROR("%4x ccq:%3d", SCH_NO(q
), ccq
);
109 * qdio_do_eqbs - extract buffer states for QEBSM
110 * @q: queue to manipulate
111 * @state: state of the extracted buffers
112 * @start: buffer number to start at
113 * @count: count of buffers to examine
114 * @auto_ack: automatically acknowledge buffers
116 * Returns the number of successfully extracted equal buffer states.
117 * Stops processing if a state is different from the last buffers state.
119 static int qdio_do_eqbs(struct qdio_q
*q
, unsigned char *state
,
120 int start
, int count
, int auto_ack
)
122 unsigned int ccq
= 0;
123 int tmp_count
= count
, tmp_start
= start
;
127 BUG_ON(!q
->irq_ptr
->sch_token
);
131 nr
+= q
->irq_ptr
->nr_input_qs
;
133 ccq
= do_eqbs(q
->irq_ptr
->sch_token
, state
, nr
, &tmp_start
, &tmp_count
,
135 rc
= qdio_check_ccq(q
, ccq
);
137 /* At least one buffer was processed, return and extract the remaining
140 if ((ccq
== 96) && (count
!= tmp_count
)) {
141 qperf_inc(q
, eqbs_partial
);
142 return (count
- tmp_count
);
146 DBF_DEV_EVENT(DBF_WARN
, q
->irq_ptr
, "EQBS again:%2d", ccq
);
151 DBF_ERROR("%4x EQBS ERROR", SCH_NO(q
));
152 DBF_ERROR("%3d%3d%2d", count
, tmp_count
, nr
);
153 q
->handler(q
->irq_ptr
->cdev
,
154 QDIO_ERROR_ACTIVATE_CHECK_CONDITION
,
155 0, -1, -1, q
->irq_ptr
->int_parm
);
158 return count
- tmp_count
;
162 * qdio_do_sqbs - set buffer states for QEBSM
163 * @q: queue to manipulate
164 * @state: new state of the buffers
165 * @start: first buffer number to change
166 * @count: how many buffers to change
168 * Returns the number of successfully changed buffers.
169 * Does retrying until the specified count of buffer states is set or an
172 static int qdio_do_sqbs(struct qdio_q
*q
, unsigned char state
, int start
,
175 unsigned int ccq
= 0;
176 int tmp_count
= count
, tmp_start
= start
;
183 BUG_ON(!q
->irq_ptr
->sch_token
);
187 nr
+= q
->irq_ptr
->nr_input_qs
;
189 ccq
= do_sqbs(q
->irq_ptr
->sch_token
, state
, nr
, &tmp_start
, &tmp_count
);
190 rc
= qdio_check_ccq(q
, ccq
);
192 DBF_DEV_EVENT(DBF_INFO
, q
->irq_ptr
, "SQBS again:%2d", ccq
);
193 qperf_inc(q
, sqbs_partial
);
197 DBF_ERROR("%4x SQBS ERROR", SCH_NO(q
));
198 DBF_ERROR("%3d%3d%2d", count
, tmp_count
, nr
);
199 q
->handler(q
->irq_ptr
->cdev
,
200 QDIO_ERROR_ACTIVATE_CHECK_CONDITION
,
201 0, -1, -1, q
->irq_ptr
->int_parm
);
205 return count
- tmp_count
;
208 /* returns number of examined buffers and their common state in *state */
209 static inline int get_buf_states(struct qdio_q
*q
, unsigned int bufnr
,
210 unsigned char *state
, unsigned int count
,
213 unsigned char __state
= 0;
216 BUG_ON(bufnr
> QDIO_MAX_BUFFERS_MASK
);
217 BUG_ON(count
> QDIO_MAX_BUFFERS_PER_Q
);
220 return qdio_do_eqbs(q
, state
, bufnr
, count
, auto_ack
);
222 for (i
= 0; i
< count
; i
++) {
224 __state
= q
->slsb
.val
[bufnr
];
225 else if (q
->slsb
.val
[bufnr
] != __state
)
227 bufnr
= next_buf(bufnr
);
233 static inline int get_buf_state(struct qdio_q
*q
, unsigned int bufnr
,
234 unsigned char *state
, int auto_ack
)
236 return get_buf_states(q
, bufnr
, state
, 1, auto_ack
);
239 /* wrap-around safe setting of slsb states, returns number of changed buffers */
240 static inline int set_buf_states(struct qdio_q
*q
, int bufnr
,
241 unsigned char state
, int count
)
245 BUG_ON(bufnr
> QDIO_MAX_BUFFERS_MASK
);
246 BUG_ON(count
> QDIO_MAX_BUFFERS_PER_Q
);
249 return qdio_do_sqbs(q
, state
, bufnr
, count
);
251 for (i
= 0; i
< count
; i
++) {
252 xchg(&q
->slsb
.val
[bufnr
], state
);
253 bufnr
= next_buf(bufnr
);
258 static inline int set_buf_state(struct qdio_q
*q
, int bufnr
,
261 return set_buf_states(q
, bufnr
, state
, 1);
264 /* set slsb states to initial state */
265 void qdio_init_buf_states(struct qdio_irq
*irq_ptr
)
270 for_each_input_queue(irq_ptr
, q
, i
)
271 set_buf_states(q
, 0, SLSB_P_INPUT_NOT_INIT
,
272 QDIO_MAX_BUFFERS_PER_Q
);
273 for_each_output_queue(irq_ptr
, q
, i
)
274 set_buf_states(q
, 0, SLSB_P_OUTPUT_NOT_INIT
,
275 QDIO_MAX_BUFFERS_PER_Q
);
278 static inline int qdio_siga_sync(struct qdio_q
*q
, unsigned int output
,
283 if (!need_siga_sync(q
))
286 DBF_DEV_EVENT(DBF_INFO
, q
->irq_ptr
, "siga-s:%1d", q
->nr
);
287 qperf_inc(q
, siga_sync
);
289 cc
= do_siga_sync(q
->irq_ptr
->schid
, output
, input
);
291 DBF_ERROR("%4x SIGA-S:%2d", SCH_NO(q
), cc
);
295 static inline int qdio_siga_sync_q(struct qdio_q
*q
)
298 return qdio_siga_sync(q
, 0, q
->mask
);
300 return qdio_siga_sync(q
, q
->mask
, 0);
303 static inline int qdio_siga_sync_out(struct qdio_q
*q
)
305 return qdio_siga_sync(q
, ~0U, 0);
308 static inline int qdio_siga_sync_all(struct qdio_q
*q
)
310 return qdio_siga_sync(q
, ~0U, ~0U);
313 static int qdio_siga_output(struct qdio_q
*q
, unsigned int *busy_bit
)
320 if (q
->u
.out
.use_enh_siga
)
324 schid
= q
->irq_ptr
->sch_token
;
328 schid
= *((u32
*)&q
->irq_ptr
->schid
);
331 cc
= do_siga_output(schid
, q
->mask
, busy_bit
, fc
);
333 /* hipersocket busy condition */
335 WARN_ON(queue_type(q
) != QDIO_IQDIO_QFMT
|| cc
!= 2);
338 start_time
= get_usecs();
341 if ((get_usecs() - start_time
) < QDIO_BUSY_BIT_PATIENCE
)
347 static inline int qdio_siga_input(struct qdio_q
*q
)
351 DBF_DEV_EVENT(DBF_INFO
, q
->irq_ptr
, "siga-r:%1d", q
->nr
);
352 qperf_inc(q
, siga_read
);
354 cc
= do_siga_input(q
->irq_ptr
->schid
, q
->mask
);
356 DBF_ERROR("%4x SIGA-R:%2d", SCH_NO(q
), cc
);
360 static inline void qdio_sync_after_thinint(struct qdio_q
*q
)
362 if (pci_out_supported(q
)) {
363 if (need_siga_sync_thinint(q
))
364 qdio_siga_sync_all(q
);
365 else if (need_siga_sync_out_thinint(q
))
366 qdio_siga_sync_out(q
);
371 int debug_get_buf_state(struct qdio_q
*q
, unsigned int bufnr
,
372 unsigned char *state
)
375 return get_buf_states(q
, bufnr
, state
, 1, 0);
378 static inline void qdio_stop_polling(struct qdio_q
*q
)
380 if (!q
->u
.in
.polling
)
384 qperf_inc(q
, stop_polling
);
386 /* show the card that we are not polling anymore */
388 set_buf_states(q
, q
->u
.in
.ack_start
, SLSB_P_INPUT_NOT_INIT
,
390 q
->u
.in
.ack_count
= 0;
392 set_buf_state(q
, q
->u
.in
.ack_start
, SLSB_P_INPUT_NOT_INIT
);
395 static inline void account_sbals(struct qdio_q
*q
, int count
)
399 q
->q_stats
.nr_sbal_total
+= count
;
400 if (count
== QDIO_MAX_BUFFERS_MASK
) {
401 q
->q_stats
.nr_sbals
[7]++;
406 q
->q_stats
.nr_sbals
[pos
]++;
409 static void announce_buffer_error(struct qdio_q
*q
, int count
)
411 q
->qdio_error
|= QDIO_ERROR_SLSB_STATE
;
413 /* special handling for no target buffer empty */
414 if ((!q
->is_input_q
&&
415 (q
->sbal
[q
->first_to_check
]->element
[15].flags
& 0xff) == 0x10)) {
416 qperf_inc(q
, target_full
);
417 DBF_DEV_EVENT(DBF_INFO
, q
->irq_ptr
, "OUTFULL FTC:%02x",
422 DBF_ERROR("%4x BUF ERROR", SCH_NO(q
));
423 DBF_ERROR((q
->is_input_q
) ? "IN:%2d" : "OUT:%2d", q
->nr
);
424 DBF_ERROR("FTC:%3d C:%3d", q
->first_to_check
, count
);
425 DBF_ERROR("F14:%2x F15:%2x",
426 q
->sbal
[q
->first_to_check
]->element
[14].flags
& 0xff,
427 q
->sbal
[q
->first_to_check
]->element
[15].flags
& 0xff);
430 static inline void inbound_primed(struct qdio_q
*q
, int count
)
434 DBF_DEV_EVENT(DBF_INFO
, q
->irq_ptr
, "in prim: %02x", count
);
436 /* for QEBSM the ACK was already set by EQBS */
438 if (!q
->u
.in
.polling
) {
440 q
->u
.in
.ack_count
= count
;
441 q
->u
.in
.ack_start
= q
->first_to_check
;
445 /* delete the previous ACK's */
446 set_buf_states(q
, q
->u
.in
.ack_start
, SLSB_P_INPUT_NOT_INIT
,
448 q
->u
.in
.ack_count
= count
;
449 q
->u
.in
.ack_start
= q
->first_to_check
;
454 * ACK the newest buffer. The ACK will be removed in qdio_stop_polling
455 * or by the next inbound run.
457 new = add_buf(q
->first_to_check
, count
- 1);
458 if (q
->u
.in
.polling
) {
459 /* reset the previous ACK but first set the new one */
460 set_buf_state(q
, new, SLSB_P_INPUT_ACK
);
461 set_buf_state(q
, q
->u
.in
.ack_start
, SLSB_P_INPUT_NOT_INIT
);
464 set_buf_state(q
, new, SLSB_P_INPUT_ACK
);
467 q
->u
.in
.ack_start
= new;
471 /* need to change ALL buffers to get more interrupts */
472 set_buf_states(q
, q
->first_to_check
, SLSB_P_INPUT_NOT_INIT
, count
);
475 static int get_inbound_buffer_frontier(struct qdio_q
*q
)
481 * Don't check 128 buffers, as otherwise qdio_inbound_q_moved
484 count
= min(atomic_read(&q
->nr_buf_used
), QDIO_MAX_BUFFERS_MASK
);
485 stop
= add_buf(q
->first_to_check
, count
);
487 if (q
->first_to_check
== stop
)
491 * No siga sync here, as a PCI or we after a thin interrupt
492 * already sync'ed the queues.
494 count
= get_buf_states(q
, q
->first_to_check
, &state
, count
, 1);
499 case SLSB_P_INPUT_PRIMED
:
500 inbound_primed(q
, count
);
501 q
->first_to_check
= add_buf(q
->first_to_check
, count
);
502 if (atomic_sub(count
, &q
->nr_buf_used
) == 0)
503 qperf_inc(q
, inbound_queue_full
);
504 if (q
->irq_ptr
->perf_stat_enabled
)
505 account_sbals(q
, count
);
507 case SLSB_P_INPUT_ERROR
:
508 announce_buffer_error(q
, count
);
509 /* process the buffer, the upper layer will take care of it */
510 q
->first_to_check
= add_buf(q
->first_to_check
, count
);
511 atomic_sub(count
, &q
->nr_buf_used
);
512 if (q
->irq_ptr
->perf_stat_enabled
)
513 account_sbals_error(q
, count
);
515 case SLSB_CU_INPUT_EMPTY
:
516 case SLSB_P_INPUT_NOT_INIT
:
517 case SLSB_P_INPUT_ACK
:
518 if (q
->irq_ptr
->perf_stat_enabled
)
519 q
->q_stats
.nr_sbal_nop
++;
520 DBF_DEV_EVENT(DBF_INFO
, q
->irq_ptr
, "in nop");
526 return q
->first_to_check
;
529 static int qdio_inbound_q_moved(struct qdio_q
*q
)
533 bufnr
= get_inbound_buffer_frontier(q
);
535 if ((bufnr
!= q
->last_move
) || q
->qdio_error
) {
536 q
->last_move
= bufnr
;
537 if (!is_thinint_irq(q
->irq_ptr
) && MACHINE_IS_LPAR
)
538 q
->u
.in
.timestamp
= get_usecs();
544 static inline int qdio_inbound_q_done(struct qdio_q
*q
)
546 unsigned char state
= 0;
548 if (!atomic_read(&q
->nr_buf_used
))
552 get_buf_state(q
, q
->first_to_check
, &state
, 0);
554 if (state
== SLSB_P_INPUT_PRIMED
|| state
== SLSB_P_INPUT_ERROR
)
555 /* more work coming */
558 if (is_thinint_irq(q
->irq_ptr
))
561 /* don't poll under z/VM */
566 * At this point we know, that inbound first_to_check
567 * has (probably) not moved (see qdio_inbound_processing).
569 if (get_usecs() > q
->u
.in
.timestamp
+ QDIO_INPUT_THRESHOLD
) {
570 DBF_DEV_EVENT(DBF_INFO
, q
->irq_ptr
, "in done:%02x",
577 static void qdio_kick_handler(struct qdio_q
*q
)
579 int start
= q
->first_to_kick
;
580 int end
= q
->first_to_check
;
583 if (unlikely(q
->irq_ptr
->state
!= QDIO_IRQ_STATE_ACTIVE
))
586 count
= sub_buf(end
, start
);
589 qperf_inc(q
, inbound_handler
);
590 DBF_DEV_EVENT(DBF_INFO
, q
->irq_ptr
, "kih s:%02x c:%02x", start
, count
);
592 qperf_inc(q
, outbound_handler
);
593 DBF_DEV_EVENT(DBF_INFO
, q
->irq_ptr
, "koh: s:%02x c:%02x",
597 q
->handler(q
->irq_ptr
->cdev
, q
->qdio_error
, q
->nr
, start
, count
,
598 q
->irq_ptr
->int_parm
);
600 /* for the next time */
601 q
->first_to_kick
= end
;
605 static void __qdio_inbound_processing(struct qdio_q
*q
)
607 qperf_inc(q
, tasklet_inbound
);
609 if (!qdio_inbound_q_moved(q
))
612 qdio_kick_handler(q
);
614 if (!qdio_inbound_q_done(q
)) {
615 /* means poll time is not yet over */
616 qperf_inc(q
, tasklet_inbound_resched
);
620 qdio_stop_polling(q
);
622 * We need to check again to not lose initiative after
623 * resetting the ACK state.
625 if (!qdio_inbound_q_done(q
)) {
626 qperf_inc(q
, tasklet_inbound_resched2
);
631 void qdio_inbound_processing(unsigned long data
)
633 struct qdio_q
*q
= (struct qdio_q
*)data
;
634 __qdio_inbound_processing(q
);
637 static int get_outbound_buffer_frontier(struct qdio_q
*q
)
642 if (((queue_type(q
) != QDIO_IQDIO_QFMT
) && !pci_out_supported(q
)) ||
643 (queue_type(q
) == QDIO_IQDIO_QFMT
&& multicast_outbound(q
)))
647 * Don't check 128 buffers, as otherwise qdio_inbound_q_moved
650 count
= min(atomic_read(&q
->nr_buf_used
), QDIO_MAX_BUFFERS_MASK
);
651 stop
= add_buf(q
->first_to_check
, count
);
653 if (q
->first_to_check
== stop
)
654 return q
->first_to_check
;
656 count
= get_buf_states(q
, q
->first_to_check
, &state
, count
, 0);
658 return q
->first_to_check
;
661 case SLSB_P_OUTPUT_EMPTY
:
662 /* the adapter got it */
663 DBF_DEV_EVENT(DBF_INFO
, q
->irq_ptr
, "out empty:%1d %02x", q
->nr
, count
);
665 atomic_sub(count
, &q
->nr_buf_used
);
666 q
->first_to_check
= add_buf(q
->first_to_check
, count
);
667 if (q
->irq_ptr
->perf_stat_enabled
)
668 account_sbals(q
, count
);
670 case SLSB_P_OUTPUT_ERROR
:
671 announce_buffer_error(q
, count
);
672 /* process the buffer, the upper layer will take care of it */
673 q
->first_to_check
= add_buf(q
->first_to_check
, count
);
674 atomic_sub(count
, &q
->nr_buf_used
);
675 if (q
->irq_ptr
->perf_stat_enabled
)
676 account_sbals_error(q
, count
);
678 case SLSB_CU_OUTPUT_PRIMED
:
679 /* the adapter has not fetched the output yet */
680 if (q
->irq_ptr
->perf_stat_enabled
)
681 q
->q_stats
.nr_sbal_nop
++;
682 DBF_DEV_EVENT(DBF_INFO
, q
->irq_ptr
, "out primed:%1d", q
->nr
);
684 case SLSB_P_OUTPUT_NOT_INIT
:
685 case SLSB_P_OUTPUT_HALTED
:
690 return q
->first_to_check
;
693 /* all buffers processed? */
694 static inline int qdio_outbound_q_done(struct qdio_q
*q
)
696 return atomic_read(&q
->nr_buf_used
) == 0;
699 static inline int qdio_outbound_q_moved(struct qdio_q
*q
)
703 bufnr
= get_outbound_buffer_frontier(q
);
705 if ((bufnr
!= q
->last_move
) || q
->qdio_error
) {
706 q
->last_move
= bufnr
;
707 DBF_DEV_EVENT(DBF_INFO
, q
->irq_ptr
, "out moved:%1d", q
->nr
);
713 static int qdio_kick_outbound_q(struct qdio_q
*q
)
715 unsigned int busy_bit
;
718 if (!need_siga_out(q
))
721 DBF_DEV_EVENT(DBF_INFO
, q
->irq_ptr
, "siga-w:%1d", q
->nr
);
722 qperf_inc(q
, siga_write
);
724 cc
= qdio_siga_output(q
, &busy_bit
);
730 DBF_ERROR("%4x cc2 REP:%1d", SCH_NO(q
), q
->nr
);
731 cc
|= QDIO_ERROR_SIGA_BUSY
;
733 DBF_DEV_EVENT(DBF_INFO
, q
->irq_ptr
, "siga-w cc2:%1d", q
->nr
);
737 DBF_ERROR("%4x SIGA-W:%1d", SCH_NO(q
), cc
);
743 static void __qdio_outbound_processing(struct qdio_q
*q
)
745 qperf_inc(q
, tasklet_outbound
);
746 BUG_ON(atomic_read(&q
->nr_buf_used
) < 0);
748 if (qdio_outbound_q_moved(q
))
749 qdio_kick_handler(q
);
751 if (queue_type(q
) == QDIO_ZFCP_QFMT
)
752 if (!pci_out_supported(q
) && !qdio_outbound_q_done(q
))
755 /* bail out for HiperSockets unicast queues */
756 if (queue_type(q
) == QDIO_IQDIO_QFMT
&& !multicast_outbound(q
))
759 if ((queue_type(q
) == QDIO_IQDIO_QFMT
) &&
760 (atomic_read(&q
->nr_buf_used
)) > QDIO_IQDIO_POLL_LVL
)
763 if (q
->u
.out
.pci_out_enabled
)
767 * Now we know that queue type is either qeth without pci enabled
768 * or HiperSockets multicast. Make sure buffer switch from PRIMED to
769 * EMPTY is noticed and outbound_handler is called after some time.
771 if (qdio_outbound_q_done(q
))
772 del_timer(&q
->u
.out
.timer
);
774 if (!timer_pending(&q
->u
.out
.timer
))
775 mod_timer(&q
->u
.out
.timer
, jiffies
+ 10 * HZ
);
779 if (unlikely(q
->irq_ptr
->state
== QDIO_IRQ_STATE_STOPPED
))
781 tasklet_schedule(&q
->tasklet
);
784 /* outbound tasklet */
785 void qdio_outbound_processing(unsigned long data
)
787 struct qdio_q
*q
= (struct qdio_q
*)data
;
788 __qdio_outbound_processing(q
);
791 void qdio_outbound_timer(unsigned long data
)
793 struct qdio_q
*q
= (struct qdio_q
*)data
;
795 if (unlikely(q
->irq_ptr
->state
== QDIO_IRQ_STATE_STOPPED
))
797 tasklet_schedule(&q
->tasklet
);
800 static inline void qdio_check_outbound_after_thinint(struct qdio_q
*q
)
805 if (!pci_out_supported(q
))
808 for_each_output_queue(q
->irq_ptr
, out
, i
)
809 if (!qdio_outbound_q_done(out
))
810 tasklet_schedule(&out
->tasklet
);
813 static void __tiqdio_inbound_processing(struct qdio_q
*q
)
815 qperf_inc(q
, tasklet_inbound
);
816 qdio_sync_after_thinint(q
);
819 * The interrupt could be caused by a PCI request. Check the
820 * PCI capable outbound queues.
822 qdio_check_outbound_after_thinint(q
);
824 if (!qdio_inbound_q_moved(q
))
827 qdio_kick_handler(q
);
829 if (!qdio_inbound_q_done(q
)) {
830 qperf_inc(q
, tasklet_inbound_resched
);
831 if (likely(q
->irq_ptr
->state
!= QDIO_IRQ_STATE_STOPPED
)) {
832 tasklet_schedule(&q
->tasklet
);
837 qdio_stop_polling(q
);
839 * We need to check again to not lose initiative after
840 * resetting the ACK state.
842 if (!qdio_inbound_q_done(q
)) {
843 qperf_inc(q
, tasklet_inbound_resched2
);
844 if (likely(q
->irq_ptr
->state
!= QDIO_IRQ_STATE_STOPPED
))
845 tasklet_schedule(&q
->tasklet
);
849 void tiqdio_inbound_processing(unsigned long data
)
851 struct qdio_q
*q
= (struct qdio_q
*)data
;
852 __tiqdio_inbound_processing(q
);
855 static inline void qdio_set_state(struct qdio_irq
*irq_ptr
,
856 enum qdio_irq_states state
)
858 DBF_DEV_EVENT(DBF_INFO
, irq_ptr
, "newstate: %1d", state
);
860 irq_ptr
->state
= state
;
864 static void qdio_irq_check_sense(struct qdio_irq
*irq_ptr
, struct irb
*irb
)
866 if (irb
->esw
.esw0
.erw
.cons
) {
867 DBF_ERROR("%4x sense:", irq_ptr
->schid
.sch_no
);
868 DBF_ERROR_HEX(irb
, 64);
869 DBF_ERROR_HEX(irb
->ecw
, 64);
873 /* PCI interrupt handler */
874 static void qdio_int_handler_pci(struct qdio_irq
*irq_ptr
)
879 if (unlikely(irq_ptr
->state
== QDIO_IRQ_STATE_STOPPED
))
882 for_each_input_queue(irq_ptr
, q
, i
)
883 tasklet_schedule(&q
->tasklet
);
885 if (!(irq_ptr
->qib
.ac
& QIB_AC_OUTBOUND_PCI_SUPPORTED
))
888 for_each_output_queue(irq_ptr
, q
, i
) {
889 if (qdio_outbound_q_done(q
))
892 if (!siga_syncs_out_pci(q
))
895 tasklet_schedule(&q
->tasklet
);
899 static void qdio_handle_activate_check(struct ccw_device
*cdev
,
900 unsigned long intparm
, int cstat
, int dstat
)
902 struct qdio_irq
*irq_ptr
= cdev
->private->qdio_data
;
905 DBF_ERROR("%4x ACT CHECK", irq_ptr
->schid
.sch_no
);
906 DBF_ERROR("intp :%lx", intparm
);
907 DBF_ERROR("ds: %2x cs:%2x", dstat
, cstat
);
909 if (irq_ptr
->nr_input_qs
) {
910 q
= irq_ptr
->input_qs
[0];
911 } else if (irq_ptr
->nr_output_qs
) {
912 q
= irq_ptr
->output_qs
[0];
917 q
->handler(q
->irq_ptr
->cdev
, QDIO_ERROR_ACTIVATE_CHECK_CONDITION
,
918 0, -1, -1, irq_ptr
->int_parm
);
920 qdio_set_state(irq_ptr
, QDIO_IRQ_STATE_STOPPED
);
923 static void qdio_establish_handle_irq(struct ccw_device
*cdev
, int cstat
,
926 struct qdio_irq
*irq_ptr
= cdev
->private->qdio_data
;
928 DBF_DEV_EVENT(DBF_INFO
, irq_ptr
, "qest irq");
932 if (dstat
& ~(DEV_STAT_DEV_END
| DEV_STAT_CHN_END
))
934 if (!(dstat
& DEV_STAT_DEV_END
))
936 qdio_set_state(irq_ptr
, QDIO_IRQ_STATE_ESTABLISHED
);
940 DBF_ERROR("%4x EQ:error", irq_ptr
->schid
.sch_no
);
941 DBF_ERROR("ds: %2x cs:%2x", dstat
, cstat
);
942 qdio_set_state(irq_ptr
, QDIO_IRQ_STATE_ERR
);
945 /* qdio interrupt handler */
946 void qdio_int_handler(struct ccw_device
*cdev
, unsigned long intparm
,
949 struct qdio_irq
*irq_ptr
= cdev
->private->qdio_data
;
952 if (!intparm
|| !irq_ptr
) {
953 DBF_ERROR("qint:%4x", cdev
->private->schid
.sch_no
);
958 switch (PTR_ERR(irb
)) {
960 DBF_ERROR("%4x IO error", irq_ptr
->schid
.sch_no
);
961 qdio_set_state(irq_ptr
, QDIO_IRQ_STATE_ERR
);
962 wake_up(&cdev
->private->wait_q
);
969 qdio_irq_check_sense(irq_ptr
, irb
);
970 cstat
= irb
->scsw
.cmd
.cstat
;
971 dstat
= irb
->scsw
.cmd
.dstat
;
973 switch (irq_ptr
->state
) {
974 case QDIO_IRQ_STATE_INACTIVE
:
975 qdio_establish_handle_irq(cdev
, cstat
, dstat
);
977 case QDIO_IRQ_STATE_CLEANUP
:
978 qdio_set_state(irq_ptr
, QDIO_IRQ_STATE_INACTIVE
);
980 case QDIO_IRQ_STATE_ESTABLISHED
:
981 case QDIO_IRQ_STATE_ACTIVE
:
982 if (cstat
& SCHN_STAT_PCI
) {
983 qdio_int_handler_pci(irq_ptr
);
987 qdio_handle_activate_check(cdev
, intparm
, cstat
,
990 case QDIO_IRQ_STATE_STOPPED
:
995 wake_up(&cdev
->private->wait_q
);
999 * qdio_get_ssqd_desc - get qdio subchannel description
1000 * @cdev: ccw device to get description for
1001 * @data: where to store the ssqd
1003 * Returns 0 or an error code. The results of the chsc are stored in the
1004 * specified structure.
1006 int qdio_get_ssqd_desc(struct ccw_device
*cdev
,
1007 struct qdio_ssqd_desc
*data
)
1010 if (!cdev
|| !cdev
->private)
1013 DBF_EVENT("get ssqd:%4x", cdev
->private->schid
.sch_no
);
1014 return qdio_setup_get_ssqd(NULL
, &cdev
->private->schid
, data
);
1016 EXPORT_SYMBOL_GPL(qdio_get_ssqd_desc
);
1019 * qdio_cleanup - shutdown queues and free data structures
1020 * @cdev: associated ccw device
1021 * @how: use halt or clear to shutdown
1023 * This function calls qdio_shutdown() for @cdev with method @how.
1024 * and qdio_free(). The qdio_free() return value is ignored since
1025 * !irq_ptr is already checked.
1027 int qdio_cleanup(struct ccw_device
*cdev
, int how
)
1029 struct qdio_irq
*irq_ptr
= cdev
->private->qdio_data
;
1035 rc
= qdio_shutdown(cdev
, how
);
1040 EXPORT_SYMBOL_GPL(qdio_cleanup
);
1042 static void qdio_shutdown_queues(struct ccw_device
*cdev
)
1044 struct qdio_irq
*irq_ptr
= cdev
->private->qdio_data
;
1048 for_each_input_queue(irq_ptr
, q
, i
)
1049 tasklet_kill(&q
->tasklet
);
1051 for_each_output_queue(irq_ptr
, q
, i
) {
1052 del_timer(&q
->u
.out
.timer
);
1053 tasklet_kill(&q
->tasklet
);
1058 * qdio_shutdown - shut down a qdio subchannel
1059 * @cdev: associated ccw device
1060 * @how: use halt or clear to shutdown
1062 int qdio_shutdown(struct ccw_device
*cdev
, int how
)
1064 struct qdio_irq
*irq_ptr
= cdev
->private->qdio_data
;
1066 unsigned long flags
;
1071 BUG_ON(irqs_disabled());
1072 DBF_EVENT("qshutdown:%4x", cdev
->private->schid
.sch_no
);
1074 mutex_lock(&irq_ptr
->setup_mutex
);
1076 * Subchannel was already shot down. We cannot prevent being called
1077 * twice since cio may trigger a shutdown asynchronously.
1079 if (irq_ptr
->state
== QDIO_IRQ_STATE_INACTIVE
) {
1080 mutex_unlock(&irq_ptr
->setup_mutex
);
1085 * Indicate that the device is going down. Scheduling the queue
1086 * tasklets is forbidden from here on.
1088 qdio_set_state(irq_ptr
, QDIO_IRQ_STATE_STOPPED
);
1090 tiqdio_remove_input_queues(irq_ptr
);
1091 qdio_shutdown_queues(cdev
);
1092 qdio_shutdown_debug_entries(irq_ptr
, cdev
);
1094 /* cleanup subchannel */
1095 spin_lock_irqsave(get_ccwdev_lock(cdev
), flags
);
1097 if (how
& QDIO_FLAG_CLEANUP_USING_CLEAR
)
1098 rc
= ccw_device_clear(cdev
, QDIO_DOING_CLEANUP
);
1100 /* default behaviour is halt */
1101 rc
= ccw_device_halt(cdev
, QDIO_DOING_CLEANUP
);
1103 DBF_ERROR("%4x SHUTD ERR", irq_ptr
->schid
.sch_no
);
1104 DBF_ERROR("rc:%4d", rc
);
1108 qdio_set_state(irq_ptr
, QDIO_IRQ_STATE_CLEANUP
);
1109 spin_unlock_irqrestore(get_ccwdev_lock(cdev
), flags
);
1110 wait_event_interruptible_timeout(cdev
->private->wait_q
,
1111 irq_ptr
->state
== QDIO_IRQ_STATE_INACTIVE
||
1112 irq_ptr
->state
== QDIO_IRQ_STATE_ERR
,
1114 spin_lock_irqsave(get_ccwdev_lock(cdev
), flags
);
1117 qdio_shutdown_thinint(irq_ptr
);
1119 /* restore interrupt handler */
1120 if ((void *)cdev
->handler
== (void *)qdio_int_handler
)
1121 cdev
->handler
= irq_ptr
->orig_handler
;
1122 spin_unlock_irqrestore(get_ccwdev_lock(cdev
), flags
);
1124 qdio_set_state(irq_ptr
, QDIO_IRQ_STATE_INACTIVE
);
1125 mutex_unlock(&irq_ptr
->setup_mutex
);
1130 EXPORT_SYMBOL_GPL(qdio_shutdown
);
1133 * qdio_free - free data structures for a qdio subchannel
1134 * @cdev: associated ccw device
1136 int qdio_free(struct ccw_device
*cdev
)
1138 struct qdio_irq
*irq_ptr
= cdev
->private->qdio_data
;
1143 DBF_EVENT("qfree:%4x", cdev
->private->schid
.sch_no
);
1144 mutex_lock(&irq_ptr
->setup_mutex
);
1146 if (irq_ptr
->debug_area
!= NULL
) {
1147 debug_unregister(irq_ptr
->debug_area
);
1148 irq_ptr
->debug_area
= NULL
;
1150 cdev
->private->qdio_data
= NULL
;
1151 mutex_unlock(&irq_ptr
->setup_mutex
);
1153 qdio_release_memory(irq_ptr
);
1156 EXPORT_SYMBOL_GPL(qdio_free
);
1159 * qdio_initialize - allocate and establish queues for a qdio subchannel
1160 * @init_data: initialization data
1162 * This function first allocates queues via qdio_allocate() and on success
1163 * establishes them via qdio_establish().
1165 int qdio_initialize(struct qdio_initialize
*init_data
)
1169 rc
= qdio_allocate(init_data
);
1173 rc
= qdio_establish(init_data
);
1175 qdio_free(init_data
->cdev
);
1178 EXPORT_SYMBOL_GPL(qdio_initialize
);
1181 * qdio_allocate - allocate qdio queues and associated data
1182 * @init_data: initialization data
1184 int qdio_allocate(struct qdio_initialize
*init_data
)
1186 struct qdio_irq
*irq_ptr
;
1188 DBF_EVENT("qallocate:%4x", init_data
->cdev
->private->schid
.sch_no
);
1190 if ((init_data
->no_input_qs
&& !init_data
->input_handler
) ||
1191 (init_data
->no_output_qs
&& !init_data
->output_handler
))
1194 if ((init_data
->no_input_qs
> QDIO_MAX_QUEUES_PER_IRQ
) ||
1195 (init_data
->no_output_qs
> QDIO_MAX_QUEUES_PER_IRQ
))
1198 if ((!init_data
->input_sbal_addr_array
) ||
1199 (!init_data
->output_sbal_addr_array
))
1202 /* irq_ptr must be in GFP_DMA since it contains ccw1.cda */
1203 irq_ptr
= (void *) get_zeroed_page(GFP_KERNEL
| GFP_DMA
);
1207 mutex_init(&irq_ptr
->setup_mutex
);
1208 qdio_allocate_dbf(init_data
, irq_ptr
);
1211 * Allocate a page for the chsc calls in qdio_establish.
1212 * Must be pre-allocated since a zfcp recovery will call
1213 * qdio_establish. In case of low memory and swap on a zfcp disk
1214 * we may not be able to allocate memory otherwise.
1216 irq_ptr
->chsc_page
= get_zeroed_page(GFP_KERNEL
);
1217 if (!irq_ptr
->chsc_page
)
1220 /* qdr is used in ccw1.cda which is u32 */
1221 irq_ptr
->qdr
= (struct qdr
*) get_zeroed_page(GFP_KERNEL
| GFP_DMA
);
1224 WARN_ON((unsigned long)irq_ptr
->qdr
& 0xfff);
1226 if (qdio_allocate_qs(irq_ptr
, init_data
->no_input_qs
,
1227 init_data
->no_output_qs
))
1230 init_data
->cdev
->private->qdio_data
= irq_ptr
;
1231 qdio_set_state(irq_ptr
, QDIO_IRQ_STATE_INACTIVE
);
1234 qdio_release_memory(irq_ptr
);
1238 EXPORT_SYMBOL_GPL(qdio_allocate
);
1241 * qdio_establish - establish queues on a qdio subchannel
1242 * @init_data: initialization data
1244 int qdio_establish(struct qdio_initialize
*init_data
)
1246 struct qdio_irq
*irq_ptr
;
1247 struct ccw_device
*cdev
= init_data
->cdev
;
1248 unsigned long saveflags
;
1251 DBF_EVENT("qestablish:%4x", cdev
->private->schid
.sch_no
);
1253 irq_ptr
= cdev
->private->qdio_data
;
1257 if (cdev
->private->state
!= DEV_STATE_ONLINE
)
1260 mutex_lock(&irq_ptr
->setup_mutex
);
1261 qdio_setup_irq(init_data
);
1263 rc
= qdio_establish_thinint(irq_ptr
);
1265 mutex_unlock(&irq_ptr
->setup_mutex
);
1266 qdio_shutdown(cdev
, QDIO_FLAG_CLEANUP_USING_CLEAR
);
1271 irq_ptr
->ccw
.cmd_code
= irq_ptr
->equeue
.cmd
;
1272 irq_ptr
->ccw
.flags
= CCW_FLAG_SLI
;
1273 irq_ptr
->ccw
.count
= irq_ptr
->equeue
.count
;
1274 irq_ptr
->ccw
.cda
= (u32
)((addr_t
)irq_ptr
->qdr
);
1276 spin_lock_irqsave(get_ccwdev_lock(cdev
), saveflags
);
1277 ccw_device_set_options_mask(cdev
, 0);
1279 rc
= ccw_device_start(cdev
, &irq_ptr
->ccw
, QDIO_DOING_ESTABLISH
, 0, 0);
1281 DBF_ERROR("%4x est IO ERR", irq_ptr
->schid
.sch_no
);
1282 DBF_ERROR("rc:%4x", rc
);
1284 spin_unlock_irqrestore(get_ccwdev_lock(cdev
), saveflags
);
1287 mutex_unlock(&irq_ptr
->setup_mutex
);
1288 qdio_shutdown(cdev
, QDIO_FLAG_CLEANUP_USING_CLEAR
);
1292 wait_event_interruptible_timeout(cdev
->private->wait_q
,
1293 irq_ptr
->state
== QDIO_IRQ_STATE_ESTABLISHED
||
1294 irq_ptr
->state
== QDIO_IRQ_STATE_ERR
, HZ
);
1296 if (irq_ptr
->state
!= QDIO_IRQ_STATE_ESTABLISHED
) {
1297 mutex_unlock(&irq_ptr
->setup_mutex
);
1298 qdio_shutdown(cdev
, QDIO_FLAG_CLEANUP_USING_CLEAR
);
1302 qdio_setup_ssqd_info(irq_ptr
);
1303 DBF_EVENT("qDmmwc:%2x", irq_ptr
->ssqd_desc
.mmwc
);
1304 DBF_EVENT("qib ac:%4x", irq_ptr
->qib
.ac
);
1306 /* qebsm is now setup if available, initialize buffer states */
1307 qdio_init_buf_states(irq_ptr
);
1309 mutex_unlock(&irq_ptr
->setup_mutex
);
1310 qdio_print_subchannel_info(irq_ptr
, cdev
);
1311 qdio_setup_debug_entries(irq_ptr
, cdev
);
1314 EXPORT_SYMBOL_GPL(qdio_establish
);
1317 * qdio_activate - activate queues on a qdio subchannel
1318 * @cdev: associated cdev
1320 int qdio_activate(struct ccw_device
*cdev
)
1322 struct qdio_irq
*irq_ptr
;
1324 unsigned long saveflags
;
1326 DBF_EVENT("qactivate:%4x", cdev
->private->schid
.sch_no
);
1328 irq_ptr
= cdev
->private->qdio_data
;
1332 if (cdev
->private->state
!= DEV_STATE_ONLINE
)
1335 mutex_lock(&irq_ptr
->setup_mutex
);
1336 if (irq_ptr
->state
== QDIO_IRQ_STATE_INACTIVE
) {
1341 irq_ptr
->ccw
.cmd_code
= irq_ptr
->aqueue
.cmd
;
1342 irq_ptr
->ccw
.flags
= CCW_FLAG_SLI
;
1343 irq_ptr
->ccw
.count
= irq_ptr
->aqueue
.count
;
1344 irq_ptr
->ccw
.cda
= 0;
1346 spin_lock_irqsave(get_ccwdev_lock(cdev
), saveflags
);
1347 ccw_device_set_options(cdev
, CCWDEV_REPORT_ALL
);
1349 rc
= ccw_device_start(cdev
, &irq_ptr
->ccw
, QDIO_DOING_ACTIVATE
,
1350 0, DOIO_DENY_PREFETCH
);
1352 DBF_ERROR("%4x act IO ERR", irq_ptr
->schid
.sch_no
);
1353 DBF_ERROR("rc:%4x", rc
);
1355 spin_unlock_irqrestore(get_ccwdev_lock(cdev
), saveflags
);
1360 if (is_thinint_irq(irq_ptr
))
1361 tiqdio_add_input_queues(irq_ptr
);
1363 /* wait for subchannel to become active */
1366 switch (irq_ptr
->state
) {
1367 case QDIO_IRQ_STATE_STOPPED
:
1368 case QDIO_IRQ_STATE_ERR
:
1372 qdio_set_state(irq_ptr
, QDIO_IRQ_STATE_ACTIVE
);
1376 mutex_unlock(&irq_ptr
->setup_mutex
);
1379 EXPORT_SYMBOL_GPL(qdio_activate
);
1381 static inline int buf_in_between(int bufnr
, int start
, int count
)
1383 int end
= add_buf(start
, count
);
1386 if (bufnr
>= start
&& bufnr
< end
)
1392 /* wrap-around case */
1393 if ((bufnr
>= start
&& bufnr
<= QDIO_MAX_BUFFERS_PER_Q
) ||
1401 * handle_inbound - reset processed input buffers
1402 * @q: queue containing the buffers
1404 * @bufnr: first buffer to process
1405 * @count: how many buffers are emptied
1407 static int handle_inbound(struct qdio_q
*q
, unsigned int callflags
,
1408 int bufnr
, int count
)
1412 qperf_inc(q
, inbound_call
);
1414 if (!q
->u
.in
.polling
)
1417 /* protect against stop polling setting an ACK for an emptied slsb */
1418 if (count
== QDIO_MAX_BUFFERS_PER_Q
) {
1419 /* overwriting everything, just delete polling status */
1420 q
->u
.in
.polling
= 0;
1421 q
->u
.in
.ack_count
= 0;
1423 } else if (buf_in_between(q
->u
.in
.ack_start
, bufnr
, count
)) {
1425 /* partial overwrite, just update ack_start */
1426 diff
= add_buf(bufnr
, count
);
1427 diff
= sub_buf(diff
, q
->u
.in
.ack_start
);
1428 q
->u
.in
.ack_count
-= diff
;
1429 if (q
->u
.in
.ack_count
<= 0) {
1430 q
->u
.in
.polling
= 0;
1431 q
->u
.in
.ack_count
= 0;
1434 q
->u
.in
.ack_start
= add_buf(q
->u
.in
.ack_start
, diff
);
1437 /* the only ACK will be deleted, so stop polling */
1438 q
->u
.in
.polling
= 0;
1442 count
= set_buf_states(q
, bufnr
, SLSB_CU_INPUT_EMPTY
, count
);
1444 used
= atomic_add_return(count
, &q
->nr_buf_used
) - count
;
1445 BUG_ON(used
+ count
> QDIO_MAX_BUFFERS_PER_Q
);
1447 /* no need to signal as long as the adapter had free buffers */
1451 if (need_siga_in(q
))
1452 return qdio_siga_input(q
);
1457 * handle_outbound - process filled outbound buffers
1458 * @q: queue containing the buffers
1460 * @bufnr: first buffer to process
1461 * @count: how many buffers are filled
1463 static int handle_outbound(struct qdio_q
*q
, unsigned int callflags
,
1464 int bufnr
, int count
)
1466 unsigned char state
;
1469 qperf_inc(q
, outbound_call
);
1471 count
= set_buf_states(q
, bufnr
, SLSB_CU_OUTPUT_PRIMED
, count
);
1472 used
= atomic_add_return(count
, &q
->nr_buf_used
);
1473 BUG_ON(used
> QDIO_MAX_BUFFERS_PER_Q
);
1475 if (callflags
& QDIO_FLAG_PCI_OUT
) {
1476 q
->u
.out
.pci_out_enabled
= 1;
1477 qperf_inc(q
, pci_request_int
);
1480 q
->u
.out
.pci_out_enabled
= 0;
1482 if (queue_type(q
) == QDIO_IQDIO_QFMT
) {
1483 if (multicast_outbound(q
))
1484 rc
= qdio_kick_outbound_q(q
);
1486 if ((q
->irq_ptr
->ssqd_desc
.mmwc
> 1) &&
1488 (count
<= q
->irq_ptr
->ssqd_desc
.mmwc
)) {
1489 /* exploit enhanced SIGA */
1490 q
->u
.out
.use_enh_siga
= 1;
1491 rc
= qdio_kick_outbound_q(q
);
1494 * One siga-w per buffer required for unicast
1497 q
->u
.out
.use_enh_siga
= 0;
1499 rc
= qdio_kick_outbound_q(q
);
1507 if (need_siga_sync(q
)) {
1508 qdio_siga_sync_q(q
);
1512 /* try to fast requeue buffers */
1513 get_buf_state(q
, prev_buf(bufnr
), &state
, 0);
1514 if (state
!= SLSB_CU_OUTPUT_PRIMED
)
1515 rc
= qdio_kick_outbound_q(q
);
1517 qperf_inc(q
, fast_requeue
);
1520 tasklet_schedule(&q
->tasklet
);
1525 * do_QDIO - process input or output buffers
1526 * @cdev: associated ccw_device for the qdio subchannel
1527 * @callflags: input or output and special flags from the program
1528 * @q_nr: queue number
1529 * @bufnr: buffer number
1530 * @count: how many buffers to process
1532 int do_QDIO(struct ccw_device
*cdev
, unsigned int callflags
,
1533 int q_nr
, unsigned int bufnr
, unsigned int count
)
1535 struct qdio_irq
*irq_ptr
;
1537 if (bufnr
>= QDIO_MAX_BUFFERS_PER_Q
|| count
> QDIO_MAX_BUFFERS_PER_Q
)
1540 irq_ptr
= cdev
->private->qdio_data
;
1544 DBF_DEV_EVENT(DBF_INFO
, irq_ptr
,
1545 "do%02x b:%02x c:%02x", callflags
, bufnr
, count
);
1547 if (irq_ptr
->state
!= QDIO_IRQ_STATE_ACTIVE
)
1550 if (callflags
& QDIO_FLAG_SYNC_INPUT
)
1551 return handle_inbound(irq_ptr
->input_qs
[q_nr
],
1552 callflags
, bufnr
, count
);
1553 else if (callflags
& QDIO_FLAG_SYNC_OUTPUT
)
1554 return handle_outbound(irq_ptr
->output_qs
[q_nr
],
1555 callflags
, bufnr
, count
);
1558 EXPORT_SYMBOL_GPL(do_QDIO
);
1560 static int __init
init_QDIO(void)
1564 rc
= qdio_setup_init();
1567 rc
= tiqdio_allocate_memory();
1570 rc
= qdio_debug_init();
1573 rc
= tiqdio_register_thinints();
1581 tiqdio_free_memory();
1587 static void __exit
exit_QDIO(void)
1589 tiqdio_unregister_thinints();
1590 tiqdio_free_memory();
1595 module_init(init_QDIO
);
1596 module_exit(exit_QDIO
);