Merge remote-tracking branch 'origin/master'
[unleashed/lotheac.git] / usr / src / uts / common / io / 1394 / adapters / hci1394_isr.c
blob454e3fc45604644d47352025c0a7f1a3ef767186
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
27 * hci1394_isr.c
28 * Contains the core interrupt handling logic for the hci1394 driver.
29 * It also contains the routine which sets up the initial interrupt
30 * mask during HW init.
33 #include <sys/conf.h>
34 #include <sys/ddi.h>
35 #include <sys/modctl.h>
36 #include <sys/stat.h>
37 #include <sys/sunddi.h>
38 #include <sys/cmn_err.h>
40 #include <sys/1394/h1394.h>
41 #include <sys/1394/adapters/hci1394.h>
44 static uint_t hci1394_isr(caddr_t parm);
45 static void hci1394_isr_bus_reset(hci1394_state_t *soft_state);
46 static void hci1394_isr_self_id(hci1394_state_t *soft_state);
47 static void hci1394_isr_isoch_ir(hci1394_state_t *soft_state);
48 static void hci1394_isr_isoch_it(hci1394_state_t *soft_state);
49 static void hci1394_isr_atreq_complete(hci1394_state_t *soft_state);
50 static void hci1394_isr_arresp(hci1394_state_t *soft_state);
51 static void hci1394_isr_arreq(hci1394_state_t *soft_state);
52 static void hci1394_isr_atresp_complete(hci1394_state_t *soft_state);
56 * hci1394_isr_init()
57 * Get the iblock_cookie, make sure we are not using a high level interrupt,
58 * register our interrupt service routine.
60 int
61 hci1394_isr_init(hci1394_state_t *soft_state)
63 int status;
66 ASSERT(soft_state != NULL);
68 /* This driver does not support running at a high level interrupt */
69 status = ddi_intr_hilevel(soft_state->drvinfo.di_dip, 0);
70 if (status != 0) {
71 return (DDI_FAILURE);
74 /* There should only be 1 1394 interrupt for an OpenHCI adapter */
75 status = ddi_get_iblock_cookie(soft_state->drvinfo.di_dip, 0,
76 &soft_state->drvinfo.di_iblock_cookie);
77 if (status != DDI_SUCCESS) {
78 return (DDI_FAILURE);
81 return (DDI_SUCCESS);
86 * hci1394_isr_fini()
87 * un-register our interrupt service routine.
89 /* ARGSUSED */
90 void
91 hci1394_isr_fini(hci1394_state_t *soft_state)
93 ASSERT(soft_state != NULL);
98 * hci1394_isr_handler_init()
99 * register our interrupt service routine.
102 hci1394_isr_handler_init(hci1394_state_t *soft_state)
104 int status;
106 ASSERT(soft_state != NULL);
108 /* Initialize interrupt handler */
109 status = ddi_add_intr(soft_state->drvinfo.di_dip, 0, NULL, NULL,
110 hci1394_isr, (caddr_t)soft_state);
111 if (status != DDI_SUCCESS) {
112 return (DDI_FAILURE);
115 return (DDI_SUCCESS);
120 * hci1394_isr_handler_fini()
121 * un-register our interrupt service routine.
123 void
124 hci1394_isr_handler_fini(hci1394_state_t *soft_state)
126 ASSERT(soft_state != NULL);
128 /* Remove interrupt handler */
129 ddi_remove_intr(soft_state->drvinfo.di_dip, 0,
130 soft_state->drvinfo.di_iblock_cookie);
135 * hci1394_isr_mask_setup()
136 * Setup the initial interrupt mask for OpenHCI. These are the interrupts
137 * that our interrupt handler is expected to handle.
139 void
140 hci1394_isr_mask_setup(hci1394_state_t *soft_state)
142 ASSERT(soft_state != NULL);
144 /* start off with all interrupts cleared/disabled */
145 hci1394_ohci_ir_intr_disable(soft_state->ohci, 0xFFFFFFFF);
146 hci1394_ohci_ir_intr_clear(soft_state->ohci, 0xFFFFFFFF);
147 hci1394_ohci_it_intr_disable(soft_state->ohci, 0xFFFFFFFF);
148 hci1394_ohci_it_intr_clear(soft_state->ohci, 0xFFFFFFFF);
149 hci1394_ohci_intr_disable(soft_state->ohci, 0xFFFFFFFF);
150 hci1394_ohci_intr_clear(soft_state->ohci, 0xFFFFFFFF);
152 /* Setup Interrupt Mask Register */
153 hci1394_ohci_intr_enable(soft_state->ohci,
154 (OHCI_INTR_UNRECOVERABLE_ERR | OHCI_INTR_CYC_TOO_LONG |
155 OHCI_INTR_BUS_RESET | OHCI_INTR_SELFID_CMPLT |
156 OHCI_INTR_REQ_TX_CMPLT | OHCI_INTR_RESP_TX_CMPLT |
157 OHCI_INTR_RQPKT | OHCI_INTR_RSPKT | OHCI_INTR_ISOCH_TX |
158 OHCI_INTR_ISOCH_RX | OHCI_INTR_POST_WR_ERR | OHCI_INTR_PHY |
159 OHCI_INTR_LOCK_RESP_ERR));
164 * hci1394_isr()
165 * Core interrupt handler. Every interrupt enabled in
166 * hci1394_isr_mask_setup() should be covered here. There may be other
167 * interrupts supported in here even if they are not initially enabled
168 * (like OHCI_INTR_CYC_64_SECS) since they may be enabled later (i.e. due to
169 * CSR register write)
171 static uint_t
172 hci1394_isr(caddr_t parm)
174 hci1394_state_t *soft_state;
175 h1394_posted_wr_err_t posted_wr_err;
176 uint32_t interrupt_event;
177 uint_t status;
180 status = DDI_INTR_UNCLAIMED;
181 soft_state = (hci1394_state_t *)parm;
183 ASSERT(soft_state != NULL);
185 if (hci1394_state(&soft_state->drvinfo) == HCI1394_SHUTDOWN)
186 return (DDI_INTR_UNCLAIMED);
189 * Get all of the enabled 1394 interrupts which are currently
190 * asserted.
192 interrupt_event = hci1394_ohci_intr_asserted(soft_state->ohci);
193 do {
194 /* handle the asserted interrupts */
195 if (interrupt_event & OHCI_INTR_BUS_RESET) {
196 hci1394_isr_bus_reset(soft_state);
197 status = DDI_INTR_CLAIMED;
199 if (interrupt_event & OHCI_INTR_SELFID_CMPLT) {
200 hci1394_isr_self_id(soft_state);
201 status = DDI_INTR_CLAIMED;
203 if (interrupt_event & OHCI_INTR_ISOCH_TX) {
204 hci1394_isr_isoch_it(soft_state);
205 status = DDI_INTR_CLAIMED;
207 if (interrupt_event & OHCI_INTR_ISOCH_RX) {
208 hci1394_isr_isoch_ir(soft_state);
209 status = DDI_INTR_CLAIMED;
211 if (interrupt_event & OHCI_INTR_REQ_TX_CMPLT) {
212 hci1394_isr_atreq_complete(soft_state);
213 status = DDI_INTR_CLAIMED;
215 if (interrupt_event & OHCI_INTR_RSPKT) {
216 hci1394_isr_arresp(soft_state);
217 status = DDI_INTR_CLAIMED;
219 if (interrupt_event & OHCI_INTR_RQPKT) {
220 hci1394_isr_arreq(soft_state);
221 status = DDI_INTR_CLAIMED;
223 if (interrupt_event & OHCI_INTR_RESP_TX_CMPLT) {
224 hci1394_isr_atresp_complete(soft_state);
225 status = DDI_INTR_CLAIMED;
227 if (interrupt_event & OHCI_INTR_CYC_64_SECS) {
228 hci1394_ohci_isr_cycle64seconds(soft_state->ohci);
229 status = DDI_INTR_CLAIMED;
231 if (interrupt_event & OHCI_INTR_UNRECOVERABLE_ERR) {
232 h1394_error_detected(soft_state->drvinfo.di_sl_private,
233 H1394_SELF_INITIATED_SHUTDOWN, NULL);
234 cmn_err(CE_WARN, "hci1394(%d): driver shutdown: "
235 "unrecoverable error interrupt detected",
236 soft_state->drvinfo.di_instance);
237 hci1394_shutdown(soft_state->drvinfo.di_dip);
238 status = DDI_INTR_CLAIMED;
240 if (interrupt_event & OHCI_INTR_CYC_LOST) {
241 hci1394_isoch_cycle_lost(soft_state);
242 status = DDI_INTR_CLAIMED;
244 if (interrupt_event & OHCI_INTR_CYC_INCONSISTENT) {
245 hci1394_isoch_cycle_inconsistent(soft_state);
246 status = DDI_INTR_CLAIMED;
248 if (interrupt_event & OHCI_INTR_CYC_TOO_LONG) {
249 hci1394_ohci_intr_clear(soft_state->ohci,
250 OHCI_INTR_CYC_TOO_LONG);
251 /* clear cycle master bit in csr state register */
252 hci1394_csr_state_bclr(soft_state->csr,
253 IEEE1394_CSR_STATE_CMSTR);
254 h1394_error_detected(soft_state->drvinfo.di_sl_private,
255 H1394_CYCLE_TOO_LONG, NULL);
256 status = DDI_INTR_CLAIMED;
258 if (interrupt_event & OHCI_INTR_POST_WR_ERR) {
259 hci1394_ohci_postwr_addr(soft_state->ohci,
260 &posted_wr_err.addr);
261 h1394_error_detected(soft_state->drvinfo.di_sl_private,
262 H1394_POSTED_WR_ERR, &posted_wr_err);
263 status = DDI_INTR_CLAIMED;
265 if (interrupt_event & OHCI_INTR_PHY) {
266 hci1394_ohci_isr_phy(soft_state->ohci);
267 status = DDI_INTR_CLAIMED;
269 if (interrupt_event & OHCI_INTR_LOCK_RESP_ERR) {
270 hci1394_ohci_intr_clear(soft_state->ohci,
271 OHCI_INTR_LOCK_RESP_ERR);
272 h1394_error_detected(soft_state->drvinfo.di_sl_private,
273 H1394_LOCK_RESP_ERR, NULL);
274 status = DDI_INTR_CLAIMED;
278 * Check for self-id-complete interrupt disappearing. There is
279 * a chance in OpenHCI where it will assert the selfid
280 * interrupt and then take it away. We will look for this case
281 * and claim it just in case. We could possibly claim an
282 * interrupt that's not ours. We would have to be in the
283 * middle of a bus reset and a bunch of other weird stuff
284 * would have to align. It should not hurt anything if we do.
286 * This will very very rarely happen, if ever. We still have
287 * to handle the case, just in case. OpenHCI 1.1 should fix
288 * this problem.
290 if ((status == DDI_INTR_UNCLAIMED) &&
291 (hci1394_state(&soft_state->drvinfo) ==
292 HCI1394_BUS_RESET)) {
293 if (soft_state->drvinfo.di_gencnt !=
294 hci1394_ohci_current_busgen(soft_state->ohci)) {
295 status = DDI_INTR_CLAIMED;
300 * See if any of the enabled 1394 interrupts have been asserted
301 * since we first checked.
303 interrupt_event = hci1394_ohci_intr_asserted(
304 soft_state->ohci);
305 } while (interrupt_event != 0);
307 return (status);
312 * hci1394_isr_bus_reset()
313 * Process a 1394 bus reset. This signifies that a bus reset has started.
314 * A bus reset will not be complete until a selfid complete interrupt
315 * comes in.
317 static void
318 hci1394_isr_bus_reset(hci1394_state_t *soft_state)
320 int status;
323 ASSERT(soft_state != NULL);
326 * Set the driver state to reset. If we cannot, we have been shutdown.
327 * The only way we can get in this code is if we have a multi-processor
328 * machine and the HAL is shutdown by one processor running in base
329 * context while this interrupt handler runs in another processor.
330 * We will disable all interrupts and just return. We shouldn't have
331 * to disable the interrupts, but we will just in case.
333 status = hci1394_state_set(&soft_state->drvinfo, HCI1394_BUS_RESET);
334 if (status != DDI_SUCCESS) {
335 hci1394_ohci_intr_master_disable(soft_state->ohci);
336 return;
340 * Save away reset generation count so we can detect self-id-compete
341 * interrupt which disappears in event register. This is discussed in
342 * more detail in hci1394_isr()
344 soft_state->drvinfo.di_gencnt =
345 hci1394_ohci_current_busgen(soft_state->ohci);
347 soft_state->drvinfo.di_stats.st_bus_reset_count++;
350 * Mask off busReset until SelfIdComplete comes in. The bus reset
351 * interrupt will be asserted until the SelfIdComplete interrupt
352 * comes in (i.e. you cannot clear the interrupt until a SelfIdComplete
353 * interrupt). Therefore, we disable the interrupt via its mask so we
354 * don't get stuck in the ISR indefinitely.
356 hci1394_ohci_intr_disable(soft_state->ohci, OHCI_INTR_BUS_RESET);
358 /* Reset the ATREQ and ATRESP Q's */
359 hci1394_async_atreq_reset(soft_state->async);
360 hci1394_async_atresp_reset(soft_state->async);
362 /* Inform Services Layer about Bus Reset */
363 h1394_bus_reset(soft_state->drvinfo.di_sl_private,
364 (void **)&soft_state->sl_selfid_buf);
369 * hci1394_isr_self_id()
370 * Process the selfid complete interrupt. The bus reset has completed
371 * and the 1394 HW has finished it's bus enumeration. The SW needs to
372 * see what's changed and handle any hotplug conditions.
374 static void
375 hci1394_isr_self_id(hci1394_state_t *soft_state)
377 int status;
378 uint_t node_id;
379 uint_t selfid_size;
380 uint_t quadlet_count;
381 uint_t index;
382 uint32_t *selfid_buf_p;
383 boolean_t selfid_error;
384 boolean_t nodeid_error;
385 boolean_t saw_error = B_FALSE;
386 uint_t phy_status;
389 ASSERT(soft_state != NULL);
391 soft_state->drvinfo.di_stats.st_selfid_count++;
394 * check for the bizarre case that we got both a bus reset and self id
395 * complete after checking for a bus reset
397 if (hci1394_state(&soft_state->drvinfo) != HCI1394_BUS_RESET) {
398 hci1394_isr_bus_reset(soft_state);
402 * Clear any set PHY error status bits set. The PHY status bits
403 * may always be set (i.e. we removed cable power) so we do not want
404 * to clear them when we handle the interrupt. We will clear them
405 * every selfid complete interrupt so worst case we will get 1 PHY event
406 * interrupt every bus reset.
408 status = hci1394_ohci_phy_read(soft_state->ohci, 5, &phy_status);
409 if (status == DDI_SUCCESS) {
410 phy_status |= OHCI_PHY_LOOP_ERR | OHCI_PHY_PWRFAIL_ERR |
411 OHCI_PHY_TIMEOUT_ERR | OHCI_PHY_PORTEVT_ERR;
412 status = hci1394_ohci_phy_write(soft_state->ohci, 5,
413 phy_status);
414 if (status == DDI_SUCCESS) {
416 * Re-enable PHY interrupt. We disable the PHY interrupt
417 * when we get one so that we do not get stuck in the
418 * ISR.
420 hci1394_ohci_intr_enable(soft_state->ohci,
421 OHCI_INTR_PHY);
425 /* See if either AT active bit is set */
426 if (hci1394_ohci_at_active(soft_state->ohci) == B_TRUE) {
427 saw_error = B_TRUE;
430 /* Clear busReset and selfIdComplete interrupts */
431 hci1394_ohci_intr_clear(soft_state->ohci, (OHCI_INTR_BUS_RESET |
432 OHCI_INTR_SELFID_CMPLT));
434 /* Read node info and test for Invalid Node ID */
435 hci1394_ohci_nodeid_info(soft_state->ohci, &node_id, &nodeid_error);
436 if (nodeid_error == B_TRUE) {
437 saw_error = B_TRUE;
440 /* Sync Selfid Buffer */
441 hci1394_ohci_selfid_sync(soft_state->ohci);
443 /* store away selfid info */
444 hci1394_ohci_selfid_info(soft_state->ohci,
445 &soft_state->drvinfo.di_gencnt, &selfid_size, &selfid_error);
447 /* Test for selfid error */
448 if (selfid_error == B_TRUE) {
449 saw_error = B_TRUE;
453 * selfid size could be 0 if a bus reset has occurred. If this occurs,
454 * we should have another selfid int coming later.
456 if ((saw_error == B_FALSE) && (selfid_size == 0)) {
457 return;
461 * make sure generation count in buffer matches generation
462 * count in register.
464 if (hci1394_ohci_selfid_buf_current(soft_state->ohci) == B_FALSE) {
465 return;
469 * Skip over first quadlet in selfid buffer, this is OpenHCI specific
470 * data.
472 selfid_size = selfid_size - IEEE1394_QUADLET;
473 quadlet_count = selfid_size >> 2;
475 /* Copy selfid buffer to Services Layer buffer */
476 for (index = 0; index < quadlet_count; index++) {
477 hci1394_ohci_selfid_read(soft_state->ohci, index + 1,
478 &soft_state->sl_selfid_buf[index]);
482 * Put our selfID info into the Services Layer's selfid buffer if we
483 * have a 1394-1995 PHY.
485 if (soft_state->halinfo.phy == H1394_PHY_1995) {
486 selfid_buf_p = (uint32_t *)(
487 (uintptr_t)soft_state->sl_selfid_buf +
488 (uintptr_t)selfid_size);
489 status = hci1394_ohci_phy_info(soft_state->ohci,
490 &selfid_buf_p[0]);
491 if (status != DDI_SUCCESS) {
493 * If we fail reading from PHY, put invalid data into
494 * the selfid buffer so the SL will reset the bus again.
496 selfid_buf_p[0] = 0xFFFFFFFF;
497 selfid_buf_p[1] = 0xFFFFFFFF;
498 } else {
499 selfid_buf_p[1] = ~selfid_buf_p[0];
501 selfid_size = selfid_size + 8;
504 /* Flush out async DMA Q's */
505 hci1394_async_flush(soft_state->async);
508 * Make sure generation count is still valid. i.e. we have not gotten
509 * another bus reset since the last time we checked. If we have gotten
510 * another bus reset, we should have another selfid interrupt coming.
512 if (soft_state->drvinfo.di_gencnt !=
513 hci1394_ohci_current_busgen(soft_state->ohci)) {
514 return;
518 * do whatever CSR register processing that needs to be done.
520 hci1394_csr_bus_reset(soft_state->csr);
523 * do whatever management may be necessary for the CYCLE_LOST and
524 * CYCLE_INCONSISTENT interrupts.
526 hci1394_isoch_error_ints_enable(soft_state);
529 * See if we saw an error. If we did, tell the services layer that we
530 * finished selfid processing and give them an illegal selfid buffer
531 * size of 0. The Services Layer will try to reset the bus again to
532 * see if we can recover from this problem. It will threshold after
533 * a finite number of errors.
535 if (saw_error == B_TRUE) {
536 h1394_self_ids(soft_state->drvinfo.di_sl_private,
537 soft_state->sl_selfid_buf, 0, node_id,
538 soft_state->drvinfo.di_gencnt);
541 * Take ourself out of Bus Reset processing mode
543 * Set the driver state to normal. If we cannot, we have been
544 * shutdown. The only way we can get in this code is if we have
545 * a multi-processor machine and the HAL is shutdown by one
546 * processor running in base context while this interrupt
547 * handler runs in another processor. We will disable all
548 * interrupts and just return. We shouldn't have to disable
549 * the interrupts, but we will just in case.
551 status = hci1394_state_set(&soft_state->drvinfo,
552 HCI1394_NORMAL);
553 if (status != DDI_SUCCESS) {
554 hci1394_ohci_intr_master_disable(soft_state->ohci);
555 return;
557 } else if (IEEE1394_NODE_NUM(node_id) != 63) {
559 * Notify services layer about self-id-complete. Don't notify
560 * the services layer if there are too many devices on the bus.
562 h1394_self_ids(soft_state->drvinfo.di_sl_private,
563 soft_state->sl_selfid_buf, selfid_size,
564 node_id, soft_state->drvinfo.di_gencnt);
567 * Take ourself out of Bus Reset processing mode
569 * Set the driver state to normal. If we cannot, we have been
570 * shutdown. The only way we can get in this code is if we have
571 * a multi-processor machine and the HAL is shutdown by one
572 * processor running in base context while this interrupt
573 * handler runs in another processor. We will disable all
574 * interrupts and just return. We shouldn't have to disable
575 * the interrupts, but we will just in case.
577 status = hci1394_state_set(&soft_state->drvinfo,
578 HCI1394_NORMAL);
579 if (status != DDI_SUCCESS) {
580 hci1394_ohci_intr_master_disable(soft_state->ohci);
581 return;
583 } else {
584 cmn_err(CE_NOTE, "hci1394(%d): Too many devices on the 1394 "
585 "bus", soft_state->drvinfo.di_instance);
588 /* enable bus reset interrupt */
589 hci1394_ohci_intr_enable(soft_state->ohci, OHCI_INTR_BUS_RESET);
594 * hci1394_isr_isoch_ir()
595 * Process each isoch recv context which has its interrupt asserted. The
596 * interrupt will be asserted when an isoch recv descriptor with the
597 * interrupt bits enabled have finished being processed.
599 static void
600 hci1394_isr_isoch_ir(hci1394_state_t *soft_state)
602 uint32_t i;
603 uint32_t mask = 0x00000001;
604 uint32_t ev;
605 int num_ir_contexts;
606 hci1394_iso_ctxt_t *ctxtp;
609 ASSERT(soft_state != NULL);
611 num_ir_contexts = hci1394_isoch_recv_count_get(soft_state->isoch);
614 * Main isochRx int is not clearable. it is automatically
615 * cleared by the hw when the ir_intr_event is cleared
617 /* loop until no more IR events */
618 while ((ev = hci1394_ohci_ir_intr_asserted(soft_state->ohci)) != 0) {
620 /* clear the events we just learned about */
621 hci1394_ohci_ir_intr_clear(soft_state->ohci, ev);
623 /* for each interrupting IR context, process the interrupt */
624 for (i = 0; i < num_ir_contexts; i++) {
626 * if the intr bit is on for a context,
627 * call xmit/recv common processing code
629 if (ev & mask) {
630 ctxtp = hci1394_isoch_recv_ctxt_get(
631 soft_state->isoch, i);
632 hci1394_ixl_interrupt(soft_state, ctxtp,
633 B_FALSE);
635 mask <<= 1;
642 * hci1394_isr_isoch_it()
643 * Process each isoch transmit context which has its interrupt asserted. The
644 * interrupt will be asserted when an isoch transmit descriptor with the
645 * interrupt bit is finished being processed.
647 static void
648 hci1394_isr_isoch_it(hci1394_state_t *soft_state)
650 uint32_t i;
651 uint32_t mask = 0x00000001;
652 uint32_t ev;
653 int num_it_contexts;
654 hci1394_iso_ctxt_t *ctxtp;
657 ASSERT(soft_state != NULL);
659 num_it_contexts = hci1394_isoch_xmit_count_get(soft_state->isoch);
662 * Main isochTx int is not clearable. it is automatically
663 * cleared by the hw when the it_intr_event is cleared.
666 /* loop until no more IT events */
667 while ((ev = hci1394_ohci_it_intr_asserted(soft_state->ohci)) != 0) {
669 /* clear the events we just learned about */
670 hci1394_ohci_it_intr_clear(soft_state->ohci, ev);
672 /* for each interrupting IR context, process the interrupt */
673 for (i = 0; i < num_it_contexts; i++) {
675 * if the intr bit is on for a context,
676 * call xmit/recv common processing code
678 if (ev & mask) {
679 ctxtp = hci1394_isoch_xmit_ctxt_get(
680 soft_state->isoch, i);
681 hci1394_ixl_interrupt(soft_state, ctxtp,
682 B_FALSE);
684 mask <<= 1;
691 * hci1394_isr_atreq_complete()
692 * Process all completed requests that we have sent out (i.e. HW gave us
693 * an ack).
695 static void
696 hci1394_isr_atreq_complete(hci1394_state_t *soft_state)
698 boolean_t request_available;
699 int status;
702 ASSERT(soft_state != NULL);
704 hci1394_ohci_intr_clear(soft_state->ohci, OHCI_INTR_REQ_TX_CMPLT);
707 * Processes all ack'd AT requests. If the request is pended, it is
708 * considered complete relative the the atreq engine. AR response
709 * processing will make sure we track the response.
711 do {
713 * Process a single request. Do not flush Q. That is only
714 * done during bus reset processing.
716 status = hci1394_async_atreq_process(soft_state->async, B_FALSE,
717 &request_available);
718 if (status != DDI_SUCCESS) {
720 } while (request_available == B_TRUE);
725 * hci1394_isr_arresp()
726 * Process all responses that have come in off the bus and send then up to
727 * the services layer. We send out a request on the bus (atreq) and some time
728 * later a response comes in. We send this response up to the services
729 * layer.
731 static void
732 hci1394_isr_arresp(hci1394_state_t *soft_state)
734 boolean_t response_available;
736 ASSERT(soft_state != NULL);
738 hci1394_ohci_intr_clear(soft_state->ohci, OHCI_INTR_RSPKT);
741 * Process all responses that have been received. If more responses
742 * come in we will stay in interrupt handler and re-run this routine.
743 * It is possible that we will call hci1394_async_arresp_process()
744 * even though there are no more AR responses to process. This would
745 * be because we have processed them earlier on. (i.e. we cleared
746 * interrupt, then got another response and processed it. The interrupt
747 * would still be pending.
749 do {
750 (void) hci1394_async_arresp_process(soft_state->async,
751 &response_available);
752 } while (response_available == B_TRUE);
757 * hci1394_isr_arreq()
758 * Process all requests that have come in off the bus and send then up to
759 * the services layer.
761 static void
762 hci1394_isr_arreq(hci1394_state_t *soft_state)
764 boolean_t request_available;
766 ASSERT(soft_state != NULL);
768 hci1394_ohci_intr_clear(soft_state->ohci, OHCI_INTR_RQPKT);
771 * Process all requests that have been received. It is possible that we
772 * will call hci1394_async_arreq_process() even though there are no
773 * more requests to process. This would be because we have processed
774 * them earlier on. (i.e. we cleared interrupt, got another request
775 * and processed it. The interrupt would still be pending.
777 do {
778 (void) hci1394_async_arreq_process(soft_state->async,
779 &request_available);
780 } while (request_available == B_TRUE);
785 * hci1394_isr_atresp_complete()
786 * Process all completed responses that we have sent out (i.e. HW gave us
787 * an ack). We get in a request off the bus (arreq) and send it up to the
788 * services layer, they send down a response to that request some time
789 * later. This interrupt signifies that the HW is done with the response.
790 * (i.e. it sent it out or failed it)
792 static void
793 hci1394_isr_atresp_complete(hci1394_state_t *soft_state)
795 boolean_t response_available;
797 ASSERT(soft_state != NULL);
799 hci1394_ohci_intr_clear(soft_state->ohci, OHCI_INTR_RESP_TX_CMPLT);
802 * Processes all ack'd AT responses It is possible that we will call
803 * hci1394_async_atresp_process() even thought there are no more
804 * responses to process. This would be because we have processed
805 * them earlier on. (i.e. we cleared interrupt, then got another
806 * response and processed it. The interrupt would still be pending.
808 do {
810 * Process a single response. Do not flush Q. That is only
811 * done during bus reset processing.
813 (void) hci1394_async_atresp_process(soft_state->async,
814 B_FALSE, &response_available);
815 } while (response_available == B_TRUE);