Lines Matching +full:period +full:- +full:scale

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 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
72 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
99 * mptspi_setTargetNegoParms - Update the target negotiation parameters
111 MPT_ADAPTER *ioc = hd->ioc; in mptspi_setTargetNegoParms()
112 SpiCfgData *pspi_data = &ioc->spi_data; in mptspi_setTargetNegoParms()
113 int id = (int) target->id; in mptspi_setTargetNegoParms()
121 target->negoFlags = pspi_data->noQas; in mptspi_setTargetNegoParms()
123 if (sdev->scsi_level < SCSI_2) { in mptspi_setTargetNegoParms()
126 offset = pspi_data->maxSyncOffset; in mptspi_setTargetNegoParms()
127 target->tflags &= ~MPT_TARGET_FLAGS_Q_YES; in mptspi_setTargetNegoParms()
133 factor = pspi_data->minSyncFactor; in mptspi_setTargetNegoParms()
145 "byte56=%02x on id=%d!\n", ioc->name, in mptspi_setTargetNegoParms()
149 if (sdev->type == TYPE_TAPE && in mptspi_setTargetNegoParms()
151 target->negoFlags |= MPT_TAPE_NEGO_IDP; in mptspi_setTargetNegoParms()
154 offset = pspi_data->maxSyncOffset; in mptspi_setTargetNegoParms()
159 * bit 1 QAS support, non-raid only in mptspi_setTargetNegoParms()
162 if (target->raidVolume == 1) in mptspi_setTargetNegoParms()
170 if (!sdev->tagged_supported) in mptspi_setTargetNegoParms()
171 target->tflags &= ~MPT_TARGET_FLAGS_Q_YES; in mptspi_setTargetNegoParms()
175 if (pspi_data->nvram && (pspi_data->nvram[id] != MPT_HOST_NVRAM_INVALID)) { in mptspi_setTargetNegoParms()
176 nvram = pspi_data->nvram[id]; in mptspi_setTargetNegoParms()
187 if (nfactor < pspi_data->minSyncFactor ) in mptspi_setTargetNegoParms()
188 nfactor = pspi_data->minSyncFactor; in mptspi_setTargetNegoParms()
209 target->minSyncFactor = factor; in mptspi_setTargetNegoParms()
210 target->maxOffset = offset; in mptspi_setTargetNegoParms()
211 target->maxWidth = width; in mptspi_setTargetNegoParms()
217 target->tflags |= MPT_TARGET_FLAGS_VALID_NEGO; in mptspi_setTargetNegoParms()
222 target->negoFlags |= MPT_TARGET_NO_NEGO_WIDE; in mptspi_setTargetNegoParms()
225 target->negoFlags |= MPT_TARGET_NO_NEGO_SYNC; in mptspi_setTargetNegoParms()
230 if (noQas && (pspi_data->noQas == 0)) { in mptspi_setTargetNegoParms()
231 pspi_data->noQas |= MPT_TARGET_NO_NEGO_QAS; in mptspi_setTargetNegoParms()
232 target->negoFlags |= MPT_TARGET_NO_NEGO_QAS; in mptspi_setTargetNegoParms()
238 "Disabling QAS due to noQas=%02x on id=%d!\n", ioc->name, noQas, id)); in mptspi_setTargetNegoParms()
243 * mptspi_writeIOCPage4 - write IOC Page 4
248 * Return: -EAGAIN if unable to obtain a Message Frame
256 MPT_ADAPTER *ioc = hd->ioc; in mptspi_writeIOCPage4()
266 if ((mf = mpt_get_msg_frame(ioc->DoneCtx, ioc)) == NULL) { in mptspi_writeIOCPage4()
268 "writeIOCPage4 : no msg frames!\n",ioc->name)); in mptspi_writeIOCPage4()
269 return -EAGAIN; in mptspi_writeIOCPage4()
279 pReq->Action = MPI_CONFIG_ACTION_PAGE_WRITE_CURRENT; in mptspi_writeIOCPage4()
280 pReq->Reserved = 0; in mptspi_writeIOCPage4()
281 pReq->ChainOffset = 0; in mptspi_writeIOCPage4()
282 pReq->Function = MPI_FUNCTION_CONFIG; in mptspi_writeIOCPage4()
283 pReq->ExtPageLength = 0; in mptspi_writeIOCPage4()
284 pReq->ExtPageType = 0; in mptspi_writeIOCPage4()
285 pReq->MsgFlags = 0; in mptspi_writeIOCPage4()
287 pReq->Reserved2[ii] = 0; in mptspi_writeIOCPage4()
290 IOCPage4Ptr = ioc->spi_data.pIocPg4; in mptspi_writeIOCPage4()
291 dataDma = ioc->spi_data.IocPg4_dma; in mptspi_writeIOCPage4()
292 ii = IOCPage4Ptr->ActiveSEP++; in mptspi_writeIOCPage4()
293 IOCPage4Ptr->SEP[ii].SEPTargetID = id; in mptspi_writeIOCPage4()
294 IOCPage4Ptr->SEP[ii].SEPBus = channel; in mptspi_writeIOCPage4()
295 pReq->Header = IOCPage4Ptr->Header; in mptspi_writeIOCPage4()
296 pReq->PageAddress = cpu_to_le32(id | (channel << 8 )); in mptspi_writeIOCPage4()
301 (IOCPage4Ptr->Header.PageLength + ii) * 4; in mptspi_writeIOCPage4()
303 ioc->add_sge((char *)&pReq->PageBufferSGE, flagsLength, dataDma); in mptspi_writeIOCPage4()
307 ioc->name, IOCPage4Ptr->MaxSEP, IOCPage4Ptr->ActiveSEP, id, channel)); in mptspi_writeIOCPage4()
309 mpt_put_msg_frame(ioc->DoneCtx, ioc, mf); in mptspi_writeIOCPage4()
315 * mptspi_initTarget - Target, LUN alloc/free functionality.
335 if (sdev->inq_periph_qual != 0) in mptspi_initTarget()
341 vtarget->type = sdev->type; in mptspi_initTarget()
343 if ((sdev->type == TYPE_PROCESSOR) && (hd->ioc->spi_data.Saf_Te)) { in mptspi_initTarget()
344 /* Treat all Processors as SAF-TE if in mptspi_initTarget()
346 vtarget->tflags |= MPT_TARGET_FLAGS_SAF_TE_ISSUED; in mptspi_initTarget()
347 mptspi_writeIOCPage4(hd, vtarget->channel, vtarget->id); in mptspi_initTarget()
348 }else if ((sdev->type == TYPE_PROCESSOR) && in mptspi_initTarget()
349 !(vtarget->tflags & MPT_TARGET_FLAGS_SAF_TE_ISSUED )) { in mptspi_initTarget()
350 if (sdev->inquiry_len > 49 ) { in mptspi_initTarget()
351 if (sdev->inquiry[44] == 'S' && in mptspi_initTarget()
352 sdev->inquiry[45] == 'A' && in mptspi_initTarget()
353 sdev->inquiry[46] == 'F' && in mptspi_initTarget()
354 sdev->inquiry[47] == '-' && in mptspi_initTarget()
355 sdev->inquiry[48] == 'T' && in mptspi_initTarget()
356 sdev->inquiry[49] == 'E' ) { in mptspi_initTarget()
357 vtarget->tflags |= MPT_TARGET_FLAGS_SAF_TE_ISSUED; in mptspi_initTarget()
358 mptspi_writeIOCPage4(hd, vtarget->channel, vtarget->id); in mptspi_initTarget()
366 * mptspi_is_raid - Determines whether target is belonging to volume
371 * non-zero = true
379 MPT_ADAPTER *ioc = hd->ioc; in mptspi_is_raid()
381 if (!ioc->raid_data.pIocPg2) in mptspi_is_raid()
384 if (!ioc->raid_data.pIocPg2->NumActiveVolumes) in mptspi_is_raid()
386 for (i=0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++) { in mptspi_is_raid()
387 if (ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID == id) { in mptspi_is_raid()
399 struct Scsi_Host *shost = dev_to_shost(&starget->dev); in mptspi_target_alloc()
405 return -ENODEV; in mptspi_target_alloc()
407 ioc = hd->ioc; in mptspi_target_alloc()
410 return -ENOMEM; in mptspi_target_alloc()
412 vtarget->ioc_id = ioc->id; in mptspi_target_alloc()
413 vtarget->tflags = MPT_TARGET_FLAGS_Q_YES; in mptspi_target_alloc()
414 vtarget->id = (u8)starget->id; in mptspi_target_alloc()
415 vtarget->channel = (u8)starget->channel; in mptspi_target_alloc()
416 vtarget->starget = starget; in mptspi_target_alloc()
417 starget->hostdata = vtarget; in mptspi_target_alloc()
419 if (starget->channel == 1) { in mptspi_target_alloc()
420 if (mptscsih_is_phys_disk(ioc, 0, starget->id) == 0) in mptspi_target_alloc()
422 vtarget->tflags |= MPT_TARGET_FLAGS_RAID_COMPONENT; in mptspi_target_alloc()
424 vtarget->channel = 0; in mptspi_target_alloc()
426 vtarget->id = mptscsih_raid_id_to_num(ioc, 0, in mptspi_target_alloc()
427 starget->id); in mptspi_target_alloc()
430 if (starget->channel == 0 && in mptspi_target_alloc()
431 mptspi_is_raid(hd, starget->id)) { in mptspi_target_alloc()
432 vtarget->raidVolume = 1; in mptspi_target_alloc()
434 "RAID Volume @ channel=%d id=%d\n", ioc->name, starget->channel, in mptspi_target_alloc()
435 starget->id)); in mptspi_target_alloc()
438 if (ioc->spi_data.nvram && in mptspi_target_alloc()
439 ioc->spi_data.nvram[starget->id] != MPT_HOST_NVRAM_INVALID) { in mptspi_target_alloc()
440 u32 nvram = ioc->spi_data.nvram[starget->id]; in mptspi_target_alloc()
444 spi_min_period(starget) = ioc->spi_data.minSyncFactor; in mptspi_target_alloc()
445 spi_max_width(starget) = ioc->spi_data.maxBusWidth; in mptspi_target_alloc()
447 spi_max_offset(starget) = ioc->spi_data.maxSyncOffset; in mptspi_target_alloc()
459 kfree(starget->hostdata); in mptspi_target_destroy()
460 starget->hostdata = NULL; in mptspi_target_destroy()
464 * mptspi_print_write_nego - negotiation parameters debug info that is being sent
473 ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "id=%d Requested = 0x%08x" in mptspi_print_write_nego()
475 hd->ioc->name, starget->id, ii, in mptspi_print_write_nego()
489 * mptspi_print_read_nego - negotiation parameters debug info that is being read
498 ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "id=%d Read = 0x%08x" in mptspi_print_read_nego()
500 hd->ioc->name, starget->id, ii, in mptspi_print_read_nego()
516 struct Scsi_Host *shost = dev_to_shost(&starget->dev); in mptspi_read_spi_device_pg0()
518 struct _MPT_ADAPTER *ioc = hd->ioc; in mptspi_read_spi_device_pg0()
524 int err = -EBUSY; in mptspi_read_spi_device_pg0()
527 if (starget->channel == 0 && in mptspi_read_spi_device_pg0()
528 mptspi_is_raid(hd, starget->id)) in mptspi_read_spi_device_pg0()
529 return -1; in mptspi_read_spi_device_pg0()
531 size = ioc->spi_data.sdp0length * 4; in mptspi_read_spi_device_pg0()
533 if (ioc->spi_data.sdp0length & 1) in mptspi_read_spi_device_pg0()
538 spi_dev_pg0 = dma_alloc_coherent(&ioc->pcidev->dev, size, &spi_dev_pg0_dma, GFP_KERNEL); in mptspi_read_spi_device_pg0()
541 "dma_alloc_coherent for parameters failed\n", ioc->name); in mptspi_read_spi_device_pg0()
542 return -EINVAL; in mptspi_read_spi_device_pg0()
547 hdr.PageVersion = ioc->spi_data.sdp0version; in mptspi_read_spi_device_pg0()
548 hdr.PageLength = ioc->spi_data.sdp0length; in mptspi_read_spi_device_pg0()
558 cfg.pageAddr = starget->id; in mptspi_read_spi_device_pg0()
562 starget_printk(KERN_ERR, starget, MYIOC_s_FMT "mpt_config failed\n", ioc->name); in mptspi_read_spi_device_pg0()
568 mptspi_print_read_nego(hd, starget, le32_to_cpu(spi_dev_pg0->NegotiatedParameters)); in mptspi_read_spi_device_pg0()
571 dma_free_coherent(&ioc->pcidev->dev, size, spi_dev_pg0, spi_dev_pg0_dma); in mptspi_read_spi_device_pg0()
620 MPT_ADAPTER *ioc = hd->ioc; in mptscsih_quiesce_raid()
626 mutex_lock(&ioc->internal_cmds.mutex); in mptscsih_quiesce_raid()
630 if ((mf = mpt_get_msg_frame(ioc->InternalCtx, ioc)) == NULL) { in mptscsih_quiesce_raid()
631 dfailprintk(hd->ioc, printk(MYIOC_s_WARN_FMT in mptscsih_quiesce_raid()
632 "%s: no msg frames!\n", ioc->name, __func__)); in mptscsih_quiesce_raid()
633 ret = -EAGAIN; in mptscsih_quiesce_raid()
638 pReq->Action = MPI_RAID_ACTION_QUIESCE_PHYS_IO; in mptscsih_quiesce_raid()
640 pReq->Action = MPI_RAID_ACTION_ENABLE_PHYS_IO; in mptscsih_quiesce_raid()
641 pReq->Reserved1 = 0; in mptscsih_quiesce_raid()
642 pReq->ChainOffset = 0; in mptscsih_quiesce_raid()
643 pReq->Function = MPI_FUNCTION_RAID_ACTION; in mptscsih_quiesce_raid()
644 pReq->VolumeID = id; in mptscsih_quiesce_raid()
645 pReq->VolumeBus = channel; in mptscsih_quiesce_raid()
646 pReq->PhysDiskNum = 0; in mptscsih_quiesce_raid()
647 pReq->MsgFlags = 0; in mptscsih_quiesce_raid()
648 pReq->Reserved2 = 0; in mptscsih_quiesce_raid()
649 pReq->ActionDataWord = 0; /* Reserved for this action */ in mptscsih_quiesce_raid()
651 ioc->add_sge((char *)&pReq->ActionDataSGE, in mptscsih_quiesce_raid()
652 MPT_SGE_FLAGS_SSIMPLE_READ | 0, (dma_addr_t) -1); in mptscsih_quiesce_raid()
655 ioc->name, pReq->Action, channel, id)); in mptscsih_quiesce_raid()
657 INITIALIZE_MGMT_STATUS(ioc->internal_cmds.status) in mptscsih_quiesce_raid()
658 mpt_put_msg_frame(ioc->InternalCtx, ioc, mf); in mptscsih_quiesce_raid()
659 timeleft = wait_for_completion_timeout(&ioc->internal_cmds.done, 10*HZ); in mptscsih_quiesce_raid()
660 if (!(ioc->internal_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) { in mptscsih_quiesce_raid()
661 ret = -ETIME; in mptscsih_quiesce_raid()
663 ioc->name, __func__)); in mptscsih_quiesce_raid()
664 if (ioc->internal_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET) in mptscsih_quiesce_raid()
668 ioc->name, __func__); in mptscsih_quiesce_raid()
675 ret = ioc->internal_cmds.completion_code; in mptscsih_quiesce_raid()
678 CLEAR_MGMT_STATUS(ioc->internal_cmds.status) in mptscsih_quiesce_raid()
679 mutex_unlock(&ioc->internal_cmds.mutex); in mptscsih_quiesce_raid()
686 VirtTarget *vtarget = scsi_target(sdev)->hostdata; in mptspi_dv_device()
687 MPT_ADAPTER *ioc = hd->ioc; in mptspi_dv_device()
690 if (sdev->channel == 0 && in mptspi_dv_device()
691 mptspi_is_raid(hd, sdev->id)) in mptspi_dv_device()
695 if (sdev->channel == 1 && in mptspi_dv_device()
696 mptscsih_quiesce_raid(hd, 1, vtarget->channel, vtarget->id) < 0) { in mptspi_dv_device()
698 "Integrated RAID quiesce failed\n", ioc->name); in mptspi_dv_device()
702 hd->spi_pending |= (1 << sdev->id); in mptspi_dv_device()
704 hd->spi_pending &= ~(1 << sdev->id); in mptspi_dv_device()
706 if (sdev->channel == 1 && in mptspi_dv_device()
707 mptscsih_quiesce_raid(hd, 0, vtarget->channel, vtarget->id) < 0) in mptspi_dv_device()
709 "Integrated RAID resume failed\n", ioc->name); in mptspi_dv_device()
711 mptspi_read_parameters(sdev->sdev_target); in mptspi_dv_device()
712 spi_display_xfer_agreement(sdev->sdev_target); in mptspi_dv_device()
713 mptspi_read_parameters(sdev->sdev_target); in mptspi_dv_device()
718 MPT_SCSI_HOST *hd = shost_priv(sdev->host); in mptspi_sdev_init()
722 MPT_ADAPTER *ioc = hd->ioc; in mptspi_sdev_init()
724 if (sdev->channel == 1 && in mptspi_sdev_init()
725 mptscsih_is_phys_disk(ioc, 0, sdev->id) == 0) in mptspi_sdev_init()
726 return -ENXIO; in mptspi_sdev_init()
731 ioc->name, sizeof(VirtDevice)); in mptspi_sdev_init()
732 return -ENOMEM; in mptspi_sdev_init()
735 vdevice->lun = sdev->lun; in mptspi_sdev_init()
736 sdev->hostdata = vdevice; in mptspi_sdev_init()
739 vtarget = starget->hostdata; in mptspi_sdev_init()
740 vdevice->vtarget = vtarget; in mptspi_sdev_init()
741 vtarget->num_luns++; in mptspi_sdev_init()
743 if (sdev->channel == 1) in mptspi_sdev_init()
744 sdev->no_uld_attach = 1; in mptspi_sdev_init()
752 struct _MPT_SCSI_HOST *hd = shost_priv(sdev->host); in mptspi_sdev_configure()
753 VirtTarget *vtarget = scsi_target(sdev)->hostdata; in mptspi_sdev_configure()
763 ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "id=%d min_period=0x%02x" in mptspi_sdev_configure()
764 " max_offset=0x%02x max_width=%d\n", hd->ioc->name, in mptspi_sdev_configure()
765 sdev->id, spi_min_period(scsi_target(sdev)), in mptspi_sdev_configure()
769 if ((sdev->channel == 1 || in mptspi_sdev_configure()
770 !(mptspi_is_raid(hd, sdev->id))) && in mptspi_sdev_configure()
771 !spi_initial_dv(sdev->sdev_target)) in mptspi_sdev_configure()
781 VirtDevice *vdevice = SCpnt->device->hostdata; in mptspi_qcmd()
782 MPT_ADAPTER *ioc = hd->ioc; in mptspi_qcmd()
784 if (!vdevice || !vdevice->vtarget) { in mptspi_qcmd()
785 SCpnt->result = DID_NO_CONNECT << 16; in mptspi_qcmd()
790 if (SCpnt->device->channel == 1 && in mptspi_qcmd()
791 mptscsih_is_phys_disk(ioc, 0, SCpnt->device->id) == 0) { in mptspi_qcmd()
792 SCpnt->result = DID_NO_CONNECT << 16; in mptspi_qcmd()
797 if (spi_dv_pending(scsi_target(SCpnt->device))) in mptspi_qcmd()
806 VirtTarget *vtarget = starget->hostdata; in mptspi_sdev_destroy()
807 VirtDevice *vdevice = sdev->hostdata; in mptspi_sdev_destroy()
809 /* Will this be the last lun on a non-raid device? */ in mptspi_sdev_destroy()
810 if (vtarget->num_luns == 1 && vdevice->configured_lun) { in mptspi_sdev_destroy()
843 .this_id = -1,
854 struct Scsi_Host *shost = dev_to_shost(&starget->dev); in mptspi_write_spi_device_pg1()
856 struct _MPT_ADAPTER *ioc = hd->ioc; in mptspi_write_spi_device_pg1()
862 int err = -EBUSY; in mptspi_write_spi_device_pg1()
864 u32 period; in mptspi_write_spi_device_pg1() local
869 if (starget->channel == 0 && in mptspi_write_spi_device_pg1()
870 mptspi_is_raid(hd, starget->id)) in mptspi_write_spi_device_pg1()
871 return -1; in mptspi_write_spi_device_pg1()
873 size = ioc->spi_data.sdp1length * 4; in mptspi_write_spi_device_pg1()
875 pg1 = dma_alloc_coherent(&ioc->pcidev->dev, size, &pg1_dma, GFP_KERNEL); in mptspi_write_spi_device_pg1()
878 "dma_alloc_coherent for parameters failed\n", ioc->name); in mptspi_write_spi_device_pg1()
879 return -EINVAL; in mptspi_write_spi_device_pg1()
884 hdr.PageVersion = ioc->spi_data.sdp1version; in mptspi_write_spi_device_pg1()
885 hdr.PageLength = ioc->spi_data.sdp1length; in mptspi_write_spi_device_pg1()
895 cfg.pageAddr = starget->id; in mptspi_write_spi_device_pg1()
899 pg1->Header.PageVersion = hdr.PageVersion; in mptspi_write_spi_device_pg1()
900 pg1->Header.PageLength = hdr.PageLength; in mptspi_write_spi_device_pg1()
901 pg1->Header.PageNumber = hdr.PageNumber; in mptspi_write_spi_device_pg1()
902 pg1->Header.PageType = hdr.PageType; in mptspi_write_spi_device_pg1()
904 nego_parms = le32_to_cpu(pg1->RequestedParameters); in mptspi_write_spi_device_pg1()
905 period = (nego_parms & MPI_SCSIDEVPAGE1_RP_MIN_SYNC_PERIOD_MASK) >> in mptspi_write_spi_device_pg1()
907 if (period == 8) { in mptspi_write_spi_device_pg1()
911 if (sdev && sdev->type == TYPE_TAPE) { in mptspi_write_spi_device_pg1()
913 "IDP:ON\n", ioc->name); in mptspi_write_spi_device_pg1()
915 pg1->RequestedParameters = in mptspi_write_spi_device_pg1()
922 mptspi_print_write_nego(hd, starget, le32_to_cpu(pg1->RequestedParameters)); in mptspi_write_spi_device_pg1()
926 "mpt_config failed\n", ioc->name); in mptspi_write_spi_device_pg1()
932 dma_free_coherent(&ioc->pcidev->dev, size, pg1, pg1_dma); in mptspi_write_spi_device_pg1()
947 if (spi_offset(starget) == -1) in mptspi_write_offset()
961 static void mptspi_write_period(struct scsi_target *starget, int period) in mptspi_write_period() argument
966 if (period < 8) in mptspi_write_period()
967 period = 8; in mptspi_write_period()
969 if (period > 255) in mptspi_write_period()
970 period = 255; in mptspi_write_period()
972 if (spi_period(starget) == -1) in mptspi_write_period()
975 if (period == 8) { in mptspi_write_period()
978 } else if (period == 9) { in mptspi_write_period()
982 spi_period(starget) = period; in mptspi_write_period()
998 if (spi_period(starget) == -1) in mptspi_write_dt()
1021 if (spi_period(starget) == -1) in mptspi_write_iu()
1064 struct Scsi_Host *shost = dev_to_shost(&starget->dev); in MPTSPI_SIMPLE_TRANSPORT_PARM()
1066 VirtTarget *vtarget = starget->hostdata; in MPTSPI_SIMPLE_TRANSPORT_PARM()
1069 if ((vtarget->negoFlags & MPT_TARGET_NO_NEGO_QAS) || in MPTSPI_SIMPLE_TRANSPORT_PARM()
1070 hd->ioc->spi_data.noQas) in MPTSPI_SIMPLE_TRANSPORT_PARM()
1116 struct _MPT_SCSI_HOST *hd = wqw->hd; in mpt_work_wrapper()
1117 MPT_ADAPTER *ioc = hd->ioc; in mpt_work_wrapper()
1118 struct Scsi_Host *shost = ioc->sh; in mpt_work_wrapper()
1120 int disk = wqw->disk; in mpt_work_wrapper()
1126 pg3 = ioc->raid_data.pIocPg3; in mpt_work_wrapper()
1132 VirtTarget *vtarget = starget->hostdata; in mpt_work_wrapper()
1135 if (sdev->channel != 1) in mpt_work_wrapper()
1139 * starget->id is the actual target address */ in mpt_work_wrapper()
1140 if(vtarget->id != disk) in mpt_work_wrapper()
1143 starget_printk(KERN_INFO, vtarget->starget, MYIOC_s_FMT in mpt_work_wrapper()
1144 "Integrated RAID requests DV of new device\n", ioc->name); in mpt_work_wrapper()
1148 "Integrated RAID detects new device %d\n", ioc->name, disk); in mpt_work_wrapper()
1149 scsi_scan_target(&ioc->sh->shost_gendev, 1, disk, 0, SCSI_SCAN_RESCAN); in mpt_work_wrapper()
1156 MPT_ADAPTER *ioc = hd->ioc; in mpt_dv_raid()
1159 shost_printk(KERN_ERR, ioc->sh, MYIOC_s_FMT in mpt_dv_raid()
1161 ioc->name, disk); in mpt_dv_raid()
1164 INIT_WORK(&wqw->work, mpt_work_wrapper); in mpt_dv_raid()
1165 wqw->hd = hd; in mpt_dv_raid()
1166 wqw->disk = disk; in mpt_dv_raid()
1168 schedule_work(&wqw->work); in mpt_dv_raid()
1174 u8 event = le32_to_cpu(pEvReply->Event) & 0xFF; in mptspi_event_process()
1175 struct _MPT_SCSI_HOST *hd = shost_priv(ioc->sh); in mptspi_event_process()
1177 if (ioc->bus_type != SPI) in mptspi_event_process()
1182 = (le32_to_cpu(pEvReply->Data[0]) & 0x00FF0000) >> 16; in mptspi_event_process()
1185 int disk = (le32_to_cpu(pEvReply->Data[0]) & 0xFF000000) >> 24; in mptspi_event_process()
1196 (struct _MPT_SCSI_HOST *)dev_to_shost(starget->dev.parent)->hostdata; in mptspi_deny_binding()
1197 return ((mptspi_is_raid(hd, starget->id)) && in mptspi_deny_binding()
1198 starget->channel == 0) ? 1 : 0; in mptspi_deny_binding()
1262 struct _MPT_SCSI_HOST *hd = wqw->hd; in mptspi_dv_renegotiate_work()
1267 MPT_ADAPTER *ioc = hd->ioc; in mptspi_dv_renegotiate_work()
1271 if (hd->spi_pending) { in mptspi_dv_renegotiate_work()
1272 shost_for_each_device(sdev, ioc->sh) { in mptspi_dv_renegotiate_work()
1273 if (hd->spi_pending & (1 << sdev->id)) in mptspi_dv_renegotiate_work()
1283 shost_for_each_device(sdev, ioc->sh) in mptspi_dv_renegotiate_work()
1296 INIT_WORK(&wqw->work, mptspi_dv_renegotiate_work); in mptspi_dv_renegotiate()
1297 wqw->hd = hd; in mptspi_dv_renegotiate()
1299 schedule_work(&wqw->work); in mptspi_dv_renegotiate()
1311 if ((ioc->bus_type != SPI) || (!rc)) in mptspi_ioc_reset()
1315 * if we get an ioc fault on bringup, ioc->sh will be NULL */ in mptspi_ioc_reset()
1317 ioc->sh) { in mptspi_ioc_reset()
1318 struct _MPT_SCSI_HOST *hd = shost_priv(ioc->sh); in mptspi_ioc_reset()
1334 struct _MPT_SCSI_HOST *hd = shost_priv(ioc->sh); in mptspi_resume()
1344 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1345 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1347 * mptspi_probe - Installs scsi devices per bus.
1350 * Returns 0 for success, non-zero for failure.
1362 int scale; in mptspi_probe() local
1371 ioc->DoneCtx = mptspiDoneCtx; in mptspi_probe()
1372 ioc->TaskCtx = mptspiTaskCtx; in mptspi_probe()
1373 ioc->InternalCtx = mptspiInternalCtx; in mptspi_probe()
1377 if (ioc->last_state != MPI_IOC_STATE_OPERATIONAL) { in mptspi_probe()
1380 ioc->name); in mptspi_probe()
1381 error = -ENODEV; in mptspi_probe()
1385 if (!ioc->active) { in mptspi_probe()
1387 ioc->name); in mptspi_probe()
1388 error = -ENODEV; in mptspi_probe()
1392 /* Sanity check - ensure at least 1 port is INITIATOR capable in mptspi_probe()
1395 for (ii=0; ii < ioc->facts.NumberOfPorts; ii++) { in mptspi_probe()
1396 if (ioc->pfacts[ii].ProtocolFlags & in mptspi_probe()
1404 ioc->name, ioc); in mptspi_probe()
1413 ioc->name); in mptspi_probe()
1414 error = -1; in mptspi_probe()
1420 if (pdev->subsystem_vendor == 0x15AD) in mptspi_probe()
1421 sh->no_write_same = 1; in mptspi_probe()
1423 spin_lock_irqsave(&ioc->FreeQlock, flags); in mptspi_probe()
1427 ioc->sh = sh; in mptspi_probe()
1429 sh->io_port = 0; in mptspi_probe()
1430 sh->n_io_port = 0; in mptspi_probe()
1431 sh->irq = 0; in mptspi_probe()
1434 sh->max_cmd_len = 16; in mptspi_probe()
1438 * only scans target IDs 0-7! in mptspi_probe()
1439 * pfactsN->MaxDevices unreliable in mptspi_probe()
1446 sh->max_id = ioc->devices_per_bus; in mptspi_probe()
1448 sh->max_lun = MPT_LAST_LUN + 1; in mptspi_probe()
1452 if (ioc->ir_firmware) in mptspi_probe()
1453 sh->max_channel = 1; in mptspi_probe()
1455 sh->max_channel = 0; in mptspi_probe()
1456 sh->this_id = ioc->pfacts[0].PortSCSIID; in mptspi_probe()
1460 sh->unique_id = ioc->id; in mptspi_probe()
1466 * numSGE = 1 + (ZZ-1)*(maxChain -1) + ZZ in mptspi_probe()
1467 * + (req_sz - 64)/sizeof(SGE) in mptspi_probe()
1471 scale = ioc->req_sz/ioc->SGE_size; in mptspi_probe()
1472 if (ioc->sg_addr_size == sizeof(u64)) { in mptspi_probe()
1473 numSGE = (scale - 1) * in mptspi_probe()
1474 (ioc->facts.MaxChainDepth-1) + scale + in mptspi_probe()
1475 (ioc->req_sz - 60) / ioc->SGE_size; in mptspi_probe()
1477 numSGE = 1 + (scale - 1) * in mptspi_probe()
1478 (ioc->facts.MaxChainDepth-1) + scale + in mptspi_probe()
1479 (ioc->req_sz - 64) / ioc->SGE_size; in mptspi_probe()
1482 if (numSGE < sh->sg_tablesize) { in mptspi_probe()
1486 ioc->name, numSGE, sh->sg_tablesize)); in mptspi_probe()
1487 sh->sg_tablesize = numSGE; in mptspi_probe()
1490 spin_unlock_irqrestore(&ioc->FreeQlock, flags); in mptspi_probe()
1493 hd->ioc = ioc; in mptspi_probe()
1498 ioc->ScsiLookup = kcalloc(ioc->req_depth, sizeof(void *), GFP_KERNEL); in mptspi_probe()
1499 if (!ioc->ScsiLookup) { in mptspi_probe()
1500 error = -ENOMEM; in mptspi_probe()
1503 spin_lock_init(&ioc->scsi_lookup_lock); in mptspi_probe()
1506 ioc->name, ioc->ScsiLookup)); in mptspi_probe()
1508 ioc->spi_data.Saf_Te = mpt_saf_te; in mptspi_probe()
1511 ioc->name, in mptspi_probe()
1513 ioc->spi_data.noQas = 0; in mptspi_probe()
1515 hd->last_queue_full = 0; in mptspi_probe()
1516 hd->spi_pending = 0; in mptspi_probe()
1520 if (ioc->spi_data.sdp0length != 0) in mptspi_probe()
1521 sh->transportt = mptspi_transport_template; in mptspi_probe()
1523 error = scsi_add_host (sh, &ioc->pcidev->dev); in mptspi_probe()
1526 "scsi_add_host failed\n", ioc->name)); in mptspi_probe()
1533 if (ioc->spi_data.bus_reset) in mptspi_probe()
1551 scsi_remove_host(ioc->sh); in mptspi_remove()
1567 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1569 * mptspi_init - Register MPT adapter(s) as SCSI host(s) with SCSI mid-layer.
1571 * Returns 0 for success, non-zero for failure.
1582 return -ENODEV; in mptspi_init()
1601 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1602 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1604 * mptspi_exit - Unregisters MPT adapter(s)