Lines Matching +full:full +full:- +full:hd

6  *  Copyright (c) 1999-2008 LSI Corporation
7 * (mailto:DL-MPTFusionLinux@lsi.com)
10 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
24 LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
43 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
45 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
70 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
80 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
95 static void mptscsih_copy_sense_data(struct scsi_cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR *mf, SC…
97 int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id,
108 static int mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *iocmd);
109 static void mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, VirtDevice *vdevice);
122 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
124 * mptscsih_getFreeChainBuffer - Function to get a free chain
140 ioc->name)); in mptscsih_getFreeChainBuffer()
141 spin_lock_irqsave(&ioc->FreeQlock, flags); in mptscsih_getFreeChainBuffer()
142 if (!list_empty(&ioc->FreeChainQ)) { in mptscsih_getFreeChainBuffer()
145 chainBuf = list_entry(ioc->FreeChainQ.next, MPT_FRAME_HDR, in mptscsih_getFreeChainBuffer()
147 list_del(&chainBuf->u.frame.linkage.list); in mptscsih_getFreeChainBuffer()
148 offset = (u8 *)chainBuf - (u8 *)ioc->ChainBuffer; in mptscsih_getFreeChainBuffer()
149 chain_idx = offset / ioc->req_sz; in mptscsih_getFreeChainBuffer()
153 ioc->name, chainBuf, ioc->ChainBuffer, offset, chain_idx)); in mptscsih_getFreeChainBuffer()
158 ioc->name)); in mptscsih_getFreeChainBuffer()
160 spin_unlock_irqrestore(&ioc->FreeQlock, flags); in mptscsih_getFreeChainBuffer()
166 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
168 * mptscsih_AddSGE - Add a SGE (plus chain buffers) to the
195 sgdir = le32_to_cpu(pReq->Control) & MPI_SCSIIO_CONTROL_DATADIRECTION_MASK; in mptscsih_AddSGE()
202 psge = (char *) &pReq->SGL; in mptscsih_AddSGE()
203 frm_sz = ioc->req_sz; in mptscsih_AddSGE()
216 sgeOffset = sizeof(SCSIIORequest_t) - sizeof(SGE_IO_UNION); in mptscsih_AddSGE()
219 /* Prior to entering this loop - the following must be set in mptscsih_AddSGE()
226 numSgeSlots = ((frm_sz - sgeOffset) / ioc->SGE_size); in mptscsih_AddSGE()
231 /* Get first (num - 1) SG elements in mptscsih_AddSGE()
235 for (ii=0; ii < (numSgeThisFrame-1); ii++) { in mptscsih_AddSGE()
245 ioc->add_sge(psge, sgflags | thisxfer, v2); in mptscsih_AddSGE()
249 psge += ioc->SGE_size; in mptscsih_AddSGE()
250 sgeOffset += ioc->SGE_size; in mptscsih_AddSGE()
262 * Note: Last SGE may have a length of 0 - which should be ok. in mptscsih_AddSGE()
267 ioc->add_sge(psge, sgflags | thisxfer, v2); in mptscsih_AddSGE()
268 sgeOffset += ioc->SGE_size; in mptscsih_AddSGE()
277 ioc->add_chain((char *)chainSge, 0, sgeOffset, in mptscsih_AddSGE()
278 ioc->ChainBufferDMA + chain_dma_off); in mptscsih_AddSGE()
283 pReq->ChainOffset = 0; in mptscsih_AddSGE()
284 RequestNB = (((sgeOffset - 1) >> ioc->NBShiftFactor) + 1) & 0x03; in mptscsih_AddSGE()
286 "Single Buffer RequestNB=%x, sgeOffset=%d\n", ioc->name, RequestNB, sgeOffset)); in mptscsih_AddSGE()
287 ioc->RequestNB[req_idx] = RequestNB; in mptscsih_AddSGE()
292 * - last SGE element, set the LastElement bit in mptscsih_AddSGE()
293 * - set ChainOffset (words) for orig MF in mptscsih_AddSGE()
295 * - update MFStructPtr ChainIndex in mptscsih_AddSGE()
296 * - Populate chain element in mptscsih_AddSGE()
302 ioc->name, sg_done)); in mptscsih_AddSGE()
304 /* Set LAST_ELEMENT flag for last non-chain element in mptscsih_AddSGE()
311 u32 *ptmp = (u32 *) (psge - ioc->SGE_size); in mptscsih_AddSGE()
325 sgeOffset += ioc->SGE_size; in mptscsih_AddSGE()
326 ioc->add_chain((char *)chainSge, nextChain, sgeOffset, in mptscsih_AddSGE()
327 ioc->ChainBufferDMA + chain_dma_off); in mptscsih_AddSGE()
329 /* The original MF buffer requires a chain buffer - in mptscsih_AddSGE()
333 pReq->ChainOffset = (u8) (sgeOffset >> 2); in mptscsih_AddSGE()
334 RequestNB = (((sgeOffset - 1) >> ioc->NBShiftFactor) + 1) & 0x03; in mptscsih_AddSGE()
335 …dsgprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Chain Buffer Needed, RequestNB=%x sgeOffset=%d\n", ioc->n… in mptscsih_AddSGE()
336 ioc->RequestNB[req_idx] = RequestNB; in mptscsih_AddSGE()
339 sges_left -= sg_done; in mptscsih_AddSGE()
348 ioc->name, pReq->CDB[0], SCpnt)); in mptscsih_AddSGE()
356 ioc->ChainToChain[chain_idx] = newIndex; in mptscsih_AddSGE()
358 ioc->ReqToChain[req_idx] = newIndex; in mptscsih_AddSGE()
361 chain_dma_off = ioc->req_sz * chain_idx; in mptscsih_AddSGE()
364 * - Set chain buffer pointer to psge and fill in mptscsih_AddSGE()
369 ioc->name, psge, req_idx)); in mptscsih_AddSGE()
373 psge = (char *) (ioc->ChainBuffer + chain_dma_off); in mptscsih_AddSGE()
378 ioc->name, psge, chain_idx)); in mptscsih_AddSGE()
396 if (ioc->bus_type != SAS) in mptscsih_issue_sep_command()
401 if (vtarget->tflags & MPT_TARGET_FLAGS_RAID_COMPONENT) in mptscsih_issue_sep_command()
404 if ((mf = mpt_get_msg_frame(ioc->InternalCtx, ioc)) == NULL) { in mptscsih_issue_sep_command()
406 ioc->name,__func__)); in mptscsih_issue_sep_command()
411 SEPMsg->Function = MPI_FUNCTION_SCSI_ENCLOSURE_PROCESSOR; in mptscsih_issue_sep_command()
412 SEPMsg->Bus = vtarget->channel; in mptscsih_issue_sep_command()
413 SEPMsg->TargetID = vtarget->id; in mptscsih_issue_sep_command()
414 SEPMsg->Action = MPI_SEP_REQ_ACTION_WRITE_STATUS; in mptscsih_issue_sep_command()
415 SEPMsg->SlotStatus = SlotStatus; in mptscsih_issue_sep_command()
418 ioc->name, SlotStatus, SEPMsg->Bus, SEPMsg->TargetID)); in mptscsih_issue_sep_command()
419 mpt_put_msg_frame(ioc->DoneCtx, ioc, mf); in mptscsih_issue_sep_command()
424 * mptscsih_info_scsiio - debug print info on reply frame
441 ioc_status = le16_to_cpu(pScsiReply->IOCStatus) & MPI_IOCSTATUS_MASK; in mptscsih_info_scsiio()
489 switch (pScsiReply->SCSIStatus) in mptscsih_info_scsiio()
517 desc1 = "task set full"; in mptscsih_info_scsiio()
538 ioc->name, pScsiReply->Bus, pScsiReply->TargetID, sc->device->lun); in mptscsih_info_scsiio()
540 "resid = %d\n", ioc->name, scsi_bufflen(sc), sc->underflow, in mptscsih_info_scsiio()
543 "sc->result = %08X\n", ioc->name, le16_to_cpu(pScsiReply->TaskTag), in mptscsih_info_scsiio()
544 le32_to_cpu(pScsiReply->TransferCount), sc->result); in mptscsih_info_scsiio()
548 ioc->name, desc, ioc_status, desc1, pScsiReply->SCSIStatus, in mptscsih_info_scsiio()
549 pScsiReply->SCSIState); in mptscsih_info_scsiio()
551 if (pScsiReply->SCSIState & MPI_SCSI_STATE_AUTOSENSE_VALID) { in mptscsih_info_scsiio()
552 skey = sc->sense_buffer[2] & 0x0F; in mptscsih_info_scsiio()
553 asc = sc->sense_buffer[12]; in mptscsih_info_scsiio()
554 ascq = sc->sense_buffer[13]; in mptscsih_info_scsiio()
557 "[0x%02x,0x%02x,0x%02x]\n", ioc->name, skey, asc, ascq); in mptscsih_info_scsiio()
563 if (pScsiReply->SCSIState & MPI_SCSI_STATE_RESPONSE_INFO_VALID && in mptscsih_info_scsiio()
564 pScsiReply->ResponseInfo) in mptscsih_info_scsiio()
566 ioc->name, le32_to_cpu(pScsiReply->ResponseInfo)); in mptscsih_info_scsiio()
570 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
572 * mptscsih_io_done - Main SCSI IO callback routine registered to
589 MPT_SCSI_HOST *hd; in mptscsih_io_done() local
596 hd = shost_priv(ioc->sh); in mptscsih_io_done()
597 req_idx = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx); in mptscsih_io_done()
599 le16_to_cpu(mr->u.frame.hwhdr.msgctxu.fld.req_idx) : req_idx; in mptscsih_io_done()
606 (le32_to_cpu(mf->u.frame.linkage.arg1) == 0xdeadbeaf)) in mptscsih_io_done()
617 if (hdr->Function == MPI_FUNCTION_SCSI_IO_REQUEST) in mptscsih_io_done()
619 ioc->name); in mptscsih_io_done()
625 if ((unsigned char *)mf != sc->host_scribble) { in mptscsih_io_done()
630 if (ioc->bus_type == SAS) { in mptscsih_io_done()
631 VirtDevice *vdevice = sc->device->hostdata; in mptscsih_io_done()
633 if (!vdevice || !vdevice->vtarget || in mptscsih_io_done()
634 vdevice->vtarget->deleted) { in mptscsih_io_done()
635 sc->result = DID_NO_CONNECT << 16; in mptscsih_io_done()
640 sc->host_scribble = NULL; in mptscsih_io_done()
641 sc->result = DID_OK << 16; /* Set default reply as OK */ in mptscsih_io_done()
645 if((ioc->facts.MsgVersion >= MPI_VERSION_01_05) && pScsiReply){ in mptscsih_io_done()
647 "ScsiDone (mf=%p,mr=%p,sc=%p,idx=%d,task-tag=%d)\n", in mptscsih_io_done()
648 ioc->name, mf, mr, sc, req_idx, pScsiReply->TaskTag)); in mptscsih_io_done()
652 ioc->name, mf, mr, sc, req_idx)); in mptscsih_io_done()
664 status = le16_to_cpu(pScsiReply->IOCStatus) & MPI_IOCSTATUS_MASK; in mptscsih_io_done()
666 scsi_state = pScsiReply->SCSIState; in mptscsih_io_done()
667 scsi_status = pScsiReply->SCSIStatus; in mptscsih_io_done()
668 xfer_cnt = le32_to_cpu(pScsiReply->TransferCount); in mptscsih_io_done()
669 scsi_set_resid(sc, scsi_bufflen(sc) - xfer_cnt); in mptscsih_io_done()
670 log_info = le32_to_cpu(pScsiReply->IOCLogInfo); in mptscsih_io_done()
686 mptscsih_copy_sense_data(sc, hd, mf, pScsiReply); in mptscsih_io_done()
692 pScsiReply->ResponseInfo) { in mptscsih_io_done()
694 "FCP_ResponseInfo=%08xh\n", ioc->name, in mptscsih_io_done()
695 sc->device->host->host_no, sc->device->channel, in mptscsih_io_done()
696 sc->device->id, sc->device->lun, in mptscsih_io_done()
697 le32_to_cpu(pScsiReply->ResponseInfo)); in mptscsih_io_done()
706 * killing interrupt handler:-( in mptscsih_io_done()
708 sc->result = SAM_STAT_BUSY; in mptscsih_io_done()
713 sc->result = DID_BAD_TARGET << 16; in mptscsih_io_done()
718 if (ioc->bus_type != FC) in mptscsih_io_done()
719 sc->result = DID_NO_CONNECT << 16; in mptscsih_io_done()
722 sc->result = DID_REQUEUE << 16; in mptscsih_io_done()
724 if (hd->sel_timeout[pScsiReq->TargetID] < 0xFFFF) in mptscsih_io_done()
725 hd->sel_timeout[pScsiReq->TargetID]++; in mptscsih_io_done()
727 vdevice = sc->device->hostdata; in mptscsih_io_done()
730 vtarget = vdevice->vtarget; in mptscsih_io_done()
731 if (vtarget->tflags & MPT_TARGET_FLAGS_LED_ON) { in mptscsih_io_done()
734 vtarget->tflags &= ~MPT_TARGET_FLAGS_LED_ON; in mptscsih_io_done()
739 if ( ioc->bus_type == SAS ) { in mptscsih_io_done()
741 le16_to_cpu(pScsiReply->IOCStatus); in mptscsih_io_done()
748 sc->device->hostdata; in mptscsih_io_done()
754 if (vdevice && vdevice-> in mptscsih_io_done()
756 vdevice->vtarget-> in mptscsih_io_done()
762 vdevice->vtarget) in mptscsih_io_done()
763 vdevice->vtarget-> in mptscsih_io_done()
766 sc->result = in mptscsih_io_done()
771 } else if (ioc->bus_type == FC) { in mptscsih_io_done()
780 sc->result = DID_ERROR << 16; in mptscsih_io_done()
785 * Allow non-SAS & non-NEXUS_LOSS to drop into below code in mptscsih_io_done()
793 sc->result = DID_RESET << 16; in mptscsih_io_done()
797 if (ioc->bus_type == FC) in mptscsih_io_done()
798 sc->result = DID_ERROR << 16; in mptscsih_io_done()
800 sc->result = DID_RESET << 16; in mptscsih_io_done()
804 scsi_set_resid(sc, scsi_bufflen(sc) - xfer_cnt); in mptscsih_io_done()
805 if((xfer_cnt==0)||(sc->underflow > xfer_cnt)) in mptscsih_io_done()
806 sc->result=DID_SOFT_ERROR << 16; in mptscsih_io_done()
808 sc->result = (DID_OK << 16) | scsi_status; in mptscsih_io_done()
811 ioc->name, sc->result, sc->device->channel, sc->device->id)); in mptscsih_io_done()
819 sc->result = (DID_OK << 16) | scsi_status; in mptscsih_io_done()
829 if (ioc->bus_type == SPI) { in mptscsih_io_done()
830 if ((pScsiReq->CDB[0] == READ_6 && ((pScsiReq->CDB[1] & 0x02) == 0)) || in mptscsih_io_done()
831 pScsiReq->CDB[0] == READ_10 || in mptscsih_io_done()
832 pScsiReq->CDB[0] == READ_12 || in mptscsih_io_done()
833 (pScsiReq->CDB[0] == READ_16 && in mptscsih_io_done()
834 ((pScsiReq->CDB[1] & 0x02) == 0)) || in mptscsih_io_done()
835 pScsiReq->CDB[0] == VERIFY || in mptscsih_io_done()
836 pScsiReq->CDB[0] == VERIFY_16) { in mptscsih_io_done()
839 sc->result = in mptscsih_io_done()
843 "sc->req_bufflen=0x%02x," in mptscsih_io_done()
851 if (xfer_cnt < sc->underflow) { in mptscsih_io_done()
853 sc->result = SAM_STAT_BUSY; in mptscsih_io_done()
855 sc->result = DID_SOFT_ERROR << 16; in mptscsih_io_done()
860 sc->result = DID_SOFT_ERROR << 16; in mptscsih_io_done()
864 sc->result = DID_RESET << 16; in mptscsih_io_done()
870 " sc->underflow={report ERR if < %02xh bytes xfer'd}\n", in mptscsih_io_done()
871 ioc->name, sc->underflow)); in mptscsih_io_done()
873 " ActBytesXferd=%02xh\n", ioc->name, xfer_cnt)); in mptscsih_io_done()
875 /* Report Queue Full in mptscsih_io_done()
887 sc->result = (DID_OK << 16) | scsi_status; in mptscsih_io_done()
901 if ((ioc->bus_type == SPI) && in mptscsih_io_done()
902 (sc->sense_buffer[2] & 0x20)) { in mptscsih_io_done()
905 sc->sense_buffer[3] << 24 | in mptscsih_io_done()
906 sc->sense_buffer[4] << 16 | in mptscsih_io_done()
907 sc->sense_buffer[5] << 8 | in mptscsih_io_done()
908 sc->sense_buffer[6]; in mptscsih_io_done()
909 if (((sc->sense_buffer[3] & 0x80) == in mptscsih_io_done()
912 sc->sense_buffer[2] = in mptscsih_io_done()
914 sc->sense_buffer[12] = 0xff; in mptscsih_io_done()
915 sc->sense_buffer[13] = 0xff; in mptscsih_io_done()
918 "sc->req_bufflen=0x%02x," in mptscsih_io_done()
923 if (((sc->sense_buffer[3] & 0x80) in mptscsih_io_done()
927 sc->sense_buffer[2] = in mptscsih_io_done()
929 sc->sense_buffer[12] = 0xff; in mptscsih_io_done()
930 sc->sense_buffer[13] = 0xff; in mptscsih_io_done()
933 "sc->req_bufflen=0x%02x," in mptscsih_io_done()
945 * (QUEUE_FULL) returned from device! --> get 0x0000?128 in mptscsih_io_done()
948 if (pScsiReply->SCSIStatus == MPI_SCSI_STATUS_TASK_SET_FULL) in mptscsih_io_done()
958 sc->result = DID_SOFT_ERROR << 16; in mptscsih_io_done()
962 sc->result = DID_RESET << 16; in mptscsih_io_done()
972 if (sc->result == MPI_SCSI_STATUS_TASK_SET_FULL) in mptscsih_io_done()
982 sc->result = DID_SOFT_ERROR << 16; in mptscsih_io_done()
997 sc->result = DID_SOFT_ERROR << 16; in mptscsih_io_done()
1003 if (sc->result && (ioc->debug_level & MPT_DEBUG_REPLY)) in mptscsih_io_done()
1012 sc->scsi_done(sc); /* Issue the command callback */ in mptscsih_io_done()
1020 * mptscsih_flush_running_cmds - For each command found, search
1023 * @hd: Pointer to a SCSI HOST structure
1030 mptscsih_flush_running_cmds(MPT_SCSI_HOST *hd) in mptscsih_flush_running_cmds() argument
1032 MPT_ADAPTER *ioc = hd->ioc; in mptscsih_flush_running_cmds()
1038 for (ii= 0; ii < ioc->req_depth; ii++) { in mptscsih_flush_running_cmds()
1045 channel = mf->Bus; in mptscsih_flush_running_cmds()
1046 id = mf->TargetID; in mptscsih_flush_running_cmds()
1049 if ((unsigned char *)mf != sc->host_scribble) in mptscsih_flush_running_cmds()
1052 sc->result = DID_RESET << 16; in mptscsih_flush_running_cmds()
1053 sc->host_scribble = NULL; in mptscsih_flush_running_cmds()
1054 dtmprintk(ioc, sdev_printk(KERN_INFO, sc->device, MYIOC_s_FMT in mptscsih_flush_running_cmds()
1056 "idx=%x\n", ioc->name, channel, id, sc, mf, ii)); in mptscsih_flush_running_cmds()
1057 sc->scsi_done(sc); in mptscsih_flush_running_cmds()
1063 * mptscsih_search_running_cmds - Delete any commands associated
1065 * when a lun is disable by mid-layer.
1068 * (BUT, BUT, BUT, the code does reference it! - mdr)
1069 * @hd: Pointer to a SCSI HOST structure
1077 mptscsih_search_running_cmds(MPT_SCSI_HOST *hd, VirtDevice *vdevice) in mptscsih_search_running_cmds() argument
1083 MPT_ADAPTER *ioc = hd->ioc; in mptscsih_search_running_cmds()
1086 spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); in mptscsih_search_running_cmds()
1087 for (ii = 0; ii < ioc->req_depth; ii++) { in mptscsih_search_running_cmds()
1088 if ((sc = ioc->ScsiLookup[ii]) != NULL) { in mptscsih_search_running_cmds()
1094 * expected that the mf->function will be RAID_SCSI_IO in mptscsih_search_running_cmds()
1096 if (vdevice->vtarget->tflags & in mptscsih_search_running_cmds()
1097 MPT_TARGET_FLAGS_RAID_COMPONENT && mf->Function != in mptscsih_search_running_cmds()
1101 int_to_scsilun(vdevice->lun, &lun); in mptscsih_search_running_cmds()
1102 if ((mf->Bus != vdevice->vtarget->channel) || in mptscsih_search_running_cmds()
1103 (mf->TargetID != vdevice->vtarget->id) || in mptscsih_search_running_cmds()
1104 memcmp(lun.scsi_lun, mf->LUN, 8)) in mptscsih_search_running_cmds()
1107 if ((unsigned char *)mf != sc->host_scribble) in mptscsih_search_running_cmds()
1109 ioc->ScsiLookup[ii] = NULL; in mptscsih_search_running_cmds()
1110 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); in mptscsih_search_running_cmds()
1114 sc->host_scribble = NULL; in mptscsih_search_running_cmds()
1115 sc->result = DID_NO_CONNECT << 16; in mptscsih_search_running_cmds()
1116 dtmprintk(ioc, sdev_printk(KERN_INFO, sc->device, in mptscsih_search_running_cmds()
1118 "fw_id %d, sc=%p, mf = %p, idx=%x\n", ioc->name, in mptscsih_search_running_cmds()
1119 vdevice->vtarget->channel, vdevice->vtarget->id, in mptscsih_search_running_cmds()
1121 sc->scsi_done(sc); in mptscsih_search_running_cmds()
1122 spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); in mptscsih_search_running_cmds()
1125 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); in mptscsih_search_running_cmds()
1129 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1131 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1133 * mptscsih_report_queue_full - Report QUEUE_FULL status returned
1147 MPT_SCSI_HOST *hd; in mptscsih_report_queue_full() local
1150 if (sc->device == NULL) in mptscsih_report_queue_full()
1152 if (sc->device->host == NULL) in mptscsih_report_queue_full()
1154 if ((hd = shost_priv(sc->device->host)) == NULL) in mptscsih_report_queue_full()
1156 ioc = hd->ioc; in mptscsih_report_queue_full()
1157 if (time - hd->last_queue_full > 10 * HZ) { in mptscsih_report_queue_full()
1159 ioc->name, 0, sc->device->id, sc->device->lun)); in mptscsih_report_queue_full()
1160 hd->last_queue_full = time; in mptscsih_report_queue_full()
1164 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1166 * mptscsih_remove - Removed scsi devices
1175 struct Scsi_Host *host = ioc->sh; in mptscsih_remove()
1176 MPT_SCSI_HOST *hd; in mptscsih_remove() local
1180 hd = NULL; in mptscsih_remove()
1182 hd = shost_priv(host); in mptscsih_remove()
1188 if (ioc->ScsiLookup != NULL) { in mptscsih_remove()
1189 sz1 = ioc->req_depth * sizeof(void *); in mptscsih_remove()
1190 kfree(ioc->ScsiLookup); in mptscsih_remove()
1191 ioc->ScsiLookup = NULL; in mptscsih_remove()
1196 ioc->name, sz1)); in mptscsih_remove()
1198 if (hd) in mptscsih_remove()
1199 kfree(hd->info_kbuf); in mptscsih_remove()
1203 ioc->sh = NULL; in mptscsih_remove()
1211 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1213 * mptscsih_shutdown - reboot notifier
1222 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1224 * mptscsih_suspend - Fusion MPT scsi driver suspend routine.
1233 scsi_block_requests(ioc->sh); in mptscsih_suspend()
1239 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1241 * mptscsih_resume - Fusion MPT scsi driver resume routine.
1252 scsi_unblock_requests(ioc->sh); in mptscsih_resume()
1258 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1260 * mptscsih_info - Return information about MPT adapter
1275 if (h->info_kbuf == NULL) in mptscsih_info()
1276 if ((h->info_kbuf = kmalloc(0x1000 /* 4Kb */, GFP_KERNEL)) == NULL) in mptscsih_info()
1277 return h->info_kbuf; in mptscsih_info()
1278 h->info_kbuf[0] = '\0'; in mptscsih_info()
1280 mpt_print_ioc_summary(h->ioc, h->info_kbuf, &size, 0, 0); in mptscsih_info()
1281 h->info_kbuf[size-1] = '\0'; in mptscsih_info()
1283 return h->info_kbuf; in mptscsih_info()
1288 MPT_SCSI_HOST *hd = shost_priv(host); in mptscsih_show_info() local
1289 MPT_ADAPTER *ioc = hd->ioc; in mptscsih_show_info()
1291 seq_printf(m, "%s: %s, ", ioc->name, ioc->prod_name); in mptscsih_show_info()
1292 seq_printf(m, "%s%08xh, ", MPT_FW_REV_MAGIC_ID_STRING, ioc->facts.FWVersion.Word); in mptscsih_show_info()
1293 seq_printf(m, "Ports=%d, ", ioc->facts.NumberOfPorts); in mptscsih_show_info()
1294 seq_printf(m, "MaxQ=%d\n", ioc->req_depth); in mptscsih_show_info()
1299 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1302 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1304 * mptscsih_qcmd - Primary Fusion MPT SCSI initiator IO start routine.
1311 * Returns 0. (rtn value discarded by linux scsi mid-layer)
1316 MPT_SCSI_HOST *hd; in mptscsih_qcmd() local
1319 VirtDevice *vdevice = SCpnt->device->hostdata; in mptscsih_qcmd()
1328 hd = shost_priv(SCpnt->device->host); in mptscsih_qcmd()
1329 ioc = hd->ioc; in mptscsih_qcmd()
1332 ioc->name, SCpnt)); in mptscsih_qcmd()
1334 if (ioc->taskmgmt_quiesce_io) in mptscsih_qcmd()
1340 if ((mf = mpt_get_msg_frame(ioc->DoneCtx, ioc)) == NULL) { in mptscsih_qcmd()
1342 ioc->name)); in mptscsih_qcmd()
1348 my_idx = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx); in mptscsih_qcmd()
1356 if (SCpnt->sc_data_direction == DMA_FROM_DEVICE) { in mptscsih_qcmd()
1358 scsidir = MPI_SCSIIO_CONTROL_READ; /* DATA IN (host<--ioc<--dev) */ in mptscsih_qcmd()
1359 } else if (SCpnt->sc_data_direction == DMA_TO_DEVICE) { in mptscsih_qcmd()
1361 scsidir = MPI_SCSIIO_CONTROL_WRITE; /* DATA OUT (host-->ioc-->dev) */ in mptscsih_qcmd()
1370 if ((vdevice->vtarget->tflags & MPT_TARGET_FLAGS_Q_YES) && in mptscsih_qcmd()
1371 SCpnt->device->tagged_supported) in mptscsih_qcmd()
1379 pScsiReq->TargetID = (u8) vdevice->vtarget->id; in mptscsih_qcmd()
1380 pScsiReq->Bus = vdevice->vtarget->channel; in mptscsih_qcmd()
1381 pScsiReq->ChainOffset = 0; in mptscsih_qcmd()
1382 if (vdevice->vtarget->tflags & MPT_TARGET_FLAGS_RAID_COMPONENT) in mptscsih_qcmd()
1383 pScsiReq->Function = MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH; in mptscsih_qcmd()
1385 pScsiReq->Function = MPI_FUNCTION_SCSI_IO_REQUEST; in mptscsih_qcmd()
1386 pScsiReq->CDBLength = SCpnt->cmd_len; in mptscsih_qcmd()
1387 pScsiReq->SenseBufferLength = MPT_SENSE_BUFFER_SIZE; in mptscsih_qcmd()
1388 pScsiReq->Reserved = 0; in mptscsih_qcmd()
1389 pScsiReq->MsgFlags = mpt_msg_flags(ioc); in mptscsih_qcmd()
1390 int_to_scsilun(SCpnt->device->lun, (struct scsi_lun *)pScsiReq->LUN); in mptscsih_qcmd()
1391 pScsiReq->Control = cpu_to_le32(scsictl); in mptscsih_qcmd()
1396 cmd_len = SCpnt->cmd_len; in mptscsih_qcmd()
1398 pScsiReq->CDB[ii] = SCpnt->cmnd[ii]; in mptscsih_qcmd()
1401 pScsiReq->CDB[ii] = 0; in mptscsih_qcmd()
1404 pScsiReq->DataLength = cpu_to_le32(datalen); in mptscsih_qcmd()
1407 pScsiReq->SenseBufferLowAddr = cpu_to_le32(ioc->sense_buf_low_dma in mptscsih_qcmd()
1415 ioc->add_sge((char *)&pScsiReq->SGL, in mptscsih_qcmd()
1417 (dma_addr_t) -1); in mptscsih_qcmd()
1424 SCpnt->host_scribble = (unsigned char *)mf; in mptscsih_qcmd()
1427 mpt_put_msg_frame(ioc->DoneCtx, ioc, mf); in mptscsih_qcmd()
1429 ioc->name, SCpnt, mf, my_idx)); in mptscsih_qcmd()
1439 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1441 * mptscsih_freeChainBuffers - Function to free chain buffers associated
1443 * @hd: Pointer to the MPT_SCSI_HOST instance
1460 chain_idx = ioc->ReqToChain[req_idx]; in mptscsih_freeChainBuffers()
1461 ioc->ReqToChain[req_idx] = MPT_HOST_NO_CHAIN; in mptscsih_freeChainBuffers()
1466 next = ioc->ChainToChain[chain_idx]; in mptscsih_freeChainBuffers()
1471 ioc->ChainToChain[chain_idx] = MPT_HOST_NO_CHAIN; in mptscsih_freeChainBuffers()
1473 chain = (MPT_FRAME_HDR *) (ioc->ChainBuffer in mptscsih_freeChainBuffers()
1474 + (chain_idx * ioc->req_sz)); in mptscsih_freeChainBuffers()
1476 spin_lock_irqsave(&ioc->FreeQlock, flags); in mptscsih_freeChainBuffers()
1477 list_add_tail(&chain->u.frame.linkage.list, &ioc->FreeChainQ); in mptscsih_freeChainBuffers()
1478 spin_unlock_irqrestore(&ioc->FreeQlock, flags); in mptscsih_freeChainBuffers()
1481 ioc->name, chain_idx)); in mptscsih_freeChainBuffers()
1489 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1494 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1496 * mptscsih_IssueTaskMgmt - Generic send Task Management function.
1497 * @hd: Pointer to MPT_SCSI_HOST structure
1506 * or a non-interrupt thread. In the former, must not call schedule().
1514 mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, u64 lun, in mptscsih_IssueTaskMgmt() argument
1521 MPT_ADAPTER *ioc = hd->ioc; in mptscsih_IssueTaskMgmt()
1532 ioc->name, type, ioc_raw_state); in mptscsih_IssueTaskMgmt()
1534 ioc->name, __func__); in mptscsih_IssueTaskMgmt()
1537 "FAILED!!\n", ioc->name); in mptscsih_IssueTaskMgmt()
1545 if (!((ioc->facts.IOCCapabilities & MPI_IOCFACTS_CAPABILITY_HIGH_PRI_Q) in mptscsih_IssueTaskMgmt()
1546 && (ioc->facts.MsgVersion >= MPI_VERSION_01_05)) && in mptscsih_IssueTaskMgmt()
1551 ioc->name, type, ioc_raw_state); in mptscsih_IssueTaskMgmt()
1555 mutex_lock(&ioc->taskmgmt_cmds.mutex); in mptscsih_IssueTaskMgmt()
1564 if ((mf = mpt_get_msg_frame(ioc->TaskCtx, ioc)) == NULL) { in mptscsih_IssueTaskMgmt()
1566 "TaskMgmt no msg frames!!\n", ioc->name)); in mptscsih_IssueTaskMgmt()
1572 ioc->name, mf)); in mptscsih_IssueTaskMgmt()
1577 pScsiTm->TargetID = id; in mptscsih_IssueTaskMgmt()
1578 pScsiTm->Bus = channel; in mptscsih_IssueTaskMgmt()
1579 pScsiTm->ChainOffset = 0; in mptscsih_IssueTaskMgmt()
1580 pScsiTm->Function = MPI_FUNCTION_SCSI_TASK_MGMT; in mptscsih_IssueTaskMgmt()
1582 pScsiTm->Reserved = 0; in mptscsih_IssueTaskMgmt()
1583 pScsiTm->TaskType = type; in mptscsih_IssueTaskMgmt()
1584 pScsiTm->Reserved1 = 0; in mptscsih_IssueTaskMgmt()
1585 pScsiTm->MsgFlags = (type == MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS) in mptscsih_IssueTaskMgmt()
1588 int_to_scsilun(lun, (struct scsi_lun *)pScsiTm->LUN); in mptscsih_IssueTaskMgmt()
1591 pScsiTm->Reserved2[ii] = 0; in mptscsih_IssueTaskMgmt()
1593 pScsiTm->TaskMsgContext = ctx2abort; in mptscsih_IssueTaskMgmt()
1596 "task_type = 0x%02X, timeout = %ld\n", ioc->name, ctx2abort, in mptscsih_IssueTaskMgmt()
1601 INITIALIZE_MGMT_STATUS(ioc->taskmgmt_cmds.status) in mptscsih_IssueTaskMgmt()
1603 if ((ioc->facts.IOCCapabilities & MPI_IOCFACTS_CAPABILITY_HIGH_PRI_Q) && in mptscsih_IssueTaskMgmt()
1604 (ioc->facts.MsgVersion >= MPI_VERSION_01_05)) in mptscsih_IssueTaskMgmt()
1605 mpt_put_msg_frame_hi_pri(ioc->TaskCtx, ioc, mf); in mptscsih_IssueTaskMgmt()
1607 retval = mpt_send_handshake_request(ioc->TaskCtx, ioc, in mptscsih_IssueTaskMgmt()
1612 ioc->name, mf, retval)); in mptscsih_IssueTaskMgmt()
1619 wait_for_completion_timeout(&ioc->taskmgmt_cmds.done, in mptscsih_IssueTaskMgmt()
1621 if (!(ioc->taskmgmt_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) { in mptscsih_IssueTaskMgmt()
1624 "TaskMgmt TIMED OUT!(mf=%p)\n", ioc->name, mf)); in mptscsih_IssueTaskMgmt()
1626 if (ioc->taskmgmt_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET) in mptscsih_IssueTaskMgmt()
1633 (SCSITaskMgmtReply_t *) ioc->taskmgmt_cmds.reply); in mptscsih_IssueTaskMgmt()
1637 ioc->name, jiffies_to_msecs(jiffies - time_count)/1000)); in mptscsih_IssueTaskMgmt()
1641 CLEAR_MGMT_STATUS(ioc->taskmgmt_cmds.status) in mptscsih_IssueTaskMgmt()
1645 ioc->name, __func__, mpt_GetIocState(ioc, 0)); in mptscsih_IssueTaskMgmt()
1646 retval = (ioc->bus_type == SAS) ? in mptscsih_IssueTaskMgmt()
1653 mutex_unlock(&ioc->taskmgmt_cmds.mutex); in mptscsih_IssueTaskMgmt()
1661 switch (ioc->bus_type) { in mptscsih_get_tm_timeout()
1672 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1674 * mptscsih_abort - Abort linux scsi_cmnd routine, new_eh variant
1684 MPT_SCSI_HOST *hd; in mptscsih_abort() local
1694 if ((hd = shost_priv(SCpnt->device->host)) == NULL) { in mptscsih_abort()
1695 SCpnt->result = DID_RESET << 16; in mptscsih_abort()
1696 SCpnt->scsi_done(SCpnt); in mptscsih_abort()
1702 ioc = hd->ioc; in mptscsih_abort()
1704 ioc->name, SCpnt); in mptscsih_abort()
1707 vdevice = SCpnt->device->hostdata; in mptscsih_abort()
1708 if (!vdevice || !vdevice->vtarget) { in mptscsih_abort()
1711 ioc->name, SCpnt)); in mptscsih_abort()
1712 SCpnt->result = DID_NO_CONNECT << 16; in mptscsih_abort()
1713 SCpnt->scsi_done(SCpnt); in mptscsih_abort()
1720 if (vdevice->vtarget->tflags & MPT_TARGET_FLAGS_RAID_COMPONENT) { in mptscsih_abort()
1723 ioc->name, SCpnt)); in mptscsih_abort()
1724 SCpnt->result = DID_RESET << 16; in mptscsih_abort()
1731 if (vdevice->vtarget->raidVolume) { in mptscsih_abort()
1734 ioc->name, SCpnt)); in mptscsih_abort()
1735 SCpnt->result = DID_RESET << 16; in mptscsih_abort()
1746 SCpnt->result = DID_RESET << 16; in mptscsih_abort()
1748 "Command not in the active list! (sc=%p)\n", ioc->name, in mptscsih_abort()
1754 if (ioc->timeouts < -1) in mptscsih_abort()
1755 ioc->timeouts++; in mptscsih_abort()
1765 * the controller, so it does not matter. -DaveM in mptscsih_abort()
1768 ctx2abort = mf->u.frame.hwhdr.msgctxu.MsgContext; in mptscsih_abort()
1769 retval = mptscsih_IssueTaskMgmt(hd, in mptscsih_abort()
1771 vdevice->vtarget->channel, in mptscsih_abort()
1772 vdevice->vtarget->id, vdevice->lun, in mptscsih_abort()
1778 ioc->name, SCpnt)); in mptscsih_abort()
1783 ioc->name, SCpnt)); in mptscsih_abort()
1789 ioc->name, ((retval == SUCCESS) ? "SUCCESS" : "FAILED"), retval, in mptscsih_abort()
1795 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1797 * mptscsih_dev_reset - Perform a SCSI TARGET_RESET! new_eh variant
1807 MPT_SCSI_HOST *hd; in mptscsih_dev_reset() local
1814 if ((hd = shost_priv(SCpnt->device->host)) == NULL){ in mptscsih_dev_reset()
1820 ioc = hd->ioc; in mptscsih_dev_reset()
1822 ioc->name, SCpnt); in mptscsih_dev_reset()
1825 vdevice = SCpnt->device->hostdata; in mptscsih_dev_reset()
1826 if (!vdevice || !vdevice->vtarget) { in mptscsih_dev_reset()
1833 if (vdevice->vtarget->tflags & MPT_TARGET_FLAGS_RAID_COMPONENT) { in mptscsih_dev_reset()
1838 retval = mptscsih_IssueTaskMgmt(hd, in mptscsih_dev_reset()
1840 vdevice->vtarget->channel, in mptscsih_dev_reset()
1841 vdevice->vtarget->id, 0, 0, in mptscsih_dev_reset()
1846 ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt); in mptscsih_dev_reset()
1855 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1857 * mptscsih_bus_reset - Perform a SCSI BUS_RESET! new_eh variant
1867 MPT_SCSI_HOST *hd; in mptscsih_bus_reset() local
1874 if ((hd = shost_priv(SCpnt->device->host)) == NULL){ in mptscsih_bus_reset()
1880 ioc = hd->ioc; in mptscsih_bus_reset()
1882 ioc->name, SCpnt); in mptscsih_bus_reset()
1885 if (ioc->timeouts < -1) in mptscsih_bus_reset()
1886 ioc->timeouts++; in mptscsih_bus_reset()
1888 vdevice = SCpnt->device->hostdata; in mptscsih_bus_reset()
1889 if (!vdevice || !vdevice->vtarget) in mptscsih_bus_reset()
1891 retval = mptscsih_IssueTaskMgmt(hd, in mptscsih_bus_reset()
1893 vdevice->vtarget->channel, 0, 0, 0, in mptscsih_bus_reset()
1897 ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt); in mptscsih_bus_reset()
1905 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1907 * mptscsih_host_reset - Perform a SCSI host adapter RESET (new_eh variant)
1917 MPT_SCSI_HOST * hd; in mptscsih_host_reset() local
1923 if ((hd = shost_priv(SCpnt->device->host)) == NULL){ in mptscsih_host_reset()
1930 mptscsih_flush_running_cmds(hd); in mptscsih_host_reset()
1932 ioc = hd->ioc; in mptscsih_host_reset()
1934 ioc->name, SCpnt); in mptscsih_host_reset()
1937 * status. The host will be taken off line by the SCSI mid-layer. in mptscsih_host_reset()
1946 ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt); in mptscsih_host_reset()
1959 if (!(ioc->taskmgmt_cmds.status & MPT_MGMT_STATUS_RF_VALID)) { in mptscsih_taskmgmt_reply()
1966 iocstatus = le16_to_cpu(pScsiTmReply->IOCStatus) & MPI_IOCSTATUS_MASK; in mptscsih_taskmgmt_reply()
1967 termination_count = le32_to_cpu(pScsiTmReply->TerminationCount); in mptscsih_taskmgmt_reply()
1972 "\tterm_cmnds = %d\n", ioc->name, pScsiTmReply->Bus, in mptscsih_taskmgmt_reply()
1973 pScsiTmReply->TargetID, type, le16_to_cpu(pScsiTmReply->IOCStatus), in mptscsih_taskmgmt_reply()
1974 le32_to_cpu(pScsiTmReply->IOCLogInfo), pScsiTmReply->ResponseCode, in mptscsih_taskmgmt_reply()
1977 if (ioc->facts.MsgVersion >= MPI_VERSION_01_05 && in mptscsih_taskmgmt_reply()
1978 pScsiTmReply->ResponseCode) in mptscsih_taskmgmt_reply()
1980 pScsiTmReply->ResponseCode); in mptscsih_taskmgmt_reply()
2002 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
2035 ioc->name, response_code, desc); in mptscsih_taskmgmt_response_code()
2039 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
2041 * mptscsih_taskmgmt_complete - Registered with Fusion MPT base driver
2058 "TaskMgmt completed (mf=%p, mr=%p)\n", ioc->name, mf, mr)); in mptscsih_taskmgmt_complete()
2060 ioc->taskmgmt_cmds.status |= MPT_MGMT_STATUS_COMMAND_GOOD; in mptscsih_taskmgmt_complete()
2065 ioc->taskmgmt_cmds.status |= MPT_MGMT_STATUS_RF_VALID; in mptscsih_taskmgmt_complete()
2066 memcpy(ioc->taskmgmt_cmds.reply, mr, in mptscsih_taskmgmt_complete()
2067 min(MPT_DEFAULT_FRAME_SIZE, 4 * mr->u.reply.MsgLength)); in mptscsih_taskmgmt_complete()
2069 if (ioc->taskmgmt_cmds.status & MPT_MGMT_STATUS_PENDING) { in mptscsih_taskmgmt_complete()
2071 ioc->taskmgmt_cmds.status &= ~MPT_MGMT_STATUS_PENDING; in mptscsih_taskmgmt_complete()
2072 complete(&ioc->taskmgmt_cmds.done); in mptscsih_taskmgmt_complete()
2073 if (ioc->bus_type == SAS) in mptscsih_taskmgmt_complete()
2074 ioc->schedule_target_reset(ioc); in mptscsih_taskmgmt_complete()
2080 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
2132 if (!ioc->raid_data.pIocPg3) in mptscsih_is_phys_disk()
2134 for (i = 0; i < ioc->raid_data.pIocPg3->NumPhysDisks; i++) { in mptscsih_is_phys_disk()
2135 if ((id == ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskID) && in mptscsih_is_phys_disk()
2136 (channel == ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskBus)) { in mptscsih_is_phys_disk()
2142 if (ioc->bus_type != SAS) in mptscsih_is_phys_disk()
2148 for (i = 0; i < ioc->raid_data.pIocPg3->NumPhysDisks; i++) { in mptscsih_is_phys_disk()
2150 ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskNum); in mptscsih_is_phys_disk()
2158 ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskNum, in mptscsih_is_phys_disk()
2164 if ((phys_disk->Path[j].Flags & in mptscsih_is_phys_disk()
2167 if ((phys_disk->Path[j].Flags & in mptscsih_is_phys_disk()
2170 if ((id == phys_disk->Path[j].PhysDiskID) && in mptscsih_is_phys_disk()
2171 (channel == phys_disk->Path[j].PhysDiskBus)) { in mptscsih_is_phys_disk()
2184 if (list_empty(&ioc->raid_data.inactive_list)) in mptscsih_is_phys_disk()
2187 mutex_lock(&ioc->raid_data.inactive_list_mutex); in mptscsih_is_phys_disk()
2188 list_for_each_entry(component_info, &ioc->raid_data.inactive_list, in mptscsih_is_phys_disk()
2190 if ((component_info->d.PhysDiskID == id) && in mptscsih_is_phys_disk()
2191 (component_info->d.PhysDiskBus == channel)) in mptscsih_is_phys_disk()
2194 mutex_unlock(&ioc->raid_data.inactive_list_mutex); in mptscsih_is_phys_disk()
2207 int rc = -ENXIO; in mptscsih_raid_id_to_num()
2210 if (!ioc->raid_data.pIocPg3) in mptscsih_raid_id_to_num()
2212 for (i = 0; i < ioc->raid_data.pIocPg3->NumPhysDisks; i++) { in mptscsih_raid_id_to_num()
2213 if ((id == ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskID) && in mptscsih_raid_id_to_num()
2214 (channel == ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskBus)) { in mptscsih_raid_id_to_num()
2215 rc = ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskNum; in mptscsih_raid_id_to_num()
2220 if (ioc->bus_type != SAS) in mptscsih_raid_id_to_num()
2226 for (i = 0; i < ioc->raid_data.pIocPg3->NumPhysDisks; i++) { in mptscsih_raid_id_to_num()
2228 ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskNum); in mptscsih_raid_id_to_num()
2236 ioc->raid_data.pIocPg3->PhysDisk[i].PhysDiskNum, in mptscsih_raid_id_to_num()
2242 if ((phys_disk->Path[j].Flags & in mptscsih_raid_id_to_num()
2245 if ((phys_disk->Path[j].Flags & in mptscsih_raid_id_to_num()
2248 if ((id == phys_disk->Path[j].PhysDiskID) && in mptscsih_raid_id_to_num()
2249 (channel == phys_disk->Path[j].PhysDiskBus)) { in mptscsih_raid_id_to_num()
2250 rc = phys_disk->PhysDiskNum; in mptscsih_raid_id_to_num()
2261 if (list_empty(&ioc->raid_data.inactive_list)) in mptscsih_raid_id_to_num()
2264 mutex_lock(&ioc->raid_data.inactive_list_mutex); in mptscsih_raid_id_to_num()
2265 list_for_each_entry(component_info, &ioc->raid_data.inactive_list, in mptscsih_raid_id_to_num()
2267 if ((component_info->d.PhysDiskID == id) && in mptscsih_raid_id_to_num()
2268 (component_info->d.PhysDiskBus == channel)) in mptscsih_raid_id_to_num()
2269 rc = component_info->d.PhysDiskNum; in mptscsih_raid_id_to_num()
2271 mutex_unlock(&ioc->raid_data.inactive_list_mutex); in mptscsih_raid_id_to_num()
2285 struct Scsi_Host *host = sdev->host; in mptscsih_slave_destroy()
2286 MPT_SCSI_HOST *hd = shost_priv(host); in mptscsih_slave_destroy() local
2292 vtarget = starget->hostdata; in mptscsih_slave_destroy()
2293 vdevice = sdev->hostdata; in mptscsih_slave_destroy()
2297 mptscsih_search_running_cmds(hd, vdevice); in mptscsih_slave_destroy()
2298 vtarget->num_luns--; in mptscsih_slave_destroy()
2299 mptscsih_synchronize_cache(hd, vdevice); in mptscsih_slave_destroy()
2301 sdev->hostdata = NULL; in mptscsih_slave_destroy()
2304 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
2306 * mptscsih_change_queue_depth - This function will set a devices queue depth
2315 MPT_SCSI_HOST *hd = shost_priv(sdev->host); in mptscsih_change_queue_depth() local
2319 MPT_ADAPTER *ioc = hd->ioc; in mptscsih_change_queue_depth()
2322 vtarget = starget->hostdata; in mptscsih_change_queue_depth()
2324 if (ioc->bus_type == SPI) { in mptscsih_change_queue_depth()
2325 if (!(vtarget->tflags & MPT_TARGET_FLAGS_Q_YES)) in mptscsih_change_queue_depth()
2327 else if (sdev->type == TYPE_DISK && in mptscsih_change_queue_depth()
2328 vtarget->minSyncFactor <= MPT_ULTRA160) in mptscsih_change_queue_depth()
2333 max_depth = ioc->sh->can_queue; in mptscsih_change_queue_depth()
2335 if (!sdev->tagged_supported) in mptscsih_change_queue_depth()
2345 * OS entry point to adjust the queue_depths on a per-device basis.
2348 * Return non-zero if fails.
2353 struct Scsi_Host *sh = sdev->host; in mptscsih_slave_configure()
2357 MPT_SCSI_HOST *hd = shost_priv(sh); in mptscsih_slave_configure() local
2358 MPT_ADAPTER *ioc = hd->ioc; in mptscsih_slave_configure()
2361 vtarget = starget->hostdata; in mptscsih_slave_configure()
2362 vdevice = sdev->hostdata; in mptscsih_slave_configure()
2366 ioc->name, sdev, sdev->channel, sdev->id, sdev->lun)); in mptscsih_slave_configure()
2367 if (ioc->bus_type == SPI) in mptscsih_slave_configure()
2370 ioc->name, sdev->sdtr, sdev->wdtr, in mptscsih_slave_configure()
2371 sdev->ppr, sdev->inquiry_len)); in mptscsih_slave_configure()
2373 vdevice->configured_lun = 1; in mptscsih_slave_configure()
2377 ioc->name, sdev->queue_depth, vtarget->tflags)); in mptscsih_slave_configure()
2379 if (ioc->bus_type == SPI) in mptscsih_slave_configure()
2382 ioc->name, vtarget->negoFlags, vtarget->maxOffset, in mptscsih_slave_configure()
2383 vtarget->minSyncFactor)); in mptscsih_slave_configure()
2388 ioc->name,sdev->tagged_supported, sdev->simple_tags)); in mptscsih_slave_configure()
2390 blk_queue_dma_alignment (sdev->request_queue, 512 - 1); in mptscsih_slave_configure()
2395 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
2400 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
2406 mptscsih_copy_sense_data(struct scsi_cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR *mf, SCSIIOReply_t … in mptscsih_copy_sense_data() argument
2410 u32 sense_count = le32_to_cpu(pScsiReply->SenseCount); in mptscsih_copy_sense_data()
2411 MPT_ADAPTER *ioc = hd->ioc; in mptscsih_copy_sense_data()
2416 vdevice = sc->device->hostdata; in mptscsih_copy_sense_data()
2423 req_index = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx); in mptscsih_copy_sense_data()
2424 sense_data = ((u8 *)ioc->sense_buf_pool + (req_index * MPT_SENSE_BUFFER_ALLOC)); in mptscsih_copy_sense_data()
2425 memcpy(sc->sense_buffer, sense_data, MPT_SENSE_BUFFER_ALLOC); in mptscsih_copy_sense_data()
2427 /* Log SMART data (asc = 0x5D, non-IM case only) if required. in mptscsih_copy_sense_data()
2429 if ((ioc->events) && (ioc->eventTypes & (1 << MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE))) { in mptscsih_copy_sense_data()
2430 if ((sense_data[12] == 0x5D) && (vdevice->vtarget->raidVolume == 0)) { in mptscsih_copy_sense_data()
2433 idx = ioc->eventContext % MPTCTL_EVENT_LOG_SIZE; in mptscsih_copy_sense_data()
2434 ioc->events[idx].event = MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE; in mptscsih_copy_sense_data()
2435 ioc->events[idx].eventContext = ioc->eventContext; in mptscsih_copy_sense_data()
2437 ioc->events[idx].data[0] = (pReq->LUN[1] << 24) | in mptscsih_copy_sense_data()
2439 (sc->device->channel << 8) | sc->device->id; in mptscsih_copy_sense_data()
2441 ioc->events[idx].data[1] = (sense_data[13] << 8) | sense_data[12]; in mptscsih_copy_sense_data()
2443 ioc->eventContext++; in mptscsih_copy_sense_data()
2444 if (ioc->pcidev->vendor == in mptscsih_copy_sense_data()
2447 vdevice->vtarget, MPI_SEP_REQ_SLOTSTATUS_PREDICTED_FAULT); in mptscsih_copy_sense_data()
2448 vdevice->vtarget->tflags |= in mptscsih_copy_sense_data()
2455 ioc->name)); in mptscsih_copy_sense_data()
2460 * mptscsih_get_scsi_lookup - retrieves scmd entry
2472 spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); in mptscsih_get_scsi_lookup()
2473 scmd = ioc->ScsiLookup[i]; in mptscsih_get_scsi_lookup()
2474 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); in mptscsih_get_scsi_lookup()
2481 * mptscsih_getclear_scsi_lookup - retrieves and clears scmd entry from ScsiLookup[] array list
2494 spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); in mptscsih_getclear_scsi_lookup()
2495 scmd = ioc->ScsiLookup[i]; in mptscsih_getclear_scsi_lookup()
2496 ioc->ScsiLookup[i] = NULL; in mptscsih_getclear_scsi_lookup()
2497 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); in mptscsih_getclear_scsi_lookup()
2503 * mptscsih_set_scsi_lookup - write a scmd entry into the ScsiLookup[] array list
2515 spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); in mptscsih_set_scsi_lookup()
2516 ioc->ScsiLookup[i] = scmd; in mptscsih_set_scsi_lookup()
2517 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); in mptscsih_set_scsi_lookup()
2521 * SCPNT_TO_LOOKUP_IDX - searches for a given scmd in the ScsiLookup[] array list
2529 int i, index=-1; in SCPNT_TO_LOOKUP_IDX()
2531 spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); in SCPNT_TO_LOOKUP_IDX()
2532 for (i = 0; i < ioc->req_depth; i++) { in SCPNT_TO_LOOKUP_IDX()
2533 if (ioc->ScsiLookup[i] == sc) { in SCPNT_TO_LOOKUP_IDX()
2540 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); in SCPNT_TO_LOOKUP_IDX()
2544 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
2548 MPT_SCSI_HOST *hd; in mptscsih_ioc_reset() local
2550 if (ioc->sh == NULL || shost_priv(ioc->sh) == NULL) in mptscsih_ioc_reset()
2553 hd = shost_priv(ioc->sh); in mptscsih_ioc_reset()
2557 "%s: MPT_IOC_SETUP_RESET\n", ioc->name, __func__)); in mptscsih_ioc_reset()
2561 "%s: MPT_IOC_PRE_RESET\n", ioc->name, __func__)); in mptscsih_ioc_reset()
2562 mptscsih_flush_running_cmds(hd); in mptscsih_ioc_reset()
2566 "%s: MPT_IOC_POST_RESET\n", ioc->name, __func__)); in mptscsih_ioc_reset()
2567 if (ioc->internal_cmds.status & MPT_MGMT_STATUS_PENDING) { in mptscsih_ioc_reset()
2568 ioc->internal_cmds.status |= in mptscsih_ioc_reset()
2570 complete(&ioc->internal_cmds.done); in mptscsih_ioc_reset()
2579 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
2583 u8 event = le32_to_cpu(pEvReply->Event) & 0xFF; in mptscsih_event_process()
2587 ioc->name, event)); in mptscsih_event_process()
2591 (ioc->bus_type == SPI) && (ioc->soft_resets < -1)) in mptscsih_event_process()
2592 ioc->soft_resets++; in mptscsih_event_process()
2597 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
2602 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
2604 * mptscsih_scandv_complete - Scan and DV callback routine registered
2633 ioc->internal_cmds.status |= MPT_MGMT_STATUS_COMMAND_GOOD; in mptscsih_scandv_complete()
2634 ioc->internal_cmds.completion_code = MPT_SCANDV_GOOD; in mptscsih_scandv_complete()
2640 ioc->internal_cmds.completion_code = in mptscsih_scandv_complete()
2642 ioc->internal_cmds.status |= MPT_MGMT_STATUS_RF_VALID; in mptscsih_scandv_complete()
2643 memcpy(ioc->internal_cmds.reply, reply, in mptscsih_scandv_complete()
2644 min(MPT_DEFAULT_FRAME_SIZE, 4 * reply->u.reply.MsgLength)); in mptscsih_scandv_complete()
2645 cmd = reply->u.hdr.Function; in mptscsih_scandv_complete()
2648 (pReply->SCSIState & MPI_SCSI_STATE_AUTOSENSE_VALID)) { in mptscsih_scandv_complete()
2649 req_idx = le16_to_cpu(req->u.frame.hwhdr.msgctxu.fld.req_idx); in mptscsih_scandv_complete()
2650 sense_data = ((u8 *)ioc->sense_buf_pool + in mptscsih_scandv_complete()
2652 sz = min_t(int, pReq->SenseBufferLength, in mptscsih_scandv_complete()
2654 memcpy(ioc->internal_cmds.sense, sense_data, sz); in mptscsih_scandv_complete()
2657 if (!(ioc->internal_cmds.status & MPT_MGMT_STATUS_PENDING)) in mptscsih_scandv_complete()
2659 ioc->internal_cmds.status &= ~MPT_MGMT_STATUS_PENDING; in mptscsih_scandv_complete()
2660 complete(&ioc->internal_cmds.done); in mptscsih_scandv_complete()
2666 * mptscsih_get_completion_code - get completion code from MPT request
2683 status = le16_to_cpu(pReply->IOCStatus) & MPI_IOCSTATUS_MASK; in mptscsih_get_completion_code()
2684 scsi_status = pReply->SCSIStatus; in mptscsih_get_completion_code()
2688 "IOCLogInfo=%08xh\n", ioc->name, status, pReply->SCSIState, in mptscsih_get_completion_code()
2689 scsi_status, le32_to_cpu(pReply->IOCLogInfo))); in mptscsih_get_completion_code()
2712 if (pReply->Function == MPI_FUNCTION_CONFIG) { in mptscsih_get_completion_code()
2714 } else if (pReply->Function == MPI_FUNCTION_RAID_ACTION) { in mptscsih_get_completion_code()
2716 if (le16_to_cpu(pr->ActionStatus) == in mptscsih_get_completion_code()
2721 } else if (pReply->SCSIState & MPI_SCSI_STATE_AUTOSENSE_VALID) in mptscsih_get_completion_code()
2723 else if (pReply->SCSIState & MPI_SCSI_STATE_AUTOSENSE_FAILED) { in mptscsih_get_completion_code()
2724 if (req->u.scsireq.CDB[0] == INQUIRY) in mptscsih_get_completion_code()
2728 } else if (pReply->SCSIState & MPI_SCSI_STATE_NO_SCSI_STATUS) in mptscsih_get_completion_code()
2730 else if (pReply->SCSIState & MPI_SCSI_STATE_TERMINATED) in mptscsih_get_completion_code()
2739 if (pReply->SCSIState & MPI_SCSI_STATE_TERMINATED) in mptscsih_get_completion_code()
2751 " completionCode set to %08xh\n", ioc->name, completion_code)); in mptscsih_get_completion_code()
2755 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
2757 * mptscsih_do_cmd - Do internal command.
2758 * @hd: MPT_SCSI_HOST pointer
2776 mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *io) in mptscsih_do_cmd() argument
2784 u8 cmd = io->cmd; in mptscsih_do_cmd()
2785 MPT_ADAPTER *ioc = hd->ioc; in mptscsih_do_cmd()
2791 spin_lock_irqsave(&ioc->taskmgmt_lock, flags); in mptscsih_do_cmd()
2792 if (ioc->ioc_reset_in_progress) { in mptscsih_do_cmd()
2793 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags); in mptscsih_do_cmd()
2795 "%s: busy with host reset\n", ioc->name, __func__)); in mptscsih_do_cmd()
2798 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags); in mptscsih_do_cmd()
2800 mutex_lock(&ioc->internal_cmds.mutex); in mptscsih_do_cmd()
2809 CDB[4] = io->size; in mptscsih_do_cmd()
2830 CDB[4] = io->size; in mptscsih_do_cmd()
2839 if (io->flags & MPT_ICFLAG_ECHO) { in mptscsih_do_cmd()
2845 if (io->flags & MPT_ICFLAG_BUF_CAP) { in mptscsih_do_cmd()
2848 CDB[6] = (io->size >> 16) & 0xFF; in mptscsih_do_cmd()
2849 CDB[7] = (io->size >> 8) & 0xFF; in mptscsih_do_cmd()
2850 CDB[8] = io->size & 0xFF; in mptscsih_do_cmd()
2858 if (io->flags & MPT_ICFLAG_ECHO) { in mptscsih_do_cmd()
2863 CDB[6] = (io->size >> 16) & 0xFF; in mptscsih_do_cmd()
2864 CDB[7] = (io->size >> 8) & 0xFF; in mptscsih_do_cmd()
2865 CDB[8] = io->size & 0xFF; in mptscsih_do_cmd()
2893 ret = -EFAULT; in mptscsih_do_cmd()
2900 if ((mf = mpt_get_msg_frame(ioc->InternalCtx, ioc)) == NULL) { in mptscsih_do_cmd()
2902 ioc->name, __func__)); in mptscsih_do_cmd()
2910 my_idx = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx); in mptscsih_do_cmd()
2913 if (io->flags & MPT_ICFLAG_PHYS_DISK) { in mptscsih_do_cmd()
2914 pScsiReq->TargetID = io->physDiskNum; in mptscsih_do_cmd()
2915 pScsiReq->Bus = 0; in mptscsih_do_cmd()
2916 pScsiReq->ChainOffset = 0; in mptscsih_do_cmd()
2917 pScsiReq->Function = MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH; in mptscsih_do_cmd()
2919 pScsiReq->TargetID = io->id; in mptscsih_do_cmd()
2920 pScsiReq->Bus = io->channel; in mptscsih_do_cmd()
2921 pScsiReq->ChainOffset = 0; in mptscsih_do_cmd()
2922 pScsiReq->Function = MPI_FUNCTION_SCSI_IO_REQUEST; in mptscsih_do_cmd()
2925 pScsiReq->CDBLength = cmdLen; in mptscsih_do_cmd()
2926 pScsiReq->SenseBufferLength = MPT_SENSE_BUFFER_SIZE; in mptscsih_do_cmd()
2928 pScsiReq->Reserved = 0; in mptscsih_do_cmd()
2930 pScsiReq->MsgFlags = mpt_msg_flags(ioc); in mptscsih_do_cmd()
2933 int_to_scsilun(io->lun, (struct scsi_lun *)pScsiReq->LUN); in mptscsih_do_cmd()
2935 if (io->flags & MPT_ICFLAG_TAGGED_CMD) in mptscsih_do_cmd()
2936 pScsiReq->Control = cpu_to_le32(dir | MPI_SCSIIO_CONTROL_SIMPLEQ); in mptscsih_do_cmd()
2938 pScsiReq->Control = cpu_to_le32(dir | MPI_SCSIIO_CONTROL_UNTAGGED); in mptscsih_do_cmd()
2941 pScsiReq->Control = cpu_to_le32(dir | MPI_SCSIIO_CONTROL_UNTAGGED); in mptscsih_do_cmd()
2943 "%s: Untagged! 0x%02x\n", ioc->name, __func__, cmd)); in mptscsih_do_cmd()
2947 pScsiReq->CDB[ii] = CDB[ii]; in mptscsih_do_cmd()
2949 pScsiReq->DataLength = cpu_to_le32(io->size); in mptscsih_do_cmd()
2950 pScsiReq->SenseBufferLowAddr = cpu_to_le32(ioc->sense_buf_low_dma in mptscsih_do_cmd()
2955 ioc->name, __func__, cmd, io->channel, io->id, io->lun)); in mptscsih_do_cmd()
2958 ioc->add_sge((char *) &pScsiReq->SGL, in mptscsih_do_cmd()
2959 MPT_SGE_FLAGS_SSIMPLE_READ | io->size, io->data_dma); in mptscsih_do_cmd()
2961 ioc->add_sge((char *) &pScsiReq->SGL, in mptscsih_do_cmd()
2962 MPT_SGE_FLAGS_SSIMPLE_WRITE | io->size, io->data_dma); in mptscsih_do_cmd()
2964 INITIALIZE_MGMT_STATUS(ioc->internal_cmds.status) in mptscsih_do_cmd()
2965 mpt_put_msg_frame(ioc->InternalCtx, ioc, mf); in mptscsih_do_cmd()
2966 timeleft = wait_for_completion_timeout(&ioc->internal_cmds.done, in mptscsih_do_cmd()
2968 if (!(ioc->internal_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) { in mptscsih_do_cmd()
2971 "%s: TIMED OUT for cmd=0x%02x\n", ioc->name, __func__, in mptscsih_do_cmd()
2973 if (ioc->internal_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET) { in mptscsih_do_cmd()
2981 ioc->name, __func__, mpt_GetIocState(ioc, 0), in mptscsih_do_cmd()
2989 ret = ioc->internal_cmds.completion_code; in mptscsih_do_cmd()
2991 ioc->name, __func__, ret)); in mptscsih_do_cmd()
2994 CLEAR_MGMT_STATUS(ioc->internal_cmds.status) in mptscsih_do_cmd()
2995 mutex_unlock(&ioc->internal_cmds.mutex); in mptscsih_do_cmd()
2999 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
3001 * mptscsih_synchronize_cache - Send SYNCHRONIZE_CACHE to all disks.
3002 * @hd: Pointer to a SCSI HOST structure
3006 * MUST be single-threaded.
3010 mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, VirtDevice *vdevice) in mptscsih_synchronize_cache() argument
3017 if (vdevice->vtarget->tflags & MPT_TARGET_FLAGS_RAID_COMPONENT) in mptscsih_synchronize_cache()
3020 if (vdevice->vtarget->type != TYPE_DISK || vdevice->vtarget->deleted || in mptscsih_synchronize_cache()
3021 !vdevice->configured_lun) in mptscsih_synchronize_cache()
3029 iocmd.physDiskNum = -1; in mptscsih_synchronize_cache()
3031 iocmd.data_dma = -1; in mptscsih_synchronize_cache()
3034 iocmd.channel = vdevice->vtarget->channel; in mptscsih_synchronize_cache()
3035 iocmd.id = vdevice->vtarget->id; in mptscsih_synchronize_cache()
3036 iocmd.lun = vdevice->lun; in mptscsih_synchronize_cache()
3038 mptscsih_do_cmd(hd, &iocmd); in mptscsih_synchronize_cache()
3046 MPT_SCSI_HOST *hd = shost_priv(host); in mptscsih_version_fw_show() local
3047 MPT_ADAPTER *ioc = hd->ioc; in mptscsih_version_fw_show()
3050 (ioc->facts.FWVersion.Word & 0xFF000000) >> 24, in mptscsih_version_fw_show()
3051 (ioc->facts.FWVersion.Word & 0x00FF0000) >> 16, in mptscsih_version_fw_show()
3052 (ioc->facts.FWVersion.Word & 0x0000FF00) >> 8, in mptscsih_version_fw_show()
3053 ioc->facts.FWVersion.Word & 0x000000FF); in mptscsih_version_fw_show()
3062 MPT_SCSI_HOST *hd = shost_priv(host); in mptscsih_version_bios_show() local
3063 MPT_ADAPTER *ioc = hd->ioc; in mptscsih_version_bios_show()
3066 (ioc->biosVersion & 0xFF000000) >> 24, in mptscsih_version_bios_show()
3067 (ioc->biosVersion & 0x00FF0000) >> 16, in mptscsih_version_bios_show()
3068 (ioc->biosVersion & 0x0000FF00) >> 8, in mptscsih_version_bios_show()
3069 ioc->biosVersion & 0x000000FF); in mptscsih_version_bios_show()
3078 MPT_SCSI_HOST *hd = shost_priv(host); in mptscsih_version_mpi_show() local
3079 MPT_ADAPTER *ioc = hd->ioc; in mptscsih_version_mpi_show()
3081 return snprintf(buf, PAGE_SIZE, "%03x\n", ioc->facts.MsgVersion); in mptscsih_version_mpi_show()
3091 MPT_SCSI_HOST *hd = shost_priv(host); in mptscsih_version_product_show() local
3092 MPT_ADAPTER *ioc = hd->ioc; in mptscsih_version_product_show()
3094 return snprintf(buf, PAGE_SIZE, "%s\n", ioc->prod_name); in mptscsih_version_product_show()
3105 MPT_SCSI_HOST *hd = shost_priv(host); in mptscsih_version_nvdata_persistent_show() local
3106 MPT_ADAPTER *ioc = hd->ioc; in mptscsih_version_nvdata_persistent_show()
3109 ioc->nvdata_version_persistent); in mptscsih_version_nvdata_persistent_show()
3119 MPT_SCSI_HOST *hd = shost_priv(host); in mptscsih_version_nvdata_default_show() local
3120 MPT_ADAPTER *ioc = hd->ioc; in mptscsih_version_nvdata_default_show()
3122 return snprintf(buf, PAGE_SIZE, "%02xh\n",ioc->nvdata_version_default); in mptscsih_version_nvdata_default_show()
3132 MPT_SCSI_HOST *hd = shost_priv(host); in mptscsih_board_name_show() local
3133 MPT_ADAPTER *ioc = hd->ioc; in mptscsih_board_name_show()
3135 return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_name); in mptscsih_board_name_show()
3144 MPT_SCSI_HOST *hd = shost_priv(host); in mptscsih_board_assembly_show() local
3145 MPT_ADAPTER *ioc = hd->ioc; in mptscsih_board_assembly_show()
3147 return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_assembly); in mptscsih_board_assembly_show()
3157 MPT_SCSI_HOST *hd = shost_priv(host); in mptscsih_board_tracer_show() local
3158 MPT_ADAPTER *ioc = hd->ioc; in mptscsih_board_tracer_show()
3160 return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_tracer); in mptscsih_board_tracer_show()
3170 MPT_SCSI_HOST *hd = shost_priv(host); in mptscsih_io_delay_show() local
3171 MPT_ADAPTER *ioc = hd->ioc; in mptscsih_io_delay_show()
3173 return snprintf(buf, PAGE_SIZE, "%02d\n", ioc->io_missing_delay); in mptscsih_io_delay_show()
3183 MPT_SCSI_HOST *hd = shost_priv(host); in mptscsih_device_delay_show() local
3184 MPT_ADAPTER *ioc = hd->ioc; in mptscsih_device_delay_show()
3186 return snprintf(buf, PAGE_SIZE, "%02d\n", ioc->device_missing_delay); in mptscsih_device_delay_show()
3196 MPT_SCSI_HOST *hd = shost_priv(host); in mptscsih_debug_level_show() local
3197 MPT_ADAPTER *ioc = hd->ioc; in mptscsih_debug_level_show()
3199 return snprintf(buf, PAGE_SIZE, "%08xh\n", ioc->debug_level); in mptscsih_debug_level_show()
3206 MPT_SCSI_HOST *hd = shost_priv(host); in mptscsih_debug_level_store() local
3207 MPT_ADAPTER *ioc = hd->ioc; in mptscsih_debug_level_store()
3211 return -EINVAL; in mptscsih_debug_level_store()
3213 ioc->debug_level = val; in mptscsih_debug_level_store()
3215 ioc->name, ioc->debug_level); in mptscsih_debug_level_store()
3262 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/