Lines Matching refs:socalp

161 static void socal_disable(socal_state_t *socalp);
162 static void socal_init_transport_interface(socal_state_t *socalp);
163 static int socal_cqalloc_init(socal_state_t *socalp, uint32_t index);
164 static void socal_cqinit(socal_state_t *socalp, uint32_t index);
165 static int socal_start(socal_state_t *socalp);
166 static void socal_doreset(socal_state_t *socalp);
168 static int socal_diag_request(socal_state_t *socalp, uint32_t port,
170 static void socal_download_ucode(socal_state_t *socalp);
171 static void socal_init_cq_desc(socal_state_t *socalp);
172 static void socal_init_wwn(socal_state_t *socalp);
173 static void socal_enable(socal_state_t *socalp);
174 static int socal_establish_pool(socal_state_t *socalp, uint32_t poolid);
175 static int socal_add_pool_buffer(socal_state_t *socalp, uint32_t poolid);
176 static int socal_issue_adisc(socal_state_t *socalp, uint32_t port, uint32_t
178 static int socal_issue_lbf(socal_state_t *socalp, uint32_t port,
180 static int socal_issue_rls(socal_state_t *socalp, uint32_t port, uint32_t
189 static int socal_getmap(socal_state_t *socalp, uint32_t port, caddr_t arg,
193 static void socal_fix_harda(socal_state_t *socalp, int port);
473 socal_state_t *socalp; in socal_attach() local
493 if ((socalp = ddi_get_driver_private(dip)) == NULL) in socal_attach()
496 if (!socalp->socal_shutdown) { in socal_attach()
500 if (socal_start(socalp) != FCAL_SUCCESS) { in socal_attach()
552 socalp = ddi_get_soft_state(socal_soft_state_p, instance); in socal_attach()
553 if (socalp == (socal_state_t *)NULL) { in socal_attach()
559 instance, socalp)); in socal_attach()
561 socalp->dip = dip; in socal_attach()
563 porta = &socalp->port_state[0]; in socal_attach()
564 portb = &socalp->port_state[1]; in socal_attach()
568 (void) strcpy(socalp->socal_name, cptr); in socal_attach()
574 porta->sp_board = socalp; in socal_attach()
575 portb->sp_board = socalp; in socal_attach()
608 socalp->socal_n_wwn.w.wwn_hi = s; in socal_attach()
610 (caddr_t)&socalp->socal_n_wwn.w.wwn_lo, in socal_attach()
612 socalp->socal_n_wwn.w.naa_id = NAA_ID_IEEE; in socal_attach()
613 socalp->socal_n_wwn.w.nport_id = 0; in socal_attach()
615 bcopy((caddr_t)wwn, (caddr_t)&socalp->socal_n_wwn, FC_WWN_SIZE); in socal_attach()
622 (void) sprintf(&socalp->socal_stats.node_wwn[i << 1], in socal_attach()
623 "%02x", socalp->socal_n_wwn.raw_wwn[i]); in socal_attach()
626 instance, socalp->socal_stats.node_wwn)); in socal_attach()
628 bcopy((caddr_t)&socalp->socal_n_wwn, (caddr_t)&porta->sp_p_wwn, in socal_attach()
630 bcopy((caddr_t)&socalp->socal_n_wwn, (caddr_t)&portb->sp_p_wwn, in socal_attach()
638 (void) sprintf(&socalp->socal_stats.port_wwn[0][i << 1], in socal_attach()
640 (void) sprintf(&socalp->socal_stats.port_wwn[1][i << 1], in socal_attach()
644 instance, socalp->socal_stats.port_wwn[0])); in socal_attach()
646 instance, socalp->socal_stats.port_wwn[1])); in socal_attach()
650 socal_disp_err(socalp, CE_WARN, "attach.4011", in socal_attach()
657 socal_disp_err(socalp, CE_WARN, "attach.4012", in socal_attach()
671 if (ddi_map_regs(dip, 0, &socalp->socal_xrp, 0, 0) in socal_attach()
673 socalp->socal_xrp = NULL; in socal_attach()
674 socal_disp_err(socalp, CE_WARN, "attach.4020", in socal_attach()
679 socalp->socal_rp = (socal_reg_t *)(socalp->socal_xrp + in socal_attach()
683 if (ddi_map_regs(dip, 0, &socalp->socal_eeprom, 0, 0) != in socal_attach()
685 socalp->socal_eeprom = NULL; in socal_attach()
686 socal_disp_err(socalp, CE_WARN, "attach.4010", in socal_attach()
691 instance, socalp->socal_eeprom)); in socal_attach()
693 if (ddi_map_regs(dip, 1, &socalp->socal_xrp, 0, 0) != in socal_attach()
695 socalp->socal_xrp = NULL; in socal_attach()
696 socal_disp_err(socalp, CE_WARN, "attach.4020", in socal_attach()
701 instance, socalp->socal_xrp)); in socal_attach()
703 if (ddi_map_regs(dip, 2, (caddr_t *)&socalp->socal_rp, 0, 0) != in socal_attach()
705 socalp->socal_rp = NULL; in socal_attach()
706 socal_disp_err(socalp, CE_WARN, "attach.4030", in socal_attach()
711 instance, socalp->socal_rp)); in socal_attach()
716 if (ddi_peek32(dip, (int32_t *)&socalp->socal_rp->socal_csr.w, in socal_attach()
718 socal_disp_err(socalp, CE_WARN, "attach.4040", in socal_attach()
723 socal_disable(socalp); in socal_attach()
726 if (ddi_poke32(dip, (int32_t *)(socalp->socal_xrp + SOCAL_XRAM_UCODE), in socal_attach()
728 socal_disp_err(socalp, CE_WARN, "attach.4050", in socal_attach()
734 if (ddi_peek32(dip, (int32_t *)(socalp->socal_xrp + SOCAL_XRAM_UCODE), in socal_attach()
737 socal_disp_err(socalp, CE_WARN, "attach.4051", in socal_attach()
744 socalp->socal_rp->socal_cr.w &= in socal_attach()
746 socalp->socal_rp->socal_cr.w |= i<<24; in socal_attach()
748 bcopy((caddr_t)socalp->socal_xrp, (caddr_t)cptr, 0x10000); in socal_attach()
750 socalp->socal_rp->socal_cr.w &= ~SOCAL_CR_EXTERNAL_RAM_BANK_MASK; in socal_attach()
756 socal_disp_err(socalp, CE_WARN, "attach.4052", in socal_attach()
762 socalp->xram_reqp = (soc_cq_t *)(socalp->socal_xrp + in socal_attach()
764 socalp->xram_rspp = (soc_cq_t *)(socalp->socal_xrp + in socal_attach()
767 if ((socalp->socal_ksp = kstat_create("socal", instance, "statistics", in socal_attach()
770 socal_disp_err(socalp, CE_WARN, "attach.4053", in socal_attach()
773 socalp->socal_stats.version = 2; in socal_attach()
774 (void) sprintf(socalp->socal_stats.drvr_name, in socal_attach()
776 socalp->socal_stats.pstats[0].port = 0; in socal_attach()
777 socalp->socal_stats.pstats[1].port = 1; in socal_attach()
778 socalp->socal_ksp->ks_data = (void *)&socalp->socal_stats; in socal_attach()
779 kstat_install(socalp->socal_ksp); in socal_attach()
787 &socalp->iblkc, in socal_attach()
788 &socalp->idevc, in socal_attach()
790 (caddr_t)socalp) != DDI_SUCCESS) { in socal_attach()
791 socal_disp_err(socalp, CE_WARN, "attach.4060", in socal_attach()
796 ddi_set_driver_private(dip, socalp); in socal_attach()
799 mutex_init(&socalp->k_imr_mtx, NULL, MUTEX_DRIVER, in socal_attach()
800 (void *)socalp->iblkc); in socal_attach()
802 mutex_init(&socalp->board_mtx, NULL, MUTEX_DRIVER, in socal_attach()
803 (void *)socalp->iblkc); in socal_attach()
804 mutex_init(&socalp->ioctl_mtx, NULL, MUTEX_DRIVER, in socal_attach()
805 (void *)socalp->iblkc); in socal_attach()
808 mutex_init(&socalp->abort_mtx, NULL, MUTEX_DRIVER, in socal_attach()
809 (void *)socalp->iblkc); in socal_attach()
811 cv_init(&socalp->board_cv, NULL, CV_DRIVER, NULL); in socal_attach()
817 mutex_init(&porta->sp_mtx, NULL, MUTEX_DRIVER, socalp->iblkc); in socal_attach()
819 mutex_init(&portb->sp_mtx, NULL, MUTEX_DRIVER, socalp->iblkc); in socal_attach()
825 socal_wcopy((uint_t *)socalp->socal_xrp + SOCAL_XRAM_SERV_PARAMS, in socal_attach()
826 (uint_t *)socalp->socal_service_params, SOCAL_SVC_LENGTH); in socal_attach()
831 socal_init_transport_interface(socalp); in socal_attach()
839 if (socal_cqalloc_init(socalp, i) != FCAL_SUCCESS) { in socal_attach()
848 burstsize = ddi_dma_burstsizes(socalp->request[0].skc_dhandle); in socal_attach()
855 socalp->socal_cfg = (socalp->socal_cfg & ~SOCAL_CR_SBUS_BURST_SIZE_MASK) in socal_attach()
859 if (ddi_dma_set_sbus64(socalp->request[0].skc_dhandle, in socal_attach()
864 socalp->socal_cfg |= SOCAL_CR_SBUS_ENHANCED; in socal_attach()
865 burstsize = ddi_dma_burstsizes(socalp->request[0]. in socal_attach()
875 socalp->socal_cfg = (socalp->socal_cfg & in socal_attach()
881 ddi_remove_intr(dip, 0, socalp->iblkc); in socal_attach()
882 socalp->iblkc = (void *)NULL; in socal_attach()
888 &socalp->iblkc, in socal_attach()
889 &socalp->idevc, in socal_attach()
891 (caddr_t)socalp) != DDI_SUCCESS) { in socal_attach()
892 socal_disp_err(socalp, CE_WARN, "attach.4060", in socal_attach()
898 instance, socalp->socal_cfg)); in socal_attach()
907 if (socal_start(socalp) != FCAL_SUCCESS) in socal_attach()
921 socal_disable(socalp); in socal_attach()
933 socal_state_t *socalp; in socal_detach() local
942 if ((socalp = ddi_get_driver_private(dip)) == NULL) in socal_detach()
949 if (socalp->port_state[i].sp_status & PORT_TARGET_MODE) in socal_detach()
954 socal_force_reset((void *)socalp, 0, DONT_RESET_PORT); in socal_detach()
976 socal_state_t *socalp; in socal_dodetach() local
981 if ((socalp = ddi_get_soft_state(socal_soft_state_p, instance)) == 0) { in socal_dodetach()
989 mutex_enter(&socalp->board_mtx); in socal_dodetach()
990 if (socalp->socal_busy > 0) { in socal_dodetach()
991 mutex_exit(&socalp->board_mtx); in socal_dodetach()
995 socalp->socal_busy = -1; in socal_dodetach()
996 mutex_exit(&socalp->board_mtx); in socal_dodetach()
999 mutex_enter(&socalp->k_imr_mtx); in socal_dodetach()
1000 socal_disable(socalp); in socal_dodetach()
1001 mutex_exit(&socalp->k_imr_mtx); in socal_dodetach()
1004 if (socalp->iblkc != (void *)NULL) { in socal_dodetach()
1005 ddi_remove_intr(dip, (uint_t)0, socalp->iblkc); in socal_dodetach()
1012 portp = &socalp->port_state[i]; in socal_dodetach()
1032 mutex_destroy(&socalp->request[i].skc_mtx); in socal_dodetach()
1033 mutex_destroy(&socalp->response[i].skc_mtx); in socal_dodetach()
1034 cv_destroy(&socalp->request[i].skc_cv); in socal_dodetach()
1035 cv_destroy(&socalp->response[i].skc_cv); in socal_dodetach()
1037 if (socalp->request[i].skc_dhandle) { in socal_dodetach()
1038 (void) ddi_dma_unbind_handle(socalp-> in socal_dodetach()
1040 ddi_dma_free_handle(&socalp->request[i].skc_dhandle); in socal_dodetach()
1042 if (socalp->request[i].skc_cq_raw) { in socal_dodetach()
1043 ddi_dma_mem_free(&socalp->request[i].skc_acchandle); in socal_dodetach()
1044 socalp->request[i].skc_cq_raw = NULL; in socal_dodetach()
1045 socalp->request[i].skc_cq = NULL; in socal_dodetach()
1047 if (socalp->response[i].skc_dhandle) { in socal_dodetach()
1048 (void) ddi_dma_unbind_handle(socalp-> in socal_dodetach()
1050 ddi_dma_free_handle(&socalp->response[i].skc_dhandle); in socal_dodetach()
1052 if (socalp->response[i].skc_cq_raw) { in socal_dodetach()
1053 ddi_dma_mem_free(&socalp->response[i].skc_acchandle); in socal_dodetach()
1054 socalp->response[i].skc_cq_raw = NULL; in socal_dodetach()
1055 socalp->response[i].skc_cq = NULL; in socal_dodetach()
1057 if (socalp->request[i].deferred_intr_timeoutid) { in socal_dodetach()
1058 (void) untimeout(socalp-> in socal_dodetach()
1061 if (socalp->response[i].deferred_intr_timeoutid) { in socal_dodetach()
1062 (void) untimeout(socalp-> in socal_dodetach()
1067 mutex_destroy(&socalp->abort_mtx); in socal_dodetach()
1068 mutex_destroy(&socalp->board_mtx); in socal_dodetach()
1069 mutex_destroy(&socalp->ioctl_mtx); in socal_dodetach()
1070 cv_destroy(&socalp->board_cv); in socal_dodetach()
1075 if (socalp->pool_dhandle) { in socal_dodetach()
1076 (void) ddi_dma_unbind_handle(socalp->pool_dhandle); in socal_dodetach()
1077 ddi_dma_free_handle(&socalp->pool_dhandle); in socal_dodetach()
1079 if (socalp->pool) { in socal_dodetach()
1080 ddi_dma_mem_free(&socalp->pool_acchandle); in socal_dodetach()
1085 if (socalp->socal_eeprom != NULL) { in socal_dodetach()
1086 ddi_unmap_regs(dip, 0, &socalp->socal_eeprom, 0, 0); in socal_dodetach()
1090 if (socalp->socal_xrp != NULL) { in socal_dodetach()
1091 ddi_unmap_regs(dip, 1, &socalp->socal_xrp, 0, 0); in socal_dodetach()
1095 if (socalp->socal_rp != NULL) { in socal_dodetach()
1096 ddi_unmap_regs(dip, 2, (caddr_t *)&socalp->socal_rp, 0, 0); in socal_dodetach()
1099 if (socalp->socal_ksp != NULL) in socal_dodetach()
1100 kstat_delete(socalp->socal_ksp); in socal_dodetach()
1102 mutex_destroy(&socalp->k_imr_mtx); in socal_dodetach()
1137 socal_state_t *socalp; in socal_bus_ctl() local
1139 if ((socalp = ddi_get_driver_private(dip)) == NULL) in socal_bus_ctl()
1152 mutex_enter(&socalp->board_mtx); in socal_bus_ctl()
1153 mutex_enter(&socalp->port_state[port].sp_mtx); in socal_bus_ctl()
1154 if (socalp->port_state[port].sp_status & in socal_bus_ctl()
1156 mutex_exit(&socalp->port_state[port].sp_mtx); in socal_bus_ctl()
1157 mutex_exit(&socalp->board_mtx); in socal_bus_ctl()
1160 socalp->socal_busy++; in socal_bus_ctl()
1161 socalp->port_state[port].sp_status |= PORT_CHILD_INIT; in socal_bus_ctl()
1162 mutex_exit(&socalp->port_state[port].sp_mtx); in socal_bus_ctl()
1163 mutex_exit(&socalp->board_mtx); in socal_bus_ctl()
1165 socalp->port_state[port].sp_transport); in socal_bus_ctl()
1173 socal_state_t *socalp; in socal_bus_ctl() local
1175 socalp = ddi_get_driver_private(dip); in socal_bus_ctl()
1189 mutex_enter(&socalp->board_mtx); in socal_bus_ctl()
1190 mutex_enter(&socalp->port_state[port].sp_mtx); in socal_bus_ctl()
1191 socalp->socal_busy--; in socal_bus_ctl()
1192 socalp->port_state[port].sp_status &= ~PORT_CHILD_INIT; in socal_bus_ctl()
1193 mutex_exit(&socalp->port_state[port].sp_mtx); in socal_bus_ctl()
1194 mutex_exit(&socalp->board_mtx); in socal_bus_ctl()
1263 socal_state_t *socalp; in socal_getinfo() local
1269 socalp = ddi_get_soft_state(socal_soft_state_p, instance); in socal_getinfo()
1270 if (socalp) in socal_getinfo()
1271 *result = socalp->dip; in socal_getinfo()
1292 socal_state_t *socalp = in socal_open() local
1297 if (socalp == NULL) in socal_open()
1301 port_statep = &socalp->port_state[port]; in socal_open()
1316 socal_state_t *socalp = in socal_close() local
1322 port_statep = &socalp->port_state[port]; in socal_close()
1338 socal_state_t *socalp = in socal_ioctl() local
1367 if (socalp == NULL) in socal_ioctl()
1407 dip = socalp->dip; in socal_ioctl()
1422 if (socalp->socal_eeprom) { in socal_ioctl()
1425 &socalp->request[i].skc_mtx); in socal_ioctl()
1427 &socalp->response[i].skc_mtx); in socal_ioctl()
1429 i = socalp->socal_rp->socal_cr.w; in socal_ioctl()
1430 socalp->socal_rp->socal_cr.w &= in socal_ioctl()
1432 socalp->socal_rp->socal_cr.w |= 3 << 16; in socal_ioctl()
1435 bcopy((caddr_t)socalp->socal_eeprom + (unsigned) in socal_ioctl()
1437 socalp->socal_rp->socal_cr.w = i; in socal_ioctl()
1439 mutex_exit(&socalp->request[i].skc_mtx); in socal_ioctl()
1441 &socalp->response[i].skc_mtx); in socal_ioctl()
1473 mutex_enter(&socalp->k_imr_mtx); in socal_ioctl()
1474 socal_disable(socalp); in socal_ioctl()
1475 mutex_exit(&socalp->k_imr_mtx); in socal_ioctl()
1480 (void) socal_force_reset((void *)socalp, 0, in socal_ioctl()
1485 mutex_enter(&socalp->request[i].skc_mtx); in socal_ioctl()
1486 mutex_enter(&socalp->response[i].skc_mtx); in socal_ioctl()
1490 socalp->socal_rp->socal_cr.w &= in socal_ioctl()
1492 socalp->socal_rp->socal_cr.w |= i<<24; in socal_ioctl()
1493 (void) copyout((caddr_t)socalp->socal_xrp, in socal_ioctl()
1496 socalp->socal_rp->socal_cr.w &= in socal_ioctl()
1499 mutex_exit(&socalp->request[i].skc_mtx); in socal_ioctl()
1500 mutex_exit(&socalp->response[i].skc_mtx); in socal_ioctl()
1510 mutex_enter(&socalp->ioctl_mtx); in socal_ioctl()
1511 if (socal_getmap(socalp, port, (caddr_t)arg, 0, 0) == in socal_ioctl()
1514 mutex_exit(&socalp->ioctl_mtx); in socal_ioctl()
1517 mutex_enter(&socalp->ioctl_mtx); in socal_ioctl()
1518 retval = socal_bypass_dev((void *)socalp, port, arg); in socal_ioctl()
1519 mutex_exit(&socalp->ioctl_mtx); in socal_ioctl()
1522 mutex_enter(&socalp->ioctl_mtx); in socal_ioctl()
1523 retval = socal_force_lip((void *)socalp, port, 0, in socal_ioctl()
1525 mutex_exit(&socalp->ioctl_mtx); in socal_ioctl()
1528 mutex_enter(&socalp->ioctl_mtx); in socal_ioctl()
1529 retval = socal_force_offline((void *)socalp, port, 0); in socal_ioctl()
1530 mutex_exit(&socalp->ioctl_mtx); in socal_ioctl()
1546 mutex_enter(&socalp->ioctl_mtx); in socal_ioctl()
1547 retval = socal_issue_adisc(socalp, port, in socal_ioctl()
1550 mutex_exit(&socalp->ioctl_mtx); in socal_ioctl()
1581 mutex_enter(&socalp->ioctl_mtx); in socal_ioctl()
1582 retval = socal_issue_rls(socalp, port, dest, in socal_ioctl()
1584 mutex_exit(&socalp->ioctl_mtx); in socal_ioctl()
1603 mutex_enter(&socalp->ioctl_mtx); in socal_ioctl()
1605 port_statep = &socalp->port_state[port]; in socal_ioctl()
1610 mutex_exit(&socalp->ioctl_mtx); in socal_ioctl()
1616 retval = socal_diag_request((void *)socalp, port, &r, in socal_ioctl()
1618 mutex_exit(&socalp->ioctl_mtx); in socal_ioctl()
1625 mutex_enter(&socalp->ioctl_mtx); in socal_ioctl()
1626 port_statep = &socalp->port_state[port]; in socal_ioctl()
1630 mutex_exit(&socalp->ioctl_mtx); in socal_ioctl()
1634 retval = socal_diag_request((void *)socalp, port, &r, in socal_ioctl()
1636 mutex_exit(&socalp->ioctl_mtx); in socal_ioctl()
1642 mutex_enter(&socalp->ioctl_mtx); in socal_ioctl()
1643 port_statep = &socalp->port_state[port]; in socal_ioctl()
1649 mutex_exit(&socalp->ioctl_mtx); in socal_ioctl()
1660 retval = socal_diag_request((void *)socalp, port, &r, in socal_ioctl()
1662 mutex_exit(&socalp->ioctl_mtx); in socal_ioctl()
1669 mutex_enter(&socalp->ioctl_mtx); in socal_ioctl()
1670 retval = socal_diag_request((void *)socalp, port, &r, in socal_ioctl()
1672 mutex_exit(&socalp->ioctl_mtx); in socal_ioctl()
1678 mutex_enter(&socalp->ioctl_mtx); in socal_ioctl()
1679 retval = socal_diag_request((void *)socalp, port, &r, in socal_ioctl()
1681 mutex_exit(&socalp->ioctl_mtx); in socal_ioctl()
1687 mutex_enter(&socalp->ioctl_mtx); in socal_ioctl()
1688 retval = socal_diag_request((void *)socalp, port, &r, in socal_ioctl()
1690 mutex_exit(&socalp->ioctl_mtx); in socal_ioctl()
1696 mutex_enter(&socalp->ioctl_mtx); in socal_ioctl()
1697 retval = socal_diag_request((void *)socalp, port, &r, in socal_ioctl()
1699 mutex_exit(&socalp->ioctl_mtx); in socal_ioctl()
1705 mutex_enter(&socalp->ioctl_mtx); in socal_ioctl()
1706 retval = socal_diag_request((void *)socalp, port, &r, in socal_ioctl()
1708 mutex_exit(&socalp->ioctl_mtx); in socal_ioctl()
1714 mutex_enter(&socalp->ioctl_mtx); in socal_ioctl()
1715 retval = socal_diag_request((void *)socalp, port, &r, in socal_ioctl()
1717 mutex_exit(&socalp->ioctl_mtx); in socal_ioctl()
1723 mutex_enter(&socalp->ioctl_mtx); in socal_ioctl()
1724 retval = socal_diag_request((void *)socalp, port, &r, in socal_ioctl()
1726 mutex_exit(&socalp->ioctl_mtx); in socal_ioctl()
1735 mutex_enter(&socalp->ioctl_mtx); in socal_ioctl()
1736 retval = socal_diag_request((void *)socalp, port, &r, in socal_ioctl()
1738 mutex_exit(&socalp->ioctl_mtx); in socal_ioctl()
1765 mutex_enter(&socalp->ioctl_mtx); in socal_ioctl()
1766 retval = socal_issue_lbf(socalp, port, flb_pl, in socal_ioctl()
1768 mutex_exit(&socalp->ioctl_mtx); in socal_ioctl()
1817 socal_disable(socal_state_t *socalp) in socal_disable() argument
1823 if (!socalp->socal_rp) in socal_disable()
1826 socalp->socal_rp->socal_imr = socalp->socal_k_imr = 0; in socal_disable()
1827 socalp->socal_rp->socal_csr.w = SOCAL_CSR_SOFT_RESET; in socal_disable()
1829 i = socalp->socal_rp->socal_csr.w; in socal_disable()
1845 socal_init_transport_interface(socal_state_t *socalp) in socal_init_transport_interface() argument
1851 xport = socalp->port_state[i].sp_transport; in socal_init_transport_interface()
1853 (void *)(socalp->iblkc)); in socal_init_transport_interface()
1857 xport->fcal_handle = (void *)socalp; in socal_init_transport_interface()
1859 xport->fcal_iblock = socalp->iblkc; in socal_init_transport_interface()
1862 xport->fcal_loginparms = socalp->socal_service_params; in socal_init_transport_interface()
1863 bcopy((caddr_t)&socalp->socal_n_wwn, in socal_init_transport_interface()
1865 bcopy((caddr_t)&socalp->port_state[i].sp_p_wwn, in socal_init_transport_interface()
1883 socal_cqalloc_init(socal_state_t *socalp, uint32_t index) in socal_cqalloc_init() argument
1895 mutex_init(&socalp->request[index].skc_mtx, NULL, MUTEX_DRIVER, in socal_cqalloc_init()
1896 (void *)socalp->iblkc); in socal_cqalloc_init()
1897 mutex_init(&socalp->response[index].skc_mtx, NULL, MUTEX_DRIVER, in socal_cqalloc_init()
1898 (void *)socalp->iblkc); in socal_cqalloc_init()
1899 cv_init(&socalp->request[index].skc_cv, NULL, CV_DRIVER, NULL); in socal_cqalloc_init()
1900 cv_init(&socalp->response[index].skc_cv, NULL, CV_DRIVER, NULL); in socal_cqalloc_init()
1905 cqp = &socalp->request[index]; in socal_cqalloc_init()
1907 if (ddi_dma_alloc_handle(socalp->dip, &socal_dma_attr, in socal_cqalloc_init()
1910 socal_disp_err(socalp, CE_WARN, "driver.4020", in socal_cqalloc_init()
1920 socal_disp_err(socalp, CE_WARN, "driver.4030", in socal_cqalloc_init()
1926 socal_disp_err(socalp, CE_WARN, "driver.4035", in socal_cqalloc_init()
1938 socal_disp_err(socalp, CE_WARN, "driver.4040", in socal_cqalloc_init()
1945 socal_disp_err(socalp, CE_WARN, "driver.4045", in socal_cqalloc_init()
1951 socalp->request[index].skc_cq_raw = NULL; in socal_cqalloc_init()
1952 socalp->request[index].skc_cq = (cqe_t *)NULL; in socal_cqalloc_init()
1953 socalp->request[index].skc_dhandle = 0; in socal_cqalloc_init()
1959 cqp = &socalp->response[index]; in socal_cqalloc_init()
1961 if (ddi_dma_alloc_handle(socalp->dip, &socal_dma_attr, in socal_cqalloc_init()
1964 socal_disp_err(socalp, CE_WARN, "driver.4050", in socal_cqalloc_init()
1974 socal_disp_err(socalp, CE_WARN, "driver.4060", in socal_cqalloc_init()
1980 socal_disp_err(socalp, CE_WARN, "driver.4065", in socal_cqalloc_init()
1993 socal_disp_err(socalp, CE_WARN, "driver.4070", in socal_cqalloc_init()
2000 socal_disp_err(socalp, CE_WARN, "driver.4075", in socal_cqalloc_init()
2006 socalp->response[index].skc_cq_raw = NULL; in socal_cqalloc_init()
2007 socalp->response[index].skc_cq = (cqe_t *)NULL; in socal_cqalloc_init()
2008 socalp->response[index].skc_dhandle = 0; in socal_cqalloc_init()
2014 socal_cqinit(socalp, index); in socal_cqalloc_init()
2018 if (socalp->request[index].skc_dhandle) { in socal_cqalloc_init()
2020 (void) ddi_dma_unbind_handle(socalp-> in socal_cqalloc_init()
2022 ddi_dma_free_handle(&socalp->request[index].skc_dhandle); in socal_cqalloc_init()
2024 if (socalp->request[index].skc_cq_raw) in socal_cqalloc_init()
2025 ddi_dma_mem_free(&socalp->request[index].skc_acchandle); in socal_cqalloc_init()
2027 if (socalp->response[index].skc_dhandle) { in socal_cqalloc_init()
2029 (void) ddi_dma_unbind_handle(socalp-> in socal_cqalloc_init()
2031 ddi_dma_free_handle(&socalp->response[index].skc_dhandle); in socal_cqalloc_init()
2033 if (socalp->response[index].skc_cq_raw) in socal_cqalloc_init()
2034 ddi_dma_mem_free(&socalp->response[index].skc_acchandle); in socal_cqalloc_init()
2036 socalp->request[index].skc_dhandle = NULL; in socal_cqalloc_init()
2037 socalp->response[index].skc_dhandle = NULL; in socal_cqalloc_init()
2038 socalp->request[index].skc_cq_raw = NULL; in socal_cqalloc_init()
2039 socalp->request[index].skc_cq = NULL; in socal_cqalloc_init()
2040 socalp->response[index].skc_cq_raw = NULL; in socal_cqalloc_init()
2041 socalp->response[index].skc_cq = NULL; in socal_cqalloc_init()
2042 mutex_destroy(&socalp->request[index].skc_mtx); in socal_cqalloc_init()
2043 mutex_destroy(&socalp->response[index].skc_mtx); in socal_cqalloc_init()
2044 cv_destroy(&socalp->request[index].skc_cv); in socal_cqalloc_init()
2045 cv_destroy(&socalp->response[index].skc_cv); in socal_cqalloc_init()
2055 socal_cqinit(socal_state_t *socalp, uint32_t index) in socal_cqinit() argument
2057 socal_kcq_t *kcq_req = &socalp->request[index]; in socal_cqinit()
2058 socal_kcq_t *kcq_rsp = &socalp->response[index]; in socal_cqinit()
2073 kcq_req->skc_socalp = socalp; in socal_cqinit()
2074 kcq_rsp->skc_socalp = socalp; in socal_cqinit()
2077 (socalp->xram_reqp + (index * sizeof (struct cq))/8); in socal_cqinit()
2079 (socalp->xram_rspp + (index * sizeof (struct cq))/8); in socal_cqinit()
2092 socal_start(socal_state_t *socalp) in socal_start() argument
2096 if (!socalp) in socal_start()
2099 socal_download_ucode(socalp); in socal_start()
2100 socal_init_cq_desc(socalp); in socal_start()
2101 socal_init_wwn(socalp); in socal_start()
2103 mutex_enter(&socalp->port_state[0].sp_mtx); in socal_start()
2104 socalp->port_state[0].sp_status in socal_start()
2106 socalp->port_state[0].sp_status |= PORT_OFFLINE; in socal_start()
2107 mutex_exit(&socalp->port_state[0].sp_mtx); in socal_start()
2109 mutex_enter(&socalp->port_state[1].sp_mtx); in socal_start()
2110 socalp->port_state[1].sp_status in socal_start()
2112 socalp->port_state[1].sp_status |= PORT_OFFLINE; in socal_start()
2113 mutex_exit(&socalp->port_state[1].sp_mtx); in socal_start()
2115 socal_enable(socalp); in socal_start()
2117 if (socalp->port_state[0].sp_status & PORT_DISABLED) in socal_start()
2118 (void) socal_diag_request((void *)socalp, 0, &r, in socal_start()
2120 if (socalp->port_state[1].sp_status & PORT_DISABLED) in socal_start()
2121 (void) socal_diag_request((void *)socalp, 1, &r, in socal_start()
2124 mutex_enter(&socalp->k_imr_mtx); in socal_start()
2125 socalp->socal_shutdown = 0; in socal_start()
2126 mutex_exit(&socalp->k_imr_mtx); in socal_start()
2128 mutex_enter(&socalp->board_mtx); in socal_start()
2129 if (socal_establish_pool(socalp, 1) != FCAL_SUCCESS) { in socal_start()
2130 mutex_exit(&socalp->board_mtx); in socal_start()
2133 if (socal_add_pool_buffer(socalp, 1) != FCAL_SUCCESS) { in socal_start()
2134 mutex_exit(&socalp->board_mtx); in socal_start()
2138 mutex_exit(&socalp->board_mtx); in socal_start()
2143 socal_doreset(socal_state_t *socalp) in socal_doreset() argument
2150 mutex_enter(&socalp->request[i].skc_mtx); in socal_doreset()
2151 mutex_enter(&socalp->response[i].skc_mtx); in socal_doreset()
2154 mutex_enter(&socalp->k_imr_mtx); in socal_doreset()
2155 socal_disable(socalp); in socal_doreset()
2157 if (socalp->pool_dhandle) { in socal_doreset()
2158 (void) ddi_dma_unbind_handle(socalp->pool_dhandle); in socal_doreset()
2159 ddi_dma_free_handle(&socalp->pool_dhandle); in socal_doreset()
2162 if (socalp->pool) in socal_doreset()
2163 ddi_dma_mem_free(&socalp->pool_acchandle); in socal_doreset()
2165 socalp->pool_dhandle = NULL; in socal_doreset()
2166 socalp->pool = NULL; in socal_doreset()
2169 socal_cqinit(socalp, i); in socal_doreset()
2172 port_statep = &socalp->port_state[i]; in socal_doreset()
2182 mutex_exit(&socalp->k_imr_mtx); in socal_doreset()
2185 mutex_exit(&socalp->request[i].skc_mtx); in socal_doreset()
2186 mutex_exit(&socalp->response[i].skc_mtx); in socal_doreset()
2190 for (scbp = socalp->port_state[i].sp_unsol_cb; scbp; in socal_doreset()
2196 mutex_enter(&socalp->request[i].skc_mtx); in socal_doreset()
2197 mutex_enter(&socalp->response[i].skc_mtx); in socal_doreset()
2202 socalp->request[i].skc_overflowh = NULL; in socal_doreset()
2203 if (socalp->request[i].skc_full & SOCAL_SKC_SLEEP) in socal_doreset()
2204 cv_broadcast(&socalp->request[i].skc_cv); in socal_doreset()
2208 mutex_exit(&socalp->request[i].skc_mtx); in socal_doreset()
2209 mutex_exit(&socalp->response[i].skc_mtx); in socal_doreset()
2226 socal_download_ucode(socal_state_t *socalp) in socal_download_ucode() argument
2236 (uint_t *)socalp->socal_xrp, fw_len); in socal_download_ucode()
2238 socal_fix_harda(socalp, 0); in socal_download_ucode()
2239 socal_fix_harda(socalp, 1); in socal_download_ucode()
2242 socal_wcopy((uint_t *)(socalp->socal_xrp+SOCAL_XRAM_FW_DATE_STR), in socal_download_ucode()
2250 socal_disp_err(socalp, CE_CONT, "driver.1010", buf); in socal_download_ucode()
2251 (void) strcpy(socalp->socal_stats.fw_revision, in socal_download_ucode()
2257 socal_disp_err(socalp, CE_CONT, "driver.3010", buf); in socal_download_ucode()
2258 (void) strcpy(socalp->socal_stats.fw_revision, in socal_download_ucode()
2273 socal_state_t *socalp, in socal_disp_err() argument
2281 instance = ddi_get_instance(socalp->dip); in socal_disp_err()
2312 socal_init_cq_desc(socal_state_t *socalp) in socal_init_cq_desc() argument
2330 (uint32_t)socalp->request[i]. in socal_init_cq_desc()
2344 (uint_t *)socalp->xram_reqp, /* pointer to xram location */ in socal_init_cq_desc()
2354 (uint32_t)socalp->response[i]. in socal_init_cq_desc()
2365 (uint_t *)socalp->xram_rspp, /* pointer to xram location */ in socal_init_cq_desc()
2370 socal_init_wwn(socal_state_t *socalp) in socal_init_wwn() argument
2373 socal_wcopy((uint_t *)&socalp->socal_n_wwn, in socal_init_wwn()
2374 (uint_t *)(socalp->socal_xrp + in socal_init_wwn()
2378 socal_wcopy((uint_t *)&socalp->port_state[0].sp_p_wwn, in socal_init_wwn()
2379 (uint_t *)(socalp->socal_xrp + SOCAL_XRAM_PORTA_WWN), in socal_init_wwn()
2383 socal_wcopy((uint_t *)&socalp->port_state[1].sp_p_wwn, in socal_init_wwn()
2384 (uint_t *)(socalp->socal_xrp + SOCAL_XRAM_PORTB_WWN), in socal_init_wwn()
2391 mutex_enter(&socalp->port_state[0].sp_transport->fcal_mtx); in socal_init_wwn()
2392 mutex_enter(&socalp->port_state[1].sp_transport->fcal_mtx); in socal_init_wwn()
2394 socal_wcopy((uint_t *)(socalp->socal_xrp + SOCAL_XRAM_SERV_PARAMS), in socal_init_wwn()
2395 (uint_t *)&socalp->socal_service_params, SOCAL_SVC_LENGTH); in socal_init_wwn()
2396 mutex_exit(&socalp->port_state[1].sp_transport->fcal_mtx); in socal_init_wwn()
2397 mutex_exit(&socalp->port_state[0].sp_transport->fcal_mtx); in socal_init_wwn()
2401 socal_enable(socal_state_t *socalp) in socal_enable() argument
2404 ddi_get_instance(socalp->dip))); in socal_enable()
2406 socalp->socal_rp->socal_cr.w = socalp->socal_cfg; in socal_enable()
2407 socalp->socal_rp->socal_csr.w = SOCAL_CSR_SOCAL_TO_HOST; in socal_enable()
2409 socalp->socal_k_imr = (uint32_t)SOCAL_CSR_SOCAL_TO_HOST | in socal_enable()
2411 socalp->socal_rp->socal_imr = (uint32_t)socalp->socal_k_imr; in socal_enable()
2425 socal_establish_pool(socal_state_t *socalp, uint32_t poolid) in socal_establish_pool() argument
2467 result = socal_cq_enque(socalp, NULL, (cqe_t *)prq, CQ_REQUEST_1, in socal_establish_pool()
2486 socal_add_pool_buffer(socal_state_t *socalp, uint32_t poolid) in socal_add_pool_buffer() argument
2500 if (ddi_dma_alloc_handle(socalp->dip, &socal_dma_attr, in socal_add_pool_buffer()
2501 DDI_DMA_DONTWAIT, NULL, &socalp->pool_dhandle) != DDI_SUCCESS) in socal_add_pool_buffer()
2504 if (ddi_dma_mem_alloc(socalp->pool_dhandle, SOCAL_POOL_SIZE, in socal_add_pool_buffer()
2506 (caddr_t *)&socalp->pool, &real_len, &socalp->pool_acchandle) in socal_add_pool_buffer()
2513 if (ddi_dma_addr_bind_handle(socalp->pool_dhandle, (struct as *)NULL, in socal_add_pool_buffer()
2514 (caddr_t)socalp->pool, SOCAL_POOL_SIZE, in socal_add_pool_buffer()
2516 NULL, &socalp->pool_dcookie, &ccount) != DDI_DMA_MAPPED) in socal_add_pool_buffer()
2533 (uint32_t)socalp->pool_dcookie.dmac_address; in socal_add_pool_buffer()
2552 result = socal_cq_enque(socalp, NULL, (cqe_t *)drq, CQ_REQUEST_1, in socal_add_pool_buffer()
2558 socal_disp_err(socalp, CE_WARN, "driver.4110", in socal_add_pool_buffer()
2560 if (socalp->pool_dhandle) { in socal_add_pool_buffer()
2562 (void) ddi_dma_unbind_handle(socalp->pool_dhandle); in socal_add_pool_buffer()
2563 ddi_dma_free_handle(&socalp->pool_dhandle); in socal_add_pool_buffer()
2565 if (socalp->pool) in socal_add_pool_buffer()
2566 ddi_dma_mem_free(&socalp->pool_acchandle); in socal_add_pool_buffer()
2567 socalp->pool_dhandle = NULL; in socal_add_pool_buffer()
2574 socal_state_t *socalp = (socal_state_t *)fcalpkt->fcal_pkt_cookie; in socal_transport() local
2577 int instance = ddi_get_instance(socalp->dip); in socal_transport()
2586 port_statep = &socalp->port_state[port]; in socal_transport()
2594 return (socal_cq_enque(socalp, port_statep, (cqe_t *)sp, in socal_transport()
2614 socal_cq_enque(socal_state_t *socalp, socal_port_t *port_statep, cqe_t *cqe, in socal_cq_enque() argument
2619 int instance = ddi_get_instance(socalp->dip); in socal_cq_enque()
2628 kcq = &socalp->request[rqix]; in socal_cq_enque()
2637 if (socalp->socal_shutdown) { in socal_cq_enque()
2678 socalp->socal_stats.qfulls++; in socal_cq_enque()
2683 mutex_enter(&socalp->k_imr_mtx); in socal_cq_enque()
2684 socalp->socal_rp->socal_imr = in socal_cq_enque()
2685 (socalp->socal_k_imr |= bitmask); in socal_cq_enque()
2686 mutex_exit(&socalp->k_imr_mtx); in socal_cq_enque()
2704 SOCAL_REQUESTQ_INDEX(rqix, socalp->socal_rp->socal_reqp.w); in socal_cq_enque()
2745 socalp->socal_rp->socal_csr.w = wmask | (kcq->skc_in << 24); in socal_cq_enque()
2756 socal_state_t *socalp = (socal_state_t *)fcalpkt->fcal_pkt_cookie; in socal_transport_poll() local
2757 register volatile socal_reg_t *socalreg = socalp->socal_rp; in socal_transport_poll()
2771 port_statep = &socalp->port_state[port]; in socal_transport_poll()
2778 if ((retval = socal_cq_enque(socalp, port_statep, (cqe_t *)sp, in socal_transport_poll()
2788 if ((SOCAL_INTR_CAUSE(socalp, csr)) & in socal_transport_poll()
2790 socal_intr_solicited(socalp, 0); in socal_transport_poll()
2803 socal_state_t *socalp = (socal_state_t *)fcalpkt->fcal_pkt_cookie; in socal_doit() local
2876 socal_take_core(socalp); in socal_doit()
2878 socal_disp_err(socalp, CE_WARN, "link.6040", in socal_doit()
2908 socal_state_t *socalp = (socal_state_t *)ssp; in socal_lilp_map() local
2909 socal_port_t *port_statep = &socalp->port_state[port]; in socal_lilp_map()
2912 socal_packet_alloc(socalp, polled ? FCAL_NOSLEEP : FCAL_SLEEP)) in socal_lilp_map()
2925 fcalpkt->fcal_pkt_cookie = (void *)socalp; in socal_lilp_map()
2936 socal_state_t *socalp = (socal_state_t *)ssp; in socal_force_lip() local
2937 socal_port_t *port_statep = &socalp->port_state[port]; in socal_force_lip()
2953 socalp->socal_stats.pstats[port].lips++; in socal_force_lip()
2955 socal_packet_alloc(socalp, polled ? FCAL_NOSLEEP : FCAL_SLEEP)) in socal_force_lip()
2965 fcalpkt->fcal_pkt_cookie = (void *)socalp; in socal_force_lip()
2975 socal_state_t *socalp = (socal_state_t *)ssp; in socal_abort_cmd() local
2976 socal_port_t *port_statep = &socalp->port_state[port]; in socal_abort_cmd()
2979 socalp->socal_stats.pstats[port].abts++; in socal_abort_cmd()
2980 kcq = &socalp->request[CQ_REQUEST_1]; in socal_abort_cmd()
2994 socalp->socal_stats.pstats[port].abts_ok++; in socal_abort_cmd()
3005 socal_packet_alloc(socalp, polled ? FCAL_NOSLEEP : FCAL_SLEEP)) in socal_abort_cmd()
3009 mutex_enter(&socalp->abort_mtx); in socal_abort_cmd()
3013 mutex_exit(&socalp->abort_mtx); in socal_abort_cmd()
3027 fcalpkt2->fcal_pkt_cookie = (void *)socalp; in socal_abort_cmd()
3028 mutex_exit(&socalp->abort_mtx); in socal_abort_cmd()
3048 socal_state_t *socalp = (socal_state_t *)ssp; in socal_bypass_dev() local
3049 socal_port_t *port_statep = &socalp->port_state[port]; in socal_bypass_dev()
3052 socal_packet_alloc(socalp, FCAL_SLEEP)) in socal_bypass_dev()
3071 socal_state_t *socalp = (socal_state_t *)ssp; in socal_force_reset() local
3073 mutex_enter(&socalp->k_imr_mtx); in socal_force_reset()
3074 if (socalp->socal_shutdown) { in socal_force_reset()
3075 mutex_exit(&socalp->k_imr_mtx); in socal_force_reset()
3078 socalp->socal_shutdown = 1; in socal_force_reset()
3079 mutex_exit(&socalp->k_imr_mtx); in socal_force_reset()
3081 socalp->socal_stats.resets++; in socal_force_reset()
3082 socal_doreset(socalp); in socal_force_reset()
3084 if (socal_start(socalp) != FCAL_SUCCESS) { in socal_force_reset()
3096 socal_state_t *socalp = (socal_state_t *)ssp; in socal_add_ulp() local
3097 socal_port_t *port_statep = &socalp->port_state[port]; in socal_add_ulp()
3137 socal_state_t *socalp = (socal_state_t *)ssp; in socal_remove_ulp() local
3144 port_statep = &socalp->port_state[port]; in socal_remove_ulp()
3182 socal_state_t *socalp = (socal_state_t *)arg; in socal_intr() local
3183 register volatile socal_reg_t *socalreg = socalp->socal_rp; in socal_intr()
3187 int instance = ddi_get_instance(socalp->dip); in socal_intr()
3194 cause = (int)SOCAL_INTR_CAUSE(socalp, csr); in socal_intr()
3201 socalp->socal_on_intr = 0; in socal_intr()
3205 socalp->socal_on_intr = 1; in socal_intr()
3216 socal_intr_unsolicited(socalp, 1); in socal_intr()
3221 socal_intr_solicited(socalp, 0); in socal_intr()
3240 socalp->socal_stats.reqq_intrs++; in socal_intr()
3244 socal_kcq_t *kcq = &socalp->request[j]; in socal_intr()
3254 if (socal_cq_enque(socalp, (socal_port_t *) in socal_intr()
3270 mutex_enter(&socalp->k_imr_mtx); in socal_intr()
3271 socalp->socal_rp->socal_imr = in socal_intr()
3272 (socalp->socal_k_imr &= ~i); in socal_intr()
3273 mutex_exit(&socalp->k_imr_mtx); in socal_intr()
3281 cause = (int)SOCAL_INTR_CAUSE(socalp, csr); in socal_intr()
3286 socalp->socal_on_intr = 0; in socal_intr()
3291 socal_intr_solicited(socal_state_t *socalp, uint32_t srq) in socal_intr_solicited() argument
3300 register volatile socal_reg_t *socalreg = socalp->socal_rp; in socal_intr_solicited()
3308 int instance = ddi_get_instance(socalp->dip); in socal_intr_solicited()
3312 kcq = &socalp->response[srq]; in socal_intr_solicited()
3378 if ((socal_core & SOCAL_TAKE_CORE) && ddi_peek8(socalp->dip, in socal_intr_solicited()
3382 socal_take_core(socalp); in socal_intr_solicited()
3390 socal_disp_err(socalp, CE_WARN, "link.4060", buf); in socal_intr_solicited()
3420 mutex_enter(&socalp->abort_mtx); in socal_intr_solicited()
3422 mutex_exit(&socalp->abort_mtx); in socal_intr_solicited()
3444 socalp->socal_stats.pstats[i]. in socal_intr_solicited()
3447 socalp->socal_stats.pstats[i]. in socal_intr_solicited()
3480 port_statep = &socalp->port_state[port]; in socal_intr_solicited()
3491 (void *)socalp, port, in socal_intr_solicited()
3503 mutex_enter(&socalp->abort_mtx); in socal_intr_solicited()
3517 mutex_exit(&socalp->abort_mtx); in socal_intr_solicited()
3528 mutex_exit(&socalp->abort_mtx); in socal_intr_solicited()
3531 mutex_exit(&socalp->abort_mtx); in socal_intr_solicited()
3606 socal_intr_unsolicited(socal_state_t *socalp, uint32_t urq) in socal_intr_unsolicited() argument
3614 register volatile socal_reg_t *socalreg = socalp->socal_rp; in socal_intr_unsolicited()
3623 int instance = ddi_get_instance(socalp->dip); in socal_intr_unsolicited()
3628 kcq = &socalp->response[urq]; in socal_intr_unsolicited()
3703 socal_disp_err(socalp, CE_WARN, "driver.4030", in socal_intr_unsolicited()
3750 port_statep = &socalp->port_state[port]; in socal_intr_unsolicited()
3765 socalp->socal_stats.pstats[port].els_rcvd++; in socal_intr_unsolicited()
3766 socal_us_els(socalp, (cqe_t *)cqe, (caddr_t)cqe_cont); in socal_intr_unsolicited()
3788 socal_disp_err(socalp, CE_WARN, "link.4020", buf); in socal_intr_unsolicited()
3817 socal_disp_err(socalp, CE_WARN, in socal_intr_unsolicited()
3825 socal_disp_err(socalp, CE_WARN, "link.4040", buf); in socal_intr_unsolicited()
3843 socal_disp_err(socalp, CE_CONT, "link.6010", in socal_intr_unsolicited()
3849 socalp->socal_stats.pstats[port].onlines++; in socal_intr_unsolicited()
3859 socal_disp_err(socalp, CE_CONT, "link.6010", in socal_intr_unsolicited()
3865 socalp->socal_stats.pstats[port].online_loops++; in socal_intr_unsolicited()
3880 socal_disp_err(socalp, CE_CONT, "link.5010", in socal_intr_unsolicited()
3888 socalp->socal_stats.pstats[port].offlines++; in socal_intr_unsolicited()
3897 socal_disp_err(socalp, CE_WARN, "link.3020", in socal_intr_unsolicited()
3913 socal_flush_overflowq(socalp, port, in socal_intr_unsolicited()
3915 socal_flush_overflowq(socalp, port, in socal_intr_unsolicited()
3924 socal_disp_err(socalp, CE_WARN, "link.4050", buf); in socal_intr_unsolicited()
3927 socalp->socal_rp->socal_cr.w, in socal_intr_unsolicited()
3928 socalp->socal_rp->socal_sae.w, in socal_intr_unsolicited()
3929 socalp->socal_rp->socal_csr.w, in socal_intr_unsolicited()
3930 socalp->socal_rp->socal_imr)); in socal_intr_unsolicited()
3981 socalp->socal_stats.pstats[port].unsol_resps++; in socal_intr_unsolicited()
3996 socal_us_els(socal_state_t *socalp, cqe_t *cqe, caddr_t payload) in socal_us_els() argument
4009 socal_disp_err(socalp, CE_WARN, "link.4010", in socal_us_els()
4030 socal_disp_err(socalp, CE_CONT, "link.1010", buf); in socal_us_els()
4043 socal_packet_alloc(socal_state_t *socalp, fcal_sleep_t sleep) in socal_packet_alloc() argument
4071 socal_state_t *socalp = (socal_state_t *)fcalpkt->fcal_pkt_cookie; in socal_lilp_map_done() local
4077 mutex_enter(&socalp->port_state[port].sp_mtx); in socal_lilp_map_done()
4078 socalp->port_state[port].sp_status &= ~PORT_LILP_PENDING; in socal_lilp_map_done()
4079 cv_broadcast(&socalp->port_state[port].sp_cv); in socal_lilp_map_done()
4080 mutex_exit(&socalp->port_state[port].sp_mtx); in socal_lilp_map_done()
4087 socal_state_t *socalp = (socal_state_t *)fcalpkt->fcal_pkt_cookie; in socal_force_lip_done() local
4093 mutex_enter(&socalp->port_state[port].sp_mtx); in socal_force_lip_done()
4094 socalp->port_state[port].sp_status &= ~PORT_LIP_PENDING; in socal_force_lip_done()
4095 cv_broadcast(&socalp->port_state[port].sp_cv); in socal_force_lip_done()
4096 mutex_exit(&socalp->port_state[port].sp_mtx); in socal_force_lip_done()
4103 socal_state_t *socalp = (socal_state_t *)fcalpkt->fcal_pkt_cookie; in socal_adisc_done() local
4109 mutex_enter(&socalp->port_state[port].sp_mtx); in socal_adisc_done()
4110 socalp->port_state[port].sp_status &= ~PORT_ADISC_PENDING; in socal_adisc_done()
4111 cv_broadcast(&socalp->port_state[port].sp_cv); in socal_adisc_done()
4112 mutex_exit(&socalp->port_state[port].sp_mtx); in socal_adisc_done()
4119 socal_state_t *socalp = (socal_state_t *)fcalpkt->fcal_pkt_cookie; in socal_lbf_done() local
4125 mutex_enter(&socalp->port_state[port].sp_mtx); in socal_lbf_done()
4126 socalp->port_state[port].sp_status &= ~PORT_LBF_PENDING; in socal_lbf_done()
4127 cv_broadcast(&socalp->port_state[port].sp_cv); in socal_lbf_done()
4128 mutex_exit(&socalp->port_state[port].sp_mtx); in socal_lbf_done()
4135 socal_state_t *socalp = (socal_state_t *)fcalpkt->fcal_pkt_cookie; in socal_rls_done() local
4141 mutex_enter(&socalp->port_state[port].sp_mtx); in socal_rls_done()
4142 socalp->port_state[port].sp_status &= ~PORT_RLS_PENDING; in socal_rls_done()
4143 cv_broadcast(&socalp->port_state[port].sp_cv); in socal_rls_done()
4144 mutex_exit(&socalp->port_state[port].sp_mtx); in socal_rls_done()
4151 socal_state_t *socalp = (socal_state_t *)fcalpkt->fcal_pkt_cookie; in socal_force_offline_done() local
4157 mutex_enter(&socalp->port_state[port].sp_mtx); in socal_force_offline_done()
4158 socalp->port_state[port].sp_status &= ~PORT_OFFLINE_PENDING; in socal_force_offline_done()
4159 cv_broadcast(&socalp->port_state[port].sp_cv); in socal_force_offline_done()
4160 mutex_exit(&socalp->port_state[port].sp_mtx); in socal_force_offline_done()
4167 socal_state_t *socalp = (socal_state_t *)fcalpkt->fcal_pkt_cookie; in socal_abort_done() local
4173 mutex_enter(&socalp->abort_mtx); in socal_abort_done()
4178 mutex_exit(&socalp->abort_mtx); in socal_abort_done()
4183 mutex_enter(&socalp->port_state[port].sp_mtx); in socal_abort_done()
4184 socalp->port_state[port].sp_status &= ~PORT_ABORT_PENDING; in socal_abort_done()
4185 cv_broadcast(&socalp->port_state[port].sp_cv); in socal_abort_done()
4186 mutex_exit(&socalp->port_state[port].sp_mtx); in socal_abort_done()
4193 socal_state_t *socalp = (socal_state_t *)fcalpkt->fcal_pkt_cookie; in socal_bypass_dev_done() local
4198 mutex_enter(&socalp->port_state[port].sp_mtx); in socal_bypass_dev_done()
4199 socalp->port_state[port].sp_status &= ~PORT_BYPASS_PENDING; in socal_bypass_dev_done()
4200 cv_broadcast(&socalp->port_state[port].sp_cv); in socal_bypass_dev_done()
4201 mutex_exit(&socalp->port_state[port].sp_mtx); in socal_bypass_dev_done()
4212 socal_diag_request(socal_state_t *socalp, uint32_t port, uint_t *diagcode, in socal_diag_request() argument
4217 socal_port_t *port_statep = &socalp->port_state[port]; in socal_diag_request()
4222 if (socal_getmap(socalp, port, (caddr_t)&map, 0, FKIOCTL) in socal_diag_request()
4229 if ((fcalpkt = socal_packet_alloc(socalp, FCAL_SLEEP)) in socal_diag_request()
4238 fcalpkt->fcal_pkt_cookie = (void *)socalp; in socal_diag_request()
4248 socal_state_t *socalp = (socal_state_t *)ssp; in socal_force_offline() local
4249 socal_port_t *port_statep = &socalp->port_state[port]; in socal_force_offline()
4252 socal_packet_alloc(socalp, polled ? FCAL_NOSLEEP : FCAL_SLEEP)) in socal_force_offline()
4261 fcalpkt->fcal_pkt_cookie = (void *)socalp; in socal_force_offline()
4267 socal_issue_adisc(socal_state_t *socalp, uint32_t port, uint32_t dest, in socal_issue_adisc() argument
4276 port_statep = &socalp->port_state[port]; in socal_issue_adisc()
4279 socal_els_alloc(socalp, port, dest, sizeof (la_els_adisc_t), in socal_issue_adisc()
4293 bcopy((caddr_t)&socalp->socal_n_wwn, in socal_issue_adisc()
4311 socal_issue_lbf(socal_state_t *socalp, uint32_t port, in socal_issue_lbf() argument
4319 port_statep = &socalp->port_state[port]; in socal_issue_lbf()
4321 if ((fcalpkt = socal_lbf_alloc(socalp, port, length, length, in socal_issue_lbf()
4343 socal_issue_rls(socal_state_t *socalp, uint32_t port, uint32_t dest, in socal_issue_rls() argument
4353 port_statep = &socalp->port_state[port]; in socal_issue_rls()
4355 if (dest == socal_getmap(socalp, port, NULL, 0, 0)) { in socal_issue_rls()
4371 socal_els_alloc(socalp, port, dest, sizeof (la_els_rls_t), in socal_issue_rls()
4408 socal_els_alloc(socal_state_t *socalp, uint32_t port, uint32_t dest, in socal_els_alloc() argument
4428 socal_packet_alloc(socalp, polled ? FCAL_NOSLEEP : FCAL_SLEEP)) in socal_els_alloc()
4443 if ((ouralpa = socal_getmap(socalp, port, NULL, 0, 0)) == -1) in socal_els_alloc()
4446 if (ddi_dma_alloc_handle(socalp->dip, &socal_dma_attr, in socal_els_alloc()
4472 if (ddi_dma_alloc_handle(socalp->dip, &socal_dma_attr, in socal_els_alloc()
4517 fcalpkt->fcal_pkt_cookie = (void *)socalp; in socal_els_alloc()
4557 socal_lbf_alloc(socal_state_t *socalp, uint32_t port, in socal_lbf_alloc() argument
4577 socal_packet_alloc(socalp, polled ? FCAL_NOSLEEP : FCAL_SLEEP)) in socal_lbf_alloc()
4592 if (ddi_dma_alloc_handle(socalp->dip, &socal_dma_attr, in socal_lbf_alloc()
4618 if (ddi_dma_alloc_handle(socalp->dip, &socal_dma_attr, in socal_lbf_alloc()
4664 fcalpkt->fcal_pkt_cookie = (void *)socalp; in socal_lbf_alloc()
4669 fhp->d_id = socalp->port_state[port].sp_src_id; in socal_lbf_alloc()
4670 fhp->s_id = socalp->port_state[port].sp_src_id; in socal_lbf_alloc()
4757 socal_getmap(socal_state_t *socalp, uint32_t port, caddr_t arg, in socal_getmap() argument
4769 port_statep = &socalp->port_state[port]; in socal_getmap()
4784 if (ddi_dma_alloc_handle(socalp->dip, &socal_dma_attr, in socal_getmap()
4807 retval = socal_lilp_map((void *)socalp, port, in socal_getmap()
4857 socal_flush_overflowq(socal_state_t *socalp, int port, int q_no) in socal_flush_overflowq() argument
4862 kcq = &socalp->request[q_no]; in socal_flush_overflowq()
4904 socal_state_t *socalp = kcq->skc_socalp; in socal_deferred_intr() local
4906 ASSERT((socalp != NULL)); in socal_deferred_intr()
4917 if (socalp->socal_on_intr) { in socal_deferred_intr()
4926 socal_intr_solicited(socalp, 0); in socal_deferred_intr()
4932 socal_state_t *socalp = (socal_state_t *)arg; in socal_take_core() local
4935 socal_disable(socalp); in socal_take_core()
4937 mutex_enter(&socalp->request[i].skc_mtx); in socal_take_core()
4938 mutex_enter(&socalp->response[i].skc_mtx); in socal_take_core()
4941 socalp->socal_rp->socal_cr.w &= in socal_take_core()
4943 socalp->socal_rp->socal_cr.w |= i<<24; in socal_take_core()
4944 (void) bcopy((caddr_t)socalp->socal_xrp, in socal_take_core()
4948 mutex_exit(&socalp->request[i].skc_mtx); in socal_take_core()
4949 mutex_exit(&socalp->response[i].skc_mtx); in socal_take_core()
4951 instance = ddi_get_instance(socalp->dip); in socal_take_core()
4960 socal_fix_harda(socal_state_t *socalp, int port) in socal_fix_harda() argument
4962 socal_port_t *portp = &socalp->port_state[port]; in socal_fix_harda()
4963 uint_t *xrp = (uint_t *)socalp->socal_xrp; in socal_fix_harda()
4988 socal_state_t *socalp; in socal_sftm_attach() local
5000 socalp = ddi_get_soft_state(socal_soft_state_p, instance); in socal_sftm_attach()
5001 if (socalp == NULL) in socal_sftm_attach()
5007 if (socalp->port_state[port].sp_status & PORT_CHILD_INIT) in socal_sftm_attach()
5014 mutex_enter(&socalp->board_mtx); in socal_sftm_attach()
5015 mutex_enter(&socalp->port_state[port].sp_mtx); in socal_sftm_attach()
5016 if (socalp->socal_busy < 0) { in socal_sftm_attach()
5017 mutex_exit(&socalp->port_state[port].sp_mtx); in socal_sftm_attach()
5018 mutex_exit(&socalp->board_mtx); in socal_sftm_attach()
5021 socalp->socal_busy++; in socal_sftm_attach()
5022 socalp->port_state[port].sp_status |= PORT_CHILD_INIT; in socal_sftm_attach()
5023 mutex_exit(&socalp->port_state[port].sp_mtx); in socal_sftm_attach()
5024 mutex_exit(&socalp->board_mtx); in socal_sftm_attach()
5031 if (hard_alpa != socalp->port_state[port].sp_hard_alpa) { in socal_sftm_attach()
5032 socalp->port_state[port].sp_hard_alpa = hard_alpa; in socal_sftm_attach()
5038 return (socalp->port_state[port].sp_transport); in socal_sftm_attach()
5046 socal_sftm_detach(socal_state_t *socalp, int port) in socal_sftm_detach() argument
5048 mutex_enter(&socalp->board_mtx); in socal_sftm_detach()
5049 socalp->socal_busy--; in socal_sftm_detach()
5050 socalp->port_state[port].sp_status &= ~PORT_CHILD_INIT; in socal_sftm_detach()
5051 mutex_exit(&socalp->board_mtx); in socal_sftm_detach()