Lines Matching refs:hal
48 extern void nx1394_undefine_events(s1394_hal_t *hal);
49 static void s1394_cleanup_node_cfgrom(s1394_hal_t *hal);
58 s1394_cleanup_for_detach(s1394_hal_t *hal, uint_t cleanup_level) in s1394_cleanup_for_detach() argument
65 if ((s1394_statep->hal_head == hal) && in s1394_cleanup_for_detach()
66 (s1394_statep->hal_tail == hal)) { in s1394_cleanup_for_detach()
70 if (hal->hal_prev) in s1394_cleanup_for_detach()
71 hal->hal_prev->hal_next = hal->hal_next; in s1394_cleanup_for_detach()
72 if (hal->hal_next) in s1394_cleanup_for_detach()
73 hal->hal_next->hal_prev = hal->hal_prev; in s1394_cleanup_for_detach()
74 if (s1394_statep->hal_head == hal) in s1394_cleanup_for_detach()
75 s1394_statep->hal_head = hal->hal_next; in s1394_cleanup_for_detach()
76 if (s1394_statep->hal_tail == hal) in s1394_cleanup_for_detach()
77 s1394_statep->hal_tail = hal->hal_prev; in s1394_cleanup_for_detach()
87 s1394_destroy_addr_space(hal); in s1394_cleanup_for_detach()
91 s1394_destroy_local_config_rom(hal); in s1394_cleanup_for_detach()
96 (void) s1394_kstat_delete(hal); in s1394_cleanup_for_detach()
101 kmem_free(hal->selfid_buf1, S1394_SELFID_BUF_SIZE); in s1394_cleanup_for_detach()
103 kmem_free(hal->selfid_buf0, S1394_SELFID_BUF_SIZE); in s1394_cleanup_for_detach()
105 s1394_destroy_timers(hal); in s1394_cleanup_for_detach()
107 s1394_destroy_br_thread(hal); in s1394_cleanup_for_detach()
109 s1394_cleanup_node_cfgrom(hal); in s1394_cleanup_for_detach()
114 cv_destroy(&hal->br_cmplq_cv); in s1394_cleanup_for_detach()
115 mutex_destroy(&hal->br_cmplq_mutex); in s1394_cleanup_for_detach()
117 cv_destroy(&hal->br_thread_cv); in s1394_cleanup_for_detach()
118 mutex_destroy(&hal->br_thread_mutex); in s1394_cleanup_for_detach()
122 (void) ddi_prop_remove_all(hal->halinfo.dip); in s1394_cleanup_for_detach()
123 nx1394_undefine_events(hal); in s1394_cleanup_for_detach()
127 kmem_cache_destroy(hal->hal_kmem_cachep); in s1394_cleanup_for_detach()
129 mutex_destroy(&hal->pending_q_mutex); in s1394_cleanup_for_detach()
130 mutex_destroy(&hal->outstanding_q_mutex); in s1394_cleanup_for_detach()
132 rw_destroy(&hal->target_list_rwlock); in s1394_cleanup_for_detach()
134 cv_destroy(&hal->bus_mgr_node_cv); in s1394_cleanup_for_detach()
135 mutex_destroy(&hal->bus_mgr_node_mutex); in s1394_cleanup_for_detach()
137 mutex_destroy(&hal->isoch_cec_list_mutex); in s1394_cleanup_for_detach()
139 mutex_destroy(&hal->cm_timer_mutex); in s1394_cleanup_for_detach()
141 mutex_destroy(&hal->topology_tree_mutex); in s1394_cleanup_for_detach()
143 kmem_free(hal, sizeof (s1394_hal_t)); in s1394_cleanup_for_detach()
161 s1394_hal_shutdown(s1394_hal_t *hal, boolean_t disable_hal) in s1394_hal_shutdown() argument
166 mutex_enter(&hal->topology_tree_mutex); in s1394_hal_shutdown()
168 if (hal->hal_state == S1394_HAL_SHUTDOWN) { in s1394_hal_shutdown()
169 mutex_exit(&hal->topology_tree_mutex); in s1394_hal_shutdown()
171 HAL_CALL(hal).shutdown(hal->halinfo.hal_private); in s1394_hal_shutdown()
176 hal->hal_state = S1394_HAL_SHUTDOWN; in s1394_hal_shutdown()
177 mutex_exit(&hal->topology_tree_mutex); in s1394_hal_shutdown()
180 HAL_CALL(hal).shutdown(hal->halinfo.hal_private); in s1394_hal_shutdown()
185 mutex_enter(&hal->topology_tree_mutex); in s1394_hal_shutdown()
186 localinfo.bus_generation = hal->generation_count; in s1394_hal_shutdown()
187 localinfo.local_nodeID = hal->node_id; in s1394_hal_shutdown()
188 mutex_exit(&hal->topology_tree_mutex); in s1394_hal_shutdown()
190 if (ndi_event_retrieve_cookie(hal->hal_ndi_event_hdl, NULL, in s1394_hal_shutdown()
193 (void) ndi_event_run_callbacks(hal->hal_ndi_event_hdl, NULL, in s1394_hal_shutdown()
204 s1394_initiate_hal_reset(s1394_hal_t *hal, int reason) in s1394_initiate_hal_reset() argument
206 if (hal->num_bus_reset_till_fail > 0) { in s1394_initiate_hal_reset()
207 hal->initiated_bus_reset = B_TRUE; in s1394_initiate_hal_reset()
208 hal->initiated_br_reason = reason; in s1394_initiate_hal_reset()
211 (void) HAL_CALL(hal).bus_reset(hal->halinfo.hal_private); in s1394_initiate_hal_reset()
225 s1394_on_br_thread(s1394_hal_t *hal) in s1394_on_br_thread() argument
227 if (hal->br_thread == curthread) in s1394_on_br_thread()
238 s1394_destroy_br_thread(s1394_hal_t *hal) in s1394_destroy_br_thread() argument
241 mutex_enter(&hal->br_thread_mutex); in s1394_destroy_br_thread()
242 hal->br_thread_ev_type |= BR_THR_GO_AWAY; in s1394_destroy_br_thread()
243 cv_signal(&hal->br_thread_cv); in s1394_destroy_br_thread()
244 mutex_exit(&hal->br_thread_mutex); in s1394_destroy_br_thread()
247 mutex_enter(&hal->bus_mgr_node_mutex); in s1394_destroy_br_thread()
248 hal->bus_mgr_node = S1394_INVALID_NODE_NUM; in s1394_destroy_br_thread()
249 cv_signal(&hal->bus_mgr_node_cv); in s1394_destroy_br_thread()
250 mutex_exit(&hal->bus_mgr_node_mutex); in s1394_destroy_br_thread()
252 mutex_enter(&hal->br_cmplq_mutex); in s1394_destroy_br_thread()
253 cv_signal(&hal->br_cmplq_cv); in s1394_destroy_br_thread()
254 mutex_exit(&hal->br_cmplq_mutex); in s1394_destroy_br_thread()
257 while (hal->br_thread_ev_type & BR_THR_GO_AWAY) in s1394_destroy_br_thread()
267 s1394_tickle_bus_reset_thread(s1394_hal_t *hal) in s1394_tickle_bus_reset_thread() argument
269 if (hal->topology_tree_processed != B_TRUE) { in s1394_tickle_bus_reset_thread()
271 mutex_enter(&hal->br_thread_mutex); in s1394_tickle_bus_reset_thread()
272 hal->br_thread_ev_type |= BR_THR_CFGROM_SCAN; in s1394_tickle_bus_reset_thread()
273 cv_signal(&hal->br_thread_cv); in s1394_tickle_bus_reset_thread()
274 mutex_exit(&hal->br_thread_mutex); in s1394_tickle_bus_reset_thread()
277 mutex_enter(&hal->br_cmplq_mutex); in s1394_tickle_bus_reset_thread()
278 cv_signal(&hal->br_cmplq_cv); in s1394_tickle_bus_reset_thread()
279 mutex_exit(&hal->br_cmplq_mutex); in s1394_tickle_bus_reset_thread()
282 mutex_enter(&hal->bus_mgr_node_mutex); in s1394_tickle_bus_reset_thread()
283 cv_signal(&hal->bus_mgr_node_cv); in s1394_tickle_bus_reset_thread()
284 mutex_exit(&hal->bus_mgr_node_mutex); in s1394_tickle_bus_reset_thread()
319 s1394_HAL_asynch_error(s1394_hal_t *hal, cmd1394_cmd_t *cmd, in s1394_HAL_asynch_error() argument
323 ASSERT(MUTEX_HELD(&hal->topology_tree_mutex)); in s1394_HAL_asynch_error()
328 if (hal->disable_requests_bit == 1) in s1394_HAL_asynch_error()
514 s1394_ioctl(s1394_hal_t *hal, int cmd, intptr_t arg, int mode, cred_t *cred_p, in s1394_ioctl() argument
521 self = hal->halinfo.dip; in s1394_ioctl()
559 if (hal->halinfo.phy == H1394_PHY_1394A) { in s1394_ioctl()
560 (void) HAL_CALL(hal).short_bus_reset( in s1394_ioctl()
561 hal->halinfo.hal_private); in s1394_ioctl()
564 HAL_CALL(hal).bus_reset(hal->halinfo.hal_private); in s1394_ioctl()
582 s1394_kstat_init(s1394_hal_t *hal) in s1394_kstat_init() argument
586 hal->hal_kstats = (s1394_kstat_t *)kmem_zalloc(sizeof (s1394_kstat_t), in s1394_kstat_init()
589 instance = ddi_get_instance(hal->halinfo.dip); in s1394_kstat_init()
591 hal->hal_ksp = kstat_create("s1394", instance, "stats", "misc", in s1394_kstat_init()
593 if (hal->hal_ksp != NULL) { in s1394_kstat_init()
594 hal->hal_ksp->ks_private = (void *)hal; in s1394_kstat_init()
595 hal->hal_ksp->ks_update = s1394_kstat_update; in s1394_kstat_init()
596 kstat_install(hal->hal_ksp); in s1394_kstat_init()
600 kmem_free((void *)hal->hal_kstats, sizeof (s1394_kstat_t)); in s1394_kstat_init()
611 s1394_kstat_delete(s1394_hal_t *hal) in s1394_kstat_delete() argument
613 kstat_delete(hal->hal_ksp); in s1394_kstat_delete()
614 kmem_free((void *)hal->hal_kstats, sizeof (s1394_kstat_t)); in s1394_kstat_delete()
627 s1394_hal_t *hal; in s1394_kstat_update() local
629 hal = ksp->ks_private; in s1394_kstat_update()
634 ksp->ks_data = hal->hal_kstats; in s1394_kstat_update()
646 s1394_addr_alloc_kstat(s1394_hal_t *hal, uint64_t addr) in s1394_addr_alloc_kstat() argument
649 if (s1394_is_posted_write(hal, addr) == B_TRUE) in s1394_addr_alloc_kstat()
650 hal->hal_kstats->addr_posted_alloc++; in s1394_addr_alloc_kstat()
651 else if (s1394_is_normal_addr(hal, addr) == B_TRUE) in s1394_addr_alloc_kstat()
652 hal->hal_kstats->addr_normal_alloc++; in s1394_addr_alloc_kstat()
653 else if (s1394_is_csr_addr(hal, addr) == B_TRUE) in s1394_addr_alloc_kstat()
654 hal->hal_kstats->addr_csr_alloc++; in s1394_addr_alloc_kstat()
655 else if (s1394_is_physical_addr(hal, addr) == B_TRUE) in s1394_addr_alloc_kstat()
656 hal->hal_kstats->addr_phys_alloc++; in s1394_addr_alloc_kstat()
664 s1394_print_node_info(s1394_hal_t *hal) in s1394_print_node_info() argument
677 hal_node_num = IEEE1394_NODE_NUM(hal->node_id); in s1394_print_node_info()
682 ddi_get_instance(hal->halinfo.dip)); in s1394_print_node_info()
685 for (i = 0; i < hal->number_of_nodes; i++) { in s1394_print_node_info()
693 for (i = 0; i < hal->number_of_nodes; i++) { in s1394_print_node_info()
700 for (i = 0; i < hal->number_of_nodes; i++) { in s1394_print_node_info()
704 for (j = 0; j < hal->number_of_nodes; j++) { in s1394_print_node_info()
705 (void) sprintf(tmp, " %3d", hal->speed_map[i][j]); in s1394_print_node_info()
713 } else if (CFGROM_BIB_READ(&hal->topology_tree[i])) { in s1394_print_node_info()
716 hal->topology_tree[i].node_guid_hi, in s1394_print_node_info()
717 hal->topology_tree[i].node_guid_lo); in s1394_print_node_info()
720 } else if (hal->topology_tree[i].link_active == 0) { in s1394_print_node_info()
770 s1394_target_from_dip_locked(s1394_hal_t *hal, dev_info_t *tdip) in s1394_target_from_dip_locked() argument
774 temp = hal->target_head; in s1394_target_from_dip_locked()
790 s1394_target_from_dip(s1394_hal_t *hal, dev_info_t *tdip) in s1394_target_from_dip() argument
794 rw_enter(&hal->target_list_rwlock, RW_READER); in s1394_target_from_dip()
795 target = s1394_target_from_dip_locked(hal, tdip); in s1394_target_from_dip()
796 rw_exit(&hal->target_list_rwlock); in s1394_target_from_dip()
806 s1394_destroy_timers(s1394_hal_t *hal) in s1394_destroy_timers() argument
809 (void) untimeout(hal->bus_mgr_timeout_id); in s1394_destroy_timers()
810 (void) untimeout(hal->bus_mgr_query_timeout_id); in s1394_destroy_timers()
813 (void) untimeout(hal->cm_timer); in s1394_destroy_timers()
816 while (hal->config_rom_timer_set == B_TRUE) { in s1394_destroy_timers()
827 s1394_cleanup_node_cfgrom(s1394_hal_t *hal) in s1394_cleanup_node_cfgrom() argument
833 if ((cfgrom = hal->topology_tree[i].cfgrom) != NULL) in s1394_cleanup_node_cfgrom()
845 s1394_hal_t *hal; in s1394_cycle_too_long_callback() local
851 hal = (s1394_hal_t *)arg; in s1394_cycle_too_long_callback()
854 mutex_enter(&hal->topology_tree_mutex); in s1394_cycle_too_long_callback()
855 mutex_enter(&hal->cm_timer_mutex); in s1394_cycle_too_long_callback()
856 hal->cm_timer_set = B_FALSE; in s1394_cycle_too_long_callback()
857 mutex_exit(&hal->cm_timer_mutex); in s1394_cycle_too_long_callback()
860 root_node_num = hal->number_of_nodes - 1; in s1394_cycle_too_long_callback()
861 hal_node_num = IEEE1394_NODE_NUM(hal->node_id); in s1394_cycle_too_long_callback()
862 mutex_exit(&hal->topology_tree_mutex); in s1394_cycle_too_long_callback()
868 (void) HAL_CALL(hal).csr_write(hal->halinfo.hal_private, in s1394_cycle_too_long_callback()