Commit 0ea99d52 authored by Maciej Trela's avatar Maciej Trela Committed by Dan Williams

isci: remove base_remote_device abstraction

Merge struct sci_base_remote_device into scic_sds_remote_device.  As for
now sci_base_remote_device was accessed indirectly using
scic_sds_remote_device->parent field.  Both machine state handlers are
also merged together.
Reported-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarMaciej Trela <Maciej.Trela@intel.com>
Signed-off-by: default avatarMaciej Patelczyk <maciej.patelczyk@intel.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent c629582d
/*
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
*
* GPL LICENSE SUMMARY
*
* Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
* The full GNU General Public License is included in this distribution
* in the file called LICENSE.GPL.
*
* BSD LICENSE
*
* Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _SCI_BASE_REMOTE_DEVICE_H_
#define _SCI_BASE_REMOTE_DEVICE_H_
/**
* This file contains all of the structures, constants, and methods common to
* all remote device object definitions.
*
*
*/
#include "sci_base_state_machine.h"
struct scic_sds_request;
/**
* enum sci_base_remote_device_states - This enumeration depicts all the states
* for the common remote device state machine.
*
*
*/
enum sci_base_remote_device_states {
/**
* Simply the initial state for the base remote device state machine.
*/
SCI_BASE_REMOTE_DEVICE_STATE_INITIAL,
/**
* This state indicates that the remote device has successfully been
* stopped. In this state no new IO operations are permitted.
* This state is entered from the INITIAL state.
* This state is entered from the STOPPING state.
*/
SCI_BASE_REMOTE_DEVICE_STATE_STOPPED,
/**
* This state indicates the the remote device is in the process of
* becoming ready (i.e. starting). In this state no new IO operations
* are permitted.
* This state is entered from the STOPPED state.
*/
SCI_BASE_REMOTE_DEVICE_STATE_STARTING,
/**
* This state indicates the remote device is now ready. Thus, the user
* is able to perform IO operations on the remote device.
* This state is entered from the STARTING state.
*/
SCI_BASE_REMOTE_DEVICE_STATE_READY,
/**
* This state indicates that the remote device is in the process of
* stopping. In this state no new IO operations are permitted, but
* existing IO operations are allowed to complete.
* This state is entered from the READY state.
* This state is entered from the FAILED state.
*/
SCI_BASE_REMOTE_DEVICE_STATE_STOPPING,
/**
* This state indicates that the remote device has failed.
* In this state no new IO operations are permitted.
* This state is entered from the INITIALIZING state.
* This state is entered from the READY state.
*/
SCI_BASE_REMOTE_DEVICE_STATE_FAILED,
/**
* This state indicates the device is being reset.
* In this state no new IO operations are permitted.
* This state is entered from the READY state.
*/
SCI_BASE_REMOTE_DEVICE_STATE_RESETTING,
/**
* Simply the final state for the base remote device state machine.
*/
SCI_BASE_REMOTE_DEVICE_STATE_FINAL,
};
/**
* struct sci_base_remote_device - The base remote device object abstracts the
* fields common to all SCI remote device objects.
*
*
*/
struct sci_base_remote_device {
/**
* The field specifies that the parent object for the base remote
* device is the base object itself.
*/
struct sci_base_object parent;
/**
* This field contains the information for the base remote device state
* machine.
*/
struct sci_base_state_machine state_machine;
};
typedef enum sci_status (*sci_base_remote_device_handler_t)(
struct sci_base_remote_device *
);
typedef enum sci_status (*sci_base_remote_device_request_handler_t)(
struct sci_base_remote_device *,
struct scic_sds_request *
);
typedef enum sci_status (*sci_base_remote_device_high_priority_request_complete_handler_t)(
struct sci_base_remote_device *,
struct scic_sds_request *,
void *,
enum sci_io_status
);
/**
* struct sci_base_remote_device_state_handler - This structure contains all of
* the state handler methods common to base remote device state machines.
* Handler methods provide the ability to change the behavior for user
* requests or transitions depending on the state the machine is in.
*
*
*/
struct sci_base_remote_device_state_handler {
/**
* The start_handler specifies the method invoked when a user attempts to
* start a remote device.
*/
sci_base_remote_device_handler_t start_handler;
/**
* The stop_handler specifies the method invoked when a user attempts to
* stop a remote device.
*/
sci_base_remote_device_handler_t stop_handler;
/**
* The fail_handler specifies the method invoked when a remote device
* failure has occurred. A failure may be due to an inability to
* initialize/configure the device.
*/
sci_base_remote_device_handler_t fail_handler;
/**
* The destruct_handler specifies the method invoked when attempting to
* destruct a remote device.
*/
sci_base_remote_device_handler_t destruct_handler;
/**
* The reset handler specifies the method invloked when requesting to reset a
* remote device.
*/
sci_base_remote_device_handler_t reset_handler;
/**
* The reset complete handler specifies the method invloked when reporting
* that a reset has completed to the remote device.
*/
sci_base_remote_device_handler_t reset_complete_handler;
/**
* The start_io_handler specifies the method invoked when a user
* attempts to start an IO request for a remote device.
*/
sci_base_remote_device_request_handler_t start_io_handler;
/**
* The complete_io_handler specifies the method invoked when a user
* attempts to complete an IO request for a remote device.
*/
sci_base_remote_device_request_handler_t complete_io_handler;
/**
* The continue_io_handler specifies the method invoked when a user
* attempts to continue an IO request for a remote device.
*/
sci_base_remote_device_request_handler_t continue_io_handler;
/**
* The start_task_handler specifies the method invoked when a user
* attempts to start a task management request for a remote device.
*/
sci_base_remote_device_request_handler_t start_task_handler;
/**
* The complete_task_handler specifies the method invoked when a user
* attempts to complete a task management request for a remote device.
*/
sci_base_remote_device_request_handler_t complete_task_handler;
};
/**
* sci_base_remote_device_construct() - Construct the base remote device
* @this_remote_device: This parameter specifies the base remote device to be
* constructed.
* @state_table: This parameter specifies the table of state definitions to be
* utilized for the remote device state machine.
*
*/
static inline void sci_base_remote_device_construct(
struct sci_base_remote_device *base_dev,
const struct sci_base_state *state_table)
{
base_dev->parent.private = NULL;
sci_base_state_machine_construct(
&base_dev->state_machine,
&base_dev->parent,
state_table,
SCI_BASE_REMOTE_DEVICE_STATE_INITIAL
);
sci_base_state_machine_start(
&base_dev->state_machine
);
}
#endif /* _SCI_BASE_REMOTE_DEVICE_H_ */
...@@ -1500,13 +1500,13 @@ void scic_sds_controller_link_down(struct scic_sds_controller *scic, ...@@ -1500,13 +1500,13 @@ void scic_sds_controller_link_down(struct scic_sds_controller *scic,
* *
*/ */
static bool scic_sds_controller_has_remote_devices_stopping( static bool scic_sds_controller_has_remote_devices_stopping(
struct scic_sds_controller *this_controller) struct scic_sds_controller *controller)
{ {
u32 index; u32 index;
for (index = 0; index < this_controller->remote_node_entries; index++) { for (index = 0; index < controller->remote_node_entries; index++) {
if ((this_controller->device_table[index] != NULL) && if ((controller->device_table[index] != NULL) &&
(this_controller->device_table[index]->parent.state_machine.current_state_id (controller->device_table[index]->state_machine.current_state_id
== SCI_BASE_REMOTE_DEVICE_STATE_STOPPING)) == SCI_BASE_REMOTE_DEVICE_STATE_STOPPING))
return true; return true;
} }
......
...@@ -123,7 +123,7 @@ enum sci_status scic_remote_device_da_construct( ...@@ -123,7 +123,7 @@ enum sci_status scic_remote_device_da_construct(
sci_base_state_machine_construct( sci_base_state_machine_construct(
&sci_dev->ready_substate_machine, &sci_dev->ready_substate_machine,
&sci_dev->parent.parent, &sci_dev->parent,
scic_sds_stp_remote_device_ready_substate_table, scic_sds_stp_remote_device_ready_substate_table,
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE); SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE);
} else if (sci_dev->target_protocols.u.bits.attached_smp_target) { } else if (sci_dev->target_protocols.u.bits.attached_smp_target) {
...@@ -132,7 +132,7 @@ enum sci_status scic_remote_device_da_construct( ...@@ -132,7 +132,7 @@ enum sci_status scic_remote_device_da_construct(
/* add the SMP ready substate machine construction here */ /* add the SMP ready substate machine construction here */
sci_base_state_machine_construct( sci_base_state_machine_construct(
&sci_dev->ready_substate_machine, &sci_dev->ready_substate_machine,
&sci_dev->parent.parent, &sci_dev->parent,
scic_sds_smp_remote_device_ready_substate_table, scic_sds_smp_remote_device_ready_substate_table,
SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE); SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE);
} }
...@@ -187,7 +187,7 @@ enum sci_status scic_remote_device_ea_construct( ...@@ -187,7 +187,7 @@ enum sci_status scic_remote_device_ea_construct(
/* add the SMP ready substate machine construction here */ /* add the SMP ready substate machine construction here */
sci_base_state_machine_construct( sci_base_state_machine_construct(
&sci_dev->ready_substate_machine, &sci_dev->ready_substate_machine,
&sci_dev->parent.parent, &sci_dev->parent,
scic_sds_smp_remote_device_ready_substate_table, scic_sds_smp_remote_device_ready_substate_table,
SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE); SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE);
} else if (sci_dev->target_protocols.u.bits.attached_stp_target) { } else if (sci_dev->target_protocols.u.bits.attached_stp_target) {
...@@ -195,7 +195,7 @@ enum sci_status scic_remote_device_ea_construct( ...@@ -195,7 +195,7 @@ enum sci_status scic_remote_device_ea_construct(
sci_base_state_machine_construct( sci_base_state_machine_construct(
&sci_dev->ready_substate_machine, &sci_dev->ready_substate_machine,
&sci_dev->parent.parent, &sci_dev->parent,
scic_sds_stp_remote_device_ready_substate_table, scic_sds_stp_remote_device_ready_substate_table,
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE); SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE);
} }
...@@ -222,7 +222,7 @@ enum sci_status scic_remote_device_ea_construct( ...@@ -222,7 +222,7 @@ enum sci_status scic_remote_device_ea_construct(
enum sci_status scic_remote_device_destruct( enum sci_status scic_remote_device_destruct(
struct scic_sds_remote_device *sci_dev) struct scic_sds_remote_device *sci_dev)
{ {
return sci_dev->state_handlers->parent.destruct_handler(&sci_dev->parent); return sci_dev->state_handlers->destruct_handler(sci_dev);
} }
...@@ -230,7 +230,7 @@ enum sci_status scic_remote_device_start( ...@@ -230,7 +230,7 @@ enum sci_status scic_remote_device_start(
struct scic_sds_remote_device *sci_dev, struct scic_sds_remote_device *sci_dev,
u32 timeout) u32 timeout)
{ {
return sci_dev->state_handlers->parent.start_handler(&sci_dev->parent); return sci_dev->state_handlers->start_handler(sci_dev);
} }
...@@ -238,21 +238,21 @@ enum sci_status scic_remote_device_stop( ...@@ -238,21 +238,21 @@ enum sci_status scic_remote_device_stop(
struct scic_sds_remote_device *sci_dev, struct scic_sds_remote_device *sci_dev,
u32 timeout) u32 timeout)
{ {
return sci_dev->state_handlers->parent.stop_handler(&sci_dev->parent); return sci_dev->state_handlers->stop_handler(sci_dev);
} }
enum sci_status scic_remote_device_reset( enum sci_status scic_remote_device_reset(
struct scic_sds_remote_device *sci_dev) struct scic_sds_remote_device *sci_dev)
{ {
return sci_dev->state_handlers->parent.reset_handler(&sci_dev->parent); return sci_dev->state_handlers->reset_handler(sci_dev);
} }
enum sci_status scic_remote_device_reset_complete( enum sci_status scic_remote_device_reset_complete(
struct scic_sds_remote_device *sci_dev) struct scic_sds_remote_device *sci_dev)
{ {
return sci_dev->state_handlers->parent.reset_complete_handler(&sci_dev->parent); return sci_dev->state_handlers->reset_complete_handler(sci_dev);
} }
...@@ -362,8 +362,8 @@ enum sci_status scic_sds_remote_device_start_io( ...@@ -362,8 +362,8 @@ enum sci_status scic_sds_remote_device_start_io(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *this_device,
struct scic_sds_request *io_request) struct scic_sds_request *io_request)
{ {
return this_device->state_handlers->parent.start_io_handler( return this_device->state_handlers->start_io_handler(
&this_device->parent, io_request); this_device, io_request);
} }
/** /**
...@@ -380,8 +380,8 @@ enum sci_status scic_sds_remote_device_complete_io( ...@@ -380,8 +380,8 @@ enum sci_status scic_sds_remote_device_complete_io(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *this_device,
struct scic_sds_request *io_request) struct scic_sds_request *io_request)
{ {
return this_device->state_handlers->parent.complete_io_handler( return this_device->state_handlers->complete_io_handler(
&this_device->parent, io_request); this_device, io_request);
} }
/** /**
...@@ -398,8 +398,8 @@ enum sci_status scic_sds_remote_device_start_task( ...@@ -398,8 +398,8 @@ enum sci_status scic_sds_remote_device_start_task(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *this_device,
struct scic_sds_request *io_request) struct scic_sds_request *io_request)
{ {
return this_device->state_handlers->parent.start_task_handler( return this_device->state_handlers->start_task_handler(
&this_device->parent, io_request); this_device, io_request);
} }
/** /**
...@@ -491,7 +491,7 @@ static void scic_sds_cb_remote_device_rnc_destruct_complete( ...@@ -491,7 +491,7 @@ static void scic_sds_cb_remote_device_rnc_destruct_complete(
BUG_ON(sci_dev->started_request_count != 0); BUG_ON(sci_dev->started_request_count != 0);
sci_base_state_machine_change_state(&sci_dev->parent.state_machine, sci_base_state_machine_change_state(&sci_dev->state_machine,
SCI_BASE_REMOTE_DEVICE_STATE_STOPPED); SCI_BASE_REMOTE_DEVICE_STATE_STOPPED);
} }
...@@ -511,11 +511,11 @@ static void scic_sds_remote_device_resume_complete_handler( ...@@ -511,11 +511,11 @@ static void scic_sds_remote_device_resume_complete_handler(
this_device = (struct scic_sds_remote_device *)user_parameter; this_device = (struct scic_sds_remote_device *)user_parameter;
if ( if (
sci_base_state_machine_get_state(&this_device->parent.state_machine) sci_base_state_machine_get_state(&this_device->state_machine)
!= SCI_BASE_REMOTE_DEVICE_STATE_READY != SCI_BASE_REMOTE_DEVICE_STATE_READY
) { ) {
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_device->parent.state_machine, &this_device->state_machine,
SCI_BASE_REMOTE_DEVICE_STATE_READY SCI_BASE_REMOTE_DEVICE_STATE_READY
); );
} }
...@@ -614,69 +614,67 @@ static enum sci_status scic_sds_remote_device_terminate_requests( ...@@ -614,69 +614,67 @@ static enum sci_status scic_sds_remote_device_terminate_requests(
return status; return status;
} }
static enum sci_status default_device_handler(struct sci_base_remote_device *base_dev, static enum sci_status
const char *func) default_device_handler(struct scic_sds_remote_device *sci_dev,
const char *func)
{ {
struct scic_sds_remote_device *sci_dev;
sci_dev = container_of(base_dev, typeof(*sci_dev), parent);
dev_warn(scirdev_to_dev(sci_dev), dev_warn(scirdev_to_dev(sci_dev),
"%s: in wrong state: %d\n", func, "%s: in wrong state: %d\n", func,
sci_base_state_machine_get_state(&base_dev->state_machine)); sci_base_state_machine_get_state(&sci_dev->state_machine));
return SCI_FAILURE_INVALID_STATE; return SCI_FAILURE_INVALID_STATE;
} }
enum sci_status scic_sds_remote_device_default_start_handler( enum sci_status scic_sds_remote_device_default_start_handler(
struct sci_base_remote_device *base_dev) struct scic_sds_remote_device *sci_dev)
{ {
return default_device_handler(base_dev, __func__); return default_device_handler(sci_dev, __func__);
} }
static enum sci_status scic_sds_remote_device_default_stop_handler( static enum sci_status scic_sds_remote_device_default_stop_handler(
struct sci_base_remote_device *base_dev) struct scic_sds_remote_device *sci_dev)
{ {
return default_device_handler(base_dev, __func__); return default_device_handler(sci_dev, __func__);
} }
enum sci_status scic_sds_remote_device_default_fail_handler( enum sci_status scic_sds_remote_device_default_fail_handler(
struct sci_base_remote_device *base_dev) struct scic_sds_remote_device *sci_dev)
{ {
return default_device_handler(base_dev, __func__); return default_device_handler(sci_dev, __func__);
} }
enum sci_status scic_sds_remote_device_default_destruct_handler( enum sci_status scic_sds_remote_device_default_destruct_handler(
struct sci_base_remote_device *base_dev) struct scic_sds_remote_device *sci_dev)
{ {
return default_device_handler(base_dev, __func__); return default_device_handler(sci_dev, __func__);
} }
enum sci_status scic_sds_remote_device_default_reset_handler( enum sci_status scic_sds_remote_device_default_reset_handler(
struct sci_base_remote_device *base_dev) struct scic_sds_remote_device *sci_dev)
{ {
return default_device_handler(base_dev, __func__); return default_device_handler(sci_dev, __func__);
} }
enum sci_status scic_sds_remote_device_default_reset_complete_handler( enum sci_status scic_sds_remote_device_default_reset_complete_handler(
struct sci_base_remote_device *base_dev) struct scic_sds_remote_device *sci_dev)
{ {
return default_device_handler(base_dev, __func__); return default_device_handler(sci_dev, __func__);
} }
enum sci_status scic_sds_remote_device_default_suspend_handler( enum sci_status scic_sds_remote_device_default_suspend_handler(
struct scic_sds_remote_device *sci_dev, u32 suspend_type) struct scic_sds_remote_device *sci_dev, u32 suspend_type)
{ {
return default_device_handler(&sci_dev->parent, __func__); return default_device_handler(sci_dev, __func__);
} }
enum sci_status scic_sds_remote_device_default_resume_handler( enum sci_status scic_sds_remote_device_default_resume_handler(
struct scic_sds_remote_device *sci_dev) struct scic_sds_remote_device *sci_dev)
{ {
return default_device_handler(&sci_dev->parent, __func__); return default_device_handler(sci_dev, __func__);
} }
/** /**
* *
* @device: The struct sci_base_remote_device which is then cast into a * @device: The struct scic_sds_remote_device which is then cast into a
* struct scic_sds_remote_device. * struct scic_sds_remote_device.
* @event_code: The event code that the struct scic_sds_controller wants the device * @event_code: The event code that the struct scic_sds_controller wants the device
* object to process. * object to process.
...@@ -734,7 +732,7 @@ static enum sci_status scic_sds_remote_device_core_event_handler( ...@@ -734,7 +732,7 @@ static enum sci_status scic_sds_remote_device_core_event_handler(
} }
/** /**
* *
* @device: The struct sci_base_remote_device which is then cast into a * @device: The struct scic_sds_remote_device which is then cast into a
* struct scic_sds_remote_device. * struct scic_sds_remote_device.
* @event_code: The event code that the struct scic_sds_controller wants the device * @event_code: The event code that the struct scic_sds_controller wants the device
* object to process. * object to process.
...@@ -754,7 +752,7 @@ static enum sci_status scic_sds_remote_device_default_event_handler( ...@@ -754,7 +752,7 @@ static enum sci_status scic_sds_remote_device_default_event_handler(
/** /**
* *
* @device: The struct sci_base_remote_device which is then cast into a * @device: The struct scic_sds_remote_device which is then cast into a
* struct scic_sds_remote_device. * struct scic_sds_remote_device.
* @frame_index: The frame index for which the struct scic_sds_controller wants this * @frame_index: The frame index for which the struct scic_sds_controller wants this
* device object to process. * device object to process.
...@@ -773,7 +771,7 @@ enum sci_status scic_sds_remote_device_default_frame_handler( ...@@ -773,7 +771,7 @@ enum sci_status scic_sds_remote_device_default_frame_handler(
__func__, __func__,
frame_index, frame_index,
sci_base_state_machine_get_state( sci_base_state_machine_get_state(
&this_device->parent.state_machine)); &this_device->state_machine));
/* Return the frame back to the controller */ /* Return the frame back to the controller */
scic_sds_controller_release_frame( scic_sds_controller_release_frame(
...@@ -784,29 +782,29 @@ enum sci_status scic_sds_remote_device_default_frame_handler( ...@@ -784,29 +782,29 @@ enum sci_status scic_sds_remote_device_default_frame_handler(
} }
enum sci_status scic_sds_remote_device_default_start_request_handler( enum sci_status scic_sds_remote_device_default_start_request_handler(
struct sci_base_remote_device *base_dev, struct scic_sds_remote_device *sci_dev,
struct scic_sds_request *request) struct scic_sds_request *request)
{ {
return default_device_handler(base_dev, __func__); return default_device_handler(sci_dev, __func__);
} }
enum sci_status scic_sds_remote_device_default_complete_request_handler( enum sci_status scic_sds_remote_device_default_complete_request_handler(
struct sci_base_remote_device *base_dev, struct scic_sds_remote_device *sci_dev,
struct scic_sds_request *request) struct scic_sds_request *request)
{ {
return default_device_handler(base_dev, __func__); return default_device_handler(sci_dev, __func__);
} }
enum sci_status scic_sds_remote_device_default_continue_request_handler( enum sci_status scic_sds_remote_device_default_continue_request_handler(
struct sci_base_remote_device *base_dev, struct scic_sds_remote_device *sci_dev,
struct scic_sds_request *request) struct scic_sds_request *request)
{ {
return default_device_handler(base_dev, __func__); return default_device_handler(sci_dev, __func__);
} }
/** /**
* *
* @device: The struct sci_base_remote_device which is then cast into a * @device: The struct scic_sds_remote_device which is then cast into a
* struct scic_sds_remote_device. * struct scic_sds_remote_device.
* @frame_index: The frame index for which the struct scic_sds_controller wants this * @frame_index: The frame index for which the struct scic_sds_controller wants this
* device object to process. * device object to process.
...@@ -887,32 +885,29 @@ enum sci_status scic_sds_remote_device_general_event_handler( ...@@ -887,32 +885,29 @@ enum sci_status scic_sds_remote_device_general_event_handler(
* which to construct the remote device. * which to construct the remote device.
*/ */
static enum sci_status scic_sds_remote_device_stopped_state_start_handler( static enum sci_status scic_sds_remote_device_stopped_state_start_handler(
struct sci_base_remote_device *base_dev) struct scic_sds_remote_device *sci_dev)
{ {
enum sci_status status; enum sci_status status;
struct scic_sds_remote_device *sci_dev;
sci_dev = container_of(base_dev, typeof(*sci_dev), parent);
status = scic_sds_remote_node_context_resume(sci_dev->rnc, status = scic_sds_remote_node_context_resume(sci_dev->rnc,
scic_sds_remote_device_resume_complete_handler, sci_dev); scic_sds_remote_device_resume_complete_handler, sci_dev);
if (status == SCI_SUCCESS) if (status == SCI_SUCCESS)
sci_base_state_machine_change_state(&base_dev->state_machine, sci_base_state_machine_change_state(&sci_dev->state_machine,
SCI_BASE_REMOTE_DEVICE_STATE_STARTING); SCI_BASE_REMOTE_DEVICE_STATE_STARTING);
return status; return status;
} }
static enum sci_status scic_sds_remote_device_stopped_state_stop_handler( static enum sci_status scic_sds_remote_device_stopped_state_stop_handler(
struct sci_base_remote_device *base_dev) struct scic_sds_remote_device *sci_dev)
{ {
return SCI_SUCCESS; return SCI_SUCCESS;
} }
/** /**
* *
* @sci_dev: The struct sci_base_remote_device which is cast into a * @sci_dev: The struct scic_sds_remote_device which is cast into a
* struct scic_sds_remote_device. * struct scic_sds_remote_device.
* *
* This method will destruct a struct scic_sds_remote_device that is in a stopped * This method will destruct a struct scic_sds_remote_device that is in a stopped
...@@ -922,18 +917,16 @@ static enum sci_status scic_sds_remote_device_stopped_state_stop_handler( ...@@ -922,18 +917,16 @@ static enum sci_status scic_sds_remote_device_stopped_state_stop_handler(
* enum sci_status SCI_SUCCESS * enum sci_status SCI_SUCCESS
*/ */
static enum sci_status scic_sds_remote_device_stopped_state_destruct_handler( static enum sci_status scic_sds_remote_device_stopped_state_destruct_handler(
struct sci_base_remote_device *base_dev) struct scic_sds_remote_device *sci_dev)
{ {
struct scic_sds_remote_device *sci_dev;
struct scic_sds_controller *scic; struct scic_sds_controller *scic;
sci_dev = container_of(base_dev, typeof(*sci_dev), parent);
scic = scic_sds_remote_device_get_controller(sci_dev); scic = scic_sds_remote_device_get_controller(sci_dev);
scic_sds_controller_free_remote_node_context(scic, sci_dev, scic_sds_controller_free_remote_node_context(scic, sci_dev,
sci_dev->rnc->remote_node_index); sci_dev->rnc->remote_node_index);
sci_dev->rnc->remote_node_index = SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX; sci_dev->rnc->remote_node_index = SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX;
sci_base_state_machine_change_state(&base_dev->state_machine, sci_base_state_machine_change_state(&sci_dev->state_machine,
SCI_BASE_REMOTE_DEVICE_STATE_FINAL); SCI_BASE_REMOTE_DEVICE_STATE_FINAL);
return SCI_SUCCESS; return SCI_SUCCESS;
...@@ -945,11 +938,8 @@ static enum sci_status scic_sds_remote_device_stopped_state_destruct_handler( ...@@ -945,11 +938,8 @@ static enum sci_status scic_sds_remote_device_stopped_state_destruct_handler(
* ***************************************************************************** */ * ***************************************************************************** */
static enum sci_status scic_sds_remote_device_starting_state_stop_handler( static enum sci_status scic_sds_remote_device_starting_state_stop_handler(
struct sci_base_remote_device *base_dev) struct scic_sds_remote_device *sci_dev)
{ {
struct scic_sds_remote_device *sci_dev;
sci_dev = container_of(base_dev, typeof(*sci_dev), parent);
/* /*
* This device has not yet started so there had better be no IO requests * This device has not yet started so there had better be no IO requests
*/ */
...@@ -965,21 +955,19 @@ static enum sci_status scic_sds_remote_device_starting_state_stop_handler( ...@@ -965,21 +955,19 @@ static enum sci_status scic_sds_remote_device_starting_state_stop_handler(
* Transition to the stopping state and wait for the remote node to * Transition to the stopping state and wait for the remote node to
* complete being posted and invalidated. * complete being posted and invalidated.
*/ */
sci_base_state_machine_change_state(&base_dev->state_machine, sci_base_state_machine_change_state(&sci_dev->state_machine,
SCI_BASE_REMOTE_DEVICE_STATE_STOPPING); SCI_BASE_REMOTE_DEVICE_STATE_STOPPING);
return SCI_SUCCESS; return SCI_SUCCESS;
} }
enum sci_status scic_sds_remote_device_ready_state_stop_handler( enum sci_status scic_sds_remote_device_ready_state_stop_handler(
struct sci_base_remote_device *base_dev) struct scic_sds_remote_device *sci_dev)
{ {
struct scic_sds_remote_device *sci_dev;
enum sci_status status = SCI_SUCCESS; enum sci_status status = SCI_SUCCESS;
sci_dev = container_of(base_dev, typeof(*sci_dev), parent);
/* Request the parent state machine to transition to the stopping state */ /* Request the parent state machine to transition to the stopping state */
sci_base_state_machine_change_state(&base_dev->state_machine, sci_base_state_machine_change_state(&sci_dev->state_machine,
SCI_BASE_REMOTE_DEVICE_STATE_STOPPING); SCI_BASE_REMOTE_DEVICE_STATE_STOPPING);
if (sci_dev->started_request_count == 0) { if (sci_dev->started_request_count == 0) {
...@@ -994,19 +982,16 @@ enum sci_status scic_sds_remote_device_ready_state_stop_handler( ...@@ -994,19 +982,16 @@ enum sci_status scic_sds_remote_device_ready_state_stop_handler(
/** /**
* *
* @device: The struct sci_base_remote_device object which is cast to a * @device: The struct scic_sds_remote_device object which is cast to a
* struct scic_sds_remote_device object. * struct scic_sds_remote_device object.
* *
* This is the ready state device reset handler enum sci_status * This is the ready state device reset handler enum sci_status
*/ */
enum sci_status scic_sds_remote_device_ready_state_reset_handler( enum sci_status scic_sds_remote_device_ready_state_reset_handler(
struct sci_base_remote_device *base_dev) struct scic_sds_remote_device *sci_dev)
{ {
struct scic_sds_remote_device *sci_dev;
sci_dev = container_of(base_dev, typeof(*sci_dev), parent);
/* Request the parent state machine to transition to the stopping state */ /* Request the parent state machine to transition to the stopping state */
sci_base_state_machine_change_state(&base_dev->state_machine, sci_base_state_machine_change_state(&sci_dev->state_machine,
SCI_BASE_REMOTE_DEVICE_STATE_RESETTING); SCI_BASE_REMOTE_DEVICE_STATE_RESETTING);
return SCI_SUCCESS; return SCI_SUCCESS;
...@@ -1021,23 +1006,22 @@ enum sci_status scic_sds_remote_device_ready_state_reset_handler( ...@@ -1021,23 +1006,22 @@ enum sci_status scic_sds_remote_device_ready_state_reset_handler(
* object could not get the resources to start. * object could not get the resources to start.
*/ */
static enum sci_status scic_sds_remote_device_ready_state_start_task_handler( static enum sci_status scic_sds_remote_device_ready_state_start_task_handler(
struct sci_base_remote_device *device, struct scic_sds_remote_device *sci_dev,
struct scic_sds_request *request) struct scic_sds_request *request)
{ {
enum sci_status result; enum sci_status result;
struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
/* See if the port is in a state where we can start the IO request */ /* See if the port is in a state where we can start the IO request */
result = scic_sds_port_start_io( result = scic_sds_port_start_io(
scic_sds_remote_device_get_port(this_device), this_device, request); scic_sds_remote_device_get_port(sci_dev), sci_dev, request);
if (result == SCI_SUCCESS) { if (result == SCI_SUCCESS) {
result = scic_sds_remote_node_context_start_task( result = scic_sds_remote_node_context_start_task(
this_device->rnc, request); sci_dev->rnc, request);
if (result == SCI_SUCCESS) if (result == SCI_SUCCESS)
result = scic_sds_request_start(request); result = scic_sds_request_start(request);
scic_sds_remote_device_start_request(this_device, request, result); scic_sds_remote_device_start_request(sci_dev, request, result);
} }
return result; return result;
...@@ -1052,23 +1036,22 @@ static enum sci_status scic_sds_remote_device_ready_state_start_task_handler( ...@@ -1052,23 +1036,22 @@ static enum sci_status scic_sds_remote_device_ready_state_start_task_handler(
* object could not get the resources to start. * object could not get the resources to start.
*/ */
static enum sci_status scic_sds_remote_device_ready_state_start_io_handler( static enum sci_status scic_sds_remote_device_ready_state_start_io_handler(
struct sci_base_remote_device *device, struct scic_sds_remote_device *sci_dev,
struct scic_sds_request *request) struct scic_sds_request *request)
{ {
enum sci_status result; enum sci_status result;
struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
/* See if the port is in a state where we can start the IO request */ /* See if the port is in a state where we can start the IO request */
result = scic_sds_port_start_io( result = scic_sds_port_start_io(
scic_sds_remote_device_get_port(this_device), this_device, request); scic_sds_remote_device_get_port(sci_dev), sci_dev, request);
if (result == SCI_SUCCESS) { if (result == SCI_SUCCESS) {
result = scic_sds_remote_node_context_start_io( result = scic_sds_remote_node_context_start_io(
this_device->rnc, request); sci_dev->rnc, request);
if (result == SCI_SUCCESS) if (result == SCI_SUCCESS)
result = scic_sds_request_start(request); result = scic_sds_request_start(request);
scic_sds_remote_device_start_request(this_device, request, result); scic_sds_remote_device_start_request(sci_dev, request, result);
} }
return result; return result;
...@@ -1081,23 +1064,24 @@ static enum sci_status scic_sds_remote_device_ready_state_start_io_handler( ...@@ -1081,23 +1064,24 @@ static enum sci_status scic_sds_remote_device_ready_state_start_io_handler(
* its own started_request_count. enum sci_status * its own started_request_count. enum sci_status
*/ */
static enum sci_status scic_sds_remote_device_ready_state_complete_request_handler( static enum sci_status scic_sds_remote_device_ready_state_complete_request_handler(
struct sci_base_remote_device *device, struct scic_sds_remote_device *sci_dev,
struct scic_sds_request *request) struct scic_sds_request *request)
{ {
enum sci_status result; enum sci_status result;
struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
result = scic_sds_request_complete(request); result = scic_sds_request_complete(request);
if (result == SCI_SUCCESS) { if (result != SCI_SUCCESS)
/* See if the port is in a state where we can start the IO request */ return result;
result = scic_sds_port_complete_io(
scic_sds_remote_device_get_port(this_device), this_device, request);
if (result == SCI_SUCCESS) { /* See if the port is in a state
scic_sds_remote_device_decrement_request_count(this_device); * where we can start the IO request */
} result = scic_sds_port_complete_io(
} scic_sds_remote_device_get_port(sci_dev),
sci_dev, request);
if (result == SCI_SUCCESS)
scic_sds_remote_device_decrement_request_count(sci_dev);
return result; return result;
} }
...@@ -1109,7 +1093,7 @@ static enum sci_status scic_sds_remote_device_ready_state_complete_request_handl ...@@ -1109,7 +1093,7 @@ static enum sci_status scic_sds_remote_device_ready_state_complete_request_handl
/** /**
* *
* @this_device: The struct sci_base_remote_device which is cast into a * @this_device: The struct scic_sds_remote_device which is cast into a
* struct scic_sds_remote_device. * struct scic_sds_remote_device.
* *
* This method will stop a struct scic_sds_remote_device that is already in the * This method will stop a struct scic_sds_remote_device that is already in the
...@@ -1118,14 +1102,13 @@ static enum sci_status scic_sds_remote_device_ready_state_complete_request_handl ...@@ -1118,14 +1102,13 @@ static enum sci_status scic_sds_remote_device_ready_state_complete_request_handl
* stopped. enum sci_status SCI_SUCCESS * stopped. enum sci_status SCI_SUCCESS
*/ */
static enum sci_status scic_sds_remote_device_stopping_state_stop_handler( static enum sci_status scic_sds_remote_device_stopping_state_stop_handler(
struct sci_base_remote_device *device) struct scic_sds_remote_device *device)
{ {
/* /*
* All requests should have been terminated, but if there is an * All requests should have been terminated, but if there is an
* attempt to stop a device already in the stopping state, then * attempt to stop a device already in the stopping state, then
* try again to terminate. */ * try again to terminate. */
return scic_sds_remote_device_terminate_requests( return scic_sds_remote_device_terminate_requests(device);
(struct scic_sds_remote_device *)device);
} }
...@@ -1143,54 +1126,44 @@ static enum sci_status scic_sds_remote_device_stopping_state_stop_handler( ...@@ -1143,54 +1126,44 @@ static enum sci_status scic_sds_remote_device_stopping_state_stop_handler(
* transition to the SCI_BASE_REMOTE_DEVICE_STATE_STOPPED. enum sci_status * transition to the SCI_BASE_REMOTE_DEVICE_STATE_STOPPED. enum sci_status
*/ */
static enum sci_status scic_sds_remote_device_stopping_state_complete_request_handler( static enum sci_status scic_sds_remote_device_stopping_state_complete_request_handler(
struct sci_base_remote_device *device, struct scic_sds_remote_device *sci_dev,
struct scic_sds_request *request) struct scic_sds_request *request)
{ {
enum sci_status status = SCI_SUCCESS; enum sci_status status = SCI_SUCCESS;
struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
status = scic_sds_request_complete(request); status = scic_sds_request_complete(request);
if (status == SCI_SUCCESS) {
status = scic_sds_port_complete_io(
scic_sds_remote_device_get_port(this_device),
this_device, request);
if (status == SCI_SUCCESS) { if (status != SCI_SUCCESS)
scic_sds_remote_device_decrement_request_count(this_device); return status;
if (scic_sds_remote_device_get_request_count(this_device) == 0) {
scic_sds_remote_node_context_destruct(
this_device->rnc,
scic_sds_cb_remote_device_rnc_destruct_complete,
this_device
);
}
}
}
return status; status = scic_sds_port_complete_io(scic_sds_remote_device_get_port(sci_dev),
} sci_dev, request);
if (status != SCI_SUCCESS)
return status;
/* scic_sds_remote_device_decrement_request_count(sci_dev);
* *****************************************************************************
* * RESETTING STATE HANDLERS if (scic_sds_remote_device_get_request_count(sci_dev) == 0)
* ***************************************************************************** */ scic_sds_remote_node_context_destruct(sci_dev->rnc,
scic_sds_cb_remote_device_rnc_destruct_complete,
sci_dev);
return SCI_SUCCESS;
}
/** /**
* *
* @device: The struct sci_base_remote_device which is to be cast into a * @device: The struct scic_sds_remote_device which is to be cast into a
* struct scic_sds_remote_device object. * struct scic_sds_remote_device object.
* *
* This method will complete the reset operation when the device is in the * This method will complete the reset operation when the device is in the
* resetting state. enum sci_status * resetting state. enum sci_status
*/ */
static enum sci_status scic_sds_remote_device_resetting_state_reset_complete_handler( static enum sci_status scic_sds_remote_device_resetting_state_reset_complete_handler(
struct sci_base_remote_device *device) struct scic_sds_remote_device *sci_dev)
{ {
struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_device->parent.state_machine, &sci_dev->state_machine,
SCI_BASE_REMOTE_DEVICE_STATE_READY SCI_BASE_REMOTE_DEVICE_STATE_READY
); );
...@@ -1199,19 +1172,17 @@ static enum sci_status scic_sds_remote_device_resetting_state_reset_complete_han ...@@ -1199,19 +1172,17 @@ static enum sci_status scic_sds_remote_device_resetting_state_reset_complete_han
/** /**
* *
* @device: The struct sci_base_remote_device which is to be cast into a * @device: The struct scic_sds_remote_device which is to be cast into a
* struct scic_sds_remote_device object. * struct scic_sds_remote_device object.
* *
* This method will stop the remote device while in the resetting state. * This method will stop the remote device while in the resetting state.
* enum sci_status * enum sci_status
*/ */
static enum sci_status scic_sds_remote_device_resetting_state_stop_handler( static enum sci_status scic_sds_remote_device_resetting_state_stop_handler(
struct sci_base_remote_device *device) struct scic_sds_remote_device *sci_dev)
{ {
struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_device->parent.state_machine, &sci_dev->state_machine,
SCI_BASE_REMOTE_DEVICE_STATE_STOPPING SCI_BASE_REMOTE_DEVICE_STATE_STOPPING
); );
...@@ -1226,20 +1197,20 @@ static enum sci_status scic_sds_remote_device_resetting_state_stop_handler( ...@@ -1226,20 +1197,20 @@ static enum sci_status scic_sds_remote_device_resetting_state_stop_handler(
* completes the task request. enum sci_status * completes the task request. enum sci_status
*/ */
static enum sci_status scic_sds_remote_device_resetting_state_complete_request_handler( static enum sci_status scic_sds_remote_device_resetting_state_complete_request_handler(
struct sci_base_remote_device *device, struct scic_sds_remote_device *sci_dev,
struct scic_sds_request *request) struct scic_sds_request *request)
{ {
enum sci_status status = SCI_SUCCESS; enum sci_status status = SCI_SUCCESS;
struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
status = scic_sds_request_complete(request); status = scic_sds_request_complete(request);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
status = scic_sds_port_complete_io( status = scic_sds_port_complete_io(
scic_sds_remote_device_get_port(this_device), this_device, request); scic_sds_remote_device_get_port(sci_dev),
sci_dev, request);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
scic_sds_remote_device_decrement_request_count(this_device); scic_sds_remote_device_decrement_request_count(sci_dev);
} }
} }
...@@ -1253,7 +1224,7 @@ static enum sci_status scic_sds_remote_device_resetting_state_complete_request_h ...@@ -1253,7 +1224,7 @@ static enum sci_status scic_sds_remote_device_resetting_state_complete_request_h
/** /**
* *
* @device: The struct sci_base_remote_device which is to be cast into a * @device: The struct scic_sds_remote_device which is to be cast into a
* struct scic_sds_remote_device object. * struct scic_sds_remote_device object.
* *
* This method handles the remove request for a failed struct scic_sds_remote_device * This method handles the remove request for a failed struct scic_sds_remote_device
...@@ -1265,140 +1236,140 @@ static enum sci_status scic_sds_remote_device_resetting_state_complete_request_h ...@@ -1265,140 +1236,140 @@ static enum sci_status scic_sds_remote_device_resetting_state_complete_request_h
static const struct scic_sds_remote_device_state_handler scic_sds_remote_device_state_handler_table[] = { static const struct scic_sds_remote_device_state_handler scic_sds_remote_device_state_handler_table[] = {
[SCI_BASE_REMOTE_DEVICE_STATE_INITIAL] = { [SCI_BASE_REMOTE_DEVICE_STATE_INITIAL] = {
.parent.start_handler = scic_sds_remote_device_default_start_handler, .start_handler = scic_sds_remote_device_default_start_handler,
.parent.stop_handler = scic_sds_remote_device_default_stop_handler, .stop_handler = scic_sds_remote_device_default_stop_handler,
.parent.fail_handler = scic_sds_remote_device_default_fail_handler, .fail_handler = scic_sds_remote_device_default_fail_handler,
.parent.destruct_handler = scic_sds_remote_device_default_destruct_handler, .destruct_handler = scic_sds_remote_device_default_destruct_handler,
.parent.reset_handler = scic_sds_remote_device_default_reset_handler, .reset_handler = scic_sds_remote_device_default_reset_handler,
.parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
.parent.start_io_handler = scic_sds_remote_device_default_start_request_handler, .start_io_handler = scic_sds_remote_device_default_start_request_handler,
.parent.complete_io_handler = scic_sds_remote_device_default_complete_request_handler, .complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
.parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler, .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
.parent.start_task_handler = scic_sds_remote_device_default_start_request_handler, .start_task_handler = scic_sds_remote_device_default_start_request_handler,
.parent.complete_task_handler = scic_sds_remote_device_default_complete_request_handler, .complete_task_handler = scic_sds_remote_device_default_complete_request_handler,
.suspend_handler = scic_sds_remote_device_default_suspend_handler, .suspend_handler = scic_sds_remote_device_default_suspend_handler,
.resume_handler = scic_sds_remote_device_default_resume_handler, .resume_handler = scic_sds_remote_device_default_resume_handler,
.event_handler = scic_sds_remote_device_default_event_handler, .event_handler = scic_sds_remote_device_default_event_handler,
.frame_handler = scic_sds_remote_device_default_frame_handler .frame_handler = scic_sds_remote_device_default_frame_handler
}, },
[SCI_BASE_REMOTE_DEVICE_STATE_STOPPED] = { [SCI_BASE_REMOTE_DEVICE_STATE_STOPPED] = {
.parent.start_handler = scic_sds_remote_device_stopped_state_start_handler, .start_handler = scic_sds_remote_device_stopped_state_start_handler,
.parent.stop_handler = scic_sds_remote_device_stopped_state_stop_handler, .stop_handler = scic_sds_remote_device_stopped_state_stop_handler,
.parent.fail_handler = scic_sds_remote_device_default_fail_handler, .fail_handler = scic_sds_remote_device_default_fail_handler,
.parent.destruct_handler = scic_sds_remote_device_stopped_state_destruct_handler, .destruct_handler = scic_sds_remote_device_stopped_state_destruct_handler,
.parent.reset_handler = scic_sds_remote_device_default_reset_handler, .reset_handler = scic_sds_remote_device_default_reset_handler,
.parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
.parent.start_io_handler = scic_sds_remote_device_default_start_request_handler, .start_io_handler = scic_sds_remote_device_default_start_request_handler,
.parent.complete_io_handler = scic_sds_remote_device_default_complete_request_handler, .complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
.parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler, .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
.parent.start_task_handler = scic_sds_remote_device_default_start_request_handler, .start_task_handler = scic_sds_remote_device_default_start_request_handler,
.parent.complete_task_handler = scic_sds_remote_device_default_complete_request_handler, .complete_task_handler = scic_sds_remote_device_default_complete_request_handler,
.suspend_handler = scic_sds_remote_device_default_suspend_handler, .suspend_handler = scic_sds_remote_device_default_suspend_handler,
.resume_handler = scic_sds_remote_device_default_resume_handler, .resume_handler = scic_sds_remote_device_default_resume_handler,
.event_handler = scic_sds_remote_device_default_event_handler, .event_handler = scic_sds_remote_device_default_event_handler,
.frame_handler = scic_sds_remote_device_default_frame_handler .frame_handler = scic_sds_remote_device_default_frame_handler
}, },
[SCI_BASE_REMOTE_DEVICE_STATE_STARTING] = { [SCI_BASE_REMOTE_DEVICE_STATE_STARTING] = {
.parent.start_handler = scic_sds_remote_device_default_start_handler, .start_handler = scic_sds_remote_device_default_start_handler,
.parent.stop_handler = scic_sds_remote_device_starting_state_stop_handler, .stop_handler = scic_sds_remote_device_starting_state_stop_handler,
.parent.fail_handler = scic_sds_remote_device_default_fail_handler, .fail_handler = scic_sds_remote_device_default_fail_handler,
.parent.destruct_handler = scic_sds_remote_device_default_destruct_handler, .destruct_handler = scic_sds_remote_device_default_destruct_handler,
.parent.reset_handler = scic_sds_remote_device_default_reset_handler, .reset_handler = scic_sds_remote_device_default_reset_handler,
.parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
.parent.start_io_handler = scic_sds_remote_device_default_start_request_handler, .start_io_handler = scic_sds_remote_device_default_start_request_handler,
.parent.complete_io_handler = scic_sds_remote_device_default_complete_request_handler, .complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
.parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler, .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
.parent.start_task_handler = scic_sds_remote_device_default_start_request_handler, .start_task_handler = scic_sds_remote_device_default_start_request_handler,
.parent.complete_task_handler = scic_sds_remote_device_default_complete_request_handler, .complete_task_handler = scic_sds_remote_device_default_complete_request_handler,
.suspend_handler = scic_sds_remote_device_default_suspend_handler, .suspend_handler = scic_sds_remote_device_default_suspend_handler,
.resume_handler = scic_sds_remote_device_default_resume_handler, .resume_handler = scic_sds_remote_device_default_resume_handler,
.event_handler = scic_sds_remote_device_general_event_handler, .event_handler = scic_sds_remote_device_general_event_handler,
.frame_handler = scic_sds_remote_device_default_frame_handler .frame_handler = scic_sds_remote_device_default_frame_handler
}, },
[SCI_BASE_REMOTE_DEVICE_STATE_READY] = { [SCI_BASE_REMOTE_DEVICE_STATE_READY] = {
.parent.start_handler = scic_sds_remote_device_default_start_handler, .start_handler = scic_sds_remote_device_default_start_handler,
.parent.stop_handler = scic_sds_remote_device_ready_state_stop_handler, .stop_handler = scic_sds_remote_device_ready_state_stop_handler,
.parent.fail_handler = scic_sds_remote_device_default_fail_handler, .fail_handler = scic_sds_remote_device_default_fail_handler,
.parent.destruct_handler = scic_sds_remote_device_default_destruct_handler, .destruct_handler = scic_sds_remote_device_default_destruct_handler,
.parent.reset_handler = scic_sds_remote_device_ready_state_reset_handler, .reset_handler = scic_sds_remote_device_ready_state_reset_handler,
.parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
.parent.start_io_handler = scic_sds_remote_device_ready_state_start_io_handler, .start_io_handler = scic_sds_remote_device_ready_state_start_io_handler,
.parent.complete_io_handler = scic_sds_remote_device_ready_state_complete_request_handler, .complete_io_handler = scic_sds_remote_device_ready_state_complete_request_handler,
.parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler, .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
.parent.start_task_handler = scic_sds_remote_device_ready_state_start_task_handler, .start_task_handler = scic_sds_remote_device_ready_state_start_task_handler,
.parent.complete_task_handler = scic_sds_remote_device_ready_state_complete_request_handler, .complete_task_handler = scic_sds_remote_device_ready_state_complete_request_handler,
.suspend_handler = scic_sds_remote_device_default_suspend_handler, .suspend_handler = scic_sds_remote_device_default_suspend_handler,
.resume_handler = scic_sds_remote_device_default_resume_handler, .resume_handler = scic_sds_remote_device_default_resume_handler,
.event_handler = scic_sds_remote_device_general_event_handler, .event_handler = scic_sds_remote_device_general_event_handler,
.frame_handler = scic_sds_remote_device_general_frame_handler, .frame_handler = scic_sds_remote_device_general_frame_handler,
}, },
[SCI_BASE_REMOTE_DEVICE_STATE_STOPPING] = { [SCI_BASE_REMOTE_DEVICE_STATE_STOPPING] = {
.parent.start_handler = scic_sds_remote_device_default_start_handler, .start_handler = scic_sds_remote_device_default_start_handler,
.parent.stop_handler = scic_sds_remote_device_stopping_state_stop_handler, .stop_handler = scic_sds_remote_device_stopping_state_stop_handler,
.parent.fail_handler = scic_sds_remote_device_default_fail_handler, .fail_handler = scic_sds_remote_device_default_fail_handler,
.parent.destruct_handler = scic_sds_remote_device_default_destruct_handler, .destruct_handler = scic_sds_remote_device_default_destruct_handler,
.parent.reset_handler = scic_sds_remote_device_default_reset_handler, .reset_handler = scic_sds_remote_device_default_reset_handler,
.parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
.parent.start_io_handler = scic_sds_remote_device_default_start_request_handler, .start_io_handler = scic_sds_remote_device_default_start_request_handler,
.parent.complete_io_handler = scic_sds_remote_device_stopping_state_complete_request_handler, .complete_io_handler = scic_sds_remote_device_stopping_state_complete_request_handler,
.parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler, .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
.parent.start_task_handler = scic_sds_remote_device_default_start_request_handler, .start_task_handler = scic_sds_remote_device_default_start_request_handler,
.parent.complete_task_handler = scic_sds_remote_device_stopping_state_complete_request_handler, .complete_task_handler = scic_sds_remote_device_stopping_state_complete_request_handler,
.suspend_handler = scic_sds_remote_device_default_suspend_handler, .suspend_handler = scic_sds_remote_device_default_suspend_handler,
.resume_handler = scic_sds_remote_device_default_resume_handler, .resume_handler = scic_sds_remote_device_default_resume_handler,
.event_handler = scic_sds_remote_device_general_event_handler, .event_handler = scic_sds_remote_device_general_event_handler,
.frame_handler = scic_sds_remote_device_general_frame_handler .frame_handler = scic_sds_remote_device_general_frame_handler
}, },
[SCI_BASE_REMOTE_DEVICE_STATE_FAILED] = { [SCI_BASE_REMOTE_DEVICE_STATE_FAILED] = {
.parent.start_handler = scic_sds_remote_device_default_start_handler, .start_handler = scic_sds_remote_device_default_start_handler,
.parent.stop_handler = scic_sds_remote_device_default_stop_handler, .stop_handler = scic_sds_remote_device_default_stop_handler,
.parent.fail_handler = scic_sds_remote_device_default_fail_handler, .fail_handler = scic_sds_remote_device_default_fail_handler,
.parent.destruct_handler = scic_sds_remote_device_default_destruct_handler, .destruct_handler = scic_sds_remote_device_default_destruct_handler,
.parent.reset_handler = scic_sds_remote_device_default_reset_handler, .reset_handler = scic_sds_remote_device_default_reset_handler,
.parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
.parent.start_io_handler = scic_sds_remote_device_default_start_request_handler, .start_io_handler = scic_sds_remote_device_default_start_request_handler,
.parent.complete_io_handler = scic_sds_remote_device_default_complete_request_handler, .complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
.parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler, .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
.parent.start_task_handler = scic_sds_remote_device_default_start_request_handler, .start_task_handler = scic_sds_remote_device_default_start_request_handler,
.parent.complete_task_handler = scic_sds_remote_device_default_complete_request_handler, .complete_task_handler = scic_sds_remote_device_default_complete_request_handler,
.suspend_handler = scic_sds_remote_device_default_suspend_handler, .suspend_handler = scic_sds_remote_device_default_suspend_handler,
.resume_handler = scic_sds_remote_device_default_resume_handler, .resume_handler = scic_sds_remote_device_default_resume_handler,
.event_handler = scic_sds_remote_device_default_event_handler, .event_handler = scic_sds_remote_device_default_event_handler,
.frame_handler = scic_sds_remote_device_general_frame_handler .frame_handler = scic_sds_remote_device_general_frame_handler
}, },
[SCI_BASE_REMOTE_DEVICE_STATE_RESETTING] = { [SCI_BASE_REMOTE_DEVICE_STATE_RESETTING] = {
.parent.start_handler = scic_sds_remote_device_default_start_handler, .start_handler = scic_sds_remote_device_default_start_handler,
.parent.stop_handler = scic_sds_remote_device_resetting_state_stop_handler, .stop_handler = scic_sds_remote_device_resetting_state_stop_handler,
.parent.fail_handler = scic_sds_remote_device_default_fail_handler, .fail_handler = scic_sds_remote_device_default_fail_handler,
.parent.destruct_handler = scic_sds_remote_device_default_destruct_handler, .destruct_handler = scic_sds_remote_device_default_destruct_handler,
.parent.reset_handler = scic_sds_remote_device_default_reset_handler, .reset_handler = scic_sds_remote_device_default_reset_handler,
.parent.reset_complete_handler = scic_sds_remote_device_resetting_state_reset_complete_handler, .reset_complete_handler = scic_sds_remote_device_resetting_state_reset_complete_handler,
.parent.start_io_handler = scic_sds_remote_device_default_start_request_handler, .start_io_handler = scic_sds_remote_device_default_start_request_handler,
.parent.complete_io_handler = scic_sds_remote_device_resetting_state_complete_request_handler, .complete_io_handler = scic_sds_remote_device_resetting_state_complete_request_handler,
.parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler, .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
.parent.start_task_handler = scic_sds_remote_device_default_start_request_handler, .start_task_handler = scic_sds_remote_device_default_start_request_handler,
.parent.complete_task_handler = scic_sds_remote_device_resetting_state_complete_request_handler, .complete_task_handler = scic_sds_remote_device_resetting_state_complete_request_handler,
.suspend_handler = scic_sds_remote_device_default_suspend_handler, .suspend_handler = scic_sds_remote_device_default_suspend_handler,
.resume_handler = scic_sds_remote_device_default_resume_handler, .resume_handler = scic_sds_remote_device_default_resume_handler,
.event_handler = scic_sds_remote_device_default_event_handler, .event_handler = scic_sds_remote_device_default_event_handler,
.frame_handler = scic_sds_remote_device_general_frame_handler .frame_handler = scic_sds_remote_device_general_frame_handler
}, },
[SCI_BASE_REMOTE_DEVICE_STATE_FINAL] = { [SCI_BASE_REMOTE_DEVICE_STATE_FINAL] = {
.parent.start_handler = scic_sds_remote_device_default_start_handler, .start_handler = scic_sds_remote_device_default_start_handler,
.parent.stop_handler = scic_sds_remote_device_default_stop_handler, .stop_handler = scic_sds_remote_device_default_stop_handler,
.parent.fail_handler = scic_sds_remote_device_default_fail_handler, .fail_handler = scic_sds_remote_device_default_fail_handler,
.parent.destruct_handler = scic_sds_remote_device_default_destruct_handler, .destruct_handler = scic_sds_remote_device_default_destruct_handler,
.parent.reset_handler = scic_sds_remote_device_default_reset_handler, .reset_handler = scic_sds_remote_device_default_reset_handler,
.parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
.parent.start_io_handler = scic_sds_remote_device_default_start_request_handler, .start_io_handler = scic_sds_remote_device_default_start_request_handler,
.parent.complete_io_handler = scic_sds_remote_device_default_complete_request_handler, .complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
.parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler, .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
.parent.start_task_handler = scic_sds_remote_device_default_start_request_handler, .start_task_handler = scic_sds_remote_device_default_start_request_handler,
.parent.complete_task_handler = scic_sds_remote_device_default_complete_request_handler, .complete_task_handler = scic_sds_remote_device_default_complete_request_handler,
.suspend_handler = scic_sds_remote_device_default_suspend_handler, .suspend_handler = scic_sds_remote_device_default_suspend_handler,
.resume_handler = scic_sds_remote_device_default_resume_handler, .resume_handler = scic_sds_remote_device_default_resume_handler,
.event_handler = scic_sds_remote_device_default_event_handler, .event_handler = scic_sds_remote_device_default_event_handler,
.frame_handler = scic_sds_remote_device_default_frame_handler .frame_handler = scic_sds_remote_device_default_frame_handler
} }
}; };
...@@ -1415,12 +1386,12 @@ static void scic_sds_remote_device_initial_state_enter( ...@@ -1415,12 +1386,12 @@ static void scic_sds_remote_device_initial_state_enter(
{ {
struct scic_sds_remote_device *sci_dev = (struct scic_sds_remote_device *)object; struct scic_sds_remote_device *sci_dev = (struct scic_sds_remote_device *)object;
sci_dev = container_of(object, typeof(*sci_dev), parent.parent); sci_dev = container_of(object, typeof(*sci_dev), parent);
SET_STATE_HANDLER(sci_dev, scic_sds_remote_device_state_handler_table, SET_STATE_HANDLER(sci_dev, scic_sds_remote_device_state_handler_table,
SCI_BASE_REMOTE_DEVICE_STATE_INITIAL); SCI_BASE_REMOTE_DEVICE_STATE_INITIAL);
/* Initial state is a transitional state to the stopped state */ /* Initial state is a transitional state to the stopped state */
sci_base_state_machine_change_state(&sci_dev->parent.state_machine, sci_base_state_machine_change_state(&sci_dev->state_machine,
SCI_BASE_REMOTE_DEVICE_STATE_STOPPED); SCI_BASE_REMOTE_DEVICE_STATE_STOPPED);
} }
...@@ -1443,7 +1414,7 @@ static void scic_sds_remote_device_stopped_state_enter( ...@@ -1443,7 +1414,7 @@ static void scic_sds_remote_device_stopped_state_enter(
struct isci_host *ihost; struct isci_host *ihost;
u32 prev_state; u32 prev_state;
sci_dev = container_of(object, typeof(*sci_dev), parent.parent); sci_dev = container_of(object, typeof(*sci_dev), parent);
scic = scic_sds_remote_device_get_controller(sci_dev); scic = scic_sds_remote_device_get_controller(sci_dev);
ihost = sci_object_get_association(scic); ihost = sci_object_get_association(scic);
idev = sci_object_get_association(sci_dev); idev = sci_object_get_association(sci_dev);
...@@ -1454,7 +1425,7 @@ static void scic_sds_remote_device_stopped_state_enter( ...@@ -1454,7 +1425,7 @@ static void scic_sds_remote_device_stopped_state_enter(
/* If we are entering from the stopping state let the SCI User know that /* If we are entering from the stopping state let the SCI User know that
* the stop operation has completed. * the stop operation has completed.
*/ */
prev_state = sci_dev->parent.state_machine.previous_state_id; prev_state = sci_dev->state_machine.previous_state_id;
if (prev_state == SCI_BASE_REMOTE_DEVICE_STATE_STOPPING) if (prev_state == SCI_BASE_REMOTE_DEVICE_STATE_STOPPING)
isci_remote_device_stop_complete(ihost, idev, SCI_SUCCESS); isci_remote_device_stop_complete(ihost, idev, SCI_SUCCESS);
...@@ -1473,7 +1444,7 @@ static void scic_sds_remote_device_stopped_state_enter( ...@@ -1473,7 +1444,7 @@ static void scic_sds_remote_device_stopped_state_enter(
static void scic_sds_remote_device_starting_state_enter(struct sci_base_object *object) static void scic_sds_remote_device_starting_state_enter(struct sci_base_object *object)
{ {
struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev), struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
parent.parent); parent);
struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
struct isci_host *ihost = sci_object_get_association(scic); struct isci_host *ihost = sci_object_get_association(scic);
struct isci_remote_device *idev = sci_object_get_association(sci_dev); struct isci_remote_device *idev = sci_object_get_association(sci_dev);
...@@ -1488,7 +1459,7 @@ static void scic_sds_remote_device_starting_state_enter(struct sci_base_object * ...@@ -1488,7 +1459,7 @@ static void scic_sds_remote_device_starting_state_enter(struct sci_base_object *
static void scic_sds_remote_device_starting_state_exit(struct sci_base_object *object) static void scic_sds_remote_device_starting_state_exit(struct sci_base_object *object)
{ {
struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev), struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
parent.parent); parent);
struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
struct isci_host *ihost = sci_object_get_association(scic); struct isci_host *ihost = sci_object_get_association(scic);
struct isci_remote_device *idev = sci_object_get_association(sci_dev); struct isci_remote_device *idev = sci_object_get_association(sci_dev);
...@@ -1511,7 +1482,7 @@ static void scic_sds_remote_device_starting_state_exit(struct sci_base_object *o ...@@ -1511,7 +1482,7 @@ static void scic_sds_remote_device_starting_state_exit(struct sci_base_object *o
static void scic_sds_remote_device_ready_state_enter(struct sci_base_object *object) static void scic_sds_remote_device_ready_state_enter(struct sci_base_object *object)
{ {
struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev), struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
parent.parent); parent);
struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
struct isci_host *ihost = sci_object_get_association(scic); struct isci_host *ihost = sci_object_get_association(scic);
struct isci_remote_device *idev = sci_object_get_association(sci_dev); struct isci_remote_device *idev = sci_object_get_association(sci_dev);
...@@ -1540,7 +1511,7 @@ static void scic_sds_remote_device_ready_state_exit( ...@@ -1540,7 +1511,7 @@ static void scic_sds_remote_device_ready_state_exit(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev), struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
parent.parent); parent);
if (sci_dev->has_ready_substate_machine) if (sci_dev->has_ready_substate_machine)
sci_base_state_machine_stop(&sci_dev->ready_substate_machine); sci_base_state_machine_stop(&sci_dev->ready_substate_machine);
else { else {
...@@ -1691,10 +1662,17 @@ void scic_remote_device_construct(struct scic_sds_port *sci_port, ...@@ -1691,10 +1662,17 @@ void scic_remote_device_construct(struct scic_sds_port *sci_port,
sci_dev->owning_port = sci_port; sci_dev->owning_port = sci_port;
sci_dev->started_request_count = 0; sci_dev->started_request_count = 0;
sci_dev->rnc = (struct scic_sds_remote_node_context *) &sci_dev[1]; sci_dev->rnc = (struct scic_sds_remote_node_context *) &sci_dev[1];
sci_dev->parent.private = NULL;
sci_base_remote_device_construct( sci_base_state_machine_construct(
&sci_dev->state_machine,
&sci_dev->parent, &sci_dev->parent,
scic_sds_remote_device_state_table scic_sds_remote_device_state_table,
SCI_BASE_REMOTE_DEVICE_STATE_INITIAL
);
sci_base_state_machine_start(
&sci_dev->state_machine
); );
scic_sds_remote_node_context_construct( scic_sds_remote_node_context_construct(
......
...@@ -56,22 +56,74 @@ ...@@ -56,22 +56,74 @@
#ifndef _SCIC_SDS_REMOTE_DEVICE_H_ #ifndef _SCIC_SDS_REMOTE_DEVICE_H_
#define _SCIC_SDS_REMOTE_DEVICE_H_ #define _SCIC_SDS_REMOTE_DEVICE_H_
#include "intel_sas.h"
#include "scu_remote_node_context.h"
#include "scic_sds_remote_node_context.h"
/** /**
* This file contains the structures, constants, and prototypes for the * enum scic_sds_remote_device_states - This enumeration depicts all the states
* struct scic_sds_remote_device object. * for the common remote device state machine.
* *
* *
*/ */
enum scic_sds_remote_device_states {
/**
* Simply the initial state for the base remote device state machine.
*/
SCI_BASE_REMOTE_DEVICE_STATE_INITIAL,
#include "intel_sas.h" /**
#include "sci_base_remote_device.h" * This state indicates that the remote device has successfully been
#include "scu_remote_node_context.h" * stopped. In this state no new IO operations are permitted.
#include "scic_sds_remote_node_context.h" * This state is entered from the INITIAL state.
* This state is entered from the STOPPING state.
*/
SCI_BASE_REMOTE_DEVICE_STATE_STOPPED,
/**
* This state indicates the the remote device is in the process of
* becoming ready (i.e. starting). In this state no new IO operations
* are permitted.
* This state is entered from the STOPPED state.
*/
SCI_BASE_REMOTE_DEVICE_STATE_STARTING,
/**
* This state indicates the remote device is now ready. Thus, the user
* is able to perform IO operations on the remote device.
* This state is entered from the STARTING state.
*/
SCI_BASE_REMOTE_DEVICE_STATE_READY,
/**
* This state indicates that the remote device is in the process of
* stopping. In this state no new IO operations are permitted, but
* existing IO operations are allowed to complete.
* This state is entered from the READY state.
* This state is entered from the FAILED state.
*/
SCI_BASE_REMOTE_DEVICE_STATE_STOPPING,
/**
* This state indicates that the remote device has failed.
* In this state no new IO operations are permitted.
* This state is entered from the INITIALIZING state.
* This state is entered from the READY state.
*/
SCI_BASE_REMOTE_DEVICE_STATE_FAILED,
struct scic_sds_controller; /**
struct scic_sds_port; * This state indicates the device is being reset.
struct scic_sds_request; * In this state no new IO operations are permitted.
struct scic_sds_remote_device_state_handler; * This state is entered from the READY state.
*/
SCI_BASE_REMOTE_DEVICE_STATE_RESETTING,
/**
* Simply the final state for the base remote device state machine.
*/
SCI_BASE_REMOTE_DEVICE_STATE_FINAL,
};
/** /**
* enum scic_sds_ssp_remote_device_ready_substates - * enum scic_sds_ssp_remote_device_ready_substates -
...@@ -186,14 +238,21 @@ enum scic_sds_smp_remote_device_ready_substates { ...@@ -186,14 +238,21 @@ enum scic_sds_smp_remote_device_ready_substates {
*/ */
struct scic_sds_remote_device { struct scic_sds_remote_device {
/** /**
* This field is the common base for all remote device objects. * The field specifies that the parent object for the base remote
* device is the base object itself.
*/
struct sci_base_object parent;
/**
* This field contains the information for the base remote device state
* machine.
*/ */
struct sci_base_remote_device parent; struct sci_base_state_machine state_machine;
/** /**
* This field is the programmed device port width. This value is written to * This field is the programmed device port width. This value is
* the RCN data structure to tell the SCU how many open connections this * written to the RCN data structure to tell the SCU how many open
* device can have. * connections this device can have.
*/ */
u32 device_port_width; u32 device_port_width;
...@@ -279,6 +338,16 @@ struct scic_sds_remote_device { ...@@ -279,6 +338,16 @@ struct scic_sds_remote_device {
const struct scic_sds_remote_device_state_handler *state_handlers; const struct scic_sds_remote_device_state_handler *state_handlers;
}; };
typedef enum sci_status (*scic_sds_remote_device_request_handler_t)(
struct scic_sds_remote_device *device,
struct scic_sds_request *request);
typedef enum sci_status (*scic_sds_remote_device_high_priority_request_complete_handler_t)(
struct scic_sds_remote_device *device,
struct scic_sds_request *request,
void *,
enum sci_io_status);
typedef enum sci_status (*scic_sds_remote_device_handler_t)( typedef enum sci_status (*scic_sds_remote_device_handler_t)(
struct scic_sds_remote_device *this_device); struct scic_sds_remote_device *this_device);
...@@ -308,7 +377,74 @@ typedef void (*scic_sds_remote_device_ready_not_ready_handler_t)( ...@@ -308,7 +377,74 @@ typedef void (*scic_sds_remote_device_ready_not_ready_handler_t)(
* *
*/ */
struct scic_sds_remote_device_state_handler { struct scic_sds_remote_device_state_handler {
struct sci_base_remote_device_state_handler parent; /**
* The start_handler specifies the method invoked when a user
* attempts to start a remote device.
*/
scic_sds_remote_device_handler_t start_handler;
/**
* The stop_handler specifies the method invoked when a user attempts to
* stop a remote device.
*/
scic_sds_remote_device_handler_t stop_handler;
/**
* The fail_handler specifies the method invoked when a remote device
* failure has occurred. A failure may be due to an inability to
* initialize/configure the device.
*/
scic_sds_remote_device_handler_t fail_handler;
/**
* The destruct_handler specifies the method invoked when attempting to
* destruct a remote device.
*/
scic_sds_remote_device_handler_t destruct_handler;
/**
* The reset handler specifies the method invloked when requesting to
* reset a remote device.
*/
scic_sds_remote_device_handler_t reset_handler;
/**
* The reset complete handler specifies the method invloked when
* reporting that a reset has completed to the remote device.
*/
scic_sds_remote_device_handler_t reset_complete_handler;
/**
* The start_io_handler specifies the method invoked when a user
* attempts to start an IO request for a remote device.
*/
scic_sds_remote_device_request_handler_t start_io_handler;
/**
* The complete_io_handler specifies the method invoked when a user
* attempts to complete an IO request for a remote device.
*/
scic_sds_remote_device_request_handler_t complete_io_handler;
/**
* The continue_io_handler specifies the method invoked when a user
* attempts to continue an IO request for a remote device.
*/
scic_sds_remote_device_request_handler_t continue_io_handler;
/**
* The start_task_handler specifies the method invoked when a user
* attempts to start a task management request for a remote device.
*/
scic_sds_remote_device_request_handler_t start_task_handler;
/**
* The complete_task_handler specifies the method invoked when a user
* attempts to complete a task management request for a remote device.
*/
scic_sds_remote_device_request_handler_t complete_task_handler;
scic_sds_remote_device_suspend_handler_t suspend_handler; scic_sds_remote_device_suspend_handler_t suspend_handler;
scic_sds_remote_device_resume_handler_t resume_handler; scic_sds_remote_device_resume_handler_t resume_handler;
scic_sds_remote_device_event_handler_t event_handler; scic_sds_remote_device_event_handler_t event_handler;
...@@ -490,30 +626,30 @@ void scic_sds_remote_device_start_request( ...@@ -490,30 +626,30 @@ void scic_sds_remote_device_start_request(
void scic_sds_remote_device_continue_request(void *sci_dev); void scic_sds_remote_device_continue_request(void *sci_dev);
enum sci_status scic_sds_remote_device_default_start_handler( enum sci_status scic_sds_remote_device_default_start_handler(
struct sci_base_remote_device *this_device); struct scic_sds_remote_device *this_device);
enum sci_status scic_sds_remote_device_default_fail_handler( enum sci_status scic_sds_remote_device_default_fail_handler(
struct sci_base_remote_device *this_device); struct scic_sds_remote_device *this_device);
enum sci_status scic_sds_remote_device_default_destruct_handler( enum sci_status scic_sds_remote_device_default_destruct_handler(
struct sci_base_remote_device *this_device); struct scic_sds_remote_device *this_device);
enum sci_status scic_sds_remote_device_default_reset_handler( enum sci_status scic_sds_remote_device_default_reset_handler(
struct sci_base_remote_device *device); struct scic_sds_remote_device *device);
enum sci_status scic_sds_remote_device_default_reset_complete_handler( enum sci_status scic_sds_remote_device_default_reset_complete_handler(
struct sci_base_remote_device *device); struct scic_sds_remote_device *device);
enum sci_status scic_sds_remote_device_default_start_request_handler( enum sci_status scic_sds_remote_device_default_start_request_handler(
struct sci_base_remote_device *device, struct scic_sds_remote_device *device,
struct scic_sds_request *request); struct scic_sds_request *request);
enum sci_status scic_sds_remote_device_default_complete_request_handler( enum sci_status scic_sds_remote_device_default_complete_request_handler(
struct sci_base_remote_device *device, struct scic_sds_remote_device *device,
struct scic_sds_request *request); struct scic_sds_request *request);
enum sci_status scic_sds_remote_device_default_continue_request_handler( enum sci_status scic_sds_remote_device_default_continue_request_handler(
struct sci_base_remote_device *device, struct scic_sds_remote_device *device,
struct scic_sds_request *request); struct scic_sds_request *request);
enum sci_status scic_sds_remote_device_default_suspend_handler( enum sci_status scic_sds_remote_device_default_suspend_handler(
...@@ -529,10 +665,10 @@ enum sci_status scic_sds_remote_device_default_frame_handler( ...@@ -529,10 +665,10 @@ enum sci_status scic_sds_remote_device_default_frame_handler(
u32 frame_index); u32 frame_index);
enum sci_status scic_sds_remote_device_ready_state_stop_handler( enum sci_status scic_sds_remote_device_ready_state_stop_handler(
struct sci_base_remote_device *device); struct scic_sds_remote_device *device);
enum sci_status scic_sds_remote_device_ready_state_reset_handler( enum sci_status scic_sds_remote_device_ready_state_reset_handler(
struct sci_base_remote_device *device); struct scic_sds_remote_device *device);
enum sci_status scic_sds_remote_device_general_frame_handler( enum sci_status scic_sds_remote_device_general_frame_handler(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *this_device,
......
...@@ -77,33 +77,32 @@ ...@@ -77,33 +77,32 @@
* the idle state. enum sci_status * the idle state. enum sci_status
*/ */
static enum sci_status scic_sds_smp_remote_device_ready_idle_substate_start_io_handler( static enum sci_status scic_sds_smp_remote_device_ready_idle_substate_start_io_handler(
struct sci_base_remote_device *device, struct scic_sds_remote_device *device,
struct scic_sds_request *request) struct scic_sds_request *request)
{ {
enum sci_status status; enum sci_status status;
struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
/* Will the port allow the io request to start? */ /* Will the port allow the io request to start? */
status = this_device->owning_port->state_handlers->start_io_handler( status = device->owning_port->state_handlers->start_io_handler(
this_device->owning_port, this_device, request); device->owning_port, device, request);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
status = status = scic_sds_remote_node_context_start_io(
scic_sds_remote_node_context_start_io(this_device->rnc, request); device->rnc, request);
if (status == SCI_SUCCESS) if (status == SCI_SUCCESS)
status = scic_sds_request_start(request); status = scic_sds_request_start(request);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
this_device->working_request = request; device->working_request = request;
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_device->ready_substate_machine, &device->ready_substate_machine,
SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD
); );
} }
scic_sds_remote_device_start_request(this_device, request, status); scic_sds_remote_device_start_request(device, request, status);
} }
return status; return status;
...@@ -123,7 +122,7 @@ static enum sci_status scic_sds_smp_remote_device_ready_idle_substate_start_io_h ...@@ -123,7 +122,7 @@ static enum sci_status scic_sds_smp_remote_device_ready_idle_substate_start_io_h
* until this one is complete. enum sci_status * until this one is complete. enum sci_status
*/ */
static enum sci_status scic_sds_smp_remote_device_ready_cmd_substate_start_io_handler( static enum sci_status scic_sds_smp_remote_device_ready_cmd_substate_start_io_handler(
struct sci_base_remote_device *device, struct scic_sds_remote_device *device,
struct scic_sds_request *request) struct scic_sds_request *request)
{ {
return SCI_FAILURE_INVALID_STATE; return SCI_FAILURE_INVALID_STATE;
...@@ -137,38 +136,37 @@ static enum sci_status scic_sds_smp_remote_device_ready_cmd_substate_start_io_ha ...@@ -137,38 +136,37 @@ static enum sci_status scic_sds_smp_remote_device_ready_cmd_substate_start_io_ha
* *
* enum sci_status * enum sci_status
*/ */
static enum sci_status scic_sds_smp_remote_device_ready_cmd_substate_complete_io_handler( static enum sci_status
struct sci_base_remote_device *device, scic_sds_smp_remote_device_ready_cmd_substate_complete_io_handler(
struct scic_sds_remote_device *device,
struct scic_sds_request *request) struct scic_sds_request *request)
{ {
enum sci_status status; enum sci_status status;
struct scic_sds_remote_device *this_device;
struct scic_sds_request *the_request; struct scic_sds_request *the_request;
this_device = (struct scic_sds_remote_device *)device;
the_request = (struct scic_sds_request *)request; the_request = (struct scic_sds_request *)request;
status = scic_sds_io_request_complete(the_request); status = scic_sds_io_request_complete(the_request);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
status = scic_sds_port_complete_io( status = scic_sds_port_complete_io(
this_device->owning_port, this_device, the_request); device->owning_port, device, the_request);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
scic_sds_remote_device_decrement_request_count(this_device); scic_sds_remote_device_decrement_request_count(device);
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_device->ready_substate_machine, &device->ready_substate_machine,
SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE
); );
} else } else
dev_err(scirdev_to_dev(this_device), dev_err(scirdev_to_dev(device),
"%s: SCIC SDS Remote Device 0x%p io request " "%s: SCIC SDS Remote Device 0x%p io request "
"0x%p could not be completd on the port 0x%p " "0x%p could not be completd on the port 0x%p "
"failed with status %d.\n", "failed with status %d.\n",
__func__, __func__,
this_device, device,
the_request, the_request,
this_device->owning_port, device->owning_port,
status); status);
} }
...@@ -204,38 +202,38 @@ static enum sci_status scic_sds_smp_remote_device_ready_cmd_substate_frame_handl ...@@ -204,38 +202,38 @@ static enum sci_status scic_sds_smp_remote_device_ready_cmd_substate_frame_handl
static const struct scic_sds_remote_device_state_handler scic_sds_smp_remote_device_ready_substate_handler_table[] = { static const struct scic_sds_remote_device_state_handler scic_sds_smp_remote_device_ready_substate_handler_table[] = {
[SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE] = { [SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE] = {
.parent.start_handler = scic_sds_remote_device_default_start_handler, .start_handler = scic_sds_remote_device_default_start_handler,
.parent.stop_handler = scic_sds_remote_device_ready_state_stop_handler, .stop_handler = scic_sds_remote_device_ready_state_stop_handler,
.parent.fail_handler = scic_sds_remote_device_default_fail_handler, .fail_handler = scic_sds_remote_device_default_fail_handler,
.parent.destruct_handler = scic_sds_remote_device_default_destruct_handler, .destruct_handler = scic_sds_remote_device_default_destruct_handler,
.parent.reset_handler = scic_sds_remote_device_default_reset_handler, .reset_handler = scic_sds_remote_device_default_reset_handler,
.parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
.parent.start_io_handler = scic_sds_smp_remote_device_ready_idle_substate_start_io_handler, .start_io_handler = scic_sds_smp_remote_device_ready_idle_substate_start_io_handler,
.parent.complete_io_handler = scic_sds_remote_device_default_complete_request_handler, .complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
.parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler, .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
.parent.start_task_handler = scic_sds_remote_device_default_start_request_handler, .start_task_handler = scic_sds_remote_device_default_start_request_handler,
.parent.complete_task_handler = scic_sds_remote_device_default_complete_request_handler, .complete_task_handler = scic_sds_remote_device_default_complete_request_handler,
.suspend_handler = scic_sds_remote_device_default_suspend_handler, .suspend_handler = scic_sds_remote_device_default_suspend_handler,
.resume_handler = scic_sds_remote_device_default_resume_handler, .resume_handler = scic_sds_remote_device_default_resume_handler,
.event_handler = scic_sds_remote_device_general_event_handler, .event_handler = scic_sds_remote_device_general_event_handler,
.frame_handler = scic_sds_remote_device_default_frame_handler .frame_handler = scic_sds_remote_device_default_frame_handler
}, },
[SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD] = { [SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD] = {
.parent.start_handler = scic_sds_remote_device_default_start_handler, .start_handler = scic_sds_remote_device_default_start_handler,
.parent.stop_handler = scic_sds_remote_device_ready_state_stop_handler, .stop_handler = scic_sds_remote_device_ready_state_stop_handler,
.parent.fail_handler = scic_sds_remote_device_default_fail_handler, .fail_handler = scic_sds_remote_device_default_fail_handler,
.parent.destruct_handler = scic_sds_remote_device_default_destruct_handler, .destruct_handler = scic_sds_remote_device_default_destruct_handler,
.parent.reset_handler = scic_sds_remote_device_default_reset_handler, .reset_handler = scic_sds_remote_device_default_reset_handler,
.parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
.parent.start_io_handler = scic_sds_smp_remote_device_ready_cmd_substate_start_io_handler, .start_io_handler = scic_sds_smp_remote_device_ready_cmd_substate_start_io_handler,
.parent.complete_io_handler = scic_sds_smp_remote_device_ready_cmd_substate_complete_io_handler, .complete_io_handler = scic_sds_smp_remote_device_ready_cmd_substate_complete_io_handler,
.parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler, .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
.parent.start_task_handler = scic_sds_remote_device_default_start_request_handler, .start_task_handler = scic_sds_remote_device_default_start_request_handler,
.parent.complete_task_handler = scic_sds_remote_device_default_complete_request_handler, .complete_task_handler = scic_sds_remote_device_default_complete_request_handler,
.suspend_handler = scic_sds_remote_device_default_suspend_handler, .suspend_handler = scic_sds_remote_device_default_suspend_handler,
.resume_handler = scic_sds_remote_device_default_resume_handler, .resume_handler = scic_sds_remote_device_default_resume_handler,
.event_handler = scic_sds_remote_device_general_event_handler, .event_handler = scic_sds_remote_device_general_event_handler,
.frame_handler = scic_sds_smp_remote_device_ready_cmd_substate_frame_handler .frame_handler = scic_sds_smp_remote_device_ready_cmd_substate_frame_handler
} }
}; };
...@@ -251,7 +249,7 @@ static const struct scic_sds_remote_device_state_handler scic_sds_smp_remote_dev ...@@ -251,7 +249,7 @@ static const struct scic_sds_remote_device_state_handler scic_sds_smp_remote_dev
static void scic_sds_smp_remote_device_ready_idle_substate_enter(struct sci_base_object *object) static void scic_sds_smp_remote_device_ready_idle_substate_enter(struct sci_base_object *object)
{ {
struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev), struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
parent.parent); parent);
struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
struct isci_host *ihost = sci_object_get_association(scic); struct isci_host *ihost = sci_object_get_association(scic);
struct isci_remote_device *idev = sci_object_get_association(sci_dev); struct isci_remote_device *idev = sci_object_get_association(sci_dev);
...@@ -276,7 +274,7 @@ static void scic_sds_smp_remote_device_ready_cmd_substate_enter( ...@@ -276,7 +274,7 @@ static void scic_sds_smp_remote_device_ready_cmd_substate_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev), struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
parent.parent); parent);
struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
struct isci_host *ihost = sci_object_get_association(scic); struct isci_host *ihost = sci_object_get_association(scic);
struct isci_remote_device *idev = sci_object_get_association(sci_dev); struct isci_remote_device *idev = sci_object_get_association(sci_dev);
...@@ -301,7 +299,7 @@ static void scic_sds_smp_remote_device_ready_cmd_substate_enter( ...@@ -301,7 +299,7 @@ static void scic_sds_smp_remote_device_ready_cmd_substate_enter(
static void scic_sds_smp_remote_device_ready_cmd_substate_exit(struct sci_base_object *object) static void scic_sds_smp_remote_device_ready_cmd_substate_exit(struct sci_base_object *object)
{ {
struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev), struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
parent.parent); parent);
sci_dev->working_request = NULL; sci_dev->working_request = NULL;
} }
......
...@@ -77,20 +77,19 @@ ...@@ -77,20 +77,19 @@
* completed successfully. * completed successfully.
*/ */
static enum sci_status scic_sds_stp_remote_device_complete_request( static enum sci_status scic_sds_stp_remote_device_complete_request(
struct sci_base_remote_device *device, struct scic_sds_remote_device *device,
struct scic_sds_request *request) struct scic_sds_request *request)
{ {
struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
enum sci_status status; enum sci_status status;
status = scic_sds_io_request_complete(request); status = scic_sds_io_request_complete(request);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
status = scic_sds_port_complete_io( status = scic_sds_port_complete_io(
this_device->owning_port, this_device, request); device->owning_port, device, request);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
scic_sds_remote_device_decrement_request_count(this_device); scic_sds_remote_device_decrement_request_count(device);
if (request->sci_status == SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED) { if (request->sci_status == SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED) {
/* /*
* This request causes hardware error, device needs to be Lun Reset. * This request causes hardware error, device needs to be Lun Reset.
...@@ -98,12 +97,12 @@ static enum sci_status scic_sds_stp_remote_device_complete_request( ...@@ -98,12 +97,12 @@ static enum sci_status scic_sds_stp_remote_device_complete_request(
* can reach RNC state handler, these IOs will be completed by RNC with * can reach RNC state handler, these IOs will be completed by RNC with
* status of "DEVICE_RESET_REQUIRED", instead of "INVALID STATE". */ * status of "DEVICE_RESET_REQUIRED", instead of "INVALID STATE". */
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_device->ready_substate_machine, &device->ready_substate_machine,
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET
); );
} else if (scic_sds_remote_device_get_request_count(this_device) == 0) { } else if (scic_sds_remote_device_get_request_count(device) == 0) {
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_device->ready_substate_machine, &device->ready_substate_machine,
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE
); );
} }
...@@ -111,12 +110,12 @@ static enum sci_status scic_sds_stp_remote_device_complete_request( ...@@ -111,12 +110,12 @@ static enum sci_status scic_sds_stp_remote_device_complete_request(
} }
if (status != SCI_SUCCESS) if (status != SCI_SUCCESS)
dev_err(scirdev_to_dev(this_device), dev_err(scirdev_to_dev(device),
"%s: Port:0x%p Device:0x%p Request:0x%p Status:0x%x " "%s: Port:0x%p Device:0x%p Request:0x%p Status:0x%x "
"could not complete\n", "could not complete\n",
__func__, __func__,
this_device->owning_port, device->owning_port,
this_device, device,
request, request,
status); status);
...@@ -140,19 +139,18 @@ static enum sci_status scic_sds_stp_remote_device_complete_request( ...@@ -140,19 +139,18 @@ static enum sci_status scic_sds_stp_remote_device_complete_request(
* callback will be called. * callback will be called.
*/ */
static enum sci_status scic_sds_stp_remote_device_ready_substate_start_request_handler( static enum sci_status scic_sds_stp_remote_device_ready_substate_start_request_handler(
struct sci_base_remote_device *device, struct scic_sds_remote_device *device,
struct scic_sds_request *request) struct scic_sds_request *request)
{ {
enum sci_status status; enum sci_status status;
struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
/* Will the port allow the io request to start? */ /* Will the port allow the io request to start? */
status = this_device->owning_port->state_handlers->start_io_handler( status = device->owning_port->state_handlers->start_io_handler(
this_device->owning_port, this_device, request); device->owning_port, device, request);
if (status != SCI_SUCCESS) if (status != SCI_SUCCESS)
return status; return status;
status = scic_sds_remote_node_context_start_task(this_device->rnc, request); status = scic_sds_remote_node_context_start_task(device->rnc, request);
if (status != SCI_SUCCESS) if (status != SCI_SUCCESS)
goto out; goto out;
...@@ -164,8 +162,8 @@ static enum sci_status scic_sds_stp_remote_device_ready_substate_start_request_h ...@@ -164,8 +162,8 @@ static enum sci_status scic_sds_stp_remote_device_ready_substate_start_request_h
* Note: If the remote device state is not IDLE this will replace * Note: If the remote device state is not IDLE this will replace
* the request that probably resulted in the task management request. * the request that probably resulted in the task management request.
*/ */
this_device->working_request = request; device->working_request = request;
sci_base_state_machine_change_state(&this_device->ready_substate_machine, sci_base_state_machine_change_state(&device->ready_substate_machine,
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD); SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD);
/* /*
...@@ -175,14 +173,14 @@ static enum sci_status scic_sds_stp_remote_device_ready_substate_start_request_h ...@@ -175,14 +173,14 @@ static enum sci_status scic_sds_stp_remote_device_ready_substate_start_request_h
* remote node context state machine will take the correct action when * remote node context state machine will take the correct action when
* the remote node context is suspended and later resumed. * the remote node context is suspended and later resumed.
*/ */
scic_sds_remote_node_context_suspend(this_device->rnc, scic_sds_remote_node_context_suspend(device->rnc,
SCI_SOFTWARE_SUSPENSION, NULL, NULL); SCI_SOFTWARE_SUSPENSION, NULL, NULL);
scic_sds_remote_node_context_resume(this_device->rnc, scic_sds_remote_node_context_resume(device->rnc,
scic_sds_remote_device_continue_request, scic_sds_remote_device_continue_request,
this_device); device);
out: out:
scic_sds_remote_device_start_request(this_device, request, status); scic_sds_remote_device_start_request(device, request, status);
/* /*
* We need to let the controller start request handler know that it can't * We need to let the controller start request handler know that it can't
* post TC yet. We will provide a callback function to post TC when RNC gets * post TC yet. We will provide a callback function to post TC when RNC gets
...@@ -208,23 +206,21 @@ static enum sci_status scic_sds_stp_remote_device_ready_substate_start_request_h ...@@ -208,23 +206,21 @@ static enum sci_status scic_sds_stp_remote_device_ready_substate_start_request_h
* enum sci_status * enum sci_status
*/ */
static enum sci_status scic_sds_stp_remote_device_ready_idle_substate_start_io_handler( static enum sci_status scic_sds_stp_remote_device_ready_idle_substate_start_io_handler(
struct sci_base_remote_device *base_device, struct scic_sds_remote_device *sci_dev,
struct scic_sds_request *request) struct scic_sds_request *request)
{ {
enum sci_status status; enum sci_status status;
struct scic_sds_remote_device *device =
(struct scic_sds_remote_device *)&base_device->parent;
struct isci_request *isci_request = struct isci_request *isci_request =
(struct isci_request *)sci_object_get_association(request); (struct isci_request *)sci_object_get_association(request);
/* Will the port allow the io request to start? */ /* Will the port allow the io request to start? */
status = device->owning_port->state_handlers->start_io_handler( status = sci_dev->owning_port->state_handlers->start_io_handler(
device->owning_port, device, request); sci_dev->owning_port, sci_dev, request);
if (status != SCI_SUCCESS) if (status != SCI_SUCCESS)
return status; return status;
status = scic_sds_remote_node_context_start_io(device->rnc, request); status = scic_sds_remote_node_context_start_io(sci_dev->rnc, request);
if (status != SCI_SUCCESS) if (status != SCI_SUCCESS)
goto out; goto out;
...@@ -233,15 +229,15 @@ static enum sci_status scic_sds_stp_remote_device_ready_idle_substate_start_io_h ...@@ -233,15 +229,15 @@ static enum sci_status scic_sds_stp_remote_device_ready_idle_substate_start_io_h
goto out; goto out;
if (isci_sata_get_sat_protocol(isci_request) == SAT_PROTOCOL_FPDMA) { if (isci_sata_get_sat_protocol(isci_request) == SAT_PROTOCOL_FPDMA) {
sci_base_state_machine_change_state(&device->ready_substate_machine, sci_base_state_machine_change_state(&sci_dev->ready_substate_machine,
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ); SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ);
} else { } else {
device->working_request = request; sci_dev->working_request = request;
sci_base_state_machine_change_state(&device->ready_substate_machine, sci_base_state_machine_change_state(&sci_dev->ready_substate_machine,
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD); SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD);
} }
out: out:
scic_sds_remote_device_start_request(device, request, status); scic_sds_remote_device_start_request(sci_dev, request, status);
return status; return status;
} }
...@@ -281,30 +277,28 @@ static enum sci_status scic_sds_stp_remote_device_ready_idle_substate_event_hand ...@@ -281,30 +277,28 @@ static enum sci_status scic_sds_stp_remote_device_ready_idle_substate_event_hand
* ***************************************************************************** */ * ***************************************************************************** */
static enum sci_status scic_sds_stp_remote_device_ready_ncq_substate_start_io_handler( static enum sci_status scic_sds_stp_remote_device_ready_ncq_substate_start_io_handler(
struct sci_base_remote_device *base_device, struct scic_sds_remote_device *sci_dev,
struct scic_sds_request *request) struct scic_sds_request *request)
{ {
enum sci_status status; enum sci_status status;
struct scic_sds_remote_device *device =
(struct scic_sds_remote_device *)&base_device->parent;
struct isci_request *isci_request = struct isci_request *isci_request =
(struct isci_request *)sci_object_get_association(request); (struct isci_request *)sci_object_get_association(request);
if (isci_sata_get_sat_protocol(isci_request) == SAT_PROTOCOL_FPDMA) { if (isci_sata_get_sat_protocol(isci_request) == SAT_PROTOCOL_FPDMA) {
status = device->owning_port->state_handlers->start_io_handler( status = sci_dev->owning_port->state_handlers->start_io_handler(
device->owning_port, sci_dev->owning_port,
device, sci_dev,
request); request);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
status = scic_sds_remote_node_context_start_io( status = scic_sds_remote_node_context_start_io(
device->rnc, sci_dev->rnc,
request); request);
if (status == SCI_SUCCESS) if (status == SCI_SUCCESS)
status = request->state_handlers->start_handler(request); status = request->state_handlers->start_handler(request);
scic_sds_remote_device_start_request(device, scic_sds_remote_device_start_request(sci_dev,
request, request,
status); status);
} }
...@@ -392,7 +386,7 @@ static enum sci_status scic_sds_stp_remote_device_ready_ncq_substate_frame_handl ...@@ -392,7 +386,7 @@ static enum sci_status scic_sds_stp_remote_device_ready_ncq_substate_frame_handl
* enum sci_status * enum sci_status
*/ */
static enum sci_status scic_sds_stp_remote_device_ready_cmd_substate_start_io_handler( static enum sci_status scic_sds_stp_remote_device_ready_cmd_substate_start_io_handler(
struct sci_base_remote_device *device, struct scic_sds_remote_device *device,
struct scic_sds_request *request) struct scic_sds_request *request)
{ {
return SCI_FAILURE_INVALID_STATE; return SCI_FAILURE_INVALID_STATE;
...@@ -445,7 +439,7 @@ static enum sci_status scic_sds_stp_remote_device_ready_cmd_substate_frame_handl ...@@ -445,7 +439,7 @@ static enum sci_status scic_sds_stp_remote_device_ready_cmd_substate_frame_handl
* * STP REMOTE DEVICE READY AWAIT RESET SUBSTATE HANDLERS * * STP REMOTE DEVICE READY AWAIT RESET SUBSTATE HANDLERS
* ***************************************************************************** */ * ***************************************************************************** */
static enum sci_status scic_sds_stp_remote_device_ready_await_reset_substate_start_io_handler( static enum sci_status scic_sds_stp_remote_device_ready_await_reset_substate_start_io_handler(
struct sci_base_remote_device *device, struct scic_sds_remote_device *device,
struct scic_sds_request *request) struct scic_sds_request *request)
{ {
return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED; return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED;
...@@ -464,10 +458,9 @@ static enum sci_status scic_sds_stp_remote_device_ready_await_reset_substate_sta ...@@ -464,10 +458,9 @@ static enum sci_status scic_sds_stp_remote_device_ready_await_reset_substate_sta
* completed successfully. * completed successfully.
*/ */
static enum sci_status scic_sds_stp_remote_device_ready_await_reset_substate_complete_request_handler( static enum sci_status scic_sds_stp_remote_device_ready_await_reset_substate_complete_request_handler(
struct sci_base_remote_device *device, struct scic_sds_remote_device *device,
struct scic_sds_request *request) struct scic_sds_request *request)
{ {
struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
struct scic_sds_request *the_request = (struct scic_sds_request *)request; struct scic_sds_request *the_request = (struct scic_sds_request *)request;
enum sci_status status; enum sci_status status;
...@@ -475,20 +468,20 @@ static enum sci_status scic_sds_stp_remote_device_ready_await_reset_substate_com ...@@ -475,20 +468,20 @@ static enum sci_status scic_sds_stp_remote_device_ready_await_reset_substate_com
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
status = scic_sds_port_complete_io( status = scic_sds_port_complete_io(
this_device->owning_port, this_device, the_request device->owning_port, device, the_request
); );
if (status == SCI_SUCCESS) if (status == SCI_SUCCESS)
scic_sds_remote_device_decrement_request_count(this_device); scic_sds_remote_device_decrement_request_count(device);
} }
if (status != SCI_SUCCESS) if (status != SCI_SUCCESS)
dev_err(scirdev_to_dev(this_device), dev_err(scirdev_to_dev(device),
"%s: Port:0x%p Device:0x%p Request:0x%p Status:0x%x " "%s: Port:0x%p Device:0x%p Request:0x%p Status:0x%x "
"could not complete\n", "could not complete\n",
__func__, __func__,
this_device->owning_port, device->owning_port,
this_device, device,
the_request, the_request,
status); status);
...@@ -538,68 +531,68 @@ enum sci_status scic_sds_stp_remote_device_ready_atapi_error_substate_event_hand ...@@ -538,68 +531,68 @@ enum sci_status scic_sds_stp_remote_device_ready_atapi_error_substate_event_hand
static const struct scic_sds_remote_device_state_handler scic_sds_stp_remote_device_ready_substate_handler_table[] = { static const struct scic_sds_remote_device_state_handler scic_sds_stp_remote_device_ready_substate_handler_table[] = {
[SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE] = { [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE] = {
.parent.start_handler = scic_sds_remote_device_default_start_handler, .start_handler = scic_sds_remote_device_default_start_handler,
.parent.stop_handler = scic_sds_remote_device_ready_state_stop_handler, .stop_handler = scic_sds_remote_device_ready_state_stop_handler,
.parent.fail_handler = scic_sds_remote_device_default_fail_handler, .fail_handler = scic_sds_remote_device_default_fail_handler,
.parent.destruct_handler = scic_sds_remote_device_default_destruct_handler, .destruct_handler = scic_sds_remote_device_default_destruct_handler,
.parent.reset_handler = scic_sds_remote_device_ready_state_reset_handler, .reset_handler = scic_sds_remote_device_ready_state_reset_handler,
.parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
.parent.start_io_handler = scic_sds_stp_remote_device_ready_idle_substate_start_io_handler, .start_io_handler = scic_sds_stp_remote_device_ready_idle_substate_start_io_handler,
.parent.complete_io_handler = scic_sds_remote_device_default_complete_request_handler, .complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
.parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler, .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
.parent.start_task_handler = scic_sds_stp_remote_device_ready_substate_start_request_handler, .start_task_handler = scic_sds_stp_remote_device_ready_substate_start_request_handler,
.parent.complete_task_handler = scic_sds_remote_device_default_complete_request_handler, .complete_task_handler = scic_sds_remote_device_default_complete_request_handler,
.suspend_handler = scic_sds_remote_device_default_suspend_handler, .suspend_handler = scic_sds_remote_device_default_suspend_handler,
.resume_handler = scic_sds_remote_device_default_resume_handler, .resume_handler = scic_sds_remote_device_default_resume_handler,
.event_handler = scic_sds_stp_remote_device_ready_idle_substate_event_handler, .event_handler = scic_sds_stp_remote_device_ready_idle_substate_event_handler,
.frame_handler = scic_sds_remote_device_default_frame_handler .frame_handler = scic_sds_remote_device_default_frame_handler
}, },
[SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD] = { [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD] = {
.parent.start_handler = scic_sds_remote_device_default_start_handler, .start_handler = scic_sds_remote_device_default_start_handler,
.parent.stop_handler = scic_sds_remote_device_ready_state_stop_handler, .stop_handler = scic_sds_remote_device_ready_state_stop_handler,
.parent.fail_handler = scic_sds_remote_device_default_fail_handler, .fail_handler = scic_sds_remote_device_default_fail_handler,
.parent.destruct_handler = scic_sds_remote_device_default_destruct_handler, .destruct_handler = scic_sds_remote_device_default_destruct_handler,
.parent.reset_handler = scic_sds_remote_device_ready_state_reset_handler, .reset_handler = scic_sds_remote_device_ready_state_reset_handler,
.parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
.parent.start_io_handler = scic_sds_stp_remote_device_ready_cmd_substate_start_io_handler, .start_io_handler = scic_sds_stp_remote_device_ready_cmd_substate_start_io_handler,
.parent.complete_io_handler = scic_sds_stp_remote_device_complete_request, .complete_io_handler = scic_sds_stp_remote_device_complete_request,
.parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler, .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
.parent.start_task_handler = scic_sds_stp_remote_device_ready_substate_start_request_handler, .start_task_handler = scic_sds_stp_remote_device_ready_substate_start_request_handler,
.parent.complete_task_handler = scic_sds_stp_remote_device_complete_request, .complete_task_handler = scic_sds_stp_remote_device_complete_request,
.suspend_handler = scic_sds_stp_remote_device_ready_cmd_substate_suspend_handler, .suspend_handler = scic_sds_stp_remote_device_ready_cmd_substate_suspend_handler,
.resume_handler = scic_sds_remote_device_default_resume_handler, .resume_handler = scic_sds_remote_device_default_resume_handler,
.event_handler = scic_sds_remote_device_general_event_handler, .event_handler = scic_sds_remote_device_general_event_handler,
.frame_handler = scic_sds_stp_remote_device_ready_cmd_substate_frame_handler .frame_handler = scic_sds_stp_remote_device_ready_cmd_substate_frame_handler
}, },
[SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ] = { [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ] = {
.parent.start_handler = scic_sds_remote_device_default_start_handler, .start_handler = scic_sds_remote_device_default_start_handler,
.parent.stop_handler = scic_sds_remote_device_ready_state_stop_handler, .stop_handler = scic_sds_remote_device_ready_state_stop_handler,
.parent.fail_handler = scic_sds_remote_device_default_fail_handler, .fail_handler = scic_sds_remote_device_default_fail_handler,
.parent.destruct_handler = scic_sds_remote_device_default_destruct_handler, .destruct_handler = scic_sds_remote_device_default_destruct_handler,
.parent.reset_handler = scic_sds_remote_device_ready_state_reset_handler, .reset_handler = scic_sds_remote_device_ready_state_reset_handler,
.parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
.parent.start_io_handler = scic_sds_stp_remote_device_ready_ncq_substate_start_io_handler, .start_io_handler = scic_sds_stp_remote_device_ready_ncq_substate_start_io_handler,
.parent.complete_io_handler = scic_sds_stp_remote_device_complete_request, .complete_io_handler = scic_sds_stp_remote_device_complete_request,
.parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler, .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
.parent.start_task_handler = scic_sds_stp_remote_device_ready_substate_start_request_handler, .start_task_handler = scic_sds_stp_remote_device_ready_substate_start_request_handler,
.parent.complete_task_handler = scic_sds_stp_remote_device_complete_request, .complete_task_handler = scic_sds_stp_remote_device_complete_request,
.suspend_handler = scic_sds_remote_device_default_suspend_handler, .suspend_handler = scic_sds_remote_device_default_suspend_handler,
.resume_handler = scic_sds_remote_device_default_resume_handler, .resume_handler = scic_sds_remote_device_default_resume_handler,
.event_handler = scic_sds_remote_device_general_event_handler, .event_handler = scic_sds_remote_device_general_event_handler,
.frame_handler = scic_sds_stp_remote_device_ready_ncq_substate_frame_handler .frame_handler = scic_sds_stp_remote_device_ready_ncq_substate_frame_handler
}, },
[SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR] = { [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR] = {
.parent.start_handler = scic_sds_remote_device_default_start_handler, .start_handler = scic_sds_remote_device_default_start_handler,
.parent.stop_handler = scic_sds_remote_device_ready_state_stop_handler, .stop_handler = scic_sds_remote_device_ready_state_stop_handler,
.parent.fail_handler = scic_sds_remote_device_default_fail_handler, .fail_handler = scic_sds_remote_device_default_fail_handler,
.parent.destruct_handler = scic_sds_remote_device_default_destruct_handler, .destruct_handler = scic_sds_remote_device_default_destruct_handler,
.parent.reset_handler = scic_sds_remote_device_ready_state_reset_handler, .reset_handler = scic_sds_remote_device_ready_state_reset_handler,
.parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
.parent.start_io_handler = scic_sds_remote_device_default_start_request_handler, .start_io_handler = scic_sds_remote_device_default_start_request_handler,
.parent.complete_io_handler = scic_sds_stp_remote_device_complete_request, .complete_io_handler = scic_sds_stp_remote_device_complete_request,
.parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler, .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
.parent.start_task_handler = scic_sds_stp_remote_device_ready_substate_start_request_handler, .start_task_handler = scic_sds_stp_remote_device_ready_substate_start_request_handler,
.parent.complete_task_handler = scic_sds_stp_remote_device_complete_request, .complete_task_handler = scic_sds_stp_remote_device_complete_request,
.suspend_handler = scic_sds_remote_device_default_suspend_handler, .suspend_handler = scic_sds_remote_device_default_suspend_handler,
.resume_handler = scic_sds_remote_device_default_resume_handler, .resume_handler = scic_sds_remote_device_default_resume_handler,
.event_handler = scic_sds_remote_device_general_event_handler, .event_handler = scic_sds_remote_device_general_event_handler,
...@@ -607,17 +600,17 @@ static const struct scic_sds_remote_device_state_handler scic_sds_stp_remote_dev ...@@ -607,17 +600,17 @@ static const struct scic_sds_remote_device_state_handler scic_sds_stp_remote_dev
}, },
#if !defined(DISABLE_ATAPI) #if !defined(DISABLE_ATAPI)
[SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_ATAPI_ERROR] = { [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_ATAPI_ERROR] = {
.parent.start_handler = scic_sds_remote_device_default_start_handler, .start_handler = scic_sds_remote_device_default_start_handler,
.parent.stop_handler = scic_sds_remote_device_ready_state_stop_handler, .stop_handler = scic_sds_remote_device_ready_state_stop_handler,
.parent.fail_handler = scic_sds_remote_device_default_fail_handler, .fail_handler = scic_sds_remote_device_default_fail_handler,
.parent.destruct_handler = scic_sds_remote_device_default_destruct_handler, .destruct_handler = scic_sds_remote_device_default_destruct_handler,
.parent.reset_handler = scic_sds_remote_device_ready_state_reset_handler, .reset_handler = scic_sds_remote_device_ready_state_reset_handler,
.parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
.parent.start_io_handler = scic_sds_remote_device_default_start_request_handler, .start_io_handler = scic_sds_remote_device_default_start_request_handler,
.parent.complete_io_handler = scic_sds_stp_remote_device_complete_request, .complete_io_handler = scic_sds_stp_remote_device_complete_request,
.parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler, .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
.parent.start_task_handler = scic_sds_stp_remote_device_ready_substate_start_request_handler, .start_task_handler = scic_sds_stp_remote_device_ready_substate_start_request_handler,
.parent.complete_task_handler = scic_sds_stp_remote_device_complete_request, .complete_task_handler = scic_sds_stp_remote_device_complete_request,
.suspend_handler = scic_sds_remote_device_default_suspend_handler, .suspend_handler = scic_sds_remote_device_default_suspend_handler,
.resume_handler = scic_sds_remote_device_default_resume_handler, .resume_handler = scic_sds_remote_device_default_resume_handler,
.event_handler = scic_sds_stp_remote_device_ready_atapi_error_substate_event_handler, .event_handler = scic_sds_stp_remote_device_ready_atapi_error_substate_event_handler,
...@@ -625,17 +618,17 @@ static const struct scic_sds_remote_device_state_handler scic_sds_stp_remote_dev ...@@ -625,17 +618,17 @@ static const struct scic_sds_remote_device_state_handler scic_sds_stp_remote_dev
}, },
#endif #endif
[SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET] = { [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET] = {
.parent.start_handler = scic_sds_remote_device_default_start_handler, .start_handler = scic_sds_remote_device_default_start_handler,
.parent.stop_handler = scic_sds_remote_device_ready_state_stop_handler, .stop_handler = scic_sds_remote_device_ready_state_stop_handler,
.parent.fail_handler = scic_sds_remote_device_default_fail_handler, .fail_handler = scic_sds_remote_device_default_fail_handler,
.parent.destruct_handler = scic_sds_remote_device_default_destruct_handler, .destruct_handler = scic_sds_remote_device_default_destruct_handler,
.parent.reset_handler = scic_sds_remote_device_ready_state_reset_handler, .reset_handler = scic_sds_remote_device_ready_state_reset_handler,
.parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
.parent.start_io_handler = scic_sds_stp_remote_device_ready_await_reset_substate_start_io_handler, .start_io_handler = scic_sds_stp_remote_device_ready_await_reset_substate_start_io_handler,
.parent.complete_io_handler = scic_sds_stp_remote_device_ready_await_reset_substate_complete_request_handler, .complete_io_handler = scic_sds_stp_remote_device_ready_await_reset_substate_complete_request_handler,
.parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler, .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
.parent.start_task_handler = scic_sds_stp_remote_device_ready_substate_start_request_handler, .start_task_handler = scic_sds_stp_remote_device_ready_substate_start_request_handler,
.parent.complete_task_handler = scic_sds_stp_remote_device_complete_request, .complete_task_handler = scic_sds_stp_remote_device_complete_request,
.suspend_handler = scic_sds_remote_device_default_suspend_handler, .suspend_handler = scic_sds_remote_device_default_suspend_handler,
.resume_handler = scic_sds_remote_device_default_resume_handler, .resume_handler = scic_sds_remote_device_default_resume_handler,
.event_handler = scic_sds_remote_device_general_event_handler, .event_handler = scic_sds_remote_device_general_event_handler,
...@@ -711,7 +704,7 @@ static void scic_sds_stp_remote_device_ready_idle_substate_enter( ...@@ -711,7 +704,7 @@ static void scic_sds_stp_remote_device_ready_idle_substate_enter(
static void scic_sds_stp_remote_device_ready_cmd_substate_enter(struct sci_base_object *object) static void scic_sds_stp_remote_device_ready_cmd_substate_enter(struct sci_base_object *object)
{ {
struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev), struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
parent.parent); parent);
struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
struct isci_host *ihost = sci_object_get_association(scic); struct isci_host *ihost = sci_object_get_association(scic);
struct isci_remote_device *idev = sci_object_get_association(sci_dev); struct isci_remote_device *idev = sci_object_get_association(sci_dev);
...@@ -729,7 +722,7 @@ static void scic_sds_stp_remote_device_ready_cmd_substate_enter(struct sci_base_ ...@@ -729,7 +722,7 @@ static void scic_sds_stp_remote_device_ready_cmd_substate_enter(struct sci_base_
static void scic_sds_stp_remote_device_ready_ncq_substate_enter(struct sci_base_object *object) static void scic_sds_stp_remote_device_ready_ncq_substate_enter(struct sci_base_object *object)
{ {
struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev), struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
parent.parent); parent);
SET_STATE_HANDLER(sci_dev, SET_STATE_HANDLER(sci_dev,
scic_sds_stp_remote_device_ready_substate_handler_table, scic_sds_stp_remote_device_ready_substate_handler_table,
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ); SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ);
...@@ -738,7 +731,7 @@ static void scic_sds_stp_remote_device_ready_ncq_substate_enter(struct sci_base_ ...@@ -738,7 +731,7 @@ static void scic_sds_stp_remote_device_ready_ncq_substate_enter(struct sci_base_
static void scic_sds_stp_remote_device_ready_ncq_error_substate_enter(struct sci_base_object *object) static void scic_sds_stp_remote_device_ready_ncq_error_substate_enter(struct sci_base_object *object)
{ {
struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev), struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
parent.parent); parent);
struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
struct isci_host *ihost = sci_object_get_association(scic); struct isci_host *ihost = sci_object_get_association(scic);
struct isci_remote_device *idev = sci_object_get_association(sci_dev); struct isci_remote_device *idev = sci_object_get_association(sci_dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment