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>
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,
509 localinfo->bus_generation, tnf_uint, node_id,
510 localinfo->local_nodeID);
511
512 if (ndi_event_retrieve_cookie(hal->hal_ndi_event_hdl, NULL,
|
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 * Copyright 2019 Joyent, Inc.
29 */
30
31 /*
32 * s1394_dev_disc.c
33 * 1394 Services Layer Device Discovery Routines
34 * This file contains the bus reset thread code, bus manager routines and
35 * various routines that are used to implement remote Config ROM reading.
36 *
37 * FUTURE:
38 * Rescan the bus if invalid nodes are seen.
39 * Investigate taskq for reading phase2 config rom reads.
40 * If we are reading the entire bus info blk, we should attempt
41 * a block read and fallback to quad reads if this fails.
42 */
43
44 #include <sys/conf.h>
45 #include <sys/sysmacros.h>
46 #include <sys/ddi.h>
47 #include <sys/sunddi.h>
48 #include <sys/cmn_err.h>
49 #include <sys/sunndi.h>
474 }
475
476 /*
477 * s1394_br_thread_exit()
478 * Flushes the completion queue and calls thread_exit() (which effectively
479 * kills the bus reset thread).
480 */
481 static void
482 s1394_br_thread_exit(s1394_hal_t *hal)
483 {
484 ASSERT(MUTEX_HELD(&hal->br_thread_mutex));
485 ASSERT(MUTEX_NOT_HELD(&hal->topology_tree_mutex));
486 TNF_PROBE_0(s1394_br_thread_exit_enter, S1394_TNF_SL_HOTPLUG_STACK, "");
487 s1394_flush_cmplq(hal);
488 #ifndef __lock_lint
489 CALLB_CPR_EXIT(&hal->hal_cprinfo);
490 #endif
491 hal->br_thread_ev_type &= ~BR_THR_GO_AWAY;
492 thread_exit();
493 /*NOTREACHED*/
494 }
495
496 /*
497 * s1394_target_bus_reset_notifies()
498 * tells the ndi event framework to invoke any callbacks registered for
499 * "bus reset event".
500 */
501 static void
502 s1394_target_bus_reset_notifies(s1394_hal_t *hal, t1394_localinfo_t *localinfo)
503 {
504 ddi_eventcookie_t cookie;
505
506 ASSERT(MUTEX_NOT_HELD(&hal->topology_tree_mutex));
507
508 TNF_PROBE_2_DEBUG(s1394_target_bus_reset_notifies_enter,
509 S1394_TNF_SL_HOTPLUG_STACK, "", tnf_uint, bus_gen,
510 localinfo->bus_generation, tnf_uint, node_id,
511 localinfo->local_nodeID);
512
513 if (ndi_event_retrieve_cookie(hal->hal_ndi_event_hdl, NULL,
|