aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci/remote_device.c
diff options
context:
space:
mode:
authorDave Jiang <dave.jiang@intel.com>2011-05-04 18:02:03 -0400
committerDan Williams <dan.j.williams@intel.com>2011-07-03 07:04:46 -0400
commite76d6180da436edf2cc3538cbed1f5b02b614613 (patch)
tree24892fa998bfb575eb71ab2fff7016fad3d423a9 /drivers/scsi/isci/remote_device.c
parentf2f300806fe186a6c45020a444667755edcce672 (diff)
isci: Convert ATA defines to Linux native defines
* Removing all intel_sata and intel_ata defines * Removing the usage of SAT_PROTOCOL_*. We can get everything from sas_task * Moved SATA FIS types to local sas.h. These defines will have to go into include/scsi/sas.h eventually. * Added offsets for SATA FIS header in order to grab the values Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci/remote_device.c')
-rw-r--r--drivers/scsi/isci/remote_device.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/scsi/isci/remote_device.c b/drivers/scsi/isci/remote_device.c
index a23ebe85773e..e766b27bdc19 100644
--- a/drivers/scsi/isci/remote_device.c
+++ b/drivers/scsi/isci/remote_device.c
@@ -53,7 +53,7 @@
53 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 53 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54 */ 54 */
55#include "intel_sas.h" 55#include "intel_sas.h"
56#include "intel_ata.h" 56#include "sas.h"
57#include "isci.h" 57#include "isci.h"
58#include "port.h" 58#include "port.h"
59#include "remote_device.h" 59#include "remote_device.h"
@@ -327,7 +327,7 @@ enum sci_status scic_sds_remote_device_frame_handler(struct scic_sds_remote_devi
327 break; 327 break;
328 } 328 }
329 case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ: { 329 case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ: {
330 struct sata_fis_header *hdr; 330 struct dev_to_host_fis *hdr;
331 331
332 status = scic_sds_unsolicited_frame_control_get_header(&scic->uf_control, 332 status = scic_sds_unsolicited_frame_control_get_header(&scic->uf_control,
333 frame_index, 333 frame_index,
@@ -335,14 +335,14 @@ enum sci_status scic_sds_remote_device_frame_handler(struct scic_sds_remote_devi
335 if (status != SCI_SUCCESS) 335 if (status != SCI_SUCCESS)
336 return status; 336 return status;
337 337
338 if (hdr->fis_type == SATA_FIS_TYPE_SETDEVBITS && 338 if (hdr->fis_type == FIS_SETDEVBITS &&
339 (hdr->status & ATA_STATUS_REG_ERROR_BIT)) { 339 (hdr->status & ATA_ERR)) {
340 sci_dev->not_ready_reason = SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED; 340 sci_dev->not_ready_reason = SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED;
341 341
342 /* TODO Check sactive and complete associated IO if any. */ 342 /* TODO Check sactive and complete associated IO if any. */
343 sci_base_state_machine_change_state(sm, SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR); 343 sci_base_state_machine_change_state(sm, SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR);
344 } else if (hdr->fis_type == SATA_FIS_TYPE_REGD2H && 344 } else if (hdr->fis_type == FIS_REGD2H &&
345 (hdr->status & ATA_STATUS_REG_ERROR_BIT)) { 345 (hdr->status & ATA_ERR)) {
346 /* 346 /*
347 * Some devices return D2H FIS when an NCQ error is detected. 347 * Some devices return D2H FIS when an NCQ error is detected.
348 * Treat this like an SDB error FIS ready reason. 348 * Treat this like an SDB error FIS ready reason.
@@ -469,6 +469,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic
469 struct sci_base_state_machine *sm = &sci_dev->state_machine; 469 struct sci_base_state_machine *sm = &sci_dev->state_machine;
470 enum scic_sds_remote_device_states state = sm->current_state_id; 470 enum scic_sds_remote_device_states state = sm->current_state_id;
471 struct scic_sds_port *sci_port = sci_dev->owning_port; 471 struct scic_sds_port *sci_port = sci_dev->owning_port;
472 struct isci_request *ireq = sci_req->ireq;
472 enum sci_status status; 473 enum sci_status status;
473 474
474 switch (state) { 475 switch (state) {
@@ -510,6 +511,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic
510 * substate. 511 * substate.
511 */ 512 */
512 enum scic_sds_remote_device_states new_state; 513 enum scic_sds_remote_device_states new_state;
514 struct sas_task *task = isci_request_access_task(ireq);
513 515
514 status = scic_sds_port_start_io(sci_port, sci_dev, sci_req); 516 status = scic_sds_port_start_io(sci_port, sci_dev, sci_req);
515 if (status != SCI_SUCCESS) 517 if (status != SCI_SUCCESS)
@@ -523,7 +525,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic
523 if (status != SCI_SUCCESS) 525 if (status != SCI_SUCCESS)
524 break; 526 break;
525 527
526 if (isci_sata_get_sat_protocol(sci_req->ireq) == SAT_PROTOCOL_FPDMA) 528 if (task->ata_task.use_ncq)
527 new_state = SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ; 529 new_state = SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ;
528 else { 530 else {
529 sci_dev->working_request = sci_req; 531 sci_dev->working_request = sci_req;
@@ -532,8 +534,10 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic
532 sci_base_state_machine_change_state(sm, new_state); 534 sci_base_state_machine_change_state(sm, new_state);
533 break; 535 break;
534 } 536 }
535 case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ: 537 case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ: {
536 if (isci_sata_get_sat_protocol(sci_req->ireq) == SAT_PROTOCOL_FPDMA) { 538 struct sas_task *task = isci_request_access_task(ireq);
539
540 if (task->ata_task.use_ncq) {
537 status = scic_sds_port_start_io(sci_port, sci_dev, sci_req); 541 status = scic_sds_port_start_io(sci_port, sci_dev, sci_req);
538 if (status != SCI_SUCCESS) 542 if (status != SCI_SUCCESS)
539 return status; 543 return status;
@@ -546,6 +550,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic
546 } else 550 } else
547 return SCI_FAILURE_INVALID_STATE; 551 return SCI_FAILURE_INVALID_STATE;
548 break; 552 break;
553 }
549 case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET: 554 case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET:
550 return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED; 555 return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED;
551 case SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE: 556 case SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE: