Lines Matching refs:state

66 static int tavor_drv_init(tavor_state_t *state, dev_info_t *dip, int instance);
67 static void tavor_drv_fini(tavor_state_t *state);
68 static void tavor_drv_fini2(tavor_state_t *state);
69 static int tavor_isr_init(tavor_state_t *state);
70 static void tavor_isr_fini(tavor_state_t *state);
71 static int tavor_hw_init(tavor_state_t *state);
72 static void tavor_hw_fini(tavor_state_t *state,
74 static int tavor_soft_state_init(tavor_state_t *state);
75 static void tavor_soft_state_fini(tavor_state_t *state);
76 static int tavor_hca_port_init(tavor_state_t *state);
77 static int tavor_hca_ports_shutdown(tavor_state_t *state, uint_t num_init);
78 static void tavor_hca_config_setup(tavor_state_t *state,
80 static int tavor_internal_uarpgs_init(tavor_state_t *state);
81 static void tavor_internal_uarpgs_fini(tavor_state_t *state);
82 static int tavor_special_qp_contexts_reserve(tavor_state_t *state);
83 static void tavor_special_qp_contexts_unreserve(tavor_state_t *state);
84 static int tavor_sw_reset(tavor_state_t *state);
85 static int tavor_mcg_init(tavor_state_t *state);
86 static void tavor_mcg_fini(tavor_state_t *state);
87 static int tavor_fw_version_check(tavor_state_t *state);
88 static void tavor_device_info_report(tavor_state_t *state);
89 static void tavor_pci_capability_list(tavor_state_t *state,
91 static void tavor_pci_capability_vpd(tavor_state_t *state,
95 static void tavor_pci_capability_pcix(tavor_state_t *state,
97 static int tavor_intr_or_msi_init(tavor_state_t *state);
98 static int tavor_add_intrs(tavor_state_t *state, int intr_type);
99 static int tavor_intr_or_msi_fini(tavor_state_t *state);
239 tavor_state_t *state; in tavor_getinfo() local
246 state = ddi_get_soft_state(tavor_statep, instance); in tavor_getinfo()
247 if (state == NULL) { in tavor_getinfo()
250 *result = (void *)state->ts_dip; in tavor_getinfo()
274 tavor_state_t *state; in tavor_open() local
284 state = ddi_get_soft_state(tavor_statep, instance); in tavor_open()
285 if (state == NULL) { in tavor_open()
341 if (!TAVOR_IS_OPERATIONAL(state->ts_operational_mode)) { in tavor_open()
343 tr_indx = state->ts_open_tr_indx++; in tavor_open()
346 status = tavor_rsrc_alloc(state, TAVOR_UARPG, 1, in tavor_open()
366 if (TAVOR_IS_OPERATIONAL(state->ts_operational_mode)) { in tavor_open()
367 tavor_rsrc_free(state, &rsrcp); in tavor_open()
391 if (TAVOR_IS_OPERATIONAL(state->ts_operational_mode)) { in tavor_open()
392 tavor_rsrc_free(state, &rsrcp); in tavor_open()
426 tavor_state_t *state; in tavor_close() local
435 state = ddi_get_soft_state(tavor_statep, instance); in tavor_close()
436 if (state == NULL) { in tavor_close()
497 if (TAVOR_IS_OPERATIONAL(state->ts_operational_mode)) { in tavor_close()
499 tavor_rsrc_free(state, &rsrcp); in tavor_close()
516 tavor_state_t *state; in tavor_attach() local
536 state = ddi_get_soft_state(tavor_statep, instance); in tavor_attach()
537 if (state == NULL) { in tavor_attach()
545 TAVOR_ATTACH_MSG_INIT(state->ts_attach_buf); in tavor_attach()
558 status = tavor_drv_init(state, dip, instance); in tavor_attach()
560 (TAVOR_IS_OPERATIONAL(state->ts_operational_mode))) { in tavor_attach()
568 tavor_drv_fini(state); in tavor_attach()
569 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_attach()
580 if (TAVOR_IS_OPERATIONAL(state->ts_operational_mode)) { in tavor_attach()
584 &state->ts_ibtfinfo); in tavor_attach()
587 tavor_drv_fini(state); in tavor_attach()
588 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_attach()
598 TAVOR_ENABLE_IBTF_CALLB(state, tmp_ibtfpriv); in tavor_attach()
600 ibc_post_attach(state->ts_ibtfpriv); in tavor_attach()
603 status = tavor_agent_handlers_init(state); in tavor_attach()
606 TAVOR_QUIESCE_IBTF_CALLB(state); in tavor_attach()
607 if (state->ts_in_evcallb != 0) { in tavor_attach()
608 TAVOR_WARNING(state, "unable to " in tavor_attach()
613 tavor_drv_fini(state); in tavor_attach()
614 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_attach()
624 tavor_device_info_report(state); in tavor_attach()
627 if (!(TAVOR_IS_OPERATIONAL(state->ts_operational_mode))) { in tavor_attach()
629 "(for maintenance mode only)", state->ts_instance); in tavor_attach()
644 state->ts_attach_buf); in tavor_attach()
645 tavor_drv_fini2(state); in tavor_attach()
659 tavor_state_t *state; in tavor_detach() local
665 state = ddi_get_soft_state(tavor_statep, instance); in tavor_detach()
666 if (state == NULL) { in tavor_detach()
678 if (TAVOR_IS_OPERATIONAL(state->ts_operational_mode)) { in tavor_detach()
680 status = tavor_agent_handlers_fini(state); in tavor_detach()
693 ibc_status = ibc_pre_detach(state->ts_ibtfpriv, cmd); in tavor_detach()
695 status = tavor_agent_handlers_init(state); in tavor_detach()
697 TAVOR_WARNING(state, "failed to " in tavor_detach()
713 tmp_ibtfpriv = state->ts_ibtfpriv; in tavor_detach()
714 TAVOR_QUIESCE_IBTF_CALLB(state); in tavor_detach()
715 if (state->ts_in_evcallb != 0) { in tavor_detach()
716 TAVOR_WARNING(state, "unable to quiesce Tavor " in tavor_detach()
733 if (TAVOR_IS_OPERATIONAL(state->ts_operational_mode)) { in tavor_detach()
735 tavor_drv_fini(state); in tavor_detach()
740 tavor_drv_fini2(state); in tavor_detach()
762 tavor_drv_init(tavor_state_t *state, dev_info_t *dip, int instance) in tavor_drv_init() argument
767 state->ts_dip = dip; in tavor_drv_init()
768 state->ts_instance = instance; in tavor_drv_init()
778 if (TAVOR_IS_HCA_MODE(state->ts_dip)) { in tavor_drv_init()
779 state->ts_operational_mode = TAVOR_HCA_MODE; in tavor_drv_init()
781 } else if (TAVOR_IS_COMPAT_MODE(state->ts_dip)) { in tavor_drv_init()
782 state->ts_operational_mode = TAVOR_COMPAT_MODE; in tavor_drv_init()
784 } else if (TAVOR_IS_MAINTENANCE_MODE(state->ts_dip)) { in tavor_drv_init()
785 state->ts_operational_mode = TAVOR_MAINTENANCE_MODE; in tavor_drv_init()
789 state->ts_operational_mode = 0; /* invalid operational mode */ in tavor_drv_init()
790 TAVOR_WARNING(state, "unexpected device type detected"); in tavor_drv_init()
803 status = tavor_hw_init(state); in tavor_drv_init()
805 state->ts_operational_mode = TAVOR_MAINTENANCE_MODE; in tavor_drv_init()
807 state->ts_attach_buf); in tavor_drv_init()
812 status = tavor_isr_init(state); in tavor_drv_init()
814 tavor_hw_fini(state, TAVOR_DRV_CLEANUP_ALL); in tavor_drv_init()
819 status = tavor_soft_state_init(state); in tavor_drv_init()
821 tavor_isr_fini(state); in tavor_drv_init()
822 tavor_hw_fini(state, TAVOR_DRV_CLEANUP_ALL); in tavor_drv_init()
835 tavor_drv_fini(tavor_state_t *state) in tavor_drv_fini() argument
838 tavor_soft_state_fini(state); in tavor_drv_fini()
841 tavor_isr_fini(state); in tavor_drv_fini()
844 tavor_hw_fini(state, TAVOR_DRV_CLEANUP_ALL); in tavor_drv_fini()
852 tavor_drv_fini2(tavor_state_t *state) in tavor_drv_fini2() argument
855 if (state->ts_reg_cmdhdl) { in tavor_drv_fini2()
856 ddi_regs_map_free(&state->ts_reg_cmdhdl); in tavor_drv_fini2()
857 state->ts_reg_cmdhdl = NULL; in tavor_drv_fini2()
861 if (state->ts_pci_cfghdl) { in tavor_drv_fini2()
862 pci_config_teardown(&state->ts_pci_cfghdl); in tavor_drv_fini2()
863 state->ts_pci_cfghdl = NULL; in tavor_drv_fini2()
872 tavor_isr_init(tavor_state_t *state) in tavor_isr_init() argument
879 status = ddi_intr_add_handler(state->ts_intrmsi_hdl, tavor_isr, in tavor_isr_init()
880 (caddr_t)state, NULL); in tavor_isr_init()
891 if (state->ts_intrmsi_cap & DDI_INTR_FLAG_BLOCK) { in tavor_isr_init()
892 status = ddi_intr_block_enable(&state->ts_intrmsi_hdl, 1); in tavor_isr_init()
897 status = ddi_intr_enable(state->ts_intrmsi_hdl); in tavor_isr_init()
907 tavor_eq_arm_all(state); in tavor_isr_init()
918 tavor_isr_fini(tavor_state_t *state) in tavor_isr_fini() argument
921 if (state->ts_intrmsi_cap & DDI_INTR_FLAG_BLOCK) { in tavor_isr_fini()
922 (void) ddi_intr_block_disable(&state->ts_intrmsi_hdl, 1); in tavor_isr_fini()
924 (void) ddi_intr_disable(state->ts_intrmsi_hdl); in tavor_isr_fini()
930 (void) ddi_intr_remove_handler(state->ts_intrmsi_hdl); in tavor_isr_fini()
943 tavor_fix_error_buf(tavor_state_t *state) in tavor_fix_error_buf() argument
948 if (ddi_prop_lookup_int_array(DDI_DEV_T_ANY, state->ts_dip, in tavor_fix_error_buf()
953 state->ts_fw.error_buf_addr -= assigned_addr[0].pci_phys_low + in tavor_fix_error_buf()
964 tavor_hw_init(tavor_state_t *state) in tavor_hw_init() argument
977 state->ts_reg_accattr.devacc_attr_version = DDI_DEVICE_ATTR_V0; in tavor_hw_init()
978 state->ts_reg_accattr.devacc_attr_endian_flags = DDI_STRUCTURE_BE_ACC; in tavor_hw_init()
979 state->ts_reg_accattr.devacc_attr_dataorder = DDI_STRICTORDER_ACC; in tavor_hw_init()
982 status = pci_config_setup(state->ts_dip, &state->ts_pci_cfghdl); in tavor_hw_init()
984 tavor_hw_fini(state, cleanup); in tavor_hw_init()
985 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_hw_init()
992 status = ddi_regs_map_setup(state->ts_dip, TAVOR_CMD_BAR, in tavor_hw_init()
993 &state->ts_reg_cmd_baseaddr, 0, 0, &state->ts_reg_accattr, in tavor_hw_init()
994 &state->ts_reg_cmdhdl); in tavor_hw_init()
996 tavor_hw_fini(state, cleanup); in tavor_hw_init()
997 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_hw_init()
1003 status = ddi_regs_map_setup(state->ts_dip, TAVOR_UAR_BAR, in tavor_hw_init()
1004 &state->ts_reg_uar_baseaddr, 0, 0, &state->ts_reg_accattr, in tavor_hw_init()
1005 &state->ts_reg_uarhdl); in tavor_hw_init()
1007 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1008 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_hw_init()
1014 status = ddi_dev_regsize(state->ts_dip, TAVOR_DDR_BAR, &ddr_size); in tavor_hw_init()
1018 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1019 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_hw_init()
1037 state->ts_cfg_profile_setting = ddr_size; in tavor_hw_init()
1039 status = ddi_regs_map_setup(state->ts_dip, TAVOR_DDR_BAR, in tavor_hw_init()
1040 &state->ts_reg_ddr_baseaddr, 0, ddr_size, &state->ts_reg_accattr, in tavor_hw_init()
1041 &state->ts_reg_ddrhdl); in tavor_hw_init()
1057 status = ddi_regs_map_setup(state->ts_dip, TAVOR_DDR_BAR, in tavor_hw_init()
1058 &state->ts_reg_ddr_baseaddr, 0, TAVOR_DDR_SIZE_128, in tavor_hw_init()
1059 &state->ts_reg_accattr, &state->ts_reg_ddrhdl); in tavor_hw_init()
1066 state->ts_cfg_profile_setting = TAVOR_DDR_SIZE_128; in tavor_hw_init()
1075 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1076 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_hw_init()
1083 state->ts_cmd_regs.hcr = (tavor_hw_hcr_t *) in tavor_hw_init()
1084 ((uintptr_t)state->ts_reg_cmd_baseaddr + TAVOR_CMD_HCR_OFFSET); in tavor_hw_init()
1087 state->ts_cmd_regs.ecr = (uint64_t *) in tavor_hw_init()
1088 ((uintptr_t)state->ts_reg_cmd_baseaddr + TAVOR_CMD_ECR_OFFSET); in tavor_hw_init()
1089 state->ts_cmd_regs.clr_ecr = (uint64_t *) in tavor_hw_init()
1090 ((uintptr_t)state->ts_reg_cmd_baseaddr + TAVOR_CMD_CLR_ECR_OFFSET); in tavor_hw_init()
1093 state->ts_cmd_regs.sw_reset = (uint32_t *) in tavor_hw_init()
1094 ((uintptr_t)state->ts_reg_cmd_baseaddr + TAVOR_CMD_SW_RESET_OFFSET); in tavor_hw_init()
1097 state->ts_cmd_regs.clr_int = (uint64_t *) in tavor_hw_init()
1098 ((uintptr_t)state->ts_reg_cmd_baseaddr + TAVOR_CMD_CLR_INT_OFFSET); in tavor_hw_init()
1101 status = tavor_cfg_profile_init_phase1(state); in tavor_hw_init()
1103 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1104 TAVOR_ATTACH_MSG(state->ts_attach_buf, "hw_init_cfginit_fail"); in tavor_hw_init()
1110 status = tavor_sw_reset(state); in tavor_hw_init()
1112 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1113 TAVOR_ATTACH_MSG(state->ts_attach_buf, "hw_init_sw_reset_fail"); in tavor_hw_init()
1118 status = tavor_sys_en_cmd_post(state, TAVOR_CMD_SYS_EN_NORMAL, in tavor_hw_init()
1130 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1131 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_hw_init()
1138 status = tavor_rsrc_init_phase1(state); in tavor_hw_init()
1140 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1141 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_hw_init()
1148 status = tavor_cmn_query_cmd_post(state, QUERY_DDR, 0, in tavor_hw_init()
1149 &state->ts_ddr, sizeof (tavor_hw_queryddr_t), in tavor_hw_init()
1154 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1155 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_hw_init()
1161 status = tavor_cmn_query_cmd_post(state, QUERY_FW, 0, &state->ts_fw, in tavor_hw_init()
1166 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1167 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_hw_init()
1172 if (tavor_fix_error_buf(state) != DDI_SUCCESS) { in tavor_hw_init()
1173 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1174 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_hw_init()
1180 status = tavor_fw_version_check(state); in tavor_hw_init()
1182 if (state->ts_operational_mode == TAVOR_HCA_MODE) { in tavor_hw_init()
1189 state->ts_fw.fw_rev_major, in tavor_hw_init()
1190 state->ts_fw.fw_rev_minor, in tavor_hw_init()
1191 state->ts_fw.fw_rev_subminor); in tavor_hw_init()
1192 } else if (state->ts_operational_mode == TAVOR_COMPAT_MODE) { in tavor_hw_init()
1199 state->ts_fw.fw_rev_major, in tavor_hw_init()
1200 state->ts_fw.fw_rev_minor, in tavor_hw_init()
1201 state->ts_fw.fw_rev_subminor); in tavor_hw_init()
1205 state->ts_fw.fw_rev_major, in tavor_hw_init()
1206 state->ts_fw.fw_rev_minor, in tavor_hw_init()
1207 state->ts_fw.fw_rev_subminor); in tavor_hw_init()
1209 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1210 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_hw_init()
1219 status = tavor_mod_stat_cfg_cmd_post(state); in tavor_hw_init()
1228 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1229 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_hw_init()
1235 status = tavor_cmn_query_cmd_post(state, QUERY_DEV_LIM, 0, in tavor_hw_init()
1236 &state->ts_devlim, sizeof (tavor_hw_querydevlim_t), in tavor_hw_init()
1241 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1242 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_hw_init()
1248 status = tavor_cfg_profile_init_phase2(state); in tavor_hw_init()
1250 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1251 TAVOR_ATTACH_MSG(state->ts_attach_buf, "hw_init_cfginit2_fail"); in tavor_hw_init()
1256 status = tavor_rsrc_init_phase2(state); in tavor_hw_init()
1258 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1259 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_hw_init()
1266 status = tavor_cmn_query_cmd_post(state, QUERY_ADAPTER, 0, in tavor_hw_init()
1267 &state->ts_adapter, sizeof (tavor_hw_queryadapter_t), in tavor_hw_init()
1272 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1273 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_hw_init()
1279 tavor_hca_config_setup(state, &state->ts_hcaparams); in tavor_hw_init()
1282 status = tavor_init_hca_cmd_post(state, &state->ts_hcaparams, in tavor_hw_init()
1287 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1288 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_hw_init()
1295 status = tavor_pd_alloc(state, &state->ts_pdhdl_internal, TAVOR_SLEEP); in tavor_hw_init()
1297 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1298 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_hw_init()
1305 status = tavor_internal_uarpgs_init(state); in tavor_hw_init()
1307 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1308 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_hw_init()
1315 status = tavor_intr_or_msi_init(state); in tavor_hw_init()
1317 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1318 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_hw_init()
1325 status = tavor_eq_init_all(state); in tavor_hw_init()
1327 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1328 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_hw_init()
1335 status = tavor_special_qp_contexts_reserve(state); in tavor_hw_init()
1337 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1338 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_hw_init()
1345 status = tavor_mcg_init(state); in tavor_hw_init()
1347 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1348 TAVOR_ATTACH_MSG(state->ts_attach_buf, "hw_init_mcg_init_fail"); in tavor_hw_init()
1354 status = tavor_hca_port_init(state); in tavor_hw_init()
1356 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1357 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_hw_init()
1364 status = tavor_getnodeinfo_cmd_post(state, TAVOR_CMD_NOSLEEP_SPIN, in tavor_hw_init()
1369 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1370 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_hw_init()
1383 if (state->ts_cfg_profile->cp_nodeguid) { in tavor_hw_init()
1384 state->ts_nodeguid = state->ts_cfg_profile->cp_nodeguid; in tavor_hw_init()
1386 state->ts_nodeguid = nodeinfo.NodeGUID; in tavor_hw_init()
1389 if (state->ts_nodeguid != nodeinfo.NodeGUID) { in tavor_hw_init()
1402 if (state->ts_cfg_profile->cp_sysimgguid) { in tavor_hw_init()
1403 state->ts_sysimgguid = state->ts_cfg_profile->cp_sysimgguid; in tavor_hw_init()
1405 state->ts_sysimgguid = nodeinfo.SystemImageGUID; in tavor_hw_init()
1408 if (state->ts_sysimgguid != nodeinfo.SystemImageGUID) { in tavor_hw_init()
1414 status = tavor_getnodedesc_cmd_post(state, TAVOR_CMD_NOSLEEP_SPIN, in tavor_hw_init()
1415 (sm_nodedesc_t *)&state->ts_nodedesc); in tavor_hw_init()
1419 tavor_hw_fini(state, cleanup); in tavor_hw_init()
1420 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_hw_init()
1434 tavor_hw_fini(tavor_state_t *state, tavor_drv_cleanup_level_t cleanup) in tavor_hw_fini() argument
1447 num_ports = state->ts_cfg_profile->cp_num_ports; in tavor_hw_fini()
1448 (void) tavor_hca_ports_shutdown(state, num_ports); in tavor_hw_fini()
1453 tavor_mcg_fini(state); in tavor_hw_fini()
1458 tavor_special_qp_contexts_unreserve(state); in tavor_hw_fini()
1467 status = tavor_eq_fini_all(state); in tavor_hw_fini()
1469 TAVOR_WARNING(state, "failed to teardown EQs"); in tavor_hw_fini()
1475 status = tavor_intr_or_msi_fini(state); in tavor_hw_fini()
1477 TAVOR_WARNING(state, "failed to free intr/MSI"); in tavor_hw_fini()
1484 tavor_internal_uarpgs_fini(state); in tavor_hw_fini()
1493 status = tavor_pd_free(state, &state->ts_pdhdl_internal); in tavor_hw_fini()
1495 TAVOR_WARNING(state, "failed to free internal PD"); in tavor_hw_fini()
1506 status = tavor_close_hca_cmd_post(state, in tavor_hw_fini()
1509 TAVOR_WARNING(state, "failed to shutdown HCA"); in tavor_hw_fini()
1516 tavor_rsrc_fini(state, TAVOR_RSRC_CLEANUP_ALL); in tavor_hw_fini()
1521 tavor_rsrc_fini(state, TAVOR_RSRC_CLEANUP_PHASE1_COMPLETE); in tavor_hw_fini()
1531 status = tavor_sys_dis_cmd_post(state, TAVOR_CMD_NOSLEEP_SPIN); in tavor_hw_fini()
1533 TAVOR_WARNING(state, "failed to shutdown hardware"); in tavor_hw_fini()
1540 tavor_cfg_profile_fini(state); in tavor_hw_fini()
1544 ddi_regs_map_free(&state->ts_reg_ddrhdl); in tavor_hw_fini()
1548 ddi_regs_map_free(&state->ts_reg_uarhdl); in tavor_hw_fini()
1560 TAVOR_WARNING(state, "unexpected driver cleanup level"); in tavor_hw_fini()
1571 tavor_soft_state_init(tavor_state_t *state) in tavor_soft_state_init() argument
1584 state->ts_ibtfinfo.hca_ci_vers = IBCI_V4; in tavor_soft_state_init()
1585 state->ts_ibtfinfo.hca_handle = (ibc_hca_hdl_t)state; in tavor_soft_state_init()
1586 state->ts_ibtfinfo.hca_ops = &tavor_ibc_ops; in tavor_soft_state_init()
1589 state->ts_ibtfinfo.hca_attr = hca_attr; in tavor_soft_state_init()
1591 hca_attr->hca_dip = state->ts_dip; in tavor_soft_state_init()
1592 hca_attr->hca_fw_major_version = state->ts_fw.fw_rev_major; in tavor_soft_state_init()
1593 hca_attr->hca_fw_minor_version = state->ts_fw.fw_rev_minor; in tavor_soft_state_init()
1594 hca_attr->hca_fw_micro_version = state->ts_fw.fw_rev_subminor; in tavor_soft_state_init()
1607 if (state->ts_devlim.ud_multi) { in tavor_soft_state_init()
1610 if (state->ts_devlim.atomic) { in tavor_soft_state_init()
1613 if (state->ts_devlim.apm) { in tavor_soft_state_init()
1616 if (state->ts_devlim.pkey_v) { in tavor_soft_state_init()
1619 if (state->ts_devlim.qkey_v) { in tavor_soft_state_init()
1622 if (state->ts_cfg_profile->cp_srq_enable) { in tavor_soft_state_init()
1632 hca_attr->hca_vendor_id = state->ts_adapter.vendor_id; in tavor_soft_state_init()
1633 hca_attr->hca_device_id = state->ts_adapter.device_id; in tavor_soft_state_init()
1634 hca_attr->hca_version_id = state->ts_adapter.rev_id; in tavor_soft_state_init()
1642 val = ((uint64_t)1 << state->ts_cfg_profile->cp_log_num_qp); in tavor_soft_state_init()
1644 state->ts_devlim.log_rsvd_qp); in tavor_soft_state_init()
1645 maxval = ((uint64_t)1 << state->ts_devlim.log_max_qp_sz); in tavor_soft_state_init()
1646 val = ((uint64_t)1 << state->ts_cfg_profile->cp_log_max_qp_sz); in tavor_soft_state_init()
1649 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_soft_state_init()
1656 maxval = state->ts_devlim.max_sg; in tavor_soft_state_init()
1657 val = state->ts_cfg_profile->cp_wqe_max_sgl; in tavor_soft_state_init()
1660 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_soft_state_init()
1665 if (state->ts_cfg_profile->cp_wqe_real_max_sgl > maxval) { in tavor_soft_state_init()
1666 state->ts_cfg_profile->cp_wqe_real_max_sgl = maxval; in tavor_soft_state_init()
1669 val = state->ts_cfg_profile->cp_wqe_real_max_sgl; in tavor_soft_state_init()
1681 val = ((uint64_t)1 << state->ts_cfg_profile->cp_log_num_cq); in tavor_soft_state_init()
1683 state->ts_devlim.log_rsvd_cq); in tavor_soft_state_init()
1684 maxval = ((uint64_t)1 << state->ts_devlim.log_max_cq_sz); in tavor_soft_state_init()
1685 val = ((uint64_t)1 << state->ts_cfg_profile->cp_log_max_cq_sz) - 1; in tavor_soft_state_init()
1688 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_soft_state_init()
1700 val = ((uint64_t)1 << state->ts_cfg_profile->cp_log_num_srq); in tavor_soft_state_init()
1702 state->ts_devlim.log_rsvd_srq); in tavor_soft_state_init()
1703 maxval = ((uint64_t)1 << state->ts_devlim.log_max_srq_sz); in tavor_soft_state_init()
1704 val = ((uint64_t)1 << state->ts_cfg_profile->cp_log_max_srq_sz); in tavor_soft_state_init()
1708 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_soft_state_init()
1714 val = state->ts_cfg_profile->cp_srq_max_sgl; in tavor_soft_state_init()
1715 maxval = state->ts_devlim.max_sg; in tavor_soft_state_init()
1718 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_soft_state_init()
1739 val = ((uint64_t)1 << state->ts_cfg_profile->cp_log_num_mpt); in tavor_soft_state_init()
1741 state->ts_devlim.log_rsvd_mpt); in tavor_soft_state_init()
1743 state->ts_devlim.log_rsvd_mpt); in tavor_soft_state_init()
1744 maxval = state->ts_devlim.log_max_mrw_sz; in tavor_soft_state_init()
1745 val = state->ts_cfg_profile->cp_log_max_mrw_sz; in tavor_soft_state_init()
1748 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_soft_state_init()
1755 val = ((uint64_t)1 << state->ts_cfg_profile->cp_log_num_rdb); in tavor_soft_state_init()
1757 val = state->ts_cfg_profile->cp_hca_max_rdma_in_qp; in tavor_soft_state_init()
1759 val = state->ts_cfg_profile->cp_hca_max_rdma_out_qp; in tavor_soft_state_init()
1772 val = ((uint64_t)1 << state->ts_cfg_profile->cp_log_num_qp); in tavor_soft_state_init()
1774 val = ((uint64_t)1 << state->ts_cfg_profile->cp_log_num_mcg); in tavor_soft_state_init()
1776 val = state->ts_cfg_profile->cp_num_qp_per_mcg; in tavor_soft_state_init()
1780 maxval = ((uint64_t)1 << state->ts_devlim.log_max_pkey); in tavor_soft_state_init()
1781 val = ((uint64_t)state->ts_cfg_profile->cp_num_ports << in tavor_soft_state_init()
1782 state->ts_cfg_profile->cp_log_max_pkeytbl); in tavor_soft_state_init()
1786 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_soft_state_init()
1793 maxval = state->ts_devlim.num_ports; in tavor_soft_state_init()
1794 val = state->ts_cfg_profile->cp_num_ports; in tavor_soft_state_init()
1797 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_soft_state_init()
1804 hca_attr->hca_node_guid = state->ts_nodeguid; in tavor_soft_state_init()
1805 hca_attr->hca_si_guid = state->ts_sysimgguid; in tavor_soft_state_init()
1811 hca_attr->hca_local_ack_delay = state->ts_devlim.ca_ack_delay; in tavor_soft_state_init()
1814 val = ((uint64_t)1 << state->ts_cfg_profile->cp_log_max_gidtbl); in tavor_soft_state_init()
1816 val = ((uint64_t)1 << state->ts_cfg_profile->cp_log_max_pkeytbl); in tavor_soft_state_init()
1820 maxval = ((uint64_t)1 << state->ts_devlim.log_max_pd); in tavor_soft_state_init()
1821 val = ((uint64_t)1 << state->ts_cfg_profile->cp_log_num_pd); in tavor_soft_state_init()
1824 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_soft_state_init()
1831 maxval = ((uint64_t)1 << state->ts_devlim.log_max_av); in tavor_soft_state_init()
1832 val = ((uint64_t)1 << state->ts_cfg_profile->cp_log_num_ah); in tavor_soft_state_init()
1835 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_soft_state_init()
1846 mutex_init(&state->ts_uar_lock, NULL, MUTEX_DRIVER, in tavor_soft_state_init()
1847 DDI_INTR_PRI(state->ts_intrmsi_pri)); in tavor_soft_state_init()
1850 state->ts_fw_flashstarted = 0; in tavor_soft_state_init()
1851 mutex_init(&state->ts_fw_flashlock, NULL, MUTEX_DRIVER, in tavor_soft_state_init()
1852 DDI_INTR_PRI(state->ts_intrmsi_pri)); in tavor_soft_state_init()
1855 mutex_init(&state->ts_info_lock, NULL, MUTEX_DRIVER, in tavor_soft_state_init()
1856 DDI_INTR_PRI(state->ts_intrmsi_pri)); in tavor_soft_state_init()
1859 tavor_qpn_avl_init(state); in tavor_soft_state_init()
1862 status = tavor_kstat_init(state); in tavor_soft_state_init()
1864 tavor_qpn_avl_fini(state); in tavor_soft_state_init()
1865 mutex_destroy(&state->ts_info_lock); in tavor_soft_state_init()
1866 mutex_destroy(&state->ts_fw_flashlock); in tavor_soft_state_init()
1867 mutex_destroy(&state->ts_uar_lock); in tavor_soft_state_init()
1869 TAVOR_ATTACH_MSG(state->ts_attach_buf, in tavor_soft_state_init()
1883 tavor_soft_state_fini(tavor_state_t *state) in tavor_soft_state_fini() argument
1886 tavor_kstat_fini(state); in tavor_soft_state_fini()
1889 tavor_qpn_avl_fini(state); in tavor_soft_state_fini()
1892 mutex_destroy(&state->ts_info_lock); in tavor_soft_state_fini()
1895 mutex_destroy(&state->ts_fw_flashlock); in tavor_soft_state_fini()
1898 mutex_destroy(&state->ts_uar_lock); in tavor_soft_state_fini()
1901 kmem_free(state->ts_ibtfinfo.hca_attr, sizeof (ibt_hca_attr_t)); in tavor_soft_state_fini()
1910 tavor_hca_config_setup(tavor_state_t *state, in tavor_hca_config_setup() argument
1928 ddr_baseaddr = (uint64_t)(uintptr_t)state->ts_reg_ddr_baseaddr; in tavor_hca_config_setup()
1929 ddr_base_map_addr = (uint64_t)state->ts_ddr.ddr_baseaddr; in tavor_hca_config_setup()
1932 rsrc_pool = &state->ts_rsrc_hdl[TAVOR_QPC]; in tavor_hca_config_setup()
1937 inithca->context.log_num_qp = state->ts_cfg_profile->cp_log_num_qp; in tavor_hca_config_setup()
1945 rsrc_pool = &state->ts_rsrc_hdl[TAVOR_CQC]; in tavor_hca_config_setup()
1950 inithca->context.log_num_cq = state->ts_cfg_profile->cp_log_num_cq; in tavor_hca_config_setup()
1953 rsrc_pool = &state->ts_rsrc_hdl[TAVOR_SRQC]; in tavor_hca_config_setup()
1959 state->ts_cfg_profile->cp_log_num_srq; in tavor_hca_config_setup()
1962 rsrc_pool = &state->ts_rsrc_hdl[TAVOR_EQPC]; in tavor_hca_config_setup()
1971 rsrc_pool = &state->ts_rsrc_hdl[TAVOR_EQC]; in tavor_hca_config_setup()
1979 rsrc_pool = &state->ts_rsrc_hdl[TAVOR_RDB]; in tavor_hca_config_setup()
1986 rsrc_pool = &state->ts_rsrc_hdl[TAVOR_MCG]; in tavor_hca_config_setup()
1990 mcg_size = TAVOR_MCGMEM_SZ(state); in tavor_hca_config_setup()
1993 (1 << state->ts_cfg_profile->cp_log_num_mcg_hash); in tavor_hca_config_setup()
1995 inithca->multi.log_mc_tbl_sz = state->ts_cfg_profile->cp_log_num_mcg; in tavor_hca_config_setup()
1999 rsrc_pool = &state->ts_rsrc_hdl[TAVOR_MPT]; in tavor_hca_config_setup()
2004 inithca->tpt.log_mpt_sz = state->ts_cfg_profile->cp_log_num_mpt; in tavor_hca_config_setup()
2007 rsrc_pool = &state->ts_rsrc_hdl[TAVOR_MTT]; in tavor_hca_config_setup()
2013 rsrc_pool = &state->ts_rsrc_hdl[TAVOR_UAR_SCR]; in tavor_hca_config_setup()
2027 tavor_hca_port_init(tavor_state_t *state) in tavor_hca_port_init() argument
2036 cfgprof = state->ts_cfg_profile; in tavor_hca_port_init()
2080 maxval = state->ts_devlim.max_mtu; in tavor_hca_port_init()
2088 maxval = state->ts_devlim.max_port_width; in tavor_hca_port_init()
2096 maxval = state->ts_devlim.max_vl; in tavor_hca_port_init()
2104 maxval = ((uint64_t)1 << state->ts_devlim.log_max_gid); in tavor_hca_port_init()
2112 maxval = ((uint64_t)1 << state->ts_devlim.log_max_pkey); in tavor_hca_port_init()
2124 status = tavor_init_ib_cmd_post(state, initib, i + 1, in tavor_hca_port_init()
2143 (void) tavor_hca_ports_shutdown(state, i); in tavor_hca_port_init()
2154 tavor_hca_ports_shutdown(tavor_state_t *state, uint_t num_init) in tavor_hca_ports_shutdown() argument
2166 status = tavor_close_ib_cmd_post(state, i + 1, in tavor_hca_ports_shutdown()
2169 TAVOR_WARNING(state, "failed to shutdown HCA port"); in tavor_hca_ports_shutdown()
2183 tavor_internal_uarpgs_init(tavor_state_t *state) in tavor_internal_uarpgs_init() argument
2191 status = tavor_rsrc_alloc(state, TAVOR_UARPG, 1, TAVOR_SLEEP, in tavor_internal_uarpgs_init()
2192 &state->ts_uarpg0_rsrc_rsrvd); in tavor_internal_uarpgs_init()
2202 status = tavor_rsrc_alloc(state, TAVOR_UARPG, 1, TAVOR_SLEEP, in tavor_internal_uarpgs_init()
2203 &state->ts_uarpg1_rsrc); in tavor_internal_uarpgs_init()
2205 tavor_rsrc_free(state, &state->ts_uarpg0_rsrc_rsrvd); in tavor_internal_uarpgs_init()
2210 state->ts_uar = (tavor_hw_uar_t *)state->ts_uarpg1_rsrc->tr_addr; in tavor_internal_uarpgs_init()
2221 tavor_internal_uarpgs_fini(tavor_state_t *state) in tavor_internal_uarpgs_fini() argument
2224 tavor_rsrc_free(state, &state->ts_uarpg1_rsrc); in tavor_internal_uarpgs_fini()
2227 tavor_rsrc_free(state, &state->ts_uarpg0_rsrc_rsrvd); in tavor_internal_uarpgs_fini()
2236 tavor_special_qp_contexts_reserve(tavor_state_t *state) in tavor_special_qp_contexts_reserve() argument
2242 mutex_init(&state->ts_spec_qplock, NULL, MUTEX_DRIVER, in tavor_special_qp_contexts_reserve()
2243 DDI_INTR_PRI(state->ts_intrmsi_pri)); in tavor_special_qp_contexts_reserve()
2251 status = tavor_rsrc_alloc(state, TAVOR_QPC, 2, TAVOR_SLEEP, &qp0_rsrc); in tavor_special_qp_contexts_reserve()
2253 mutex_destroy(&state->ts_spec_qplock); in tavor_special_qp_contexts_reserve()
2256 state->ts_spec_qp0 = qp0_rsrc; in tavor_special_qp_contexts_reserve()
2264 status = tavor_rsrc_alloc(state, TAVOR_QPC, 2, TAVOR_SLEEP, &qp1_rsrc); in tavor_special_qp_contexts_reserve()
2266 tavor_rsrc_free(state, &qp0_rsrc); in tavor_special_qp_contexts_reserve()
2267 mutex_destroy(&state->ts_spec_qplock); in tavor_special_qp_contexts_reserve()
2270 state->ts_spec_qp1 = qp1_rsrc; in tavor_special_qp_contexts_reserve()
2281 tavor_special_qp_contexts_unreserve(tavor_state_t *state) in tavor_special_qp_contexts_unreserve() argument
2284 tavor_rsrc_free(state, &state->ts_spec_qp1); in tavor_special_qp_contexts_unreserve()
2287 tavor_rsrc_free(state, &state->ts_spec_qp0); in tavor_special_qp_contexts_unreserve()
2290 mutex_destroy(&state->ts_spec_qplock); in tavor_special_qp_contexts_unreserve()
2299 tavor_sw_reset(tavor_state_t *state) in tavor_sw_reset() argument
2302 ddi_acc_handle_t hdl = state->ts_pci_cfghdl, phdl; in tavor_sw_reset()
2310 reset_delay = state->ts_cfg_profile->cp_sw_reset_delay; in tavor_sw_reset()
2321 dip = state->ts_dip; in tavor_sw_reset()
2325 tavor_pci_capability_list(state, hdl); in tavor_sw_reset()
2335 state->ts_cfg_data[i] = pci_config_get32(hdl, i << 2); in tavor_sw_reset()
2356 state->ts_cfg_pdata[i] = in tavor_sw_reset()
2365 ddi_put32(state->ts_reg_cmdhdl, state->ts_cmd_regs.sw_reset, in tavor_sw_reset()
2394 state->ts_cfg_pdata[i]); in tavor_sw_reset()
2425 pci_config_put32(hdl, i << 2, state->ts_cfg_data[i]); in tavor_sw_reset()
2438 tavor_mcg_init(tavor_state_t *state) in tavor_mcg_init() argument
2446 mcg_tmp_sz = TAVOR_MCGMEM_SZ(state); in tavor_mcg_init()
2447 state->ts_mcgtmp = kmem_zalloc(mcg_tmp_sz, KM_SLEEP); in tavor_mcg_init()
2454 mutex_init(&state->ts_mcglock, NULL, MUTEX_DRIVER, in tavor_mcg_init()
2455 DDI_INTR_PRI(state->ts_intrmsi_pri)); in tavor_mcg_init()
2466 tavor_mcg_fini(tavor_state_t *state) in tavor_mcg_fini() argument
2471 mcg_tmp_sz = TAVOR_MCGMEM_SZ(state); in tavor_mcg_fini()
2472 kmem_free(state->ts_mcgtmp, mcg_tmp_sz); in tavor_mcg_fini()
2475 mutex_destroy(&state->ts_mcglock); in tavor_mcg_fini()
2484 tavor_fw_version_check(tavor_state_t *state) in tavor_fw_version_check() argument
2496 switch (state->ts_operational_mode) { in tavor_fw_version_check()
2518 if (state->ts_fw.fw_rev_major < tavor_fw_ver_major) { in tavor_fw_version_check()
2520 } else if (state->ts_fw.fw_rev_major > tavor_fw_ver_major) { in tavor_fw_version_check()
2527 if (state->ts_fw.fw_rev_minor < tavor_fw_ver_minor) { in tavor_fw_version_check()
2529 } else if (state->ts_fw.fw_rev_minor > tavor_fw_ver_minor) { in tavor_fw_version_check()
2538 if (state->ts_fw.fw_rev_subminor < tavor_fw_ver_subminor) { in tavor_fw_version_check()
2540 } else if (state->ts_fw.fw_rev_subminor > tavor_fw_ver_subminor) { in tavor_fw_version_check()
2553 tavor_device_info_report(tavor_state_t *state) in tavor_device_info_report() argument
2556 "HW rev: %02x\n", state->ts_instance, state->ts_fw.fw_rev_major, in tavor_device_info_report()
2557 state->ts_fw.fw_rev_minor, state->ts_fw.fw_rev_subminor, in tavor_device_info_report()
2558 state->ts_adapter.rev_id); in tavor_device_info_report()
2560 state->ts_instance, state->ts_nodedesc, state->ts_nodeguid); in tavor_device_info_report()
2569 tavor_pci_capability_list(tavor_state_t *state, ddi_acc_handle_t hdl) in tavor_pci_capability_list() argument
2604 tavor_pci_capability_vpd(state, hdl, offset); in tavor_pci_capability_list()
2607 tavor_pci_capability_pcix(state, hdl, offset); in tavor_pci_capability_list()
2660 tavor_pci_capability_vpd(tavor_state_t *state, ddi_acc_handle_t hdl, in tavor_pci_capability_vpd() argument
2708 if (name_length > sizeof (state->ts_hca_name)) { in tavor_pci_capability_vpd()
2713 (void) memcpy(state->ts_hca_name, &vpd.vpd_char[vpd_str_id + 3], in tavor_pci_capability_vpd()
2715 state->ts_hca_name[name_length] = 0; in tavor_pci_capability_vpd()
2731 if (pn_length > sizeof (state->ts_hca_pn)) { in tavor_pci_capability_vpd()
2736 (void) memcpy(state->ts_hca_pn, in tavor_pci_capability_vpd()
2739 state->ts_hca_pn[pn_length] = 0; in tavor_pci_capability_vpd()
2740 state->ts_hca_pn_len = pn_length; in tavor_pci_capability_vpd()
2749 state->ts_hca_pn_len = 0; in tavor_pci_capability_vpd()
2757 tavor_pci_capability_pcix(tavor_state_t *state, ddi_acc_handle_t hdl, in tavor_pci_capability_pcix() argument
2779 max_out_splt_trans = ddi_prop_get_int(DDI_DEV_T_ANY, state->ts_dip, in tavor_pci_capability_pcix()
2786 " (%d), using default value (%d)\n", state->ts_instance, in tavor_pci_capability_pcix()
2788 state->ts_cfg_profile->cp_max_out_splt_trans); in tavor_pci_capability_pcix()
2790 state->ts_cfg_profile->cp_max_out_splt_trans; in tavor_pci_capability_pcix()
2793 state->ts_cfg_profile->cp_max_out_splt_trans; in tavor_pci_capability_pcix()
2817 max_mem_rd_byte_cnt = ddi_prop_get_int(DDI_DEV_T_ANY, state->ts_dip, in tavor_pci_capability_pcix()
2824 " (%d), using default value (%d)\n", state->ts_instance, in tavor_pci_capability_pcix()
2826 state->ts_cfg_profile->cp_max_mem_rd_byte_cnt); in tavor_pci_capability_pcix()
2828 state->ts_cfg_profile->cp_max_mem_rd_byte_cnt; in tavor_pci_capability_pcix()
2831 state->ts_cfg_profile->cp_max_mem_rd_byte_cnt; in tavor_pci_capability_pcix()
2860 tavor_intr_or_msi_init(tavor_state_t *state) in tavor_intr_or_msi_init() argument
2865 status = ddi_intr_get_supported_types(state->ts_dip, in tavor_intr_or_msi_init()
2866 &state->ts_intr_types_avail); in tavor_intr_or_msi_init()
2879 if ((state->ts_cfg_profile->cp_use_msi_if_avail != 0) && in tavor_intr_or_msi_init()
2880 (state->ts_intr_types_avail & DDI_INTR_TYPE_MSI)) { in tavor_intr_or_msi_init()
2881 status = tavor_add_intrs(state, DDI_INTR_TYPE_MSI); in tavor_intr_or_msi_init()
2883 state->ts_intr_type_chosen = DDI_INTR_TYPE_MSI; in tavor_intr_or_msi_init()
2892 if (state->ts_intr_types_avail & DDI_INTR_TYPE_FIXED) { in tavor_intr_or_msi_init()
2893 status = tavor_add_intrs(state, DDI_INTR_TYPE_FIXED); in tavor_intr_or_msi_init()
2895 state->ts_intr_type_chosen = DDI_INTR_TYPE_FIXED; in tavor_intr_or_msi_init()
2911 tavor_add_intrs(tavor_state_t *state, int intr_type) in tavor_add_intrs() argument
2916 status = ddi_intr_get_nintrs(state->ts_dip, intr_type, in tavor_add_intrs()
2917 &state->ts_intrmsi_count); in tavor_add_intrs()
2923 status = ddi_intr_get_navail(state->ts_dip, intr_type, in tavor_add_intrs()
2924 &state->ts_intrmsi_avail); in tavor_add_intrs()
2930 if ((state->ts_intrmsi_avail < 1) || (state->ts_intrmsi_count < 1)) { in tavor_add_intrs()
2935 status = ddi_intr_alloc(state->ts_dip, &state->ts_intrmsi_hdl, in tavor_add_intrs()
2936 intr_type, 0, 1, &state->ts_intrmsi_allocd, in tavor_add_intrs()
2943 if (state->ts_intrmsi_allocd < 1) { in tavor_add_intrs()
2951 status = ddi_intr_get_pri(state->ts_intrmsi_hdl, in tavor_add_intrs()
2952 &state->ts_intrmsi_pri); in tavor_add_intrs()
2955 (void) ddi_intr_free(state->ts_intrmsi_hdl); in tavor_add_intrs()
2961 if (state->ts_intrmsi_pri >= ddi_intr_get_hilevel_pri()) { in tavor_add_intrs()
2963 (void) ddi_intr_free(state->ts_intrmsi_hdl); in tavor_add_intrs()
2969 status = ddi_intr_get_cap(state->ts_intrmsi_hdl, in tavor_add_intrs()
2970 &state->ts_intrmsi_cap); in tavor_add_intrs()
2973 (void) ddi_intr_free(state->ts_intrmsi_hdl); in tavor_add_intrs()
2987 tavor_intr_or_msi_fini(tavor_state_t *state) in tavor_intr_or_msi_fini() argument
2992 status = ddi_intr_free(state->ts_intrmsi_hdl); in tavor_intr_or_msi_fini()
3003 tavor_intr_disable(tavor_state_t *state) in tavor_intr_disable() argument
3006 ddi_acc_handle_t pci_cfg_hdl = state->ts_pci_cfghdl; in tavor_intr_disable()
3008 ASSERT(state->ts_intr_types_avail & in tavor_intr_disable()
3016 if ((state->ts_cfg_profile->cp_use_msi_if_avail != 0) && in tavor_intr_disable()
3017 (state->ts_intr_types_avail & DDI_INTR_TYPE_MSI)) { in tavor_intr_disable()
3045 ASSERT(state->ts_intr_types_avail & DDI_INTR_TYPE_FIXED); in tavor_intr_disable()
3059 tavor_state_t *state = ddi_get_soft_state(tavor_statep, in tavor_quiesce() local
3061 ASSERT(state != NULL); in tavor_quiesce()
3064 state->ts_quiescing = B_TRUE; in tavor_quiesce()
3067 if (!TAVOR_IS_OPERATIONAL(state->ts_operational_mode)) { in tavor_quiesce()
3072 if (tavor_hca_ports_shutdown(state, in tavor_quiesce()
3073 state->ts_cfg_profile->cp_num_ports) != TAVOR_CMD_SUCCESS) { in tavor_quiesce()
3074 state->ts_quiescing = B_FALSE; in tavor_quiesce()
3079 if (tavor_close_hca_cmd_post(state, TAVOR_CMD_NOSLEEP_SPIN) != in tavor_quiesce()
3081 state->ts_quiescing = B_FALSE; in tavor_quiesce()
3086 if (tavor_sys_dis_cmd_post(state, TAVOR_CMD_NOSLEEP_SPIN) != in tavor_quiesce()
3088 state->ts_quiescing = B_FALSE; in tavor_quiesce()
3093 if (tavor_intr_disable(state) != DDI_SUCCESS) { in tavor_quiesce()
3094 state->ts_quiescing = B_FALSE; in tavor_quiesce()
3099 if (tavor_sw_reset(state) != DDI_SUCCESS) { in tavor_quiesce()
3100 state->ts_quiescing = B_FALSE; in tavor_quiesce()