7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #pragma ident "%Z%%M% %I% %E% SMI"
28
29 /*
30 * s1394_dev_disc.c
31 * 1394 Services Layer Device Discovery Routines
32 * This file contains the bus reset thread code, bus manager routines and
33 * various routines that are used to implement remote Config ROM reading.
34 *
35 * FUTURE:
36 * Rescan the bus if invalid nodes are seen.
37 * Investigate taskq for reading phase2 config rom reads.
38 * If we are reading the entire bus info blk, we should attempt
39 * a block read and fallback to quad reads if this fails.
40 */
41
42 #include <sys/conf.h>
43 #include <sys/sysmacros.h>
44 #include <sys/ddi.h>
45 #include <sys/sunddi.h>
46 #include <sys/cmn_err.h>
47 #include <sys/sunndi.h>
48 #include <sys/modctl.h>
466
467 } while (cmd != NULL);
468
469 TNF_PROBE_0_DEBUG(s1394_flush_cmplq_exit, S1394_TNF_SL_HOTPLUG_STACK,
470 "");
471
472 }
473
474 /*
475 * s1394_br_thread_exit()
476 * Flushes the completion queue and calls thread_exit() (which effectively
477 * kills the bus reset thread).
478 */
479 static void
480 s1394_br_thread_exit(s1394_hal_t *hal)
481 {
482 ASSERT(MUTEX_HELD(&hal->br_thread_mutex));
483 ASSERT(MUTEX_NOT_HELD(&hal->topology_tree_mutex));
484 TNF_PROBE_0(s1394_br_thread_exit_enter, S1394_TNF_SL_HOTPLUG_STACK, "");
485 s1394_flush_cmplq(hal);
486 #ifndef __lock_lint
487 CALLB_CPR_EXIT(&hal->hal_cprinfo);
488 #endif
489 hal->br_thread_ev_type &= ~BR_THR_GO_AWAY;
490 thread_exit();
491 /*NOTREACHED*/
492 TNF_PROBE_0(s1394_br_thread_exit_enter, S1394_TNF_SL_HOTPLUG_STACK, "");
493 }
494
495 /*
496 * s1394_target_bus_reset_notifies()
497 * tells the ndi event framework to invoke any callbacks registered for
498 * "bus reset event".
499 */
500 static void
501 s1394_target_bus_reset_notifies(s1394_hal_t *hal, t1394_localinfo_t *localinfo)
502 {
503 ddi_eventcookie_t cookie;
504
505 ASSERT(MUTEX_NOT_HELD(&hal->topology_tree_mutex));
506
507 TNF_PROBE_2_DEBUG(s1394_target_bus_reset_notifies_enter,
508 S1394_TNF_SL_HOTPLUG_STACK, "", tnf_uint, bus_gen,
|
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * s1394_dev_disc.c
29 * 1394 Services Layer Device Discovery Routines
30 * This file contains the bus reset thread code, bus manager routines and
31 * various routines that are used to implement remote Config ROM reading.
32 *
33 * FUTURE:
34 * Rescan the bus if invalid nodes are seen.
35 * Investigate taskq for reading phase2 config rom reads.
36 * If we are reading the entire bus info blk, we should attempt
37 * a block read and fallback to quad reads if this fails.
38 */
39
40 #include <sys/conf.h>
41 #include <sys/sysmacros.h>
42 #include <sys/ddi.h>
43 #include <sys/sunddi.h>
44 #include <sys/cmn_err.h>
45 #include <sys/sunndi.h>
46 #include <sys/modctl.h>
464
465 } while (cmd != NULL);
466
467 TNF_PROBE_0_DEBUG(s1394_flush_cmplq_exit, S1394_TNF_SL_HOTPLUG_STACK,
468 "");
469
470 }
471
472 /*
473 * s1394_br_thread_exit()
474 * Flushes the completion queue and calls thread_exit() (which effectively
475 * kills the bus reset thread).
476 */
477 static void
478 s1394_br_thread_exit(s1394_hal_t *hal)
479 {
480 ASSERT(MUTEX_HELD(&hal->br_thread_mutex));
481 ASSERT(MUTEX_NOT_HELD(&hal->topology_tree_mutex));
482 TNF_PROBE_0(s1394_br_thread_exit_enter, S1394_TNF_SL_HOTPLUG_STACK, "");
483 s1394_flush_cmplq(hal);
484 CALLB_CPR_EXIT(&hal->hal_cprinfo);
485 hal->br_thread_ev_type &= ~BR_THR_GO_AWAY;
486 thread_exit();
487 /*NOTREACHED*/
488 TNF_PROBE_0(s1394_br_thread_exit_enter, S1394_TNF_SL_HOTPLUG_STACK, "");
489 }
490
491 /*
492 * s1394_target_bus_reset_notifies()
493 * tells the ndi event framework to invoke any callbacks registered for
494 * "bus reset event".
495 */
496 static void
497 s1394_target_bus_reset_notifies(s1394_hal_t *hal, t1394_localinfo_t *localinfo)
498 {
499 ddi_eventcookie_t cookie;
500
501 ASSERT(MUTEX_NOT_HELD(&hal->topology_tree_mutex));
502
503 TNF_PROBE_2_DEBUG(s1394_target_bus_reset_notifies_enter,
504 S1394_TNF_SL_HOTPLUG_STACK, "", tnf_uint, bus_gen,
|