]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - drivers/scsi/ipr.c
[SCSI] ipr: Simplify status area dumping
[mirror_ubuntu-zesty-kernel.git] / drivers / scsi / ipr.c
index 5890e5f92d820c6fcf6c18e983636933bc45d313..dd5c96239e06f83fce0fb85ca70332def020b027 100644 (file)
@@ -164,29 +164,6 @@ MODULE_PARM_DESC(auto_create, "Auto-create single device RAID 0 arrays when init
 MODULE_LICENSE("GPL");
 MODULE_VERSION(IPR_DRIVER_VERSION);
 
-static const char *ipr_gpdd_dev_end_states[] = {
-       "Command complete",
-       "Terminated by host",
-       "Terminated by device reset",
-       "Terminated by bus reset",
-       "Unknown",
-       "Command not started"
-};
-
-static const char *ipr_gpdd_dev_bus_phases[] = {
-       "Bus free",
-       "Arbitration",
-       "Selection",
-       "Message out",
-       "Command",
-       "Message in",
-       "Data out",
-       "Data in",
-       "Status",
-       "Reselection",
-       "Unknown"
-};
-
 /*  A constant array of IOASCs/URCs/Error Messages */
 static const
 struct ipr_error_table_t ipr_error_table[] = {
@@ -869,8 +846,8 @@ static void ipr_handle_config_change(struct ipr_ioa_cfg *ioa_cfg,
 
        if (hostrcb->hcam.notify_type == IPR_HOST_RCB_NOTIF_TYPE_REM_ENTRY) {
                if (res->sdev) {
-                       res->sdev->hostdata = NULL;
                        res->del_from_ml = 1;
+                       res->cfgte.res_handle = IPR_INVALID_RES_HANDLE;
                        if (ioa_cfg->allow_ml_add_del)
                                schedule_work(&ioa_cfg->work_q);
                } else
@@ -2107,7 +2084,6 @@ restart:
                                did_work = 1;
                                sdev = res->sdev;
                                if (!scsi_device_get(sdev)) {
-                                       res->sdev = NULL;
                                        list_move_tail(&res->queue, &ioa_cfg->free_res_q);
                                        spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
                                        scsi_remove_device(sdev);
@@ -2124,6 +2100,7 @@ restart:
                        bus = res->cfgte.res_addr.bus;
                        target = res->cfgte.res_addr.target;
                        lun = res->cfgte.res_addr.lun;
+                       res->add_to_ml = 0;
                        spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
                        scsi_add_device(ioa_cfg->host, bus, target, lun);
                        spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
@@ -3214,7 +3191,7 @@ static int ipr_slave_configure(struct scsi_device *sdev)
                        sdev->timeout = IPR_VSET_RW_TIMEOUT;
                        blk_queue_max_sectors(sdev->request_queue, IPR_VSET_MAX_SECTORS);
                }
-               if (IPR_IS_DASD_DEVICE(res->cfgte.std_inq_data))
+               if (ipr_is_vset_device(res) || ipr_is_scsi_disk(res))
                        sdev->allow_restart = 1;
                scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
        }
@@ -3938,6 +3915,7 @@ static void ipr_erp_cancel_all(struct ipr_cmnd *ipr_cmd)
  * ipr_dump_ioasa - Dump contents of IOASA
  * @ioa_cfg:   ioa config struct
  * @ipr_cmd:   ipr command struct
+ * @res:               resource entry struct
  *
  * This function is invoked by the interrupt handler when ops
  * fail. It will log the IOASA if appropriate. Only called
@@ -3947,7 +3925,7 @@ static void ipr_erp_cancel_all(struct ipr_cmnd *ipr_cmd)
  *     none
  **/
 static void ipr_dump_ioasa(struct ipr_ioa_cfg *ioa_cfg,
-                          struct ipr_cmnd *ipr_cmd)
+                          struct ipr_cmnd *ipr_cmd, struct ipr_resource_entry *res)
 {
        int i;
        u16 data_len;
@@ -3975,16 +3953,7 @@ static void ipr_dump_ioasa(struct ipr_ioa_cfg *ioa_cfg,
                        return;
        }
 
-       ipr_sdev_err(ipr_cmd->scsi_cmd->device, "%s\n",
-                    ipr_error_table[error_index].error);
-
-       if ((ioasa->u.gpdd.end_state <= ARRAY_SIZE(ipr_gpdd_dev_end_states)) &&
-           (ioasa->u.gpdd.bus_phase <=  ARRAY_SIZE(ipr_gpdd_dev_bus_phases))) {
-               ipr_sdev_err(ipr_cmd->scsi_cmd->device,
-                            "Device End state: %s Phase: %s\n",
-                            ipr_gpdd_dev_end_states[ioasa->u.gpdd.end_state],
-                            ipr_gpdd_dev_bus_phases[ioasa->u.gpdd.bus_phase]);
-       }
+       ipr_res_err(ioa_cfg, res, "%s\n", ipr_error_table[error_index].error);
 
        if (sizeof(struct ipr_ioasa) < be16_to_cpu(ioasa->ret_stat_len))
                data_len = sizeof(struct ipr_ioasa);
@@ -4141,7 +4110,7 @@ static void ipr_erp_start(struct ipr_ioa_cfg *ioa_cfg,
        }
 
        if (ipr_is_gscsi(res))
-               ipr_dump_ioasa(ioa_cfg, ipr_cmd);
+               ipr_dump_ioasa(ioa_cfg, ipr_cmd, res);
        else
                ipr_gen_sense(ipr_cmd);
 
@@ -4540,7 +4509,7 @@ static int ipr_set_supported_devs(struct ipr_cmnd *ipr_cmd)
        ipr_cmd->job_step = ipr_ioa_reset_done;
 
        list_for_each_entry_continue(res, &ioa_cfg->used_res_q, queue) {
-               if (!IPR_IS_DASD_DEVICE(res->cfgte.std_inq_data))
+               if (!ipr_is_scsi_disk(res))
                        continue;
 
                ipr_cmd->u.res = res;
@@ -4980,7 +4949,7 @@ static int ipr_init_res_table(struct ipr_cmnd *ipr_cmd)
        list_for_each_entry_safe(res, temp, &old_res, queue) {
                if (res->sdev) {
                        res->del_from_ml = 1;
-                       res->sdev->hostdata = NULL;
+                       res->cfgte.res_handle = IPR_INVALID_RES_HANDLE;
                        list_move_tail(&res->queue, &ioa_cfg->used_res_q);
                } else {
                        list_move_tail(&res->queue, &ioa_cfg->free_res_q);