Merge patch series "scsi: EH rework prep patches, part 1"
[linux-2.6-microblaze.git] / drivers / message / fusion / mptscsih.c
index 2bc1708..9080a73 100644 (file)
@@ -1793,7 +1793,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /**
- *     mptscsih_dev_reset - Perform a SCSI TARGET_RESET!  new_eh variant
+ *     mptscsih_dev_reset - Perform a SCSI LOGICAL_UNIT_RESET!
  *     @SCpnt: Pointer to scsi_cmnd structure, IO which reset is due to
  *
  *     (linux scsi_host_template.eh_dev_reset_handler routine)
@@ -1808,6 +1808,58 @@ mptscsih_dev_reset(struct scsi_cmnd * SCpnt)
        VirtDevice       *vdevice;
        MPT_ADAPTER     *ioc;
 
+       /* If we can't locate our host adapter structure, return FAILED status.
+        */
+       if ((hd = shost_priv(SCpnt->device->host)) == NULL){
+               printk(KERN_ERR MYNAM ": lun reset: "
+                  "Can't locate host! (sc=%p)\n", SCpnt);
+               return FAILED;
+       }
+
+       ioc = hd->ioc;
+       printk(MYIOC_s_INFO_FMT "attempting lun reset! (sc=%p)\n",
+              ioc->name, SCpnt);
+       scsi_print_command(SCpnt);
+
+       vdevice = SCpnt->device->hostdata;
+       if (!vdevice || !vdevice->vtarget) {
+               retval = 0;
+               goto out;
+       }
+
+       retval = mptscsih_IssueTaskMgmt(hd,
+                               MPI_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET,
+                               vdevice->vtarget->channel,
+                               vdevice->vtarget->id, vdevice->lun, 0,
+                               mptscsih_get_tm_timeout(ioc));
+
+ out:
+       printk (MYIOC_s_INFO_FMT "lun reset: %s (sc=%p)\n",
+           ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt);
+
+       if (retval == 0)
+               return SUCCESS;
+       else
+               return FAILED;
+}
+
+/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
+/**
+ *     mptscsih_target_reset - Perform a SCSI TARGET_RESET!
+ *     @SCpnt: Pointer to scsi_cmnd structure, IO which reset is due to
+ *
+ *     (linux scsi_host_template.eh_target_reset_handler routine)
+ *
+ *     Returns SUCCESS or FAILED.
+ **/
+int
+mptscsih_target_reset(struct scsi_cmnd * SCpnt)
+{
+       MPT_SCSI_HOST   *hd;
+       int              retval;
+       VirtDevice       *vdevice;
+       MPT_ADAPTER     *ioc;
+
        /* If we can't locate our host adapter structure, return FAILED status.
         */
        if ((hd = shost_priv(SCpnt->device->host)) == NULL){
@@ -3256,6 +3308,7 @@ EXPORT_SYMBOL(mptscsih_slave_destroy);
 EXPORT_SYMBOL(mptscsih_slave_configure);
 EXPORT_SYMBOL(mptscsih_abort);
 EXPORT_SYMBOL(mptscsih_dev_reset);
+EXPORT_SYMBOL(mptscsih_target_reset);
 EXPORT_SYMBOL(mptscsih_bus_reset);
 EXPORT_SYMBOL(mptscsih_host_reset);
 EXPORT_SYMBOL(mptscsih_bios_param);