• Home
  • Raw
  • Download

Lines Matching +full:fails +full:- +full:without +full:- +full:test +full:- +full:cd

2 /* ips.c -- driver for the Adaptec / IBM ServeRAID controller                */
17 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
22 /* THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR */
23 /* CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT */
24 /* LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, */
35 /* DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND */
43 /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
57 /* 0.99.02 - Breakup commands that are bigger than 8 * the stripe size */
58 /* 0.99.03 - Make interrupt routine handle all completed request on the */
60 /* - Make sure passthru commands get woken up if we run out of */
62 /* - Send all of the commands on the queue at once rather than */
64 /* 0.99.04 - Fix race condition in the passthru mechanism -- this required */
66 /* - Fix error recovery code */
67 /* 0.99.05 - Fix an oops when we get certain passthru commands */
68 /* 1.00.00 - Initial Public Release */
70 /* 3.60.00 - Bump max commands to 128 for use with firmware 3.60 */
71 /* - Change version to 3.60 to coincide with release numbering. */
72 /* 3.60.01 - Remove bogus error check in passthru routine */
73 /* 3.60.02 - Make DCDB direction based on lookup table */
74 /* - Only allow one DCDB command to a SCSI ID at a time */
75 /* 4.00.00 - Add support for ServeRAID 4 */
76 /* 4.00.01 - Add support for First Failure Data Capture */
77 /* 4.00.02 - Fix problem with PT DCDB with no buffer */
78 /* 4.00.03 - Add alternative passthru interface */
79 /* - Add ability to flash BIOS */
80 /* 4.00.04 - Rename structures/constants to be prefixed with IPS_ */
81 /* 4.00.05 - Remove wish_block from init routine */
82 /* - Use linux/spinlock.h instead of asm/spinlock.h for kernels */
84 /* - Sync with other changes from the 2.3 kernels */
85 /* 4.00.06 - Fix timeout with initial FFDC command */
86 /* 4.00.06a - Port to 2.4 (trivial) -- Christoph Hellwig <hch@infradead.org> */
87 /* 4.10.00 - Add support for ServeRAID 4M/4L */
88 /* 4.10.13 - Fix for dynamic unload and proc file system */
89 /* 4.20.03 - Rename version to coincide with new release schedules */
93 /* 4.20.13 - Fix some failure cases / reset code */
94 /* - Hook into the reboot_notifier to flush the controller cache */
95 /* 4.50.01 - Fix problem when there is a hole in logical drive numbering */
96 /* 4.70.09 - Use a Common ( Large Buffer ) for Flashing from the JCRM CD */
97 /* - Add IPSSEND Flash Support */
98 /* - Set Sense Data for Unknown SCSI Command */
99 /* - Use Slot Number from NVRAM Page 5 */
100 /* - Restore caller's DCDB Structure */
101 /* 4.70.12 - Corrective actions for bad controller ( during initialization )*/
102 /* 4.70.13 - Don't Send CDB's if we already know the device is not present */
103 /* - Don't release HA Lock in ips_next() until SC taken off queue */
104 /* - Unregister SCSI device in ips_release() */
105 /* 4.70.15 - Fix Breakup for very large ( non-SG ) requests in ips_done() */
106 /* 4.71.00 - Change all memory allocations to not use GFP_DMA flag */
107 /* Code Clean-Up for 2.4.x kernel */
108 /* 4.72.00 - Allow for a Scatter-Gather Element to exceed MAX_XFER Size */
109 /* 4.72.01 - I/O Mapped Memory release ( so "insmod ips" does not Fail ) */
110 /* - Don't Issue Internal FFDC Command if there are Active Commands */
111 /* - Close Window for getting too many IOCTL's active */
112 /* 4.80.00 - Make ia64 Safe */
113 /* 4.80.04 - Eliminate calls to strtok() if 2.4.x or greater */
114 /* - Adjustments to Device Queue Depth */
115 /* 4.80.14 - Take all semaphores off stack */
116 /* - Clean Up New_IOCTL path */
117 /* 4.80.20 - Set max_sectors in Scsi_Host structure ( if >= 2.4.7 kernel ) */
118 /* - 5 second delay needed after resetting an i960 adapter */
119 /* 4.80.26 - Clean up potential code problems ( Arjan's recommendations ) */
120 /* 4.90.01 - Version Matching for FirmWare, BIOS, and Driver */
121 /* 4.90.05 - Use New PCI Architecture to facilitate Hot Plug Development */
122 /* 4.90.08 - Increase Delays in Flashing ( Trombone Only - 4H ) */
123 /* 4.90.08 - Data Corruption if First Scatter Gather Element is > 64K */
124 /* 4.90.11 - Don't actually RESET unless it's physically required */
125 /* - Remove unused compile options */
126 /* 5.00.01 - Sarasota ( 5i ) adapters must always be scanned first */
127 /* - Get rid on IOCTL_NEW_COMMAND code */
128 /* - Add Extended DCDB Commands for Tape Support in 5I */
129 /* 5.10.12 - use pci_dma interfaces, update for 2.5 kernel changes */
130 /* 5.10.15 - remove unused code (sem, macros, etc.) */
131 /* 5.30.00 - use __devexit_p() */
132 /* 6.00.00 - Add 6x Adapters and Battery Flash */
133 /* 6.10.00 - Remove 1G Addressing Limitations */
134 /* 6.11.xx - Get VersionInfo buffer off the stack ! DDTS 60401 */
135 /* 6.11.xx - Make Logical Drive Info structure safe for DMA DDTS 60639 */
136 /* 7.10.18 - Add highmem_io flag in SCSI Templete for 2.4 kernels */
137 /* - Fix path/name for scsi_hosts.h include for 2.6 kernels */
138 /* - Fix sort order of 7k */
139 /* - Remove 3 unused "inline" functions */
140 /* 7.12.xx - Use STATIC functions wherever possible */
141 /* - Clean up deprecated MODULE_PARM calls */
142 /* 7.12.05 - Remove Version Matching per IBM request */
148 * IPS_DEBUG - Turn on debugging info
152 * debug:<number> - Set debug level to <number>
154 * 1 - Normal debug messages
155 * 2 - Verbose debug messages
156 * 11 - Method trace (non interrupt)
157 * 12 - Method trace (includes interrupt)
159 * noi2o - Don't use I2O Queues (ServeRAID 4 only)
160 * nommap - Don't use memory mapped I/O
161 * ioctlsize - Initial size of the IOCTL buffer
181 #include <linux/dma-mapping.h>
209 #define IPS_DMA_DIR(scb) ((!scb->scsi_cmd || ips_is_passthru(scb->scsi_cmd) || \
210 DMA_NONE == scb->scsi_cmd->sc_data_direction) ? \
212 scb->scsi_cmd->sc_data_direction)
350 static int ips_cd_boot; /* Booting from Manager CD */
351 static char *ips_FlashData = NULL; /* CD Boot - Flash Data Buffer */
353 static long ips_FlashDataInUse; /* CD Boot - Flash Data In Use Flag */
365 .this_id = -1,
586 ha->func.isintr = ips_isintr_morpheus; in ips_setup_funclist()
587 ha->func.isinit = ips_isinit_morpheus; in ips_setup_funclist()
588 ha->func.issue = ips_issue_i2o_memio; in ips_setup_funclist()
589 ha->func.init = ips_init_morpheus; in ips_setup_funclist()
590 ha->func.statupd = ips_statupd_morpheus; in ips_setup_funclist()
591 ha->func.reset = ips_reset_morpheus; in ips_setup_funclist()
592 ha->func.intr = ips_intr_morpheus; in ips_setup_funclist()
593 ha->func.enableint = ips_enable_int_morpheus; in ips_setup_funclist()
596 ha->func.isintr = ips_isintr_copperhead_memio; in ips_setup_funclist()
597 ha->func.isinit = ips_isinit_copperhead_memio; in ips_setup_funclist()
598 ha->func.init = ips_init_copperhead_memio; in ips_setup_funclist()
599 ha->func.statupd = ips_statupd_copperhead_memio; in ips_setup_funclist()
600 ha->func.statinit = ips_statinit_memio; in ips_setup_funclist()
601 ha->func.reset = ips_reset_copperhead_memio; in ips_setup_funclist()
602 ha->func.intr = ips_intr_copperhead; in ips_setup_funclist()
603 ha->func.erasebios = ips_erase_bios_memio; in ips_setup_funclist()
604 ha->func.programbios = ips_program_bios_memio; in ips_setup_funclist()
605 ha->func.verifybios = ips_verify_bios_memio; in ips_setup_funclist()
606 ha->func.enableint = ips_enable_int_copperhead_memio; in ips_setup_funclist()
608 ha->func.issue = ips_issue_i2o_memio; in ips_setup_funclist()
610 ha->func.issue = ips_issue_copperhead_memio; in ips_setup_funclist()
613 ha->func.isintr = ips_isintr_copperhead; in ips_setup_funclist()
614 ha->func.isinit = ips_isinit_copperhead; in ips_setup_funclist()
615 ha->func.init = ips_init_copperhead; in ips_setup_funclist()
616 ha->func.statupd = ips_statupd_copperhead; in ips_setup_funclist()
617 ha->func.statinit = ips_statinit; in ips_setup_funclist()
618 ha->func.reset = ips_reset_copperhead; in ips_setup_funclist()
619 ha->func.intr = ips_intr_copperhead; in ips_setup_funclist()
620 ha->func.erasebios = ips_erase_bios; in ips_setup_funclist()
621 ha->func.programbios = ips_program_bios; in ips_setup_funclist()
622 ha->func.verifybios = ips_verify_bios; in ips_setup_funclist()
623 ha->func.enableint = ips_enable_int_copperhead; in ips_setup_funclist()
626 ha->func.issue = ips_issue_i2o; in ips_setup_funclist()
628 ha->func.issue = ips_issue_copperhead; in ips_setup_funclist()
667 scb = &ha->scbs[ha->max_cmds - 1]; in ips_release()
671 scb->timeout = ips_cmd_timeout; in ips_release()
672 scb->cdb[0] = IPS_CMD_FLUSH; in ips_release()
674 scb->cmd.flush_cache.op_code = IPS_CMD_FLUSH; in ips_release()
675 scb->cmd.flush_cache.command_id = IPS_COMMAND_ID(ha, scb); in ips_release()
676 scb->cmd.flush_cache.state = IPS_NORM_STATE; in ips_release()
677 scb->cmd.flush_cache.reserved = 0; in ips_release()
678 scb->cmd.flush_cache.reserved2 = 0; in ips_release()
679 scb->cmd.flush_cache.reserved3 = 0; in ips_release()
680 scb->cmd.flush_cache.reserved4 = 0; in ips_release()
682 IPS_PRINTK(KERN_WARNING, ha->pcidev, "Flushing Cache.\n"); in ips_release()
686 IPS_PRINTK(KERN_WARNING, ha->pcidev, "Incomplete Flush.\n"); in ips_release()
688 IPS_PRINTK(KERN_WARNING, ha->pcidev, "Flushing Complete.\n"); in ips_release()
697 free_irq(ha->pcidev->irq, ha); in ips_release()
732 if (!ha->active) in ips_halt()
736 scb = &ha->scbs[ha->max_cmds - 1]; in ips_halt()
740 scb->timeout = ips_cmd_timeout; in ips_halt()
741 scb->cdb[0] = IPS_CMD_FLUSH; in ips_halt()
743 scb->cmd.flush_cache.op_code = IPS_CMD_FLUSH; in ips_halt()
744 scb->cmd.flush_cache.command_id = IPS_COMMAND_ID(ha, scb); in ips_halt()
745 scb->cmd.flush_cache.state = IPS_NORM_STATE; in ips_halt()
746 scb->cmd.flush_cache.reserved = 0; in ips_halt()
747 scb->cmd.flush_cache.reserved2 = 0; in ips_halt()
748 scb->cmd.flush_cache.reserved3 = 0; in ips_halt()
749 scb->cmd.flush_cache.reserved4 = 0; in ips_halt()
751 IPS_PRINTK(KERN_WARNING, ha->pcidev, "Flushing Cache.\n"); in ips_halt()
756 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_halt()
759 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_halt()
787 host = SC->device->host; in ips_eh_abort()
788 ha = (ips_ha_t *) SC->device->host->hostdata; in ips_eh_abort()
793 if (!ha->active) in ips_eh_abort()
796 spin_lock(host->host_lock); in ips_eh_abort()
799 item = ha->copp_waitlist.head; in ips_eh_abort()
800 while ((item) && (item->scsi_cmd != SC)) in ips_eh_abort()
801 item = item->next; 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()
817 spin_unlock(host->host_lock); in ips_eh_abort()
852 ha = (ips_ha_t *) SC->device->host->hostdata; in __ips_eh_reset()
860 if (!ha->active) in __ips_eh_reset()
864 item = ha->copp_waitlist.head; in __ips_eh_reset()
865 while ((item) && (item->scsi_cmd != SC)) in __ips_eh_reset()
866 item = item->next; in __ips_eh_reset()
870 ips_removeq_copp(&ha->copp_waitlist, item); in __ips_eh_reset()
875 if (ips_removeq_wait(&ha->scb_waitlist, SC)) { in __ips_eh_reset()
890 if (ha->ioctl_reset == 0) { /* IF Not an IOCTL Requested Reset */ in __ips_eh_reset()
891 scb = &ha->scbs[ha->max_cmds - 1]; in __ips_eh_reset()
895 scb->timeout = ips_cmd_timeout; in __ips_eh_reset()
896 scb->cdb[0] = IPS_CMD_FLUSH; in __ips_eh_reset()
898 scb->cmd.flush_cache.op_code = IPS_CMD_FLUSH; in __ips_eh_reset()
899 scb->cmd.flush_cache.command_id = IPS_COMMAND_ID(ha, scb); in __ips_eh_reset()
900 scb->cmd.flush_cache.state = IPS_NORM_STATE; in __ips_eh_reset()
901 scb->cmd.flush_cache.reserved = 0; in __ips_eh_reset()
902 scb->cmd.flush_cache.reserved2 = 0; in __ips_eh_reset()
903 scb->cmd.flush_cache.reserved3 = 0; in __ips_eh_reset()
904 scb->cmd.flush_cache.reserved4 = 0; in __ips_eh_reset()
909 IPS_PRINTK(KERN_NOTICE, ha->pcidev, in __ips_eh_reset()
910 "Reset Request - Flushed Cache\n"); in __ips_eh_reset()
918 ha->ioctl_reset = 0; /* Reset the IOCTL Requested Reset Flag */ in __ips_eh_reset()
924 IPS_PRINTK(KERN_NOTICE, ha->pcidev, "Resetting controller.\n"); in __ips_eh_reset()
925 ret = (*ha->func.reset) (ha); in __ips_eh_reset()
930 IPS_PRINTK(KERN_NOTICE, ha->pcidev, in __ips_eh_reset()
931 "Controller reset failed - controller now offline.\n"); in __ips_eh_reset()
935 ips_name, ha->host_num); in __ips_eh_reset()
937 while ((scb = ips_removeq_scb_head(&ha->scb_activelist))) { in __ips_eh_reset()
938 scb->scsi_cmd->result = DID_ERROR << 16; in __ips_eh_reset()
939 scb->scsi_cmd->scsi_done(scb->scsi_cmd); in __ips_eh_reset()
945 ips_name, ha->host_num); in __ips_eh_reset()
947 while ((scsi_cmd = ips_removeq_wait_head(&ha->scb_waitlist))) { in __ips_eh_reset()
948 scsi_cmd->result = DID_ERROR; in __ips_eh_reset()
949 scsi_cmd->scsi_done(scsi_cmd); in __ips_eh_reset()
952 ha->active = FALSE; in __ips_eh_reset()
959 IPS_PRINTK(KERN_NOTICE, ha->pcidev, in __ips_eh_reset()
960 "Controller reset failed - controller now offline.\n"); in __ips_eh_reset()
964 ips_name, ha->host_num); in __ips_eh_reset()
966 while ((scb = ips_removeq_scb_head(&ha->scb_activelist))) { in __ips_eh_reset()
967 scb->scsi_cmd->result = DID_ERROR << 16; in __ips_eh_reset()
968 scb->scsi_cmd->scsi_done(scb->scsi_cmd); in __ips_eh_reset()
974 ips_name, ha->host_num); in __ips_eh_reset()
976 while ((scsi_cmd = ips_removeq_wait_head(&ha->scb_waitlist))) { in __ips_eh_reset()
977 scsi_cmd->result = DID_ERROR << 16; in __ips_eh_reset()
978 scsi_cmd->scsi_done(scsi_cmd); in __ips_eh_reset()
981 ha->active = FALSE; in __ips_eh_reset()
986 if (le32_to_cpu(ha->subsys->param[3]) & 0x300000) { in __ips_eh_reset()
987 ha->last_ffdc = ktime_get_real_seconds(); in __ips_eh_reset()
988 ha->reset_count++; in __ips_eh_reset()
993 DEBUG_VAR(1, "(%s%d) Failing active commands", ips_name, ha->host_num); in __ips_eh_reset()
995 while ((scb = ips_removeq_scb_head(&ha->scb_activelist))) { in __ips_eh_reset()
996 scb->scsi_cmd->result = DID_RESET << 16; in __ips_eh_reset()
997 scb->scsi_cmd->scsi_done(scb->scsi_cmd); in __ips_eh_reset()
1002 for (i = 1; i < ha->nbus; i++) in __ips_eh_reset()
1003 ha->dcdb_active[i - 1] = 0; in __ips_eh_reset()
1006 ha->num_ioctl = 0; in __ips_eh_reset()
1019 spin_lock_irq(SC->device->host->host_lock); in ips_eh_reset()
1021 spin_unlock_irq(SC->device->host->host_lock); in ips_eh_reset()
1045 ha = (ips_ha_t *) SC->device->host->hostdata; in ips_queue_lck()
1050 if (!ha->active) in ips_queue_lck()
1054 if (ha->copp_waitlist.count == IPS_MAX_IOCTL_QUEUE) { in ips_queue_lck()
1055 SC->result = DID_BUS_BUSY << 16; in ips_queue_lck()
1060 } else if (ha->scb_waitlist.count == IPS_MAX_QUEUE) { in ips_queue_lck()
1061 SC->result = DID_BUS_BUSY << 16; in ips_queue_lck()
1067 SC->scsi_done = done; in ips_queue_lck()
1071 ha->host_num, in ips_queue_lck()
1072 SC->cmnd[0], in ips_queue_lck()
1073 SC->device->channel, SC->device->id, SC->device->lun); in ips_queue_lck()
1077 && (scmd_id(SC) == ha->ha_id[scmd_channel(SC)])) { in ips_queue_lck()
1078 SC->result = DID_NO_CONNECT << 16; in ips_queue_lck()
1088 /* A Reset IOCTL is only sent by the boot CD in extreme cases. */ in ips_queue_lck()
1092 if ((pt->CoppCP.cmd.reset.op_code == IPS_CMD_RESET_CHANNEL) && in ips_queue_lck()
1093 (pt->CoppCP.cmd.reset.adapter_flag == 1)) { in ips_queue_lck()
1094 if (ha->scb_activelist.count != 0) { in ips_queue_lck()
1095 SC->result = DID_BUS_BUSY << 16; in ips_queue_lck()
1099 ha->ioctl_reset = 1; /* This reset request is from an IOCTL */ in ips_queue_lck()
1101 SC->result = DID_OK << 16; in ips_queue_lck()
1102 SC->scsi_done(SC); in ips_queue_lck()
1110 SC->result = DID_ERROR << 16; in ips_queue_lck()
1116 scratch->scsi_cmd = SC; in ips_queue_lck()
1117 scratch->next = NULL; in ips_queue_lck()
1119 ips_putq_copp_tail(&ha->copp_waitlist, scratch); in ips_queue_lck()
1121 ips_putq_wait_tail(&ha->scb_waitlist, SC); in ips_queue_lck()
1143 ips_ha_t *ha = (ips_ha_t *) sdev->host->hostdata; in DEF_SCSI_QCMD()
1154 if (!ha->active) in DEF_SCSI_QCMD()
1161 if ((capacity > 0x400000) && ((ha->enq->ucMiscFlag & 0x8) == 0)) { in DEF_SCSI_QCMD()
1196 ha = IPS_HA(SDptr->host); in ips_slave_configure()
1197 if (SDptr->tagged_supported && SDptr->type == TYPE_DISK) { in ips_slave_configure()
1198 min = ha->max_cmds / 2; in ips_slave_configure()
1199 if (ha->enq->ucLogDriveCount <= 2) in ips_slave_configure()
1200 min = ha->max_cmds - 1; in ips_slave_configure()
1204 SDptr->skip_ms_page_8 = 1; in ips_slave_configure()
1205 SDptr->skip_ms_page_3f = 1; in ips_slave_configure()
1230 host = ips_sh[ha->host_num]; in do_ipsintr()
1233 (*ha->func.intr) (ha); in do_ipsintr()
1237 spin_lock(host->host_lock); in do_ipsintr()
1239 if (!ha->active) { in do_ipsintr()
1240 spin_unlock(host->host_lock); in do_ipsintr()
1244 irqstatus = (*ha->func.intr) (ha); in do_ipsintr()
1246 spin_unlock(host->host_lock); in do_ipsintr()
1277 if (!ha->active) in ips_intr_copperhead()
1280 intrstatus = (*ha->func.isintr) (ha); in ips_intr_copperhead()
1291 sp = &ha->sp; in ips_intr_copperhead()
1293 intrstatus = (*ha->func.isintr) (ha); in ips_intr_copperhead()
1298 cstatus.value = (*ha->func.statupd) (ha); in ips_intr_copperhead()
1300 if (cstatus.fields.command_id > (IPS_MAX_CMDS - 1)) { in ips_intr_copperhead()
1306 scb = (ips_scb_t *) sp->scb_addr; in ips_intr_copperhead()
1312 (*scb->callback) (ha, scb); in ips_intr_copperhead()
1341 if (!ha->active) in ips_intr_morpheus()
1344 intrstatus = (*ha->func.isintr) (ha); in ips_intr_morpheus()
1355 sp = &ha->sp; in ips_intr_morpheus()
1357 intrstatus = (*ha->func.isintr) (ha); in ips_intr_morpheus()
1362 cstatus.value = (*ha->func.statupd) (ha); in ips_intr_morpheus()
1368 if (cstatus.fields.command_id > (IPS_MAX_CMDS - 1)) { in ips_intr_morpheus()
1369 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_intr_morpheus()
1376 scb = (ips_scb_t *) sp->scb_addr; in ips_intr_morpheus()
1382 (*scb->callback) (ha, scb); in ips_intr_morpheus()
1416 if (ha->ad_type > 0 && ha->ad_type <= MAX_ADAPTER_NAME) { in ips_info()
1418 strcat(bp, ips_adapter_name[ha->ad_type - 1]); in ips_info()
1435 ha = (ips_ha_t *) ips_sh[i]->hostdata; in ips_write_info()
1442 return (-EINVAL); in ips_write_info()
1457 ha = (ips_ha_t *) ips_sh[i]->hostdata; in ips_show_info()
1464 return (-EINVAL); in ips_show_info()
1469 /*--------------------------------------------------------------------------*/
1471 /*--------------------------------------------------------------------------*/
1491 if ((SC->cmnd[0] == IPS_IOCTL_COMMAND) && in ips_is_passthru()
1492 (SC->device->channel == 0) && in ips_is_passthru()
1493 (SC->device->id == IPS_ADAPTER_ID) && in ips_is_passthru()
1494 (SC->device->lun == 0) && scsi_sglist(SC)) { in ips_is_passthru()
1501 buffer = kmap_atomic(sg_page(sg)) + sg->offset; in ips_is_passthru()
1504 kunmap_atomic(buffer - sg->offset); in ips_is_passthru()
1508 kunmap_atomic(buffer - sg->offset); in ips_is_passthru()
1528 if (ha->ioctl_data && length <= ha->ioctl_len) in ips_alloc_passthru_buffer()
1531 bigger_buf = dma_alloc_coherent(&ha->pcidev->dev, length, &dma_busaddr, in ips_alloc_passthru_buffer()
1535 dma_free_coherent(&ha->pcidev->dev, ha->ioctl_len, in ips_alloc_passthru_buffer()
1536 ha->ioctl_data, ha->ioctl_busaddr); in ips_alloc_passthru_buffer()
1538 ha->ioctl_data = (char *) bigger_buf; in ips_alloc_passthru_buffer()
1539 ha->ioctl_len = length; in ips_alloc_passthru_buffer()
1540 ha->ioctl_busaddr = dma_busaddr; in ips_alloc_passthru_buffer()
1542 return -1; in ips_alloc_passthru_buffer()
1567 length += sg->length; in ips_make_passthru()
1572 ips_name, ha->host_num); in ips_make_passthru()
1576 /* allocation failure! If ha->ioctl_data exists, use it to return in ips_make_passthru()
1578 if (ha->ioctl_data) { in ips_make_passthru()
1579 pt = (ips_passthru_t *) ha->ioctl_data; in ips_make_passthru()
1581 pt->BasicStatus = 0x0B; in ips_make_passthru()
1582 pt->ExtendedStatus = 0x00; in ips_make_passthru()
1587 ha->ioctl_datasize = length; in ips_make_passthru()
1589 ips_scmd_buf_read(SC, ha->ioctl_data, ha->ioctl_datasize); in ips_make_passthru()
1590 pt = (ips_passthru_t *) ha->ioctl_data; in ips_make_passthru()
1602 switch (pt->CoppCmd) { in ips_make_passthru()
1604 memcpy(ha->ioctl_data + sizeof (ips_passthru_t), in ips_make_passthru()
1606 ips_scmd_buf_write(SC, ha->ioctl_data, in ips_make_passthru()
1608 SC->result = DID_OK << 16; in ips_make_passthru()
1614 if (SC->cmnd[0] == IPS_IOCTL_COMMAND) { in ips_make_passthru()
1615 if (length < (sizeof (ips_passthru_t) + pt->CmdBSize)) { in ips_make_passthru()
1619 ips_name, ha->host_num); in ips_make_passthru()
1624 if (ha->pcidev->device == IPS_DEVICEID_COPPERHEAD && in ips_make_passthru()
1625 pt->CoppCP.cmd.flashfw.op_code == in ips_make_passthru()
1628 ips_scmd_buf_write(SC, ha->ioctl_data, in ips_make_passthru()
1657 if (IPS_IS_TROMBONE(ha) && pt->CoppCP.cmd.flashfw.type == IPS_FW_IMAGE) { in ips_flash_copperhead()
1663 pt->BasicStatus = 0x0B; in ips_flash_copperhead()
1664 pt->ExtendedStatus = 0; in ips_flash_copperhead()
1665 scb->scsi_cmd->result = DID_OK << 16; in ips_flash_copperhead()
1666 /* IF it's OK to Use the "CD BOOT" Flash Buffer, then you can */ in ips_flash_copperhead()
1668 if (pt->CoppCP.cmd.flashfw.type == IPS_BIOS_IMAGE && in ips_flash_copperhead()
1669 pt->CoppCP.cmd.flashfw.direction == IPS_ERASE_BIOS) { in ips_flash_copperhead()
1670 pt->BasicStatus = 0; in ips_flash_copperhead()
1672 } else if (pt->CoppCP.cmd.flashfw.packet_num == 0) { in ips_flash_copperhead()
1674 ha->flash_data = ips_FlashData; in ips_flash_copperhead()
1675 ha->flash_busaddr = ips_flashbusaddr; in ips_flash_copperhead()
1676 ha->flash_len = PAGE_SIZE << 7; in ips_flash_copperhead()
1677 ha->flash_datasize = 0; in ips_flash_copperhead()
1678 } else if (!ha->flash_data) { in ips_flash_copperhead()
1679 datasize = pt->CoppCP.cmd.flashfw.total_packets * in ips_flash_copperhead()
1680 pt->CoppCP.cmd.flashfw.count; in ips_flash_copperhead()
1681 ha->flash_data = dma_alloc_coherent(&ha->pcidev->dev, in ips_flash_copperhead()
1682 datasize, &ha->flash_busaddr, GFP_KERNEL); in ips_flash_copperhead()
1683 if (!ha->flash_data){ in ips_flash_copperhead()
1687 ha->flash_datasize = 0; in ips_flash_copperhead()
1688 ha->flash_len = datasize; in ips_flash_copperhead()
1692 if (pt->CoppCP.cmd.flashfw.count + ha->flash_datasize > in ips_flash_copperhead()
1693 ha->flash_len) { in ips_flash_copperhead()
1695 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_flash_copperhead()
1700 if (!ha->flash_data) in ips_flash_copperhead()
1702 pt->BasicStatus = 0; in ips_flash_copperhead()
1703 memcpy(&ha->flash_data[ha->flash_datasize], pt + 1, in ips_flash_copperhead()
1704 pt->CoppCP.cmd.flashfw.count); in ips_flash_copperhead()
1705 ha->flash_datasize += pt->CoppCP.cmd.flashfw.count; in ips_flash_copperhead()
1706 if (pt->CoppCP.cmd.flashfw.packet_num == in ips_flash_copperhead()
1707 pt->CoppCP.cmd.flashfw.total_packets - 1) { in ips_flash_copperhead()
1708 if (pt->CoppCP.cmd.flashfw.type == IPS_BIOS_IMAGE) in ips_flash_copperhead()
1710 else if (pt->CoppCP.cmd.flashfw.type == IPS_FW_IMAGE) in ips_flash_copperhead()
1725 if (pt->CoppCP.cmd.flashfw.type == IPS_BIOS_IMAGE && in ips_flash_bios()
1726 pt->CoppCP.cmd.flashfw.direction == IPS_WRITE_BIOS) { in ips_flash_bios()
1727 if ((!ha->func.programbios) || (!ha->func.erasebios) || in ips_flash_bios()
1728 (!ha->func.verifybios)) in ips_flash_bios()
1730 if ((*ha->func.erasebios) (ha)) { in ips_flash_bios()
1732 "(%s%d) flash bios failed - unable to erase flash", in ips_flash_bios()
1733 ips_name, ha->host_num); in ips_flash_bios()
1736 if ((*ha->func.programbios) (ha, in ips_flash_bios()
1737 ha->flash_data + in ips_flash_bios()
1739 ha->flash_datasize - in ips_flash_bios()
1742 "(%s%d) flash bios failed - unable to flash", in ips_flash_bios()
1743 ips_name, ha->host_num); in ips_flash_bios()
1746 if ((*ha->func.verifybios) (ha, in ips_flash_bios()
1747 ha->flash_data + in ips_flash_bios()
1749 ha->flash_datasize - in ips_flash_bios()
1752 "(%s%d) flash bios failed - unable to verify flash", in ips_flash_bios()
1753 ips_name, ha->host_num); in ips_flash_bios()
1758 } else if (pt->CoppCP.cmd.flashfw.type == IPS_BIOS_IMAGE && in ips_flash_bios()
1759 pt->CoppCP.cmd.flashfw.direction == IPS_ERASE_BIOS) { in ips_flash_bios()
1760 if (!ha->func.erasebios) in ips_flash_bios()
1762 if ((*ha->func.erasebios) (ha)) { in ips_flash_bios()
1764 "(%s%d) flash bios failed - unable to erase flash", in ips_flash_bios()
1765 ips_name, ha->host_num); in ips_flash_bios()
1771 pt->BasicStatus = 0x0B; in ips_flash_bios()
1772 pt->ExtendedStatus = 0x00; in ips_flash_bios()
1783 /* return a -1 if a breakup occurred */
1792 if ((scb->data_len + e_len) > ha->max_xfer) { in ips_fill_scb_sg_single()
1793 e_len = ha->max_xfer - scb->data_len; in ips_fill_scb_sg_single()
1794 scb->breakup = indx; in ips_fill_scb_sg_single()
1795 ++scb->sg_break; in ips_fill_scb_sg_single()
1796 ret_val = -1; in ips_fill_scb_sg_single()
1798 scb->breakup = 0; in ips_fill_scb_sg_single()
1799 scb->sg_break = 0; in ips_fill_scb_sg_single()
1802 scb->sg_list.enh_list[indx].address_lo = in ips_fill_scb_sg_single()
1804 scb->sg_list.enh_list[indx].address_hi = in ips_fill_scb_sg_single()
1806 scb->sg_list.enh_list[indx].length = cpu_to_le32(e_len); in ips_fill_scb_sg_single()
1808 scb->sg_list.std_list[indx].address = in ips_fill_scb_sg_single()
1810 scb->sg_list.std_list[indx].length = cpu_to_le32(e_len); in ips_fill_scb_sg_single()
1813 ++scb->sg_len; in ips_fill_scb_sg_single()
1814 scb->data_len += e_len; in ips_fill_scb_sg_single()
1829 if (pt->CoppCP.cmd.flashfw.type == IPS_FW_IMAGE && in ips_flash_firmware()
1830 pt->CoppCP.cmd.flashfw.direction == IPS_WRITE_FW) { in ips_flash_firmware()
1831 memset(&pt->CoppCP.cmd, 0, sizeof (IPS_HOST_COMMAND)); in ips_flash_firmware()
1832 pt->CoppCP.cmd.flashfw.op_code = IPS_CMD_DOWNLOAD; in ips_flash_firmware()
1833 pt->CoppCP.cmd.flashfw.count = cpu_to_le32(ha->flash_datasize); in ips_flash_firmware()
1835 pt->BasicStatus = 0x0B; in ips_flash_firmware()
1836 pt->ExtendedStatus = 0x00; in ips_flash_firmware()
1841 sg_list.list = scb->sg_list.list; in ips_flash_firmware()
1842 cmd_busaddr = scb->scb_busaddr; in ips_flash_firmware()
1844 memcpy(&scb->cmd, &pt->CoppCP.cmd, sizeof (IPS_IOCTL_CMD)); in ips_flash_firmware()
1846 scb->sg_list.list = sg_list.list; in ips_flash_firmware()
1847 scb->scb_busaddr = cmd_busaddr; in ips_flash_firmware()
1848 scb->bus = scb->scsi_cmd->device->channel; in ips_flash_firmware()
1849 scb->target_id = scb->scsi_cmd->device->id; in ips_flash_firmware()
1850 scb->lun = scb->scsi_cmd->device->lun; in ips_flash_firmware()
1851 scb->sg_len = 0; in ips_flash_firmware()
1852 scb->data_len = 0; in ips_flash_firmware()
1853 scb->flags = 0; in ips_flash_firmware()
1854 scb->op_code = 0; in ips_flash_firmware()
1855 scb->callback = ipsintr_done; in ips_flash_firmware()
1856 scb->timeout = ips_cmd_timeout; in ips_flash_firmware()
1858 scb->data_len = ha->flash_datasize; in ips_flash_firmware()
1859 scb->data_busaddr = in ips_flash_firmware()
1860 dma_map_single(&ha->pcidev->dev, ha->flash_data, scb->data_len, in ips_flash_firmware()
1862 scb->flags |= IPS_SCB_MAP_SINGLE; in ips_flash_firmware()
1863 scb->cmd.flashfw.command_id = IPS_COMMAND_ID(ha, scb); in ips_flash_firmware()
1864 scb->cmd.flashfw.buffer_addr = cpu_to_le32(scb->data_busaddr); in ips_flash_firmware()
1865 if (pt->TimeOut) in ips_flash_firmware()
1866 scb->timeout = pt->TimeOut; in ips_flash_firmware()
1867 scb->scsi_cmd->result = DID_OK << 16; in ips_flash_firmware()
1879 if (ha->flash_data == ips_FlashData) in ips_free_flash_copperhead()
1881 else if (ha->flash_data) in ips_free_flash_copperhead()
1882 dma_free_coherent(&ha->pcidev->dev, ha->flash_len, in ips_free_flash_copperhead()
1883 ha->flash_data, ha->flash_busaddr); in ips_free_flash_copperhead()
1884 ha->flash_data = NULL; in ips_free_flash_copperhead()
1908 sg_list.list = scb->sg_list.list; in ips_usrcmd()
1909 cmd_busaddr = scb->scb_busaddr; in ips_usrcmd()
1911 memcpy(&scb->cmd, &pt->CoppCP.cmd, sizeof (IPS_IOCTL_CMD)); in ips_usrcmd()
1912 memcpy(&scb->dcdb, &pt->CoppCP.dcdb, sizeof (IPS_DCDB_TABLE)); in ips_usrcmd()
1915 scb->sg_list.list = sg_list.list; in ips_usrcmd()
1916 scb->scb_busaddr = cmd_busaddr; in ips_usrcmd()
1917 scb->bus = scb->scsi_cmd->device->channel; in ips_usrcmd()
1918 scb->target_id = scb->scsi_cmd->device->id; in ips_usrcmd()
1919 scb->lun = scb->scsi_cmd->device->lun; in ips_usrcmd()
1920 scb->sg_len = 0; in ips_usrcmd()
1921 scb->data_len = 0; in ips_usrcmd()
1922 scb->flags = 0; in ips_usrcmd()
1923 scb->op_code = 0; in ips_usrcmd()
1924 scb->callback = ipsintr_done; in ips_usrcmd()
1925 scb->timeout = ips_cmd_timeout; in ips_usrcmd()
1926 scb->cmd.basic_io.command_id = IPS_COMMAND_ID(ha, scb); in ips_usrcmd()
1929 if ((scb->cmd.basic_io.op_code == IPS_CMD_READ_SG) || in ips_usrcmd()
1930 (scb->cmd.basic_io.op_code == IPS_CMD_WRITE_SG) || in ips_usrcmd()
1931 (scb->cmd.basic_io.op_code == IPS_CMD_DCDB_SG)) in ips_usrcmd()
1934 if (pt->CmdBSize) { in ips_usrcmd()
1935 scb->data_len = pt->CmdBSize; in ips_usrcmd()
1936 scb->data_busaddr = ha->ioctl_busaddr + sizeof (ips_passthru_t); in ips_usrcmd()
1938 scb->data_busaddr = 0L; in ips_usrcmd()
1941 if (scb->cmd.dcdb.op_code == IPS_CMD_DCDB) in ips_usrcmd()
1942 scb->cmd.dcdb.dcdb_address = cpu_to_le32(scb->scb_busaddr + in ips_usrcmd()
1943 (unsigned long) &scb-> in ips_usrcmd()
1944 dcdb - in ips_usrcmd()
1947 if (pt->CmdBSize) { in ips_usrcmd()
1948 if (scb->cmd.dcdb.op_code == IPS_CMD_DCDB) in ips_usrcmd()
1949 scb->dcdb.buffer_pointer = in ips_usrcmd()
1950 cpu_to_le32(scb->data_busaddr); in ips_usrcmd()
1952 scb->cmd.basic_io.sg_addr = in ips_usrcmd()
1953 cpu_to_le32(scb->data_busaddr); in ips_usrcmd()
1957 if (pt->TimeOut) { in ips_usrcmd()
1958 scb->timeout = pt->TimeOut; in ips_usrcmd()
1960 if (pt->TimeOut <= 10) in ips_usrcmd()
1961 scb->dcdb.cmd_attribute |= IPS_TIMEOUT10; in ips_usrcmd()
1962 else if (pt->TimeOut <= 60) in ips_usrcmd()
1963 scb->dcdb.cmd_attribute |= IPS_TIMEOUT60; in ips_usrcmd()
1965 scb->dcdb.cmd_attribute |= IPS_TIMEOUT20M; in ips_usrcmd()
1969 scb->scsi_cmd->result = DID_OK << 16; in ips_usrcmd()
1991 if ((!scb) || (!scb->scsi_cmd) || (!scsi_sglist(scb->scsi_cmd))) { in ips_cleanup_passthru()
1993 ips_name, ha->host_num); in ips_cleanup_passthru()
1997 pt = (ips_passthru_t *) ha->ioctl_data; in ips_cleanup_passthru()
2000 if (scb->cmd.dcdb.op_code == IPS_CMD_DCDB) /* Copy DCDB Back to Caller's Area */ in ips_cleanup_passthru()
2001 memcpy(&pt->CoppCP.dcdb, &scb->dcdb, sizeof (IPS_DCDB_TABLE)); in ips_cleanup_passthru()
2003 pt->BasicStatus = scb->basic_status; in ips_cleanup_passthru()
2004 pt->ExtendedStatus = scb->extended_status; in ips_cleanup_passthru()
2005 pt->AdapterType = ha->ad_type; in ips_cleanup_passthru()
2007 if (ha->pcidev->device == IPS_DEVICEID_COPPERHEAD && in ips_cleanup_passthru()
2008 (scb->cmd.flashfw.op_code == IPS_CMD_DOWNLOAD || in ips_cleanup_passthru()
2009 scb->cmd.flashfw.op_code == IPS_CMD_RW_BIOSFW)) in ips_cleanup_passthru()
2012 ips_scmd_buf_write(scb->scsi_cmd, ha->ioctl_data, ha->ioctl_datasize); in ips_cleanup_passthru()
2031 if ((le32_to_cpu(ha->nvram->signature) == IPS_NVRAM_P5_SIG) && in ips_host_info()
2032 (le16_to_cpu(ha->nvram->adapter_type) != 0)) in ips_host_info()
2034 ips_adapter_name[ha->ad_type - 1]); in ips_host_info()
2038 if (ha->io_addr) in ips_host_info()
2041 ha->io_addr, ha->io_len); in ips_host_info()
2043 if (ha->mem_addr) { in ips_host_info()
2046 ha->mem_addr, ha->mem_len); in ips_host_info()
2049 (unsigned long)ha->mem_ptr); in ips_host_info()
2052 seq_printf(m, "\tIRQ number : %d\n", ha->pcidev->irq); in ips_host_info()
2057 if (le32_to_cpu(ha->nvram->signature) == IPS_NVRAM_P5_SIG) { in ips_host_info()
2058 if (ha->nvram->bios_low[3] == 0) { in ips_host_info()
2061 ha->nvram->bios_high[0], ha->nvram->bios_high[1], in ips_host_info()
2062 ha->nvram->bios_high[2], ha->nvram->bios_high[3], in ips_host_info()
2063 ha->nvram->bios_low[0], ha->nvram->bios_low[1], in ips_host_info()
2064 ha->nvram->bios_low[2]); in ips_host_info()
2069 ha->nvram->bios_high[0], ha->nvram->bios_high[1], in ips_host_info()
2070 ha->nvram->bios_high[2], ha->nvram->bios_high[3], in ips_host_info()
2071 ha->nvram->bios_low[0], ha->nvram->bios_low[1], in ips_host_info()
2072 ha->nvram->bios_low[2], ha->nvram->bios_low[3]); in ips_host_info()
2077 if (ha->enq->CodeBlkVersion[7] == 0) { in ips_host_info()
2080 ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1], in ips_host_info()
2081 ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3], in ips_host_info()
2082 ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5], in ips_host_info()
2083 ha->enq->CodeBlkVersion[6]); in ips_host_info()
2087 ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1], in ips_host_info()
2088 ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3], in ips_host_info()
2089 ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5], in ips_host_info()
2090 ha->enq->CodeBlkVersion[6], ha->enq->CodeBlkVersion[7]); in ips_host_info()
2093 if (ha->enq->BootBlkVersion[7] == 0) { in ips_host_info()
2096 ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1], in ips_host_info()
2097 ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3], in ips_host_info()
2098 ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5], in ips_host_info()
2099 ha->enq->BootBlkVersion[6]); in ips_host_info()
2103 ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1], in ips_host_info()
2104 ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3], in ips_host_info()
2105 ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5], in ips_host_info()
2106 ha->enq->BootBlkVersion[6], ha->enq->BootBlkVersion[7]); in ips_host_info()
2116 ha->enq->ucMaxPhysicalDevices); in ips_host_info()
2118 ha->max_cmds); in ips_host_info()
2120 ha->scb_waitlist.count); in ips_host_info()
2122 ha->scb_activelist.count - ha->num_ioctl); in ips_host_info()
2124 ha->copp_waitlist.count); in ips_host_info()
2126 ha->num_ioctl); in ips_host_info()
2147 switch (ha->pcidev->device) { in ips_identify_controller()
2149 if (ha->pcidev->revision <= IPS_REVID_SERVERAID) { in ips_identify_controller()
2150 ha->ad_type = IPS_ADTYPE_SERVERAID; in ips_identify_controller()
2151 } else if (ha->pcidev->revision == IPS_REVID_SERVERAID2) { in ips_identify_controller()
2152 ha->ad_type = IPS_ADTYPE_SERVERAID2; in ips_identify_controller()
2153 } else if (ha->pcidev->revision == IPS_REVID_NAVAJO) { in ips_identify_controller()
2154 ha->ad_type = IPS_ADTYPE_NAVAJO; in ips_identify_controller()
2155 } else if ((ha->pcidev->revision == IPS_REVID_SERVERAID2) in ips_identify_controller()
2156 && (ha->slot_num == 0)) { in ips_identify_controller()
2157 ha->ad_type = IPS_ADTYPE_KIOWA; in ips_identify_controller()
2158 } else if ((ha->pcidev->revision >= IPS_REVID_CLARINETP1) && in ips_identify_controller()
2159 (ha->pcidev->revision <= IPS_REVID_CLARINETP3)) { in ips_identify_controller()
2160 if (ha->enq->ucMaxPhysicalDevices == 15) in ips_identify_controller()
2161 ha->ad_type = IPS_ADTYPE_SERVERAID3L; in ips_identify_controller()
2163 ha->ad_type = IPS_ADTYPE_SERVERAID3; in ips_identify_controller()
2164 } else if ((ha->pcidev->revision >= IPS_REVID_TROMBONE32) && in ips_identify_controller()
2165 (ha->pcidev->revision <= IPS_REVID_TROMBONE64)) { in ips_identify_controller()
2166 ha->ad_type = IPS_ADTYPE_SERVERAID4H; in ips_identify_controller()
2171 switch (ha->pcidev->subsystem_device) { in ips_identify_controller()
2173 ha->ad_type = IPS_ADTYPE_SERVERAID4L; in ips_identify_controller()
2177 ha->ad_type = IPS_ADTYPE_SERVERAID4M; in ips_identify_controller()
2181 ha->ad_type = IPS_ADTYPE_SERVERAID4MX; in ips_identify_controller()
2185 ha->ad_type = IPS_ADTYPE_SERVERAID4LX; in ips_identify_controller()
2189 ha->ad_type = IPS_ADTYPE_SERVERAID5I2; in ips_identify_controller()
2193 ha->ad_type = IPS_ADTYPE_SERVERAID5I1; in ips_identify_controller()
2200 switch (ha->pcidev->subsystem_device) { in ips_identify_controller()
2202 ha->ad_type = IPS_ADTYPE_SERVERAID6M; in ips_identify_controller()
2205 ha->ad_type = IPS_ADTYPE_SERVERAID6I; in ips_identify_controller()
2208 ha->ad_type = IPS_ADTYPE_SERVERAID7k; in ips_identify_controller()
2211 ha->ad_type = IPS_ADTYPE_SERVERAID7M; in ips_identify_controller()
2242 memcpy(ha->bios_version, " ?", 8); in ips_get_bios_version()
2244 if (ha->pcidev->device == IPS_DEVICEID_COPPERHEAD) { in ips_get_bios_version()
2248 /* test 1st byte */ in ips_get_bios_version()
2249 writel(0, 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 if (readb(ha->mem_ptr + IPS_REG_FLDP) != 0x55) in ips_get_bios_version()
2256 writel(1, ha->mem_ptr + IPS_REG_FLAP); in ips_get_bios_version()
2257 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2260 if (readb(ha->mem_ptr + IPS_REG_FLDP) != 0xAA) in ips_get_bios_version()
2264 writel(0x1FF, ha->mem_ptr + IPS_REG_FLAP); in ips_get_bios_version()
2265 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2268 major = readb(ha->mem_ptr + IPS_REG_FLDP); in ips_get_bios_version()
2271 writel(0x1FE, ha->mem_ptr + IPS_REG_FLAP); in ips_get_bios_version()
2272 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2274 minor = readb(ha->mem_ptr + IPS_REG_FLDP); in ips_get_bios_version()
2277 writel(0x1FD, ha->mem_ptr + IPS_REG_FLAP); in ips_get_bios_version()
2278 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2280 subminor = readb(ha->mem_ptr + IPS_REG_FLDP); in ips_get_bios_version()
2285 /* test 1st byte */ in ips_get_bios_version()
2286 outl(0, 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 if (inb(ha->io_addr + IPS_REG_FLDP) != 0x55) in ips_get_bios_version()
2293 outl(1, 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 if (inb(ha->io_addr + IPS_REG_FLDP) != 0xAA) in ips_get_bios_version()
2301 outl(0x1FF, 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 major = inb(ha->io_addr + IPS_REG_FLDP); in ips_get_bios_version()
2308 outl(0x1FE, ha->io_addr + IPS_REG_FLAP); in ips_get_bios_version()
2309 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2312 minor = inb(ha->io_addr + IPS_REG_FLDP); in ips_get_bios_version()
2315 outl(0x1FD, ha->io_addr + IPS_REG_FLAP); in ips_get_bios_version()
2316 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_get_bios_version()
2319 subminor = inb(ha->io_addr + IPS_REG_FLDP); in ips_get_bios_version()
2323 /* Morpheus Family - Send Command to the card */ in ips_get_bios_version()
2325 buffer = ha->ioctl_data; in ips_get_bios_version()
2329 scb = &ha->scbs[ha->max_cmds - 1]; in ips_get_bios_version()
2333 scb->timeout = ips_cmd_timeout; in ips_get_bios_version()
2334 scb->cdb[0] = IPS_CMD_RW_BIOSFW; in ips_get_bios_version()
2336 scb->cmd.flashfw.op_code = IPS_CMD_RW_BIOSFW; in ips_get_bios_version()
2337 scb->cmd.flashfw.command_id = IPS_COMMAND_ID(ha, scb); in ips_get_bios_version()
2338 scb->cmd.flashfw.type = 1; in ips_get_bios_version()
2339 scb->cmd.flashfw.direction = 0; in ips_get_bios_version()
2340 scb->cmd.flashfw.count = cpu_to_le32(0x800); in ips_get_bios_version()
2341 scb->cmd.flashfw.total_packets = 1; in ips_get_bios_version()
2342 scb->cmd.flashfw.packet_num = 0; in ips_get_bios_version()
2343 scb->data_len = 0x1000; in ips_get_bios_version()
2344 scb->cmd.flashfw.buffer_addr = ha->ioctl_busaddr; in ips_get_bios_version()
2351 || ((scb->basic_status & IPS_GSC_STATUS_MASK) > 1)) { in ips_get_bios_version()
2366 ha->bios_version[0] = hex_asc_upper_hi(major); in ips_get_bios_version()
2367 ha->bios_version[1] = '.'; in ips_get_bios_version()
2368 ha->bios_version[2] = hex_asc_upper_lo(major); in ips_get_bios_version()
2369 ha->bios_version[3] = hex_asc_upper_lo(subminor); in ips_get_bios_version()
2370 ha->bios_version[4] = '.'; in ips_get_bios_version()
2371 ha->bios_version[5] = hex_asc_upper_hi(minor); in ips_get_bios_version()
2372 ha->bios_version[6] = hex_asc_upper_lo(minor); in ips_get_bios_version()
2373 ha->bios_version[7] = 0; in ips_get_bios_version()
2397 if (ha->func.statinit) in ips_hainit()
2398 (*ha->func.statinit) (ha); in ips_hainit()
2400 if (ha->func.enableint) in ips_hainit()
2401 (*ha->func.enableint) (ha); in ips_hainit()
2404 ha->reset_count = 1; in ips_hainit()
2405 ha->last_ffdc = ktime_get_real_seconds(); in ips_hainit()
2409 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_hainit()
2416 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_hainit()
2426 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_hainit()
2434 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_hainit()
2441 if ((ha->conf->ucLogDriveCount > 0) && (ha->requires_esl == 1)) in ips_hainit()
2445 ha->ntargets = IPS_MAX_TARGETS + 1; in ips_hainit()
2446 ha->nlun = 1; in ips_hainit()
2447 ha->nbus = (ha->enq->ucMaxPhysicalDevices / IPS_MAX_TARGETS) + 1; in ips_hainit()
2449 switch (ha->conf->logical_drive[0].ucStripeSize) { in ips_hainit()
2451 ha->max_xfer = 0x10000; in ips_hainit()
2455 ha->max_xfer = 0x20000; in ips_hainit()
2459 ha->max_xfer = 0x40000; in ips_hainit()
2464 ha->max_xfer = 0x80000; in ips_hainit()
2469 if (le32_to_cpu(ha->subsys->param[4]) & 0x1) { in ips_hainit()
2471 ha->max_cmds = ha->enq->ucConcurrentCmdCount; in ips_hainit()
2474 switch (ha->conf->logical_drive[0].ucStripeSize) { in ips_hainit()
2476 ha->max_cmds = 32; in ips_hainit()
2480 ha->max_cmds = 16; in ips_hainit()
2484 ha->max_cmds = 8; in ips_hainit()
2489 ha->max_cmds = 4; in ips_hainit()
2495 if ((ha->ad_type == IPS_ADTYPE_SERVERAID3L) || in ips_hainit()
2496 (ha->ad_type == IPS_ADTYPE_SERVERAID4L) || in ips_hainit()
2497 (ha->ad_type == IPS_ADTYPE_SERVERAID4LX)) { in ips_hainit()
2498 if ((ha->max_cmds > MaxLiteCmds) && (MaxLiteCmds)) in ips_hainit()
2499 ha->max_cmds = MaxLiteCmds; in ips_hainit()
2503 ha->ha_id[0] = IPS_ADAPTER_ID; in ips_hainit()
2504 for (i = 1; i < ha->nbus; i++) { in ips_hainit()
2505 ha->ha_id[i] = ha->conf->init_id[i - 1] & 0x1f; in ips_hainit()
2506 ha->dcdb_active[i - 1] = 0; in ips_hainit()
2535 host = ips_sh[ha->host_num]; in ips_next()
2541 spin_lock(host->host_lock); in ips_next()
2543 if ((ha->subsys->param[3] & 0x300000) in ips_next()
2544 && (ha->scb_activelist.count == 0)) { in ips_next()
2546 if (now - ha->last_ffdc > IPS_SECS_8HOURS) { in ips_next()
2547 ha->last_ffdc = now; in ips_next()
2559 while ((ha->num_ioctl < IPS_MAX_IOCTL) && in ips_next()
2560 (ha->copp_waitlist.head) && (scb = ips_getscb(ha))) { in ips_next()
2562 item = ips_removeq_copp_head(&ha->copp_waitlist); in ips_next()
2563 ha->num_ioctl++; in ips_next()
2565 spin_unlock(host->host_lock); in ips_next()
2566 scb->scsi_cmd = item->scsi_cmd; in ips_next()
2569 ret = ips_make_passthru(ha, scb->scsi_cmd, scb, intr); in ips_next()
2572 spin_lock(host->host_lock); in ips_next()
2575 if (scb->scsi_cmd) { in ips_next()
2576 scb->scsi_cmd->result = DID_ERROR << 16; in ips_next()
2577 scb->scsi_cmd->scsi_done(scb->scsi_cmd); in ips_next()
2583 if (scb->scsi_cmd) { in ips_next()
2584 scb->scsi_cmd->result = DID_OK << 16; in ips_next()
2585 scb->scsi_cmd->scsi_done(scb->scsi_cmd); in ips_next()
2595 ha->num_ioctl--; in ips_next()
2602 ips_putq_scb_head(&ha->scb_activelist, scb); in ips_next()
2604 ha->num_ioctl--; in ips_next()
2608 if (scb->scsi_cmd) { in ips_next()
2609 scb->scsi_cmd->result = DID_ERROR << 16; in ips_next()
2627 p = ha->scb_waitlist.head; in ips_next()
2630 && (ha-> in ips_next()
2631 dcdb_active[scmd_channel(p) - in ips_next()
2634 p = (struct scsi_cmnd *) p->host_scribble; in ips_next()
2639 SC = ips_removeq_wait(&ha->scb_waitlist, q); in ips_next()
2642 spin_unlock(host->host_lock); /* Unlock HA after command is taken off queue */ in ips_next()
2644 SC->result = DID_OK; in ips_next()
2645 SC->host_scribble = NULL; in ips_next()
2647 scb->target_id = SC->device->id; in ips_next()
2648 scb->lun = SC->device->lun; in ips_next()
2649 scb->bus = SC->device->channel; in ips_next()
2650 scb->scsi_cmd = SC; in ips_next()
2651 scb->breakup = 0; in ips_next()
2652 scb->data_len = 0; in ips_next()
2653 scb->callback = ipsintr_done; in ips_next()
2654 scb->timeout = ips_cmd_timeout; in ips_next()
2655 memset(&scb->cmd, 0, 16); in ips_next()
2658 memcpy(scb->cdb, SC->cmnd, SC->cmd_len); in ips_next()
2660 scb->sg_count = scsi_dma_map(SC); in ips_next()
2661 BUG_ON(scb->sg_count < 0); in ips_next()
2662 if (scb->sg_count) { in ips_next()
2666 scb->flags |= IPS_SCB_MAP_SG; in ips_next()
2668 scsi_for_each_sg(SC, sg, scb->sg_count, i) { in ips_next()
2674 scb->dcdb.transfer_length = scb->data_len; in ips_next()
2676 scb->data_busaddr = 0L; in ips_next()
2677 scb->sg_len = 0; in ips_next()
2678 scb->data_len = 0; in ips_next()
2679 scb->dcdb.transfer_length = 0; in ips_next()
2682 scb->dcdb.cmd_attribute = in ips_next()
2683 ips_command_direction[scb->scsi_cmd->cmnd[0]]; in ips_next()
2687 if ((scb->scsi_cmd->cmnd[0] == WRITE_BUFFER) && in ips_next()
2688 (scb->data_len == 0)) in ips_next()
2689 scb->dcdb.cmd_attribute = 0; in ips_next()
2691 if (!(scb->dcdb.cmd_attribute & 0x3)) in ips_next()
2692 scb->dcdb.transfer_length = 0; in ips_next()
2694 if (scb->data_len >= IPS_MAX_XFER) { in ips_next()
2695 scb->dcdb.cmd_attribute |= IPS_TRANSFER64K; in ips_next()
2696 scb->dcdb.transfer_length = 0; in ips_next()
2699 spin_lock(host->host_lock); in ips_next()
2705 ips_putq_scb_head(&ha->scb_activelist, scb); in ips_next()
2708 if (scb->scsi_cmd) { in ips_next()
2709 scb->scsi_cmd->result = DID_ERROR << 16; in ips_next()
2710 scb->scsi_cmd->scsi_done(scb->scsi_cmd); in ips_next()
2713 if (scb->bus) in ips_next()
2714 ha->dcdb_active[scb->bus - 1] &= in ips_next()
2715 ~(1 << scb->target_id); in ips_next()
2720 if (scb->scsi_cmd) in ips_next()
2721 scb->scsi_cmd->scsi_done(scb->scsi_cmd); in ips_next()
2723 if (scb->bus) in ips_next()
2724 ha->dcdb_active[scb->bus - 1] &= in ips_next()
2725 ~(1 << scb->target_id); in ips_next()
2733 p = (struct scsi_cmnd *) p->host_scribble; in ips_next()
2738 spin_unlock(host->host_lock); in ips_next()
2760 item->q_next = queue->head; in ips_putq_scb_head()
2761 queue->head = item; in ips_putq_scb_head()
2763 if (!queue->tail) in ips_putq_scb_head()
2764 queue->tail = item; in ips_putq_scb_head()
2766 queue->count++; in ips_putq_scb_head()
2787 item = queue->head; in ips_removeq_scb_head()
2793 queue->head = item->q_next; in ips_removeq_scb_head()
2794 item->q_next = NULL; in ips_removeq_scb_head()
2796 if (queue->tail == item) in ips_removeq_scb_head()
2797 queue->tail = NULL; in ips_removeq_scb_head()
2799 queue->count--; in ips_removeq_scb_head()
2825 if (item == queue->head) { in ips_removeq_scb()
2829 p = queue->head; in ips_removeq_scb()
2831 while ((p) && (item != p->q_next)) in ips_removeq_scb()
2832 p = p->q_next; in ips_removeq_scb()
2836 p->q_next = item->q_next; in ips_removeq_scb()
2838 if (!item->q_next) in ips_removeq_scb()
2839 queue->tail = p; in ips_removeq_scb()
2841 item->q_next = NULL; in ips_removeq_scb()
2842 queue->count--; in ips_removeq_scb()
2868 item->host_scribble = NULL; in ips_putq_wait_tail()
2870 if (queue->tail) in ips_putq_wait_tail()
2871 queue->tail->host_scribble = (char *) item; in ips_putq_wait_tail()
2873 queue->tail = item; in ips_putq_wait_tail()
2875 if (!queue->head) in ips_putq_wait_tail()
2876 queue->head = item; in ips_putq_wait_tail()
2878 queue->count++; in ips_putq_wait_tail()
2898 item = queue->head; in ips_removeq_wait_head()
2904 queue->head = (struct scsi_cmnd *) item->host_scribble; in ips_removeq_wait_head()
2905 item->host_scribble = NULL; in ips_removeq_wait_head()
2907 if (queue->tail == item) in ips_removeq_wait_head()
2908 queue->tail = NULL; in ips_removeq_wait_head()
2910 queue->count--; in ips_removeq_wait_head()
2936 if (item == queue->head) { in ips_removeq_wait()
2940 p = queue->head; in ips_removeq_wait()
2942 while ((p) && (item != (struct scsi_cmnd *) p->host_scribble)) in ips_removeq_wait()
2943 p = (struct scsi_cmnd *) p->host_scribble; in ips_removeq_wait()
2947 p->host_scribble = item->host_scribble; in ips_removeq_wait()
2949 if (!item->host_scribble) in ips_removeq_wait()
2950 queue->tail = p; in ips_removeq_wait()
2952 item->host_scribble = NULL; in ips_removeq_wait()
2953 queue->count--; in ips_removeq_wait()
2980 item->next = NULL; in ips_putq_copp_tail()
2982 if (queue->tail) in ips_putq_copp_tail()
2983 queue->tail->next = item; in ips_putq_copp_tail()
2985 queue->tail = item; in ips_putq_copp_tail()
2987 if (!queue->head) in ips_putq_copp_tail()
2988 queue->head = item; in ips_putq_copp_tail()
2990 queue->count++; in ips_putq_copp_tail()
3011 item = queue->head; in ips_removeq_copp_head()
3017 queue->head = item->next; in ips_removeq_copp_head()
3018 item->next = NULL; in ips_removeq_copp_head()
3020 if (queue->tail == item) in ips_removeq_copp_head()
3021 queue->tail = NULL; in ips_removeq_copp_head()
3023 queue->count--; in ips_removeq_copp_head()
3049 if (item == queue->head) { in ips_removeq_copp()
3053 p = queue->head; in ips_removeq_copp()
3055 while ((p) && (item != p->next)) in ips_removeq_copp()
3056 p = p->next; in ips_removeq_copp()
3060 p->next = item->next; in ips_removeq_copp()
3062 if (!item->next) in ips_removeq_copp()
3063 queue->tail = p; in ips_removeq_copp()
3065 item->next = NULL; in ips_removeq_copp()
3066 queue->count--; in ips_removeq_copp()
3089 if ((ha->waitflag == TRUE) && (ha->cmd_in_progress == scb->cdb[0])) { in ipsintr_blocking()
3090 ha->waitflag = FALSE; in ipsintr_blocking()
3102 /* Finalize an interrupt for non-internal commands */
3111 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ipsintr_done()
3117 if (scb->scsi_cmd == NULL) { in ipsintr_done()
3119 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ipsintr_done()
3147 if ((scb->scsi_cmd) && (ips_is_passthru(scb->scsi_cmd))) { in ips_done()
3149 ha->num_ioctl--; in ips_done()
3156 if ((scb->breakup) || (scb->sg_break)) { in ips_done()
3161 scb->data_len = 0; in ips_done()
3163 sg = scsi_sglist(scb->scsi_cmd); in ips_done()
3166 sg_dma_index = scb->breakup; in ips_done()
3167 for (i = 0; i < scb->breakup; i++) in ips_done()
3176 for (; sg_dma_index < scsi_sg_count(scb->scsi_cmd); in ips_done()
3186 scb->dcdb.transfer_length = scb->data_len; in ips_done()
3187 scb->dcdb.cmd_attribute |= in ips_done()
3188 ips_command_direction[scb->scsi_cmd->cmnd[0]]; in ips_done()
3190 if (!(scb->dcdb.cmd_attribute & 0x3)) in ips_done()
3191 scb->dcdb.transfer_length = 0; in ips_done()
3193 if (scb->data_len >= IPS_MAX_XFER) { in ips_done()
3194 scb->dcdb.cmd_attribute |= IPS_TRANSFER64K; in ips_done()
3195 scb->dcdb.transfer_length = 0; in ips_done()
3202 if (scb->scsi_cmd) { in ips_done()
3203 scb->scsi_cmd->result = DID_ERROR << 16; in ips_done()
3204 scb->scsi_cmd->scsi_done(scb->scsi_cmd); in ips_done()
3210 if (scb->scsi_cmd) { in ips_done()
3211 scb->scsi_cmd->result = DID_ERROR << 16; in ips_done()
3212 scb->scsi_cmd->scsi_done(scb->scsi_cmd); in ips_done()
3225 if (scb->bus) { in ips_done()
3226 ha->dcdb_active[scb->bus - 1] &= ~(1 << scb->target_id); in ips_done()
3229 scb->scsi_cmd->scsi_done(scb->scsi_cmd); in ips_done()
3254 if (scb->bus) { in ips_map_status()
3257 ips_name, ha->host_num, in ips_map_status()
3258 scb->scsi_cmd->device->channel, in ips_map_status()
3259 scb->scsi_cmd->device->id, scb->scsi_cmd->device->lun, in ips_map_status()
3260 scb->basic_status, scb->extended_status, in ips_map_status()
3261 scb->extended_status == in ips_map_status()
3262 IPS_ERR_CKCOND ? scb->dcdb.sense_info[2] & 0xf : 0, in ips_map_status()
3263 scb->extended_status == in ips_map_status()
3264 IPS_ERR_CKCOND ? scb->dcdb.sense_info[12] : 0, in ips_map_status()
3265 scb->extended_status == in ips_map_status()
3266 IPS_ERR_CKCOND ? scb->dcdb.sense_info[13] : 0); in ips_map_status()
3273 switch (scb->basic_status & IPS_GSC_STATUS_MASK) { in ips_map_status()
3286 switch (scb->extended_status) { in ips_map_status()
3288 if (scb->bus) in ips_map_status()
3294 if ((scb->cmd.dcdb.op_code == IPS_CMD_EXTENDED_DCDB) || in ips_map_status()
3295 (scb->cmd.dcdb.op_code == in ips_map_status()
3297 tapeDCDB = (IPS_DCDB_TABLE_TAPE *) & scb->dcdb; in ips_map_status()
3298 transfer_len = tapeDCDB->transfer_length; in ips_map_status()
3301 (uint32_t) scb->dcdb.transfer_length; in ips_map_status()
3304 if ((scb->bus) && (transfer_len < scb->data_len)) { in ips_map_status()
3305 /* Underrun - set default to no error */ in ips_map_status()
3309 if (scb->scsi_cmd->cmnd[0] == INQUIRY) { in ips_map_status()
3310 ips_scmd_buf_read(scb->scsi_cmd, in ips_map_status()
3324 if (scb->bus) in ips_map_status()
3335 if (scb->bus) { in ips_map_status()
3336 if ((scb->cmd.dcdb.op_code == in ips_map_status()
3338 || (scb->cmd.dcdb.op_code == in ips_map_status()
3341 (IPS_DCDB_TABLE_TAPE *) & scb->dcdb; in ips_map_status()
3342 memcpy(scb->scsi_cmd->sense_buffer, in ips_map_status()
3343 tapeDCDB->sense_info, in ips_map_status()
3346 memcpy(scb->scsi_cmd->sense_buffer, in ips_map_status()
3347 scb->dcdb.sense_info, in ips_map_status()
3364 scb->scsi_cmd->result = device_error | (errcode << 16); in ips_map_status()
3388 ha->waitflag = TRUE; in ips_send_wait()
3389 ha->cmd_in_progress = scb->cdb[0]; in ips_send_wait()
3391 scb->callback = ipsintr_blocking; in ips_send_wait()
3459 if (!scb->scsi_cmd) { in ips_send_cmd()
3462 if (scb->bus > 0) { in ips_send_cmd()
3464 /* to real devices -- fail them */ in ips_send_cmd()
3465 if ((ha->waitflag == TRUE) && in ips_send_cmd()
3466 (ha->cmd_in_progress == scb->cdb[0])) { in ips_send_cmd()
3467 ha->waitflag = FALSE; in ips_send_cmd()
3472 } else if ((scb->bus == 0) && (!ips_is_passthru(scb->scsi_cmd))) { in ips_send_cmd()
3473 /* command to logical bus -- interpret */ in ips_send_cmd()
3476 switch (scb->scsi_cmd->cmnd[0]) { in ips_send_cmd()
3482 scb->scsi_cmd->result = DID_ERROR << 16; in ips_send_cmd()
3486 scb->scsi_cmd->result = DID_OK << 16; in ips_send_cmd()
3491 if (scb->target_id == IPS_ADAPTER_ID) { in ips_send_cmd()
3496 if (scb->scsi_cmd->cmnd[0] == TEST_UNIT_READY) in ips_send_cmd()
3497 scb->scsi_cmd->result = DID_OK << 16; in ips_send_cmd()
3499 if (scb->scsi_cmd->cmnd[0] == INQUIRY) { in ips_send_cmd()
3525 ips_scmd_buf_write(scb->scsi_cmd, in ips_send_cmd()
3529 scb->scsi_cmd->result = DID_OK << 16; in ips_send_cmd()
3532 scb->cmd.logical_info.op_code = IPS_CMD_GET_LD_INFO; in ips_send_cmd()
3533 scb->cmd.logical_info.command_id = IPS_COMMAND_ID(ha, scb); in ips_send_cmd()
3534 scb->cmd.logical_info.reserved = 0; in ips_send_cmd()
3535 scb->cmd.logical_info.reserved2 = 0; in ips_send_cmd()
3536 scb->data_len = sizeof (IPS_LD_INFO); in ips_send_cmd()
3537 scb->data_busaddr = ha->logical_drive_info_dma_addr; in ips_send_cmd()
3538 scb->flags = 0; in ips_send_cmd()
3539 scb->cmd.logical_info.buffer_addr = scb->data_busaddr; in ips_send_cmd()
3547 scb->scsi_cmd->result = DID_OK << 16; in ips_send_cmd()
3552 if (!scb->sg_len) { in ips_send_cmd()
3553 scb->cmd.basic_io.op_code = in ips_send_cmd()
3554 (scb->scsi_cmd->cmnd[0] == in ips_send_cmd()
3556 scb->cmd.basic_io.enhanced_sg = 0; in ips_send_cmd()
3557 scb->cmd.basic_io.sg_addr = in ips_send_cmd()
3558 cpu_to_le32(scb->data_busaddr); in ips_send_cmd()
3560 scb->cmd.basic_io.op_code = in ips_send_cmd()
3561 (scb->scsi_cmd->cmnd[0] == in ips_send_cmd()
3564 scb->cmd.basic_io.enhanced_sg = in ips_send_cmd()
3566 scb->cmd.basic_io.sg_addr = in ips_send_cmd()
3567 cpu_to_le32(scb->sg_busaddr); in ips_send_cmd()
3570 scb->cmd.basic_io.segment_4G = 0; in ips_send_cmd()
3571 scb->cmd.basic_io.command_id = IPS_COMMAND_ID(ha, scb); in ips_send_cmd()
3572 scb->cmd.basic_io.log_drv = scb->target_id; in ips_send_cmd()
3573 scb->cmd.basic_io.sg_count = scb->sg_len; in ips_send_cmd()
3575 if (scb->cmd.basic_io.lba) in ips_send_cmd()
3576 le32_add_cpu(&scb->cmd.basic_io.lba, in ips_send_cmd()
3577 le16_to_cpu(scb->cmd.basic_io. in ips_send_cmd()
3580 scb->cmd.basic_io.lba = in ips_send_cmd()
3581 (((scb->scsi_cmd-> in ips_send_cmd()
3582 cmnd[1] & 0x1f) << 16) | (scb->scsi_cmd-> in ips_send_cmd()
3584 (scb->scsi_cmd->cmnd[3])); in ips_send_cmd()
3586 scb->cmd.basic_io.sector_count = in ips_send_cmd()
3587 cpu_to_le16(scb->data_len / IPS_BLKSIZE); in ips_send_cmd()
3589 if (le16_to_cpu(scb->cmd.basic_io.sector_count) == 0) in ips_send_cmd()
3590 scb->cmd.basic_io.sector_count = in ips_send_cmd()
3598 if (!scb->sg_len) { in ips_send_cmd()
3599 scb->cmd.basic_io.op_code = in ips_send_cmd()
3600 (scb->scsi_cmd->cmnd[0] == in ips_send_cmd()
3602 scb->cmd.basic_io.enhanced_sg = 0; in ips_send_cmd()
3603 scb->cmd.basic_io.sg_addr = in ips_send_cmd()
3604 cpu_to_le32(scb->data_busaddr); in ips_send_cmd()
3606 scb->cmd.basic_io.op_code = in ips_send_cmd()
3607 (scb->scsi_cmd->cmnd[0] == in ips_send_cmd()
3610 scb->cmd.basic_io.enhanced_sg = in ips_send_cmd()
3612 scb->cmd.basic_io.sg_addr = in ips_send_cmd()
3613 cpu_to_le32(scb->sg_busaddr); in ips_send_cmd()
3616 scb->cmd.basic_io.segment_4G = 0; in ips_send_cmd()
3617 scb->cmd.basic_io.command_id = IPS_COMMAND_ID(ha, scb); in ips_send_cmd()
3618 scb->cmd.basic_io.log_drv = scb->target_id; in ips_send_cmd()
3619 scb->cmd.basic_io.sg_count = scb->sg_len; in ips_send_cmd()
3621 if (scb->cmd.basic_io.lba) in ips_send_cmd()
3622 le32_add_cpu(&scb->cmd.basic_io.lba, in ips_send_cmd()
3623 le16_to_cpu(scb->cmd.basic_io. in ips_send_cmd()
3626 scb->cmd.basic_io.lba = in ips_send_cmd()
3627 ((scb->scsi_cmd->cmnd[2] << 24) | (scb-> in ips_send_cmd()
3628 scsi_cmd-> in ips_send_cmd()
3631 (scb->scsi_cmd->cmnd[4] << 8) | scb-> in ips_send_cmd()
3632 scsi_cmd->cmnd[5]); in ips_send_cmd()
3634 scb->cmd.basic_io.sector_count = in ips_send_cmd()
3635 cpu_to_le16(scb->data_len / IPS_BLKSIZE); in ips_send_cmd()
3637 if (cpu_to_le16(scb->cmd.basic_io.sector_count) == 0) { in ips_send_cmd()
3643 scb->scsi_cmd->result = DID_OK << 16; in ips_send_cmd()
3651 scb->scsi_cmd->result = DID_OK << 16; in ips_send_cmd()
3655 scb->cmd.basic_io.op_code = IPS_CMD_ENQUIRY; in ips_send_cmd()
3656 scb->cmd.basic_io.command_id = IPS_COMMAND_ID(ha, scb); in ips_send_cmd()
3657 scb->cmd.basic_io.segment_4G = 0; in ips_send_cmd()
3658 scb->cmd.basic_io.enhanced_sg = 0; in ips_send_cmd()
3659 scb->data_len = sizeof (*ha->enq); in ips_send_cmd()
3660 scb->cmd.basic_io.sg_addr = ha->enq_busaddr; in ips_send_cmd()
3665 scb->cmd.logical_info.op_code = IPS_CMD_GET_LD_INFO; in ips_send_cmd()
3666 scb->cmd.logical_info.command_id = IPS_COMMAND_ID(ha, scb); in ips_send_cmd()
3667 scb->cmd.logical_info.reserved = 0; in ips_send_cmd()
3668 scb->cmd.logical_info.reserved2 = 0; in ips_send_cmd()
3669 scb->cmd.logical_info.reserved3 = 0; in ips_send_cmd()
3670 scb->data_len = sizeof (IPS_LD_INFO); in ips_send_cmd()
3671 scb->data_busaddr = ha->logical_drive_info_dma_addr; in ips_send_cmd()
3672 scb->flags = 0; in ips_send_cmd()
3673 scb->cmd.logical_info.buffer_addr = scb->data_busaddr; in ips_send_cmd()
3685 scb->scsi_cmd->result = DID_OK << 16; in ips_send_cmd()
3692 sp = (char *) scb->scsi_cmd->sense_buffer; in ips_send_cmd()
3701 scb->scsi_cmd->result = device_error | (DID_OK << 16); in ips_send_cmd()
3710 if (scb->bus > 0) { in ips_send_cmd()
3714 if (ha->conf->dev[scb->bus - 1][scb->target_id].ucState == 0) { in ips_send_cmd()
3715 scb->scsi_cmd->result = DID_NO_CONNECT << 16; in ips_send_cmd()
3719 ha->dcdb_active[scb->bus - 1] |= (1 << scb->target_id); in ips_send_cmd()
3720 scb->cmd.dcdb.command_id = IPS_COMMAND_ID(ha, scb); in ips_send_cmd()
3721 scb->cmd.dcdb.dcdb_address = cpu_to_le32(scb->scb_busaddr + in ips_send_cmd()
3722 (unsigned long) &scb-> in ips_send_cmd()
3723 dcdb - in ips_send_cmd()
3725 scb->cmd.dcdb.reserved = 0; in ips_send_cmd()
3726 scb->cmd.dcdb.reserved2 = 0; in ips_send_cmd()
3727 scb->cmd.dcdb.reserved3 = 0; in ips_send_cmd()
3728 scb->cmd.dcdb.segment_4G = 0; in ips_send_cmd()
3729 scb->cmd.dcdb.enhanced_sg = 0; in ips_send_cmd()
3731 TimeOut = scb->scsi_cmd->request->timeout; in ips_send_cmd()
3733 if (ha->subsys->param[4] & 0x00100000) { /* If NEW Tape DCDB is Supported */ in ips_send_cmd()
3734 if (!scb->sg_len) { in ips_send_cmd()
3735 scb->cmd.dcdb.op_code = IPS_CMD_EXTENDED_DCDB; in ips_send_cmd()
3737 scb->cmd.dcdb.op_code = in ips_send_cmd()
3739 scb->cmd.dcdb.enhanced_sg = in ips_send_cmd()
3743 tapeDCDB = (IPS_DCDB_TABLE_TAPE *) & scb->dcdb; /* Use Same Data Area as Old DCDB Struct */ in ips_send_cmd()
3744 tapeDCDB->device_address = in ips_send_cmd()
3745 ((scb->bus - 1) << 4) | scb->target_id; in ips_send_cmd()
3746 tapeDCDB->cmd_attribute |= IPS_DISCONNECT_ALLOWED; in ips_send_cmd()
3747 tapeDCDB->cmd_attribute &= ~IPS_TRANSFER64K; /* Always Turn OFF 64K Size Flag */ in ips_send_cmd()
3751 tapeDCDB->cmd_attribute |= IPS_TIMEOUT10; /* TimeOut is 10 Seconds */ in ips_send_cmd()
3753 tapeDCDB->cmd_attribute |= IPS_TIMEOUT60; /* TimeOut is 60 Seconds */ in ips_send_cmd()
3755 tapeDCDB->cmd_attribute |= IPS_TIMEOUT20M; /* TimeOut is 20 Minutes */ in ips_send_cmd()
3758 tapeDCDB->cdb_length = scb->scsi_cmd->cmd_len; in ips_send_cmd()
3759 tapeDCDB->reserved_for_LUN = 0; in ips_send_cmd()
3760 tapeDCDB->transfer_length = scb->data_len; in ips_send_cmd()
3761 if (scb->cmd.dcdb.op_code == IPS_CMD_EXTENDED_DCDB_SG) in ips_send_cmd()
3762 tapeDCDB->buffer_pointer = in ips_send_cmd()
3763 cpu_to_le32(scb->sg_busaddr); in ips_send_cmd()
3765 tapeDCDB->buffer_pointer = in ips_send_cmd()
3766 cpu_to_le32(scb->data_busaddr); in ips_send_cmd()
3767 tapeDCDB->sg_count = scb->sg_len; in ips_send_cmd()
3768 tapeDCDB->sense_length = sizeof (tapeDCDB->sense_info); in ips_send_cmd()
3769 tapeDCDB->scsi_status = 0; in ips_send_cmd()
3770 tapeDCDB->reserved = 0; in ips_send_cmd()
3771 memcpy(tapeDCDB->scsi_cdb, scb->scsi_cmd->cmnd, in ips_send_cmd()
3772 scb->scsi_cmd->cmd_len); in ips_send_cmd()
3774 if (!scb->sg_len) { in ips_send_cmd()
3775 scb->cmd.dcdb.op_code = IPS_CMD_DCDB; in ips_send_cmd()
3777 scb->cmd.dcdb.op_code = IPS_CMD_DCDB_SG; in ips_send_cmd()
3778 scb->cmd.dcdb.enhanced_sg = in ips_send_cmd()
3782 scb->dcdb.device_address = in ips_send_cmd()
3783 ((scb->bus - 1) << 4) | scb->target_id; in ips_send_cmd()
3784 scb->dcdb.cmd_attribute |= IPS_DISCONNECT_ALLOWED; in ips_send_cmd()
3788 scb->dcdb.cmd_attribute |= IPS_TIMEOUT10; /* TimeOut is 10 Seconds */ in ips_send_cmd()
3790 scb->dcdb.cmd_attribute |= IPS_TIMEOUT60; /* TimeOut is 60 Seconds */ in ips_send_cmd()
3792 scb->dcdb.cmd_attribute |= IPS_TIMEOUT20M; /* TimeOut is 20 Minutes */ in ips_send_cmd()
3795 scb->dcdb.transfer_length = scb->data_len; in ips_send_cmd()
3796 if (scb->dcdb.cmd_attribute & IPS_TRANSFER64K) in ips_send_cmd()
3797 scb->dcdb.transfer_length = 0; in ips_send_cmd()
3798 if (scb->cmd.dcdb.op_code == IPS_CMD_DCDB_SG) in ips_send_cmd()
3799 scb->dcdb.buffer_pointer = in ips_send_cmd()
3800 cpu_to_le32(scb->sg_busaddr); in ips_send_cmd()
3802 scb->dcdb.buffer_pointer = in ips_send_cmd()
3803 cpu_to_le32(scb->data_busaddr); in ips_send_cmd()
3804 scb->dcdb.cdb_length = scb->scsi_cmd->cmd_len; in ips_send_cmd()
3805 scb->dcdb.sense_length = sizeof (scb->dcdb.sense_info); in ips_send_cmd()
3806 scb->dcdb.sg_count = scb->sg_len; in ips_send_cmd()
3807 scb->dcdb.reserved = 0; in ips_send_cmd()
3808 memcpy(scb->dcdb.scsi_cdb, scb->scsi_cmd->cmnd, in ips_send_cmd()
3809 scb->scsi_cmd->cmd_len); in ips_send_cmd()
3810 scb->dcdb.scsi_status = 0; in ips_send_cmd()
3811 scb->dcdb.reserved2[0] = 0; in ips_send_cmd()
3812 scb->dcdb.reserved2[1] = 0; in ips_send_cmd()
3813 scb->dcdb.reserved2[2] = 0; in ips_send_cmd()
3817 return ((*ha->func.issue) (ha, scb)); in ips_send_cmd()
3841 scb = &ha->scbs[pstatus->fields.command_id]; in ips_chkstatus()
3842 scb->basic_status = basic_status = in ips_chkstatus()
3843 pstatus->fields.basic_status & IPS_BASIC_STATUS_MASK; in ips_chkstatus()
3844 scb->extended_status = ext_status = pstatus->fields.extended_status; in ips_chkstatus()
3846 sp = &ha->sp; in ips_chkstatus()
3847 sp->residue_len = 0; in ips_chkstatus()
3848 sp->scb_addr = (void *) scb; in ips_chkstatus()
3851 ips_removeq_scb(&ha->scb_activelist, scb); in ips_chkstatus()
3853 if (!scb->scsi_cmd) in ips_chkstatus()
3859 ha->host_num, in ips_chkstatus()
3860 scb->cdb[0], in ips_chkstatus()
3861 scb->cmd.basic_io.command_id, in ips_chkstatus()
3862 scb->bus, scb->target_id, scb->lun); in ips_chkstatus()
3864 if ((scb->scsi_cmd) && (ips_is_passthru(scb->scsi_cmd))) in ips_chkstatus()
3865 /* passthru - just returns the raw result */ in ips_chkstatus()
3873 if (scb->bus == 0) { in ips_chkstatus()
3878 ips_name, ha->host_num, in ips_chkstatus()
3879 scb->cmd.basic_io.op_code, in ips_chkstatus()
3883 switch (scb->scsi_cmd->cmnd[0]) { in ips_chkstatus()
3955 scb->scsi_cmd->result = errcode << 16; in ips_chkstatus()
3958 if (scb->scsi_cmd->cmnd[0] == INQUIRY) { in ips_chkstatus()
3959 ips_scmd_buf_read(scb->scsi_cmd, in ips_chkstatus()
3962 scb->scsi_cmd->result = DID_TIME_OUT << 16; in ips_chkstatus()
3966 if (scb->bus == 0) { in ips_chkstatus()
3969 ips_name, ha->host_num, in ips_chkstatus()
3970 scb->cmd.basic_io.op_code, basic_status, in ips_chkstatus()
3992 if (scb->target_id >= IPS_MAX_LD) in ips_online()
3995 if ((scb->basic_status & IPS_GSC_STATUS_MASK) > 1) { in ips_online()
3996 memset(ha->logical_drive_info, 0, sizeof (IPS_LD_INFO)); in ips_online()
4000 if (ha->logical_drive_info->drive_info[scb->target_id].state != in ips_online()
4002 && ha->logical_drive_info->drive_info[scb->target_id].state != in ips_online()
4004 && ha->logical_drive_info->drive_info[scb->target_id].state != in ips_online()
4006 && ha->logical_drive_info->drive_info[scb->target_id].state != in ips_online()
4043 ips_scmd_buf_write(scb->scsi_cmd, &inquiry, sizeof (inquiry)); in ips_inquiry()
4064 if (scsi_bufflen(scb->scsi_cmd) < 8) in ips_rdcap()
4069 (ha->logical_drive_info-> in ips_rdcap()
4070 drive_info[scb->target_id].sector_count) - 1); in ips_rdcap()
4073 ips_scmd_buf_write(scb->scsi_cmd, &cap, sizeof (cap)); in ips_rdcap()
4097 if (le32_to_cpu(ha->enq->ulDriveSize[scb->target_id]) > 0x400000 && in ips_msense()
4098 (ha->enq->ucMiscFlag & 0x8) == 0) { in ips_msense()
4107 (le32_to_cpu(ha->enq->ulDriveSize[scb->target_id]) - in ips_msense()
4114 switch (scb->scsi_cmd->cmnd[2] & 0x3f) { in ips_msense()
4164 ips_scmd_buf_write(scb->scsi_cmd, &mdata, sizeof (mdata)); in ips_msense()
4193 ips_scmd_buf_write(scb->scsi_cmd, &reqsen, sizeof (reqsen)); in ips_reqsen()
4214 if (ha->enq) { in ips_free()
4215 dma_free_coherent(&ha->pcidev->dev, sizeof(IPS_ENQ), in ips_free()
4216 ha->enq, ha->enq_busaddr); in ips_free()
4217 ha->enq = NULL; in ips_free()
4220 kfree(ha->conf); in ips_free()
4221 ha->conf = NULL; in ips_free()
4223 if (ha->adapt) { in ips_free()
4224 dma_free_coherent(&ha->pcidev->dev, in ips_free()
4226 sizeof (IPS_IO_CMD), ha->adapt, in ips_free()
4227 ha->adapt->hw_status_start); in ips_free()
4228 ha->adapt = NULL; in ips_free()
4231 if (ha->logical_drive_info) { in ips_free()
4232 dma_free_coherent(&ha->pcidev->dev, in ips_free()
4234 ha->logical_drive_info, in ips_free()
4235 ha->logical_drive_info_dma_addr); in ips_free()
4236 ha->logical_drive_info = NULL; in ips_free()
4239 kfree(ha->nvram); in ips_free()
4240 ha->nvram = NULL; in ips_free()
4242 kfree(ha->subsys); in ips_free()
4243 ha->subsys = NULL; in ips_free()
4245 if (ha->ioctl_data) { in ips_free()
4246 dma_free_coherent(&ha->pcidev->dev, ha->ioctl_len, in ips_free()
4247 ha->ioctl_data, ha->ioctl_busaddr); in ips_free()
4248 ha->ioctl_data = NULL; in ips_free()
4249 ha->ioctl_datasize = 0; in ips_free()
4250 ha->ioctl_len = 0; in ips_free()
4252 ips_deallocatescbs(ha, ha->max_cmds); in ips_free()
4255 if (ha->mem_ptr) { in ips_free()
4256 iounmap(ha->ioremap_ptr); in ips_free()
4257 ha->ioremap_ptr = NULL; in ips_free()
4258 ha->mem_ptr = NULL; in ips_free()
4261 ha->mem_addr = 0; in ips_free()
4278 if (ha->scbs) { in ips_deallocatescbs()
4279 dma_free_coherent(&ha->pcidev->dev, in ips_deallocatescbs()
4281 ha->scbs->sg_list.list, in ips_deallocatescbs()
4282 ha->scbs->sg_busaddr); in ips_deallocatescbs()
4283 dma_free_coherent(&ha->pcidev->dev, sizeof (ips_scb_t) * cmds, in ips_deallocatescbs()
4284 ha->scbs, ha->scbs->scb_busaddr); in ips_deallocatescbs()
4285 ha->scbs = NULL; in ips_deallocatescbs()
4310 ha->scbs = dma_alloc_coherent(&ha->pcidev->dev, in ips_allocatescbs()
4311 ha->max_cmds * sizeof (ips_scb_t), in ips_allocatescbs()
4313 if (ha->scbs == NULL) in ips_allocatescbs()
4315 ips_sg.list = dma_alloc_coherent(&ha->pcidev->dev, in ips_allocatescbs()
4316 IPS_SGLIST_SIZE(ha) * IPS_MAX_SG * ha->max_cmds, in ips_allocatescbs()
4319 dma_free_coherent(&ha->pcidev->dev, in ips_allocatescbs()
4320 ha->max_cmds * sizeof (ips_scb_t), ha->scbs, in ips_allocatescbs()
4325 memset(ha->scbs, 0, ha->max_cmds * sizeof (ips_scb_t)); in ips_allocatescbs()
4327 for (i = 0; i < ha->max_cmds; i++) { in ips_allocatescbs()
4328 scb_p = &ha->scbs[i]; in ips_allocatescbs()
4329 scb_p->scb_busaddr = command_dma + sizeof (ips_scb_t) * i; in ips_allocatescbs()
4332 scb_p->sg_list.enh_list = in ips_allocatescbs()
4334 scb_p->sg_busaddr = in ips_allocatescbs()
4337 scb_p->sg_list.std_list = in ips_allocatescbs()
4339 scb_p->sg_busaddr = in ips_allocatescbs()
4344 if (i < ha->max_cmds - 1) { in ips_allocatescbs()
4345 scb_p->q_next = ha->scb_freelist; in ips_allocatescbs()
4346 ha->scb_freelist = scb_p; in ips_allocatescbs()
4373 sg_list.list = scb->sg_list.list; in ips_init_scb()
4374 cmd_busaddr = scb->scb_busaddr; in ips_init_scb()
4375 sg_busaddr = scb->sg_busaddr; in ips_init_scb()
4378 memset(ha->dummy, 0, sizeof (IPS_IO_CMD)); in ips_init_scb()
4381 ha->dummy->op_code = 0xFF; in ips_init_scb()
4382 ha->dummy->ccsar = cpu_to_le32(ha->adapt->hw_status_start in ips_init_scb()
4384 ha->dummy->command_id = IPS_MAX_CMDS; in ips_init_scb()
4387 scb->scb_busaddr = cmd_busaddr; in ips_init_scb()
4388 scb->sg_busaddr = sg_busaddr; in ips_init_scb()
4389 scb->sg_list.list = sg_list.list; in ips_init_scb()
4392 scb->cmd.basic_io.cccr = cpu_to_le32((uint32_t) IPS_BIT_ILE); in ips_init_scb()
4393 scb->cmd.basic_io.ccsar = cpu_to_le32(ha->adapt->hw_status_start in ips_init_scb()
4415 if ((scb = ha->scb_freelist) == NULL) { in ips_getscb()
4420 ha->scb_freelist = scb->q_next; in ips_getscb()
4421 scb->flags = 0; in ips_getscb()
4422 scb->q_next = NULL; in ips_getscb()
4445 if (scb->flags & IPS_SCB_MAP_SG) in ips_freescb()
4446 scsi_dma_unmap(scb->scsi_cmd); in ips_freescb()
4447 else if (scb->flags & IPS_SCB_MAP_SINGLE) in ips_freescb()
4448 dma_unmap_single(&ha->pcidev->dev, scb->data_busaddr, in ips_freescb()
4449 scb->data_len, IPS_DMA_DIR(scb)); in ips_freescb()
4452 if (IPS_COMMAND_ID(ha, scb) < (ha->max_cmds - 1)) { in ips_freescb()
4453 scb->q_next = ha->scb_freelist; in ips_freescb()
4454 ha->scb_freelist = scb; in ips_freescb()
4475 isr = inb(ha->io_addr + IPS_REG_HISR); in ips_isinit_copperhead()
4476 scpr = inb(ha->io_addr + IPS_REG_SCPR); in ips_isinit_copperhead()
4501 isr = readb(ha->mem_ptr + IPS_REG_HISR); in ips_isinit_copperhead_memio()
4502 scpr = readb(ha->mem_ptr + IPS_REG_SCPR); in ips_isinit_copperhead_memio()
4530 post = readl(ha->mem_ptr + IPS_REG_I960_MSG0); in ips_isinit_morpheus()
4531 bits = readl(ha->mem_ptr + IPS_REG_I2O_HIR); in ips_isinit_morpheus()
4561 scb = dma_alloc_coherent(&ha->pcidev->dev, sizeof(ips_scb_t), in ips_flush_and_reset()
4566 scb->scb_busaddr = command_dma; in ips_flush_and_reset()
4568 scb->timeout = ips_cmd_timeout; in ips_flush_and_reset()
4569 scb->cdb[0] = IPS_CMD_FLUSH; in ips_flush_and_reset()
4571 scb->cmd.flush_cache.op_code = IPS_CMD_FLUSH; in ips_flush_and_reset()
4572 … scb->cmd.flush_cache.command_id = IPS_MAX_CMDS; /* Use an ID that would otherwise not exist */ in ips_flush_and_reset()
4573 scb->cmd.flush_cache.state = IPS_NORM_STATE; in ips_flush_and_reset()
4574 scb->cmd.flush_cache.reserved = 0; in ips_flush_and_reset()
4575 scb->cmd.flush_cache.reserved2 = 0; in ips_flush_and_reset()
4576 scb->cmd.flush_cache.reserved3 = 0; in ips_flush_and_reset()
4577 scb->cmd.flush_cache.reserved4 = 0; in ips_flush_and_reset()
4587 /* This may look evil, but it's only done during extremely rare start-up conditions ! */ in ips_flush_and_reset()
4589 time--; in ips_flush_and_reset()
4595 (*ha->func.reset) (ha); in ips_flush_and_reset()
4597 dma_free_coherent(&ha->pcidev->dev, sizeof(ips_scb_t), scb, command_dma); in ips_flush_and_reset()
4617 cstatus.value = (*ha->func.statupd) (ha); in ips_poll_for_flush_complete()
4643 outb(ha->io_addr + IPS_REG_HISR, IPS_BIT_EI); in ips_enable_int_copperhead()
4644 inb(ha->io_addr + IPS_REG_HISR); /*Ensure PCI Posting Completes*/ in ips_enable_int_copperhead()
4660 writeb(IPS_BIT_EI, ha->mem_ptr + IPS_REG_HISR); in ips_enable_int_copperhead_memio()
4661 readb(ha->mem_ptr + IPS_REG_HISR); /*Ensure PCI Posting Completes*/ in ips_enable_int_copperhead_memio()
4679 Oimr = readl(ha->mem_ptr + IPS_REG_I960_OIMR); in ips_enable_int_morpheus()
4681 writel(Oimr, ha->mem_ptr + IPS_REG_I960_OIMR); in ips_enable_int_morpheus()
4682 readl(ha->mem_ptr + IPS_REG_I960_OIMR); /*Ensure PCI Posting Completes*/ in ips_enable_int_morpheus()
4706 Isr = inb(ha->io_addr + IPS_REG_HISR); in ips_init_copperhead()
4718 PostByte[i] = inb(ha->io_addr + IPS_REG_ISPR); in ips_init_copperhead()
4719 outb(Isr, ha->io_addr + IPS_REG_HISR); in ips_init_copperhead()
4723 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_copperhead()
4724 "reset controller fails (post status %x %x).\n", in ips_init_copperhead()
4732 Isr = inb(ha->io_addr + IPS_REG_HISR); in ips_init_copperhead()
4744 inb(ha->io_addr + IPS_REG_ISPR); in ips_init_copperhead()
4745 outb(Isr, ha->io_addr + IPS_REG_HISR); in ips_init_copperhead()
4749 Cbsp = inb(ha->io_addr + IPS_REG_CBSP); in ips_init_copperhead()
4763 outl(0x1010, ha->io_addr + IPS_REG_CCCR); in ips_init_copperhead()
4766 outb(IPS_BIT_EBM, ha->io_addr + IPS_REG_SCPR); in ips_init_copperhead()
4768 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_init_copperhead()
4770 outl(0, ha->io_addr + IPS_REG_NDAE); in ips_init_copperhead()
4773 outb(IPS_BIT_EI, ha->io_addr + IPS_REG_HISR); in ips_init_copperhead()
4799 Isr = readb(ha->mem_ptr + IPS_REG_HISR); in ips_init_copperhead_memio()
4811 PostByte[i] = readb(ha->mem_ptr + IPS_REG_ISPR); in ips_init_copperhead_memio()
4812 writeb(Isr, ha->mem_ptr + IPS_REG_HISR); in ips_init_copperhead_memio()
4816 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_copperhead_memio()
4817 "reset controller fails (post status %x %x).\n", in ips_init_copperhead_memio()
4825 Isr = readb(ha->mem_ptr + IPS_REG_HISR); in ips_init_copperhead_memio()
4837 readb(ha->mem_ptr + IPS_REG_ISPR); in ips_init_copperhead_memio()
4838 writeb(Isr, ha->mem_ptr + IPS_REG_HISR); in ips_init_copperhead_memio()
4842 Cbsp = readb(ha->mem_ptr + IPS_REG_CBSP); in ips_init_copperhead_memio()
4856 writel(0x1010, ha->mem_ptr + IPS_REG_CCCR); in ips_init_copperhead_memio()
4859 writeb(IPS_BIT_EBM, ha->mem_ptr + IPS_REG_SCPR); in ips_init_copperhead_memio()
4861 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_init_copperhead_memio()
4863 writel(0, ha->mem_ptr + IPS_REG_NDAE); in ips_init_copperhead_memio()
4866 writeb(IPS_BIT_EI, ha->mem_ptr + IPS_REG_HISR); in ips_init_copperhead_memio()
4894 Isr = readl(ha->mem_ptr + IPS_REG_I2O_HIR); in ips_init_morpheus()
4905 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_morpheus()
4911 Post = readl(ha->mem_ptr + IPS_REG_I960_MSG0); in ips_init_morpheus()
4914 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_morpheus()
4919 writel(Isr, ha->mem_ptr + IPS_REG_I2O_HIR); in ips_init_morpheus()
4922 Post = readl(ha->mem_ptr + IPS_REG_I960_MSG0); in ips_init_morpheus()
4930 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_morpheus()
4939 writel(Isr, ha->mem_ptr + IPS_REG_I2O_HIR); in ips_init_morpheus()
4942 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_morpheus()
4943 "reset controller fails (post status %x).\n", Post); in ips_init_morpheus()
4950 Isr = readl(ha->mem_ptr + IPS_REG_I2O_HIR); in ips_init_morpheus()
4961 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_morpheus()
4967 Config = readl(ha->mem_ptr + IPS_REG_I960_MSG1); in ips_init_morpheus()
4971 writel(Isr, ha->mem_ptr + IPS_REG_I2O_HIR); in ips_init_morpheus()
4974 Oimr = readl(ha->mem_ptr + IPS_REG_I960_OIMR); in ips_init_morpheus()
4976 writel(Oimr, ha->mem_ptr + IPS_REG_I960_OIMR); in ips_init_morpheus()
4983 ha->requires_esl = 1; in ips_init_morpheus()
5006 ips_name, ha->host_num, ha->io_addr, ha->pcidev->irq); in ips_reset_copperhead()
5013 outb(IPS_BIT_RST, ha->io_addr + IPS_REG_SCPR); in ips_reset_copperhead()
5018 outb(0, ha->io_addr + IPS_REG_SCPR); in ips_reset_copperhead()
5023 if ((*ha->func.init) (ha)) in ips_reset_copperhead()
5051 ips_name, ha->host_num, ha->mem_addr, ha->pcidev->irq); in ips_reset_copperhead_memio()
5058 writeb(IPS_BIT_RST, ha->mem_ptr + IPS_REG_SCPR); in ips_reset_copperhead_memio()
5063 writeb(0, ha->mem_ptr + IPS_REG_SCPR); in ips_reset_copperhead_memio()
5068 if ((*ha->func.init) (ha)) in ips_reset_copperhead_memio()
5097 ips_name, ha->host_num, ha->mem_addr, ha->pcidev->irq); in ips_reset_morpheus()
5104 writel(0x80000000, ha->mem_ptr + IPS_REG_I960_IDR); in ips_reset_morpheus()
5110 pci_read_config_byte(ha->pcidev, 4, &junk); in ips_reset_morpheus()
5112 if ((*ha->func.init) (ha)) in ips_reset_morpheus()
5139 ha->adapt->p_status_start = ha->adapt->status; in ips_statinit()
5140 ha->adapt->p_status_end = ha->adapt->status + IPS_MAX_CMDS; in ips_statinit()
5141 ha->adapt->p_status_tail = ha->adapt->status; in ips_statinit()
5143 phys_status_start = ha->adapt->hw_status_start; in ips_statinit()
5144 outl(phys_status_start, ha->io_addr + IPS_REG_SQSR); in ips_statinit()
5146 ha->io_addr + IPS_REG_SQER); in ips_statinit()
5148 ha->io_addr + IPS_REG_SQHR); in ips_statinit()
5149 outl(phys_status_start, ha->io_addr + IPS_REG_SQTR); in ips_statinit()
5151 ha->adapt->hw_status_tail = phys_status_start; in ips_statinit()
5170 ha->adapt->p_status_start = ha->adapt->status; in ips_statinit_memio()
5171 ha->adapt->p_status_end = ha->adapt->status + IPS_MAX_CMDS; in ips_statinit_memio()
5172 ha->adapt->p_status_tail = ha->adapt->status; in ips_statinit_memio()
5174 phys_status_start = ha->adapt->hw_status_start; in ips_statinit_memio()
5175 writel(phys_status_start, ha->mem_ptr + IPS_REG_SQSR); in ips_statinit_memio()
5177 ha->mem_ptr + IPS_REG_SQER); in ips_statinit_memio()
5178 writel(phys_status_start + IPS_STATUS_SIZE, ha->mem_ptr + IPS_REG_SQHR); in ips_statinit_memio()
5179 writel(phys_status_start, ha->mem_ptr + IPS_REG_SQTR); in ips_statinit_memio()
5181 ha->adapt->hw_status_tail = phys_status_start; in ips_statinit_memio()
5198 if (ha->adapt->p_status_tail != ha->adapt->p_status_end) { in ips_statupd_copperhead()
5199 ha->adapt->p_status_tail++; in ips_statupd_copperhead()
5200 ha->adapt->hw_status_tail += sizeof (IPS_STATUS); in ips_statupd_copperhead()
5202 ha->adapt->p_status_tail = ha->adapt->p_status_start; in ips_statupd_copperhead()
5203 ha->adapt->hw_status_tail = ha->adapt->hw_status_start; in ips_statupd_copperhead()
5206 outl(ha->adapt->hw_status_tail, in ips_statupd_copperhead()
5207 ha->io_addr + IPS_REG_SQTR); in ips_statupd_copperhead()
5209 return (ha->adapt->p_status_tail->value); in ips_statupd_copperhead()
5226 if (ha->adapt->p_status_tail != ha->adapt->p_status_end) { in ips_statupd_copperhead_memio()
5227 ha->adapt->p_status_tail++; in ips_statupd_copperhead_memio()
5228 ha->adapt->hw_status_tail += sizeof (IPS_STATUS); in ips_statupd_copperhead_memio()
5230 ha->adapt->p_status_tail = ha->adapt->p_status_start; in ips_statupd_copperhead_memio()
5231 ha->adapt->hw_status_tail = ha->adapt->hw_status_start; in ips_statupd_copperhead_memio()
5234 writel(ha->adapt->hw_status_tail, ha->mem_ptr + IPS_REG_SQTR); in ips_statupd_copperhead_memio()
5236 return (ha->adapt->p_status_tail->value); in ips_statupd_copperhead_memio()
5255 val = readl(ha->mem_ptr + IPS_REG_I2O_OUTMSGQ); in ips_statupd_morpheus()
5277 if (scb->scsi_cmd) { in ips_issue_copperhead()
5280 ha->host_num, in ips_issue_copperhead()
5281 scb->cdb[0], in ips_issue_copperhead()
5282 scb->cmd.basic_io.command_id, in ips_issue_copperhead()
5283 scb->bus, scb->target_id, scb->lun); in ips_issue_copperhead()
5286 ips_name, ha->host_num, scb->cmd.basic_io.command_id); in ips_issue_copperhead()
5292 le32_to_cpu(inl(ha->io_addr + IPS_REG_CCCR))) & IPS_BIT_SEM) { in ips_issue_copperhead()
5299 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_issue_copperhead()
5301 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_issue_copperhead()
5308 outl(scb->scb_busaddr, ha->io_addr + IPS_REG_CCSAR); in ips_issue_copperhead()
5309 outw(IPS_BIT_START_CMD, ha->io_addr + IPS_REG_CCCR); in ips_issue_copperhead()
5331 if (scb->scsi_cmd) { in ips_issue_copperhead_memio()
5334 ha->host_num, in ips_issue_copperhead_memio()
5335 scb->cdb[0], in ips_issue_copperhead_memio()
5336 scb->cmd.basic_io.command_id, in ips_issue_copperhead_memio()
5337 scb->bus, scb->target_id, scb->lun); in ips_issue_copperhead_memio()
5340 ips_name, ha->host_num, scb->cmd.basic_io.command_id); in ips_issue_copperhead_memio()
5345 while ((val = readl(ha->mem_ptr + IPS_REG_CCCR)) & IPS_BIT_SEM) { in ips_issue_copperhead_memio()
5352 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_issue_copperhead_memio()
5354 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_issue_copperhead_memio()
5361 writel(scb->scb_busaddr, ha->mem_ptr + IPS_REG_CCSAR); in ips_issue_copperhead_memio()
5362 writel(IPS_BIT_START_CMD, ha->mem_ptr + IPS_REG_CCCR); in ips_issue_copperhead_memio()
5382 if (scb->scsi_cmd) { in ips_issue_i2o()
5385 ha->host_num, in ips_issue_i2o()
5386 scb->cdb[0], in ips_issue_i2o()
5387 scb->cmd.basic_io.command_id, in ips_issue_i2o()
5388 scb->bus, scb->target_id, scb->lun); in ips_issue_i2o()
5391 ips_name, ha->host_num, scb->cmd.basic_io.command_id); in ips_issue_i2o()
5394 outl(scb->scb_busaddr, ha->io_addr + IPS_REG_I2O_INMSGQ); in ips_issue_i2o()
5414 if (scb->scsi_cmd) { in ips_issue_i2o_memio()
5417 ha->host_num, in ips_issue_i2o_memio()
5418 scb->cdb[0], in ips_issue_i2o_memio()
5419 scb->cmd.basic_io.command_id, in ips_issue_i2o_memio()
5420 scb->bus, scb->target_id, scb->lun); in ips_issue_i2o_memio()
5423 ips_name, ha->host_num, scb->cmd.basic_io.command_id); in ips_issue_i2o_memio()
5426 writel(scb->scb_busaddr, ha->mem_ptr + IPS_REG_I2O_INMSGQ); in ips_issue_i2o_memio()
5437 /* Test to see if an interrupt is for us */
5447 Isr = inb(ha->io_addr + IPS_REG_HISR); in ips_isintr_copperhead()
5458 outb(Isr, ha->io_addr + IPS_REG_HISR); in ips_isintr_copperhead()
5470 /* Test to see if an interrupt is for us */
5480 Isr = readb(ha->mem_ptr + IPS_REG_HISR); in ips_isintr_copperhead_memio()
5491 writeb(Isr, ha->mem_ptr + IPS_REG_HISR); in ips_isintr_copperhead_memio()
5503 /* Test to see if an interrupt is for us */
5513 Isr = readl(ha->mem_ptr + IPS_REG_I2O_HIR); in ips_isintr_morpheus()
5545 if (ha->waitflag == FALSE) { in ips_wait()
5551 if (ha->waitflag == FALSE) { in ips_wait()
5568 (*ha->func.intr) (ha); in ips_wait()
5571 /* This looks like a very evil loop, but it only does this during start-up */ in ips_wait()
5573 time--; in ips_wait()
5594 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_write_driver_status()
5602 if (le32_to_cpu(ha->nvram->signature) != IPS_NVRAM_P5_SIG) { in ips_write_driver_status()
5605 ips_name, ha->host_num, ha->nvram->signature); in ips_write_driver_status()
5606 ha->nvram->signature = IPS_NVRAM_P5_SIG; in ips_write_driver_status()
5611 ips_name, ha->host_num, le16_to_cpu(ha->nvram->adapter_type), in ips_write_driver_status()
5612 ha->nvram->adapter_slot, ha->nvram->bios_high[0], in ips_write_driver_status()
5613 ha->nvram->bios_high[1], ha->nvram->bios_high[2], in ips_write_driver_status()
5614 ha->nvram->bios_high[3], ha->nvram->bios_low[0], in ips_write_driver_status()
5615 ha->nvram->bios_low[1], ha->nvram->bios_low[2], in ips_write_driver_status()
5616 ha->nvram->bios_low[3]); in ips_write_driver_status()
5621 ha->nvram->operating_system = IPS_OS_LINUX; in ips_write_driver_status()
5622 ha->nvram->adapter_type = ha->ad_type; in ips_write_driver_status()
5623 memcpy((char *) ha->nvram->driver_high, IPS_VERSION_HIGH, 4); in ips_write_driver_status()
5624 memcpy((char *) ha->nvram->driver_low, IPS_VERSION_LOW, 4); in ips_write_driver_status()
5625 memcpy((char *) ha->nvram->bios_high, ha->bios_version, 4); in ips_write_driver_status()
5626 memcpy((char *) ha->nvram->bios_low, ha->bios_version + 4, 4); in ips_write_driver_status()
5628 ha->nvram->versioning = 0; /* Indicate the Driver Does Not Support Versioning */ in ips_write_driver_status()
5632 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_write_driver_status()
5639 ha->slot_num = ha->nvram->adapter_slot; in ips_write_driver_status()
5661 scb = &ha->scbs[ha->max_cmds - 1]; in ips_read_adapter_status()
5665 scb->timeout = ips_cmd_timeout; in ips_read_adapter_status()
5666 scb->cdb[0] = IPS_CMD_ENQUIRY; in ips_read_adapter_status()
5668 scb->cmd.basic_io.op_code = IPS_CMD_ENQUIRY; in ips_read_adapter_status()
5669 scb->cmd.basic_io.command_id = IPS_COMMAND_ID(ha, scb); in ips_read_adapter_status()
5670 scb->cmd.basic_io.sg_count = 0; in ips_read_adapter_status()
5671 scb->cmd.basic_io.lba = 0; in ips_read_adapter_status()
5672 scb->cmd.basic_io.sector_count = 0; in ips_read_adapter_status()
5673 scb->cmd.basic_io.log_drv = 0; in ips_read_adapter_status()
5674 scb->data_len = sizeof (*ha->enq); in ips_read_adapter_status()
5675 scb->cmd.basic_io.sg_addr = ha->enq_busaddr; in ips_read_adapter_status()
5681 || ((scb->basic_status & IPS_GSC_STATUS_MASK) > 1)) in ips_read_adapter_status()
5704 scb = &ha->scbs[ha->max_cmds - 1]; in ips_read_subsystem_parameters()
5708 scb->timeout = ips_cmd_timeout; in ips_read_subsystem_parameters()
5709 scb->cdb[0] = IPS_CMD_GET_SUBSYS; in ips_read_subsystem_parameters()
5711 scb->cmd.basic_io.op_code = IPS_CMD_GET_SUBSYS; in ips_read_subsystem_parameters()
5712 scb->cmd.basic_io.command_id = IPS_COMMAND_ID(ha, scb); in ips_read_subsystem_parameters()
5713 scb->cmd.basic_io.sg_count = 0; in ips_read_subsystem_parameters()
5714 scb->cmd.basic_io.lba = 0; in ips_read_subsystem_parameters()
5715 scb->cmd.basic_io.sector_count = 0; in ips_read_subsystem_parameters()
5716 scb->cmd.basic_io.log_drv = 0; in ips_read_subsystem_parameters()
5717 scb->data_len = sizeof (*ha->subsys); in ips_read_subsystem_parameters()
5718 scb->cmd.basic_io.sg_addr = ha->ioctl_busaddr; in ips_read_subsystem_parameters()
5724 || ((scb->basic_status & IPS_GSC_STATUS_MASK) > 1)) in ips_read_subsystem_parameters()
5727 memcpy(ha->subsys, ha->ioctl_data, sizeof(*ha->subsys)); in ips_read_subsystem_parameters()
5751 ha->conf->init_id[i] = 7; in ips_read_config()
5753 scb = &ha->scbs[ha->max_cmds - 1]; in ips_read_config()
5757 scb->timeout = ips_cmd_timeout; in ips_read_config()
5758 scb->cdb[0] = IPS_CMD_READ_CONF; in ips_read_config()
5760 scb->cmd.basic_io.op_code = IPS_CMD_READ_CONF; in ips_read_config()
5761 scb->cmd.basic_io.command_id = IPS_COMMAND_ID(ha, scb); in ips_read_config()
5762 scb->data_len = sizeof (*ha->conf); in ips_read_config()
5763 scb->cmd.basic_io.sg_addr = ha->ioctl_busaddr; in ips_read_config()
5769 || ((scb->basic_status & IPS_GSC_STATUS_MASK) > 1)) { in ips_read_config()
5771 memset(ha->conf, 0, sizeof (IPS_CONF)); in ips_read_config()
5775 ha->conf->init_id[i] = 7; in ips_read_config()
5778 if ((scb->basic_status & IPS_GSC_STATUS_MASK) == in ips_read_config()
5785 memcpy(ha->conf, ha->ioctl_data, sizeof(*ha->conf)); in ips_read_config()
5806 scb = &ha->scbs[ha->max_cmds - 1]; in ips_readwrite_page5()
5810 scb->timeout = ips_cmd_timeout; in ips_readwrite_page5()
5811 scb->cdb[0] = IPS_CMD_RW_NVRAM_PAGE; in ips_readwrite_page5()
5813 scb->cmd.nvram.op_code = IPS_CMD_RW_NVRAM_PAGE; in ips_readwrite_page5()
5814 scb->cmd.nvram.command_id = IPS_COMMAND_ID(ha, scb); in ips_readwrite_page5()
5815 scb->cmd.nvram.page = 5; in ips_readwrite_page5()
5816 scb->cmd.nvram.write = write; in ips_readwrite_page5()
5817 scb->cmd.nvram.reserved = 0; in ips_readwrite_page5()
5818 scb->cmd.nvram.reserved2 = 0; in ips_readwrite_page5()
5819 scb->data_len = sizeof (*ha->nvram); in ips_readwrite_page5()
5820 scb->cmd.nvram.buffer_addr = ha->ioctl_busaddr; in ips_readwrite_page5()
5822 memcpy(ha->ioctl_data, ha->nvram, sizeof(*ha->nvram)); in ips_readwrite_page5()
5828 || ((scb->basic_status & IPS_GSC_STATUS_MASK) > 1)) { in ips_readwrite_page5()
5830 memset(ha->nvram, 0, sizeof (IPS_NVRAM_P5)); in ips_readwrite_page5()
5835 memcpy(ha->nvram, ha->ioctl_data, sizeof(*ha->nvram)); in ips_readwrite_page5()
5856 scb = &ha->scbs[ha->max_cmds - 1]; in ips_clear_adapter()
5860 scb->timeout = ips_reset_timeout; in ips_clear_adapter()
5861 scb->cdb[0] = IPS_CMD_CONFIG_SYNC; in ips_clear_adapter()
5863 scb->cmd.config_sync.op_code = IPS_CMD_CONFIG_SYNC; in ips_clear_adapter()
5864 scb->cmd.config_sync.command_id = IPS_COMMAND_ID(ha, scb); in ips_clear_adapter()
5865 scb->cmd.config_sync.channel = 0; in ips_clear_adapter()
5866 scb->cmd.config_sync.source_target = IPS_POCL; in ips_clear_adapter()
5867 scb->cmd.config_sync.reserved = 0; in ips_clear_adapter()
5868 scb->cmd.config_sync.reserved2 = 0; in ips_clear_adapter()
5869 scb->cmd.config_sync.reserved3 = 0; in ips_clear_adapter()
5875 || ((scb->basic_status & IPS_GSC_STATUS_MASK) > 1)) in ips_clear_adapter()
5881 scb->cdb[0] = IPS_CMD_ERROR_TABLE; in ips_clear_adapter()
5882 scb->timeout = ips_reset_timeout; in ips_clear_adapter()
5884 scb->cmd.unlock_stripe.op_code = IPS_CMD_ERROR_TABLE; in ips_clear_adapter()
5885 scb->cmd.unlock_stripe.command_id = IPS_COMMAND_ID(ha, scb); in ips_clear_adapter()
5886 scb->cmd.unlock_stripe.log_drv = 0; in ips_clear_adapter()
5887 scb->cmd.unlock_stripe.control = IPS_CSL; in ips_clear_adapter()
5888 scb->cmd.unlock_stripe.reserved = 0; in ips_clear_adapter()
5889 scb->cmd.unlock_stripe.reserved2 = 0; in ips_clear_adapter()
5890 scb->cmd.unlock_stripe.reserved3 = 0; in ips_clear_adapter()
5896 || ((scb->basic_status & IPS_GSC_STATUS_MASK) > 1)) in ips_clear_adapter()
5918 scb = &ha->scbs[ha->max_cmds - 1]; in ips_ffdc_reset()
5922 scb->timeout = ips_cmd_timeout; in ips_ffdc_reset()
5923 scb->cdb[0] = IPS_CMD_FFDC; in ips_ffdc_reset()
5924 scb->cmd.ffdc.op_code = IPS_CMD_FFDC; in ips_ffdc_reset()
5925 scb->cmd.ffdc.command_id = IPS_COMMAND_ID(ha, scb); in ips_ffdc_reset()
5926 scb->cmd.ffdc.reset_count = ha->reset_count; in ips_ffdc_reset()
5927 scb->cmd.ffdc.reset_type = 0x80; in ips_ffdc_reset()
5930 ips_fix_ffdc_time(ha, scb, ha->last_ffdc); in ips_ffdc_reset()
5952 DEBUG_VAR(1, "(%s%d) Sending time update.", ips_name, ha->host_num); in ips_ffdc_time()
5954 scb = &ha->scbs[ha->max_cmds - 1]; in ips_ffdc_time()
5958 scb->timeout = ips_cmd_timeout; in ips_ffdc_time()
5959 scb->cdb[0] = IPS_CMD_FFDC; in ips_ffdc_time()
5960 scb->cmd.ffdc.op_code = IPS_CMD_FFDC; in ips_ffdc_time()
5961 scb->cmd.ffdc.command_id = IPS_COMMAND_ID(ha, scb); in ips_ffdc_time()
5962 scb->cmd.ffdc.reset_count = 0; in ips_ffdc_time()
5963 scb->cmd.ffdc.reset_type = 0; in ips_ffdc_time()
5966 ips_fix_ffdc_time(ha, scb, ha->last_ffdc); in ips_ffdc_time()
5989 scb->cmd.ffdc.hour = tm.tm_hour; in ips_fix_ffdc_time()
5990 scb->cmd.ffdc.minute = tm.tm_min; in ips_fix_ffdc_time()
5991 scb->cmd.ffdc.second = tm.tm_sec; in ips_fix_ffdc_time()
5992 scb->cmd.ffdc.yearH = (tm.tm_year + 1900) / 100; in ips_fix_ffdc_time()
5993 scb->cmd.ffdc.yearL = tm.tm_year % 100; in ips_fix_ffdc_time()
5994 scb->cmd.ffdc.month = tm.tm_mon + 1; in ips_fix_ffdc_time()
5995 scb->cmd.ffdc.day = tm.tm_mday; in ips_fix_ffdc_time()
6021 outl(0, ha->io_addr + IPS_REG_FLAP); in ips_erase_bios()
6022 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios()
6025 outb(0x50, ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6026 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios()
6030 outb(0x20, ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6031 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios()
6035 outb(0xD0, ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6036 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios()
6040 outb(0x70, ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6041 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios()
6047 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) { in ips_erase_bios()
6048 outl(0, ha->io_addr + IPS_REG_FLAP); in ips_erase_bios()
6052 status = inb(ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6058 timeout--; in ips_erase_bios()
6066 outb(0xB0, ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6067 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios()
6073 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) { in ips_erase_bios()
6074 outl(0, ha->io_addr + IPS_REG_FLAP); in ips_erase_bios()
6078 status = inb(ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6084 timeout--; in ips_erase_bios()
6102 outb(0x50, ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6103 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios()
6107 outb(0xFF, ha->io_addr + IPS_REG_FLDP); in ips_erase_bios()
6108 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios()
6133 writel(0, ha->mem_ptr + IPS_REG_FLAP); in ips_erase_bios_memio()
6134 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios_memio()
6137 writeb(0x50, ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6138 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios_memio()
6142 writeb(0x20, ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6143 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios_memio()
6147 writeb(0xD0, ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6148 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios_memio()
6152 writeb(0x70, ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6153 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios_memio()
6159 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) { in ips_erase_bios_memio()
6160 writel(0, ha->mem_ptr + IPS_REG_FLAP); in ips_erase_bios_memio()
6164 status = readb(ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6170 timeout--; in ips_erase_bios_memio()
6178 writeb(0xB0, ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6179 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios_memio()
6185 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) { in ips_erase_bios_memio()
6186 writel(0, ha->mem_ptr + IPS_REG_FLAP); in ips_erase_bios_memio()
6190 status = readb(ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6196 timeout--; in ips_erase_bios_memio()
6214 writeb(0x50, ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6215 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios_memio()
6219 writeb(0xFF, ha->mem_ptr + IPS_REG_FLDP); in ips_erase_bios_memio()
6220 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_erase_bios_memio()
6248 outl(i + offset, ha->io_addr + IPS_REG_FLAP); in ips_program_bios()
6249 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios()
6252 outb(0x40, ha->io_addr + IPS_REG_FLDP); in ips_program_bios()
6253 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios()
6256 outb(buffer[i], ha->io_addr + IPS_REG_FLDP); in ips_program_bios()
6257 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios()
6263 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) { in ips_program_bios()
6264 outl(0, ha->io_addr + IPS_REG_FLAP); in ips_program_bios()
6268 status = inb(ha->io_addr + IPS_REG_FLDP); in ips_program_bios()
6274 timeout--; 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()
6293 outl(0, ha->io_addr + IPS_REG_FLAP); in ips_program_bios()
6294 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios()
6297 outb(0xFF, ha->io_addr + IPS_REG_FLDP); in ips_program_bios()
6298 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios()
6306 outl(0, ha->io_addr + IPS_REG_FLAP); in ips_program_bios()
6307 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios()
6310 outb(0xFF, ha->io_addr + IPS_REG_FLDP); in ips_program_bios()
6311 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios()
6339 writel(i + offset, ha->mem_ptr + IPS_REG_FLAP); in ips_program_bios_memio()
6340 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios_memio()
6343 writeb(0x40, ha->mem_ptr + IPS_REG_FLDP); in ips_program_bios_memio()
6344 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios_memio()
6347 writeb(buffer[i], ha->mem_ptr + IPS_REG_FLDP); in ips_program_bios_memio()
6348 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios_memio()
6354 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) { in ips_program_bios_memio()
6355 writel(0, ha->mem_ptr + IPS_REG_FLAP); in ips_program_bios_memio()
6359 status = readb(ha->mem_ptr + IPS_REG_FLDP); in ips_program_bios_memio()
6365 timeout--; 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()
6384 writel(0, ha->mem_ptr + IPS_REG_FLAP); in ips_program_bios_memio()
6385 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios_memio()
6388 writeb(0xFF, ha->mem_ptr + IPS_REG_FLDP); in ips_program_bios_memio()
6389 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios_memio()
6397 writel(0, ha->mem_ptr + IPS_REG_FLAP); in ips_program_bios_memio()
6398 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios_memio()
6401 writeb(0xFF, ha->mem_ptr + IPS_REG_FLDP); in ips_program_bios_memio()
6402 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_program_bios_memio()
6425 /* test 1st byte */ in ips_verify_bios()
6426 outl(0, ha->io_addr + IPS_REG_FLAP); in ips_verify_bios()
6427 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_verify_bios()
6430 if (inb(ha->io_addr + IPS_REG_FLDP) != 0x55) in ips_verify_bios()
6433 outl(1, ha->io_addr + IPS_REG_FLAP); in ips_verify_bios()
6434 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_verify_bios()
6436 if (inb(ha->io_addr + IPS_REG_FLDP) != 0xAA) in ips_verify_bios()
6442 outl(i + offset, ha->io_addr + IPS_REG_FLAP); in ips_verify_bios()
6443 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_verify_bios()
6446 checksum = (uint8_t) checksum + inb(ha->io_addr + IPS_REG_FLDP); in ips_verify_bios()
6474 /* test 1st byte */ in ips_verify_bios_memio()
6475 writel(0, ha->mem_ptr + IPS_REG_FLAP); in ips_verify_bios_memio()
6476 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_verify_bios_memio()
6479 if (readb(ha->mem_ptr + IPS_REG_FLDP) != 0x55) in ips_verify_bios_memio()
6482 writel(1, ha->mem_ptr + IPS_REG_FLAP); in ips_verify_bios_memio()
6483 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_verify_bios_memio()
6485 if (readb(ha->mem_ptr + IPS_REG_FLDP) != 0xAA) in ips_verify_bios_memio()
6491 writel(i + offset, ha->mem_ptr + IPS_REG_FLAP); in ips_verify_bios_memio()
6492 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) in ips_verify_bios_memio()
6496 (uint8_t) checksum + readb(ha->mem_ptr + IPS_REG_FLDP); in ips_verify_bios_memio()
6517 ha->active = 0; in ips_abort_init()
6521 return -1; in ips_abort_init()
6538 for (i = highindex; i > lowindex; i--) { in ips_shift_controllers()
6539 ips_ha[i] = ips_ha[i - 1]; in ips_shift_controllers()
6540 ips_sh[i] = ips_sh[i - 1]; in ips_shift_controllers()
6541 ips_ha[i]->host_num = i; in ips_shift_controllers()
6543 ha_sav->host_num = lowindex; in ips_shift_controllers()
6562 nvram = ips_ha[0]->nvram; in ips_order_controllers()
6564 if (nvram->adapter_order[0]) { in ips_order_controllers()
6565 for (i = 1; i <= nvram->adapter_order[0]; i++) { in ips_order_controllers()
6567 switch (ips_ha[j]->ad_type) { in ips_order_controllers()
6570 if (nvram->adapter_order[i] == 'M') { in ips_order_controllers()
6580 if (nvram->adapter_order[i] == 'N') { in ips_order_controllers()
6590 if (nvram->adapter_order[i] == 'S') { in ips_order_controllers()
6603 if (nvram->adapter_order[i] == 'A') { in ips_order_controllers()
6620 if (ips_ha[i]->ad_type == IPS_ADTYPE_SERVERAID5I2 || in ips_order_controllers()
6621 ips_ha[i]->ad_type == IPS_ADTYPE_SERVERAID5I1) { in ips_order_controllers()
6631 if (ips_ha[i]->ad_type == IPS_ADTYPE_SERVERAID4L || in ips_order_controllers()
6632 ips_ha[i]->ad_type == IPS_ADTYPE_SERVERAID4M || in ips_order_controllers()
6633 ips_ha[i]->ad_type == IPS_ADTYPE_SERVERAID4LX || in ips_order_controllers()
6634 ips_ha[i]->ad_type == IPS_ADTYPE_SERVERAID4MX) { in ips_order_controllers()
6657 IPS_PRINTK(KERN_WARNING, oldha->pcidev, in ips_register_scsi()
6659 return -1; in ips_register_scsi()
6663 free_irq(oldha->pcidev->irq, oldha); in ips_register_scsi()
6665 if (request_irq(ha->pcidev->irq, do_ipsintr, IRQF_SHARED, ips_name, ha)) { in ips_register_scsi()
6666 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_register_scsi()
6674 sh->unique_id = (ha->io_addr) ? ha->io_addr : ha->mem_addr; in ips_register_scsi()
6675 sh->sg_tablesize = sh->hostt->sg_tablesize; in ips_register_scsi()
6676 sh->can_queue = sh->hostt->can_queue; in ips_register_scsi()
6677 sh->cmd_per_lun = sh->hostt->cmd_per_lun; in ips_register_scsi()
6678 sh->max_sectors = 128; in ips_register_scsi()
6680 sh->max_id = ha->ntargets; in ips_register_scsi()
6681 sh->max_lun = ha->nlun; in ips_register_scsi()
6682 sh->max_channel = ha->nbus - 1; in ips_register_scsi()
6683 sh->can_queue = ha->max_cmds - 1; in ips_register_scsi()
6685 if (scsi_add_host(sh, &ha->pcidev->dev)) in ips_register_scsi()
6696 free_irq(ha->pcidev->irq, ha); in ips_register_scsi()
6699 return -1; in ips_register_scsi()
6702 /*---------------------------------------------------------------------------*/
6707 /*---------------------------------------------------------------------------*/
6737 return -ENODEV; in ips_module_init()
6742 return -ENODEV; in ips_module_init()
6765 /*---------------------------------------------------------------------------*/
6772 /* 0 if Successful, else non-zero */
6773 /*---------------------------------------------------------------------------*/
6777 int index = -1; in ips_insert_device()
6796 rc = -1; in ips_insert_device()
6805 rc = -ENODEV; in ips_insert_device()
6819 /*---------------------------------------------------------------------------*/
6826 /* 0 if Successful, else non-zero */
6827 /*---------------------------------------------------------------------------*/
6853 return -1; in ips_init_phase1()
6880 offs = mem_addr - base; in ips_init_phase1()
6883 return -1; in ips_init_phase1()
6895 return -1; in ips_init_phase1()
6900 ha->active = 1; in ips_init_phase1()
6903 ha->io_addr = io_addr; in ips_init_phase1()
6904 ha->io_len = io_len; in ips_init_phase1()
6905 ha->mem_addr = mem_addr; in ips_init_phase1()
6906 ha->mem_len = mem_len; in ips_init_phase1()
6907 ha->mem_ptr = mem_ptr; in ips_init_phase1()
6908 ha->ioremap_ptr = ioremap_ptr; in ips_init_phase1()
6909 ha->host_num = (uint32_t) index; in ips_init_phase1()
6910 ha->slot_num = PCI_SLOT(pci_dev->devfn); in ips_init_phase1()
6911 ha->pcidev = pci_dev; in ips_init_phase1()
6920 !dma_set_mask(&ha->pcidev->dev, DMA_BIT_MASK(64))) { in ips_init_phase1()
6921 (ha)->flags |= IPS_HA_ENH_SG; in ips_init_phase1()
6923 if (dma_set_mask(&ha->pcidev->dev, DMA_BIT_MASK(32)) != 0) { in ips_init_phase1()
6929 ips_FlashData = dma_alloc_coherent(&pci_dev->dev, in ips_init_phase1()
6933 ha->enq = dma_alloc_coherent(&pci_dev->dev, sizeof (IPS_ENQ), in ips_init_phase1()
6934 &ha->enq_busaddr, GFP_KERNEL); in ips_init_phase1()
6935 if (!ha->enq) { in ips_init_phase1()
6941 ha->adapt = dma_alloc_coherent(&pci_dev->dev, in ips_init_phase1()
6944 if (!ha->adapt) { in ips_init_phase1()
6949 ha->adapt->hw_status_start = dma_address; in ips_init_phase1()
6950 ha->dummy = (void *) (ha->adapt + 1); in ips_init_phase1()
6954 ha->logical_drive_info = dma_alloc_coherent(&pci_dev->dev, in ips_init_phase1()
6956 if (!ha->logical_drive_info) { in ips_init_phase1()
6961 ha->logical_drive_info_dma_addr = dma_address; in ips_init_phase1()
6964 ha->conf = kmalloc(sizeof (IPS_CONF), GFP_KERNEL); in ips_init_phase1()
6966 if (!ha->conf) { in ips_init_phase1()
6972 ha->nvram = kmalloc(sizeof (IPS_NVRAM_P5), GFP_KERNEL); in ips_init_phase1()
6974 if (!ha->nvram) { in ips_init_phase1()
6980 ha->subsys = kmalloc(sizeof (IPS_SUBSYS), GFP_KERNEL); in ips_init_phase1()
6982 if (!ha->subsys) { in ips_init_phase1()
6993 ha->ioctl_data = dma_alloc_coherent(&pci_dev->dev, ips_ioctlsize, in ips_init_phase1()
6994 &ha->ioctl_busaddr, GFP_KERNEL); in ips_init_phase1()
6995 ha->ioctl_len = ips_ioctlsize; in ips_init_phase1()
6996 if (!ha->ioctl_data) { in ips_init_phase1()
7009 IsDead = readl(ha->mem_ptr + IPS_REG_I960_MSG1); in ips_init_phase1()
7019 if (!(*ha->func.isinit) (ha)) { in ips_init_phase1()
7020 if (!(*ha->func.init) (ha)) { in ips_init_phase1()
7034 /*---------------------------------------------------------------------------*/
7041 /* 0 if Successful, else non-zero */
7042 /*---------------------------------------------------------------------------*/
7051 if (!ha->active) { in ips_init_phase2()
7053 return -1; in ips_init_phase2()
7057 if (request_irq(ha->pcidev->irq, do_ipsintr, IRQF_SHARED, ips_name, ha)) { in ips_init_phase2()
7058 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_phase2()
7066 ha->max_cmds = 1; in ips_init_phase2()
7068 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_phase2()
7070 free_irq(ha->pcidev->irq, ha); in ips_init_phase2()
7075 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_phase2()
7077 free_irq(ha->pcidev->irq, ha); in ips_init_phase2()
7085 IPS_PRINTK(KERN_WARNING, ha->pcidev, in ips_init_phase2()
7087 free_irq(ha->pcidev->irq, ha); in ips_init_phase2()
7104 * ---------------------------------------------------------------------------
7106 * c-indent-level: 2
7107 * c-brace-imaginary-offset: 0
7108 * c-brace-offset: -2
7109 * c-argdecl-indent: 2
7110 * c-label-offset: -2
7111 * c-continued-statement-offset: 2
7112 * c-continued-brace-offset: 0
7113 * indent-tabs-mode: nil
7114 * tab-width: 8