Lines Matching refs:state

47 static void tavor_eq_poll(tavor_state_t *state, tavor_eqhdl_t eq);
48 static void tavor_eq_catastrophic(tavor_state_t *state);
49 static int tavor_eq_alloc(tavor_state_t *state, uint32_t log_eq_size,
51 static int tavor_eq_free(tavor_state_t *state, tavor_eqhdl_t *eqhdl);
52 static int tavor_eq_handler_init(tavor_state_t *state, tavor_eqhdl_t eq,
53 uint_t evt_type_mask, int (*eqfunc)(tavor_state_t *state,
55 static int tavor_eq_handler_fini(tavor_state_t *state, tavor_eqhdl_t eq);
58 static int tavor_port_state_change_handler(tavor_state_t *state,
60 static int tavor_comm_estbl_handler(tavor_state_t *state,
62 static int tavor_local_wq_cat_err_handler(tavor_state_t *state,
64 static int tavor_invreq_local_wq_err_handler(tavor_state_t *state,
66 static int tavor_local_acc_vio_wq_err_handler(tavor_state_t *state,
68 static int tavor_sendq_drained_handler(tavor_state_t *state,
70 static int tavor_path_mig_handler(tavor_state_t *state,
72 static int tavor_path_mig_err_handler(tavor_state_t *state,
74 static int tavor_srq_catastrophic_handler(tavor_state_t *state,
76 static int tavor_srq_last_wqe_reached_handler(tavor_state_t *state,
78 static int tavor_ecc_detection_handler(tavor_state_t *state,
80 static int tavor_no_eqhandler(tavor_state_t *state, tavor_eqhdl_t eq,
89 tavor_eq_init_all(tavor_state_t *state)
104 log_eq_size = state->ts_cfg_profile->cp_log_default_eq_sz;
112 if (state->ts_intr_type_chosen == DDI_INTR_TYPE_MSI) {
115 intr_num = state->ts_adapter.inta_pin;
140 status = tavor_eq_alloc(state, log_eq_size, intr_num,
141 &state->ts_eqhdl[i]);
158 (void) tavor_eq_handler_init(state, state->ts_eqhdl[i],
172 status = tavor_eq_handler_init(state, state->ts_eqhdl[32],
190 status = tavor_eq_handler_init(state, state->ts_eqhdl[33],
194 TAVOR_TNF_FAIL(status, "port state change event");
208 status = tavor_eq_handler_init(state, state->ts_eqhdl[34],
228 status = tavor_eq_handler_init(state, state->ts_eqhdl[35],
246 status = tavor_eq_handler_init(state, state->ts_eqhdl[36],
264 status = tavor_eq_handler_init(state, state->ts_eqhdl[37],
283 status = tavor_eq_handler_init(state, state->ts_eqhdl[38],
298 * state transition. If this setup fails for any reason (which, in
303 status = tavor_eq_handler_init(state, state->ts_eqhdl[39],
322 status = tavor_eq_handler_init(state, state->ts_eqhdl[40],
341 status = tavor_eq_handler_init(state, state->ts_eqhdl[41],
365 status = tavor_eq_handler_init(state, state->ts_eqhdl[42],
383 status = tavor_eq_handler_init(state, state->ts_eqhdl[43],
402 status = tavor_eq_handler_init(state, state->ts_eqhdl[44],
421 status = tavor_eq_handler_init(state, state->ts_eqhdl[45],
440 status = tavor_eq_handler_init(state, state->ts_eqhdl[46],
456 (void) tavor_eq_handler_fini(state, state->ts_eqhdl[i]);
461 (void) tavor_eq_free(state, &state->ts_eqhdl[i]);
475 tavor_eq_fini_all(tavor_state_t *state)
494 status = tavor_eq_handler_fini(state, state->ts_eqhdl[i]);
508 status = tavor_eq_free(state, &state->ts_eqhdl[i]);
527 tavor_eq_arm_all(tavor_state_t *state)
546 tavor_eq_doorbell(state, TAVOR_EQDB_REARM_EQ, i, 0);
561 tavor_state_t *state;
572 state = (tavor_state_t *)arg1;
577 ecr = state->ts_cmd_regs.ecr;
578 clr_int = state->ts_cmd_regs.clr_int;
585 ecrreg = ddi_get64(state->ts_reg_cmdhdl, ecr);
589 * EQs in the "fired" state), call tavor_eq_poll() to process each
597 tavor_eq_poll(state, state->ts_eqhdl[i]);
611 if (state->ts_intr_type_chosen == DDI_INTR_TYPE_MSI) {
614 int_mask = ((uint64_t)1 << state->ts_adapter.inta_pin);
616 ddi_put64(state->ts_reg_cmdhdl, clr_int, int_mask);
619 ecrreg = ddi_get64(state->ts_reg_cmdhdl, ecr);
633 tavor_eq_doorbell(tavor_state_t *state, uint32_t eq_cmd, uint32_t eqn,
646 TAVOR_UAR_DOORBELL(state, (uint64_t *)&state->ts_uar->eq,
655 tavor_eq_poll(tavor_state_t *state, tavor_eqhdl_t eq)
661 int (*eqfunction)(tavor_state_t *state, tavor_eqhdl_t eq,
669 clr_ecr = state->ts_cmd_regs.clr_ecr;
681 tavor_eq_catastrophic(state);
688 ddi_put64(state->ts_reg_cmdhdl, clr_ecr, ecr_mask);
749 eqfunction(state, eq, eqe);
775 ddi_put64(state->ts_reg_cmdhdl, clr_ecr, ecr_mask);
779 tavor_eq_doorbell(state, TAVOR_EQDB_SET_CONSINDX, eq->eq_eqnum,
783 tavor_eq_doorbell(state, TAVOR_EQDB_REARM_EQ, eq->eq_eqnum, 0);
788 * has been flushed to the hardware. There is state encoded in
810 tavor_eq_catastrophic(tavor_state_t *state)
826 (uintptr_t)state->ts_reg_cmd_baseaddr +
827 state->ts_fw.error_buf_addr);
828 buf_size = state->ts_fw.error_buf_sz;
830 word = ddi_get32(state->ts_reg_cmdhdl, base_addr);
873 base_addr = (uint32_t *)((uintptr_t)(state->ts_reg_cmd_baseaddr
874 + state->ts_fw.error_buf_addr + (i * 4)));
875 err_buf = ddi_get32(state->ts_reg_cmdhdl, base_addr);
890 if (state->ts_ibtfpriv != NULL) {
891 TAVOR_DO_IBTF_ASYNC_CALLB(state, type, &event);
903 tavor_eq_alloc(tavor_state_t *state, uint32_t log_eq_size, uint_t intr,
923 pd = state->ts_pdhdl_internal;
935 status = tavor_rsrc_alloc(state, TAVOR_EQC, 1, TAVOR_SLEEP, &eqc);
948 status = tavor_rsrc_alloc(state, TAVOR_EQHDL, 1, TAVOR_SLEEP, &rsrc);
971 status = tavor_queue_alloc(state, &eq->eq_eqinfo, TAVOR_SLEEP);
1002 dma_xfer_mode = state->ts_cfg_profile->cp_streaming_consistent;
1006 op.mro_bind_type = state->ts_cfg_profile->cp_iommu_bypass;
1009 status = tavor_mr_register(state, pd, &mr_attr, &mr, &op);
1020 eq->eq_sync = TAVOR_EQ_IS_SYNC_REQ(state, eq->eq_eqinfo);
1033 * "fired" state. We will arm them later (after our interrupt
1039 eqc_entry.state = TAVOR_EQ_FIRED;
1055 status = tavor_cmn_ownership_cmd_post(state, SW2HW_EQ, &eqc_entry,
1088 if (tavor_mr_deregister(state, &mr, TAVOR_MR_DEREG_ALL,
1090 TAVOR_WARNING(state, "failed to deregister EQ memory");
1093 tavor_queue_free(state, &eq->eq_eqinfo);
1095 tavor_rsrc_free(state, &rsrc);
1097 tavor_rsrc_free(state, &eqc);
1113 tavor_eq_free(tavor_state_t *state, tavor_eqhdl_t *eqhdl)
1133 pd = state->ts_pdhdl_internal;
1143 status = tavor_cmn_ownership_cmd_post(state, HW2SW_EQ, &eqc_entry,
1146 TAVOR_WARNING(state, "failed to reclaim EQC ownership");
1161 status = tavor_mr_deregister(state, &mr, TAVOR_MR_DEREG_ALL,
1164 TAVOR_WARNING(state, "failed to deregister EQ memory");
1170 tavor_queue_free(state, &eq->eq_eqinfo);
1173 tavor_rsrc_free(state, &rsrc);
1176 tavor_rsrc_free(state, &eqc);
1194 tavor_eq_handler_init(tavor_state_t *state, tavor_eqhdl_t eq,
1195 uint_t evt_type_mask, int (*eq_func)(tavor_state_t *state,
1220 status = tavor_map_eq_cmd_post(state,
1243 tavor_eq_handler_fini(tavor_state_t *state, tavor_eqhdl_t eq)
1262 status = tavor_map_eq_cmd_post(state,
1329 tavor_port_state_change_handler(tavor_state_t *state, tavor_eqhdl_t eq,
1348 tavor_eq_overflow_handler(state, eq, eqe);
1361 if ((port == 0) || (port > state->ts_cfg_profile->cp_num_ports)) {
1362 TAVOR_WARNING(state, "Unexpected port number in port state "
1375 ddi_dev_report_fault(state->ts_dip, DDI_SERVICE_RESTORED,
1382 ddi_dev_report_fault(state->ts_dip, DDI_SERVICE_LOST,
1385 TAVOR_WARNING(state, "Unexpected subtype in port state change "
1399 if (state->ts_ibtfpriv != NULL) {
1400 TAVOR_DO_IBTF_ASYNC_CALLB(state, type, &event);
1413 tavor_comm_estbl_handler(tavor_state_t *state, tavor_eqhdl_t eq,
1432 tavor_eq_overflow_handler(state, eq, eqe);
1440 qp = tavor_qphdl_from_qpnum(state, qpnum);
1463 (state->ts_ibtfpriv != NULL)) {
1467 TAVOR_DO_IBTF_ASYNC_CALLB(state, type, &event);
1484 tavor_local_wq_cat_err_handler(tavor_state_t *state, tavor_eqhdl_t eq,
1503 tavor_eq_overflow_handler(state, eq, eqe);
1511 qp = tavor_qphdl_from_qpnum(state, qpnum);
1534 (state->ts_ibtfpriv != NULL)) {
1538 TAVOR_DO_IBTF_ASYNC_CALLB(state, type, &event);
1555 tavor_invreq_local_wq_err_handler(tavor_state_t *state, tavor_eqhdl_t eq,
1574 tavor_eq_overflow_handler(state, eq, eqe);
1582 qp = tavor_qphdl_from_qpnum(state, qpnum);
1605 (state->ts_ibtfpriv != NULL)) {
1609 TAVOR_DO_IBTF_ASYNC_CALLB(state, type, &event);
1626 tavor_local_acc_vio_wq_err_handler(tavor_state_t *state, tavor_eqhdl_t eq,
1645 tavor_eq_overflow_handler(state, eq, eqe);
1653 qp = tavor_qphdl_from_qpnum(state, qpnum);
1676 (state->ts_ibtfpriv != NULL)) {
1680 TAVOR_DO_IBTF_ASYNC_CALLB(state, type, &event);
1697 tavor_sendq_drained_handler(tavor_state_t *state, tavor_eqhdl_t eq,
1717 tavor_eq_overflow_handler(state, eq, eqe);
1725 qp = tavor_qphdl_from_qpnum(state, qpnum);
1748 (state->ts_ibtfpriv != NULL)) {
1753 * Grab the QP lock and update the QP state to reflect that
1766 TAVOR_DO_IBTF_ASYNC_CALLB(state, type, &event);
1784 tavor_path_mig_handler(tavor_state_t *state, tavor_eqhdl_t eq,
1803 tavor_eq_overflow_handler(state, eq, eqe);
1811 qp = tavor_qphdl_from_qpnum(state, qpnum);
1834 (state->ts_ibtfpriv != NULL)) {
1838 TAVOR_DO_IBTF_ASYNC_CALLB(state, type, &event);
1855 tavor_path_mig_err_handler(tavor_state_t *state, tavor_eqhdl_t eq,
1874 tavor_eq_overflow_handler(state, eq, eqe);
1882 qp = tavor_qphdl_from_qpnum(state, qpnum);
1905 (state->ts_ibtfpriv != NULL)) {
1909 TAVOR_DO_IBTF_ASYNC_CALLB(state, type, &event);
1926 tavor_srq_catastrophic_handler(tavor_state_t *state, tavor_eqhdl_t eq,
1945 tavor_eq_overflow_handler(state, eq, eqe);
1953 qp = tavor_qphdl_from_qpnum(state, qpnum);
1976 (state->ts_ibtfpriv != NULL)) {
1984 TAVOR_DO_IBTF_ASYNC_CALLB(state, type, &event);
2001 tavor_srq_last_wqe_reached_handler(tavor_state_t *state, tavor_eqhdl_t eq,
2020 tavor_eq_overflow_handler(state, eq, eqe);
2028 qp = tavor_qphdl_from_qpnum(state, qpnum);
2051 (state->ts_ibtfpriv != NULL)) {
2055 TAVOR_DO_IBTF_ASYNC_CALLB(state, type, &event);
2072 tavor_ecc_detection_handler(tavor_state_t *state, tavor_eqhdl_t eq,
2089 tavor_eq_overflow_handler(state, eq, eqe);
2101 TAVOR_WARNING(state, "ECC Correctable Error Event Detected");
2117 tavor_eq_overflow_handler(tavor_state_t *state, tavor_eqhdl_t eq,
2136 TAVOR_WARNING(state, "Event Queue overflow");
2149 tavor_no_eqhandler(tavor_state_t *state, tavor_eqhdl_t eq,
2166 TAVOR_WARNING(state, "Unexpected Event handler");