Lines Matching refs:state

46 static void hermon_eq_poll(hermon_state_t *state, hermon_eqhdl_t eq);
47 static void hermon_eq_catastrophic(hermon_state_t *state);
48 static int hermon_eq_alloc(hermon_state_t *state, uint32_t log_eq_size,
50 static int hermon_eq_free(hermon_state_t *state, hermon_eqhdl_t *eqhdl);
51 static int hermon_eq_handler_init(hermon_state_t *state, hermon_eqhdl_t eq,
52 uint_t evt_type_mask, int (*eqfunc)(hermon_state_t *state,
54 static int hermon_eq_handler_fini(hermon_state_t *state, hermon_eqhdl_t eq);
55 static int hermon_port_state_change_handler(hermon_state_t *state,
57 static int hermon_comm_estbl_handler(hermon_state_t *state,
59 static int hermon_local_wq_cat_err_handler(hermon_state_t *state,
61 static int hermon_invreq_local_wq_err_handler(hermon_state_t *state,
63 static int hermon_local_acc_vio_wq_err_handler(hermon_state_t *state,
65 static int hermon_sendq_drained_handler(hermon_state_t *state,
67 static int hermon_path_mig_handler(hermon_state_t *state,
69 static int hermon_path_mig_err_handler(hermon_state_t *state,
71 static int hermon_catastrophic_handler(hermon_state_t *state,
73 static int hermon_srq_last_wqe_reached_handler(hermon_state_t *state,
75 static int hermon_fexch_error_handler(hermon_state_t *state,
77 static int hermon_no_eqhandler(hermon_state_t *state, hermon_eqhdl_t eq,
79 static int hermon_eq_demux(hermon_state_t *state, hermon_eqhdl_t eq,
87 hermon_eq_init_all(hermon_state_t *state) in hermon_eq_init_all() argument
94 ddi_acc_handle_t uarhdl = hermon_get_uarhdl(state); in hermon_eq_init_all()
105 log_eq_size = state->hs_cfg_profile->cp_log_eq_sz; in hermon_eq_init_all()
120 num_eq_rsvd = state->hs_rsvd_eqs; in hermon_eq_init_all()
121 eq = &state->hs_eqhdl[num_eq_rsvd]; in hermon_eq_init_all()
128 if (state->hs_intr_type_chosen == DDI_INTR_TYPE_FIXED) { in hermon_eq_init_all()
129 intr_num = state->hs_adapter.inta_pin; in hermon_eq_init_all()
133 for (i = 0; i + 1 < state->hs_intrmsi_allocd; i++) { in hermon_eq_init_all()
134 status = hermon_eq_alloc(state, log_eq_size, i, &eq[i]); in hermon_eq_init_all()
137 (void) hermon_eq_handler_fini(state, in hermon_eq_init_all()
139 (void) hermon_eq_free(state, &eq[i]); in hermon_eq_init_all()
144 (void) hermon_eq_handler_init(state, eq[i], in hermon_eq_init_all()
157 status = hermon_eq_alloc(state, log_eq_size, intr_num, in hermon_eq_init_all()
178 (void) hermon_eq_handler_init(state, eq[num_eq_unmap + num_extra], in hermon_eq_init_all()
192 status = hermon_eq_handler_init(state, eq[num_eq_unmap + num_extra], in hermon_eq_init_all()
197 state->hs_cq_erreqnum = num_eq_unmap + num_extra + num_eq_rsvd; in hermon_eq_init_all()
258 status = hermon_eq_handler_init(state, eq[num_eq_unmap + num_extra], in hermon_eq_init_all()
274 status = hermon_eq_handler_init(state, eq[num_eq_unmap + num_extra], in hermon_eq_init_all()
282 hermon_pio_start(state, uarhdl, all_eq_init_fail, fm_loop_cnt, in hermon_eq_init_all()
293 hermon_pio_end(state, uarhdl, all_eq_init_fail, fm_loop_cnt, in hermon_eq_init_all()
302 (void) hermon_eq_handler_fini(state, eq[i]); in hermon_eq_init_all()
307 (void) hermon_eq_free(state, &eq[i]); in hermon_eq_init_all()
312 hermon_fm_ereport(state, HCA_SYS_ERR, HCA_ERR_NON_FATAL); in hermon_eq_init_all()
325 hermon_eq_fini_all(hermon_state_t *state) in hermon_eq_fini_all() argument
336 num_eq = HERMON_NUM_EQ_USED + state->hs_intrmsi_allocd - 1; in hermon_eq_fini_all()
337 num_eq_rsvd = state->hs_rsvd_eqs; in hermon_eq_fini_all()
338 eq = &state->hs_eqhdl[num_eq_rsvd]; in hermon_eq_fini_all()
345 status = hermon_eq_handler_fini(state, eq[i]); in hermon_eq_fini_all()
356 status = hermon_eq_free(state, &eq[i]); in hermon_eq_fini_all()
371 hermon_eq_reset_uar_baseaddr(hermon_state_t *state) in hermon_eq_reset_uar_baseaddr() argument
376 num_eq = HERMON_NUM_EQ_USED + state->hs_intrmsi_allocd - 1; in hermon_eq_reset_uar_baseaddr()
377 eqh = &state->hs_eqhdl[state->hs_rsvd_eqs]; in hermon_eq_reset_uar_baseaddr()
381 ((uintptr_t)state->hs_reg_uar_baseaddr + in hermon_eq_reset_uar_baseaddr()
392 hermon_eq_arm_all(hermon_state_t *state) in hermon_eq_arm_all() argument
399 ddi_acc_handle_t uarhdl = hermon_get_uarhdl(state); in hermon_eq_arm_all()
404 num_eq = HERMON_NUM_EQ_USED + state->hs_intrmsi_allocd - 1; in hermon_eq_arm_all()
405 num_eq_rsvd = state->hs_rsvd_eqs; in hermon_eq_arm_all()
408 hermon_pio_start(state, uarhdl, pio_error, fm_loop_cnt, fm_status, in hermon_eq_arm_all()
413 eq = state->hs_eqhdl[i + num_eq_rsvd]; in hermon_eq_arm_all()
416 (uint32_t *)((uintptr_t)state->hs_reg_uar_baseaddr + in hermon_eq_arm_all()
421 hermon_pio_end(state, uarhdl, pio_error, fm_loop_cnt, fm_status, in hermon_eq_arm_all()
427 hermon_fm_ereport(state, HCA_SYS_ERR, HCA_ERR_NON_FATAL); in hermon_eq_arm_all()
439 hermon_state_t *state; in hermon_isr() local
446 state = (hermon_state_t *)(void *)arg1; in hermon_isr()
456 if (state->hs_intr_type_chosen == DDI_INTR_TYPE_FIXED) { in hermon_isr()
457 ddi_acc_handle_t cmdhdl = hermon_get_cmdhdl(state); in hermon_isr()
463 hermon_pio_start(state, cmdhdl, pio_error, fm_loop_cnt, in hermon_isr()
466 ddi_put64(cmdhdl, state->hs_cmd_regs.clr_intr, in hermon_isr()
467 (uint64_t)1 << state->hs_adapter.inta_pin); in hermon_isr()
470 hermon_pio_end(state, cmdhdl, pio_error, fm_loop_cnt, fm_status, in hermon_isr()
485 r = state->hs_rsvd_eqs; in hermon_isr()
487 if (intr + 1 == state->hs_intrmsi_allocd) { /* last intr */ in hermon_isr()
488 r += state->hs_intrmsi_allocd - 1; in hermon_isr()
490 hermon_eq_poll(state, state->hs_eqhdl[i + r]); in hermon_isr()
493 hermon_eq_poll(state, state->hs_eqhdl[intr + r]); in hermon_isr()
499 hermon_fm_ereport(state, HCA_SYS_ERR, HCA_ERR_FATAL); in hermon_isr()
509 hermon_eq_poll(hermon_state_t *state, hermon_eqhdl_t eq) in hermon_eq_poll() argument
514 int (*eqfunction)(hermon_state_t *state, hermon_eqhdl_t eq, in hermon_eq_poll()
516 ddi_acc_handle_t uarhdl = hermon_get_uarhdl(state); in hermon_eq_poll()
567 eqfunction(state, eq, eqe); in hermon_eq_poll()
589 hermon_pio_start(state, uarhdl, pio_error, fm_loop_cnt, in hermon_eq_poll()
596 hermon_pio_end(state, uarhdl, pio_error, fm_loop_cnt, in hermon_eq_poll()
605 hermon_fm_ereport(state, HCA_SYS_ERR, HCA_ERR_FATAL); in hermon_eq_poll()
614 hermon_eq_catastrophic(hermon_state_t *state) in hermon_eq_catastrophic() argument
616 ddi_acc_handle_t cmdhdl = hermon_get_cmdhdl(state); in hermon_eq_catastrophic()
630 base_addr = state->hs_cmd_regs.fw_err_buf; in hermon_eq_catastrophic()
632 buf_size = state->hs_fw.error_buf_sz; /* in #dwords */ in hermon_eq_catastrophic()
635 hermon_pio_start(state, cmdhdl, pio_error, fm_loop_cnt, fm_status, in hermon_eq_catastrophic()
641 hermon_pio_end(state, cmdhdl, pio_error, fm_loop_cnt, fm_status, in hermon_eq_catastrophic()
681 hermon_pio_start(state, cmdhdl, pio_error, fm_loop_cnt, fm_status, in hermon_eq_catastrophic()
689 (state->hs_cmd_regs.fw_err_buf + i); in hermon_eq_catastrophic()
692 state->hs_instance, i, err_buf); in hermon_eq_catastrophic()
696 hermon_pio_end(state, cmdhdl, pio_error, fm_loop_cnt, fm_status, in hermon_eq_catastrophic()
710 if (state->hs_ibtfpriv != NULL) { in hermon_eq_catastrophic()
711 HERMON_DO_IBTF_ASYNC_CALLB(state, type, &event); in hermon_eq_catastrophic()
716 hermon_fm_ereport(state, HCA_SYS_ERR, HCA_ERR_NON_FATAL); in hermon_eq_catastrophic()
725 hermon_eq_alloc(hermon_state_t *state, uint32_t log_eq_size, uint_t intr, in hermon_eq_alloc() argument
739 pd = state->hs_pdhdl_internal; in hermon_eq_alloc()
751 status = hermon_rsrc_alloc(state, HERMON_EQC, 1, HERMON_SLEEP, &eqc); in hermon_eq_alloc()
763 status = hermon_rsrc_alloc(state, HERMON_EQHDL, 1, HERMON_SLEEP, &rsrc); in hermon_eq_alloc()
778 status = hermon_queue_alloc(state, &eq->eq_eqinfo, HERMON_SLEEP); in hermon_eq_alloc()
804 op.mro_bind_type = state->hs_cfg_profile->cp_iommu_bypass; in hermon_eq_alloc()
807 status = hermon_mr_register(state, pd, &mr_attr, &mr, &op, in hermon_eq_alloc()
824 eqc_entry.state = HERMON_EQ_ARMED; in hermon_eq_alloc()
841 status = hermon_cmn_ownership_cmd_post(state, SW2HW_EQ, &eqc_entry, in hermon_eq_alloc()
845 state->hs_instance, status); in hermon_eq_alloc()
847 hermon_fm_ereport(state, HCA_SYS_ERR, HCA_ERR_SRV_LOST); in hermon_eq_alloc()
866 eq->eq_doorbell = (uint32_t *)((uintptr_t)state->hs_reg_uar_baseaddr + in hermon_eq_alloc()
876 if (hermon_mr_deregister(state, &mr, HERMON_MR_DEREG_ALL, in hermon_eq_alloc()
878 HERMON_WARNING(state, "failed to deregister EQ memory"); in hermon_eq_alloc()
883 hermon_rsrc_free(state, &rsrc); in hermon_eq_alloc()
885 hermon_rsrc_free(state, &eqc); in hermon_eq_alloc()
898 hermon_eq_free(hermon_state_t *state, hermon_eqhdl_t *eqhdl) in hermon_eq_free() argument
916 pd = state->hs_pdhdl_internal; in hermon_eq_free()
926 status = hermon_cmn_ownership_cmd_post(state, HW2SW_EQ, &eqc_entry, in hermon_eq_free()
929 HERMON_WARNING(state, "failed to reclaim EQC ownership"); in hermon_eq_free()
941 status = hermon_mr_deregister(state, &mr, HERMON_MR_DEREG_ALL, in hermon_eq_free()
944 HERMON_WARNING(state, "failed to deregister EQ memory"); in hermon_eq_free()
951 hermon_rsrc_free(state, &rsrc); in hermon_eq_free()
954 hermon_rsrc_free(state, &eqc); in hermon_eq_free()
971 hermon_eq_handler_init(hermon_state_t *state, hermon_eqhdl_t eq, in hermon_eq_handler_init() argument
972 uint_t evt_type_mask, int (*eq_func)(hermon_state_t *state, in hermon_eq_handler_init() argument
995 status = hermon_map_eq_cmd_post(state, in hermon_eq_handler_init()
1000 "%08x\n", state->hs_instance, status); in hermon_eq_handler_init()
1014 hermon_eq_handler_fini(hermon_state_t *state, hermon_eqhdl_t eq) in hermon_eq_handler_fini() argument
1031 status = hermon_map_eq_cmd_post(state, in hermon_eq_handler_fini()
1036 "%08x\n", state->hs_instance, status); in hermon_eq_handler_fini()
1051 hermon_eq_demux(hermon_state_t *state, hermon_eqhdl_t eq, in hermon_eq_demux() argument
1062 status = hermon_port_state_change_handler(state, eq, eqe); in hermon_eq_demux()
1066 status = hermon_comm_estbl_handler(state, eq, eqe); in hermon_eq_demux()
1070 status = hermon_cmd_complete_handler(state, eq, eqe); in hermon_eq_demux()
1074 HERMON_WARNING(state, HERMON_FMA_LOCCAT); in hermon_eq_demux()
1075 status = hermon_local_wq_cat_err_handler(state, eq, eqe); in hermon_eq_demux()
1079 HERMON_WARNING(state, HERMON_FMA_LOCINV); in hermon_eq_demux()
1080 status = hermon_invreq_local_wq_err_handler(state, eq, eqe); in hermon_eq_demux()
1084 HERMON_WARNING(state, HERMON_FMA_LOCACEQ); in hermon_eq_demux()
1086 status = hermon_local_acc_vio_wq_err_handler(state, eq, eqe); in hermon_eq_demux()
1089 status = hermon_sendq_drained_handler(state, eq, eqe); in hermon_eq_demux()
1093 status = hermon_path_mig_handler(state, eq, eqe); in hermon_eq_demux()
1097 HERMON_WARNING(state, HERMON_FMA_PATHMIG); in hermon_eq_demux()
1098 status = hermon_path_mig_err_handler(state, eq, eqe); in hermon_eq_demux()
1102 HERMON_WARNING(state, HERMON_FMA_SRQCAT); in hermon_eq_demux()
1103 status = hermon_catastrophic_handler(state, eq, eqe); in hermon_eq_demux()
1107 status = hermon_srq_last_wqe_reached_handler(state, eq, eqe); in hermon_eq_demux()
1111 status = hermon_fexch_error_handler(state, eq, eqe); in hermon_eq_demux()
1126 hermon_port_state_change_handler(hermon_state_t *state, hermon_eqhdl_t eq, in hermon_port_state_change_handler() argument
1142 if ((port == 0) || (port > state->hs_cfg_profile->cp_num_ports)) { in hermon_port_state_change_handler()
1143 HERMON_WARNING(state, "Unexpected port number in port state " in hermon_port_state_change_handler()
1155 ddi_dev_report_fault(state->hs_dip, DDI_SERVICE_RESTORED, in hermon_port_state_change_handler()
1162 ddi_dev_report_fault(state->hs_dip, DDI_SERVICE_LOST, in hermon_port_state_change_handler()
1165 HERMON_WARNING(state, "Unexpected subtype in port state change " in hermon_port_state_change_handler()
1178 if (state->hs_ibtfpriv != NULL) { in hermon_port_state_change_handler()
1179 HERMON_DO_IBTF_ASYNC_CALLB(state, type, &event); in hermon_port_state_change_handler()
1192 hermon_comm_estbl_handler(hermon_state_t *state, hermon_eqhdl_t eq, in hermon_comm_estbl_handler() argument
1202 qp = hermon_qphdl_from_qpnum(state, qpnum); in hermon_comm_estbl_handler()
1225 (state->hs_ibtfpriv != NULL)) { in hermon_comm_estbl_handler()
1229 HERMON_DO_IBTF_ASYNC_CALLB(state, type, &event); in hermon_comm_estbl_handler()
1242 hermon_local_wq_cat_err_handler(hermon_state_t *state, hermon_eqhdl_t eq, in hermon_local_wq_cat_err_handler() argument
1252 qp = hermon_qphdl_from_qpnum(state, qpnum); in hermon_local_wq_cat_err_handler()
1275 (state->hs_ibtfpriv != NULL)) { in hermon_local_wq_cat_err_handler()
1279 HERMON_DO_IBTF_ASYNC_CALLB(state, type, &event); in hermon_local_wq_cat_err_handler()
1292 hermon_invreq_local_wq_err_handler(hermon_state_t *state, hermon_eqhdl_t eq, in hermon_invreq_local_wq_err_handler() argument
1302 qp = hermon_qphdl_from_qpnum(state, qpnum); in hermon_invreq_local_wq_err_handler()
1325 (state->hs_ibtfpriv != NULL)) { in hermon_invreq_local_wq_err_handler()
1329 HERMON_DO_IBTF_ASYNC_CALLB(state, type, &event); in hermon_invreq_local_wq_err_handler()
1342 hermon_local_acc_vio_wq_err_handler(hermon_state_t *state, hermon_eqhdl_t eq, in hermon_local_acc_vio_wq_err_handler() argument
1352 qp = hermon_qphdl_from_qpnum(state, qpnum); in hermon_local_acc_vio_wq_err_handler()
1375 (state->hs_ibtfpriv != NULL)) { in hermon_local_acc_vio_wq_err_handler()
1379 HERMON_DO_IBTF_ASYNC_CALLB(state, type, &event); in hermon_local_acc_vio_wq_err_handler()
1392 hermon_sendq_drained_handler(hermon_state_t *state, hermon_eqhdl_t eq, in hermon_sendq_drained_handler() argument
1403 qp = hermon_qphdl_from_qpnum(state, qpnum); in hermon_sendq_drained_handler()
1426 (state->hs_ibtfpriv != NULL)) { in hermon_sendq_drained_handler()
1444 HERMON_DO_IBTF_ASYNC_CALLB(state, type, &event); in hermon_sendq_drained_handler()
1458 hermon_path_mig_handler(hermon_state_t *state, hermon_eqhdl_t eq, in hermon_path_mig_handler() argument
1468 qp = hermon_qphdl_from_qpnum(state, qpnum); in hermon_path_mig_handler()
1491 (state->hs_ibtfpriv != NULL)) { in hermon_path_mig_handler()
1495 HERMON_DO_IBTF_ASYNC_CALLB(state, type, &event); in hermon_path_mig_handler()
1508 hermon_path_mig_err_handler(hermon_state_t *state, hermon_eqhdl_t eq, in hermon_path_mig_err_handler() argument
1518 qp = hermon_qphdl_from_qpnum(state, qpnum); in hermon_path_mig_err_handler()
1541 (state->hs_ibtfpriv != NULL)) { in hermon_path_mig_err_handler()
1545 HERMON_DO_IBTF_ASYNC_CALLB(state, type, &event); in hermon_path_mig_err_handler()
1558 hermon_catastrophic_handler(hermon_state_t *state, hermon_eqhdl_t eq, in hermon_catastrophic_handler() argument
1567 HERMON_FMANOTE(state, HERMON_FMA_INTERNAL); in hermon_catastrophic_handler()
1568 hermon_eq_catastrophic(state); in hermon_catastrophic_handler()
1574 qp = hermon_qphdl_from_qpnum(state, qpnum); in hermon_catastrophic_handler()
1597 (state->hs_ibtfpriv != NULL)) { in hermon_catastrophic_handler()
1605 HERMON_DO_IBTF_ASYNC_CALLB(state, type, &event); in hermon_catastrophic_handler()
1618 hermon_srq_last_wqe_reached_handler(hermon_state_t *state, hermon_eqhdl_t eq, in hermon_srq_last_wqe_reached_handler() argument
1628 qp = hermon_qphdl_from_qpnum(state, qpnum); in hermon_srq_last_wqe_reached_handler()
1651 (state->hs_ibtfpriv != NULL)) { in hermon_srq_last_wqe_reached_handler()
1655 HERMON_DO_IBTF_ASYNC_CALLB(state, type, &event); in hermon_srq_last_wqe_reached_handler()
1663 static int hermon_fexch_error_handler(hermon_state_t *state, in hermon_fexch_error_handler() argument
1673 qpnum = hermon_fcoib_qpnum_from_fexch(state, in hermon_fexch_error_handler()
1675 qp = hermon_qphdl_from_qpnum(state, qpnum); in hermon_fexch_error_handler()
1700 (state->hs_ibtfpriv != NULL)) { in hermon_fexch_error_handler()
1704 HERMON_DO_IBTF_ASYNC_CALLB(state, type, &event); in hermon_fexch_error_handler()
1717 hermon_no_eqhandler(hermon_state_t *state, hermon_eqhdl_t eq, in hermon_no_eqhandler() argument
1732 HERMON_WARNING(state, "Unexpected Event handler"); in hermon_no_eqhandler()