isci: handle cases where a d2h fis is used report an ncq error
authorPiotr Sawicki <piotr.sawicki@intel.com>
Fri, 25 Feb 2011 21:07:38 +0000 (13:07 -0800)
committerDan Williams <dan.j.williams@intel.com>
Sun, 3 Jul 2011 10:55:29 +0000 (03:55 -0700)
Observed that some devices return a d2h fis, treat like an sdb error fis.

Signed-off-by: Piotr Sawicki <piotr.sawicki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/scsi/isci/core/scic_sds_stp_remote_device.c

index 1d8d9013068f7b5bd8499672f12269d7a45a6525..9a615f07cefe47af30ee4572773610e8ec359acd 100644 (file)
@@ -367,10 +367,27 @@ static enum sci_status scic_sds_stp_remote_device_ready_ncq_substate_frame_handl
                );
 
        if (status == SCI_SUCCESS) {
-               if (
-                       (frame_header->fis_type == SATA_FIS_TYPE_SETDEVBITS)
-                       && (frame_header->status & ATA_STATUS_REG_ERROR_BIT)
-                       ) {
+               if (frame_header->fis_type == SATA_FIS_TYPE_SETDEVBITS &&
+                   (frame_header->status & ATA_STATUS_REG_ERROR_BIT)) {
+                       this_device->not_ready_reason =
+                               SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED;
+
+                       /*
+                        * / @todo Check sactive and complete associated IO
+                        * if any.
+                        */
+
+                       sci_base_state_machine_change_state(
+                               &this_device->ready_substate_machine,
+                               SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR
+                               );
+               } else if (frame_header->fis_type == SATA_FIS_TYPE_REGD2H &&
+                          (frame_header->status & ATA_STATUS_REG_ERROR_BIT)) {
+
+                       /*
+                        * Some devices return D2H FIS when an NCQ error is detected.
+                        * Treat this like an SDB error FIS ready reason.
+                        */
                        this_device->not_ready_reason =
                                SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED;