Lines Matching refs:hal
77 static void s1394_common_CSR_routine(s1394_hal_t *hal, cmd1394_cmd_t *req);
79 static int s1394_init_config_rom_structures(s1394_hal_t *hal);
81 static int s1394_destroy_config_rom_structures(s1394_hal_t *hal);
88 s1394_setup_CSR_space(s1394_hal_t *hal) in s1394_setup_CSR_space() argument
118 addr.aa_arg = hal; in s1394_setup_CSR_space()
119 result = s1394_claim_addr_blk(hal, &addr); in s1394_setup_CSR_space()
137 addr.aa_arg = hal; in s1394_setup_CSR_space()
138 result = s1394_claim_addr_blk(hal, &addr); in s1394_setup_CSR_space()
156 addr.aa_arg = hal; in s1394_setup_CSR_space()
157 result = s1394_claim_addr_blk(hal, &addr); in s1394_setup_CSR_space()
175 addr.aa_arg = hal; in s1394_setup_CSR_space()
176 result = s1394_claim_addr_blk(hal, &addr); in s1394_setup_CSR_space()
194 addr.aa_arg = hal; in s1394_setup_CSR_space()
195 result = s1394_claim_addr_blk(hal, &addr); in s1394_setup_CSR_space()
213 addr.aa_arg = hal; in s1394_setup_CSR_space()
214 result = s1394_claim_addr_blk(hal, &addr); in s1394_setup_CSR_space()
232 addr.aa_arg = hal; in s1394_setup_CSR_space()
233 result = s1394_claim_addr_blk(hal, &addr); in s1394_setup_CSR_space()
251 addr.aa_arg = hal; in s1394_setup_CSR_space()
252 result = s1394_claim_addr_blk(hal, &addr); in s1394_setup_CSR_space()
270 addr.aa_arg = hal; in s1394_setup_CSR_space()
271 result = s1394_claim_addr_blk(hal, &addr); in s1394_setup_CSR_space()
289 addr.aa_arg = hal; in s1394_setup_CSR_space()
290 result = s1394_claim_addr_blk(hal, &addr); in s1394_setup_CSR_space()
307 addr.aa_arg = hal; in s1394_setup_CSR_space()
308 result = s1394_claim_addr_blk(hal, &addr); in s1394_setup_CSR_space()
325 addr.aa_arg = hal; in s1394_setup_CSR_space()
326 result = s1394_claim_addr_blk(hal, &addr); in s1394_setup_CSR_space()
343 addr.aa_arg = hal; in s1394_setup_CSR_space()
344 result = s1394_claim_addr_blk(hal, &addr); in s1394_setup_CSR_space()
363 addr.aa_arg = hal; in s1394_setup_CSR_space()
364 result = s1394_claim_addr_blk(hal, &addr); in s1394_setup_CSR_space()
375 result = s1394_reserve_addr_blk(hal, &addr); in s1394_setup_CSR_space()
384 hal->CSR_topology_map = kmem_zalloc(IEEE1394_UCSR_TOPOLOGY_MAP_SZ, in s1394_setup_CSR_space()
393 addr.aa_kmem_bufp = (caddr_t)hal->CSR_topology_map; in s1394_setup_CSR_space()
394 addr.aa_arg = hal; in s1394_setup_CSR_space()
395 result = s1394_claim_addr_blk(hal, &addr); in s1394_setup_CSR_space()
397 kmem_free((void *)hal->CSR_topology_map, in s1394_setup_CSR_space()
412 result = s1394_reserve_addr_blk(hal, &addr); in s1394_setup_CSR_space()
428 result = s1394_reserve_addr_blk(hal, &addr); in s1394_setup_CSR_space()
445 s1394_hal_t *hal; in s1394_CSR_state_clear() local
452 hal = (s1394_hal_t *)req->cmd_callback_arg; in s1394_CSR_state_clear()
460 (void) s1394_send_response(hal, req); in s1394_CSR_state_clear()
465 mutex_enter(&hal->topology_tree_mutex); in s1394_CSR_state_clear()
467 if (hal->bus_mgr_node != -1) in s1394_CSR_state_clear()
468 should_be_from = IEEE1394_NODE_NUM(hal->bus_mgr_node); in s1394_CSR_state_clear()
469 else if (hal->IRM_node != -1) in s1394_CSR_state_clear()
470 should_be_from = IEEE1394_NODE_NUM(hal->IRM_node); in s1394_CSR_state_clear()
473 mutex_exit(&hal->topology_tree_mutex); in s1394_CSR_state_clear()
485 result = HAL_CALL(hal).csr_read(hal->halinfo.hal_private, in s1394_CSR_state_clear()
503 mutex_enter(&hal->topology_tree_mutex); in s1394_CSR_state_clear()
506 hal->disable_requests_bit = 0; in s1394_CSR_state_clear()
507 if (hal->hal_state == S1394_HAL_DREQ) in s1394_CSR_state_clear()
508 hal->hal_state = S1394_HAL_NORMAL; in s1394_CSR_state_clear()
513 hal->abdicate_bus_mgr_bit = 0; in s1394_CSR_state_clear()
515 mutex_exit(&hal->topology_tree_mutex); in s1394_CSR_state_clear()
524 result = HAL_CALL(hal).csr_write(hal->halinfo.hal_private, in s1394_CSR_state_clear()
537 (void) s1394_send_response(hal, req); in s1394_CSR_state_clear()
549 s1394_hal_t *hal; in s1394_CSR_state_set() local
558 hal = (s1394_hal_t *)req->cmd_callback_arg; in s1394_CSR_state_set()
566 (void) s1394_send_response(hal, req); in s1394_CSR_state_set()
571 mutex_enter(&hal->topology_tree_mutex); in s1394_CSR_state_set()
573 if (hal->bus_mgr_node != -1) in s1394_CSR_state_set()
574 should_be_from = IEEE1394_NODE_NUM(hal->bus_mgr_node); in s1394_CSR_state_set()
575 else if (hal->IRM_node != -1) in s1394_CSR_state_set()
576 should_be_from = IEEE1394_NODE_NUM(hal->IRM_node); in s1394_CSR_state_set()
579 hal_node_num = IEEE1394_NODE_NUM(hal->node_id); in s1394_CSR_state_set()
580 hal_number_of_nodes = hal->number_of_nodes; in s1394_CSR_state_set()
581 mutex_exit(&hal->topology_tree_mutex); in s1394_CSR_state_set()
594 mutex_enter(&hal->topology_tree_mutex); in s1394_CSR_state_set()
600 hal->disable_requests_bit = 1; in s1394_CSR_state_set()
601 if (hal->hal_state == S1394_HAL_NORMAL) in s1394_CSR_state_set()
602 hal->hal_state = S1394_HAL_DREQ; in s1394_CSR_state_set()
606 hal->abdicate_bus_mgr_bit = 1; in s1394_CSR_state_set()
608 mutex_exit(&hal->topology_tree_mutex); in s1394_CSR_state_set()
617 result = HAL_CALL(hal).csr_write(hal->halinfo.hal_private, in s1394_CSR_state_set()
630 (void) s1394_send_response(hal, req); in s1394_CSR_state_set()
641 s1394_hal_t *hal; in s1394_CSR_node_ids() local
643 hal = (s1394_hal_t *)req->cmd_callback_arg; in s1394_CSR_node_ids()
645 s1394_common_CSR_routine(hal, req); in s1394_CSR_node_ids()
656 s1394_hal_t *hal; in s1394_CSR_reset_start() local
660 hal = (s1394_hal_t *)req->cmd_callback_arg; in s1394_CSR_reset_start()
668 (void) s1394_send_response(hal, req); in s1394_CSR_reset_start()
682 (void) HAL_CALL(hal).csr_write(hal->halinfo.hal_private, in s1394_CSR_reset_start()
691 (void) s1394_send_response(hal, req); in s1394_CSR_reset_start()
702 s1394_hal_t *hal; in s1394_CSR_split_timeout() local
704 hal = (s1394_hal_t *)req->cmd_callback_arg; in s1394_CSR_split_timeout()
706 s1394_common_CSR_routine(hal, req); in s1394_CSR_split_timeout()
717 s1394_hal_t *hal; in s1394_CSR_argument_regs() local
719 hal = (s1394_hal_t *)req->cmd_callback_arg; in s1394_CSR_argument_regs()
721 s1394_common_CSR_routine(hal, req); in s1394_CSR_argument_regs()
732 s1394_hal_t *hal; in s1394_CSR_test_regs() local
735 hal = (s1394_hal_t *)req->cmd_callback_arg; in s1394_CSR_test_regs()
744 (void) s1394_send_response(hal, req); in s1394_CSR_test_regs()
746 s1394_common_CSR_routine(hal, req); in s1394_CSR_test_regs()
758 s1394_hal_t *hal; in s1394_CSR_interrupt_regs() local
760 hal = (s1394_hal_t *)req->cmd_callback_arg; in s1394_CSR_interrupt_regs()
762 s1394_common_CSR_routine(hal, req); in s1394_CSR_interrupt_regs()
773 s1394_hal_t *hal; in s1394_CSR_clock_regs() local
775 hal = (s1394_hal_t *)req->cmd_callback_arg; in s1394_CSR_clock_regs()
777 s1394_common_CSR_routine(hal, req); in s1394_CSR_clock_regs()
788 s1394_hal_t *hal; in s1394_CSR_message_regs() local
790 hal = (s1394_hal_t *)req->cmd_callback_arg; in s1394_CSR_message_regs()
792 s1394_common_CSR_routine(hal, req); in s1394_CSR_message_regs()
802 s1394_hal_t *hal; in s1394_CSR_cycle_time() local
807 hal = (s1394_hal_t *)req->cmd_callback_arg; in s1394_CSR_cycle_time()
815 (void) s1394_send_response(hal, req); in s1394_CSR_cycle_time()
830 result = HAL_CALL(hal).csr_read(hal->halinfo.hal_private, in s1394_CSR_cycle_time()
852 result = HAL_CALL(hal).csr_write(hal->halinfo.hal_private, in s1394_CSR_cycle_time()
865 (void) s1394_send_response(hal, req); in s1394_CSR_cycle_time()
877 s1394_hal_t *hal; in s1394_CSR_bus_time() local
884 hal = (s1394_hal_t *)req->cmd_callback_arg; in s1394_CSR_bus_time()
892 (void) s1394_send_response(hal, req); in s1394_CSR_bus_time()
907 result = HAL_CALL(hal).csr_read(hal->halinfo.hal_private, in s1394_CSR_bus_time()
919 mutex_enter(&hal->topology_tree_mutex); in s1394_CSR_bus_time()
921 if (hal->bus_mgr_node != -1) in s1394_CSR_bus_time()
922 should_be_from = IEEE1394_NODE_NUM(hal->bus_mgr_node); in s1394_CSR_bus_time()
923 else if (hal->IRM_node != -1) in s1394_CSR_bus_time()
924 should_be_from = IEEE1394_NODE_NUM(hal->IRM_node); in s1394_CSR_bus_time()
927 mutex_exit(&hal->topology_tree_mutex); in s1394_CSR_bus_time()
944 result = HAL_CALL(hal).csr_write(hal->halinfo.hal_private, in s1394_CSR_bus_time()
957 (void) s1394_send_response(hal, req); in s1394_CSR_bus_time()
968 s1394_hal_t *hal; in s1394_CSR_busy_timeout() local
970 hal = (s1394_hal_t *)req->cmd_callback_arg; in s1394_CSR_busy_timeout()
972 s1394_common_CSR_routine(hal, req); in s1394_CSR_busy_timeout()
984 s1394_hal_t *hal; in s1394_CSR_IRM_regs() local
993 hal = (s1394_hal_t *)req->cmd_callback_arg; in s1394_CSR_IRM_regs()
1001 (void) s1394_send_response(hal, req); in s1394_CSR_IRM_regs()
1016 result = HAL_CALL(hal).csr_read(hal->halinfo.hal_private, in s1394_CSR_IRM_regs()
1027 mutex_enter(&hal->topology_tree_mutex); in s1394_CSR_IRM_regs()
1028 generation = hal->generation_count; in s1394_CSR_IRM_regs()
1029 mutex_exit(&hal->topology_tree_mutex); in s1394_CSR_IRM_regs()
1041 result = HAL_CALL(hal).csr_cswap32( in s1394_CSR_IRM_regs()
1042 hal->halinfo.hal_private, generation, in s1394_CSR_IRM_regs()
1061 (void) s1394_send_response(hal, req); in s1394_CSR_IRM_regs()
1073 s1394_hal_t *hal; in s1394_CSR_topology_map() local
1075 hal = (s1394_hal_t *)req->cmd_callback_arg; in s1394_CSR_topology_map()
1083 (void) s1394_send_response(hal, req); in s1394_CSR_topology_map()
1094 s1394_CSR_topology_map_update(s1394_hal_t *hal) in s1394_CSR_topology_map_update() argument
1105 ASSERT(MUTEX_HELD(&hal->topology_tree_mutex)); in s1394_CSR_topology_map_update()
1107 tm_ptr = (uint32_t *)hal->CSR_topology_map; in s1394_CSR_topology_map_update()
1111 for (i = 0; i < hal->number_of_nodes; i++) { in s1394_CSR_topology_map_update()
1113 selfid_packet = hal->selfid_ptrs[i]; in s1394_CSR_topology_map_update()
1144 s1394_CSR_topology_map_disable(s1394_hal_t *hal) in s1394_CSR_topology_map_disable() argument
1148 ASSERT(MUTEX_HELD(&hal->topology_tree_mutex)); in s1394_CSR_topology_map_disable()
1150 tm_ptr = (uint32_t *)hal->CSR_topology_map; in s1394_CSR_topology_map_disable()
1163 s1394_common_CSR_routine(s1394_hal_t *hal, cmd1394_cmd_t *req) in s1394_common_CSR_routine() argument
1175 (void) s1394_send_response(hal, req); in s1394_common_CSR_routine()
1186 result = HAL_CALL(hal).csr_read(hal->halinfo.hal_private, in s1394_common_CSR_routine()
1204 result = HAL_CALL(hal).csr_write(hal->halinfo.hal_private, in s1394_common_CSR_routine()
1217 (void) s1394_send_response(hal, req); in s1394_common_CSR_routine()
1227 s1394_init_local_config_rom(s1394_hal_t *hal) in s1394_init_local_config_rom() argument
1245 mutex_init(&hal->local_config_rom_mutex, in s1394_init_local_config_rom()
1246 NULL, MUTEX_DRIVER, hal->halinfo.hw_interrupt); in s1394_init_local_config_rom()
1249 hal->local_config_rom = (uint32_t *)kmem_zalloc(IEEE1394_CONFIG_ROM_SZ, in s1394_init_local_config_rom()
1253 hal->temp_config_rom_buf = (uint32_t *)kmem_zalloc( in s1394_init_local_config_rom()
1256 config_rom = hal->local_config_rom; in s1394_init_local_config_rom()
1259 mutex_enter(&hal->local_config_rom_mutex); in s1394_init_local_config_rom()
1262 ret = s1394_init_config_rom_structures(hal); in s1394_init_local_config_rom()
1265 mutex_exit(&hal->local_config_rom_mutex); in s1394_init_local_config_rom()
1266 kmem_free((void *)hal->temp_config_rom_buf, in s1394_init_local_config_rom()
1268 kmem_free((void *)hal->local_config_rom, in s1394_init_local_config_rom()
1270 mutex_destroy(&hal->local_config_rom_mutex); in s1394_init_local_config_rom()
1274 bus_capabilities = hal->halinfo.bus_capabilities; in s1394_init_local_config_rom()
1296 guid = hal->halinfo.guid; in s1394_init_local_config_rom()
1319 node_capabilities = hal->halinfo.node_capabilities & in s1394_init_local_config_rom()
1353 ret = s1394_add_config_rom_entry(hal, S1394_ROOT_TEXT_KEY, text_leaf, in s1394_init_local_config_rom()
1358 (void) s1394_destroy_config_rom_structures(hal); in s1394_init_local_config_rom()
1360 mutex_exit(&hal->local_config_rom_mutex); in s1394_init_local_config_rom()
1361 kmem_free((void *)hal->temp_config_rom_buf, in s1394_init_local_config_rom()
1363 kmem_free((void *)hal->local_config_rom, in s1394_init_local_config_rom()
1365 mutex_destroy(&hal->local_config_rom_mutex); in s1394_init_local_config_rom()
1383 ret = s1394_add_config_rom_entry(hal, S1394_NODE_UNIQUE_ID_KEY, in s1394_init_local_config_rom()
1390 (void) s1394_destroy_config_rom_structures(hal); in s1394_init_local_config_rom()
1392 mutex_exit(&hal->local_config_rom_mutex); in s1394_init_local_config_rom()
1393 kmem_free((void *)hal->temp_config_rom_buf, in s1394_init_local_config_rom()
1395 kmem_free((void *)hal->local_config_rom, in s1394_init_local_config_rom()
1397 mutex_destroy(&hal->local_config_rom_mutex); in s1394_init_local_config_rom()
1431 ret = s1394_add_config_rom_entry(hal, S1394_UNIT_DIR_KEY, unit_dir, in s1394_init_local_config_rom()
1436 (void) s1394_destroy_config_rom_structures(hal); in s1394_init_local_config_rom()
1438 mutex_exit(&hal->local_config_rom_mutex); in s1394_init_local_config_rom()
1439 kmem_free((void *)hal->temp_config_rom_buf, in s1394_init_local_config_rom()
1442 kmem_free((void *)hal->local_config_rom, in s1394_init_local_config_rom()
1444 mutex_destroy(&hal->local_config_rom_mutex); in s1394_init_local_config_rom()
1449 hal->config_rom_update_amount = (IEEE1394_CONFIG_ROM_QUAD_SZ - in s1394_init_local_config_rom()
1450 hal->free_space); in s1394_init_local_config_rom()
1453 mutex_exit(&hal->local_config_rom_mutex); in s1394_init_local_config_rom()
1459 (void) HAL_CALL(hal).update_config_rom(hal->halinfo.hal_private, in s1394_init_local_config_rom()
1473 s1394_destroy_local_config_rom(s1394_hal_t *hal) in s1394_destroy_local_config_rom() argument
1476 mutex_enter(&hal->local_config_rom_mutex); in s1394_destroy_local_config_rom()
1479 (void) s1394_destroy_config_rom_structures(hal); in s1394_destroy_local_config_rom()
1482 mutex_exit(&hal->local_config_rom_mutex); in s1394_destroy_local_config_rom()
1485 kmem_free((void *)hal->temp_config_rom_buf, IEEE1394_CONFIG_ROM_SZ); in s1394_destroy_local_config_rom()
1487 kmem_free((void *)hal->local_config_rom, IEEE1394_CONFIG_ROM_SZ); in s1394_destroy_local_config_rom()
1490 mutex_destroy(&hal->local_config_rom_mutex); in s1394_destroy_local_config_rom()
1499 s1394_init_config_rom_structures(s1394_hal_t *hal) in s1394_init_config_rom_structures() argument
1504 ASSERT(MUTEX_HELD(&hal->local_config_rom_mutex)); in s1394_init_config_rom_structures()
1525 hal->root_directory = root_directory; in s1394_init_config_rom_structures()
1526 hal->free_space = IEEE1394_CONFIG_ROM_QUAD_SZ - in s1394_init_config_rom_structures()
1538 s1394_destroy_config_rom_structures(s1394_hal_t *hal) in s1394_destroy_config_rom_structures() argument
1543 ASSERT(MUTEX_HELD(&hal->local_config_rom_mutex)); in s1394_destroy_config_rom_structures()
1545 curr_blk = hal->root_directory; in s1394_destroy_config_rom_structures()
1567 s1394_add_config_rom_entry(s1394_hal_t *hal, uint8_t key, uint32_t *buffer, in s1394_add_config_rom_entry() argument
1580 ASSERT(MUTEX_HELD(&hal->local_config_rom_mutex)); in s1394_add_config_rom_entry()
1582 if (size > hal->free_space) { in s1394_add_config_rom_entry()
1588 config_rom = hal->local_config_rom; in s1394_add_config_rom_entry()
1589 temp_buf = hal->temp_config_rom_buf; in s1394_add_config_rom_entry()
1595 tmp_offset = hal->root_directory->cfgrom_addr_lo; in s1394_add_config_rom_entry()
1596 tmp_size = (hal->root_directory->cfgrom_addr_hi - tmp_offset) + 1; in s1394_add_config_rom_entry()
1599 last_entry_offset = hal->root_directory->cfgrom_addr_hi + 1; in s1394_add_config_rom_entry()
1601 curr_blk = hal->root_directory; in s1394_add_config_rom_entry()
1624 hal->free_space--; in s1394_add_config_rom_entry()
1635 if (hal->free_space == size) { in s1394_add_config_rom_entry()
1654 hal->free_space = hal->free_space - size; in s1394_add_config_rom_entry()
1661 tmp_offset = hal->root_directory->cfgrom_addr_hi; in s1394_add_config_rom_entry()
1662 tmp_size = tmp_offset - hal->root_directory->cfgrom_addr_lo; in s1394_add_config_rom_entry()
1666 temp_buf[hal->root_directory->cfgrom_addr_hi] = in s1394_add_config_rom_entry()
1669 tmp_offset = hal->root_directory->cfgrom_addr_lo; in s1394_add_config_rom_entry()
1672 for (i = (tmp_offset + 1); i <= hal->root_directory->cfgrom_addr_hi; in s1394_add_config_rom_entry()
1680 for (i = tmp_offset; i <= hal->root_directory->cfgrom_addr_hi; i++) in s1394_add_config_rom_entry()
1704 s1394_remove_config_rom_entry(s1394_hal_t *hal, void **handle, int *status) in s1394_remove_config_rom_entry() argument
1720 ASSERT(MUTEX_HELD(&hal->local_config_rom_mutex)); in s1394_remove_config_rom_entry()
1724 config_rom = hal->local_config_rom; in s1394_remove_config_rom_entry()
1725 temp_buf = hal->temp_config_rom_buf; in s1394_remove_config_rom_entry()
1730 root_offset = hal->root_directory->cfgrom_addr_lo; in s1394_remove_config_rom_entry()
1745 curr_blk = hal->root_directory->cfgrom_next; in s1394_remove_config_rom_entry()
1816 hal->free_space = hal->free_space + (del_offset + 1); in s1394_remove_config_rom_entry()
1823 hal->root_directory->cfgrom_addr_hi--; in s1394_remove_config_rom_entry()
1824 tmp_offset = hal->root_directory->cfgrom_addr_lo; in s1394_remove_config_rom_entry()
1825 tmp_size = hal->root_directory->cfgrom_addr_hi - tmp_offset; in s1394_remove_config_rom_entry()
1828 for (i = (tmp_offset + 1); i <= hal->root_directory->cfgrom_addr_hi; in s1394_remove_config_rom_entry()
1836 for (i = (tmp_offset + 1); i <= hal->root_directory->cfgrom_addr_hi; in s1394_remove_config_rom_entry()
1841 tmp_size = IEEE1394_CONFIG_ROM_SZ - (hal->free_space << 2); in s1394_remove_config_rom_entry()
1863 s1394_hal_t *hal; in s1394_update_config_rom_callback() local
1871 hal = (s1394_hal_t *)arg; in s1394_update_config_rom_callback()
1874 mutex_enter(&hal->local_config_rom_mutex); in s1394_update_config_rom_callback()
1876 config_rom = hal->local_config_rom; in s1394_update_config_rom_callback()
1902 last_entry_offset = (IEEE1394_CONFIG_ROM_QUAD_SZ - hal->free_space); in s1394_update_config_rom_callback()
1903 if (last_entry_offset < hal->config_rom_update_amount) in s1394_update_config_rom_callback()
1904 last_entry_offset = hal->config_rom_update_amount; in s1394_update_config_rom_callback()
1906 hal->config_rom_update_amount = (IEEE1394_CONFIG_ROM_QUAD_SZ - in s1394_update_config_rom_callback()
1907 hal->free_space); in s1394_update_config_rom_callback()
1910 hal->config_rom_timer_set = B_FALSE; in s1394_update_config_rom_callback()
1913 mutex_exit(&hal->local_config_rom_mutex); in s1394_update_config_rom_callback()
1919 (void) HAL_CALL(hal).update_config_rom(hal->halinfo.hal_private,\ in s1394_update_config_rom_callback()
1923 (void) HAL_CALL(hal).bus_reset(hal->halinfo.hal_private); in s1394_update_config_rom_callback()