Lines Matching refs:ha

280 static void ips_free_flash_copperhead(ips_ha_t * ha);
331 static int ips_abort_init(ips_ha_t * ha, int index);
337 static int ips_poll_for_flush_complete(ips_ha_t * ha);
338 static void ips_flush_and_reset(ips_ha_t *ha);
583 ips_setup_funclist(ips_ha_t * ha) in ips_setup_funclist() argument
589 if (IPS_IS_MORPHEUS(ha) || IPS_IS_MARCO(ha)) { in ips_setup_funclist()
591 ha->func.isintr = ips_isintr_morpheus; in ips_setup_funclist()
592 ha->func.isinit = ips_isinit_morpheus; in ips_setup_funclist()
593 ha->func.issue = ips_issue_i2o_memio; in ips_setup_funclist()
594 ha->func.init = ips_init_morpheus; in ips_setup_funclist()
595 ha->func.statupd = ips_statupd_morpheus; in ips_setup_funclist()
596 ha->func.reset = ips_reset_morpheus; in ips_setup_funclist()
597 ha->func.intr = ips_intr_morpheus; in ips_setup_funclist()
598 ha->func.enableint = ips_enable_int_morpheus; in ips_setup_funclist()
599 } else if (IPS_USE_MEMIO(ha)) { in ips_setup_funclist()
601 ha->func.isintr = ips_isintr_copperhead_memio; in ips_setup_funclist()
602 ha->func.isinit = ips_isinit_copperhead_memio; in ips_setup_funclist()
603 ha->func.init = ips_init_copperhead_memio; in ips_setup_funclist()
604 ha->func.statupd = ips_statupd_copperhead_memio; in ips_setup_funclist()
605 ha->func.statinit = ips_statinit_memio; in ips_setup_funclist()
606 ha->func.reset = ips_reset_copperhead_memio; in ips_setup_funclist()
607 ha->func.intr = ips_intr_copperhead; in ips_setup_funclist()
608 ha->func.erasebios = ips_erase_bios_memio; in ips_setup_funclist()
609 ha->func.programbios = ips_program_bios_memio; in ips_setup_funclist()
610 ha->func.verifybios = ips_verify_bios_memio; in ips_setup_funclist()
611 ha->func.enableint = ips_enable_int_copperhead_memio; in ips_setup_funclist()
612 if (IPS_USE_I2O_DELIVER(ha)) in ips_setup_funclist()
613 ha->func.issue = ips_issue_i2o_memio; in ips_setup_funclist()
615 ha->func.issue = ips_issue_copperhead_memio; in ips_setup_funclist()
618 ha->func.isintr = ips_isintr_copperhead; in ips_setup_funclist()
619 ha->func.isinit = ips_isinit_copperhead; in ips_setup_funclist()
620 ha->func.init = ips_init_copperhead; in ips_setup_funclist()
621 ha->func.statupd = ips_statupd_copperhead; in ips_setup_funclist()
622 ha->func.statinit = ips_statinit; in ips_setup_funclist()
623 ha->func.reset = ips_reset_copperhead; in ips_setup_funclist()
624 ha->func.intr = ips_intr_copperhead; in ips_setup_funclist()
625 ha->func.erasebios = ips_erase_bios; in ips_setup_funclist()
626 ha->func.programbios = ips_program_bios; in ips_setup_funclist()
627 ha->func.verifybios = ips_verify_bios; in ips_setup_funclist()
628 ha->func.enableint = ips_enable_int_copperhead; in ips_setup_funclist()
630 if (IPS_USE_I2O_DELIVER(ha)) in ips_setup_funclist()
631 ha->func.issue = ips_issue_i2o; in ips_setup_funclist()
633 ha->func.issue = ips_issue_copperhead; in ips_setup_funclist()
649 ips_ha_t *ha; in ips_release() local
664 ha = IPS_HA(sh); in ips_release()
666 if (!ha) in ips_release()
670 scb = &ha->scbs[ha->max_cmds - 1]; in ips_release()
672 ips_init_scb(ha, scb); in ips_release()
678 scb->cmd.flush_cache.command_id = IPS_COMMAND_ID(ha, scb); in ips_release()
685 IPS_PRINTK(KERN_WARNING, ha->pcidev, "Flushing Cache.\n"); in ips_release()
688 if (ips_send_wait(ha, scb, ips_cmd_timeout, IPS_INTR_ON) == IPS_FAILURE) in ips_release()
689 IPS_PRINTK(KERN_WARNING, ha->pcidev, "Incomplete Flush.\n"); in ips_release()
691 IPS_PRINTK(KERN_WARNING, ha->pcidev, "Flushing Complete.\n"); in ips_release()
697 ips_free(ha); in ips_release()
700 free_irq(ha->pcidev->irq, ha); in ips_release()
720 ips_ha_t *ha; in ips_halt() local
728 ha = (ips_ha_t *) ips_ha[i]; in ips_halt()
730 if (!ha) in ips_halt()
733 if (!ha->active) in ips_halt()
737 scb = &ha->scbs[ha->max_cmds - 1]; in ips_halt()
739 ips_init_scb(ha, scb); in ips_halt()
745 scb->cmd.flush_cache.command_id = IPS_COMMAND_ID(ha, scb); in ips_halt()
752 IPS_PRINTK(KERN_WARNING, ha->pcidev, "Flushing Cache.\n"); in ips_halt()
755 if (ips_send_wait(ha, scb, ips_cmd_timeout, IPS_INTR_ON) == in ips_halt()
757 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_halt()
760 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_halt()
778 ips_ha_t *ha; in ips_eh_abort() local
789 ha = (ips_ha_t *) SC->device->host->hostdata; in ips_eh_abort()
791 if (!ha) in ips_eh_abort()
794 if (!ha->active) in ips_eh_abort()
800 item = ha->copp_waitlist.head; in ips_eh_abort()
806 ips_removeq_copp(&ha->copp_waitlist, item); in ips_eh_abort()
810 } else if (ips_removeq_wait(&ha->scb_waitlist, SC)) { in ips_eh_abort()
837 ips_ha_t *ha; in __ips_eh_reset() local
852 ha = (ips_ha_t *) SC->device->host->hostdata; in __ips_eh_reset()
854 if (!ha) { in __ips_eh_reset()
860 if (!ha->active) in __ips_eh_reset()
873 if (ha->ioctl_reset == 0) { /* IF Not an IOCTL Requested Reset */ in __ips_eh_reset()
874 scb = &ha->scbs[ha->max_cmds - 1]; in __ips_eh_reset()
876 ips_init_scb(ha, scb); in __ips_eh_reset()
882 scb->cmd.flush_cache.command_id = IPS_COMMAND_ID(ha, scb); in __ips_eh_reset()
890 ret = ips_send_wait(ha, scb, ips_cmd_timeout, IPS_INTR_IORL); in __ips_eh_reset()
892 IPS_PRINTK(KERN_NOTICE, ha->pcidev, in __ips_eh_reset()
901 ha->ioctl_reset = 0; /* Reset the IOCTL Requested Reset Flag */ in __ips_eh_reset()
907 IPS_PRINTK(KERN_NOTICE, ha->pcidev, "Resetting controller.\n"); in __ips_eh_reset()
908 ret = (*ha->func.reset) (ha); in __ips_eh_reset()
913 IPS_PRINTK(KERN_NOTICE, ha->pcidev, in __ips_eh_reset()
918 ips_name, ha->host_num); in __ips_eh_reset()
920 while ((scb = ips_removeq_scb_head(&ha->scb_activelist))) { in __ips_eh_reset()
923 ips_freescb(ha, scb); in __ips_eh_reset()
928 ips_name, ha->host_num); in __ips_eh_reset()
930 while ((scsi_cmd = ips_removeq_wait_head(&ha->scb_waitlist))) { in __ips_eh_reset()
935 ha->active = false; in __ips_eh_reset()
939 if (!ips_clear_adapter(ha, IPS_INTR_IORL)) { in __ips_eh_reset()
942 IPS_PRINTK(KERN_NOTICE, ha->pcidev, in __ips_eh_reset()
947 ips_name, ha->host_num); in __ips_eh_reset()
949 while ((scb = ips_removeq_scb_head(&ha->scb_activelist))) { in __ips_eh_reset()
952 ips_freescb(ha, scb); in __ips_eh_reset()
957 ips_name, ha->host_num); in __ips_eh_reset()
959 while ((scsi_cmd = ips_removeq_wait_head(&ha->scb_waitlist))) { in __ips_eh_reset()
964 ha->active = false; in __ips_eh_reset()
969 if (le32_to_cpu(ha->subsys->param[3]) & 0x300000) { in __ips_eh_reset()
970 ha->last_ffdc = ktime_get_real_seconds(); in __ips_eh_reset()
971 ha->reset_count++; in __ips_eh_reset()
972 ips_ffdc_reset(ha, IPS_INTR_IORL); in __ips_eh_reset()
976 DEBUG_VAR(1, "(%s%d) Failing active commands", ips_name, ha->host_num); in __ips_eh_reset()
978 while ((scb = ips_removeq_scb_head(&ha->scb_activelist))) { in __ips_eh_reset()
981 ips_freescb(ha, scb); in __ips_eh_reset()
985 for (i = 1; i < ha->nbus; i++) in __ips_eh_reset()
986 ha->dcdb_active[i - 1] = 0; in __ips_eh_reset()
989 ha->num_ioctl = 0; in __ips_eh_reset()
991 ips_next(ha, IPS_INTR_IORL); in __ips_eh_reset()
1024 ips_ha_t *ha; in ips_queue_lck() local
1029 ha = (ips_ha_t *) SC->device->host->hostdata; in ips_queue_lck()
1031 if (!ha) in ips_queue_lck()
1034 if (!ha->active) in ips_queue_lck()
1038 if (ha->copp_waitlist.count == IPS_MAX_IOCTL_QUEUE) { in ips_queue_lck()
1044 } else if (ha->scb_waitlist.count == IPS_MAX_QUEUE) { in ips_queue_lck()
1053 ha->host_num, in ips_queue_lck()
1059 && (scmd_id(SC) == ha->ha_id[scmd_channel(SC)])) { in ips_queue_lck()
1076 if (ha->scb_activelist.count != 0) { in ips_queue_lck()
1081 ha->ioctl_reset = 1; /* This reset request is from an IOCTL */ in ips_queue_lck()
1101 ips_putq_copp_tail(&ha->copp_waitlist, scratch); in ips_queue_lck()
1103 ips_putq_wait_tail(&ha->scb_waitlist, SC); in ips_queue_lck()
1106 ips_next(ha, IPS_INTR_IORL); in ips_queue_lck()
1130 ips_ha_t *ha = (ips_ha_t *) sdev->host->hostdata; in DEF_SCSI_QCMD() local
1137 if (!ha) in DEF_SCSI_QCMD()
1141 if (!ha->active) in DEF_SCSI_QCMD()
1144 if (!ips_read_adapter_status(ha, IPS_INTR_ON)) in DEF_SCSI_QCMD()
1148 if ((capacity > 0x400000) && ((ha->enq->ucMiscFlag & 0x8) == 0)) { in DEF_SCSI_QCMD()
1180 ips_ha_t *ha; in ips_sdev_configure() local
1183 ha = IPS_HA(SDptr->host); in ips_sdev_configure()
1185 min = ha->max_cmds / 2; in ips_sdev_configure()
1186 if (ha->enq->ucLogDriveCount <= 2) in ips_sdev_configure()
1187 min = ha->max_cmds - 1; in ips_sdev_configure()
1208 ips_ha_t *ha; in do_ipsintr() local
1214 ha = (ips_ha_t *) dev_id; in do_ipsintr()
1215 if (!ha) in do_ipsintr()
1217 host = ips_sh[ha->host_num]; in do_ipsintr()
1220 (*ha->func.intr) (ha); in do_ipsintr()
1226 if (!ha->active) { in do_ipsintr()
1231 irqstatus = (*ha->func.intr) (ha); in do_ipsintr()
1236 ips_next(ha, IPS_INTR_ON); in do_ipsintr()
1252 ips_intr_copperhead(ips_ha_t * ha) in ips_intr_copperhead() argument
1261 if (!ha) in ips_intr_copperhead()
1264 if (!ha->active) in ips_intr_copperhead()
1267 intrstatus = (*ha->func.isintr) (ha); in ips_intr_copperhead()
1278 sp = &ha->sp; in ips_intr_copperhead()
1280 intrstatus = (*ha->func.isintr) (ha); in ips_intr_copperhead()
1285 cstatus.value = (*ha->func.statupd) (ha); in ips_intr_copperhead()
1292 ips_chkstatus(ha, &cstatus); in ips_intr_copperhead()
1299 (*scb->callback) (ha, scb); in ips_intr_copperhead()
1316 ips_intr_morpheus(ips_ha_t * ha) in ips_intr_morpheus() argument
1325 if (!ha) in ips_intr_morpheus()
1328 if (!ha->active) in ips_intr_morpheus()
1331 intrstatus = (*ha->func.isintr) (ha); in ips_intr_morpheus()
1342 sp = &ha->sp; in ips_intr_morpheus()
1344 intrstatus = (*ha->func.isintr) (ha); in ips_intr_morpheus()
1349 cstatus.value = (*ha->func.statupd) (ha); in ips_intr_morpheus()
1356 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_intr_morpheus()
1362 ips_chkstatus(ha, &cstatus); in ips_intr_morpheus()
1369 (*scb->callback) (ha, scb); in ips_intr_morpheus()
1388 ips_ha_t *ha; in ips_info() local
1392 ha = IPS_HA(SH); in ips_info()
1394 if (!ha) in ips_info()
1403 if (ha->ad_type > 0 && ha->ad_type <= MAX_ADAPTER_NAME) { in ips_info()
1405 strcat(bp, ips_adapter_name[ha->ad_type - 1]); in ips_info()
1416 ips_ha_t *ha = NULL; in ips_write_info() local
1422 ha = (ips_ha_t *) ips_sh[i]->hostdata; in ips_write_info()
1428 if (!ha) in ips_write_info()
1438 ips_ha_t *ha = NULL; in ips_show_info() local
1444 ha = (ips_ha_t *) ips_sh[i]->hostdata; in ips_show_info()
1450 if (!ha) in ips_show_info()
1453 return ips_host_info(ha, m); in ips_show_info()
1509 ips_alloc_passthru_buffer(ips_ha_t * ha, int length) in ips_alloc_passthru_buffer() argument
1514 if (ha->ioctl_data && length <= ha->ioctl_len) in ips_alloc_passthru_buffer()
1517 bigger_buf = dma_alloc_coherent(&ha->pcidev->dev, length, &dma_busaddr, in ips_alloc_passthru_buffer()
1521 dma_free_coherent(&ha->pcidev->dev, ha->ioctl_len, in ips_alloc_passthru_buffer()
1522 ha->ioctl_data, ha->ioctl_busaddr); in ips_alloc_passthru_buffer()
1524 ha->ioctl_data = (char *) bigger_buf; in ips_alloc_passthru_buffer()
1525 ha->ioctl_len = length; in ips_alloc_passthru_buffer()
1526 ha->ioctl_busaddr = dma_busaddr; in ips_alloc_passthru_buffer()
1543 ips_make_passthru(ips_ha_t *ha, struct scsi_cmnd *SC, ips_scb_t *scb, int intr) in ips_make_passthru() argument
1558 ips_name, ha->host_num); in ips_make_passthru()
1561 if (ips_alloc_passthru_buffer(ha, length)) { in ips_make_passthru()
1564 if (ha->ioctl_data) { in ips_make_passthru()
1565 pt = (ips_passthru_t *) ha->ioctl_data; in ips_make_passthru()
1573 ha->ioctl_datasize = length; in ips_make_passthru()
1575 ips_scmd_buf_read(SC, ha->ioctl_data, ha->ioctl_datasize); in ips_make_passthru()
1576 pt = (ips_passthru_t *) ha->ioctl_data; in ips_make_passthru()
1590 memcpy(ha->ioctl_data + sizeof (ips_passthru_t), in ips_make_passthru()
1592 ips_scmd_buf_write(SC, ha->ioctl_data, in ips_make_passthru()
1605 ips_name, ha->host_num); in ips_make_passthru()
1610 if (ha->pcidev->device == IPS_DEVICEID_COPPERHEAD && in ips_make_passthru()
1613 ret = ips_flash_copperhead(ha, pt, scb); in ips_make_passthru()
1614 ips_scmd_buf_write(SC, ha->ioctl_data, in ips_make_passthru()
1618 if (ips_usrcmd(ha, pt, scb)) in ips_make_passthru()
1637 ips_flash_copperhead(ips_ha_t * ha, ips_passthru_t * pt, ips_scb_t * scb) in ips_flash_copperhead() argument
1643 if (IPS_IS_TROMBONE(ha) && pt->CoppCP.cmd.flashfw.type == IPS_FW_IMAGE) { in ips_flash_copperhead()
1644 if (ips_usrcmd(ha, pt, scb)) in ips_flash_copperhead()
1657 return ips_flash_bios(ha, pt, scb); in ips_flash_copperhead()
1660 ha->flash_data = ips_FlashData; in ips_flash_copperhead()
1661 ha->flash_busaddr = ips_flashbusaddr; in ips_flash_copperhead()
1662 ha->flash_len = PAGE_SIZE << 7; in ips_flash_copperhead()
1663 ha->flash_datasize = 0; in ips_flash_copperhead()
1664 } else if (!ha->flash_data) { in ips_flash_copperhead()
1667 ha->flash_data = dma_alloc_coherent(&ha->pcidev->dev, in ips_flash_copperhead()
1668 datasize, &ha->flash_busaddr, GFP_KERNEL); in ips_flash_copperhead()
1669 if (!ha->flash_data){ in ips_flash_copperhead()
1673 ha->flash_datasize = 0; in ips_flash_copperhead()
1674 ha->flash_len = datasize; in ips_flash_copperhead()
1678 if (pt->CoppCP.cmd.flashfw.count + ha->flash_datasize > in ips_flash_copperhead()
1679 ha->flash_len) { in ips_flash_copperhead()
1680 ips_free_flash_copperhead(ha); in ips_flash_copperhead()
1681 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_flash_copperhead()
1686 if (!ha->flash_data) in ips_flash_copperhead()
1689 memcpy(&ha->flash_data[ha->flash_datasize], pt + 1, in ips_flash_copperhead()
1691 ha->flash_datasize += pt->CoppCP.cmd.flashfw.count; in ips_flash_copperhead()
1695 return ips_flash_bios(ha, pt, scb); in ips_flash_copperhead()
1697 return ips_flash_firmware(ha, pt, scb); in ips_flash_copperhead()
1708 ips_flash_bios(ips_ha_t * ha, ips_passthru_t * pt, ips_scb_t * scb) in ips_flash_bios() argument
1713 if ((!ha->func.programbios) || (!ha->func.erasebios) || in ips_flash_bios()
1714 (!ha->func.verifybios)) in ips_flash_bios()
1716 if ((*ha->func.erasebios) (ha)) { in ips_flash_bios()
1719 ips_name, ha->host_num); in ips_flash_bios()
1722 if ((*ha->func.programbios) (ha, in ips_flash_bios()
1723 ha->flash_data + in ips_flash_bios()
1725 ha->flash_datasize - in ips_flash_bios()
1729 ips_name, ha->host_num); in ips_flash_bios()
1732 if ((*ha->func.verifybios) (ha, in ips_flash_bios()
1733 ha->flash_data + in ips_flash_bios()
1735 ha->flash_datasize - in ips_flash_bios()
1739 ips_name, ha->host_num); in ips_flash_bios()
1742 ips_free_flash_copperhead(ha); in ips_flash_bios()
1746 if (!ha->func.erasebios) in ips_flash_bios()
1748 if ((*ha->func.erasebios) (ha)) { in ips_flash_bios()
1751 ips_name, ha->host_num); in ips_flash_bios()
1759 ips_free_flash_copperhead(ha); in ips_flash_bios()
1772 ips_fill_scb_sg_single(ips_ha_t * ha, dma_addr_t busaddr, in ips_fill_scb_sg_single() argument
1778 if ((scb->data_len + e_len) > ha->max_xfer) { in ips_fill_scb_sg_single()
1779 e_len = ha->max_xfer - scb->data_len; in ips_fill_scb_sg_single()
1787 if (IPS_USE_ENH_SGLIST(ha)) { in ips_fill_scb_sg_single()
1810 ips_flash_firmware(ips_ha_t * ha, ips_passthru_t * pt, ips_scb_t * scb) in ips_flash_firmware() argument
1819 pt->CoppCP.cmd.flashfw.count = cpu_to_le32(ha->flash_datasize); in ips_flash_firmware()
1823 ips_free_flash_copperhead(ha); in ips_flash_firmware()
1844 scb->data_len = ha->flash_datasize; in ips_flash_firmware()
1846 dma_map_single(&ha->pcidev->dev, ha->flash_data, scb->data_len, in ips_flash_firmware()
1849 scb->cmd.flashfw.command_id = IPS_COMMAND_ID(ha, scb); in ips_flash_firmware()
1863 ips_free_flash_copperhead(ips_ha_t * ha) in ips_free_flash_copperhead() argument
1865 if (ha->flash_data == ips_FlashData) in ips_free_flash_copperhead()
1867 else if (ha->flash_data) in ips_free_flash_copperhead()
1868 dma_free_coherent(&ha->pcidev->dev, ha->flash_len, in ips_free_flash_copperhead()
1869 ha->flash_data, ha->flash_busaddr); in ips_free_flash_copperhead()
1870 ha->flash_data = NULL; in ips_free_flash_copperhead()
1883 ips_usrcmd(ips_ha_t * ha, ips_passthru_t * pt, ips_scb_t * scb) in ips_usrcmd() argument
1890 if ((!scb) || (!pt) || (!ha)) in ips_usrcmd()
1912 scb->cmd.basic_io.command_id = IPS_COMMAND_ID(ha, scb); in ips_usrcmd()
1922 scb->data_busaddr = ha->ioctl_busaddr + sizeof (ips_passthru_t); in ips_usrcmd()
1971 ips_cleanup_passthru(ips_ha_t * ha, ips_scb_t * scb) in ips_cleanup_passthru() argument
1979 ips_name, ha->host_num); in ips_cleanup_passthru()
1983 pt = (ips_passthru_t *) ha->ioctl_data; in ips_cleanup_passthru()
1991 pt->AdapterType = ha->ad_type; in ips_cleanup_passthru()
1993 if (ha->pcidev->device == IPS_DEVICEID_COPPERHEAD && in ips_cleanup_passthru()
1996 ips_free_flash_copperhead(ha); in ips_cleanup_passthru()
1998 ips_scmd_buf_write(scb->scsi_cmd, ha->ioctl_data, ha->ioctl_datasize); in ips_cleanup_passthru()
2011 ips_host_info(ips_ha_t *ha, struct seq_file *m) in ips_host_info() argument
2017 if ((le32_to_cpu(ha->nvram->signature) == IPS_NVRAM_P5_SIG) && in ips_host_info()
2018 (le16_to_cpu(ha->nvram->adapter_type) != 0)) in ips_host_info()
2020 ips_adapter_name[ha->ad_type - 1]); in ips_host_info()
2024 if (ha->io_addr) in ips_host_info()
2027 ha->io_addr, ha->io_len); in ips_host_info()
2029 if (ha->mem_addr) { in ips_host_info()
2032 ha->mem_addr, ha->mem_len); in ips_host_info()
2035 (unsigned long)ha->mem_ptr); in ips_host_info()
2038 seq_printf(m, "\tIRQ number : %d\n", ha->pcidev->irq); in ips_host_info()
2043 if (le32_to_cpu(ha->nvram->signature) == IPS_NVRAM_P5_SIG) { in ips_host_info()
2044 if (ha->nvram->bios_low[3] == 0) { in ips_host_info()
2047 ha->nvram->bios_high[0], ha->nvram->bios_high[1], in ips_host_info()
2048 ha->nvram->bios_high[2], ha->nvram->bios_high[3], in ips_host_info()
2049 ha->nvram->bios_low[0], ha->nvram->bios_low[1], in ips_host_info()
2050 ha->nvram->bios_low[2]); in ips_host_info()
2055 ha->nvram->bios_high[0], ha->nvram->bios_high[1], in ips_host_info()
2056 ha->nvram->bios_high[2], ha->nvram->bios_high[3], in ips_host_info()
2057 ha->nvram->bios_low[0], ha->nvram->bios_low[1], in ips_host_info()
2058 ha->nvram->bios_low[2], ha->nvram->bios_low[3]); in ips_host_info()
2063 if (ha->enq->CodeBlkVersion[7] == 0) { in ips_host_info()
2066 ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1], in ips_host_info()
2067 ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3], in ips_host_info()
2068 ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5], in ips_host_info()
2069 ha->enq->CodeBlkVersion[6]); in ips_host_info()
2073 ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1], in ips_host_info()
2074 ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3], in ips_host_info()
2075 ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5], in ips_host_info()
2076 ha->enq->CodeBlkVersion[6], ha->enq->CodeBlkVersion[7]); in ips_host_info()
2079 if (ha->enq->BootBlkVersion[7] == 0) { in ips_host_info()
2082 ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1], in ips_host_info()
2083 ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3], in ips_host_info()
2084 ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5], in ips_host_info()
2085 ha->enq->BootBlkVersion[6]); in ips_host_info()
2089 ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1], in ips_host_info()
2090 ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3], in ips_host_info()
2091 ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5], in ips_host_info()
2092 ha->enq->BootBlkVersion[6], ha->enq->BootBlkVersion[7]); in ips_host_info()
2102 ha->enq->ucMaxPhysicalDevices); in ips_host_info()
2104 ha->max_cmds); in ips_host_info()
2106 ha->scb_waitlist.count); in ips_host_info()
2108 ha->scb_activelist.count - ha->num_ioctl); in ips_host_info()
2110 ha->copp_waitlist.count); in ips_host_info()
2112 ha->num_ioctl); in ips_host_info()
2129 ips_identify_controller(ips_ha_t * ha) in ips_identify_controller() argument
2133 switch (ha->pcidev->device) { in ips_identify_controller()
2135 if (ha->pcidev->revision <= IPS_REVID_SERVERAID) { in ips_identify_controller()
2136 ha->ad_type = IPS_ADTYPE_SERVERAID; in ips_identify_controller()
2137 } else if (ha->pcidev->revision == IPS_REVID_SERVERAID2) { in ips_identify_controller()
2138 ha->ad_type = IPS_ADTYPE_SERVERAID2; in ips_identify_controller()
2139 } else if (ha->pcidev->revision == IPS_REVID_NAVAJO) { in ips_identify_controller()
2140 ha->ad_type = IPS_ADTYPE_NAVAJO; in ips_identify_controller()
2141 } else if ((ha->pcidev->revision == IPS_REVID_SERVERAID2) in ips_identify_controller()
2142 && (ha->slot_num == 0)) { in ips_identify_controller()
2143 ha->ad_type = IPS_ADTYPE_KIOWA; in ips_identify_controller()
2144 } else if ((ha->pcidev->revision >= IPS_REVID_CLARINETP1) && in ips_identify_controller()
2145 (ha->pcidev->revision <= IPS_REVID_CLARINETP3)) { in ips_identify_controller()
2146 if (ha->enq->ucMaxPhysicalDevices == 15) in ips_identify_controller()
2147 ha->ad_type = IPS_ADTYPE_SERVERAID3L; in ips_identify_controller()
2149 ha->ad_type = IPS_ADTYPE_SERVERAID3; in ips_identify_controller()
2150 } else if ((ha->pcidev->revision >= IPS_REVID_TROMBONE32) && in ips_identify_controller()
2151 (ha->pcidev->revision <= IPS_REVID_TROMBONE64)) { in ips_identify_controller()
2152 ha->ad_type = IPS_ADTYPE_SERVERAID4H; in ips_identify_controller()
2157 switch (ha->pcidev->subsystem_device) { in ips_identify_controller()
2159 ha->ad_type = IPS_ADTYPE_SERVERAID4L; in ips_identify_controller()
2163 ha->ad_type = IPS_ADTYPE_SERVERAID4M; in ips_identify_controller()
2167 ha->ad_type = IPS_ADTYPE_SERVERAID4MX; in ips_identify_controller()
2171 ha->ad_type = IPS_ADTYPE_SERVERAID4LX; in ips_identify_controller()
2175 ha->ad_type = IPS_ADTYPE_SERVERAID5I2; in ips_identify_controller()
2179 ha->ad_type = IPS_ADTYPE_SERVERAID5I1; in ips_identify_controller()
2186 switch (ha->pcidev->subsystem_device) { in ips_identify_controller()
2188 ha->ad_type = IPS_ADTYPE_SERVERAID6M; in ips_identify_controller()
2191 ha->ad_type = IPS_ADTYPE_SERVERAID6I; in ips_identify_controller()
2194 ha->ad_type = IPS_ADTYPE_SERVERAID7k; in ips_identify_controller()
2197 ha->ad_type = IPS_ADTYPE_SERVERAID7M; in ips_identify_controller()
2214 ips_get_bios_version(ips_ha_t * ha, int intr) in ips_get_bios_version() argument
2228 memcpy(ha->bios_version, " ?", 8); in ips_get_bios_version()
2230 if (ha->pcidev->device == IPS_DEVICEID_COPPERHEAD) { in ips_get_bios_version()
2231 if (IPS_USE_MEMIO(ha)) { in ips_get_bios_version()
2235 writel(0, ha->mem_ptr + IPS_REG_FLAP); in ips_get_bios_version()
2236 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2239 if (readb(ha->mem_ptr + IPS_REG_FLDP) != 0x55) in ips_get_bios_version()
2242 writel(1, ha->mem_ptr + IPS_REG_FLAP); in ips_get_bios_version()
2243 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2246 if (readb(ha->mem_ptr + IPS_REG_FLDP) != 0xAA) in ips_get_bios_version()
2250 writel(0x1FF, ha->mem_ptr + IPS_REG_FLAP); in ips_get_bios_version()
2251 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2254 major = readb(ha->mem_ptr + IPS_REG_FLDP); in ips_get_bios_version()
2257 writel(0x1FE, ha->mem_ptr + IPS_REG_FLAP); in ips_get_bios_version()
2258 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2260 minor = readb(ha->mem_ptr + IPS_REG_FLDP); in ips_get_bios_version()
2263 writel(0x1FD, ha->mem_ptr + IPS_REG_FLAP); in ips_get_bios_version()
2264 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2266 subminor = readb(ha->mem_ptr + IPS_REG_FLDP); in ips_get_bios_version()
2272 outl(0, ha->io_addr + IPS_REG_FLAP); in ips_get_bios_version()
2273 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2276 if (inb(ha->io_addr + IPS_REG_FLDP) != 0x55) in ips_get_bios_version()
2279 outl(1, ha->io_addr + IPS_REG_FLAP); in ips_get_bios_version()
2280 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2283 if (inb(ha->io_addr + IPS_REG_FLDP) != 0xAA) in ips_get_bios_version()
2287 outl(0x1FF, ha->io_addr + IPS_REG_FLAP); in ips_get_bios_version()
2288 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2291 major = inb(ha->io_addr + IPS_REG_FLDP); in ips_get_bios_version()
2294 outl(0x1FE, ha->io_addr + IPS_REG_FLAP); in ips_get_bios_version()
2295 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2298 minor = inb(ha->io_addr + IPS_REG_FLDP); in ips_get_bios_version()
2301 outl(0x1FD, ha->io_addr + IPS_REG_FLAP); in ips_get_bios_version()
2302 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2305 subminor = inb(ha->io_addr + IPS_REG_FLDP); in ips_get_bios_version()
2311 buffer = ha->ioctl_data; in ips_get_bios_version()
2315 scb = &ha->scbs[ha->max_cmds - 1]; in ips_get_bios_version()
2317 ips_init_scb(ha, scb); in ips_get_bios_version()
2323 scb->cmd.flashfw.command_id = IPS_COMMAND_ID(ha, scb); in ips_get_bios_version()
2330 scb->cmd.flashfw.buffer_addr = ha->ioctl_busaddr; in ips_get_bios_version()
2334 ips_send_wait(ha, scb, ips_cmd_timeout, in ips_get_bios_version()
2352 ha->bios_version[0] = hex_asc_upper_hi(major); in ips_get_bios_version()
2353 ha->bios_version[1] = '.'; in ips_get_bios_version()
2354 ha->bios_version[2] = hex_asc_upper_lo(major); in ips_get_bios_version()
2355 ha->bios_version[3] = hex_asc_upper_lo(subminor); in ips_get_bios_version()
2356 ha->bios_version[4] = '.'; in ips_get_bios_version()
2357 ha->bios_version[5] = hex_asc_upper_hi(minor); in ips_get_bios_version()
2358 ha->bios_version[6] = hex_asc_upper_lo(minor); in ips_get_bios_version()
2359 ha->bios_version[7] = 0; in ips_get_bios_version()
2374 ips_hainit(ips_ha_t * ha) in ips_hainit() argument
2380 if (!ha) in ips_hainit()
2383 if (ha->func.statinit) in ips_hainit()
2384 (*ha->func.statinit) (ha); in ips_hainit()
2386 if (ha->func.enableint) in ips_hainit()
2387 (*ha->func.enableint) (ha); in ips_hainit()
2390 ha->reset_count = 1; in ips_hainit()
2391 ha->last_ffdc = ktime_get_real_seconds(); in ips_hainit()
2392 ips_ffdc_reset(ha, IPS_INTR_IORL); in ips_hainit()
2394 if (!ips_read_config(ha, IPS_INTR_IORL)) { in ips_hainit()
2395 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_hainit()
2401 if (!ips_read_adapter_status(ha, IPS_INTR_IORL)) { in ips_hainit()
2402 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_hainit()
2409 ips_identify_controller(ha); in ips_hainit()
2411 if (!ips_read_subsystem_parameters(ha, IPS_INTR_IORL)) { in ips_hainit()
2412 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_hainit()
2419 if (!ips_write_driver_status(ha, IPS_INTR_IORL)) { in ips_hainit()
2420 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_hainit()
2427 if ((ha->conf->ucLogDriveCount > 0) && (ha->requires_esl == 1)) in ips_hainit()
2428 ips_clear_adapter(ha, IPS_INTR_IORL); in ips_hainit()
2431 ha->ntargets = IPS_MAX_TARGETS + 1; in ips_hainit()
2432 ha->nlun = 1; in ips_hainit()
2433 ha->nbus = (ha->enq->ucMaxPhysicalDevices / IPS_MAX_TARGETS) + 1; in ips_hainit()
2435 switch (ha->conf->logical_drive[0].ucStripeSize) { in ips_hainit()
2437 ha->max_xfer = 0x10000; in ips_hainit()
2441 ha->max_xfer = 0x20000; in ips_hainit()
2445 ha->max_xfer = 0x40000; in ips_hainit()
2450 ha->max_xfer = 0x80000; in ips_hainit()
2455 if (le32_to_cpu(ha->subsys->param[4]) & 0x1) { in ips_hainit()
2457 ha->max_cmds = ha->enq->ucConcurrentCmdCount; in ips_hainit()
2460 switch (ha->conf->logical_drive[0].ucStripeSize) { in ips_hainit()
2462 ha->max_cmds = 32; in ips_hainit()
2466 ha->max_cmds = 16; in ips_hainit()
2470 ha->max_cmds = 8; in ips_hainit()
2475 ha->max_cmds = 4; in ips_hainit()
2481 if ((ha->ad_type == IPS_ADTYPE_SERVERAID3L) || in ips_hainit()
2482 (ha->ad_type == IPS_ADTYPE_SERVERAID4L) || in ips_hainit()
2483 (ha->ad_type == IPS_ADTYPE_SERVERAID4LX)) { in ips_hainit()
2484 if ((ha->max_cmds > MaxLiteCmds) && (MaxLiteCmds)) in ips_hainit()
2485 ha->max_cmds = MaxLiteCmds; in ips_hainit()
2489 ha->ha_id[0] = IPS_ADAPTER_ID; in ips_hainit()
2490 for (i = 1; i < ha->nbus; i++) { in ips_hainit()
2491 ha->ha_id[i] = ha->conf->init_id[i - 1] & 0x1f; in ips_hainit()
2492 ha->dcdb_active[i - 1] = 0; in ips_hainit()
2508 ips_next(ips_ha_t * ha, int intr) in ips_next() argument
2519 if (!ha) in ips_next()
2521 host = ips_sh[ha->host_num]; in ips_next()
2529 if ((ha->subsys->param[3] & 0x300000) in ips_next()
2530 && (ha->scb_activelist.count == 0)) { in ips_next()
2532 if (now - ha->last_ffdc > IPS_SECS_8HOURS) { in ips_next()
2533 ha->last_ffdc = now; in ips_next()
2534 ips_ffdc_time(ha); in ips_next()
2545 while ((ha->num_ioctl < IPS_MAX_IOCTL) && in ips_next()
2546 (ha->copp_waitlist.head) && (scb = ips_getscb(ha))) { in ips_next()
2548 item = ips_removeq_copp_head(&ha->copp_waitlist); in ips_next()
2549 ha->num_ioctl++; in ips_next()
2555 ret = ips_make_passthru(ha, scb->scsi_cmd, scb, intr); in ips_next()
2566 ips_freescb(ha, scb); in ips_next()
2574 ips_freescb(ha, scb); in ips_next()
2581 ha->num_ioctl--; in ips_next()
2585 ret = ips_send_cmd(ha, scb); in ips_next()
2588 ips_putq_scb_head(&ha->scb_activelist, scb); in ips_next()
2590 ha->num_ioctl--; in ips_next()
2598 ips_freescb(ha, scb); in ips_next()
2601 ips_freescb(ha, scb); in ips_next()
2613 p = ha->scb_waitlist.head; in ips_next()
2614 while ((p) && (scb = ips_getscb(ha))) { in ips_next()
2616 && (ha-> in ips_next()
2619 ips_freescb(ha, scb); in ips_next()
2625 SC = ips_removeq_wait(&ha->scb_waitlist, q); in ips_next()
2656 (ha, sg_dma_address(sg), scb, i, in ips_next()
2687 ret = ips_send_cmd(ha, scb); in ips_next()
2691 ips_putq_scb_head(&ha->scb_activelist, scb); in ips_next()
2700 ha->dcdb_active[scb->bus - 1] &= in ips_next()
2703 ips_freescb(ha, scb); in ips_next()
2710 ha->dcdb_active[scb->bus - 1] &= in ips_next()
2713 ips_freescb(ha, scb); in ips_next()
3070 ipsintr_blocking(ips_ha_t * ha, ips_scb_t * scb) in ipsintr_blocking() argument
3074 ips_freescb(ha, scb); in ipsintr_blocking()
3075 if (ha->waitflag && ha->cmd_in_progress == scb->cdb[0]) { in ipsintr_blocking()
3076 ha->waitflag = false; in ipsintr_blocking()
3092 ipsintr_done(ips_ha_t * ha, ips_scb_t * scb) in ipsintr_done() argument
3097 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ipsintr_done()
3105 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ipsintr_done()
3111 ips_done(ha, scb); in ipsintr_done()
3124 ips_done(ips_ha_t * ha, ips_scb_t * scb) in ips_done() argument
3134 ips_cleanup_passthru(ha, scb); in ips_done()
3135 ha->num_ioctl--; in ips_done()
3157 ips_fill_scb_sg_single(ha, in ips_done()
3165 (ha, in ips_done()
3184 ret = ips_send_cmd(ha, scb); in ips_done()
3193 ips_freescb(ha, scb); in ips_done()
3201 ips_freescb(ha, scb); in ips_done()
3212 ha->dcdb_active[scb->bus - 1] &= ~(1 << scb->target_id); in ips_done()
3217 ips_freescb(ha, scb); in ips_done()
3230 ips_map_status(ips_ha_t * ha, ips_scb_t * scb, ips_stat_t * sp) in ips_map_status() argument
3243 ips_name, ha->host_num, in ips_map_status()
3369 ips_send_wait(ips_ha_t * ha, ips_scb_t * scb, int timeout, int intr) in ips_send_wait() argument
3376 ha->waitflag = true; in ips_send_wait()
3377 ha->cmd_in_progress = scb->cdb[0]; in ips_send_wait()
3380 ret = ips_send_cmd(ha, scb); in ips_send_wait()
3386 ret = ips_wait(ha, timeout, intr); in ips_send_wait()
3435 ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb) in ips_send_cmd() argument
3453 if (ha->waitflag && ha->cmd_in_progress == scb->cdb[0]) in ips_send_cmd()
3454 ha->waitflag = false; in ips_send_cmd()
3519 scb->cmd.logical_info.command_id = IPS_COMMAND_ID(ha, scb); in ips_send_cmd()
3523 scb->data_busaddr = ha->logical_drive_info_dma_addr; in ips_send_cmd()
3532 ips_reqsen(ha, scb); in ips_send_cmd()
3551 IPS_USE_ENH_SGLIST(ha) ? 0xFF : 0; in ips_send_cmd()
3557 scb->cmd.basic_io.command_id = IPS_COMMAND_ID(ha, scb); in ips_send_cmd()
3597 IPS_USE_ENH_SGLIST(ha) ? 0xFF : 0; in ips_send_cmd()
3603 scb->cmd.basic_io.command_id = IPS_COMMAND_ID(ha, scb); in ips_send_cmd()
3642 scb->cmd.basic_io.command_id = IPS_COMMAND_ID(ha, scb); in ips_send_cmd()
3645 scb->data_len = sizeof (*ha->enq); in ips_send_cmd()
3646 scb->cmd.basic_io.sg_addr = ha->enq_busaddr; in ips_send_cmd()
3652 scb->cmd.logical_info.command_id = IPS_COMMAND_ID(ha, scb); in ips_send_cmd()
3657 scb->data_busaddr = ha->logical_drive_info_dma_addr; in ips_send_cmd()
3700 if (ha->conf->dev[scb->bus - 1][scb->target_id].ucState == 0) { in ips_send_cmd()
3705 ha->dcdb_active[scb->bus - 1] |= (1 << scb->target_id); in ips_send_cmd()
3706 scb->cmd.dcdb.command_id = IPS_COMMAND_ID(ha, scb); in ips_send_cmd()
3719 if (ha->subsys->param[4] & 0x00100000) { /* If NEW Tape DCDB is Supported */ in ips_send_cmd()
3726 IPS_USE_ENH_SGLIST(ha) ? 0xFF : 0; in ips_send_cmd()
3765 IPS_USE_ENH_SGLIST(ha) ? 0xFF : 0; in ips_send_cmd()
3803 return ((*ha->func.issue) (ha, scb)); in ips_send_cmd()
3816 ips_chkstatus(ips_ha_t * ha, IPS_STATUS * pstatus) in ips_chkstatus() argument
3827 scb = &ha->scbs[pstatus->fields.command_id]; in ips_chkstatus()
3832 sp = &ha->sp; in ips_chkstatus()
3837 ips_removeq_scb(&ha->scb_activelist, scb); in ips_chkstatus()
3845 ha->host_num, in ips_chkstatus()
3864 ips_name, ha->host_num, in ips_chkstatus()
3882 if (!ips_online(ha, scb)) { in ips_chkstatus()
3888 if (ips_online(ha, scb)) { in ips_chkstatus()
3889 ips_inquiry(ha, scb); in ips_chkstatus()
3896 ips_reqsen(ha, scb); in ips_chkstatus()
3908 if (!ips_online(ha, scb) in ips_chkstatus()
3909 || !ips_msense(ha, scb)) { in ips_chkstatus()
3915 if (ips_online(ha, scb)) in ips_chkstatus()
3916 ips_rdcap(ha, scb); in ips_chkstatus()
3955 ips_name, ha->host_num, in ips_chkstatus()
3960 ips_map_status(ha, scb, sp); in ips_chkstatus()
3974 ips_online(ips_ha_t * ha, ips_scb_t * scb) in ips_online() argument
3982 memset(ha->logical_drive_info, 0, sizeof (IPS_LD_INFO)); in ips_online()
3986 if (ha->logical_drive_info->drive_info[scb->target_id].state != in ips_online()
3988 && ha->logical_drive_info->drive_info[scb->target_id].state != in ips_online()
3990 && ha->logical_drive_info->drive_info[scb->target_id].state != in ips_online()
3992 && ha->logical_drive_info->drive_info[scb->target_id].state != in ips_online()
4009 ips_inquiry(ips_ha_t * ha, ips_scb_t * scb) in ips_inquiry() argument
4044 ips_rdcap(ips_ha_t * ha, ips_scb_t * scb) in ips_rdcap() argument
4055 (ha->logical_drive_info-> in ips_rdcap()
4074 ips_msense(ips_ha_t * ha, ips_scb_t * scb) in ips_msense() argument
4083 if (le32_to_cpu(ha->enq->ulDriveSize[scb->target_id]) > 0x400000 && in ips_msense()
4084 (ha->enq->ucMiscFlag & 0x8) == 0) { in ips_msense()
4093 (le32_to_cpu(ha->enq->ulDriveSize[scb->target_id]) - in ips_msense()
4165 ips_reqsen(ips_ha_t * ha, ips_scb_t * scb) in ips_reqsen() argument
4194 ips_free(ips_ha_t * ha) in ips_free() argument
4199 if (ha) { in ips_free()
4200 if (ha->enq) { in ips_free()
4201 dma_free_coherent(&ha->pcidev->dev, sizeof(IPS_ENQ), in ips_free()
4202 ha->enq, ha->enq_busaddr); in ips_free()
4203 ha->enq = NULL; in ips_free()
4206 kfree(ha->conf); in ips_free()
4207 ha->conf = NULL; in ips_free()
4209 if (ha->adapt) { in ips_free()
4210 dma_free_coherent(&ha->pcidev->dev, in ips_free()
4212 sizeof (IPS_IO_CMD), ha->adapt, in ips_free()
4213 ha->adapt->hw_status_start); in ips_free()
4214 ha->adapt = NULL; in ips_free()
4217 if (ha->logical_drive_info) { in ips_free()
4218 dma_free_coherent(&ha->pcidev->dev, in ips_free()
4220 ha->logical_drive_info, in ips_free()
4221 ha->logical_drive_info_dma_addr); in ips_free()
4222 ha->logical_drive_info = NULL; in ips_free()
4225 kfree(ha->nvram); in ips_free()
4226 ha->nvram = NULL; in ips_free()
4228 kfree(ha->subsys); in ips_free()
4229 ha->subsys = NULL; in ips_free()
4231 if (ha->ioctl_data) { in ips_free()
4232 dma_free_coherent(&ha->pcidev->dev, ha->ioctl_len, in ips_free()
4233 ha->ioctl_data, ha->ioctl_busaddr); in ips_free()
4234 ha->ioctl_data = NULL; in ips_free()
4235 ha->ioctl_datasize = 0; in ips_free()
4236 ha->ioctl_len = 0; in ips_free()
4238 ips_deallocatescbs(ha, ha->max_cmds); in ips_free()
4241 if (ha->mem_ptr) { in ips_free()
4242 iounmap(ha->ioremap_ptr); in ips_free()
4243 ha->ioremap_ptr = NULL; in ips_free()
4244 ha->mem_ptr = NULL; in ips_free()
4247 ha->mem_addr = 0; in ips_free()
4262 ips_deallocatescbs(ips_ha_t * ha, int cmds) in ips_deallocatescbs() argument
4264 if (ha->scbs) { in ips_deallocatescbs()
4265 dma_free_coherent(&ha->pcidev->dev, in ips_deallocatescbs()
4266 IPS_SGLIST_SIZE(ha) * IPS_MAX_SG * cmds, in ips_deallocatescbs()
4267 ha->scbs->sg_list.list, in ips_deallocatescbs()
4268 ha->scbs->sg_busaddr); in ips_deallocatescbs()
4269 dma_free_coherent(&ha->pcidev->dev, sizeof (ips_scb_t) * cmds, in ips_deallocatescbs()
4270 ha->scbs, ha->scbs->scb_busaddr); in ips_deallocatescbs()
4271 ha->scbs = NULL; in ips_deallocatescbs()
4286 ips_allocatescbs(ips_ha_t * ha) in ips_allocatescbs() argument
4296 ha->scbs = dma_alloc_coherent(&ha->pcidev->dev, in ips_allocatescbs()
4297 ha->max_cmds * sizeof (ips_scb_t), in ips_allocatescbs()
4299 if (ha->scbs == NULL) in ips_allocatescbs()
4301 ips_sg.list = dma_alloc_coherent(&ha->pcidev->dev, in ips_allocatescbs()
4302 IPS_SGLIST_SIZE(ha) * IPS_MAX_SG * ha->max_cmds, in ips_allocatescbs()
4305 dma_free_coherent(&ha->pcidev->dev, in ips_allocatescbs()
4306 ha->max_cmds * sizeof (ips_scb_t), ha->scbs, in ips_allocatescbs()
4311 memset(ha->scbs, 0, ha->max_cmds * sizeof (ips_scb_t)); in ips_allocatescbs()
4313 for (i = 0; i < ha->max_cmds; i++) { in ips_allocatescbs()
4314 scb_p = &ha->scbs[i]; in ips_allocatescbs()
4317 if (IPS_USE_ENH_SGLIST(ha)) { in ips_allocatescbs()
4321 sg_dma + IPS_SGLIST_SIZE(ha) * IPS_MAX_SG * i; in ips_allocatescbs()
4326 sg_dma + IPS_SGLIST_SIZE(ha) * IPS_MAX_SG * i; in ips_allocatescbs()
4330 if (i < ha->max_cmds - 1) { in ips_allocatescbs()
4331 scb_p->q_next = ha->scb_freelist; in ips_allocatescbs()
4332 ha->scb_freelist = scb_p; in ips_allocatescbs()
4350 ips_init_scb(ips_ha_t * ha, ips_scb_t * scb) in ips_init_scb() argument
4364 memset(ha->dummy, 0, sizeof (IPS_IO_CMD)); in ips_init_scb()
4367 ha->dummy->op_code = 0xFF; in ips_init_scb()
4368 ha->dummy->ccsar = cpu_to_le32(ha->adapt->hw_status_start in ips_init_scb()
4370 ha->dummy->command_id = IPS_MAX_CMDS; in ips_init_scb()
4379 scb->cmd.basic_io.ccsar = cpu_to_le32(ha->adapt->hw_status_start in ips_init_scb()
4395 ips_getscb(ips_ha_t * ha) in ips_getscb() argument
4401 if ((scb = ha->scb_freelist) == NULL) { in ips_getscb()
4406 ha->scb_freelist = scb->q_next; in ips_getscb()
4410 ips_init_scb(ha, scb); in ips_getscb()
4427 ips_freescb(ips_ha_t * ha, ips_scb_t * scb) in ips_freescb() argument
4434 dma_unmap_single(&ha->pcidev->dev, scb->data_busaddr, in ips_freescb()
4438 if (IPS_COMMAND_ID(ha, scb) < (ha->max_cmds - 1)) { in ips_freescb()
4439 scb->q_next = ha->scb_freelist; in ips_freescb()
4440 ha->scb_freelist = scb; in ips_freescb()
4454 ips_isinit_copperhead(ips_ha_t * ha) in ips_isinit_copperhead() argument
4461 isr = inb(ha->io_addr + IPS_REG_HISR); in ips_isinit_copperhead()
4462 scpr = inb(ha->io_addr + IPS_REG_SCPR); in ips_isinit_copperhead()
4480 ips_isinit_copperhead_memio(ips_ha_t * ha) in ips_isinit_copperhead_memio() argument
4487 isr = readb(ha->mem_ptr + IPS_REG_HISR); in ips_isinit_copperhead_memio()
4488 scpr = readb(ha->mem_ptr + IPS_REG_SCPR); in ips_isinit_copperhead_memio()
4506 ips_isinit_morpheus(ips_ha_t * ha) in ips_isinit_morpheus() argument
4513 if (ips_isintr_morpheus(ha)) in ips_isinit_morpheus()
4514 ips_flush_and_reset(ha); in ips_isinit_morpheus()
4516 post = readl(ha->mem_ptr + IPS_REG_I960_MSG0); in ips_isinit_morpheus()
4517 bits = readl(ha->mem_ptr + IPS_REG_I2O_HIR); in ips_isinit_morpheus()
4538 ips_flush_and_reset(ips_ha_t *ha) in ips_flush_and_reset() argument
4547 scb = dma_alloc_coherent(&ha->pcidev->dev, sizeof(ips_scb_t), in ips_flush_and_reset()
4551 ips_init_scb(ha, scb); in ips_flush_and_reset()
4565 ret = ips_send_cmd(ha, scb); /* Send the Flush Command */ in ips_flush_and_reset()
4572 done = ips_poll_for_flush_complete(ha); in ips_flush_and_reset()
4581 (*ha->func.reset) (ha); in ips_flush_and_reset()
4583 dma_free_coherent(&ha->pcidev->dev, sizeof(ips_scb_t), scb, command_dma); in ips_flush_and_reset()
4598 ips_poll_for_flush_complete(ips_ha_t * ha) in ips_poll_for_flush_complete() argument
4603 cstatus.value = (*ha->func.statupd) (ha); in ips_poll_for_flush_complete()
4625 ips_enable_int_copperhead(ips_ha_t * ha) in ips_enable_int_copperhead() argument
4629 outb(ha->io_addr + IPS_REG_HISR, IPS_BIT_EI); in ips_enable_int_copperhead()
4630 inb(ha->io_addr + IPS_REG_HISR); /*Ensure PCI Posting Completes*/ in ips_enable_int_copperhead()
4642 ips_enable_int_copperhead_memio(ips_ha_t * ha) in ips_enable_int_copperhead_memio() argument
4646 writeb(IPS_BIT_EI, ha->mem_ptr + IPS_REG_HISR); in ips_enable_int_copperhead_memio()
4647 readb(ha->mem_ptr + IPS_REG_HISR); /*Ensure PCI Posting Completes*/ in ips_enable_int_copperhead_memio()
4659 ips_enable_int_morpheus(ips_ha_t * ha) in ips_enable_int_morpheus() argument
4665 Oimr = readl(ha->mem_ptr + IPS_REG_I960_OIMR); in ips_enable_int_morpheus()
4667 writel(Oimr, ha->mem_ptr + IPS_REG_I960_OIMR); in ips_enable_int_morpheus()
4668 readl(ha->mem_ptr + IPS_REG_I960_OIMR); /*Ensure PCI Posting Completes*/ in ips_enable_int_morpheus()
4681 ips_init_copperhead(ips_ha_t * ha) in ips_init_copperhead() argument
4692 Isr = inb(ha->io_addr + IPS_REG_HISR); in ips_init_copperhead()
4704 PostByte[i] = inb(ha->io_addr + IPS_REG_ISPR); in ips_init_copperhead()
4705 outb(Isr, ha->io_addr + IPS_REG_HISR); in ips_init_copperhead()
4709 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_copperhead()
4718 Isr = inb(ha->io_addr + IPS_REG_HISR); in ips_init_copperhead()
4730 inb(ha->io_addr + IPS_REG_ISPR); in ips_init_copperhead()
4731 outb(Isr, ha->io_addr + IPS_REG_HISR); in ips_init_copperhead()
4735 Cbsp = inb(ha->io_addr + IPS_REG_CBSP); in ips_init_copperhead()
4749 outl(0x1010, ha->io_addr + IPS_REG_CCCR); in ips_init_copperhead()
4752 outb(IPS_BIT_EBM, ha->io_addr + IPS_REG_SCPR); in ips_init_copperhead()
4754 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_init_copperhead()
4756 outl(0, ha->io_addr + IPS_REG_NDAE); in ips_init_copperhead()
4759 outb(IPS_BIT_EI, ha->io_addr + IPS_REG_HISR); in ips_init_copperhead()
4774 ips_init_copperhead_memio(ips_ha_t * ha) in ips_init_copperhead_memio() argument
4785 Isr = readb(ha->mem_ptr + IPS_REG_HISR); in ips_init_copperhead_memio()
4797 PostByte[i] = readb(ha->mem_ptr + IPS_REG_ISPR); in ips_init_copperhead_memio()
4798 writeb(Isr, ha->mem_ptr + IPS_REG_HISR); in ips_init_copperhead_memio()
4802 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_copperhead_memio()
4811 Isr = readb(ha->mem_ptr + IPS_REG_HISR); in ips_init_copperhead_memio()
4823 readb(ha->mem_ptr + IPS_REG_ISPR); in ips_init_copperhead_memio()
4824 writeb(Isr, ha->mem_ptr + IPS_REG_HISR); in ips_init_copperhead_memio()
4828 Cbsp = readb(ha->mem_ptr + IPS_REG_CBSP); in ips_init_copperhead_memio()
4842 writel(0x1010, ha->mem_ptr + IPS_REG_CCCR); in ips_init_copperhead_memio()
4845 writeb(IPS_BIT_EBM, ha->mem_ptr + IPS_REG_SCPR); in ips_init_copperhead_memio()
4847 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_init_copperhead_memio()
4849 writel(0, ha->mem_ptr + IPS_REG_NDAE); in ips_init_copperhead_memio()
4852 writeb(IPS_BIT_EI, ha->mem_ptr + IPS_REG_HISR); in ips_init_copperhead_memio()
4868 ips_init_morpheus(ips_ha_t * ha) in ips_init_morpheus() argument
4880 Isr = readl(ha->mem_ptr + IPS_REG_I2O_HIR); in ips_init_morpheus()
4891 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_morpheus()
4897 Post = readl(ha->mem_ptr + IPS_REG_I960_MSG0); in ips_init_morpheus()
4900 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_morpheus()
4905 writel(Isr, ha->mem_ptr + IPS_REG_I2O_HIR); in ips_init_morpheus()
4908 Post = readl(ha->mem_ptr + IPS_REG_I960_MSG0); in ips_init_morpheus()
4916 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_morpheus()
4925 writel(Isr, ha->mem_ptr + IPS_REG_I2O_HIR); in ips_init_morpheus()
4928 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_morpheus()
4936 Isr = readl(ha->mem_ptr + IPS_REG_I2O_HIR); in ips_init_morpheus()
4947 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_morpheus()
4953 Config = readl(ha->mem_ptr + IPS_REG_I960_MSG1); in ips_init_morpheus()
4957 writel(Isr, ha->mem_ptr + IPS_REG_I2O_HIR); in ips_init_morpheus()
4960 Oimr = readl(ha->mem_ptr + IPS_REG_I960_OIMR); in ips_init_morpheus()
4962 writel(Oimr, ha->mem_ptr + IPS_REG_I960_OIMR); in ips_init_morpheus()
4969 ha->requires_esl = 1; in ips_init_morpheus()
4985 ips_reset_copperhead(ips_ha_t * ha) in ips_reset_copperhead() argument
4992 ips_name, ha->host_num, ha->io_addr, ha->pcidev->irq); in ips_reset_copperhead()
4999 outb(IPS_BIT_RST, ha->io_addr + IPS_REG_SCPR); in ips_reset_copperhead()
5004 outb(0, ha->io_addr + IPS_REG_SCPR); in ips_reset_copperhead()
5009 if ((*ha->func.init) (ha)) in ips_reset_copperhead()
5030 ips_reset_copperhead_memio(ips_ha_t * ha) in ips_reset_copperhead_memio() argument
5037 ips_name, ha->host_num, ha->mem_addr, ha->pcidev->irq); in ips_reset_copperhead_memio()
5044 writeb(IPS_BIT_RST, ha->mem_ptr + IPS_REG_SCPR); in ips_reset_copperhead_memio()
5049 writeb(0, ha->mem_ptr + IPS_REG_SCPR); in ips_reset_copperhead_memio()
5054 if ((*ha->func.init) (ha)) in ips_reset_copperhead_memio()
5075 ips_reset_morpheus(ips_ha_t * ha) in ips_reset_morpheus() argument
5083 ips_name, ha->host_num, ha->mem_addr, ha->pcidev->irq); in ips_reset_morpheus()
5090 writel(0x80000000, ha->mem_ptr + IPS_REG_I960_IDR); in ips_reset_morpheus()
5096 pci_read_config_byte(ha->pcidev, 4, &junk); in ips_reset_morpheus()
5098 if ((*ha->func.init) (ha)) in ips_reset_morpheus()
5119 ips_statinit(ips_ha_t * ha) in ips_statinit() argument
5125 ha->adapt->p_status_start = ha->adapt->status; in ips_statinit()
5126 ha->adapt->p_status_end = ha->adapt->status + IPS_MAX_CMDS; in ips_statinit()
5127 ha->adapt->p_status_tail = ha->adapt->status; in ips_statinit()
5129 phys_status_start = ha->adapt->hw_status_start; in ips_statinit()
5130 outl(phys_status_start, ha->io_addr + IPS_REG_SQSR); in ips_statinit()
5132 ha->io_addr + IPS_REG_SQER); in ips_statinit()
5134 ha->io_addr + IPS_REG_SQHR); in ips_statinit()
5135 outl(phys_status_start, ha->io_addr + IPS_REG_SQTR); in ips_statinit()
5137 ha->adapt->hw_status_tail = phys_status_start; in ips_statinit()
5150 ips_statinit_memio(ips_ha_t * ha) in ips_statinit_memio() argument
5156 ha->adapt->p_status_start = ha->adapt->status; in ips_statinit_memio()
5157 ha->adapt->p_status_end = ha->adapt->status + IPS_MAX_CMDS; in ips_statinit_memio()
5158 ha->adapt->p_status_tail = ha->adapt->status; in ips_statinit_memio()
5160 phys_status_start = ha->adapt->hw_status_start; in ips_statinit_memio()
5161 writel(phys_status_start, ha->mem_ptr + IPS_REG_SQSR); in ips_statinit_memio()
5163 ha->mem_ptr + IPS_REG_SQER); in ips_statinit_memio()
5164 writel(phys_status_start + IPS_STATUS_SIZE, ha->mem_ptr + IPS_REG_SQHR); in ips_statinit_memio()
5165 writel(phys_status_start, ha->mem_ptr + IPS_REG_SQTR); in ips_statinit_memio()
5167 ha->adapt->hw_status_tail = phys_status_start; in ips_statinit_memio()
5180 ips_statupd_copperhead(ips_ha_t * ha) in ips_statupd_copperhead() argument
5184 if (ha->adapt->p_status_tail != ha->adapt->p_status_end) { in ips_statupd_copperhead()
5185 ha->adapt->p_status_tail++; in ips_statupd_copperhead()
5186 ha->adapt->hw_status_tail += sizeof (IPS_STATUS); in ips_statupd_copperhead()
5188 ha->adapt->p_status_tail = ha->adapt->p_status_start; in ips_statupd_copperhead()
5189 ha->adapt->hw_status_tail = ha->adapt->hw_status_start; in ips_statupd_copperhead()
5192 outl(ha->adapt->hw_status_tail, in ips_statupd_copperhead()
5193 ha->io_addr + IPS_REG_SQTR); in ips_statupd_copperhead()
5195 return (ha->adapt->p_status_tail->value); in ips_statupd_copperhead()
5208 ips_statupd_copperhead_memio(ips_ha_t * ha) in ips_statupd_copperhead_memio() argument
5212 if (ha->adapt->p_status_tail != ha->adapt->p_status_end) { in ips_statupd_copperhead_memio()
5213 ha->adapt->p_status_tail++; in ips_statupd_copperhead_memio()
5214 ha->adapt->hw_status_tail += sizeof (IPS_STATUS); in ips_statupd_copperhead_memio()
5216 ha->adapt->p_status_tail = ha->adapt->p_status_start; in ips_statupd_copperhead_memio()
5217 ha->adapt->hw_status_tail = ha->adapt->hw_status_start; in ips_statupd_copperhead_memio()
5220 writel(ha->adapt->hw_status_tail, ha->mem_ptr + IPS_REG_SQTR); in ips_statupd_copperhead_memio()
5222 return (ha->adapt->p_status_tail->value); in ips_statupd_copperhead_memio()
5235 ips_statupd_morpheus(ips_ha_t * ha) in ips_statupd_morpheus() argument
5241 val = readl(ha->mem_ptr + IPS_REG_I2O_OUTMSGQ); in ips_statupd_morpheus()
5256 ips_issue_copperhead(ips_ha_t * ha, ips_scb_t * scb) in ips_issue_copperhead() argument
5266 ha->host_num, in ips_issue_copperhead()
5272 ips_name, ha->host_num, scb->cmd.basic_io.command_id); in ips_issue_copperhead()
5278 le32_to_cpu(inl(ha->io_addr + IPS_REG_CCCR))) & IPS_BIT_SEM) { in ips_issue_copperhead()
5285 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_issue_copperhead()
5287 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_issue_copperhead()
5294 outl(scb->scb_busaddr, ha->io_addr + IPS_REG_CCSAR); in ips_issue_copperhead()
5295 outw(IPS_BIT_START_CMD, ha->io_addr + IPS_REG_CCCR); in ips_issue_copperhead()
5310 ips_issue_copperhead_memio(ips_ha_t * ha, ips_scb_t * scb) in ips_issue_copperhead_memio() argument
5320 ha->host_num, in ips_issue_copperhead_memio()
5326 ips_name, ha->host_num, scb->cmd.basic_io.command_id); in ips_issue_copperhead_memio()
5331 while ((val = readl(ha->mem_ptr + IPS_REG_CCCR)) & IPS_BIT_SEM) { in ips_issue_copperhead_memio()
5338 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_issue_copperhead_memio()
5340 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_issue_copperhead_memio()
5347 writel(scb->scb_busaddr, ha->mem_ptr + IPS_REG_CCSAR); in ips_issue_copperhead_memio()
5348 writel(IPS_BIT_START_CMD, ha->mem_ptr + IPS_REG_CCCR); in ips_issue_copperhead_memio()
5363 ips_issue_i2o(ips_ha_t * ha, ips_scb_t * scb) in ips_issue_i2o() argument
5371 ha->host_num, in ips_issue_i2o()
5377 ips_name, ha->host_num, scb->cmd.basic_io.command_id); in ips_issue_i2o()
5380 outl(scb->scb_busaddr, ha->io_addr + IPS_REG_I2O_INMSGQ); in ips_issue_i2o()
5395 ips_issue_i2o_memio(ips_ha_t * ha, ips_scb_t * scb) in ips_issue_i2o_memio() argument
5403 ha->host_num, in ips_issue_i2o_memio()
5409 ips_name, ha->host_num, scb->cmd.basic_io.command_id); in ips_issue_i2o_memio()
5412 writel(scb->scb_busaddr, ha->mem_ptr + IPS_REG_I2O_INMSGQ); in ips_issue_i2o_memio()
5427 ips_isintr_copperhead(ips_ha_t * ha) in ips_isintr_copperhead() argument
5433 Isr = inb(ha->io_addr + IPS_REG_HISR); in ips_isintr_copperhead()
5444 outb(Isr, ha->io_addr + IPS_REG_HISR); in ips_isintr_copperhead()
5460 ips_isintr_copperhead_memio(ips_ha_t * ha) in ips_isintr_copperhead_memio() argument
5466 Isr = readb(ha->mem_ptr + IPS_REG_HISR); in ips_isintr_copperhead_memio()
5477 writeb(Isr, ha->mem_ptr + IPS_REG_HISR); in ips_isintr_copperhead_memio()
5493 ips_isintr_morpheus(ips_ha_t * ha) in ips_isintr_morpheus() argument
5499 Isr = readl(ha->mem_ptr + IPS_REG_I2O_HIR); in ips_isintr_morpheus()
5517 ips_wait(ips_ha_t * ha, int time, int intr) in ips_wait() argument
5531 if (!ha->waitflag) { in ips_wait()
5537 if (!ha->waitflag) { in ips_wait()
5554 (*ha->func.intr) (ha); in ips_wait()
5575 ips_write_driver_status(ips_ha_t * ha, int intr) in ips_write_driver_status() argument
5579 if (!ips_readwrite_page5(ha, false, intr)) { in ips_write_driver_status()
5580 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_write_driver_status()
5588 if (le32_to_cpu(ha->nvram->signature) != IPS_NVRAM_P5_SIG) { in ips_write_driver_status()
5591 ips_name, ha->host_num, ha->nvram->signature); in ips_write_driver_status()
5592 ha->nvram->signature = IPS_NVRAM_P5_SIG; in ips_write_driver_status()
5597 ips_name, ha->host_num, le16_to_cpu(ha->nvram->adapter_type), in ips_write_driver_status()
5598 ha->nvram->adapter_slot, ha->nvram->bios_high[0], in ips_write_driver_status()
5599 ha->nvram->bios_high[1], ha->nvram->bios_high[2], in ips_write_driver_status()
5600 ha->nvram->bios_high[3], ha->nvram->bios_low[0], in ips_write_driver_status()
5601 ha->nvram->bios_low[1], ha->nvram->bios_low[2], in ips_write_driver_status()
5602 ha->nvram->bios_low[3]); in ips_write_driver_status()
5604 ips_get_bios_version(ha, intr); in ips_write_driver_status()
5607 ha->nvram->operating_system = IPS_OS_LINUX; in ips_write_driver_status()
5608 ha->nvram->adapter_type = ha->ad_type; in ips_write_driver_status()
5609 memcpy((char *) ha->nvram->driver_high, IPS_VERSION_HIGH, 4); in ips_write_driver_status()
5610 memcpy((char *) ha->nvram->driver_low, IPS_VERSION_LOW, 4); in ips_write_driver_status()
5611 memcpy((char *) ha->nvram->bios_high, ha->bios_version, 4); in ips_write_driver_status()
5612 memcpy((char *) ha->nvram->bios_low, ha->bios_version + 4, 4); in ips_write_driver_status()
5614 ha->nvram->versioning = 0; /* Indicate the Driver Does Not Support Versioning */ in ips_write_driver_status()
5617 if (!ips_readwrite_page5(ha, true, intr)) { in ips_write_driver_status()
5618 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_write_driver_status()
5625 ha->slot_num = ha->nvram->adapter_slot; in ips_write_driver_status()
5640 ips_read_adapter_status(ips_ha_t * ha, int intr) in ips_read_adapter_status() argument
5647 scb = &ha->scbs[ha->max_cmds - 1]; in ips_read_adapter_status()
5649 ips_init_scb(ha, scb); in ips_read_adapter_status()
5655 scb->cmd.basic_io.command_id = IPS_COMMAND_ID(ha, scb); in ips_read_adapter_status()
5660 scb->data_len = sizeof (*ha->enq); in ips_read_adapter_status()
5661 scb->cmd.basic_io.sg_addr = ha->enq_busaddr; in ips_read_adapter_status()
5665 ips_send_wait(ha, scb, ips_cmd_timeout, intr)) == IPS_FAILURE) in ips_read_adapter_status()
5683 ips_read_subsystem_parameters(ips_ha_t * ha, int intr) in ips_read_subsystem_parameters() argument
5690 scb = &ha->scbs[ha->max_cmds - 1]; in ips_read_subsystem_parameters()
5692 ips_init_scb(ha, scb); in ips_read_subsystem_parameters()
5698 scb->cmd.basic_io.command_id = IPS_COMMAND_ID(ha, scb); in ips_read_subsystem_parameters()
5703 scb->data_len = sizeof (*ha->subsys); in ips_read_subsystem_parameters()
5704 scb->cmd.basic_io.sg_addr = ha->ioctl_busaddr; in ips_read_subsystem_parameters()
5708 ips_send_wait(ha, scb, ips_cmd_timeout, intr)) == IPS_FAILURE) in ips_read_subsystem_parameters()
5713 memcpy(ha->subsys, ha->ioctl_data, sizeof(*ha->subsys)); in ips_read_subsystem_parameters()
5727 ips_read_config(ips_ha_t * ha, int intr) in ips_read_config() argument
5737 ha->conf->init_id[i] = 7; in ips_read_config()
5739 scb = &ha->scbs[ha->max_cmds - 1]; in ips_read_config()
5741 ips_init_scb(ha, scb); in ips_read_config()
5747 scb->cmd.basic_io.command_id = IPS_COMMAND_ID(ha, scb); in ips_read_config()
5748 scb->data_len = sizeof (*ha->conf); in ips_read_config()
5749 scb->cmd.basic_io.sg_addr = ha->ioctl_busaddr; in ips_read_config()
5753 ips_send_wait(ha, scb, ips_cmd_timeout, intr)) == IPS_FAILURE) in ips_read_config()
5757 memset(ha->conf, 0, sizeof (IPS_CONF)); in ips_read_config()
5761 ha->conf->init_id[i] = 7; in ips_read_config()
5771 memcpy(ha->conf, ha->ioctl_data, sizeof(*ha->conf)); in ips_read_config()
5785 ips_readwrite_page5(ips_ha_t * ha, int write, int intr) in ips_readwrite_page5() argument
5792 scb = &ha->scbs[ha->max_cmds - 1]; in ips_readwrite_page5()
5794 ips_init_scb(ha, scb); in ips_readwrite_page5()
5800 scb->cmd.nvram.command_id = IPS_COMMAND_ID(ha, scb); in ips_readwrite_page5()
5805 scb->data_len = sizeof (*ha->nvram); in ips_readwrite_page5()
5806 scb->cmd.nvram.buffer_addr = ha->ioctl_busaddr; in ips_readwrite_page5()
5808 memcpy(ha->ioctl_data, ha->nvram, sizeof(*ha->nvram)); in ips_readwrite_page5()
5812 ips_send_wait(ha, scb, ips_cmd_timeout, intr)) == IPS_FAILURE) in ips_readwrite_page5()
5816 memset(ha->nvram, 0, sizeof (IPS_NVRAM_P5)); in ips_readwrite_page5()
5821 memcpy(ha->nvram, ha->ioctl_data, sizeof(*ha->nvram)); in ips_readwrite_page5()
5835 ips_clear_adapter(ips_ha_t * ha, int intr) in ips_clear_adapter() argument
5842 scb = &ha->scbs[ha->max_cmds - 1]; in ips_clear_adapter()
5844 ips_init_scb(ha, scb); in ips_clear_adapter()
5850 scb->cmd.config_sync.command_id = IPS_COMMAND_ID(ha, scb); in ips_clear_adapter()
5859 ips_send_wait(ha, scb, ips_reset_timeout, intr)) == IPS_FAILURE) in ips_clear_adapter()
5865 ips_init_scb(ha, scb); in ips_clear_adapter()
5871 scb->cmd.unlock_stripe.command_id = IPS_COMMAND_ID(ha, scb); in ips_clear_adapter()
5880 ips_send_wait(ha, scb, ips_cmd_timeout, intr)) == IPS_FAILURE) in ips_clear_adapter()
5898 ips_ffdc_reset(ips_ha_t * ha, int intr) in ips_ffdc_reset() argument
5904 scb = &ha->scbs[ha->max_cmds - 1]; in ips_ffdc_reset()
5906 ips_init_scb(ha, scb); in ips_ffdc_reset()
5911 scb->cmd.ffdc.command_id = IPS_COMMAND_ID(ha, scb); in ips_ffdc_reset()
5912 scb->cmd.ffdc.reset_count = ha->reset_count; in ips_ffdc_reset()
5916 ips_fix_ffdc_time(ha, scb, ha->last_ffdc); in ips_ffdc_reset()
5919 ips_send_wait(ha, scb, ips_cmd_timeout, intr); in ips_ffdc_reset()
5932 ips_ffdc_time(ips_ha_t * ha) in ips_ffdc_time() argument
5938 DEBUG_VAR(1, "(%s%d) Sending time update.", ips_name, ha->host_num); in ips_ffdc_time()
5940 scb = &ha->scbs[ha->max_cmds - 1]; in ips_ffdc_time()
5942 ips_init_scb(ha, scb); in ips_ffdc_time()
5947 scb->cmd.ffdc.command_id = IPS_COMMAND_ID(ha, scb); in ips_ffdc_time()
5952 ips_fix_ffdc_time(ha, scb, ha->last_ffdc); in ips_ffdc_time()
5955 ips_send_wait(ha, scb, ips_cmd_timeout, IPS_FFDC); in ips_ffdc_time()
5967 ips_fix_ffdc_time(ips_ha_t * ha, ips_scb_t * scb, time64_t current_time) in ips_fix_ffdc_time() argument
5997 ips_erase_bios(ips_ha_t * ha) in ips_erase_bios() argument
6007 outl(0, ha->io_addr + IPS_REG_FLAP); in ips_erase_bios()
6008 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios()
6011 outb(0x50, ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6012 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios()
6016 outb(0x20, ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6017 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios()
6021 outb(0xD0, ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6022 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios()
6026 outb(0x70, ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6027 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios()
6033 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) { in ips_erase_bios()
6034 outl(0, ha->io_addr + IPS_REG_FLAP); in ips_erase_bios()
6038 status = inb(ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6052 outb(0xB0, ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6053 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios()
6059 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) { in ips_erase_bios()
6060 outl(0, ha->io_addr + IPS_REG_FLAP); in ips_erase_bios()
6064 status = inb(ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6088 outb(0x50, ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6089 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios()
6093 outb(0xFF, ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6094 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios()
6109 ips_erase_bios_memio(ips_ha_t * ha) in ips_erase_bios_memio() argument
6119 writel(0, ha->mem_ptr + IPS_REG_FLAP); in ips_erase_bios_memio()
6120 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios_memio()
6123 writeb(0x50, ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6124 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios_memio()
6128 writeb(0x20, ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6129 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios_memio()
6133 writeb(0xD0, ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6134 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios_memio()
6138 writeb(0x70, ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6139 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios_memio()
6145 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) { in ips_erase_bios_memio()
6146 writel(0, ha->mem_ptr + IPS_REG_FLAP); in ips_erase_bios_memio()
6150 status = readb(ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6164 writeb(0xB0, ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6165 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios_memio()
6171 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) { in ips_erase_bios_memio()
6172 writel(0, ha->mem_ptr + IPS_REG_FLAP); in ips_erase_bios_memio()
6176 status = readb(ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6200 writeb(0x50, ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6201 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios_memio()
6205 writeb(0xFF, ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6206 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios_memio()
6221 ips_program_bios(ips_ha_t * ha, char *buffer, uint32_t buffersize, in ips_program_bios() argument
6234 outl(i + offset, ha->io_addr + IPS_REG_FLAP); in ips_program_bios()
6235 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios()
6238 outb(0x40, ha->io_addr + IPS_REG_FLDP); in ips_program_bios()
6239 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios()
6242 outb(buffer[i], ha->io_addr + IPS_REG_FLDP); in ips_program_bios()
6243 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios()
6249 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) { in ips_program_bios()
6250 outl(0, ha->io_addr + IPS_REG_FLAP); in ips_program_bios()
6254 status = inb(ha->io_addr + IPS_REG_FLDP); in ips_program_bios()
6265 outl(0, ha->io_addr + IPS_REG_FLAP); in ips_program_bios()
6266 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios()
6269 outb(0xFF, ha->io_addr + IPS_REG_FLDP); in ips_program_bios()
6270 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios()
6279 outl(0, ha->io_addr + IPS_REG_FLAP); in ips_program_bios()
6280 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios()
6283 outb(0xFF, ha->io_addr + IPS_REG_FLDP); in ips_program_bios()
6284 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios()
6292 outl(0, ha->io_addr + IPS_REG_FLAP); in ips_program_bios()
6293 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios()
6296 outb(0xFF, ha->io_addr + IPS_REG_FLDP); in ips_program_bios()
6297 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios()
6312 ips_program_bios_memio(ips_ha_t * ha, char *buffer, uint32_t buffersize, in ips_program_bios_memio() argument
6325 writel(i + offset, ha->mem_ptr + IPS_REG_FLAP); in ips_program_bios_memio()
6326 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios_memio()
6329 writeb(0x40, ha->mem_ptr + IPS_REG_FLDP); in ips_program_bios_memio()
6330 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios_memio()
6333 writeb(buffer[i], ha->mem_ptr + IPS_REG_FLDP); in ips_program_bios_memio()
6334 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios_memio()
6340 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) { in ips_program_bios_memio()
6341 writel(0, ha->mem_ptr + IPS_REG_FLAP); in ips_program_bios_memio()
6345 status = readb(ha->mem_ptr + IPS_REG_FLDP); in ips_program_bios_memio()
6356 writel(0, ha->mem_ptr + IPS_REG_FLAP); in ips_program_bios_memio()
6357 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios_memio()
6360 writeb(0xFF, ha->mem_ptr + IPS_REG_FLDP); in ips_program_bios_memio()
6361 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios_memio()
6370 writel(0, ha->mem_ptr + IPS_REG_FLAP); in ips_program_bios_memio()
6371 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios_memio()
6374 writeb(0xFF, ha->mem_ptr + IPS_REG_FLDP); in ips_program_bios_memio()
6375 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios_memio()
6383 writel(0, ha->mem_ptr + IPS_REG_FLAP); in ips_program_bios_memio()
6384 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios_memio()
6387 writeb(0xFF, ha->mem_ptr + IPS_REG_FLDP); in ips_program_bios_memio()
6388 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios_memio()
6403 ips_verify_bios(ips_ha_t * ha, char *buffer, uint32_t buffersize, in ips_verify_bios() argument
6412 outl(0, ha->io_addr + IPS_REG_FLAP); in ips_verify_bios()
6413 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_verify_bios()
6416 if (inb(ha->io_addr + IPS_REG_FLDP) != 0x55) in ips_verify_bios()
6419 outl(1, ha->io_addr + IPS_REG_FLAP); in ips_verify_bios()
6420 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_verify_bios()
6422 if (inb(ha->io_addr + IPS_REG_FLDP) != 0xAA) in ips_verify_bios()
6428 outl(i + offset, ha->io_addr + IPS_REG_FLAP); in ips_verify_bios()
6429 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_verify_bios()
6432 checksum = (uint8_t) checksum + inb(ha->io_addr + IPS_REG_FLDP); in ips_verify_bios()
6452 ips_verify_bios_memio(ips_ha_t * ha, char *buffer, uint32_t buffersize, in ips_verify_bios_memio() argument
6461 writel(0, ha->mem_ptr + IPS_REG_FLAP); in ips_verify_bios_memio()
6462 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_verify_bios_memio()
6465 if (readb(ha->mem_ptr + IPS_REG_FLDP) != 0x55) in ips_verify_bios_memio()
6468 writel(1, ha->mem_ptr + IPS_REG_FLAP); in ips_verify_bios_memio()
6469 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_verify_bios_memio()
6471 if (readb(ha->mem_ptr + IPS_REG_FLDP) != 0xAA) in ips_verify_bios_memio()
6477 writel(i + offset, ha->mem_ptr + IPS_REG_FLAP); in ips_verify_bios_memio()
6478 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_verify_bios_memio()
6482 (uint8_t) checksum + readb(ha->mem_ptr + IPS_REG_FLDP); in ips_verify_bios_memio()
6501 ips_abort_init(ips_ha_t * ha, int index) in ips_abort_init() argument
6503 ha->active = 0; in ips_abort_init()
6504 ips_free(ha); in ips_abort_init()
6640 ips_ha_t *ha, *oldha = ips_ha[index]; in ips_register_scsi() local
6647 ha = IPS_HA(sh); in ips_register_scsi()
6648 memcpy(ha, oldha, sizeof (ips_ha_t)); in ips_register_scsi()
6651 if (request_irq(ha->pcidev->irq, do_ipsintr, IRQF_SHARED, ips_name, ha)) { in ips_register_scsi()
6652 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_register_scsi()
6660 sh->unique_id = (ha->io_addr) ? ha->io_addr : ha->mem_addr; in ips_register_scsi()
6666 sh->max_id = ha->ntargets; in ips_register_scsi()
6667 sh->max_lun = ha->nlun; in ips_register_scsi()
6668 sh->max_channel = ha->nbus - 1; in ips_register_scsi()
6669 sh->can_queue = ha->max_cmds - 1; in ips_register_scsi()
6671 if (scsi_add_host(sh, &ha->pcidev->dev)) in ips_register_scsi()
6675 ips_ha[index] = ha; in ips_register_scsi()
6682 free_irq(ha->pcidev->irq, ha); in ips_register_scsi()
6817 ips_ha_t *ha; in ips_init_phase1() local
6877 ha = kzalloc_obj(ips_ha_t); in ips_init_phase1()
6878 if (ha == NULL) { in ips_init_phase1()
6885 ips_ha[index] = ha; in ips_init_phase1()
6886 ha->active = 1; in ips_init_phase1()
6889 ha->io_addr = io_addr; in ips_init_phase1()
6890 ha->io_len = io_len; in ips_init_phase1()
6891 ha->mem_addr = mem_addr; in ips_init_phase1()
6892 ha->mem_len = mem_len; in ips_init_phase1()
6893 ha->mem_ptr = mem_ptr; in ips_init_phase1()
6894 ha->ioremap_ptr = ioremap_ptr; in ips_init_phase1()
6895 ha->host_num = (uint32_t) index; in ips_init_phase1()
6896 ha->slot_num = PCI_SLOT(pci_dev->devfn); in ips_init_phase1()
6897 ha->pcidev = pci_dev; in ips_init_phase1()
6905 if (sizeof(dma_addr_t) > 4 && IPS_HAS_ENH_SGLIST(ha) && in ips_init_phase1()
6906 !dma_set_mask(&ha->pcidev->dev, DMA_BIT_MASK(64))) { in ips_init_phase1()
6907 (ha)->flags |= IPS_HA_ENH_SG; in ips_init_phase1()
6909 if (dma_set_mask(&ha->pcidev->dev, DMA_BIT_MASK(32)) != 0) { in ips_init_phase1()
6911 return ips_abort_init(ha, index); in ips_init_phase1()
6919 ha->enq = dma_alloc_coherent(&pci_dev->dev, sizeof (IPS_ENQ), in ips_init_phase1()
6920 &ha->enq_busaddr, GFP_KERNEL); in ips_init_phase1()
6921 if (!ha->enq) { in ips_init_phase1()
6924 return ips_abort_init(ha, index); in ips_init_phase1()
6927 ha->adapt = dma_alloc_coherent(&pci_dev->dev, in ips_init_phase1()
6930 if (!ha->adapt) { in ips_init_phase1()
6933 return ips_abort_init(ha, index); in ips_init_phase1()
6935 ha->adapt->hw_status_start = dma_address; in ips_init_phase1()
6936 ha->dummy = (void *) (ha->adapt + 1); in ips_init_phase1()
6940 ha->logical_drive_info = dma_alloc_coherent(&pci_dev->dev, in ips_init_phase1()
6942 if (!ha->logical_drive_info) { in ips_init_phase1()
6945 return ips_abort_init(ha, index); in ips_init_phase1()
6947 ha->logical_drive_info_dma_addr = dma_address; in ips_init_phase1()
6950 ha->conf = kmalloc_obj(IPS_CONF); in ips_init_phase1()
6952 if (!ha->conf) { in ips_init_phase1()
6955 return ips_abort_init(ha, index); in ips_init_phase1()
6958 ha->nvram = kmalloc_obj(IPS_NVRAM_P5); in ips_init_phase1()
6960 if (!ha->nvram) { in ips_init_phase1()
6963 return ips_abort_init(ha, index); in ips_init_phase1()
6966 ha->subsys = kmalloc_obj(IPS_SUBSYS); in ips_init_phase1()
6968 if (!ha->subsys) { in ips_init_phase1()
6971 return ips_abort_init(ha, index); in ips_init_phase1()
6979 ha->ioctl_data = dma_alloc_coherent(&pci_dev->dev, ips_ioctlsize, in ips_init_phase1()
6980 &ha->ioctl_busaddr, GFP_KERNEL); in ips_init_phase1()
6981 ha->ioctl_len = ips_ioctlsize; in ips_init_phase1()
6982 if (!ha->ioctl_data) { in ips_init_phase1()
6985 return ips_abort_init(ha, index); in ips_init_phase1()
6991 ips_setup_funclist(ha); in ips_init_phase1()
6993 if ((IPS_IS_MORPHEUS(ha)) || (IPS_IS_MARCO(ha))) { in ips_init_phase1()
6995 IsDead = readl(ha->mem_ptr + IPS_REG_I960_MSG1); in ips_init_phase1()
6997 ips_reset_morpheus(ha); in ips_init_phase1()
7005 if (!(*ha->func.isinit) (ha)) { in ips_init_phase1()
7006 if (!(*ha->func.init) (ha)) { in ips_init_phase1()
7012 return ips_abort_init(ha, index); in ips_init_phase1()
7032 ips_ha_t *ha; in ips_init_phase2() local
7034 ha = ips_ha[index]; in ips_init_phase2()
7037 if (!ha->active) { in ips_init_phase2()
7043 if (request_irq(ha->pcidev->irq, do_ipsintr, IRQF_SHARED, ips_name, ha)) { in ips_init_phase2()
7044 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_phase2()
7046 return ips_abort_init(ha, index); in ips_init_phase2()
7052 ha->max_cmds = 1; in ips_init_phase2()
7053 if (!ips_allocatescbs(ha)) { in ips_init_phase2()
7054 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_phase2()
7056 free_irq(ha->pcidev->irq, ha); in ips_init_phase2()
7057 return ips_abort_init(ha, index); in ips_init_phase2()
7060 if (!ips_hainit(ha)) { in ips_init_phase2()
7061 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_phase2()
7063 free_irq(ha->pcidev->irq, ha); in ips_init_phase2()
7064 return ips_abort_init(ha, index); in ips_init_phase2()
7067 ips_deallocatescbs(ha, 1); in ips_init_phase2()
7070 if (!ips_allocatescbs(ha)) { in ips_init_phase2()
7071 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_phase2()
7073 free_irq(ha->pcidev->irq, ha); in ips_init_phase2()
7074 return ips_abort_init(ha, index); in ips_init_phase2()