Lines Matching refs:cpqary3p
284 cpqary3_t *cpqary3p; /* per-controller */ in cpqary3_attach() local
304 cpqary3p = ddi_get_soft_state(cpqary3_state, instance); in cpqary3_attach()
305 if (!cpqary3p) { in cpqary3_attach()
307 cpqary3_cleanup(cpqary3p, cleanstatus); in cpqary3_attach()
312 cpqary3p->dip = dip; in cpqary3_attach()
313 cpqary3p->instance = instance; in cpqary3_attach()
316 cpqary3_read_conf_file(dip, cpqary3p); in cpqary3_attach()
319 retvalue = cpqary3_update_ctlrdetails(cpqary3p, &cleanstatus); in cpqary3_attach()
321 cpqary3_cleanup(cpqary3p, cleanstatus); in cpqary3_attach()
326 if (ddi_get_iblock_cookie(dip, 0, &cpqary3p->hw_iblock_cookie) != in cpqary3_attach()
328 cpqary3_cleanup(cpqary3p, cleanstatus); in cpqary3_attach()
333 mutex_init(&cpqary3p->hw_mutex, NULL, MUTEX_DRIVER, in cpqary3_attach()
334 (void *)cpqary3p->hw_iblock_cookie); in cpqary3_attach()
340 &cpqary3p->sw_iblock_cookie) != DDI_SUCCESS) { in cpqary3_attach()
341 cpqary3_cleanup(cpqary3p, cleanstatus); in cpqary3_attach()
346 mutex_init(&cpqary3p->sw_mutex, NULL, MUTEX_DRIVER, in cpqary3_attach()
347 (void *)cpqary3p->sw_iblock_cookie); in cpqary3_attach()
351 retvalue = cpqary3_init_ctlr_resource(cpqary3p); in cpqary3_attach()
353 cpqary3_cleanup(cpqary3p, cleanstatus); in cpqary3_attach()
361 cpqary3p->hba_tran = scsi_hba_tran_alloc(dip, SCSI_HBA_CANSLEEP); in cpqary3_attach()
362 if (!cpqary3p->hba_tran) { in cpqary3_attach()
363 cpqary3_cleanup(cpqary3p, cleanstatus); in cpqary3_attach()
373 cpqary3_init_hbatran(cpqary3p); in cpqary3_attach()
378 tmp_dma_attr.dma_attr_sgllen = cpqary3p->sg_cnt; in cpqary3_attach()
385 if (scsi_hba_attach_setup(dip, &tmp_dma_attr, cpqary3p->hba_tran, in cpqary3_attach()
387 cpqary3_cleanup(cpqary3p, cleanstatus); in cpqary3_attach()
410 cpqary3_cleanup(cpqary3p, cleanstatus); in cpqary3_attach()
416 cpqary3p->tick_tmout_id = timeout(cpqary3_tick_hdlr, in cpqary3_attach()
417 (caddr_t)cpqary3p, drv_usectohz(CPQARY3_TICKTMOUT_VALUE)); in cpqary3_attach()
422 &cpqary3p->cpqary3_softintr_id, &cpqary3p->sw_iblock_cookie, NULL, in cpqary3_attach()
423 cpqary3_sw_isr, (caddr_t)cpqary3p) != DDI_SUCCESS) { in cpqary3_attach()
424 cpqary3_cleanup(cpqary3p, cleanstatus); in cpqary3_attach()
430 if (ddi_add_intr(dip, 0, &cpqary3p->hw_iblock_cookie, NULL, in cpqary3_attach()
431 cpqary3_hw_isr, (caddr_t)cpqary3p) != DDI_SUCCESS) { in cpqary3_attach()
432 cpqary3_cleanup(cpqary3p, cleanstatus); in cpqary3_attach()
438 cpqary3_intr_onoff(cpqary3p, CPQARY3_INTR_ENABLE); in cpqary3_attach()
439 if (cpqary3p->host_support & 0x4) in cpqary3_attach()
440 cpqary3_lockup_intr_onoff(cpqary3p, CPQARY3_LOCKUP_INTR_ENABLE); in cpqary3_attach()
449 if (cpqary3p->noe_support == 1) { in cpqary3_attach()
452 cpqary3_send_NOE_command(cpqary3p, in cpqary3_attach()
490 cpqary3_t *cpqary3p; in cpqary3_detach() local
504 cpqary3p = (cpqary3_t *)hba_tran->tran_hba_private; in cpqary3_detach()
508 cpqary3_flush_cache(cpqary3p); in cpqary3_detach()
512 cpqary3_cleanup(cpqary3p, CPQARY3_CLEAN_ALL); in cpqary3_detach()
532 cpqary3_t *cpqary3p; in cpqary3_ioctl() local
558 cpqary3p = (cpqary3_t *)ddi_get_soft_state(cpqary3_state, instance); in cpqary3_ioctl()
562 if (!cpqary3p) { in cpqary3_ioctl()
585 cpqary3_ioctl_ctlr_info(arg, cpqary3p, mode); in cpqary3_ioctl()
590 cpqary3_ioctl_bmic_pass(arg, cpqary3p, mode); in cpqary3_ioctl()
595 cpqary3_ioctl_scsi_pass(arg, cpqary3p, mode); in cpqary3_ioctl()
616 cpqary3_cleanup(cpqary3_t *cpqary3p, uint32_t status) in cpqary3_cleanup() argument
622 ASSERT(cpqary3p != NULL); in cpqary3_cleanup()
636 if (CPQARY3_SUCCESS == cpqary3_disable_NOE_command(cpqary3p)) { in cpqary3_cleanup()
637 mutex_enter(&cpqary3p->hw_mutex); in cpqary3_cleanup()
640 cv_timedwait_sig(&cpqary3p->cv_noe_wait, in cpqary3_cleanup()
641 &cpqary3p->hw_mutex, in cpqary3_cleanup()
647 mutex_exit(&cpqary3p->hw_mutex); in cpqary3_cleanup()
665 ddi_remove_intr(cpqary3p->dip, 0, cpqary3p->hw_iblock_cookie); in cpqary3_cleanup()
668 ddi_remove_softintr(cpqary3p->cpqary3_softintr_id); in cpqary3_cleanup()
670 if ((status & CPQARY3_TICK_TMOUT_REGD) && cpqary3p->tick_tmout_id) { in cpqary3_cleanup()
671 VERIFY(untimeout(cpqary3p->tick_tmout_id) >= 0); in cpqary3_cleanup()
672 cpqary3p->tick_tmout_id = NULL; in cpqary3_cleanup()
676 (void) sprintf(node_name, "cpqary3%d", cpqary3p->instance); in cpqary3_cleanup()
677 ddi_remove_minor_node(cpqary3p->dip, node_name); in cpqary3_cleanup()
681 (void) scsi_hba_detach(cpqary3p->dip); in cpqary3_cleanup()
684 scsi_hba_tran_free(cpqary3p->hba_tran); in cpqary3_cleanup()
687 mutex_enter(&cpqary3p->hw_mutex); in cpqary3_cleanup()
689 cv_destroy(&cpqary3p->cv_abort_wait); in cpqary3_cleanup()
690 cv_destroy(&cpqary3p->cv_flushcache_wait); in cpqary3_cleanup()
691 cv_destroy(&cpqary3p->cv_noe_wait); in cpqary3_cleanup()
692 cv_destroy(&cpqary3p->cv_immediate_wait); in cpqary3_cleanup()
693 cv_destroy(&cpqary3p->cv_ioctl_wait); in cpqary3_cleanup()
696 if (cpqary3p->cpqary3_tgtp[targ] == NULL) in cpqary3_cleanup()
698 MEM_SFREE(cpqary3p->cpqary3_tgtp[targ], in cpqary3_cleanup()
702 mutex_exit(&cpqary3p->hw_mutex); in cpqary3_cleanup()
704 cpqary3_memfini(cpqary3p, CPQARY3_MEMLIST_DONE | in cpqary3_cleanup()
709 mutex_destroy(&cpqary3p->sw_mutex); in cpqary3_cleanup()
712 mutex_destroy(&cpqary3p->hw_mutex); in cpqary3_cleanup()
718 if (cpqary3p->idr_handle) in cpqary3_cleanup()
719 ddi_regs_map_free(&cpqary3p->idr_handle); in cpqary3_cleanup()
720 if (cpqary3p->isr_handle) in cpqary3_cleanup()
721 ddi_regs_map_free(&cpqary3p->isr_handle); in cpqary3_cleanup()
722 if (cpqary3p->imr_handle) in cpqary3_cleanup()
723 ddi_regs_map_free(&cpqary3p->imr_handle); in cpqary3_cleanup()
724 if (cpqary3p->ipq_handle) in cpqary3_cleanup()
725 ddi_regs_map_free(&cpqary3p->ipq_handle); in cpqary3_cleanup()
726 if (cpqary3p->opq_handle) in cpqary3_cleanup()
727 ddi_regs_map_free(&cpqary3p->opq_handle); in cpqary3_cleanup()
728 if (cpqary3p->ct_handle) in cpqary3_cleanup()
729 ddi_regs_map_free(&cpqary3p->ct_handle); in cpqary3_cleanup()
734 ddi_get_instance(cpqary3p->dip)); in cpqary3_cleanup()
753 cpqary3_update_ctlrdetails(cpqary3_t *cpqary3p, uint32_t *cleanstatus) in cpqary3_update_ctlrdetails() argument
779 RETURN_FAILURE_IF_NULL(cpqary3p); in cpqary3_update_ctlrdetails()
786 if (ddi_slaveonly(cpqary3p->dip) == DDI_SUCCESS) in cpqary3_update_ctlrdetails()
795 if (ddi_getlongprop(DDI_DEV_T_NONE, cpqary3p->dip, DDI_PROP_DONTPASS, in cpqary3_update_ctlrdetails()
799 cpqary3p->bus = PCI_REG_BUS_G(*regp); in cpqary3_update_ctlrdetails()
800 cpqary3p->dev = PCI_REG_DEV_G(*regp); in cpqary3_update_ctlrdetails()
801 cpqary3p->fun = PCI_REG_FUNC_G(*regp); in cpqary3_update_ctlrdetails()
845 if (pci_config_setup(cpqary3p->dip, &pci_handle) != DDI_SUCCESS) in cpqary3_update_ctlrdetails()
848 cpqary3p->irq = pci_config_get8(pci_handle, PCI_CONF_ILINE); in cpqary3_update_ctlrdetails()
849 cpqary3p->board_id = in cpqary3_update_ctlrdetails()
860 cpqary3p->bddef = cpqary3_bd_getbybid(cpqary3p->board_id); in cpqary3_update_ctlrdetails()
861 if (cpqary3p->bddef == NULL) { in cpqary3_update_ctlrdetails()
864 cpqary3p->board_id); in cpqary3_update_ctlrdetails()
867 map_len = cpqary3p->bddef->bd_maplen; in cpqary3_update_ctlrdetails()
868 (void) strcpy(cpqary3p->hba_name, cpqary3p->bddef->bd_dispname); in cpqary3_update_ctlrdetails()
880 retvalue = ddi_regs_map_setup(cpqary3p->dip, in cpqary3_update_ctlrdetails()
882 (caddr_t *)&cpqary3p->idr, (offset_t)I2O_IBDB_SET, map_len, in cpqary3_update_ctlrdetails()
883 &cpqary3_dev_attributes, &cpqary3p->idr_handle); in cpqary3_update_ctlrdetails()
896 retvalue = ddi_regs_map_setup(cpqary3p->dip, in cpqary3_update_ctlrdetails()
898 (caddr_t *)&cpqary3p->odr, (offset_t)I2O_OBDB_STATUS, map_len, in cpqary3_update_ctlrdetails()
899 &cpqary3_dev_attributes, &cpqary3p->odr_handle); in cpqary3_update_ctlrdetails()
911 retvalue = ddi_regs_map_setup(cpqary3p->dip, in cpqary3_update_ctlrdetails()
913 (caddr_t *)&cpqary3p->odr_cl, (offset_t)I2O_OBDB_CLEAR, map_len, in cpqary3_update_ctlrdetails()
914 &cpqary3_dev_attributes, &cpqary3p->odr_cl_handle); in cpqary3_update_ctlrdetails()
927 retvalue = ddi_regs_map_setup(cpqary3p->dip, in cpqary3_update_ctlrdetails()
929 (caddr_t *)&cpqary3p->spr0, (offset_t)I2O_CTLR_INIT, map_len, in cpqary3_update_ctlrdetails()
930 &cpqary3_dev_attributes, &cpqary3p->spr0_handle); in cpqary3_update_ctlrdetails()
946 retvalue = ddi_regs_map_setup(cpqary3p->dip, in cpqary3_update_ctlrdetails()
948 (caddr_t *)&cpqary3p->isr, (offset_t)I2O_INT_STATUS, map_len, in cpqary3_update_ctlrdetails()
949 &cpqary3_dev_attributes, &cpqary3p->isr_handle); in cpqary3_update_ctlrdetails()
961 retvalue = ddi_regs_map_setup(cpqary3p->dip, in cpqary3_update_ctlrdetails()
963 (caddr_t *)&cpqary3p->imr, (offset_t)I2O_INT_MASK, map_len, in cpqary3_update_ctlrdetails()
964 &cpqary3_dev_attributes, &cpqary3p->imr_handle); in cpqary3_update_ctlrdetails()
976 retvalue = ddi_regs_map_setup(cpqary3p->dip, in cpqary3_update_ctlrdetails()
978 (caddr_t *)&cpqary3p->ipq, (offset_t)I2O_IBPOST_Q, map_len, in cpqary3_update_ctlrdetails()
979 &cpqary3_dev_attributes, &cpqary3p->ipq_handle); in cpqary3_update_ctlrdetails()
991 retvalue = ddi_regs_map_setup(cpqary3p->dip, in cpqary3_update_ctlrdetails()
992 mem_bar0, /* INDEX_PCI_BASE0, */ (caddr_t *)&cpqary3p->opq, in cpqary3_update_ctlrdetails()
994 &cpqary3p->opq_handle); in cpqary3_update_ctlrdetails()
1011 retvalue = ddi_regs_map_setup(cpqary3p->dip, in cpqary3_update_ctlrdetails()
1026 retvalue = ddi_regs_map_setup(cpqary3p->dip, in cpqary3_update_ctlrdetails()
1074 retvalue = ddi_regs_map_setup(cpqary3p->dip, in cpqary3_update_ctlrdetails()
1076 (caddr_t *)&cpqary3p->ct, (offset_t)ct_memoff_val, in cpqary3_update_ctlrdetails()
1077 sizeof (CfgTable_t), &cpqary3_dev_attributes, &cpqary3p->ct_handle); in cpqary3_update_ctlrdetails()
1091 retvalue = ddi_regs_map_setup(cpqary3p->dip, in cpqary3_update_ctlrdetails()
1093 (caddr_t *)&cpqary3p->cp, in cpqary3_update_ctlrdetails()
1094 (offset_t)(ct_memoff_val + cpqary3p->ct->TransportMethodOffset), in cpqary3_update_ctlrdetails()
1096 &cpqary3p->cp_handle); in cpqary3_update_ctlrdetails()