From 890cae9b8a7defd87feb1ec77a2affd25bd59cce Mon Sep 17 00:00:00 2001 From: Maciej Patelczyk Date: Thu, 28 Apr 2011 22:06:31 +0000 Subject: [PATCH] isci: Removed sci_base_object from scic_sds_request. 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 Signed-off-by: Dan Williams --- drivers/scsi/isci/core/sci_util.c | 5 +-- drivers/scsi/isci/core/scic_sds_request.c | 42 ++++++++----------- drivers/scsi/isci/core/scic_sds_request.h | 6 +-- drivers/scsi/isci/core/scic_sds_smp_request.c | 6 +-- drivers/scsi/isci/core/scic_sds_ssp_request.c | 4 +- drivers/scsi/isci/core/scic_sds_stp_request.c | 30 ++++++------- drivers/scsi/isci/request.c | 4 +- drivers/scsi/isci/stp_remote_device.c | 6 +-- drivers/scsi/isci/task.c | 7 +--- 9 files changed, 48 insertions(+), 62 deletions(-) diff --git a/drivers/scsi/isci/core/sci_util.c b/drivers/scsi/isci/core/sci_util.c index cb3e9f73828..ebf0ed919a9 100644 --- a/drivers/scsi/isci/core/sci_util.c +++ b/drivers/scsi/isci/core/sci_util.c @@ -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; diff --git a/drivers/scsi/isci/core/scic_sds_request.c b/drivers/scsi/isci/core/scic_sds_request.c index a438ea22315..fba64288109 100644 --- a/drivers/scsi/isci/core/scic_sds_request.c +++ b/drivers/scsi/isci/core/scic_sds_request.c @@ -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 ); diff --git a/drivers/scsi/isci/core/scic_sds_request.h b/drivers/scsi/isci/core/scic_sds_request.h index 0bb1da81ce8..11d5a3ea9da 100644 --- a/drivers/scsi/isci/core/scic_sds_request.h +++ b/drivers/scsi/isci/core/scic_sds_request.h @@ -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. diff --git a/drivers/scsi/isci/core/scic_sds_smp_request.c b/drivers/scsi/isci/core/scic_sds_smp_request.c index 42997375977..ba29192f7fd 100644 --- a/drivers/scsi/isci/core/scic_sds_smp_request.c +++ b/drivers/scsi/isci/core/scic_sds_smp_request.c @@ -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 ); diff --git a/drivers/scsi/isci/core/scic_sds_ssp_request.c b/drivers/scsi/isci/core/scic_sds_ssp_request.c index a7297abdb1b..7183ae331d2 100644 --- a/drivers/scsi/isci/core/scic_sds_ssp_request.c +++ b/drivers/scsi/isci/core/scic_sds_ssp_request.c @@ -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, diff --git a/drivers/scsi/isci/core/scic_sds_stp_request.c b/drivers/scsi/isci/core/scic_sds_stp_request.c index 2c6b62ee5fe..ec215463092 100644 --- a/drivers/scsi/isci/core/scic_sds_stp_request.c +++ b/drivers/scsi/isci/core/scic_sds_stp_request.c @@ -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); diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c index 281a556f5ee..c45e78e41f2 100644 --- a/drivers/scsi/isci/request.c +++ b/drivers/scsi/isci/request.c @@ -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: diff --git a/drivers/scsi/isci/stp_remote_device.c b/drivers/scsi/isci/stp_remote_device.c index d8697646942..1853552bc25 100644 --- a/drivers/scsi/isci/stp_remote_device.c +++ b/drivers/scsi/isci/stp_remote_device.c @@ -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( diff --git a/drivers/scsi/isci/task.c b/drivers/scsi/isci/task.c index c0ed1b28f3e..95f38672321 100644 --- a/drivers/scsi/isci/task.c +++ b/drivers/scsi/isci/task.c @@ -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) { -- 2.39.5