Lines Matching refs:ha

279 static void ips_free_flash_copperhead(ips_ha_t * ha);
330 static int ips_abort_init(ips_ha_t * ha, int index);
336 static int ips_poll_for_flush_complete(ips_ha_t * ha);
337 static void ips_flush_and_reset(ips_ha_t *ha);
582 ips_setup_funclist(ips_ha_t * ha) in ips_setup_funclist() argument
588 if (IPS_IS_MORPHEUS(ha) || IPS_IS_MARCO(ha)) { in ips_setup_funclist()
590 ha->func.isintr = ips_isintr_morpheus; in ips_setup_funclist()
591 ha->func.isinit = ips_isinit_morpheus; in ips_setup_funclist()
592 ha->func.issue = ips_issue_i2o_memio; in ips_setup_funclist()
593 ha->func.init = ips_init_morpheus; in ips_setup_funclist()
594 ha->func.statupd = ips_statupd_morpheus; in ips_setup_funclist()
595 ha->func.reset = ips_reset_morpheus; in ips_setup_funclist()
596 ha->func.intr = ips_intr_morpheus; in ips_setup_funclist()
597 ha->func.enableint = ips_enable_int_morpheus; in ips_setup_funclist()
598 } else if (IPS_USE_MEMIO(ha)) { in ips_setup_funclist()
600 ha->func.isintr = ips_isintr_copperhead_memio; in ips_setup_funclist()
601 ha->func.isinit = ips_isinit_copperhead_memio; in ips_setup_funclist()
602 ha->func.init = ips_init_copperhead_memio; in ips_setup_funclist()
603 ha->func.statupd = ips_statupd_copperhead_memio; in ips_setup_funclist()
604 ha->func.statinit = ips_statinit_memio; in ips_setup_funclist()
605 ha->func.reset = ips_reset_copperhead_memio; in ips_setup_funclist()
606 ha->func.intr = ips_intr_copperhead; in ips_setup_funclist()
607 ha->func.erasebios = ips_erase_bios_memio; in ips_setup_funclist()
608 ha->func.programbios = ips_program_bios_memio; in ips_setup_funclist()
609 ha->func.verifybios = ips_verify_bios_memio; in ips_setup_funclist()
610 ha->func.enableint = ips_enable_int_copperhead_memio; in ips_setup_funclist()
611 if (IPS_USE_I2O_DELIVER(ha)) in ips_setup_funclist()
612 ha->func.issue = ips_issue_i2o_memio; in ips_setup_funclist()
614 ha->func.issue = ips_issue_copperhead_memio; in ips_setup_funclist()
617 ha->func.isintr = ips_isintr_copperhead; in ips_setup_funclist()
618 ha->func.isinit = ips_isinit_copperhead; in ips_setup_funclist()
619 ha->func.init = ips_init_copperhead; in ips_setup_funclist()
620 ha->func.statupd = ips_statupd_copperhead; in ips_setup_funclist()
621 ha->func.statinit = ips_statinit; in ips_setup_funclist()
622 ha->func.reset = ips_reset_copperhead; in ips_setup_funclist()
623 ha->func.intr = ips_intr_copperhead; in ips_setup_funclist()
624 ha->func.erasebios = ips_erase_bios; in ips_setup_funclist()
625 ha->func.programbios = ips_program_bios; in ips_setup_funclist()
626 ha->func.verifybios = ips_verify_bios; in ips_setup_funclist()
627 ha->func.enableint = ips_enable_int_copperhead; in ips_setup_funclist()
629 if (IPS_USE_I2O_DELIVER(ha)) in ips_setup_funclist()
630 ha->func.issue = ips_issue_i2o; in ips_setup_funclist()
632 ha->func.issue = ips_issue_copperhead; in ips_setup_funclist()
648 ips_ha_t *ha; in ips_release() local
663 ha = IPS_HA(sh); in ips_release()
665 if (!ha) in ips_release()
669 scb = &ha->scbs[ha->max_cmds - 1]; in ips_release()
671 ips_init_scb(ha, scb); in ips_release()
677 scb->cmd.flush_cache.command_id = IPS_COMMAND_ID(ha, scb); in ips_release()
684 IPS_PRINTK(KERN_WARNING, ha->pcidev, "Flushing Cache.\n"); in ips_release()
687 if (ips_send_wait(ha, scb, ips_cmd_timeout, IPS_INTR_ON) == IPS_FAILURE) in ips_release()
688 IPS_PRINTK(KERN_WARNING, ha->pcidev, "Incomplete Flush.\n"); in ips_release()
690 IPS_PRINTK(KERN_WARNING, ha->pcidev, "Flushing Complete.\n"); in ips_release()
696 ips_free(ha); in ips_release()
699 free_irq(ha->pcidev->irq, ha); in ips_release()
719 ips_ha_t *ha; in ips_halt() local
727 ha = (ips_ha_t *) ips_ha[i]; in ips_halt()
729 if (!ha) in ips_halt()
732 if (!ha->active) in ips_halt()
736 scb = &ha->scbs[ha->max_cmds - 1]; in ips_halt()
738 ips_init_scb(ha, scb); in ips_halt()
744 scb->cmd.flush_cache.command_id = IPS_COMMAND_ID(ha, scb); in ips_halt()
751 IPS_PRINTK(KERN_WARNING, ha->pcidev, "Flushing Cache.\n"); in ips_halt()
754 if (ips_send_wait(ha, scb, ips_cmd_timeout, IPS_INTR_ON) == in ips_halt()
756 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_halt()
759 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_halt()
777 ips_ha_t *ha; in ips_eh_abort() local
788 ha = (ips_ha_t *) SC->device->host->hostdata; in ips_eh_abort()
790 if (!ha) in ips_eh_abort()
793 if (!ha->active) in ips_eh_abort()
799 item = ha->copp_waitlist.head; in ips_eh_abort()
805 ips_removeq_copp(&ha->copp_waitlist, item); in ips_eh_abort()
809 } else if (ips_removeq_wait(&ha->scb_waitlist, SC)) { in ips_eh_abort()
836 ips_ha_t *ha; in __ips_eh_reset() local
851 ha = (ips_ha_t *) SC->device->host->hostdata; in __ips_eh_reset()
853 if (!ha) { in __ips_eh_reset()
859 if (!ha->active) in __ips_eh_reset()
872 if (ha->ioctl_reset == 0) { /* IF Not an IOCTL Requested Reset */ in __ips_eh_reset()
873 scb = &ha->scbs[ha->max_cmds - 1]; in __ips_eh_reset()
875 ips_init_scb(ha, scb); in __ips_eh_reset()
881 scb->cmd.flush_cache.command_id = IPS_COMMAND_ID(ha, scb); in __ips_eh_reset()
889 ret = ips_send_wait(ha, scb, ips_cmd_timeout, IPS_INTR_IORL); in __ips_eh_reset()
891 IPS_PRINTK(KERN_NOTICE, ha->pcidev, in __ips_eh_reset()
900 ha->ioctl_reset = 0; /* Reset the IOCTL Requested Reset Flag */ in __ips_eh_reset()
906 IPS_PRINTK(KERN_NOTICE, ha->pcidev, "Resetting controller.\n"); in __ips_eh_reset()
907 ret = (*ha->func.reset) (ha); in __ips_eh_reset()
912 IPS_PRINTK(KERN_NOTICE, ha->pcidev, in __ips_eh_reset()
917 ips_name, ha->host_num); in __ips_eh_reset()
919 while ((scb = ips_removeq_scb_head(&ha->scb_activelist))) { in __ips_eh_reset()
922 ips_freescb(ha, scb); in __ips_eh_reset()
927 ips_name, ha->host_num); in __ips_eh_reset()
929 while ((scsi_cmd = ips_removeq_wait_head(&ha->scb_waitlist))) { in __ips_eh_reset()
934 ha->active = false; in __ips_eh_reset()
938 if (!ips_clear_adapter(ha, IPS_INTR_IORL)) { in __ips_eh_reset()
941 IPS_PRINTK(KERN_NOTICE, ha->pcidev, in __ips_eh_reset()
946 ips_name, ha->host_num); in __ips_eh_reset()
948 while ((scb = ips_removeq_scb_head(&ha->scb_activelist))) { in __ips_eh_reset()
951 ips_freescb(ha, scb); in __ips_eh_reset()
956 ips_name, ha->host_num); in __ips_eh_reset()
958 while ((scsi_cmd = ips_removeq_wait_head(&ha->scb_waitlist))) { in __ips_eh_reset()
963 ha->active = false; in __ips_eh_reset()
968 if (le32_to_cpu(ha->subsys->param[3]) & 0x300000) { in __ips_eh_reset()
969 ha->last_ffdc = ktime_get_real_seconds(); in __ips_eh_reset()
970 ha->reset_count++; in __ips_eh_reset()
971 ips_ffdc_reset(ha, IPS_INTR_IORL); in __ips_eh_reset()
975 DEBUG_VAR(1, "(%s%d) Failing active commands", ips_name, ha->host_num); in __ips_eh_reset()
977 while ((scb = ips_removeq_scb_head(&ha->scb_activelist))) { in __ips_eh_reset()
980 ips_freescb(ha, scb); in __ips_eh_reset()
984 for (i = 1; i < ha->nbus; i++) in __ips_eh_reset()
985 ha->dcdb_active[i - 1] = 0; in __ips_eh_reset()
988 ha->num_ioctl = 0; in __ips_eh_reset()
990 ips_next(ha, IPS_INTR_IORL); in __ips_eh_reset()
1023 ips_ha_t *ha; in ips_queue_lck() local
1028 ha = (ips_ha_t *) SC->device->host->hostdata; in ips_queue_lck()
1030 if (!ha) in ips_queue_lck()
1033 if (!ha->active) in ips_queue_lck()
1037 if (ha->copp_waitlist.count == IPS_MAX_IOCTL_QUEUE) { in ips_queue_lck()
1043 } else if (ha->scb_waitlist.count == IPS_MAX_QUEUE) { in ips_queue_lck()
1052 ha->host_num, in ips_queue_lck()
1058 && (scmd_id(SC) == ha->ha_id[scmd_channel(SC)])) { in ips_queue_lck()
1075 if (ha->scb_activelist.count != 0) { in ips_queue_lck()
1080 ha->ioctl_reset = 1; /* This reset request is from an IOCTL */ in ips_queue_lck()
1100 ips_putq_copp_tail(&ha->copp_waitlist, scratch); in ips_queue_lck()
1102 ips_putq_wait_tail(&ha->scb_waitlist, SC); in ips_queue_lck()
1105 ips_next(ha, IPS_INTR_IORL); in ips_queue_lck()
1129 ips_ha_t *ha = (ips_ha_t *) sdev->host->hostdata; in DEF_SCSI_QCMD() local
1136 if (!ha) in DEF_SCSI_QCMD()
1140 if (!ha->active) in DEF_SCSI_QCMD()
1143 if (!ips_read_adapter_status(ha, IPS_INTR_ON)) in DEF_SCSI_QCMD()
1147 if ((capacity > 0x400000) && ((ha->enq->ucMiscFlag & 0x8) == 0)) { in DEF_SCSI_QCMD()
1179 ips_ha_t *ha; in ips_slave_configure() local
1182 ha = IPS_HA(SDptr->host); in ips_slave_configure()
1184 min = ha->max_cmds / 2; in ips_slave_configure()
1185 if (ha->enq->ucLogDriveCount <= 2) in ips_slave_configure()
1186 min = ha->max_cmds - 1; in ips_slave_configure()
1207 ips_ha_t *ha; in do_ipsintr() local
1213 ha = (ips_ha_t *) dev_id; in do_ipsintr()
1214 if (!ha) in do_ipsintr()
1216 host = ips_sh[ha->host_num]; in do_ipsintr()
1219 (*ha->func.intr) (ha); in do_ipsintr()
1225 if (!ha->active) { in do_ipsintr()
1230 irqstatus = (*ha->func.intr) (ha); in do_ipsintr()
1235 ips_next(ha, IPS_INTR_ON); in do_ipsintr()
1251 ips_intr_copperhead(ips_ha_t * ha) in ips_intr_copperhead() argument
1260 if (!ha) in ips_intr_copperhead()
1263 if (!ha->active) in ips_intr_copperhead()
1266 intrstatus = (*ha->func.isintr) (ha); in ips_intr_copperhead()
1277 sp = &ha->sp; in ips_intr_copperhead()
1279 intrstatus = (*ha->func.isintr) (ha); in ips_intr_copperhead()
1284 cstatus.value = (*ha->func.statupd) (ha); in ips_intr_copperhead()
1291 ips_chkstatus(ha, &cstatus); in ips_intr_copperhead()
1298 (*scb->callback) (ha, scb); in ips_intr_copperhead()
1315 ips_intr_morpheus(ips_ha_t * ha) in ips_intr_morpheus() argument
1324 if (!ha) in ips_intr_morpheus()
1327 if (!ha->active) in ips_intr_morpheus()
1330 intrstatus = (*ha->func.isintr) (ha); in ips_intr_morpheus()
1341 sp = &ha->sp; in ips_intr_morpheus()
1343 intrstatus = (*ha->func.isintr) (ha); in ips_intr_morpheus()
1348 cstatus.value = (*ha->func.statupd) (ha); in ips_intr_morpheus()
1355 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_intr_morpheus()
1361 ips_chkstatus(ha, &cstatus); in ips_intr_morpheus()
1368 (*scb->callback) (ha, scb); in ips_intr_morpheus()
1387 ips_ha_t *ha; in ips_info() local
1391 ha = IPS_HA(SH); in ips_info()
1393 if (!ha) in ips_info()
1402 if (ha->ad_type > 0 && ha->ad_type <= MAX_ADAPTER_NAME) { in ips_info()
1404 strcat(bp, ips_adapter_name[ha->ad_type - 1]); in ips_info()
1415 ips_ha_t *ha = NULL; in ips_write_info() local
1421 ha = (ips_ha_t *) ips_sh[i]->hostdata; in ips_write_info()
1427 if (!ha) in ips_write_info()
1437 ips_ha_t *ha = NULL; in ips_show_info() local
1443 ha = (ips_ha_t *) ips_sh[i]->hostdata; in ips_show_info()
1449 if (!ha) in ips_show_info()
1452 return ips_host_info(ha, m); in ips_show_info()
1508 ips_alloc_passthru_buffer(ips_ha_t * ha, int length) in ips_alloc_passthru_buffer() argument
1513 if (ha->ioctl_data && length <= ha->ioctl_len) in ips_alloc_passthru_buffer()
1516 bigger_buf = dma_alloc_coherent(&ha->pcidev->dev, length, &dma_busaddr, in ips_alloc_passthru_buffer()
1520 dma_free_coherent(&ha->pcidev->dev, ha->ioctl_len, in ips_alloc_passthru_buffer()
1521 ha->ioctl_data, ha->ioctl_busaddr); in ips_alloc_passthru_buffer()
1523 ha->ioctl_data = (char *) bigger_buf; in ips_alloc_passthru_buffer()
1524 ha->ioctl_len = length; in ips_alloc_passthru_buffer()
1525 ha->ioctl_busaddr = dma_busaddr; in ips_alloc_passthru_buffer()
1542 ips_make_passthru(ips_ha_t *ha, struct scsi_cmnd *SC, ips_scb_t *scb, int intr) in ips_make_passthru() argument
1557 ips_name, ha->host_num); in ips_make_passthru()
1560 if (ips_alloc_passthru_buffer(ha, length)) { in ips_make_passthru()
1563 if (ha->ioctl_data) { in ips_make_passthru()
1564 pt = (ips_passthru_t *) ha->ioctl_data; in ips_make_passthru()
1572 ha->ioctl_datasize = length; in ips_make_passthru()
1574 ips_scmd_buf_read(SC, ha->ioctl_data, ha->ioctl_datasize); in ips_make_passthru()
1575 pt = (ips_passthru_t *) ha->ioctl_data; in ips_make_passthru()
1589 memcpy(ha->ioctl_data + sizeof (ips_passthru_t), in ips_make_passthru()
1591 ips_scmd_buf_write(SC, ha->ioctl_data, in ips_make_passthru()
1604 ips_name, ha->host_num); in ips_make_passthru()
1609 if (ha->pcidev->device == IPS_DEVICEID_COPPERHEAD && in ips_make_passthru()
1612 ret = ips_flash_copperhead(ha, pt, scb); in ips_make_passthru()
1613 ips_scmd_buf_write(SC, ha->ioctl_data, in ips_make_passthru()
1617 if (ips_usrcmd(ha, pt, scb)) in ips_make_passthru()
1636 ips_flash_copperhead(ips_ha_t * ha, ips_passthru_t * pt, ips_scb_t * scb) in ips_flash_copperhead() argument
1642 if (IPS_IS_TROMBONE(ha) && pt->CoppCP.cmd.flashfw.type == IPS_FW_IMAGE) { in ips_flash_copperhead()
1643 if (ips_usrcmd(ha, pt, scb)) in ips_flash_copperhead()
1656 return ips_flash_bios(ha, pt, scb); in ips_flash_copperhead()
1659 ha->flash_data = ips_FlashData; in ips_flash_copperhead()
1660 ha->flash_busaddr = ips_flashbusaddr; in ips_flash_copperhead()
1661 ha->flash_len = PAGE_SIZE << 7; in ips_flash_copperhead()
1662 ha->flash_datasize = 0; in ips_flash_copperhead()
1663 } else if (!ha->flash_data) { in ips_flash_copperhead()
1666 ha->flash_data = dma_alloc_coherent(&ha->pcidev->dev, in ips_flash_copperhead()
1667 datasize, &ha->flash_busaddr, GFP_KERNEL); in ips_flash_copperhead()
1668 if (!ha->flash_data){ in ips_flash_copperhead()
1672 ha->flash_datasize = 0; in ips_flash_copperhead()
1673 ha->flash_len = datasize; in ips_flash_copperhead()
1677 if (pt->CoppCP.cmd.flashfw.count + ha->flash_datasize > in ips_flash_copperhead()
1678 ha->flash_len) { in ips_flash_copperhead()
1679 ips_free_flash_copperhead(ha); in ips_flash_copperhead()
1680 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_flash_copperhead()
1685 if (!ha->flash_data) in ips_flash_copperhead()
1688 memcpy(&ha->flash_data[ha->flash_datasize], pt + 1, in ips_flash_copperhead()
1690 ha->flash_datasize += pt->CoppCP.cmd.flashfw.count; in ips_flash_copperhead()
1694 return ips_flash_bios(ha, pt, scb); in ips_flash_copperhead()
1696 return ips_flash_firmware(ha, pt, scb); in ips_flash_copperhead()
1707 ips_flash_bios(ips_ha_t * ha, ips_passthru_t * pt, ips_scb_t * scb) in ips_flash_bios() argument
1712 if ((!ha->func.programbios) || (!ha->func.erasebios) || in ips_flash_bios()
1713 (!ha->func.verifybios)) in ips_flash_bios()
1715 if ((*ha->func.erasebios) (ha)) { in ips_flash_bios()
1718 ips_name, ha->host_num); in ips_flash_bios()
1721 if ((*ha->func.programbios) (ha, in ips_flash_bios()
1722 ha->flash_data + in ips_flash_bios()
1724 ha->flash_datasize - in ips_flash_bios()
1728 ips_name, ha->host_num); in ips_flash_bios()
1731 if ((*ha->func.verifybios) (ha, in ips_flash_bios()
1732 ha->flash_data + in ips_flash_bios()
1734 ha->flash_datasize - in ips_flash_bios()
1738 ips_name, ha->host_num); in ips_flash_bios()
1741 ips_free_flash_copperhead(ha); in ips_flash_bios()
1745 if (!ha->func.erasebios) in ips_flash_bios()
1747 if ((*ha->func.erasebios) (ha)) { in ips_flash_bios()
1750 ips_name, ha->host_num); in ips_flash_bios()
1758 ips_free_flash_copperhead(ha); in ips_flash_bios()
1771 ips_fill_scb_sg_single(ips_ha_t * ha, dma_addr_t busaddr, in ips_fill_scb_sg_single() argument
1777 if ((scb->data_len + e_len) > ha->max_xfer) { in ips_fill_scb_sg_single()
1778 e_len = ha->max_xfer - scb->data_len; in ips_fill_scb_sg_single()
1786 if (IPS_USE_ENH_SGLIST(ha)) { in ips_fill_scb_sg_single()
1809 ips_flash_firmware(ips_ha_t * ha, ips_passthru_t * pt, ips_scb_t * scb) in ips_flash_firmware() argument
1818 pt->CoppCP.cmd.flashfw.count = cpu_to_le32(ha->flash_datasize); in ips_flash_firmware()
1822 ips_free_flash_copperhead(ha); in ips_flash_firmware()
1843 scb->data_len = ha->flash_datasize; in ips_flash_firmware()
1845 dma_map_single(&ha->pcidev->dev, ha->flash_data, scb->data_len, in ips_flash_firmware()
1848 scb->cmd.flashfw.command_id = IPS_COMMAND_ID(ha, scb); in ips_flash_firmware()
1862 ips_free_flash_copperhead(ips_ha_t * ha) in ips_free_flash_copperhead() argument
1864 if (ha->flash_data == ips_FlashData) in ips_free_flash_copperhead()
1866 else if (ha->flash_data) in ips_free_flash_copperhead()
1867 dma_free_coherent(&ha->pcidev->dev, ha->flash_len, in ips_free_flash_copperhead()
1868 ha->flash_data, ha->flash_busaddr); in ips_free_flash_copperhead()
1869 ha->flash_data = NULL; in ips_free_flash_copperhead()
1882 ips_usrcmd(ips_ha_t * ha, ips_passthru_t * pt, ips_scb_t * scb) in ips_usrcmd() argument
1889 if ((!scb) || (!pt) || (!ha)) in ips_usrcmd()
1911 scb->cmd.basic_io.command_id = IPS_COMMAND_ID(ha, scb); in ips_usrcmd()
1921 scb->data_busaddr = ha->ioctl_busaddr + sizeof (ips_passthru_t); in ips_usrcmd()
1970 ips_cleanup_passthru(ips_ha_t * ha, ips_scb_t * scb) in ips_cleanup_passthru() argument
1978 ips_name, ha->host_num); in ips_cleanup_passthru()
1982 pt = (ips_passthru_t *) ha->ioctl_data; in ips_cleanup_passthru()
1990 pt->AdapterType = ha->ad_type; in ips_cleanup_passthru()
1992 if (ha->pcidev->device == IPS_DEVICEID_COPPERHEAD && in ips_cleanup_passthru()
1995 ips_free_flash_copperhead(ha); in ips_cleanup_passthru()
1997 ips_scmd_buf_write(scb->scsi_cmd, ha->ioctl_data, ha->ioctl_datasize); in ips_cleanup_passthru()
2010 ips_host_info(ips_ha_t *ha, struct seq_file *m) in ips_host_info() argument
2016 if ((le32_to_cpu(ha->nvram->signature) == IPS_NVRAM_P5_SIG) && in ips_host_info()
2017 (le16_to_cpu(ha->nvram->adapter_type) != 0)) in ips_host_info()
2019 ips_adapter_name[ha->ad_type - 1]); in ips_host_info()
2023 if (ha->io_addr) in ips_host_info()
2026 ha->io_addr, ha->io_len); in ips_host_info()
2028 if (ha->mem_addr) { in ips_host_info()
2031 ha->mem_addr, ha->mem_len); in ips_host_info()
2034 (unsigned long)ha->mem_ptr); in ips_host_info()
2037 seq_printf(m, "\tIRQ number : %d\n", ha->pcidev->irq); in ips_host_info()
2042 if (le32_to_cpu(ha->nvram->signature) == IPS_NVRAM_P5_SIG) { in ips_host_info()
2043 if (ha->nvram->bios_low[3] == 0) { in ips_host_info()
2046 ha->nvram->bios_high[0], ha->nvram->bios_high[1], in ips_host_info()
2047 ha->nvram->bios_high[2], ha->nvram->bios_high[3], in ips_host_info()
2048 ha->nvram->bios_low[0], ha->nvram->bios_low[1], in ips_host_info()
2049 ha->nvram->bios_low[2]); in ips_host_info()
2054 ha->nvram->bios_high[0], ha->nvram->bios_high[1], in ips_host_info()
2055 ha->nvram->bios_high[2], ha->nvram->bios_high[3], in ips_host_info()
2056 ha->nvram->bios_low[0], ha->nvram->bios_low[1], in ips_host_info()
2057 ha->nvram->bios_low[2], ha->nvram->bios_low[3]); in ips_host_info()
2062 if (ha->enq->CodeBlkVersion[7] == 0) { in ips_host_info()
2065 ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1], in ips_host_info()
2066 ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3], in ips_host_info()
2067 ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5], in ips_host_info()
2068 ha->enq->CodeBlkVersion[6]); in ips_host_info()
2072 ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1], in ips_host_info()
2073 ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3], in ips_host_info()
2074 ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5], in ips_host_info()
2075 ha->enq->CodeBlkVersion[6], ha->enq->CodeBlkVersion[7]); in ips_host_info()
2078 if (ha->enq->BootBlkVersion[7] == 0) { in ips_host_info()
2081 ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1], in ips_host_info()
2082 ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3], in ips_host_info()
2083 ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5], in ips_host_info()
2084 ha->enq->BootBlkVersion[6]); in ips_host_info()
2088 ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1], in ips_host_info()
2089 ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3], in ips_host_info()
2090 ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5], in ips_host_info()
2091 ha->enq->BootBlkVersion[6], ha->enq->BootBlkVersion[7]); in ips_host_info()
2101 ha->enq->ucMaxPhysicalDevices); in ips_host_info()
2103 ha->max_cmds); in ips_host_info()
2105 ha->scb_waitlist.count); in ips_host_info()
2107 ha->scb_activelist.count - ha->num_ioctl); in ips_host_info()
2109 ha->copp_waitlist.count); in ips_host_info()
2111 ha->num_ioctl); in ips_host_info()
2128 ips_identify_controller(ips_ha_t * ha) in ips_identify_controller() argument
2132 switch (ha->pcidev->device) { in ips_identify_controller()
2134 if (ha->pcidev->revision <= IPS_REVID_SERVERAID) { in ips_identify_controller()
2135 ha->ad_type = IPS_ADTYPE_SERVERAID; in ips_identify_controller()
2136 } else if (ha->pcidev->revision == IPS_REVID_SERVERAID2) { in ips_identify_controller()
2137 ha->ad_type = IPS_ADTYPE_SERVERAID2; in ips_identify_controller()
2138 } else if (ha->pcidev->revision == IPS_REVID_NAVAJO) { in ips_identify_controller()
2139 ha->ad_type = IPS_ADTYPE_NAVAJO; in ips_identify_controller()
2140 } else if ((ha->pcidev->revision == IPS_REVID_SERVERAID2) in ips_identify_controller()
2141 && (ha->slot_num == 0)) { in ips_identify_controller()
2142 ha->ad_type = IPS_ADTYPE_KIOWA; in ips_identify_controller()
2143 } else if ((ha->pcidev->revision >= IPS_REVID_CLARINETP1) && in ips_identify_controller()
2144 (ha->pcidev->revision <= IPS_REVID_CLARINETP3)) { in ips_identify_controller()
2145 if (ha->enq->ucMaxPhysicalDevices == 15) in ips_identify_controller()
2146 ha->ad_type = IPS_ADTYPE_SERVERAID3L; in ips_identify_controller()
2148 ha->ad_type = IPS_ADTYPE_SERVERAID3; in ips_identify_controller()
2149 } else if ((ha->pcidev->revision >= IPS_REVID_TROMBONE32) && in ips_identify_controller()
2150 (ha->pcidev->revision <= IPS_REVID_TROMBONE64)) { in ips_identify_controller()
2151 ha->ad_type = IPS_ADTYPE_SERVERAID4H; in ips_identify_controller()
2156 switch (ha->pcidev->subsystem_device) { in ips_identify_controller()
2158 ha->ad_type = IPS_ADTYPE_SERVERAID4L; in ips_identify_controller()
2162 ha->ad_type = IPS_ADTYPE_SERVERAID4M; in ips_identify_controller()
2166 ha->ad_type = IPS_ADTYPE_SERVERAID4MX; in ips_identify_controller()
2170 ha->ad_type = IPS_ADTYPE_SERVERAID4LX; in ips_identify_controller()
2174 ha->ad_type = IPS_ADTYPE_SERVERAID5I2; in ips_identify_controller()
2178 ha->ad_type = IPS_ADTYPE_SERVERAID5I1; in ips_identify_controller()
2185 switch (ha->pcidev->subsystem_device) { in ips_identify_controller()
2187 ha->ad_type = IPS_ADTYPE_SERVERAID6M; in ips_identify_controller()
2190 ha->ad_type = IPS_ADTYPE_SERVERAID6I; in ips_identify_controller()
2193 ha->ad_type = IPS_ADTYPE_SERVERAID7k; in ips_identify_controller()
2196 ha->ad_type = IPS_ADTYPE_SERVERAID7M; in ips_identify_controller()
2213 ips_get_bios_version(ips_ha_t * ha, int intr) in ips_get_bios_version() argument
2227 memcpy(ha->bios_version, " ?", 8); in ips_get_bios_version()
2229 if (ha->pcidev->device == IPS_DEVICEID_COPPERHEAD) { in ips_get_bios_version()
2230 if (IPS_USE_MEMIO(ha)) { in ips_get_bios_version()
2234 writel(0, ha->mem_ptr + IPS_REG_FLAP); in ips_get_bios_version()
2235 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2238 if (readb(ha->mem_ptr + IPS_REG_FLDP) != 0x55) in ips_get_bios_version()
2241 writel(1, ha->mem_ptr + IPS_REG_FLAP); in ips_get_bios_version()
2242 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2245 if (readb(ha->mem_ptr + IPS_REG_FLDP) != 0xAA) in ips_get_bios_version()
2249 writel(0x1FF, ha->mem_ptr + IPS_REG_FLAP); in ips_get_bios_version()
2250 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2253 major = readb(ha->mem_ptr + IPS_REG_FLDP); in ips_get_bios_version()
2256 writel(0x1FE, ha->mem_ptr + IPS_REG_FLAP); in ips_get_bios_version()
2257 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2259 minor = readb(ha->mem_ptr + IPS_REG_FLDP); in ips_get_bios_version()
2262 writel(0x1FD, ha->mem_ptr + IPS_REG_FLAP); in ips_get_bios_version()
2263 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2265 subminor = readb(ha->mem_ptr + IPS_REG_FLDP); in ips_get_bios_version()
2271 outl(0, ha->io_addr + IPS_REG_FLAP); in ips_get_bios_version()
2272 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2275 if (inb(ha->io_addr + IPS_REG_FLDP) != 0x55) in ips_get_bios_version()
2278 outl(1, ha->io_addr + IPS_REG_FLAP); in ips_get_bios_version()
2279 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2282 if (inb(ha->io_addr + IPS_REG_FLDP) != 0xAA) in ips_get_bios_version()
2286 outl(0x1FF, ha->io_addr + IPS_REG_FLAP); in ips_get_bios_version()
2287 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2290 major = inb(ha->io_addr + IPS_REG_FLDP); in ips_get_bios_version()
2293 outl(0x1FE, ha->io_addr + IPS_REG_FLAP); in ips_get_bios_version()
2294 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2297 minor = inb(ha->io_addr + IPS_REG_FLDP); in ips_get_bios_version()
2300 outl(0x1FD, ha->io_addr + IPS_REG_FLAP); in ips_get_bios_version()
2301 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2304 subminor = inb(ha->io_addr + IPS_REG_FLDP); in ips_get_bios_version()
2310 buffer = ha->ioctl_data; in ips_get_bios_version()
2314 scb = &ha->scbs[ha->max_cmds - 1]; in ips_get_bios_version()
2316 ips_init_scb(ha, scb); in ips_get_bios_version()
2322 scb->cmd.flashfw.command_id = IPS_COMMAND_ID(ha, scb); in ips_get_bios_version()
2329 scb->cmd.flashfw.buffer_addr = ha->ioctl_busaddr; in ips_get_bios_version()
2333 ips_send_wait(ha, scb, ips_cmd_timeout, in ips_get_bios_version()
2351 ha->bios_version[0] = hex_asc_upper_hi(major); in ips_get_bios_version()
2352 ha->bios_version[1] = '.'; in ips_get_bios_version()
2353 ha->bios_version[2] = hex_asc_upper_lo(major); in ips_get_bios_version()
2354 ha->bios_version[3] = hex_asc_upper_lo(subminor); in ips_get_bios_version()
2355 ha->bios_version[4] = '.'; in ips_get_bios_version()
2356 ha->bios_version[5] = hex_asc_upper_hi(minor); in ips_get_bios_version()
2357 ha->bios_version[6] = hex_asc_upper_lo(minor); in ips_get_bios_version()
2358 ha->bios_version[7] = 0; in ips_get_bios_version()
2373 ips_hainit(ips_ha_t * ha) in ips_hainit() argument
2379 if (!ha) in ips_hainit()
2382 if (ha->func.statinit) in ips_hainit()
2383 (*ha->func.statinit) (ha); in ips_hainit()
2385 if (ha->func.enableint) in ips_hainit()
2386 (*ha->func.enableint) (ha); in ips_hainit()
2389 ha->reset_count = 1; in ips_hainit()
2390 ha->last_ffdc = ktime_get_real_seconds(); in ips_hainit()
2391 ips_ffdc_reset(ha, IPS_INTR_IORL); in ips_hainit()
2393 if (!ips_read_config(ha, IPS_INTR_IORL)) { in ips_hainit()
2394 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_hainit()
2400 if (!ips_read_adapter_status(ha, IPS_INTR_IORL)) { in ips_hainit()
2401 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_hainit()
2408 ips_identify_controller(ha); in ips_hainit()
2410 if (!ips_read_subsystem_parameters(ha, IPS_INTR_IORL)) { in ips_hainit()
2411 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_hainit()
2418 if (!ips_write_driver_status(ha, IPS_INTR_IORL)) { in ips_hainit()
2419 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_hainit()
2426 if ((ha->conf->ucLogDriveCount > 0) && (ha->requires_esl == 1)) in ips_hainit()
2427 ips_clear_adapter(ha, IPS_INTR_IORL); in ips_hainit()
2430 ha->ntargets = IPS_MAX_TARGETS + 1; in ips_hainit()
2431 ha->nlun = 1; in ips_hainit()
2432 ha->nbus = (ha->enq->ucMaxPhysicalDevices / IPS_MAX_TARGETS) + 1; in ips_hainit()
2434 switch (ha->conf->logical_drive[0].ucStripeSize) { in ips_hainit()
2436 ha->max_xfer = 0x10000; in ips_hainit()
2440 ha->max_xfer = 0x20000; in ips_hainit()
2444 ha->max_xfer = 0x40000; in ips_hainit()
2449 ha->max_xfer = 0x80000; in ips_hainit()
2454 if (le32_to_cpu(ha->subsys->param[4]) & 0x1) { in ips_hainit()
2456 ha->max_cmds = ha->enq->ucConcurrentCmdCount; in ips_hainit()
2459 switch (ha->conf->logical_drive[0].ucStripeSize) { in ips_hainit()
2461 ha->max_cmds = 32; in ips_hainit()
2465 ha->max_cmds = 16; in ips_hainit()
2469 ha->max_cmds = 8; in ips_hainit()
2474 ha->max_cmds = 4; in ips_hainit()
2480 if ((ha->ad_type == IPS_ADTYPE_SERVERAID3L) || in ips_hainit()
2481 (ha->ad_type == IPS_ADTYPE_SERVERAID4L) || in ips_hainit()
2482 (ha->ad_type == IPS_ADTYPE_SERVERAID4LX)) { in ips_hainit()
2483 if ((ha->max_cmds > MaxLiteCmds) && (MaxLiteCmds)) in ips_hainit()
2484 ha->max_cmds = MaxLiteCmds; in ips_hainit()
2488 ha->ha_id[0] = IPS_ADAPTER_ID; in ips_hainit()
2489 for (i = 1; i < ha->nbus; i++) { in ips_hainit()
2490 ha->ha_id[i] = ha->conf->init_id[i - 1] & 0x1f; in ips_hainit()
2491 ha->dcdb_active[i - 1] = 0; in ips_hainit()
2507 ips_next(ips_ha_t * ha, int intr) in ips_next() argument
2518 if (!ha) in ips_next()
2520 host = ips_sh[ha->host_num]; in ips_next()
2528 if ((ha->subsys->param[3] & 0x300000) in ips_next()
2529 && (ha->scb_activelist.count == 0)) { in ips_next()
2531 if (now - ha->last_ffdc > IPS_SECS_8HOURS) { in ips_next()
2532 ha->last_ffdc = now; in ips_next()
2533 ips_ffdc_time(ha); in ips_next()
2544 while ((ha->num_ioctl < IPS_MAX_IOCTL) && in ips_next()
2545 (ha->copp_waitlist.head) && (scb = ips_getscb(ha))) { in ips_next()
2547 item = ips_removeq_copp_head(&ha->copp_waitlist); in ips_next()
2548 ha->num_ioctl++; in ips_next()
2554 ret = ips_make_passthru(ha, scb->scsi_cmd, scb, intr); in ips_next()
2565 ips_freescb(ha, scb); in ips_next()
2573 ips_freescb(ha, scb); in ips_next()
2580 ha->num_ioctl--; in ips_next()
2584 ret = ips_send_cmd(ha, scb); in ips_next()
2587 ips_putq_scb_head(&ha->scb_activelist, scb); in ips_next()
2589 ha->num_ioctl--; in ips_next()
2597 ips_freescb(ha, scb); in ips_next()
2600 ips_freescb(ha, scb); in ips_next()
2612 p = ha->scb_waitlist.head; in ips_next()
2613 while ((p) && (scb = ips_getscb(ha))) { in ips_next()
2615 && (ha-> in ips_next()
2618 ips_freescb(ha, scb); in ips_next()
2624 SC = ips_removeq_wait(&ha->scb_waitlist, q); in ips_next()
2655 (ha, sg_dma_address(sg), scb, i, in ips_next()
2686 ret = ips_send_cmd(ha, scb); in ips_next()
2690 ips_putq_scb_head(&ha->scb_activelist, scb); in ips_next()
2699 ha->dcdb_active[scb->bus - 1] &= in ips_next()
2702 ips_freescb(ha, scb); in ips_next()
2709 ha->dcdb_active[scb->bus - 1] &= in ips_next()
2712 ips_freescb(ha, scb); in ips_next()
3069 ipsintr_blocking(ips_ha_t * ha, ips_scb_t * scb) in ipsintr_blocking() argument
3073 ips_freescb(ha, scb); in ipsintr_blocking()
3074 if (ha->waitflag && ha->cmd_in_progress == scb->cdb[0]) { in ipsintr_blocking()
3075 ha->waitflag = false; in ipsintr_blocking()
3091 ipsintr_done(ips_ha_t * ha, ips_scb_t * scb) in ipsintr_done() argument
3096 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ipsintr_done()
3104 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ipsintr_done()
3110 ips_done(ha, scb); in ipsintr_done()
3123 ips_done(ips_ha_t * ha, ips_scb_t * scb) in ips_done() argument
3133 ips_cleanup_passthru(ha, scb); in ips_done()
3134 ha->num_ioctl--; in ips_done()
3156 ips_fill_scb_sg_single(ha, in ips_done()
3164 (ha, in ips_done()
3183 ret = ips_send_cmd(ha, scb); in ips_done()
3192 ips_freescb(ha, scb); in ips_done()
3200 ips_freescb(ha, scb); in ips_done()
3211 ha->dcdb_active[scb->bus - 1] &= ~(1 << scb->target_id); in ips_done()
3216 ips_freescb(ha, scb); in ips_done()
3229 ips_map_status(ips_ha_t * ha, ips_scb_t * scb, ips_stat_t * sp) in ips_map_status() argument
3242 ips_name, ha->host_num, in ips_map_status()
3368 ips_send_wait(ips_ha_t * ha, ips_scb_t * scb, int timeout, int intr) in ips_send_wait() argument
3375 ha->waitflag = true; in ips_send_wait()
3376 ha->cmd_in_progress = scb->cdb[0]; in ips_send_wait()
3379 ret = ips_send_cmd(ha, scb); in ips_send_wait()
3385 ret = ips_wait(ha, timeout, intr); in ips_send_wait()
3434 ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb) in ips_send_cmd() argument
3452 if (ha->waitflag && ha->cmd_in_progress == scb->cdb[0]) in ips_send_cmd()
3453 ha->waitflag = false; in ips_send_cmd()
3518 scb->cmd.logical_info.command_id = IPS_COMMAND_ID(ha, scb); in ips_send_cmd()
3522 scb->data_busaddr = ha->logical_drive_info_dma_addr; in ips_send_cmd()
3531 ips_reqsen(ha, scb); in ips_send_cmd()
3550 IPS_USE_ENH_SGLIST(ha) ? 0xFF : 0; in ips_send_cmd()
3556 scb->cmd.basic_io.command_id = IPS_COMMAND_ID(ha, scb); in ips_send_cmd()
3596 IPS_USE_ENH_SGLIST(ha) ? 0xFF : 0; in ips_send_cmd()
3602 scb->cmd.basic_io.command_id = IPS_COMMAND_ID(ha, scb); in ips_send_cmd()
3641 scb->cmd.basic_io.command_id = IPS_COMMAND_ID(ha, scb); in ips_send_cmd()
3644 scb->data_len = sizeof (*ha->enq); in ips_send_cmd()
3645 scb->cmd.basic_io.sg_addr = ha->enq_busaddr; in ips_send_cmd()
3651 scb->cmd.logical_info.command_id = IPS_COMMAND_ID(ha, scb); in ips_send_cmd()
3656 scb->data_busaddr = ha->logical_drive_info_dma_addr; in ips_send_cmd()
3699 if (ha->conf->dev[scb->bus - 1][scb->target_id].ucState == 0) { in ips_send_cmd()
3704 ha->dcdb_active[scb->bus - 1] |= (1 << scb->target_id); in ips_send_cmd()
3705 scb->cmd.dcdb.command_id = IPS_COMMAND_ID(ha, scb); in ips_send_cmd()
3718 if (ha->subsys->param[4] & 0x00100000) { /* If NEW Tape DCDB is Supported */ in ips_send_cmd()
3725 IPS_USE_ENH_SGLIST(ha) ? 0xFF : 0; in ips_send_cmd()
3764 IPS_USE_ENH_SGLIST(ha) ? 0xFF : 0; in ips_send_cmd()
3802 return ((*ha->func.issue) (ha, scb)); in ips_send_cmd()
3815 ips_chkstatus(ips_ha_t * ha, IPS_STATUS * pstatus) in ips_chkstatus() argument
3826 scb = &ha->scbs[pstatus->fields.command_id]; in ips_chkstatus()
3831 sp = &ha->sp; in ips_chkstatus()
3836 ips_removeq_scb(&ha->scb_activelist, scb); in ips_chkstatus()
3844 ha->host_num, in ips_chkstatus()
3863 ips_name, ha->host_num, in ips_chkstatus()
3881 if (!ips_online(ha, scb)) { in ips_chkstatus()
3887 if (ips_online(ha, scb)) { in ips_chkstatus()
3888 ips_inquiry(ha, scb); in ips_chkstatus()
3895 ips_reqsen(ha, scb); in ips_chkstatus()
3907 if (!ips_online(ha, scb) in ips_chkstatus()
3908 || !ips_msense(ha, scb)) { in ips_chkstatus()
3914 if (ips_online(ha, scb)) in ips_chkstatus()
3915 ips_rdcap(ha, scb); in ips_chkstatus()
3954 ips_name, ha->host_num, in ips_chkstatus()
3959 ips_map_status(ha, scb, sp); in ips_chkstatus()
3973 ips_online(ips_ha_t * ha, ips_scb_t * scb) in ips_online() argument
3981 memset(ha->logical_drive_info, 0, sizeof (IPS_LD_INFO)); in ips_online()
3985 if (ha->logical_drive_info->drive_info[scb->target_id].state != in ips_online()
3987 && ha->logical_drive_info->drive_info[scb->target_id].state != in ips_online()
3989 && ha->logical_drive_info->drive_info[scb->target_id].state != in ips_online()
3991 && ha->logical_drive_info->drive_info[scb->target_id].state != in ips_online()
4008 ips_inquiry(ips_ha_t * ha, ips_scb_t * scb) in ips_inquiry() argument
4043 ips_rdcap(ips_ha_t * ha, ips_scb_t * scb) in ips_rdcap() argument
4054 (ha->logical_drive_info-> in ips_rdcap()
4073 ips_msense(ips_ha_t * ha, ips_scb_t * scb) in ips_msense() argument
4082 if (le32_to_cpu(ha->enq->ulDriveSize[scb->target_id]) > 0x400000 && in ips_msense()
4083 (ha->enq->ucMiscFlag & 0x8) == 0) { in ips_msense()
4092 (le32_to_cpu(ha->enq->ulDriveSize[scb->target_id]) - in ips_msense()
4164 ips_reqsen(ips_ha_t * ha, ips_scb_t * scb) in ips_reqsen() argument
4193 ips_free(ips_ha_t * ha) in ips_free() argument
4198 if (ha) { in ips_free()
4199 if (ha->enq) { in ips_free()
4200 dma_free_coherent(&ha->pcidev->dev, sizeof(IPS_ENQ), in ips_free()
4201 ha->enq, ha->enq_busaddr); in ips_free()
4202 ha->enq = NULL; in ips_free()
4205 kfree(ha->conf); in ips_free()
4206 ha->conf = NULL; in ips_free()
4208 if (ha->adapt) { in ips_free()
4209 dma_free_coherent(&ha->pcidev->dev, in ips_free()
4211 sizeof (IPS_IO_CMD), ha->adapt, in ips_free()
4212 ha->adapt->hw_status_start); in ips_free()
4213 ha->adapt = NULL; in ips_free()
4216 if (ha->logical_drive_info) { in ips_free()
4217 dma_free_coherent(&ha->pcidev->dev, in ips_free()
4219 ha->logical_drive_info, in ips_free()
4220 ha->logical_drive_info_dma_addr); in ips_free()
4221 ha->logical_drive_info = NULL; in ips_free()
4224 kfree(ha->nvram); in ips_free()
4225 ha->nvram = NULL; in ips_free()
4227 kfree(ha->subsys); in ips_free()
4228 ha->subsys = NULL; in ips_free()
4230 if (ha->ioctl_data) { in ips_free()
4231 dma_free_coherent(&ha->pcidev->dev, ha->ioctl_len, in ips_free()
4232 ha->ioctl_data, ha->ioctl_busaddr); in ips_free()
4233 ha->ioctl_data = NULL; in ips_free()
4234 ha->ioctl_datasize = 0; in ips_free()
4235 ha->ioctl_len = 0; in ips_free()
4237 ips_deallocatescbs(ha, ha->max_cmds); in ips_free()
4240 if (ha->mem_ptr) { in ips_free()
4241 iounmap(ha->ioremap_ptr); in ips_free()
4242 ha->ioremap_ptr = NULL; in ips_free()
4243 ha->mem_ptr = NULL; in ips_free()
4246 ha->mem_addr = 0; in ips_free()
4261 ips_deallocatescbs(ips_ha_t * ha, int cmds) in ips_deallocatescbs() argument
4263 if (ha->scbs) { in ips_deallocatescbs()
4264 dma_free_coherent(&ha->pcidev->dev, in ips_deallocatescbs()
4265 IPS_SGLIST_SIZE(ha) * IPS_MAX_SG * cmds, in ips_deallocatescbs()
4266 ha->scbs->sg_list.list, in ips_deallocatescbs()
4267 ha->scbs->sg_busaddr); in ips_deallocatescbs()
4268 dma_free_coherent(&ha->pcidev->dev, sizeof (ips_scb_t) * cmds, in ips_deallocatescbs()
4269 ha->scbs, ha->scbs->scb_busaddr); in ips_deallocatescbs()
4270 ha->scbs = NULL; in ips_deallocatescbs()
4285 ips_allocatescbs(ips_ha_t * ha) in ips_allocatescbs() argument
4295 ha->scbs = dma_alloc_coherent(&ha->pcidev->dev, in ips_allocatescbs()
4296 ha->max_cmds * sizeof (ips_scb_t), in ips_allocatescbs()
4298 if (ha->scbs == NULL) in ips_allocatescbs()
4300 ips_sg.list = dma_alloc_coherent(&ha->pcidev->dev, in ips_allocatescbs()
4301 IPS_SGLIST_SIZE(ha) * IPS_MAX_SG * ha->max_cmds, in ips_allocatescbs()
4304 dma_free_coherent(&ha->pcidev->dev, in ips_allocatescbs()
4305 ha->max_cmds * sizeof (ips_scb_t), ha->scbs, in ips_allocatescbs()
4310 memset(ha->scbs, 0, ha->max_cmds * sizeof (ips_scb_t)); in ips_allocatescbs()
4312 for (i = 0; i < ha->max_cmds; i++) { in ips_allocatescbs()
4313 scb_p = &ha->scbs[i]; in ips_allocatescbs()
4316 if (IPS_USE_ENH_SGLIST(ha)) { in ips_allocatescbs()
4320 sg_dma + IPS_SGLIST_SIZE(ha) * IPS_MAX_SG * i; in ips_allocatescbs()
4325 sg_dma + IPS_SGLIST_SIZE(ha) * IPS_MAX_SG * i; in ips_allocatescbs()
4329 if (i < ha->max_cmds - 1) { in ips_allocatescbs()
4330 scb_p->q_next = ha->scb_freelist; in ips_allocatescbs()
4331 ha->scb_freelist = scb_p; in ips_allocatescbs()
4349 ips_init_scb(ips_ha_t * ha, ips_scb_t * scb) in ips_init_scb() argument
4363 memset(ha->dummy, 0, sizeof (IPS_IO_CMD)); in ips_init_scb()
4366 ha->dummy->op_code = 0xFF; in ips_init_scb()
4367 ha->dummy->ccsar = cpu_to_le32(ha->adapt->hw_status_start in ips_init_scb()
4369 ha->dummy->command_id = IPS_MAX_CMDS; in ips_init_scb()
4378 scb->cmd.basic_io.ccsar = cpu_to_le32(ha->adapt->hw_status_start in ips_init_scb()
4394 ips_getscb(ips_ha_t * ha) in ips_getscb() argument
4400 if ((scb = ha->scb_freelist) == NULL) { in ips_getscb()
4405 ha->scb_freelist = scb->q_next; in ips_getscb()
4409 ips_init_scb(ha, scb); in ips_getscb()
4426 ips_freescb(ips_ha_t * ha, ips_scb_t * scb) in ips_freescb() argument
4433 dma_unmap_single(&ha->pcidev->dev, scb->data_busaddr, in ips_freescb()
4437 if (IPS_COMMAND_ID(ha, scb) < (ha->max_cmds - 1)) { in ips_freescb()
4438 scb->q_next = ha->scb_freelist; in ips_freescb()
4439 ha->scb_freelist = scb; in ips_freescb()
4453 ips_isinit_copperhead(ips_ha_t * ha) in ips_isinit_copperhead() argument
4460 isr = inb(ha->io_addr + IPS_REG_HISR); in ips_isinit_copperhead()
4461 scpr = inb(ha->io_addr + IPS_REG_SCPR); in ips_isinit_copperhead()
4479 ips_isinit_copperhead_memio(ips_ha_t * ha) in ips_isinit_copperhead_memio() argument
4486 isr = readb(ha->mem_ptr + IPS_REG_HISR); in ips_isinit_copperhead_memio()
4487 scpr = readb(ha->mem_ptr + IPS_REG_SCPR); in ips_isinit_copperhead_memio()
4505 ips_isinit_morpheus(ips_ha_t * ha) in ips_isinit_morpheus() argument
4512 if (ips_isintr_morpheus(ha)) in ips_isinit_morpheus()
4513 ips_flush_and_reset(ha); in ips_isinit_morpheus()
4515 post = readl(ha->mem_ptr + IPS_REG_I960_MSG0); in ips_isinit_morpheus()
4516 bits = readl(ha->mem_ptr + IPS_REG_I2O_HIR); in ips_isinit_morpheus()
4537 ips_flush_and_reset(ips_ha_t *ha) in ips_flush_and_reset() argument
4546 scb = dma_alloc_coherent(&ha->pcidev->dev, sizeof(ips_scb_t), in ips_flush_and_reset()
4550 ips_init_scb(ha, scb); in ips_flush_and_reset()
4564 ret = ips_send_cmd(ha, scb); /* Send the Flush Command */ in ips_flush_and_reset()
4571 done = ips_poll_for_flush_complete(ha); in ips_flush_and_reset()
4580 (*ha->func.reset) (ha); in ips_flush_and_reset()
4582 dma_free_coherent(&ha->pcidev->dev, sizeof(ips_scb_t), scb, command_dma); in ips_flush_and_reset()
4597 ips_poll_for_flush_complete(ips_ha_t * ha) in ips_poll_for_flush_complete() argument
4602 cstatus.value = (*ha->func.statupd) (ha); in ips_poll_for_flush_complete()
4624 ips_enable_int_copperhead(ips_ha_t * ha) in ips_enable_int_copperhead() argument
4628 outb(ha->io_addr + IPS_REG_HISR, IPS_BIT_EI); in ips_enable_int_copperhead()
4629 inb(ha->io_addr + IPS_REG_HISR); /*Ensure PCI Posting Completes*/ in ips_enable_int_copperhead()
4641 ips_enable_int_copperhead_memio(ips_ha_t * ha) in ips_enable_int_copperhead_memio() argument
4645 writeb(IPS_BIT_EI, ha->mem_ptr + IPS_REG_HISR); in ips_enable_int_copperhead_memio()
4646 readb(ha->mem_ptr + IPS_REG_HISR); /*Ensure PCI Posting Completes*/ in ips_enable_int_copperhead_memio()
4658 ips_enable_int_morpheus(ips_ha_t * ha) in ips_enable_int_morpheus() argument
4664 Oimr = readl(ha->mem_ptr + IPS_REG_I960_OIMR); in ips_enable_int_morpheus()
4666 writel(Oimr, ha->mem_ptr + IPS_REG_I960_OIMR); in ips_enable_int_morpheus()
4667 readl(ha->mem_ptr + IPS_REG_I960_OIMR); /*Ensure PCI Posting Completes*/ in ips_enable_int_morpheus()
4680 ips_init_copperhead(ips_ha_t * ha) in ips_init_copperhead() argument
4691 Isr = inb(ha->io_addr + IPS_REG_HISR); in ips_init_copperhead()
4703 PostByte[i] = inb(ha->io_addr + IPS_REG_ISPR); in ips_init_copperhead()
4704 outb(Isr, ha->io_addr + IPS_REG_HISR); in ips_init_copperhead()
4708 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_copperhead()
4717 Isr = inb(ha->io_addr + IPS_REG_HISR); in ips_init_copperhead()
4729 inb(ha->io_addr + IPS_REG_ISPR); in ips_init_copperhead()
4730 outb(Isr, ha->io_addr + IPS_REG_HISR); in ips_init_copperhead()
4734 Cbsp = inb(ha->io_addr + IPS_REG_CBSP); in ips_init_copperhead()
4748 outl(0x1010, ha->io_addr + IPS_REG_CCCR); in ips_init_copperhead()
4751 outb(IPS_BIT_EBM, ha->io_addr + IPS_REG_SCPR); in ips_init_copperhead()
4753 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_init_copperhead()
4755 outl(0, ha->io_addr + IPS_REG_NDAE); in ips_init_copperhead()
4758 outb(IPS_BIT_EI, ha->io_addr + IPS_REG_HISR); in ips_init_copperhead()
4773 ips_init_copperhead_memio(ips_ha_t * ha) in ips_init_copperhead_memio() argument
4784 Isr = readb(ha->mem_ptr + IPS_REG_HISR); in ips_init_copperhead_memio()
4796 PostByte[i] = readb(ha->mem_ptr + IPS_REG_ISPR); in ips_init_copperhead_memio()
4797 writeb(Isr, ha->mem_ptr + IPS_REG_HISR); in ips_init_copperhead_memio()
4801 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_copperhead_memio()
4810 Isr = readb(ha->mem_ptr + IPS_REG_HISR); in ips_init_copperhead_memio()
4822 readb(ha->mem_ptr + IPS_REG_ISPR); in ips_init_copperhead_memio()
4823 writeb(Isr, ha->mem_ptr + IPS_REG_HISR); in ips_init_copperhead_memio()
4827 Cbsp = readb(ha->mem_ptr + IPS_REG_CBSP); in ips_init_copperhead_memio()
4841 writel(0x1010, ha->mem_ptr + IPS_REG_CCCR); in ips_init_copperhead_memio()
4844 writeb(IPS_BIT_EBM, ha->mem_ptr + IPS_REG_SCPR); in ips_init_copperhead_memio()
4846 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_init_copperhead_memio()
4848 writel(0, ha->mem_ptr + IPS_REG_NDAE); in ips_init_copperhead_memio()
4851 writeb(IPS_BIT_EI, ha->mem_ptr + IPS_REG_HISR); in ips_init_copperhead_memio()
4867 ips_init_morpheus(ips_ha_t * ha) in ips_init_morpheus() argument
4879 Isr = readl(ha->mem_ptr + IPS_REG_I2O_HIR); in ips_init_morpheus()
4890 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_morpheus()
4896 Post = readl(ha->mem_ptr + IPS_REG_I960_MSG0); in ips_init_morpheus()
4899 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_morpheus()
4904 writel(Isr, ha->mem_ptr + IPS_REG_I2O_HIR); in ips_init_morpheus()
4907 Post = readl(ha->mem_ptr + IPS_REG_I960_MSG0); in ips_init_morpheus()
4915 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_morpheus()
4924 writel(Isr, ha->mem_ptr + IPS_REG_I2O_HIR); in ips_init_morpheus()
4927 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_morpheus()
4935 Isr = readl(ha->mem_ptr + IPS_REG_I2O_HIR); in ips_init_morpheus()
4946 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_morpheus()
4952 Config = readl(ha->mem_ptr + IPS_REG_I960_MSG1); in ips_init_morpheus()
4956 writel(Isr, ha->mem_ptr + IPS_REG_I2O_HIR); in ips_init_morpheus()
4959 Oimr = readl(ha->mem_ptr + IPS_REG_I960_OIMR); in ips_init_morpheus()
4961 writel(Oimr, ha->mem_ptr + IPS_REG_I960_OIMR); in ips_init_morpheus()
4968 ha->requires_esl = 1; in ips_init_morpheus()
4984 ips_reset_copperhead(ips_ha_t * ha) in ips_reset_copperhead() argument
4991 ips_name, ha->host_num, ha->io_addr, ha->pcidev->irq); in ips_reset_copperhead()
4998 outb(IPS_BIT_RST, ha->io_addr + IPS_REG_SCPR); in ips_reset_copperhead()
5003 outb(0, ha->io_addr + IPS_REG_SCPR); in ips_reset_copperhead()
5008 if ((*ha->func.init) (ha)) in ips_reset_copperhead()
5029 ips_reset_copperhead_memio(ips_ha_t * ha) in ips_reset_copperhead_memio() argument
5036 ips_name, ha->host_num, ha->mem_addr, ha->pcidev->irq); in ips_reset_copperhead_memio()
5043 writeb(IPS_BIT_RST, ha->mem_ptr + IPS_REG_SCPR); in ips_reset_copperhead_memio()
5048 writeb(0, ha->mem_ptr + IPS_REG_SCPR); in ips_reset_copperhead_memio()
5053 if ((*ha->func.init) (ha)) in ips_reset_copperhead_memio()
5074 ips_reset_morpheus(ips_ha_t * ha) in ips_reset_morpheus() argument
5082 ips_name, ha->host_num, ha->mem_addr, ha->pcidev->irq); in ips_reset_morpheus()
5089 writel(0x80000000, ha->mem_ptr + IPS_REG_I960_IDR); in ips_reset_morpheus()
5095 pci_read_config_byte(ha->pcidev, 4, &junk); in ips_reset_morpheus()
5097 if ((*ha->func.init) (ha)) in ips_reset_morpheus()
5118 ips_statinit(ips_ha_t * ha) in ips_statinit() argument
5124 ha->adapt->p_status_start = ha->adapt->status; in ips_statinit()
5125 ha->adapt->p_status_end = ha->adapt->status + IPS_MAX_CMDS; in ips_statinit()
5126 ha->adapt->p_status_tail = ha->adapt->status; in ips_statinit()
5128 phys_status_start = ha->adapt->hw_status_start; in ips_statinit()
5129 outl(phys_status_start, ha->io_addr + IPS_REG_SQSR); in ips_statinit()
5131 ha->io_addr + IPS_REG_SQER); in ips_statinit()
5133 ha->io_addr + IPS_REG_SQHR); in ips_statinit()
5134 outl(phys_status_start, ha->io_addr + IPS_REG_SQTR); in ips_statinit()
5136 ha->adapt->hw_status_tail = phys_status_start; in ips_statinit()
5149 ips_statinit_memio(ips_ha_t * ha) in ips_statinit_memio() argument
5155 ha->adapt->p_status_start = ha->adapt->status; in ips_statinit_memio()
5156 ha->adapt->p_status_end = ha->adapt->status + IPS_MAX_CMDS; in ips_statinit_memio()
5157 ha->adapt->p_status_tail = ha->adapt->status; in ips_statinit_memio()
5159 phys_status_start = ha->adapt->hw_status_start; in ips_statinit_memio()
5160 writel(phys_status_start, ha->mem_ptr + IPS_REG_SQSR); in ips_statinit_memio()
5162 ha->mem_ptr + IPS_REG_SQER); in ips_statinit_memio()
5163 writel(phys_status_start + IPS_STATUS_SIZE, ha->mem_ptr + IPS_REG_SQHR); in ips_statinit_memio()
5164 writel(phys_status_start, ha->mem_ptr + IPS_REG_SQTR); in ips_statinit_memio()
5166 ha->adapt->hw_status_tail = phys_status_start; in ips_statinit_memio()
5179 ips_statupd_copperhead(ips_ha_t * ha) in ips_statupd_copperhead() argument
5183 if (ha->adapt->p_status_tail != ha->adapt->p_status_end) { in ips_statupd_copperhead()
5184 ha->adapt->p_status_tail++; in ips_statupd_copperhead()
5185 ha->adapt->hw_status_tail += sizeof (IPS_STATUS); in ips_statupd_copperhead()
5187 ha->adapt->p_status_tail = ha->adapt->p_status_start; in ips_statupd_copperhead()
5188 ha->adapt->hw_status_tail = ha->adapt->hw_status_start; in ips_statupd_copperhead()
5191 outl(ha->adapt->hw_status_tail, in ips_statupd_copperhead()
5192 ha->io_addr + IPS_REG_SQTR); in ips_statupd_copperhead()
5194 return (ha->adapt->p_status_tail->value); in ips_statupd_copperhead()
5207 ips_statupd_copperhead_memio(ips_ha_t * ha) in ips_statupd_copperhead_memio() argument
5211 if (ha->adapt->p_status_tail != ha->adapt->p_status_end) { in ips_statupd_copperhead_memio()
5212 ha->adapt->p_status_tail++; in ips_statupd_copperhead_memio()
5213 ha->adapt->hw_status_tail += sizeof (IPS_STATUS); in ips_statupd_copperhead_memio()
5215 ha->adapt->p_status_tail = ha->adapt->p_status_start; in ips_statupd_copperhead_memio()
5216 ha->adapt->hw_status_tail = ha->adapt->hw_status_start; in ips_statupd_copperhead_memio()
5219 writel(ha->adapt->hw_status_tail, ha->mem_ptr + IPS_REG_SQTR); in ips_statupd_copperhead_memio()
5221 return (ha->adapt->p_status_tail->value); in ips_statupd_copperhead_memio()
5234 ips_statupd_morpheus(ips_ha_t * ha) in ips_statupd_morpheus() argument
5240 val = readl(ha->mem_ptr + IPS_REG_I2O_OUTMSGQ); in ips_statupd_morpheus()
5255 ips_issue_copperhead(ips_ha_t * ha, ips_scb_t * scb) in ips_issue_copperhead() argument
5265 ha->host_num, in ips_issue_copperhead()
5271 ips_name, ha->host_num, scb->cmd.basic_io.command_id); in ips_issue_copperhead()
5277 le32_to_cpu(inl(ha->io_addr + IPS_REG_CCCR))) & IPS_BIT_SEM) { in ips_issue_copperhead()
5284 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_issue_copperhead()
5286 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_issue_copperhead()
5293 outl(scb->scb_busaddr, ha->io_addr + IPS_REG_CCSAR); in ips_issue_copperhead()
5294 outw(IPS_BIT_START_CMD, ha->io_addr + IPS_REG_CCCR); in ips_issue_copperhead()
5309 ips_issue_copperhead_memio(ips_ha_t * ha, ips_scb_t * scb) in ips_issue_copperhead_memio() argument
5319 ha->host_num, in ips_issue_copperhead_memio()
5325 ips_name, ha->host_num, scb->cmd.basic_io.command_id); in ips_issue_copperhead_memio()
5330 while ((val = readl(ha->mem_ptr + IPS_REG_CCCR)) & IPS_BIT_SEM) { in ips_issue_copperhead_memio()
5337 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_issue_copperhead_memio()
5339 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_issue_copperhead_memio()
5346 writel(scb->scb_busaddr, ha->mem_ptr + IPS_REG_CCSAR); in ips_issue_copperhead_memio()
5347 writel(IPS_BIT_START_CMD, ha->mem_ptr + IPS_REG_CCCR); in ips_issue_copperhead_memio()
5362 ips_issue_i2o(ips_ha_t * ha, ips_scb_t * scb) in ips_issue_i2o() argument
5370 ha->host_num, in ips_issue_i2o()
5376 ips_name, ha->host_num, scb->cmd.basic_io.command_id); in ips_issue_i2o()
5379 outl(scb->scb_busaddr, ha->io_addr + IPS_REG_I2O_INMSGQ); in ips_issue_i2o()
5394 ips_issue_i2o_memio(ips_ha_t * ha, ips_scb_t * scb) in ips_issue_i2o_memio() argument
5402 ha->host_num, in ips_issue_i2o_memio()
5408 ips_name, ha->host_num, scb->cmd.basic_io.command_id); in ips_issue_i2o_memio()
5411 writel(scb->scb_busaddr, ha->mem_ptr + IPS_REG_I2O_INMSGQ); in ips_issue_i2o_memio()
5426 ips_isintr_copperhead(ips_ha_t * ha) in ips_isintr_copperhead() argument
5432 Isr = inb(ha->io_addr + IPS_REG_HISR); in ips_isintr_copperhead()
5443 outb(Isr, ha->io_addr + IPS_REG_HISR); in ips_isintr_copperhead()
5459 ips_isintr_copperhead_memio(ips_ha_t * ha) in ips_isintr_copperhead_memio() argument
5465 Isr = readb(ha->mem_ptr + IPS_REG_HISR); in ips_isintr_copperhead_memio()
5476 writeb(Isr, ha->mem_ptr + IPS_REG_HISR); in ips_isintr_copperhead_memio()
5492 ips_isintr_morpheus(ips_ha_t * ha) in ips_isintr_morpheus() argument
5498 Isr = readl(ha->mem_ptr + IPS_REG_I2O_HIR); in ips_isintr_morpheus()
5516 ips_wait(ips_ha_t * ha, int time, int intr) in ips_wait() argument
5530 if (!ha->waitflag) { in ips_wait()
5536 if (!ha->waitflag) { in ips_wait()
5553 (*ha->func.intr) (ha); in ips_wait()
5574 ips_write_driver_status(ips_ha_t * ha, int intr) in ips_write_driver_status() argument
5578 if (!ips_readwrite_page5(ha, false, intr)) { in ips_write_driver_status()
5579 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_write_driver_status()
5587 if (le32_to_cpu(ha->nvram->signature) != IPS_NVRAM_P5_SIG) { in ips_write_driver_status()
5590 ips_name, ha->host_num, ha->nvram->signature); in ips_write_driver_status()
5591 ha->nvram->signature = IPS_NVRAM_P5_SIG; in ips_write_driver_status()
5596 ips_name, ha->host_num, le16_to_cpu(ha->nvram->adapter_type), in ips_write_driver_status()
5597 ha->nvram->adapter_slot, ha->nvram->bios_high[0], in ips_write_driver_status()
5598 ha->nvram->bios_high[1], ha->nvram->bios_high[2], in ips_write_driver_status()
5599 ha->nvram->bios_high[3], ha->nvram->bios_low[0], in ips_write_driver_status()
5600 ha->nvram->bios_low[1], ha->nvram->bios_low[2], in ips_write_driver_status()
5601 ha->nvram->bios_low[3]); in ips_write_driver_status()
5603 ips_get_bios_version(ha, intr); in ips_write_driver_status()
5606 ha->nvram->operating_system = IPS_OS_LINUX; in ips_write_driver_status()
5607 ha->nvram->adapter_type = ha->ad_type; in ips_write_driver_status()
5608 memcpy((char *) ha->nvram->driver_high, IPS_VERSION_HIGH, 4); in ips_write_driver_status()
5609 memcpy((char *) ha->nvram->driver_low, IPS_VERSION_LOW, 4); in ips_write_driver_status()
5610 memcpy((char *) ha->nvram->bios_high, ha->bios_version, 4); in ips_write_driver_status()
5611 memcpy((char *) ha->nvram->bios_low, ha->bios_version + 4, 4); in ips_write_driver_status()
5613 ha->nvram->versioning = 0; /* Indicate the Driver Does Not Support Versioning */ in ips_write_driver_status()
5616 if (!ips_readwrite_page5(ha, true, intr)) { in ips_write_driver_status()
5617 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_write_driver_status()
5624 ha->slot_num = ha->nvram->adapter_slot; in ips_write_driver_status()
5639 ips_read_adapter_status(ips_ha_t * ha, int intr) in ips_read_adapter_status() argument
5646 scb = &ha->scbs[ha->max_cmds - 1]; in ips_read_adapter_status()
5648 ips_init_scb(ha, scb); in ips_read_adapter_status()
5654 scb->cmd.basic_io.command_id = IPS_COMMAND_ID(ha, scb); in ips_read_adapter_status()
5659 scb->data_len = sizeof (*ha->enq); in ips_read_adapter_status()
5660 scb->cmd.basic_io.sg_addr = ha->enq_busaddr; in ips_read_adapter_status()
5664 ips_send_wait(ha, scb, ips_cmd_timeout, intr)) == IPS_FAILURE) in ips_read_adapter_status()
5682 ips_read_subsystem_parameters(ips_ha_t * ha, int intr) in ips_read_subsystem_parameters() argument
5689 scb = &ha->scbs[ha->max_cmds - 1]; in ips_read_subsystem_parameters()
5691 ips_init_scb(ha, scb); in ips_read_subsystem_parameters()
5697 scb->cmd.basic_io.command_id = IPS_COMMAND_ID(ha, scb); in ips_read_subsystem_parameters()
5702 scb->data_len = sizeof (*ha->subsys); in ips_read_subsystem_parameters()
5703 scb->cmd.basic_io.sg_addr = ha->ioctl_busaddr; in ips_read_subsystem_parameters()
5707 ips_send_wait(ha, scb, ips_cmd_timeout, intr)) == IPS_FAILURE) in ips_read_subsystem_parameters()
5712 memcpy(ha->subsys, ha->ioctl_data, sizeof(*ha->subsys)); in ips_read_subsystem_parameters()
5726 ips_read_config(ips_ha_t * ha, int intr) in ips_read_config() argument
5736 ha->conf->init_id[i] = 7; in ips_read_config()
5738 scb = &ha->scbs[ha->max_cmds - 1]; in ips_read_config()
5740 ips_init_scb(ha, scb); in ips_read_config()
5746 scb->cmd.basic_io.command_id = IPS_COMMAND_ID(ha, scb); in ips_read_config()
5747 scb->data_len = sizeof (*ha->conf); in ips_read_config()
5748 scb->cmd.basic_io.sg_addr = ha->ioctl_busaddr; in ips_read_config()
5752 ips_send_wait(ha, scb, ips_cmd_timeout, intr)) == IPS_FAILURE) in ips_read_config()
5756 memset(ha->conf, 0, sizeof (IPS_CONF)); in ips_read_config()
5760 ha->conf->init_id[i] = 7; in ips_read_config()
5770 memcpy(ha->conf, ha->ioctl_data, sizeof(*ha->conf)); in ips_read_config()
5784 ips_readwrite_page5(ips_ha_t * ha, int write, int intr) in ips_readwrite_page5() argument
5791 scb = &ha->scbs[ha->max_cmds - 1]; in ips_readwrite_page5()
5793 ips_init_scb(ha, scb); in ips_readwrite_page5()
5799 scb->cmd.nvram.command_id = IPS_COMMAND_ID(ha, scb); in ips_readwrite_page5()
5804 scb->data_len = sizeof (*ha->nvram); in ips_readwrite_page5()
5805 scb->cmd.nvram.buffer_addr = ha->ioctl_busaddr; in ips_readwrite_page5()
5807 memcpy(ha->ioctl_data, ha->nvram, sizeof(*ha->nvram)); in ips_readwrite_page5()
5811 ips_send_wait(ha, scb, ips_cmd_timeout, intr)) == IPS_FAILURE) in ips_readwrite_page5()
5815 memset(ha->nvram, 0, sizeof (IPS_NVRAM_P5)); in ips_readwrite_page5()
5820 memcpy(ha->nvram, ha->ioctl_data, sizeof(*ha->nvram)); in ips_readwrite_page5()
5834 ips_clear_adapter(ips_ha_t * ha, int intr) in ips_clear_adapter() argument
5841 scb = &ha->scbs[ha->max_cmds - 1]; in ips_clear_adapter()
5843 ips_init_scb(ha, scb); in ips_clear_adapter()
5849 scb->cmd.config_sync.command_id = IPS_COMMAND_ID(ha, scb); in ips_clear_adapter()
5858 ips_send_wait(ha, scb, ips_reset_timeout, intr)) == IPS_FAILURE) in ips_clear_adapter()
5864 ips_init_scb(ha, scb); in ips_clear_adapter()
5870 scb->cmd.unlock_stripe.command_id = IPS_COMMAND_ID(ha, scb); in ips_clear_adapter()
5879 ips_send_wait(ha, scb, ips_cmd_timeout, intr)) == IPS_FAILURE) in ips_clear_adapter()
5897 ips_ffdc_reset(ips_ha_t * ha, int intr) in ips_ffdc_reset() argument
5903 scb = &ha->scbs[ha->max_cmds - 1]; in ips_ffdc_reset()
5905 ips_init_scb(ha, scb); in ips_ffdc_reset()
5910 scb->cmd.ffdc.command_id = IPS_COMMAND_ID(ha, scb); in ips_ffdc_reset()
5911 scb->cmd.ffdc.reset_count = ha->reset_count; in ips_ffdc_reset()
5915 ips_fix_ffdc_time(ha, scb, ha->last_ffdc); in ips_ffdc_reset()
5918 ips_send_wait(ha, scb, ips_cmd_timeout, intr); in ips_ffdc_reset()
5931 ips_ffdc_time(ips_ha_t * ha) in ips_ffdc_time() argument
5937 DEBUG_VAR(1, "(%s%d) Sending time update.", ips_name, ha->host_num); in ips_ffdc_time()
5939 scb = &ha->scbs[ha->max_cmds - 1]; in ips_ffdc_time()
5941 ips_init_scb(ha, scb); in ips_ffdc_time()
5946 scb->cmd.ffdc.command_id = IPS_COMMAND_ID(ha, scb); in ips_ffdc_time()
5951 ips_fix_ffdc_time(ha, scb, ha->last_ffdc); in ips_ffdc_time()
5954 ips_send_wait(ha, scb, ips_cmd_timeout, IPS_FFDC); in ips_ffdc_time()
5966 ips_fix_ffdc_time(ips_ha_t * ha, ips_scb_t * scb, time64_t current_time) in ips_fix_ffdc_time() argument
5996 ips_erase_bios(ips_ha_t * ha) in ips_erase_bios() argument
6006 outl(0, ha->io_addr + IPS_REG_FLAP); in ips_erase_bios()
6007 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios()
6010 outb(0x50, ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6011 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios()
6015 outb(0x20, ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6016 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios()
6020 outb(0xD0, ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6021 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios()
6025 outb(0x70, ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6026 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios()
6032 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) { in ips_erase_bios()
6033 outl(0, ha->io_addr + IPS_REG_FLAP); in ips_erase_bios()
6037 status = inb(ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6051 outb(0xB0, ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6052 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios()
6058 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) { in ips_erase_bios()
6059 outl(0, ha->io_addr + IPS_REG_FLAP); in ips_erase_bios()
6063 status = inb(ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6087 outb(0x50, ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6088 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios()
6092 outb(0xFF, ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6093 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios()
6108 ips_erase_bios_memio(ips_ha_t * ha) in ips_erase_bios_memio() argument
6118 writel(0, ha->mem_ptr + IPS_REG_FLAP); in ips_erase_bios_memio()
6119 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios_memio()
6122 writeb(0x50, ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6123 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios_memio()
6127 writeb(0x20, ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6128 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios_memio()
6132 writeb(0xD0, ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6133 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios_memio()
6137 writeb(0x70, ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6138 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios_memio()
6144 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) { in ips_erase_bios_memio()
6145 writel(0, ha->mem_ptr + IPS_REG_FLAP); in ips_erase_bios_memio()
6149 status = readb(ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6163 writeb(0xB0, ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6164 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios_memio()
6170 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) { in ips_erase_bios_memio()
6171 writel(0, ha->mem_ptr + IPS_REG_FLAP); in ips_erase_bios_memio()
6175 status = readb(ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6199 writeb(0x50, ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6200 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios_memio()
6204 writeb(0xFF, ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6205 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios_memio()
6220 ips_program_bios(ips_ha_t * ha, char *buffer, uint32_t buffersize, in ips_program_bios() argument
6233 outl(i + offset, ha->io_addr + IPS_REG_FLAP); in ips_program_bios()
6234 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios()
6237 outb(0x40, ha->io_addr + IPS_REG_FLDP); in ips_program_bios()
6238 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios()
6241 outb(buffer[i], ha->io_addr + IPS_REG_FLDP); in ips_program_bios()
6242 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios()
6248 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) { in ips_program_bios()
6249 outl(0, ha->io_addr + IPS_REG_FLAP); in ips_program_bios()
6253 status = inb(ha->io_addr + IPS_REG_FLDP); in ips_program_bios()
6264 outl(0, ha->io_addr + IPS_REG_FLAP); in ips_program_bios()
6265 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios()
6268 outb(0xFF, ha->io_addr + IPS_REG_FLDP); in ips_program_bios()
6269 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios()
6278 outl(0, ha->io_addr + IPS_REG_FLAP); in ips_program_bios()
6279 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios()
6282 outb(0xFF, ha->io_addr + IPS_REG_FLDP); in ips_program_bios()
6283 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios()
6291 outl(0, ha->io_addr + IPS_REG_FLAP); in ips_program_bios()
6292 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios()
6295 outb(0xFF, ha->io_addr + IPS_REG_FLDP); in ips_program_bios()
6296 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios()
6311 ips_program_bios_memio(ips_ha_t * ha, char *buffer, uint32_t buffersize, in ips_program_bios_memio() argument
6324 writel(i + offset, ha->mem_ptr + IPS_REG_FLAP); in ips_program_bios_memio()
6325 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios_memio()
6328 writeb(0x40, ha->mem_ptr + IPS_REG_FLDP); in ips_program_bios_memio()
6329 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios_memio()
6332 writeb(buffer[i], ha->mem_ptr + IPS_REG_FLDP); in ips_program_bios_memio()
6333 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios_memio()
6339 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) { in ips_program_bios_memio()
6340 writel(0, ha->mem_ptr + IPS_REG_FLAP); in ips_program_bios_memio()
6344 status = readb(ha->mem_ptr + IPS_REG_FLDP); in ips_program_bios_memio()
6355 writel(0, ha->mem_ptr + IPS_REG_FLAP); in ips_program_bios_memio()
6356 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios_memio()
6359 writeb(0xFF, ha->mem_ptr + IPS_REG_FLDP); in ips_program_bios_memio()
6360 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios_memio()
6369 writel(0, ha->mem_ptr + IPS_REG_FLAP); in ips_program_bios_memio()
6370 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios_memio()
6373 writeb(0xFF, ha->mem_ptr + IPS_REG_FLDP); in ips_program_bios_memio()
6374 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios_memio()
6382 writel(0, ha->mem_ptr + IPS_REG_FLAP); in ips_program_bios_memio()
6383 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios_memio()
6386 writeb(0xFF, ha->mem_ptr + IPS_REG_FLDP); in ips_program_bios_memio()
6387 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios_memio()
6402 ips_verify_bios(ips_ha_t * ha, char *buffer, uint32_t buffersize, in ips_verify_bios() argument
6411 outl(0, ha->io_addr + IPS_REG_FLAP); in ips_verify_bios()
6412 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_verify_bios()
6415 if (inb(ha->io_addr + IPS_REG_FLDP) != 0x55) in ips_verify_bios()
6418 outl(1, ha->io_addr + IPS_REG_FLAP); in ips_verify_bios()
6419 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_verify_bios()
6421 if (inb(ha->io_addr + IPS_REG_FLDP) != 0xAA) in ips_verify_bios()
6427 outl(i + offset, ha->io_addr + IPS_REG_FLAP); in ips_verify_bios()
6428 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_verify_bios()
6431 checksum = (uint8_t) checksum + inb(ha->io_addr + IPS_REG_FLDP); in ips_verify_bios()
6451 ips_verify_bios_memio(ips_ha_t * ha, char *buffer, uint32_t buffersize, in ips_verify_bios_memio() argument
6460 writel(0, ha->mem_ptr + IPS_REG_FLAP); in ips_verify_bios_memio()
6461 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_verify_bios_memio()
6464 if (readb(ha->mem_ptr + IPS_REG_FLDP) != 0x55) in ips_verify_bios_memio()
6467 writel(1, ha->mem_ptr + IPS_REG_FLAP); in ips_verify_bios_memio()
6468 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_verify_bios_memio()
6470 if (readb(ha->mem_ptr + IPS_REG_FLDP) != 0xAA) in ips_verify_bios_memio()
6476 writel(i + offset, ha->mem_ptr + IPS_REG_FLAP); in ips_verify_bios_memio()
6477 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_verify_bios_memio()
6481 (uint8_t) checksum + readb(ha->mem_ptr + IPS_REG_FLDP); in ips_verify_bios_memio()
6500 ips_abort_init(ips_ha_t * ha, int index) in ips_abort_init() argument
6502 ha->active = 0; in ips_abort_init()
6503 ips_free(ha); in ips_abort_init()
6639 ips_ha_t *ha, *oldha = ips_ha[index]; in ips_register_scsi() local
6646 ha = IPS_HA(sh); in ips_register_scsi()
6647 memcpy(ha, oldha, sizeof (ips_ha_t)); in ips_register_scsi()
6650 if (request_irq(ha->pcidev->irq, do_ipsintr, IRQF_SHARED, ips_name, ha)) { in ips_register_scsi()
6651 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_register_scsi()
6659 sh->unique_id = (ha->io_addr) ? ha->io_addr : ha->mem_addr; in ips_register_scsi()
6665 sh->max_id = ha->ntargets; in ips_register_scsi()
6666 sh->max_lun = ha->nlun; in ips_register_scsi()
6667 sh->max_channel = ha->nbus - 1; in ips_register_scsi()
6668 sh->can_queue = ha->max_cmds - 1; in ips_register_scsi()
6670 if (scsi_add_host(sh, &ha->pcidev->dev)) in ips_register_scsi()
6674 ips_ha[index] = ha; in ips_register_scsi()
6681 free_irq(ha->pcidev->irq, ha); in ips_register_scsi()
6816 ips_ha_t *ha; in ips_init_phase1() local
6876 ha = kzalloc(sizeof (ips_ha_t), GFP_KERNEL); in ips_init_phase1()
6877 if (ha == NULL) { in ips_init_phase1()
6884 ips_ha[index] = ha; in ips_init_phase1()
6885 ha->active = 1; in ips_init_phase1()
6888 ha->io_addr = io_addr; in ips_init_phase1()
6889 ha->io_len = io_len; in ips_init_phase1()
6890 ha->mem_addr = mem_addr; in ips_init_phase1()
6891 ha->mem_len = mem_len; in ips_init_phase1()
6892 ha->mem_ptr = mem_ptr; in ips_init_phase1()
6893 ha->ioremap_ptr = ioremap_ptr; in ips_init_phase1()
6894 ha->host_num = (uint32_t) index; in ips_init_phase1()
6895 ha->slot_num = PCI_SLOT(pci_dev->devfn); in ips_init_phase1()
6896 ha->pcidev = pci_dev; in ips_init_phase1()
6904 if (sizeof(dma_addr_t) > 4 && IPS_HAS_ENH_SGLIST(ha) && in ips_init_phase1()
6905 !dma_set_mask(&ha->pcidev->dev, DMA_BIT_MASK(64))) { in ips_init_phase1()
6906 (ha)->flags |= IPS_HA_ENH_SG; in ips_init_phase1()
6908 if (dma_set_mask(&ha->pcidev->dev, DMA_BIT_MASK(32)) != 0) { in ips_init_phase1()
6910 return ips_abort_init(ha, index); in ips_init_phase1()
6918 ha->enq = dma_alloc_coherent(&pci_dev->dev, sizeof (IPS_ENQ), in ips_init_phase1()
6919 &ha->enq_busaddr, GFP_KERNEL); in ips_init_phase1()
6920 if (!ha->enq) { in ips_init_phase1()
6923 return ips_abort_init(ha, index); in ips_init_phase1()
6926 ha->adapt = dma_alloc_coherent(&pci_dev->dev, in ips_init_phase1()
6929 if (!ha->adapt) { in ips_init_phase1()
6932 return ips_abort_init(ha, index); in ips_init_phase1()
6934 ha->adapt->hw_status_start = dma_address; in ips_init_phase1()
6935 ha->dummy = (void *) (ha->adapt + 1); in ips_init_phase1()
6939 ha->logical_drive_info = dma_alloc_coherent(&pci_dev->dev, in ips_init_phase1()
6941 if (!ha->logical_drive_info) { in ips_init_phase1()
6944 return ips_abort_init(ha, index); in ips_init_phase1()
6946 ha->logical_drive_info_dma_addr = dma_address; in ips_init_phase1()
6949 ha->conf = kmalloc(sizeof (IPS_CONF), GFP_KERNEL); in ips_init_phase1()
6951 if (!ha->conf) { in ips_init_phase1()
6954 return ips_abort_init(ha, index); in ips_init_phase1()
6957 ha->nvram = kmalloc(sizeof (IPS_NVRAM_P5), GFP_KERNEL); in ips_init_phase1()
6959 if (!ha->nvram) { in ips_init_phase1()
6962 return ips_abort_init(ha, index); in ips_init_phase1()
6965 ha->subsys = kmalloc(sizeof (IPS_SUBSYS), GFP_KERNEL); in ips_init_phase1()
6967 if (!ha->subsys) { in ips_init_phase1()
6970 return ips_abort_init(ha, index); in ips_init_phase1()
6978 ha->ioctl_data = dma_alloc_coherent(&pci_dev->dev, ips_ioctlsize, in ips_init_phase1()
6979 &ha->ioctl_busaddr, GFP_KERNEL); in ips_init_phase1()
6980 ha->ioctl_len = ips_ioctlsize; in ips_init_phase1()
6981 if (!ha->ioctl_data) { in ips_init_phase1()
6984 return ips_abort_init(ha, index); in ips_init_phase1()
6990 ips_setup_funclist(ha); in ips_init_phase1()
6992 if ((IPS_IS_MORPHEUS(ha)) || (IPS_IS_MARCO(ha))) { in ips_init_phase1()
6994 IsDead = readl(ha->mem_ptr + IPS_REG_I960_MSG1); in ips_init_phase1()
6996 ips_reset_morpheus(ha); in ips_init_phase1()
7004 if (!(*ha->func.isinit) (ha)) { in ips_init_phase1()
7005 if (!(*ha->func.init) (ha)) { in ips_init_phase1()
7011 return ips_abort_init(ha, index); in ips_init_phase1()
7031 ips_ha_t *ha; in ips_init_phase2() local
7033 ha = ips_ha[index]; in ips_init_phase2()
7036 if (!ha->active) { in ips_init_phase2()
7042 if (request_irq(ha->pcidev->irq, do_ipsintr, IRQF_SHARED, ips_name, ha)) { in ips_init_phase2()
7043 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_phase2()
7045 return ips_abort_init(ha, index); in ips_init_phase2()
7051 ha->max_cmds = 1; in ips_init_phase2()
7052 if (!ips_allocatescbs(ha)) { in ips_init_phase2()
7053 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_phase2()
7055 free_irq(ha->pcidev->irq, ha); in ips_init_phase2()
7056 return ips_abort_init(ha, index); in ips_init_phase2()
7059 if (!ips_hainit(ha)) { in ips_init_phase2()
7060 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_phase2()
7062 free_irq(ha->pcidev->irq, ha); in ips_init_phase2()
7063 return ips_abort_init(ha, index); in ips_init_phase2()
7066 ips_deallocatescbs(ha, 1); in ips_init_phase2()
7069 if (!ips_allocatescbs(ha)) { in ips_init_phase2()
7070 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_phase2()
7072 free_irq(ha->pcidev->irq, ha); in ips_init_phase2()
7073 return ips_abort_init(ha, index); in ips_init_phase2()