diff options
author | Dan Williams <dan.j.williams@intel.com> | 2011-06-30 20:38:32 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-07-03 07:04:52 -0400 |
commit | d9dcb4ba791de2a06b19ac47cd61601cf3d4e208 (patch) | |
tree | 4b818b5b14c078703c034489c92e74975be6c06f /drivers/scsi/isci/request.c | |
parent | 78a6f06e0e82125787d7aa308fe28c2c8381540c (diff) |
isci: unify isci_host and scic_sds_controller
Remove the distinction between these two implementations and unify on
isci_host (local instances named ihost). Hmmm, we had two
'oem_parameters' instances, one was unused... nice.
Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci/request.c')
-rw-r--r-- | drivers/scsi/isci/request.c | 200 |
1 files changed, 98 insertions, 102 deletions
diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c index 90ead662828d..36e674896bc5 100644 --- a/drivers/scsi/isci/request.c +++ b/drivers/scsi/isci/request.c | |||
@@ -74,19 +74,19 @@ static struct scu_sgl_element_pair *to_sgl_element_pair(struct isci_request *ire | |||
74 | return &ireq->sg_table[idx - 2]; | 74 | return &ireq->sg_table[idx - 2]; |
75 | } | 75 | } |
76 | 76 | ||
77 | static dma_addr_t to_sgl_element_pair_dma(struct scic_sds_controller *scic, | 77 | static dma_addr_t to_sgl_element_pair_dma(struct isci_host *ihost, |
78 | struct isci_request *ireq, u32 idx) | 78 | struct isci_request *ireq, u32 idx) |
79 | { | 79 | { |
80 | u32 offset; | 80 | u32 offset; |
81 | 81 | ||
82 | if (idx == 0) { | 82 | if (idx == 0) { |
83 | offset = (void *) &ireq->tc->sgl_pair_ab - | 83 | offset = (void *) &ireq->tc->sgl_pair_ab - |
84 | (void *) &scic->task_context_table[0]; | 84 | (void *) &ihost->task_context_table[0]; |
85 | return scic->task_context_dma + offset; | 85 | return ihost->task_context_dma + offset; |
86 | } else if (idx == 1) { | 86 | } else if (idx == 1) { |
87 | offset = (void *) &ireq->tc->sgl_pair_cd - | 87 | offset = (void *) &ireq->tc->sgl_pair_cd - |
88 | (void *) &scic->task_context_table[0]; | 88 | (void *) &ihost->task_context_table[0]; |
89 | return scic->task_context_dma + offset; | 89 | return ihost->task_context_dma + offset; |
90 | } | 90 | } |
91 | 91 | ||
92 | return scic_io_request_get_dma_addr(ireq, &ireq->sg_table[idx - 2]); | 92 | return scic_io_request_get_dma_addr(ireq, &ireq->sg_table[idx - 2]); |
@@ -102,8 +102,7 @@ static void init_sgl_element(struct scu_sgl_element *e, struct scatterlist *sg) | |||
102 | 102 | ||
103 | static void scic_sds_request_build_sgl(struct isci_request *ireq) | 103 | static void scic_sds_request_build_sgl(struct isci_request *ireq) |
104 | { | 104 | { |
105 | struct isci_host *isci_host = ireq->isci_host; | 105 | struct isci_host *ihost = ireq->isci_host; |
106 | struct scic_sds_controller *scic = &isci_host->sci; | ||
107 | struct sas_task *task = isci_request_access_task(ireq); | 106 | struct sas_task *task = isci_request_access_task(ireq); |
108 | struct scatterlist *sg = NULL; | 107 | struct scatterlist *sg = NULL; |
109 | dma_addr_t dma_addr; | 108 | dma_addr_t dma_addr; |
@@ -125,7 +124,7 @@ static void scic_sds_request_build_sgl(struct isci_request *ireq) | |||
125 | memset(&scu_sg->B, 0, sizeof(scu_sg->B)); | 124 | memset(&scu_sg->B, 0, sizeof(scu_sg->B)); |
126 | 125 | ||
127 | if (prev_sg) { | 126 | if (prev_sg) { |
128 | dma_addr = to_sgl_element_pair_dma(scic, | 127 | dma_addr = to_sgl_element_pair_dma(ihost, |
129 | ireq, | 128 | ireq, |
130 | sg_idx); | 129 | sg_idx); |
131 | 130 | ||
@@ -141,7 +140,7 @@ static void scic_sds_request_build_sgl(struct isci_request *ireq) | |||
141 | } else { /* handle when no sg */ | 140 | } else { /* handle when no sg */ |
142 | scu_sg = to_sgl_element_pair(ireq, sg_idx); | 141 | scu_sg = to_sgl_element_pair(ireq, sg_idx); |
143 | 142 | ||
144 | dma_addr = dma_map_single(&isci_host->pdev->dev, | 143 | dma_addr = dma_map_single(&ihost->pdev->dev, |
145 | task->scatter, | 144 | task->scatter, |
146 | task->total_xfer_len, | 145 | task->total_xfer_len, |
147 | task->data_dir); | 146 | task->data_dir); |
@@ -508,7 +507,7 @@ scic_io_request_construct_sata(struct isci_request *ireq, | |||
508 | scu_stp_raw_request_construct_task_context(ireq); | 507 | scu_stp_raw_request_construct_task_context(ireq); |
509 | return SCI_SUCCESS; | 508 | return SCI_SUCCESS; |
510 | } else { | 509 | } else { |
511 | dev_err(scic_to_dev(ireq->owning_controller), | 510 | dev_err(&ireq->owning_controller->pdev->dev, |
512 | "%s: Request 0x%p received un-handled SAT " | 511 | "%s: Request 0x%p received un-handled SAT " |
513 | "management protocol 0x%x.\n", | 512 | "management protocol 0x%x.\n", |
514 | __func__, ireq, tmf->tmf_code); | 513 | __func__, ireq, tmf->tmf_code); |
@@ -518,7 +517,7 @@ scic_io_request_construct_sata(struct isci_request *ireq, | |||
518 | } | 517 | } |
519 | 518 | ||
520 | if (!sas_protocol_ata(task->task_proto)) { | 519 | if (!sas_protocol_ata(task->task_proto)) { |
521 | dev_err(scic_to_dev(ireq->owning_controller), | 520 | dev_err(&ireq->owning_controller->pdev->dev, |
522 | "%s: Non-ATA protocol in SATA path: 0x%x\n", | 521 | "%s: Non-ATA protocol in SATA path: 0x%x\n", |
523 | __func__, | 522 | __func__, |
524 | task->task_proto); | 523 | task->task_proto); |
@@ -616,7 +615,7 @@ enum sci_status scic_task_request_construct_sata(struct isci_request *ireq) | |||
616 | tmf->tmf_code == isci_tmf_sata_srst_low) { | 615 | tmf->tmf_code == isci_tmf_sata_srst_low) { |
617 | scu_stp_raw_request_construct_task_context(ireq); | 616 | scu_stp_raw_request_construct_task_context(ireq); |
618 | } else { | 617 | } else { |
619 | dev_err(scic_to_dev(ireq->owning_controller), | 618 | dev_err(&ireq->owning_controller->pdev->dev, |
620 | "%s: Request 0x%p received un-handled SAT " | 619 | "%s: Request 0x%p received un-handled SAT " |
621 | "Protocol 0x%x.\n", | 620 | "Protocol 0x%x.\n", |
622 | __func__, ireq, tmf->tmf_code); | 621 | __func__, ireq, tmf->tmf_code); |
@@ -639,11 +638,11 @@ enum sci_status scic_task_request_construct_sata(struct isci_request *ireq) | |||
639 | #define SCU_TASK_CONTEXT_SRAM 0x200000 | 638 | #define SCU_TASK_CONTEXT_SRAM 0x200000 |
640 | static u32 sci_req_tx_bytes(struct isci_request *ireq) | 639 | static u32 sci_req_tx_bytes(struct isci_request *ireq) |
641 | { | 640 | { |
642 | struct scic_sds_controller *scic = ireq->owning_controller; | 641 | struct isci_host *ihost = ireq->owning_controller; |
643 | u32 ret_val = 0; | 642 | u32 ret_val = 0; |
644 | 643 | ||
645 | if (readl(&scic->smu_registers->address_modifier) == 0) { | 644 | if (readl(&ihost->smu_registers->address_modifier) == 0) { |
646 | void __iomem *scu_reg_base = scic->scu_registers; | 645 | void __iomem *scu_reg_base = ihost->scu_registers; |
647 | 646 | ||
648 | /* get the bytes of data from the Address == BAR1 + 20002Ch + (256*TCi) where | 647 | /* get the bytes of data from the Address == BAR1 + 20002Ch + (256*TCi) where |
649 | * BAR1 is the scu_registers | 648 | * BAR1 is the scu_registers |
@@ -663,11 +662,11 @@ enum sci_status scic_sds_request_start(struct isci_request *ireq) | |||
663 | { | 662 | { |
664 | enum sci_base_request_states state; | 663 | enum sci_base_request_states state; |
665 | struct scu_task_context *tc = ireq->tc; | 664 | struct scu_task_context *tc = ireq->tc; |
666 | struct scic_sds_controller *scic = ireq->owning_controller; | 665 | struct isci_host *ihost = ireq->owning_controller; |
667 | 666 | ||
668 | state = ireq->sm.current_state_id; | 667 | state = ireq->sm.current_state_id; |
669 | if (state != SCI_REQ_CONSTRUCTED) { | 668 | if (state != SCI_REQ_CONSTRUCTED) { |
670 | dev_warn(scic_to_dev(scic), | 669 | dev_warn(&ihost->pdev->dev, |
671 | "%s: SCIC IO Request requested to start while in wrong " | 670 | "%s: SCIC IO Request requested to start while in wrong " |
672 | "state %d\n", __func__, state); | 671 | "state %d\n", __func__, state); |
673 | return SCI_FAILURE_INVALID_STATE; | 672 | return SCI_FAILURE_INVALID_STATE; |
@@ -749,7 +748,7 @@ scic_sds_io_request_terminate(struct isci_request *ireq) | |||
749 | return SCI_SUCCESS; | 748 | return SCI_SUCCESS; |
750 | case SCI_REQ_COMPLETED: | 749 | case SCI_REQ_COMPLETED: |
751 | default: | 750 | default: |
752 | dev_warn(scic_to_dev(ireq->owning_controller), | 751 | dev_warn(&ireq->owning_controller->pdev->dev, |
753 | "%s: SCIC IO Request requested to abort while in wrong " | 752 | "%s: SCIC IO Request requested to abort while in wrong " |
754 | "state %d\n", | 753 | "state %d\n", |
755 | __func__, | 754 | __func__, |
@@ -763,7 +762,7 @@ scic_sds_io_request_terminate(struct isci_request *ireq) | |||
763 | enum sci_status scic_sds_request_complete(struct isci_request *ireq) | 762 | enum sci_status scic_sds_request_complete(struct isci_request *ireq) |
764 | { | 763 | { |
765 | enum sci_base_request_states state; | 764 | enum sci_base_request_states state; |
766 | struct scic_sds_controller *scic = ireq->owning_controller; | 765 | struct isci_host *ihost = ireq->owning_controller; |
767 | 766 | ||
768 | state = ireq->sm.current_state_id; | 767 | state = ireq->sm.current_state_id; |
769 | if (WARN_ONCE(state != SCI_REQ_COMPLETED, | 768 | if (WARN_ONCE(state != SCI_REQ_COMPLETED, |
@@ -771,7 +770,7 @@ enum sci_status scic_sds_request_complete(struct isci_request *ireq) | |||
771 | return SCI_FAILURE_INVALID_STATE; | 770 | return SCI_FAILURE_INVALID_STATE; |
772 | 771 | ||
773 | if (ireq->saved_rx_frame_index != SCU_INVALID_FRAME_INDEX) | 772 | if (ireq->saved_rx_frame_index != SCU_INVALID_FRAME_INDEX) |
774 | scic_sds_controller_release_frame(scic, | 773 | scic_sds_controller_release_frame(ihost, |
775 | ireq->saved_rx_frame_index); | 774 | ireq->saved_rx_frame_index); |
776 | 775 | ||
777 | /* XXX can we just stop the machine and remove the 'final' state? */ | 776 | /* XXX can we just stop the machine and remove the 'final' state? */ |
@@ -783,12 +782,12 @@ enum sci_status scic_sds_io_request_event_handler(struct isci_request *ireq, | |||
783 | u32 event_code) | 782 | u32 event_code) |
784 | { | 783 | { |
785 | enum sci_base_request_states state; | 784 | enum sci_base_request_states state; |
786 | struct scic_sds_controller *scic = ireq->owning_controller; | 785 | struct isci_host *ihost = ireq->owning_controller; |
787 | 786 | ||
788 | state = ireq->sm.current_state_id; | 787 | state = ireq->sm.current_state_id; |
789 | 788 | ||
790 | if (state != SCI_REQ_STP_PIO_DATA_IN) { | 789 | if (state != SCI_REQ_STP_PIO_DATA_IN) { |
791 | dev_warn(scic_to_dev(scic), "%s: (%x) in wrong state %d\n", | 790 | dev_warn(&ihost->pdev->dev, "%s: (%x) in wrong state %d\n", |
792 | __func__, event_code, state); | 791 | __func__, event_code, state); |
793 | 792 | ||
794 | return SCI_FAILURE_INVALID_STATE; | 793 | return SCI_FAILURE_INVALID_STATE; |
@@ -802,7 +801,7 @@ enum sci_status scic_sds_io_request_event_handler(struct isci_request *ireq, | |||
802 | sci_change_state(&ireq->sm, SCI_REQ_STP_PIO_WAIT_FRAME); | 801 | sci_change_state(&ireq->sm, SCI_REQ_STP_PIO_WAIT_FRAME); |
803 | return SCI_SUCCESS; | 802 | return SCI_SUCCESS; |
804 | default: | 803 | default: |
805 | dev_err(scic_to_dev(scic), | 804 | dev_err(&ihost->pdev->dev, |
806 | "%s: pio request unexpected event %#x\n", | 805 | "%s: pio request unexpected event %#x\n", |
807 | __func__, event_code); | 806 | __func__, event_code); |
808 | 807 | ||
@@ -1024,7 +1023,7 @@ static enum sci_status ssp_task_request_await_tc_event(struct isci_request *ireq | |||
1024 | * There is a potential for receiving multiple task responses if | 1023 | * There is a potential for receiving multiple task responses if |
1025 | * we decide to send the task IU again. | 1024 | * we decide to send the task IU again. |
1026 | */ | 1025 | */ |
1027 | dev_warn(scic_to_dev(ireq->owning_controller), | 1026 | dev_warn(&ireq->owning_controller->pdev->dev, |
1028 | "%s: TaskRequest:0x%p CompletionCode:%x - " | 1027 | "%s: TaskRequest:0x%p CompletionCode:%x - " |
1029 | "ACK/NAK timeout\n", __func__, ireq, | 1028 | "ACK/NAK timeout\n", __func__, ireq, |
1030 | completion_code); | 1029 | completion_code); |
@@ -1073,7 +1072,7 @@ smp_request_await_response_tc_event(struct isci_request *ireq, | |||
1073 | * response within 2 ms. This causes our hardware break | 1072 | * response within 2 ms. This causes our hardware break |
1074 | * the connection and set TC completion with one of | 1073 | * the connection and set TC completion with one of |
1075 | * these SMP_XXX_XX_ERR status. For these type of error, | 1074 | * these SMP_XXX_XX_ERR status. For these type of error, |
1076 | * we ask scic user to retry the request. | 1075 | * we ask ihost user to retry the request. |
1077 | */ | 1076 | */ |
1078 | scic_sds_request_set_status(ireq, SCU_TASK_DONE_SMP_RESP_TO_ERR, | 1077 | scic_sds_request_set_status(ireq, SCU_TASK_DONE_SMP_RESP_TO_ERR, |
1079 | SCI_FAILURE_RETRY_REQUIRED); | 1078 | SCI_FAILURE_RETRY_REQUIRED); |
@@ -1451,18 +1450,18 @@ static void scic_sds_stp_request_udma_complete_request( | |||
1451 | static enum sci_status scic_sds_stp_request_udma_general_frame_handler(struct isci_request *ireq, | 1450 | static enum sci_status scic_sds_stp_request_udma_general_frame_handler(struct isci_request *ireq, |
1452 | u32 frame_index) | 1451 | u32 frame_index) |
1453 | { | 1452 | { |
1454 | struct scic_sds_controller *scic = ireq->owning_controller; | 1453 | struct isci_host *ihost = ireq->owning_controller; |
1455 | struct dev_to_host_fis *frame_header; | 1454 | struct dev_to_host_fis *frame_header; |
1456 | enum sci_status status; | 1455 | enum sci_status status; |
1457 | u32 *frame_buffer; | 1456 | u32 *frame_buffer; |
1458 | 1457 | ||
1459 | status = scic_sds_unsolicited_frame_control_get_header(&scic->uf_control, | 1458 | status = scic_sds_unsolicited_frame_control_get_header(&ihost->uf_control, |
1460 | frame_index, | 1459 | frame_index, |
1461 | (void **)&frame_header); | 1460 | (void **)&frame_header); |
1462 | 1461 | ||
1463 | if ((status == SCI_SUCCESS) && | 1462 | if ((status == SCI_SUCCESS) && |
1464 | (frame_header->fis_type == FIS_REGD2H)) { | 1463 | (frame_header->fis_type == FIS_REGD2H)) { |
1465 | scic_sds_unsolicited_frame_control_get_buffer(&scic->uf_control, | 1464 | scic_sds_unsolicited_frame_control_get_buffer(&ihost->uf_control, |
1466 | frame_index, | 1465 | frame_index, |
1467 | (void **)&frame_buffer); | 1466 | (void **)&frame_buffer); |
1468 | 1467 | ||
@@ -1471,7 +1470,7 @@ static enum sci_status scic_sds_stp_request_udma_general_frame_handler(struct is | |||
1471 | frame_buffer); | 1470 | frame_buffer); |
1472 | } | 1471 | } |
1473 | 1472 | ||
1474 | scic_sds_controller_release_frame(scic, frame_index); | 1473 | scic_sds_controller_release_frame(ihost, frame_index); |
1475 | 1474 | ||
1476 | return status; | 1475 | return status; |
1477 | } | 1476 | } |
@@ -1480,7 +1479,7 @@ enum sci_status | |||
1480 | scic_sds_io_request_frame_handler(struct isci_request *ireq, | 1479 | scic_sds_io_request_frame_handler(struct isci_request *ireq, |
1481 | u32 frame_index) | 1480 | u32 frame_index) |
1482 | { | 1481 | { |
1483 | struct scic_sds_controller *scic = ireq->owning_controller; | 1482 | struct isci_host *ihost = ireq->owning_controller; |
1484 | struct isci_stp_request *stp_req = &ireq->stp.req; | 1483 | struct isci_stp_request *stp_req = &ireq->stp.req; |
1485 | enum sci_base_request_states state; | 1484 | enum sci_base_request_states state; |
1486 | enum sci_status status; | 1485 | enum sci_status status; |
@@ -1492,7 +1491,7 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1492 | struct ssp_frame_hdr ssp_hdr; | 1491 | struct ssp_frame_hdr ssp_hdr; |
1493 | void *frame_header; | 1492 | void *frame_header; |
1494 | 1493 | ||
1495 | scic_sds_unsolicited_frame_control_get_header(&scic->uf_control, | 1494 | scic_sds_unsolicited_frame_control_get_header(&ihost->uf_control, |
1496 | frame_index, | 1495 | frame_index, |
1497 | &frame_header); | 1496 | &frame_header); |
1498 | 1497 | ||
@@ -1503,7 +1502,7 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1503 | struct ssp_response_iu *resp_iu; | 1502 | struct ssp_response_iu *resp_iu; |
1504 | ssize_t word_cnt = SSP_RESP_IU_MAX_SIZE / sizeof(u32); | 1503 | ssize_t word_cnt = SSP_RESP_IU_MAX_SIZE / sizeof(u32); |
1505 | 1504 | ||
1506 | scic_sds_unsolicited_frame_control_get_buffer(&scic->uf_control, | 1505 | scic_sds_unsolicited_frame_control_get_buffer(&ihost->uf_control, |
1507 | frame_index, | 1506 | frame_index, |
1508 | (void **)&resp_iu); | 1507 | (void **)&resp_iu); |
1509 | 1508 | ||
@@ -1522,7 +1521,7 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1522 | SCI_SUCCESS); | 1521 | SCI_SUCCESS); |
1523 | } else { | 1522 | } else { |
1524 | /* not a response frame, why did it get forwarded? */ | 1523 | /* not a response frame, why did it get forwarded? */ |
1525 | dev_err(scic_to_dev(scic), | 1524 | dev_err(&ihost->pdev->dev, |
1526 | "%s: SCIC IO Request 0x%p received unexpected " | 1525 | "%s: SCIC IO Request 0x%p received unexpected " |
1527 | "frame %d type 0x%02x\n", __func__, ireq, | 1526 | "frame %d type 0x%02x\n", __func__, ireq, |
1528 | frame_index, ssp_hdr.frame_type); | 1527 | frame_index, ssp_hdr.frame_type); |
@@ -1532,7 +1531,7 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1532 | * In any case we are done with this frame buffer return it to | 1531 | * In any case we are done with this frame buffer return it to |
1533 | * the controller | 1532 | * the controller |
1534 | */ | 1533 | */ |
1535 | scic_sds_controller_release_frame(scic, frame_index); | 1534 | scic_sds_controller_release_frame(ihost, frame_index); |
1536 | 1535 | ||
1537 | return SCI_SUCCESS; | 1536 | return SCI_SUCCESS; |
1538 | } | 1537 | } |
@@ -1540,14 +1539,14 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1540 | case SCI_REQ_TASK_WAIT_TC_RESP: | 1539 | case SCI_REQ_TASK_WAIT_TC_RESP: |
1541 | scic_sds_io_request_copy_response(ireq); | 1540 | scic_sds_io_request_copy_response(ireq); |
1542 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 1541 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
1543 | scic_sds_controller_release_frame(scic,frame_index); | 1542 | scic_sds_controller_release_frame(ihost,frame_index); |
1544 | return SCI_SUCCESS; | 1543 | return SCI_SUCCESS; |
1545 | 1544 | ||
1546 | case SCI_REQ_SMP_WAIT_RESP: { | 1545 | case SCI_REQ_SMP_WAIT_RESP: { |
1547 | struct smp_resp *rsp_hdr = &ireq->smp.rsp; | 1546 | struct smp_resp *rsp_hdr = &ireq->smp.rsp; |
1548 | void *frame_header; | 1547 | void *frame_header; |
1549 | 1548 | ||
1550 | scic_sds_unsolicited_frame_control_get_header(&scic->uf_control, | 1549 | scic_sds_unsolicited_frame_control_get_header(&ihost->uf_control, |
1551 | frame_index, | 1550 | frame_index, |
1552 | &frame_header); | 1551 | &frame_header); |
1553 | 1552 | ||
@@ -1558,7 +1557,7 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1558 | if (rsp_hdr->frame_type == SMP_RESPONSE) { | 1557 | if (rsp_hdr->frame_type == SMP_RESPONSE) { |
1559 | void *smp_resp; | 1558 | void *smp_resp; |
1560 | 1559 | ||
1561 | scic_sds_unsolicited_frame_control_get_buffer(&scic->uf_control, | 1560 | scic_sds_unsolicited_frame_control_get_buffer(&ihost->uf_control, |
1562 | frame_index, | 1561 | frame_index, |
1563 | &smp_resp); | 1562 | &smp_resp); |
1564 | 1563 | ||
@@ -1577,7 +1576,7 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1577 | * This was not a response frame why did it get | 1576 | * This was not a response frame why did it get |
1578 | * forwarded? | 1577 | * forwarded? |
1579 | */ | 1578 | */ |
1580 | dev_err(scic_to_dev(scic), | 1579 | dev_err(&ihost->pdev->dev, |
1581 | "%s: SCIC SMP Request 0x%p received unexpected " | 1580 | "%s: SCIC SMP Request 0x%p received unexpected " |
1582 | "frame %d type 0x%02x\n", | 1581 | "frame %d type 0x%02x\n", |
1583 | __func__, | 1582 | __func__, |
@@ -1592,7 +1591,7 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1592 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 1591 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
1593 | } | 1592 | } |
1594 | 1593 | ||
1595 | scic_sds_controller_release_frame(scic, frame_index); | 1594 | scic_sds_controller_release_frame(ihost, frame_index); |
1596 | 1595 | ||
1597 | return SCI_SUCCESS; | 1596 | return SCI_SUCCESS; |
1598 | } | 1597 | } |
@@ -1619,12 +1618,12 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1619 | struct dev_to_host_fis *frame_header; | 1618 | struct dev_to_host_fis *frame_header; |
1620 | u32 *frame_buffer; | 1619 | u32 *frame_buffer; |
1621 | 1620 | ||
1622 | status = scic_sds_unsolicited_frame_control_get_header(&scic->uf_control, | 1621 | status = scic_sds_unsolicited_frame_control_get_header(&ihost->uf_control, |
1623 | frame_index, | 1622 | frame_index, |
1624 | (void **)&frame_header); | 1623 | (void **)&frame_header); |
1625 | 1624 | ||
1626 | if (status != SCI_SUCCESS) { | 1625 | if (status != SCI_SUCCESS) { |
1627 | dev_err(scic_to_dev(scic), | 1626 | dev_err(&ihost->pdev->dev, |
1628 | "%s: SCIC IO Request 0x%p could not get frame " | 1627 | "%s: SCIC IO Request 0x%p could not get frame " |
1629 | "header for frame index %d, status %x\n", | 1628 | "header for frame index %d, status %x\n", |
1630 | __func__, | 1629 | __func__, |
@@ -1637,7 +1636,7 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1637 | 1636 | ||
1638 | switch (frame_header->fis_type) { | 1637 | switch (frame_header->fis_type) { |
1639 | case FIS_REGD2H: | 1638 | case FIS_REGD2H: |
1640 | scic_sds_unsolicited_frame_control_get_buffer(&scic->uf_control, | 1639 | scic_sds_unsolicited_frame_control_get_buffer(&ihost->uf_control, |
1641 | frame_index, | 1640 | frame_index, |
1642 | (void **)&frame_buffer); | 1641 | (void **)&frame_buffer); |
1643 | 1642 | ||
@@ -1651,7 +1650,7 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1651 | break; | 1650 | break; |
1652 | 1651 | ||
1653 | default: | 1652 | default: |
1654 | dev_warn(scic_to_dev(scic), | 1653 | dev_warn(&ihost->pdev->dev, |
1655 | "%s: IO Request:0x%p Frame Id:%d protocol " | 1654 | "%s: IO Request:0x%p Frame Id:%d protocol " |
1656 | "violation occurred\n", __func__, stp_req, | 1655 | "violation occurred\n", __func__, stp_req, |
1657 | frame_index); | 1656 | frame_index); |
@@ -1664,7 +1663,7 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1664 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 1663 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
1665 | 1664 | ||
1666 | /* Frame has been decoded return it to the controller */ | 1665 | /* Frame has been decoded return it to the controller */ |
1667 | scic_sds_controller_release_frame(scic, frame_index); | 1666 | scic_sds_controller_release_frame(ihost, frame_index); |
1668 | 1667 | ||
1669 | return status; | 1668 | return status; |
1670 | } | 1669 | } |
@@ -1674,12 +1673,12 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1674 | struct dev_to_host_fis *frame_header; | 1673 | struct dev_to_host_fis *frame_header; |
1675 | u32 *frame_buffer; | 1674 | u32 *frame_buffer; |
1676 | 1675 | ||
1677 | status = scic_sds_unsolicited_frame_control_get_header(&scic->uf_control, | 1676 | status = scic_sds_unsolicited_frame_control_get_header(&ihost->uf_control, |
1678 | frame_index, | 1677 | frame_index, |
1679 | (void **)&frame_header); | 1678 | (void **)&frame_header); |
1680 | 1679 | ||
1681 | if (status != SCI_SUCCESS) { | 1680 | if (status != SCI_SUCCESS) { |
1682 | dev_err(scic_to_dev(scic), | 1681 | dev_err(&ihost->pdev->dev, |
1683 | "%s: SCIC IO Request 0x%p could not get frame " | 1682 | "%s: SCIC IO Request 0x%p could not get frame " |
1684 | "header for frame index %d, status %x\n", | 1683 | "header for frame index %d, status %x\n", |
1685 | __func__, stp_req, frame_index, status); | 1684 | __func__, stp_req, frame_index, status); |
@@ -1689,7 +1688,7 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1689 | switch (frame_header->fis_type) { | 1688 | switch (frame_header->fis_type) { |
1690 | case FIS_PIO_SETUP: | 1689 | case FIS_PIO_SETUP: |
1691 | /* Get from the frame buffer the PIO Setup Data */ | 1690 | /* Get from the frame buffer the PIO Setup Data */ |
1692 | scic_sds_unsolicited_frame_control_get_buffer(&scic->uf_control, | 1691 | scic_sds_unsolicited_frame_control_get_buffer(&ihost->uf_control, |
1693 | frame_index, | 1692 | frame_index, |
1694 | (void **)&frame_buffer); | 1693 | (void **)&frame_buffer); |
1695 | 1694 | ||
@@ -1736,7 +1735,7 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1736 | * FIS when it is still busy? Do nothing since | 1735 | * FIS when it is still busy? Do nothing since |
1737 | * we are still in the right state. | 1736 | * we are still in the right state. |
1738 | */ | 1737 | */ |
1739 | dev_dbg(scic_to_dev(scic), | 1738 | dev_dbg(&ihost->pdev->dev, |
1740 | "%s: SCIC PIO Request 0x%p received " | 1739 | "%s: SCIC PIO Request 0x%p received " |
1741 | "D2H Register FIS with BSY status " | 1740 | "D2H Register FIS with BSY status " |
1742 | "0x%x\n", | 1741 | "0x%x\n", |
@@ -1746,7 +1745,7 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1746 | break; | 1745 | break; |
1747 | } | 1746 | } |
1748 | 1747 | ||
1749 | scic_sds_unsolicited_frame_control_get_buffer(&scic->uf_control, | 1748 | scic_sds_unsolicited_frame_control_get_buffer(&ihost->uf_control, |
1750 | frame_index, | 1749 | frame_index, |
1751 | (void **)&frame_buffer); | 1750 | (void **)&frame_buffer); |
1752 | 1751 | ||
@@ -1767,7 +1766,7 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1767 | } | 1766 | } |
1768 | 1767 | ||
1769 | /* Frame is decoded return it to the controller */ | 1768 | /* Frame is decoded return it to the controller */ |
1770 | scic_sds_controller_release_frame(scic, frame_index); | 1769 | scic_sds_controller_release_frame(ihost, frame_index); |
1771 | 1770 | ||
1772 | return status; | 1771 | return status; |
1773 | } | 1772 | } |
@@ -1776,12 +1775,12 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1776 | struct dev_to_host_fis *frame_header; | 1775 | struct dev_to_host_fis *frame_header; |
1777 | struct sata_fis_data *frame_buffer; | 1776 | struct sata_fis_data *frame_buffer; |
1778 | 1777 | ||
1779 | status = scic_sds_unsolicited_frame_control_get_header(&scic->uf_control, | 1778 | status = scic_sds_unsolicited_frame_control_get_header(&ihost->uf_control, |
1780 | frame_index, | 1779 | frame_index, |
1781 | (void **)&frame_header); | 1780 | (void **)&frame_header); |
1782 | 1781 | ||
1783 | if (status != SCI_SUCCESS) { | 1782 | if (status != SCI_SUCCESS) { |
1784 | dev_err(scic_to_dev(scic), | 1783 | dev_err(&ihost->pdev->dev, |
1785 | "%s: SCIC IO Request 0x%p could not get frame " | 1784 | "%s: SCIC IO Request 0x%p could not get frame " |
1786 | "header for frame index %d, status %x\n", | 1785 | "header for frame index %d, status %x\n", |
1787 | __func__, | 1786 | __func__, |
@@ -1792,7 +1791,7 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1792 | } | 1791 | } |
1793 | 1792 | ||
1794 | if (frame_header->fis_type != FIS_DATA) { | 1793 | if (frame_header->fis_type != FIS_DATA) { |
1795 | dev_err(scic_to_dev(scic), | 1794 | dev_err(&ihost->pdev->dev, |
1796 | "%s: SCIC PIO Request 0x%p received frame %d " | 1795 | "%s: SCIC PIO Request 0x%p received frame %d " |
1797 | "with fis type 0x%02x when expecting a data " | 1796 | "with fis type 0x%02x when expecting a data " |
1798 | "fis.\n", | 1797 | "fis.\n", |
@@ -1808,7 +1807,7 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1808 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 1807 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
1809 | 1808 | ||
1810 | /* Frame is decoded return it to the controller */ | 1809 | /* Frame is decoded return it to the controller */ |
1811 | scic_sds_controller_release_frame(scic, frame_index); | 1810 | scic_sds_controller_release_frame(ihost, frame_index); |
1812 | return status; | 1811 | return status; |
1813 | } | 1812 | } |
1814 | 1813 | ||
@@ -1816,7 +1815,7 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1816 | ireq->saved_rx_frame_index = frame_index; | 1815 | ireq->saved_rx_frame_index = frame_index; |
1817 | stp_req->pio_len = 0; | 1816 | stp_req->pio_len = 0; |
1818 | } else { | 1817 | } else { |
1819 | scic_sds_unsolicited_frame_control_get_buffer(&scic->uf_control, | 1818 | scic_sds_unsolicited_frame_control_get_buffer(&ihost->uf_control, |
1820 | frame_index, | 1819 | frame_index, |
1821 | (void **)&frame_buffer); | 1820 | (void **)&frame_buffer); |
1822 | 1821 | ||
@@ -1824,7 +1823,7 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1824 | (u8 *)frame_buffer); | 1823 | (u8 *)frame_buffer); |
1825 | 1824 | ||
1826 | /* Frame is decoded return it to the controller */ | 1825 | /* Frame is decoded return it to the controller */ |
1827 | scic_sds_controller_release_frame(scic, frame_index); | 1826 | scic_sds_controller_release_frame(ihost, frame_index); |
1828 | } | 1827 | } |
1829 | 1828 | ||
1830 | /* Check for the end of the transfer, are there more | 1829 | /* Check for the end of the transfer, are there more |
@@ -1849,11 +1848,11 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1849 | struct dev_to_host_fis *frame_header; | 1848 | struct dev_to_host_fis *frame_header; |
1850 | u32 *frame_buffer; | 1849 | u32 *frame_buffer; |
1851 | 1850 | ||
1852 | status = scic_sds_unsolicited_frame_control_get_header(&scic->uf_control, | 1851 | status = scic_sds_unsolicited_frame_control_get_header(&ihost->uf_control, |
1853 | frame_index, | 1852 | frame_index, |
1854 | (void **)&frame_header); | 1853 | (void **)&frame_header); |
1855 | if (status != SCI_SUCCESS) { | 1854 | if (status != SCI_SUCCESS) { |
1856 | dev_err(scic_to_dev(scic), | 1855 | dev_err(&ihost->pdev->dev, |
1857 | "%s: SCIC IO Request 0x%p could not get frame " | 1856 | "%s: SCIC IO Request 0x%p could not get frame " |
1858 | "header for frame index %d, status %x\n", | 1857 | "header for frame index %d, status %x\n", |
1859 | __func__, | 1858 | __func__, |
@@ -1865,7 +1864,7 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1865 | 1864 | ||
1866 | switch (frame_header->fis_type) { | 1865 | switch (frame_header->fis_type) { |
1867 | case FIS_REGD2H: | 1866 | case FIS_REGD2H: |
1868 | scic_sds_unsolicited_frame_control_get_buffer(&scic->uf_control, | 1867 | scic_sds_unsolicited_frame_control_get_buffer(&ihost->uf_control, |
1869 | frame_index, | 1868 | frame_index, |
1870 | (void **)&frame_buffer); | 1869 | (void **)&frame_buffer); |
1871 | 1870 | ||
@@ -1880,7 +1879,7 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1880 | break; | 1879 | break; |
1881 | 1880 | ||
1882 | default: | 1881 | default: |
1883 | dev_warn(scic_to_dev(scic), | 1882 | dev_warn(&ihost->pdev->dev, |
1884 | "%s: IO Request:0x%p Frame Id:%d protocol " | 1883 | "%s: IO Request:0x%p Frame Id:%d protocol " |
1885 | "violation occurred\n", | 1884 | "violation occurred\n", |
1886 | __func__, | 1885 | __func__, |
@@ -1896,7 +1895,7 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1896 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 1895 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
1897 | 1896 | ||
1898 | /* Frame has been decoded return it to the controller */ | 1897 | /* Frame has been decoded return it to the controller */ |
1899 | scic_sds_controller_release_frame(scic, frame_index); | 1898 | scic_sds_controller_release_frame(ihost, frame_index); |
1900 | 1899 | ||
1901 | return status; | 1900 | return status; |
1902 | } | 1901 | } |
@@ -1905,18 +1904,18 @@ scic_sds_io_request_frame_handler(struct isci_request *ireq, | |||
1905 | * TODO: Is it even possible to get an unsolicited frame in the | 1904 | * TODO: Is it even possible to get an unsolicited frame in the |
1906 | * aborting state? | 1905 | * aborting state? |
1907 | */ | 1906 | */ |
1908 | scic_sds_controller_release_frame(scic, frame_index); | 1907 | scic_sds_controller_release_frame(ihost, frame_index); |
1909 | return SCI_SUCCESS; | 1908 | return SCI_SUCCESS; |
1910 | 1909 | ||
1911 | default: | 1910 | default: |
1912 | dev_warn(scic_to_dev(scic), | 1911 | dev_warn(&ihost->pdev->dev, |
1913 | "%s: SCIC IO Request given unexpected frame %x while " | 1912 | "%s: SCIC IO Request given unexpected frame %x while " |
1914 | "in state %d\n", | 1913 | "in state %d\n", |
1915 | __func__, | 1914 | __func__, |
1916 | frame_index, | 1915 | frame_index, |
1917 | state); | 1916 | state); |
1918 | 1917 | ||
1919 | scic_sds_controller_release_frame(scic, frame_index); | 1918 | scic_sds_controller_release_frame(ihost, frame_index); |
1920 | return SCI_FAILURE_INVALID_STATE; | 1919 | return SCI_FAILURE_INVALID_STATE; |
1921 | } | 1920 | } |
1922 | } | 1921 | } |
@@ -2042,7 +2041,7 @@ scic_sds_io_request_tc_completion(struct isci_request *ireq, | |||
2042 | u32 completion_code) | 2041 | u32 completion_code) |
2043 | { | 2042 | { |
2044 | enum sci_base_request_states state; | 2043 | enum sci_base_request_states state; |
2045 | struct scic_sds_controller *scic = ireq->owning_controller; | 2044 | struct isci_host *ihost = ireq->owning_controller; |
2046 | 2045 | ||
2047 | state = ireq->sm.current_state_id; | 2046 | state = ireq->sm.current_state_id; |
2048 | 2047 | ||
@@ -2089,7 +2088,7 @@ scic_sds_io_request_tc_completion(struct isci_request *ireq, | |||
2089 | completion_code); | 2088 | completion_code); |
2090 | 2089 | ||
2091 | default: | 2090 | default: |
2092 | dev_warn(scic_to_dev(scic), | 2091 | dev_warn(&ihost->pdev->dev, |
2093 | "%s: SCIC IO Request given task completion " | 2092 | "%s: SCIC IO Request given task completion " |
2094 | "notification %x while in wrong state %d\n", | 2093 | "notification %x while in wrong state %d\n", |
2095 | __func__, | 2094 | __func__, |
@@ -2480,7 +2479,7 @@ static void isci_task_save_for_upper_layer_completion( | |||
2480 | } | 2479 | } |
2481 | } | 2480 | } |
2482 | 2481 | ||
2483 | static void isci_request_io_request_complete(struct isci_host *isci_host, | 2482 | static void isci_request_io_request_complete(struct isci_host *ihost, |
2484 | struct isci_request *request, | 2483 | struct isci_request *request, |
2485 | enum sci_io_status completion_status) | 2484 | enum sci_io_status completion_status) |
2486 | { | 2485 | { |
@@ -2495,7 +2494,7 @@ static void isci_request_io_request_complete(struct isci_host *isci_host, | |||
2495 | enum isci_completion_selection complete_to_host | 2494 | enum isci_completion_selection complete_to_host |
2496 | = isci_perform_normal_io_completion; | 2495 | = isci_perform_normal_io_completion; |
2497 | 2496 | ||
2498 | dev_dbg(&isci_host->pdev->dev, | 2497 | dev_dbg(&ihost->pdev->dev, |
2499 | "%s: request = %p, task = %p,\n" | 2498 | "%s: request = %p, task = %p,\n" |
2500 | "task->data_dir = %d completion_status = 0x%x\n", | 2499 | "task->data_dir = %d completion_status = 0x%x\n", |
2501 | __func__, | 2500 | __func__, |
@@ -2616,7 +2615,7 @@ static void isci_request_io_request_complete(struct isci_host *isci_host, | |||
2616 | switch (completion_status) { | 2615 | switch (completion_status) { |
2617 | 2616 | ||
2618 | case SCI_IO_FAILURE_RESPONSE_VALID: | 2617 | case SCI_IO_FAILURE_RESPONSE_VALID: |
2619 | dev_dbg(&isci_host->pdev->dev, | 2618 | dev_dbg(&ihost->pdev->dev, |
2620 | "%s: SCI_IO_FAILURE_RESPONSE_VALID (%p/%p)\n", | 2619 | "%s: SCI_IO_FAILURE_RESPONSE_VALID (%p/%p)\n", |
2621 | __func__, | 2620 | __func__, |
2622 | request, | 2621 | request, |
@@ -2631,17 +2630,17 @@ static void isci_request_io_request_complete(struct isci_host *isci_host, | |||
2631 | /* crack the iu response buffer. */ | 2630 | /* crack the iu response buffer. */ |
2632 | resp_iu = &request->ssp.rsp; | 2631 | resp_iu = &request->ssp.rsp; |
2633 | isci_request_process_response_iu(task, resp_iu, | 2632 | isci_request_process_response_iu(task, resp_iu, |
2634 | &isci_host->pdev->dev); | 2633 | &ihost->pdev->dev); |
2635 | 2634 | ||
2636 | } else if (SAS_PROTOCOL_SMP == task->task_proto) { | 2635 | } else if (SAS_PROTOCOL_SMP == task->task_proto) { |
2637 | 2636 | ||
2638 | dev_err(&isci_host->pdev->dev, | 2637 | dev_err(&ihost->pdev->dev, |
2639 | "%s: SCI_IO_FAILURE_RESPONSE_VALID: " | 2638 | "%s: SCI_IO_FAILURE_RESPONSE_VALID: " |
2640 | "SAS_PROTOCOL_SMP protocol\n", | 2639 | "SAS_PROTOCOL_SMP protocol\n", |
2641 | __func__); | 2640 | __func__); |
2642 | 2641 | ||
2643 | } else | 2642 | } else |
2644 | dev_err(&isci_host->pdev->dev, | 2643 | dev_err(&ihost->pdev->dev, |
2645 | "%s: unknown protocol\n", __func__); | 2644 | "%s: unknown protocol\n", __func__); |
2646 | 2645 | ||
2647 | /* use the task status set in the task struct by the | 2646 | /* use the task status set in the task struct by the |
@@ -2662,7 +2661,7 @@ static void isci_request_io_request_complete(struct isci_host *isci_host, | |||
2662 | if (task->task_proto == SAS_PROTOCOL_SMP) { | 2661 | if (task->task_proto == SAS_PROTOCOL_SMP) { |
2663 | void *rsp = &request->smp.rsp; | 2662 | void *rsp = &request->smp.rsp; |
2664 | 2663 | ||
2665 | dev_dbg(&isci_host->pdev->dev, | 2664 | dev_dbg(&ihost->pdev->dev, |
2666 | "%s: SMP protocol completion\n", | 2665 | "%s: SMP protocol completion\n", |
2667 | __func__); | 2666 | __func__); |
2668 | 2667 | ||
@@ -2687,20 +2686,20 @@ static void isci_request_io_request_complete(struct isci_host *isci_host, | |||
2687 | if (task->task_status.residual != 0) | 2686 | if (task->task_status.residual != 0) |
2688 | status = SAS_DATA_UNDERRUN; | 2687 | status = SAS_DATA_UNDERRUN; |
2689 | 2688 | ||
2690 | dev_dbg(&isci_host->pdev->dev, | 2689 | dev_dbg(&ihost->pdev->dev, |
2691 | "%s: SCI_IO_SUCCESS_IO_DONE_EARLY %d\n", | 2690 | "%s: SCI_IO_SUCCESS_IO_DONE_EARLY %d\n", |
2692 | __func__, | 2691 | __func__, |
2693 | status); | 2692 | status); |
2694 | 2693 | ||
2695 | } else | 2694 | } else |
2696 | dev_dbg(&isci_host->pdev->dev, | 2695 | dev_dbg(&ihost->pdev->dev, |
2697 | "%s: SCI_IO_SUCCESS\n", | 2696 | "%s: SCI_IO_SUCCESS\n", |
2698 | __func__); | 2697 | __func__); |
2699 | 2698 | ||
2700 | break; | 2699 | break; |
2701 | 2700 | ||
2702 | case SCI_IO_FAILURE_TERMINATED: | 2701 | case SCI_IO_FAILURE_TERMINATED: |
2703 | dev_dbg(&isci_host->pdev->dev, | 2702 | dev_dbg(&ihost->pdev->dev, |
2704 | "%s: SCI_IO_FAILURE_TERMINATED (%p/%p)\n", | 2703 | "%s: SCI_IO_FAILURE_TERMINATED (%p/%p)\n", |
2705 | __func__, | 2704 | __func__, |
2706 | request, | 2705 | request, |
@@ -2768,7 +2767,7 @@ static void isci_request_io_request_complete(struct isci_host *isci_host, | |||
2768 | 2767 | ||
2769 | default: | 2768 | default: |
2770 | /* Catch any otherwise unhandled error codes here. */ | 2769 | /* Catch any otherwise unhandled error codes here. */ |
2771 | dev_warn(&isci_host->pdev->dev, | 2770 | dev_warn(&ihost->pdev->dev, |
2772 | "%s: invalid completion code: 0x%x - " | 2771 | "%s: invalid completion code: 0x%x - " |
2773 | "isci_request = %p\n", | 2772 | "isci_request = %p\n", |
2774 | __func__, completion_status, request); | 2773 | __func__, completion_status, request); |
@@ -2802,11 +2801,11 @@ static void isci_request_io_request_complete(struct isci_host *isci_host, | |||
2802 | break; | 2801 | break; |
2803 | if (task->num_scatter == 0) | 2802 | if (task->num_scatter == 0) |
2804 | /* 0 indicates a single dma address */ | 2803 | /* 0 indicates a single dma address */ |
2805 | dma_unmap_single(&isci_host->pdev->dev, | 2804 | dma_unmap_single(&ihost->pdev->dev, |
2806 | request->zero_scatter_daddr, | 2805 | request->zero_scatter_daddr, |
2807 | task->total_xfer_len, task->data_dir); | 2806 | task->total_xfer_len, task->data_dir); |
2808 | else /* unmap the sgl dma addresses */ | 2807 | else /* unmap the sgl dma addresses */ |
2809 | dma_unmap_sg(&isci_host->pdev->dev, task->scatter, | 2808 | dma_unmap_sg(&ihost->pdev->dev, task->scatter, |
2810 | request->num_sg_entries, task->data_dir); | 2809 | request->num_sg_entries, task->data_dir); |
2811 | break; | 2810 | break; |
2812 | case SAS_PROTOCOL_SMP: { | 2811 | case SAS_PROTOCOL_SMP: { |
@@ -2814,7 +2813,7 @@ static void isci_request_io_request_complete(struct isci_host *isci_host, | |||
2814 | struct smp_req *smp_req; | 2813 | struct smp_req *smp_req; |
2815 | void *kaddr; | 2814 | void *kaddr; |
2816 | 2815 | ||
2817 | dma_unmap_sg(&isci_host->pdev->dev, sg, 1, DMA_TO_DEVICE); | 2816 | dma_unmap_sg(&ihost->pdev->dev, sg, 1, DMA_TO_DEVICE); |
2818 | 2817 | ||
2819 | /* need to swab it back in case the command buffer is re-used */ | 2818 | /* need to swab it back in case the command buffer is re-used */ |
2820 | kaddr = kmap_atomic(sg_page(sg), KM_IRQ0); | 2819 | kaddr = kmap_atomic(sg_page(sg), KM_IRQ0); |
@@ -2828,14 +2827,12 @@ static void isci_request_io_request_complete(struct isci_host *isci_host, | |||
2828 | } | 2827 | } |
2829 | 2828 | ||
2830 | /* Put the completed request on the correct list */ | 2829 | /* Put the completed request on the correct list */ |
2831 | isci_task_save_for_upper_layer_completion(isci_host, request, response, | 2830 | isci_task_save_for_upper_layer_completion(ihost, request, response, |
2832 | status, complete_to_host | 2831 | status, complete_to_host |
2833 | ); | 2832 | ); |
2834 | 2833 | ||
2835 | /* complete the io request to the core. */ | 2834 | /* complete the io request to the core. */ |
2836 | scic_controller_complete_io(&isci_host->sci, | 2835 | scic_controller_complete_io(ihost, request->target_device, request); |
2837 | request->target_device, | ||
2838 | request); | ||
2839 | isci_put_device(idev); | 2836 | isci_put_device(idev); |
2840 | 2837 | ||
2841 | /* set terminated handle so it cannot be completed or | 2838 | /* set terminated handle so it cannot be completed or |
@@ -2885,8 +2882,7 @@ static void scic_sds_request_started_state_enter(struct sci_base_state_machine * | |||
2885 | static void scic_sds_request_completed_state_enter(struct sci_base_state_machine *sm) | 2882 | static void scic_sds_request_completed_state_enter(struct sci_base_state_machine *sm) |
2886 | { | 2883 | { |
2887 | struct isci_request *ireq = container_of(sm, typeof(*ireq), sm); | 2884 | struct isci_request *ireq = container_of(sm, typeof(*ireq), sm); |
2888 | struct scic_sds_controller *scic = ireq->owning_controller; | 2885 | struct isci_host *ihost = ireq->owning_controller; |
2889 | struct isci_host *ihost = scic_to_ihost(scic); | ||
2890 | 2886 | ||
2891 | /* Tell the SCI_USER that the IO request is complete */ | 2887 | /* Tell the SCI_USER that the IO request is complete */ |
2892 | if (!test_bit(IREQ_TMF, &ireq->flags)) | 2888 | if (!test_bit(IREQ_TMF, &ireq->flags)) |
@@ -2985,7 +2981,7 @@ static const struct sci_base_state scic_sds_request_state_table[] = { | |||
2985 | }; | 2981 | }; |
2986 | 2982 | ||
2987 | static void | 2983 | static void |
2988 | scic_sds_general_request_construct(struct scic_sds_controller *scic, | 2984 | scic_sds_general_request_construct(struct isci_host *ihost, |
2989 | struct isci_remote_device *idev, | 2985 | struct isci_remote_device *idev, |
2990 | struct isci_request *ireq) | 2986 | struct isci_request *ireq) |
2991 | { | 2987 | { |
@@ -3001,7 +2997,7 @@ scic_sds_general_request_construct(struct scic_sds_controller *scic, | |||
3001 | } | 2997 | } |
3002 | 2998 | ||
3003 | static enum sci_status | 2999 | static enum sci_status |
3004 | scic_io_request_construct(struct scic_sds_controller *scic, | 3000 | scic_io_request_construct(struct isci_host *ihost, |
3005 | struct isci_remote_device *idev, | 3001 | struct isci_remote_device *idev, |
3006 | struct isci_request *ireq) | 3002 | struct isci_request *ireq) |
3007 | { | 3003 | { |
@@ -3009,7 +3005,7 @@ scic_io_request_construct(struct scic_sds_controller *scic, | |||
3009 | enum sci_status status = SCI_SUCCESS; | 3005 | enum sci_status status = SCI_SUCCESS; |
3010 | 3006 | ||
3011 | /* Build the common part of the request */ | 3007 | /* Build the common part of the request */ |
3012 | scic_sds_general_request_construct(scic, idev, ireq); | 3008 | scic_sds_general_request_construct(ihost, idev, ireq); |
3013 | 3009 | ||
3014 | if (idev->rnc.remote_node_index == SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX) | 3010 | if (idev->rnc.remote_node_index == SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX) |
3015 | return SCI_FAILURE_INVALID_REMOTE_DEVICE; | 3011 | return SCI_FAILURE_INVALID_REMOTE_DEVICE; |
@@ -3028,7 +3024,7 @@ scic_io_request_construct(struct scic_sds_controller *scic, | |||
3028 | return status; | 3024 | return status; |
3029 | } | 3025 | } |
3030 | 3026 | ||
3031 | enum sci_status scic_task_request_construct(struct scic_sds_controller *scic, | 3027 | enum sci_status scic_task_request_construct(struct isci_host *ihost, |
3032 | struct isci_remote_device *idev, | 3028 | struct isci_remote_device *idev, |
3033 | u16 io_tag, struct isci_request *ireq) | 3029 | u16 io_tag, struct isci_request *ireq) |
3034 | { | 3030 | { |
@@ -3036,7 +3032,7 @@ enum sci_status scic_task_request_construct(struct scic_sds_controller *scic, | |||
3036 | enum sci_status status = SCI_SUCCESS; | 3032 | enum sci_status status = SCI_SUCCESS; |
3037 | 3033 | ||
3038 | /* Build the common part of the request */ | 3034 | /* Build the common part of the request */ |
3039 | scic_sds_general_request_construct(scic, idev, ireq); | 3035 | scic_sds_general_request_construct(ihost, idev, ireq); |
3040 | 3036 | ||
3041 | if (dev->dev_type == SAS_END_DEV || | 3037 | if (dev->dev_type == SAS_END_DEV || |
3042 | dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { | 3038 | dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { |
@@ -3156,7 +3152,7 @@ scic_io_request_construct_smp(struct device *dev, | |||
3156 | task_context->initiator_request = 1; | 3152 | task_context->initiator_request = 1; |
3157 | task_context->connection_rate = idev->connection_rate; | 3153 | task_context->connection_rate = idev->connection_rate; |
3158 | task_context->protocol_engine_index = | 3154 | task_context->protocol_engine_index = |
3159 | scic_sds_controller_get_protocol_engine_group(scic); | 3155 | scic_sds_controller_get_protocol_engine_group(ihost); |
3160 | task_context->logical_port_index = scic_sds_port_get_index(iport); | 3156 | task_context->logical_port_index = scic_sds_port_get_index(iport); |
3161 | task_context->protocol_type = SCU_TASK_CONTEXT_PROTOCOL_SMP; | 3157 | task_context->protocol_type = SCU_TASK_CONTEXT_PROTOCOL_SMP; |
3162 | task_context->abort = 0; | 3158 | task_context->abort = 0; |
@@ -3199,7 +3195,7 @@ scic_io_request_construct_smp(struct device *dev, | |||
3199 | task_context->task_phase = 0; | 3195 | task_context->task_phase = 0; |
3200 | 3196 | ||
3201 | ireq->post_context = (SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC | | 3197 | ireq->post_context = (SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC | |
3202 | (scic_sds_controller_get_protocol_engine_group(scic) << | 3198 | (scic_sds_controller_get_protocol_engine_group(ihost) << |
3203 | SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT) | | 3199 | SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT) | |
3204 | (scic_sds_port_get_index(iport) << | 3200 | (scic_sds_port_get_index(iport) << |
3205 | SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT) | | 3201 | SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT) | |
@@ -3245,7 +3241,7 @@ static enum sci_status isci_smp_request_build(struct isci_request *ireq) | |||
3245 | 3241 | ||
3246 | /** | 3242 | /** |
3247 | * isci_io_request_build() - This function builds the io request object. | 3243 | * isci_io_request_build() - This function builds the io request object. |
3248 | * @isci_host: This parameter specifies the ISCI host object | 3244 | * @ihost: This parameter specifies the ISCI host object |
3249 | * @request: This parameter points to the isci_request object allocated in the | 3245 | * @request: This parameter points to the isci_request object allocated in the |
3250 | * request construct function. | 3246 | * request construct function. |
3251 | * @sci_device: This parameter is the handle for the sci core's remote device | 3247 | * @sci_device: This parameter is the handle for the sci core's remote device |
@@ -3253,14 +3249,14 @@ static enum sci_status isci_smp_request_build(struct isci_request *ireq) | |||
3253 | * | 3249 | * |
3254 | * SCI_SUCCESS on successfull completion, or specific failure code. | 3250 | * SCI_SUCCESS on successfull completion, or specific failure code. |
3255 | */ | 3251 | */ |
3256 | static enum sci_status isci_io_request_build(struct isci_host *isci_host, | 3252 | static enum sci_status isci_io_request_build(struct isci_host *ihost, |
3257 | struct isci_request *request, | 3253 | struct isci_request *request, |
3258 | struct isci_remote_device *idev) | 3254 | struct isci_remote_device *idev) |
3259 | { | 3255 | { |
3260 | enum sci_status status = SCI_SUCCESS; | 3256 | enum sci_status status = SCI_SUCCESS; |
3261 | struct sas_task *task = isci_request_access_task(request); | 3257 | struct sas_task *task = isci_request_access_task(request); |
3262 | 3258 | ||
3263 | dev_dbg(&isci_host->pdev->dev, | 3259 | dev_dbg(&ihost->pdev->dev, |
3264 | "%s: idev = 0x%p; request = %p, " | 3260 | "%s: idev = 0x%p; request = %p, " |
3265 | "num_scatter = %d\n", | 3261 | "num_scatter = %d\n", |
3266 | __func__, | 3262 | __func__, |
@@ -3277,7 +3273,7 @@ static enum sci_status isci_io_request_build(struct isci_host *isci_host, | |||
3277 | !(SAS_PROTOCOL_SMP & task->task_proto)) { | 3273 | !(SAS_PROTOCOL_SMP & task->task_proto)) { |
3278 | 3274 | ||
3279 | request->num_sg_entries = dma_map_sg( | 3275 | request->num_sg_entries = dma_map_sg( |
3280 | &isci_host->pdev->dev, | 3276 | &ihost->pdev->dev, |
3281 | task->scatter, | 3277 | task->scatter, |
3282 | task->num_scatter, | 3278 | task->num_scatter, |
3283 | task->data_dir | 3279 | task->data_dir |
@@ -3287,10 +3283,10 @@ static enum sci_status isci_io_request_build(struct isci_host *isci_host, | |||
3287 | return SCI_FAILURE_INSUFFICIENT_RESOURCES; | 3283 | return SCI_FAILURE_INSUFFICIENT_RESOURCES; |
3288 | } | 3284 | } |
3289 | 3285 | ||
3290 | status = scic_io_request_construct(&isci_host->sci, idev, request); | 3286 | status = scic_io_request_construct(ihost, idev, request); |
3291 | 3287 | ||
3292 | if (status != SCI_SUCCESS) { | 3288 | if (status != SCI_SUCCESS) { |
3293 | dev_warn(&isci_host->pdev->dev, | 3289 | dev_warn(&ihost->pdev->dev, |
3294 | "%s: failed request construct\n", | 3290 | "%s: failed request construct\n", |
3295 | __func__); | 3291 | __func__); |
3296 | return SCI_FAILURE; | 3292 | return SCI_FAILURE; |
@@ -3309,7 +3305,7 @@ static enum sci_status isci_io_request_build(struct isci_host *isci_host, | |||
3309 | status = isci_request_stp_request_construct(request); | 3305 | status = isci_request_stp_request_construct(request); |
3310 | break; | 3306 | break; |
3311 | default: | 3307 | default: |
3312 | dev_warn(&isci_host->pdev->dev, | 3308 | dev_warn(&ihost->pdev->dev, |
3313 | "%s: unknown protocol\n", __func__); | 3309 | "%s: unknown protocol\n", __func__); |
3314 | return SCI_FAILURE; | 3310 | return SCI_FAILURE; |
3315 | } | 3311 | } |
@@ -3392,7 +3388,7 @@ int isci_request_execute(struct isci_host *ihost, struct isci_remote_device *ide | |||
3392 | * request was built that way (ie. | 3388 | * request was built that way (ie. |
3393 | * ireq->is_task_management_request is false). | 3389 | * ireq->is_task_management_request is false). |
3394 | */ | 3390 | */ |
3395 | status = scic_controller_start_task(&ihost->sci, | 3391 | status = scic_controller_start_task(ihost, |
3396 | idev, | 3392 | idev, |
3397 | ireq); | 3393 | ireq); |
3398 | } else { | 3394 | } else { |
@@ -3400,7 +3396,7 @@ int isci_request_execute(struct isci_host *ihost, struct isci_remote_device *ide | |||
3400 | } | 3396 | } |
3401 | } else { | 3397 | } else { |
3402 | /* send the request, let the core assign the IO TAG. */ | 3398 | /* send the request, let the core assign the IO TAG. */ |
3403 | status = scic_controller_start_io(&ihost->sci, idev, | 3399 | status = scic_controller_start_io(ihost, idev, |
3404 | ireq); | 3400 | ireq); |
3405 | } | 3401 | } |
3406 | 3402 | ||