提交 c629582d 编写于 作者: C Christoph Hellwig 提交者: Dan Williams

isci: remove scic_controller state handlers

Remove the state handler indirections for the scic_controller, and replace
them with procedural calls that check for the correct state first.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NDan Williams <dan.j.williams@intel.com>
上级 bc5c9674
......@@ -110,11 +110,6 @@ enum sci_task_status scic_controller_start_task(
struct scic_sds_request *task_request,
u16 io_tag);
enum sci_status scic_controller_complete_task(
struct scic_sds_controller *controller,
struct scic_sds_remote_device *remote_device,
struct scic_sds_request *task_request);
enum sci_status scic_controller_terminate_request(
struct scic_sds_controller *controller,
struct scic_sds_remote_device *remote_device,
......
......@@ -430,90 +430,6 @@ enum scic_sds_controller_states {
};
typedef enum sci_status (*scic_sds_controller_handler_t)
(struct scic_sds_controller *);
typedef enum sci_status (*scic_sds_controller_timed_handler_t)
(struct scic_sds_controller *, u32);
typedef enum sci_status (*scic_sds_controller_request_handler_t)
(struct scic_sds_controller *,
struct sci_base_remote_device *,
struct scic_sds_request *);
typedef enum sci_status (*scic_sds_controller_start_request_handler_t)
(struct scic_sds_controller *,
struct sci_base_remote_device *,
struct scic_sds_request *, u16);
typedef void (*scic_sds_controller_phy_handler_t)
(struct scic_sds_controller *,
struct scic_sds_port *,
struct scic_sds_phy *);
typedef void (*scic_sds_controller_device_handler_t)
(struct scic_sds_controller *,
struct scic_sds_remote_device *);
struct scic_sds_controller_state_handler {
/**
* The start_handler specifies the method invoked when a user attempts to
* start a controller.
*/
scic_sds_controller_timed_handler_t start;
/**
* The stop_handler specifies the method invoked when a user attempts to
* stop a controller.
*/
scic_sds_controller_timed_handler_t stop;
/**
* The reset_handler specifies the method invoked when a user attempts to
* reset a controller.
*/
scic_sds_controller_handler_t reset;
/**
* The initialize_handler specifies the method invoked when a user
* attempts to initialize a controller.
*/
scic_sds_controller_handler_t initialize;
/**
* The start_io_handler specifies the method invoked when a user
* attempts to start an IO request for a controller.
*/
scic_sds_controller_start_request_handler_t start_io;
/**
* The complete_io_handler specifies the method invoked when a user
* attempts to complete an IO request for a controller.
*/
scic_sds_controller_request_handler_t complete_io;
/**
* The continue_io_handler specifies the method invoked when a user
* attempts to continue an IO request for a controller.
*/
scic_sds_controller_request_handler_t continue_io;
/**
* The start_task_handler specifies the method invoked when a user
* attempts to start a task management request for a controller.
*/
scic_sds_controller_start_request_handler_t start_task;
/**
* The complete_task_handler specifies the method invoked when a user
* attempts to complete a task management request for a controller.
*/
scic_sds_controller_request_handler_t complete_task;
scic_sds_controller_request_handler_t terminate_request;
scic_sds_controller_phy_handler_t link_up;
scic_sds_controller_phy_handler_t link_down;
scic_sds_controller_device_handler_t device_stopped;
};
extern const struct scic_sds_controller_state_handler
scic_sds_controller_state_handler_table[];
/**
* INCREMENT_QUEUE_GET() -
*
......@@ -676,4 +592,6 @@ void scic_sds_controller_copy_task_context(
void scic_sds_controller_register_setup(
struct scic_sds_controller *this_controller);
enum sci_status scic_controller_continue_io(struct scic_sds_request *sci_req);
#endif /* _SCIC_SDS_CONTROLLER_H_ */
......@@ -558,17 +558,10 @@ void scic_sds_remote_device_start_request(
void scic_sds_remote_device_continue_request(void *dev)
{
struct scic_sds_remote_device *sci_dev = dev;
struct scic_sds_request *sci_req = sci_dev->working_request;
/* we need to check if this request is still valid to continue. */
if (sci_req) {
struct scic_sds_controller *scic = sci_req->owning_controller;
u32 state = scic->state_machine.current_state_id;
scic_sds_controller_request_handler_t continue_io;
continue_io = scic_sds_controller_state_handler_table[state].continue_io;
continue_io(scic, &sci_req->target_device->parent, sci_req);
}
if (sci_dev->working_request)
scic_controller_continue_io(sci_dev->working_request);
}
/**
......
......@@ -637,10 +637,7 @@ static enum sci_status scic_sds_stp_request_pio_data_out_trasmit_data_frame(
u32 length)
{
struct scic_sds_stp_request *this_sds_stp_request = (struct scic_sds_stp_request *)this_request;
scic_sds_controller_request_handler_t continue_io;
struct scu_sgl_element *current_sgl;
struct scic_sds_controller *scic;
u32 state;
/*
* Recycle the TC and reconstruct it for sending out DATA FIS containing
......@@ -662,10 +659,7 @@ static enum sci_status scic_sds_stp_request_pio_data_out_trasmit_data_frame(
task_context->type.stp.fis_type = SATA_FIS_TYPE_DATA;
/* send the new TC out. */
scic = this_request->owning_controller;
state = scic->state_machine.current_state_id;
continue_io = scic_sds_controller_state_handler_table[state].continue_io;
return continue_io(scic, &this_request->target_device->parent, this_request);
return scic_controller_continue_io(this_request);
}
/**
......@@ -1758,12 +1752,9 @@ static void scic_sds_stp_request_started_soft_reset_await_h2d_diagnostic_complet
struct sci_base_object *object)
{
struct scic_sds_request *this_request = (struct scic_sds_request *)object;
scic_sds_controller_request_handler_t continue_io;
struct scu_task_context *task_context;
struct sata_fis_reg_h2d *h2d_fis;
struct scic_sds_controller *scic;
enum sci_status status;
u32 state;
/* Clear the SRST bit */
h2d_fis = scic_stp_io_request_get_h2d_reg_address(this_request);
......@@ -1774,12 +1765,7 @@ static void scic_sds_stp_request_started_soft_reset_await_h2d_diagnostic_complet
this_request->owning_controller, this_request->io_tag);
task_context->control_frame = 0;
scic = this_request->owning_controller;
state = scic->state_machine.current_state_id;
continue_io = scic_sds_controller_state_handler_table[state].continue_io;
status = continue_io(scic, &this_request->target_device->parent, this_request);
status = scic_controller_continue_io(this_request);
if (status == SCI_SUCCESS) {
SET_STATE_HANDLER(
this_request,
......
......@@ -1480,7 +1480,7 @@ void isci_task_request_complete(
/* PRINT_TMF( ((struct isci_tmf *)request->task)); */
tmf_complete = tmf->complete;
scic_controller_complete_task(
scic_controller_complete_io(
isci_host->core_controller,
to_sci_dev(isci_device),
request->sci_request_handle
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册