isci: Removed sci_base_object from scic_sds_request.
authorMaciej Patelczyk <maciej.patelczyk@intel.com>
Thu, 28 Apr 2011 22:06:31 +0000 (22:06 +0000)
committerDan Williams <dan.j.williams@intel.com>
Sun, 3 Jul 2011 11:00:38 +0000 (04:00 -0700)
The 'struct sci_base_object' was removed from the struct
scic_sds_request and was replaced by a pointer to
struct isci_request.

Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/scsi/isci/core/sci_util.c
drivers/scsi/isci/core/scic_sds_request.c
drivers/scsi/isci/core/scic_sds_request.h
drivers/scsi/isci/core/scic_sds_smp_request.c
drivers/scsi/isci/core/scic_sds_ssp_request.c
drivers/scsi/isci/core/scic_sds_stp_request.c
drivers/scsi/isci/request.c
drivers/scsi/isci/stp_remote_device.c
drivers/scsi/isci/task.c

index cb3e9f73828def340389ac3d64d1707581ff2ef4..ebf0ed919a9fe2df6264b3eddd6b636710e1e171 100644 (file)
@@ -72,7 +72,7 @@ void scic_word_copy_with_swap(
 
 void *scic_request_get_virt_addr(struct scic_sds_request *sci_req, dma_addr_t phys_addr)
 {
-       struct isci_request *ireq = sci_object_get_association(sci_req);
+       struct isci_request *ireq = sci_req->ireq;
        dma_addr_t offset;
 
        BUG_ON(phys_addr < ireq->request_daddr);
@@ -87,8 +87,7 @@ void *scic_request_get_virt_addr(struct scic_sds_request *sci_req, dma_addr_t ph
 dma_addr_t scic_io_request_get_dma_addr(struct scic_sds_request *sds_request,
                                        void *virt_addr)
 {
-       struct isci_request *isci_request =
-               (struct isci_request *)sci_object_get_association(sds_request);
+       struct isci_request *isci_request = sds_request->ireq;
 
        char *requested_addr = (char *)virt_addr;
        char *base_addr = (char *)isci_request;
index a438ea22315adea32efbb3c84d06056241fc0894..fba642881092e5928bdab4cfa36a210a308ce216 100644 (file)
@@ -253,8 +253,7 @@ static struct scu_sgl_element_pair *scic_sds_request_get_sgl_element_pair(
  */
 void scic_sds_request_build_sgl(struct scic_sds_request *sds_request)
 {
-       struct isci_request *isci_request =
-               (struct isci_request *)sci_object_get_association(sds_request);
+       struct isci_request *isci_request = sds_request->ireq;
        struct isci_host *isci_host = isci_request->isci_host;
        struct sas_task *task = isci_request_access_task(isci_request);
        struct scatterlist *sg = NULL;
@@ -359,8 +358,7 @@ static void scic_sds_io_request_build_ssp_command_iu(
        struct sci_ssp_command_iu *command_frame;
        u32 cdb_length;
        u32 *cdb_buffer;
-       struct isci_request *isci_request =
-               (struct isci_request *)sci_object_get_association(sds_request);
+       struct isci_request *isci_request = sds_request->ireq;
 
        command_frame =
                (struct sci_ssp_command_iu *)sds_request->command_buffer;
@@ -403,8 +401,7 @@ static void scic_sds_task_request_build_ssp_task_iu(
        struct scic_sds_request *sds_request)
 {
        struct sci_ssp_task_iu *command_frame;
-       struct isci_request *isci_request =
-               (struct isci_request *)sci_object_get_association(sds_request);
+       struct isci_request *isci_request = sds_request->ireq;
 
        command_frame =
                (struct sci_ssp_task_iu *)sds_request->command_buffer;
@@ -700,8 +697,7 @@ u32 scic_io_request_get_object_size(void)
 enum sci_status scic_io_request_construct_basic_ssp(
        struct scic_sds_request *sci_req)
 {
-       struct isci_request *isci_request =
-               (struct isci_request *)sci_object_get_association(sci_req);
+       struct isci_request *isci_request = sci_req->ireq;
 
        sci_req->protocol = SCIC_SSP_PROTOCOL;
 
@@ -744,8 +740,7 @@ enum sci_status scic_io_request_construct_basic_sata(
        u32 len;
        enum dma_data_direction dir;
        bool copy = false;
-       struct isci_request *isci_request =
-               (struct isci_request *)sci_object_get_association(sci_req);
+       struct isci_request *isci_request = sci_req->ireq;
        struct sas_task *task = isci_request_access_task(isci_request);
 
        stp_req = container_of(sci_req, typeof(*stp_req), parent);
@@ -772,8 +767,7 @@ enum sci_status scic_task_request_construct_sata(
 {
        enum sci_status status;
        u8 sat_protocol;
-       struct isci_request *isci_request =
-               (struct isci_request *)sci_object_get_association(sci_req);
+       struct isci_request *isci_request = sci_req->ireq;
 
        sat_protocol = isci_sata_get_sat_protocol(isci_request);
 
@@ -1002,8 +996,7 @@ void scic_sds_io_request_copy_response(struct scic_sds_request *sds_request)
        u32 user_response_length;
        u32 core_response_length;
        struct sci_ssp_response_iu *ssp_response;
-       struct isci_request *isci_request =
-               (struct isci_request *)sci_object_get_association(sds_request);
+       struct isci_request *isci_request = sds_request->ireq;
 
        ssp_response =
                (struct sci_ssp_response_iu *)sds_request->response_buffer;
@@ -1523,7 +1516,7 @@ static const struct scic_sds_io_request_state_handler scic_sds_request_state_han
  */
 static void scic_sds_request_initial_state_enter(void *object)
 {
-       struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
+       struct scic_sds_request *sci_req = object;
 
        SET_STATE_HANDLER(
                sci_req,
@@ -1542,7 +1535,7 @@ static void scic_sds_request_initial_state_enter(void *object)
  */
 static void scic_sds_request_constructed_state_enter(void *object)
 {
-       struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
+       struct scic_sds_request *sci_req = object;
 
        SET_STATE_HANDLER(
                sci_req,
@@ -1562,7 +1555,7 @@ static void scic_sds_request_constructed_state_enter(void *object)
  */
 static void scic_sds_request_started_state_enter(void *object)
 {
-       struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
+       struct scic_sds_request *sci_req = object;
 
        SET_STATE_HANDLER(
                sci_req,
@@ -1589,7 +1582,7 @@ static void scic_sds_request_started_state_enter(void *object)
  */
 static void scic_sds_request_started_state_exit(void *object)
 {
-       struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
+       struct scic_sds_request *sci_req = object;
 
        if (sci_req->has_started_substate_machine == true)
                sci_base_state_machine_stop(&sci_req->started_substate_machine);
@@ -1609,11 +1602,11 @@ static void scic_sds_request_started_state_exit(void *object)
  */
 static void scic_sds_request_completed_state_enter(void *object)
 {
-       struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
+       struct scic_sds_request *sci_req = object;
        struct scic_sds_controller *scic =
                scic_sds_request_get_controller(sci_req);
        struct isci_host *ihost = scic->ihost;
-       struct isci_request *ireq = sci_object_get_association(sci_req);
+       struct isci_request *ireq = sci_req->ireq;
 
        SET_STATE_HANDLER(sci_req,
                          scic_sds_request_state_handler_table,
@@ -1639,7 +1632,7 @@ static void scic_sds_request_completed_state_enter(void *object)
  */
 static void scic_sds_request_aborting_state_enter(void *object)
 {
-       struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
+       struct scic_sds_request *sci_req = object;
 
        /* Setting the abort bit in the Task Context is required by the silicon. */
        sci_req->task_context_buffer->abort = 1;
@@ -1662,7 +1655,7 @@ static void scic_sds_request_aborting_state_enter(void *object)
  */
 static void scic_sds_request_final_state_enter(void *object)
 {
-       struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
+       struct scic_sds_request *sci_req = object;
 
        SET_STATE_HANDLER(
                sci_req,
@@ -1699,8 +1692,7 @@ static void scic_sds_general_request_construct(struct scic_sds_controller *scic,
                                               void *user_io_request_object,
                                               struct scic_sds_request *sci_req)
 {
-       sci_req->parent.private = NULL;
-       sci_base_state_machine_construct(&sci_req->state_machine, &sci_req->parent,
+       sci_base_state_machine_construct(&sci_req->state_machine, sci_req,
                        scic_sds_request_state_table, SCI_BASE_REQUEST_STATE_INITIAL);
        sci_base_state_machine_start(&sci_req->state_machine);
 
@@ -1790,7 +1782,7 @@ enum sci_status scic_task_request_construct(struct scic_sds_controller *scic,
                /* Construct the started sub-state machine. */
                sci_base_state_machine_construct(
                        &sci_req->started_substate_machine,
-                       &sci_req->parent,
+                       sci_req,
                        scic_sds_io_request_started_task_mgmt_substate_table,
                        SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_COMPLETION
                        );
index 0bb1da81ce853ece27d8dfdc80229e510a50dab8..11d5a3ea9da32542b9d0c93a515d3151ab337860 100644 (file)
@@ -118,6 +118,7 @@ enum scic_sds_smp_request_started_substates {
        SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_TC_COMPLETION,
 };
 
+struct isci_request;
 /**
  * struct scic_sds_request - This structure contains or references all of
  *    the data necessary to process a task management or normal IO request.
@@ -126,10 +127,9 @@ enum scic_sds_smp_request_started_substates {
  */
 struct scic_sds_request {
        /**
-        * The field specifies that the parent object for the base request is the
-        * base object itself.
+        * The field specifies that the peer object for the request object.
         */
-       struct sci_base_object parent;
+       struct isci_request *ireq;
 
        /**
         * This field contains the information for the base request state machine.
index 429973759776097424ec405b65e683d27b84c388..ba29192f7fd0a209c72be10317e43561c56a1a28 100644 (file)
@@ -525,7 +525,7 @@ static const struct scic_sds_io_request_state_handler scic_sds_smp_request_start
 static void scic_sds_smp_request_started_await_response_substate_enter(
        void *object)
 {
-       struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
+       struct scic_sds_request *sci_req = object;
 
        SET_STATE_HANDLER(
                sci_req,
@@ -546,7 +546,7 @@ static void scic_sds_smp_request_started_await_response_substate_enter(
 static void scic_sds_smp_request_started_await_tc_completion_substate_enter(
        void *object)
 {
-       struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
+       struct scic_sds_request *sci_req = object;
 
        SET_STATE_HANDLER(
                sci_req,
@@ -590,7 +590,7 @@ enum sci_status scic_io_request_construct_smp(struct scic_sds_request *sci_req)
        /* Construct the started sub-state machine. */
        sci_base_state_machine_construct(
                &sci_req->started_substate_machine,
-               &sci_req->parent,
+               sci_req,
                scic_sds_smp_request_started_substate_table,
                SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_RESPONSE
                );
index a7297abdb1bd16e266454ecec447b28c90f254e3..7183ae331d2ecbcef778c6d29e0b0ec32e58801b 100644 (file)
@@ -202,7 +202,7 @@ static const struct scic_sds_io_request_state_handler scic_sds_ssp_task_request_
 static void scic_sds_io_request_started_task_mgmt_await_tc_completion_substate_enter(
        void *object)
 {
-       struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
+       struct scic_sds_request *sci_req = object;
 
        SET_STATE_HANDLER(
                sci_req,
@@ -223,7 +223,7 @@ static void scic_sds_io_request_started_task_mgmt_await_tc_completion_substate_e
 static void scic_sds_io_request_started_task_mgmt_await_task_response_substate_enter(
        void *object)
 {
-       struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
+       struct scic_sds_request *sci_req = object;
 
        SET_STATE_HANDLER(
                sci_req,
index 2c6b62ee5fe8c4d650a5de81150db6850d8b6f46..ec215463092a6c5d7dd29f2f5a8e0b58e1aab060 100644 (file)
@@ -566,7 +566,7 @@ static const struct scic_sds_io_request_state_handler scic_sds_stp_request_start
 static void scic_sds_stp_request_started_non_data_await_h2d_completion_enter(
        void *object)
 {
-       struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
+       struct scic_sds_request *sci_req = object;
 
        SET_STATE_HANDLER(
                sci_req,
@@ -581,7 +581,7 @@ static void scic_sds_stp_request_started_non_data_await_h2d_completion_enter(
 
 static void scic_sds_stp_request_started_non_data_await_d2h_enter(void *object)
 {
-       struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
+       struct scic_sds_request *sci_req = object;
 
        SET_STATE_HANDLER(
                sci_req,
@@ -611,7 +611,7 @@ enum sci_status scic_sds_stp_non_data_request_construct(struct scic_sds_request
        scu_stp_raw_request_construct_task_context(stp_req, sci_req->task_context_buffer);
 
        sci_base_state_machine_construct(&sci_req->started_substate_machine,
-                                        &sci_req->parent,
+                                        sci_req,
                                         scic_sds_stp_request_started_non_data_substate_table,
                                         SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_H2D_COMPLETION_SUBSTATE);
 
@@ -1215,7 +1215,7 @@ static const struct scic_sds_io_request_state_handler scic_sds_stp_request_start
 static void scic_sds_stp_request_started_pio_await_h2d_completion_enter(
        void *object)
 {
-       struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
+       struct scic_sds_request *sci_req = object;
 
        SET_STATE_HANDLER(
                sci_req,
@@ -1229,7 +1229,7 @@ static void scic_sds_stp_request_started_pio_await_h2d_completion_enter(
 
 static void scic_sds_stp_request_started_pio_await_frame_enter(void *object)
 {
-       struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
+       struct scic_sds_request *sci_req = object;
 
        SET_STATE_HANDLER(
                sci_req,
@@ -1241,7 +1241,7 @@ static void scic_sds_stp_request_started_pio_await_frame_enter(void *object)
 static void scic_sds_stp_request_started_pio_data_in_await_data_enter(
        void *object)
 {
-       struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
+       struct scic_sds_request *sci_req = object;
 
        SET_STATE_HANDLER(
                sci_req,
@@ -1253,7 +1253,7 @@ static void scic_sds_stp_request_started_pio_data_in_await_data_enter(
 static void scic_sds_stp_request_started_pio_data_out_transmit_data_enter(
        void *object)
 {
-       struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
+       struct scic_sds_request *sci_req = object;
 
        SET_STATE_HANDLER(
                sci_req,
@@ -1311,7 +1311,7 @@ enum sci_status scic_sds_stp_pio_request_construct(struct scic_sds_request *sci_
        }
 
        sci_base_state_machine_construct(&sci_req->started_substate_machine,
-                                        &sci_req->parent,
+                                        sci_req,
                                         scic_sds_stp_request_started_pio_substate_table,
                                         SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_H2D_COMPLETION_SUBSTATE);
 
@@ -1485,7 +1485,7 @@ static const struct scic_sds_io_request_state_handler scic_sds_stp_request_start
 static void scic_sds_stp_request_started_udma_await_tc_completion_enter(
        void *object)
 {
-       struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
+       struct scic_sds_request *sci_req = object;
 
        SET_STATE_HANDLER(
                sci_req,
@@ -1504,7 +1504,7 @@ static void scic_sds_stp_request_started_udma_await_tc_completion_enter(
 static void scic_sds_stp_request_started_udma_await_d2h_reg_fis_enter(
        void *object)
 {
-       struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
+       struct scic_sds_request *sci_req = object;
 
        SET_STATE_HANDLER(
                sci_req,
@@ -1535,7 +1535,7 @@ enum sci_status scic_sds_stp_udma_request_construct(struct scic_sds_request *sci
 
        sci_base_state_machine_construct(
                &sci_req->started_substate_machine,
-               &sci_req->parent,
+               sci_req,
                scic_sds_stp_request_started_udma_substate_table,
                SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE
                );
@@ -1732,7 +1732,7 @@ static const struct scic_sds_io_request_state_handler scic_sds_stp_request_start
 static void scic_sds_stp_request_started_soft_reset_await_h2d_asserted_completion_enter(
        void *object)
 {
-       struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
+       struct scic_sds_request *sci_req = object;
 
        SET_STATE_HANDLER(
                sci_req,
@@ -1748,7 +1748,7 @@ static void scic_sds_stp_request_started_soft_reset_await_h2d_asserted_completio
 static void scic_sds_stp_request_started_soft_reset_await_h2d_diagnostic_completion_enter(
        void *object)
 {
-       struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
+       struct scic_sds_request *sci_req = object;
        struct scu_task_context *task_context;
        struct sata_fis_reg_h2d *h2d_fis;
        enum sci_status status;
@@ -1775,7 +1775,7 @@ static void scic_sds_stp_request_started_soft_reset_await_h2d_diagnostic_complet
 static void scic_sds_stp_request_started_soft_reset_await_d2h_response_enter(
        void *object)
 {
-       struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
+       struct scic_sds_request *sci_req = object;
 
        SET_STATE_HANDLER(
                sci_req,
@@ -1806,7 +1806,7 @@ enum sci_status scic_sds_stp_soft_reset_request_construct(struct scic_sds_reques
        scu_stp_raw_request_construct_task_context(stp_req, sci_req->task_context_buffer);
 
        sci_base_state_machine_construct(&sci_req->started_substate_machine,
-                                        &sci_req->parent,
+                                        sci_req,
                                         scic_sds_stp_request_started_soft_reset_substate_table,
                                         SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_ASSERTED_COMPLETION_SUBSTATE);
 
index 281a556f5eebc49a80a7c58caf8093220fb47f97..c45e78e41f27a16b34e54f8fed2bd82ebd96bfb4 100644 (file)
@@ -61,7 +61,7 @@
 #include "request.h"
 #include "sata.h"
 #include "scu_completion_codes.h"
-
+#include "core/scic_sds_request.h"
 
 static enum sci_status isci_request_ssp_request_construct(
        struct isci_request *request)
@@ -225,7 +225,7 @@ static enum sci_status isci_io_request_build(
                return SCI_FAILURE;
        }
 
-       sci_object_set_association(request->sci_request_handle, request);
+       request->sci_request_handle->ireq = request;
 
        switch (task->task_proto) {
        case SAS_PROTOCOL_SMP:
index d869764694283990a848f1bef55b97d9cb09a563..1853552bc25221a8a7ae902b3c30b979bb9aaf7a 100644 (file)
@@ -209,8 +209,7 @@ static enum sci_status scic_sds_stp_remote_device_ready_idle_substate_start_io_h
        struct scic_sds_request *request)
 {
        enum sci_status status;
-       struct isci_request *isci_request =
-               (struct isci_request *)sci_object_get_association(request);
+       struct isci_request *isci_request = request->ireq;
 
 
        /* Will the port allow the io request to start? */
@@ -280,8 +279,7 @@ static enum sci_status scic_sds_stp_remote_device_ready_ncq_substate_start_io_ha
        struct scic_sds_request *request)
 {
        enum sci_status status;
-       struct isci_request *isci_request =
-               (struct isci_request *)sci_object_get_association(request);
+       struct isci_request *isci_request = request->ireq;
 
        if (isci_sata_get_sat_protocol(isci_request) == SAT_PROTOCOL_FPDMA) {
                status = sci_dev->owning_port->state_handlers->start_io_handler(
index c0ed1b28f3e56b45b42d765ca716c778d14e980c..95f38672321207b7ece42b6dab2c7118a1e92412 100644 (file)
@@ -63,7 +63,7 @@
 #include "request.h"
 #include "sata.h"
 #include "task.h"
-
+#include "core/scic_sds_request.h"
 /**
 * isci_task_refuse() - complete the request to the upper layer driver in
 *     the case where an I/O needs to be completed back in the submit path.
@@ -314,10 +314,7 @@ static enum sci_status isci_task_request_build(
                goto errout;
        }
 
-       sci_object_set_association(
-               request->sci_request_handle,
-               request
-               );
+       request->sci_request_handle->ireq =  request;
 
        /* XXX convert to get this from task->tproto like other drivers */
        if (dev->dev_type == SAS_END_DEV) {