+++ /dev/null
-/*
- * 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_ */
*
*/
static bool scic_sds_controller_has_remote_devices_stopping(
- struct scic_sds_controller *this_controller)
+ struct scic_sds_controller *controller)
{
u32 index;
- for (index = 0; index < this_controller->remote_node_entries; index++) {
- if ((this_controller->device_table[index] != NULL) &&
- (this_controller->device_table[index]->parent.state_machine.current_state_id
+ for (index = 0; index < controller->remote_node_entries; index++) {
+ if ((controller->device_table[index] != NULL) &&
+ (controller->device_table[index]->state_machine.current_state_id
== SCI_BASE_REMOTE_DEVICE_STATE_STOPPING))
return true;
}
sci_base_state_machine_construct(
&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_IDLE);
} else if (sci_dev->target_protocols.u.bits.attached_smp_target) {
/* add the SMP ready substate machine construction here */
sci_base_state_machine_construct(
&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_IDLE);
}
/* add the SMP ready substate machine construction here */
sci_base_state_machine_construct(
&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_IDLE);
} else if (sci_dev->target_protocols.u.bits.attached_stp_target) {
sci_base_state_machine_construct(
&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_IDLE);
}
enum sci_status scic_remote_device_destruct(
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);
}
struct scic_sds_remote_device *sci_dev,
u32 timeout)
{
- return sci_dev->state_handlers->parent.start_handler(&sci_dev->parent);
+ return sci_dev->state_handlers->start_handler(sci_dev);
}
struct scic_sds_remote_device *sci_dev,
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(
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(
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);
}
struct scic_sds_remote_device *this_device,
struct scic_sds_request *io_request)
{
- return this_device->state_handlers->parent.start_io_handler(
- &this_device->parent, io_request);
+ return this_device->state_handlers->start_io_handler(
+ this_device, io_request);
}
/**
struct scic_sds_remote_device *this_device,
struct scic_sds_request *io_request)
{
- return this_device->state_handlers->parent.complete_io_handler(
- &this_device->parent, io_request);
+ return this_device->state_handlers->complete_io_handler(
+ this_device, io_request);
}
/**
struct scic_sds_remote_device *this_device,
struct scic_sds_request *io_request)
{
- return this_device->state_handlers->parent.start_task_handler(
- &this_device->parent, io_request);
+ return this_device->state_handlers->start_task_handler(
+ this_device, io_request);
}
/**
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);
}
this_device = (struct scic_sds_remote_device *)user_parameter;
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_state_machine_change_state(
- &this_device->parent.state_machine,
+ &this_device->state_machine,
SCI_BASE_REMOTE_DEVICE_STATE_READY
);
}
return status;
}
-static enum sci_status default_device_handler(struct sci_base_remote_device *base_dev,
- const char *func)
+static enum sci_status
+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),
"%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;
}
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(
- 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(
- 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(
- 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(
- 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(
- 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(
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(
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.
* @event_code: The event code that the struct scic_sds_controller wants the device
* object to process.
}
/**
*
- * @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.
* @event_code: The event code that the struct scic_sds_controller wants the device
* object to process.
/**
*
- * @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.
* @frame_index: The frame index for which the struct scic_sds_controller wants this
* device object to process.
__func__,
frame_index,
sci_base_state_machine_get_state(
- &this_device->parent.state_machine));
+ &this_device->state_machine));
/* Return the frame back to the controller */
scic_sds_controller_release_frame(
}
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)
{
- 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(
- struct sci_base_remote_device *base_dev,
+ struct scic_sds_remote_device *sci_dev,
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(
- struct sci_base_remote_device *base_dev,
+ struct scic_sds_remote_device *sci_dev,
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.
* @frame_index: The frame index for which the struct scic_sds_controller wants this
* device object to process.
* which to construct the remote device.
*/
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;
- 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,
scic_sds_remote_device_resume_complete_handler, sci_dev);
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);
return status;
}
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;
}
/**
*
- * @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.
*
* This method will destruct a struct scic_sds_remote_device that is in a stopped
* enum sci_status SCI_SUCCESS
*/
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;
- sci_dev = container_of(base_dev, typeof(*sci_dev), parent);
scic = scic_sds_remote_device_get_controller(sci_dev);
scic_sds_controller_free_remote_node_context(scic, sci_dev,
sci_dev->rnc->remote_node_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);
return SCI_SUCCESS;
* ***************************************************************************** */
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
*/
* Transition to the stopping state and wait for the remote node to
* 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);
return SCI_SUCCESS;
}
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;
- sci_dev = container_of(base_dev, typeof(*sci_dev), parent);
/* 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);
if (sci_dev->started_request_count == 0) {
/**
*
- * @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.
*
* This is the ready state device reset handler enum sci_status
*/
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 */
- 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);
return SCI_SUCCESS;
* object could not get the resources to start.
*/
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)
{
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 */
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) {
result = scic_sds_remote_node_context_start_task(
- this_device->rnc, request);
+ sci_dev->rnc, request);
if (result == SCI_SUCCESS)
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;
* object could not get the resources to start.
*/
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)
{
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 */
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) {
result = scic_sds_remote_node_context_start_io(
- this_device->rnc, request);
+ sci_dev->rnc, request);
if (result == SCI_SUCCESS)
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;
* its own started_request_count. enum sci_status
*/
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)
{
enum sci_status result;
- struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)device;
result = scic_sds_request_complete(request);
- if (result == SCI_SUCCESS) {
- /* See if the port is in a state where we can start the IO request */
- result = scic_sds_port_complete_io(
- scic_sds_remote_device_get_port(this_device), this_device, request);
+ if (result != SCI_SUCCESS)
+ return result;
- if (result == SCI_SUCCESS) {
- scic_sds_remote_device_decrement_request_count(this_device);
- }
- }
+ /* See if the port is in a state
+ * 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;
}
/**
*
- * @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.
*
* This method will stop a struct scic_sds_remote_device that is already in the
* stopped. enum sci_status SCI_SUCCESS
*/
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
* attempt to stop a device already in the stopping state, then
* try again to terminate. */
- return scic_sds_remote_device_terminate_requests(
- (struct scic_sds_remote_device *)device);
+ return scic_sds_remote_device_terminate_requests(device);
}
* 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(
- struct sci_base_remote_device *device,
+ struct scic_sds_remote_device *sci_dev,
struct scic_sds_request *request)
{
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);
- 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) {
- scic_sds_remote_device_decrement_request_count(this_device);
-
- 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
- );
- }
- }
- }
+ if (status != SCI_SUCCESS)
+ return status;
- 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;
-/*
- * *****************************************************************************
- * * RESETTING STATE HANDLERS
- * ***************************************************************************** */
+ scic_sds_remote_device_decrement_request_count(sci_dev);
+
+ 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.
*
* This method will complete the reset operation when the device is in the
* resetting state. enum sci_status
*/
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(
- &this_device->parent.state_machine,
+ &sci_dev->state_machine,
SCI_BASE_REMOTE_DEVICE_STATE_READY
);
/**
*
- * @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.
*
* This method will stop the remote device while in the resetting state.
* enum sci_status
*/
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(
- &this_device->parent.state_machine,
+ &sci_dev->state_machine,
SCI_BASE_REMOTE_DEVICE_STATE_STOPPING
);
* completes the task request. enum sci_status
*/
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)
{
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);
if (status == SCI_SUCCESS) {
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) {
- scic_sds_remote_device_decrement_request_count(this_device);
+ scic_sds_remote_device_decrement_request_count(sci_dev);
}
}
/**
*
- * @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.
*
* This method handles the remove request for a failed struct scic_sds_remote_device
static const struct scic_sds_remote_device_state_handler scic_sds_remote_device_state_handler_table[] = {
[SCI_BASE_REMOTE_DEVICE_STATE_INITIAL] = {
- .parent.start_handler = scic_sds_remote_device_default_start_handler,
- .parent.stop_handler = scic_sds_remote_device_default_stop_handler,
- .parent.fail_handler = scic_sds_remote_device_default_fail_handler,
- .parent.destruct_handler = scic_sds_remote_device_default_destruct_handler,
- .parent.reset_handler = scic_sds_remote_device_default_reset_handler,
- .parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
- .parent.start_io_handler = scic_sds_remote_device_default_start_request_handler,
- .parent.complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
- .parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
- .parent.start_task_handler = scic_sds_remote_device_default_start_request_handler,
- .parent.complete_task_handler = scic_sds_remote_device_default_complete_request_handler,
- .suspend_handler = scic_sds_remote_device_default_suspend_handler,
- .resume_handler = scic_sds_remote_device_default_resume_handler,
- .event_handler = scic_sds_remote_device_default_event_handler,
- .frame_handler = scic_sds_remote_device_default_frame_handler
+ .start_handler = scic_sds_remote_device_default_start_handler,
+ .stop_handler = scic_sds_remote_device_default_stop_handler,
+ .fail_handler = scic_sds_remote_device_default_fail_handler,
+ .destruct_handler = scic_sds_remote_device_default_destruct_handler,
+ .reset_handler = scic_sds_remote_device_default_reset_handler,
+ .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+ .start_io_handler = scic_sds_remote_device_default_start_request_handler,
+ .complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
+ .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
+ .start_task_handler = scic_sds_remote_device_default_start_request_handler,
+ .complete_task_handler = scic_sds_remote_device_default_complete_request_handler,
+ .suspend_handler = scic_sds_remote_device_default_suspend_handler,
+ .resume_handler = scic_sds_remote_device_default_resume_handler,
+ .event_handler = scic_sds_remote_device_default_event_handler,
+ .frame_handler = scic_sds_remote_device_default_frame_handler
},
[SCI_BASE_REMOTE_DEVICE_STATE_STOPPED] = {
- .parent.start_handler = scic_sds_remote_device_stopped_state_start_handler,
- .parent.stop_handler = scic_sds_remote_device_stopped_state_stop_handler,
- .parent.fail_handler = scic_sds_remote_device_default_fail_handler,
- .parent.destruct_handler = scic_sds_remote_device_stopped_state_destruct_handler,
- .parent.reset_handler = scic_sds_remote_device_default_reset_handler,
- .parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
- .parent.start_io_handler = scic_sds_remote_device_default_start_request_handler,
- .parent.complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
- .parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
- .parent.start_task_handler = scic_sds_remote_device_default_start_request_handler,
- .parent.complete_task_handler = scic_sds_remote_device_default_complete_request_handler,
- .suspend_handler = scic_sds_remote_device_default_suspend_handler,
- .resume_handler = scic_sds_remote_device_default_resume_handler,
- .event_handler = scic_sds_remote_device_default_event_handler,
- .frame_handler = scic_sds_remote_device_default_frame_handler
+ .start_handler = scic_sds_remote_device_stopped_state_start_handler,
+ .stop_handler = scic_sds_remote_device_stopped_state_stop_handler,
+ .fail_handler = scic_sds_remote_device_default_fail_handler,
+ .destruct_handler = scic_sds_remote_device_stopped_state_destruct_handler,
+ .reset_handler = scic_sds_remote_device_default_reset_handler,
+ .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+ .start_io_handler = scic_sds_remote_device_default_start_request_handler,
+ .complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
+ .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
+ .start_task_handler = scic_sds_remote_device_default_start_request_handler,
+ .complete_task_handler = scic_sds_remote_device_default_complete_request_handler,
+ .suspend_handler = scic_sds_remote_device_default_suspend_handler,
+ .resume_handler = scic_sds_remote_device_default_resume_handler,
+ .event_handler = scic_sds_remote_device_default_event_handler,
+ .frame_handler = scic_sds_remote_device_default_frame_handler
},
[SCI_BASE_REMOTE_DEVICE_STATE_STARTING] = {
- .parent.start_handler = scic_sds_remote_device_default_start_handler,
- .parent.stop_handler = scic_sds_remote_device_starting_state_stop_handler,
- .parent.fail_handler = scic_sds_remote_device_default_fail_handler,
- .parent.destruct_handler = scic_sds_remote_device_default_destruct_handler,
- .parent.reset_handler = scic_sds_remote_device_default_reset_handler,
- .parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
- .parent.start_io_handler = scic_sds_remote_device_default_start_request_handler,
- .parent.complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
- .parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
- .parent.start_task_handler = scic_sds_remote_device_default_start_request_handler,
- .parent.complete_task_handler = scic_sds_remote_device_default_complete_request_handler,
- .suspend_handler = scic_sds_remote_device_default_suspend_handler,
- .resume_handler = scic_sds_remote_device_default_resume_handler,
- .event_handler = scic_sds_remote_device_general_event_handler,
- .frame_handler = scic_sds_remote_device_default_frame_handler
+ .start_handler = scic_sds_remote_device_default_start_handler,
+ .stop_handler = scic_sds_remote_device_starting_state_stop_handler,
+ .fail_handler = scic_sds_remote_device_default_fail_handler,
+ .destruct_handler = scic_sds_remote_device_default_destruct_handler,
+ .reset_handler = scic_sds_remote_device_default_reset_handler,
+ .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+ .start_io_handler = scic_sds_remote_device_default_start_request_handler,
+ .complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
+ .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
+ .start_task_handler = scic_sds_remote_device_default_start_request_handler,
+ .complete_task_handler = scic_sds_remote_device_default_complete_request_handler,
+ .suspend_handler = scic_sds_remote_device_default_suspend_handler,
+ .resume_handler = scic_sds_remote_device_default_resume_handler,
+ .event_handler = scic_sds_remote_device_general_event_handler,
+ .frame_handler = scic_sds_remote_device_default_frame_handler
},
[SCI_BASE_REMOTE_DEVICE_STATE_READY] = {
- .parent.start_handler = scic_sds_remote_device_default_start_handler,
- .parent.stop_handler = scic_sds_remote_device_ready_state_stop_handler,
- .parent.fail_handler = scic_sds_remote_device_default_fail_handler,
- .parent.destruct_handler = scic_sds_remote_device_default_destruct_handler,
- .parent.reset_handler = scic_sds_remote_device_ready_state_reset_handler,
- .parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
- .parent.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,
- .parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
- .parent.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,
- .suspend_handler = scic_sds_remote_device_default_suspend_handler,
- .resume_handler = scic_sds_remote_device_default_resume_handler,
- .event_handler = scic_sds_remote_device_general_event_handler,
- .frame_handler = scic_sds_remote_device_general_frame_handler,
+ .start_handler = scic_sds_remote_device_default_start_handler,
+ .stop_handler = scic_sds_remote_device_ready_state_stop_handler,
+ .fail_handler = scic_sds_remote_device_default_fail_handler,
+ .destruct_handler = scic_sds_remote_device_default_destruct_handler,
+ .reset_handler = scic_sds_remote_device_ready_state_reset_handler,
+ .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+ .start_io_handler = scic_sds_remote_device_ready_state_start_io_handler,
+ .complete_io_handler = scic_sds_remote_device_ready_state_complete_request_handler,
+ .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
+ .start_task_handler = scic_sds_remote_device_ready_state_start_task_handler,
+ .complete_task_handler = scic_sds_remote_device_ready_state_complete_request_handler,
+ .suspend_handler = scic_sds_remote_device_default_suspend_handler,
+ .resume_handler = scic_sds_remote_device_default_resume_handler,
+ .event_handler = scic_sds_remote_device_general_event_handler,
+ .frame_handler = scic_sds_remote_device_general_frame_handler,
},
[SCI_BASE_REMOTE_DEVICE_STATE_STOPPING] = {
- .parent.start_handler = scic_sds_remote_device_default_start_handler,
- .parent.stop_handler = scic_sds_remote_device_stopping_state_stop_handler,
- .parent.fail_handler = scic_sds_remote_device_default_fail_handler,
- .parent.destruct_handler = scic_sds_remote_device_default_destruct_handler,
- .parent.reset_handler = scic_sds_remote_device_default_reset_handler,
- .parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
- .parent.start_io_handler = scic_sds_remote_device_default_start_request_handler,
- .parent.complete_io_handler = scic_sds_remote_device_stopping_state_complete_request_handler,
- .parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
- .parent.start_task_handler = scic_sds_remote_device_default_start_request_handler,
- .parent.complete_task_handler = scic_sds_remote_device_stopping_state_complete_request_handler,
- .suspend_handler = scic_sds_remote_device_default_suspend_handler,
- .resume_handler = scic_sds_remote_device_default_resume_handler,
- .event_handler = scic_sds_remote_device_general_event_handler,
- .frame_handler = scic_sds_remote_device_general_frame_handler
+ .start_handler = scic_sds_remote_device_default_start_handler,
+ .stop_handler = scic_sds_remote_device_stopping_state_stop_handler,
+ .fail_handler = scic_sds_remote_device_default_fail_handler,
+ .destruct_handler = scic_sds_remote_device_default_destruct_handler,
+ .reset_handler = scic_sds_remote_device_default_reset_handler,
+ .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+ .start_io_handler = scic_sds_remote_device_default_start_request_handler,
+ .complete_io_handler = scic_sds_remote_device_stopping_state_complete_request_handler,
+ .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
+ .start_task_handler = scic_sds_remote_device_default_start_request_handler,
+ .complete_task_handler = scic_sds_remote_device_stopping_state_complete_request_handler,
+ .suspend_handler = scic_sds_remote_device_default_suspend_handler,
+ .resume_handler = scic_sds_remote_device_default_resume_handler,
+ .event_handler = scic_sds_remote_device_general_event_handler,
+ .frame_handler = scic_sds_remote_device_general_frame_handler
},
[SCI_BASE_REMOTE_DEVICE_STATE_FAILED] = {
- .parent.start_handler = scic_sds_remote_device_default_start_handler,
- .parent.stop_handler = scic_sds_remote_device_default_stop_handler,
- .parent.fail_handler = scic_sds_remote_device_default_fail_handler,
- .parent.destruct_handler = scic_sds_remote_device_default_destruct_handler,
- .parent.reset_handler = scic_sds_remote_device_default_reset_handler,
- .parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
- .parent.start_io_handler = scic_sds_remote_device_default_start_request_handler,
- .parent.complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
- .parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
- .parent.start_task_handler = scic_sds_remote_device_default_start_request_handler,
- .parent.complete_task_handler = scic_sds_remote_device_default_complete_request_handler,
- .suspend_handler = scic_sds_remote_device_default_suspend_handler,
- .resume_handler = scic_sds_remote_device_default_resume_handler,
- .event_handler = scic_sds_remote_device_default_event_handler,
- .frame_handler = scic_sds_remote_device_general_frame_handler
+ .start_handler = scic_sds_remote_device_default_start_handler,
+ .stop_handler = scic_sds_remote_device_default_stop_handler,
+ .fail_handler = scic_sds_remote_device_default_fail_handler,
+ .destruct_handler = scic_sds_remote_device_default_destruct_handler,
+ .reset_handler = scic_sds_remote_device_default_reset_handler,
+ .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+ .start_io_handler = scic_sds_remote_device_default_start_request_handler,
+ .complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
+ .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
+ .start_task_handler = scic_sds_remote_device_default_start_request_handler,
+ .complete_task_handler = scic_sds_remote_device_default_complete_request_handler,
+ .suspend_handler = scic_sds_remote_device_default_suspend_handler,
+ .resume_handler = scic_sds_remote_device_default_resume_handler,
+ .event_handler = scic_sds_remote_device_default_event_handler,
+ .frame_handler = scic_sds_remote_device_general_frame_handler
},
[SCI_BASE_REMOTE_DEVICE_STATE_RESETTING] = {
- .parent.start_handler = scic_sds_remote_device_default_start_handler,
- .parent.stop_handler = scic_sds_remote_device_resetting_state_stop_handler,
- .parent.fail_handler = scic_sds_remote_device_default_fail_handler,
- .parent.destruct_handler = scic_sds_remote_device_default_destruct_handler,
- .parent.reset_handler = scic_sds_remote_device_default_reset_handler,
- .parent.reset_complete_handler = scic_sds_remote_device_resetting_state_reset_complete_handler,
- .parent.start_io_handler = scic_sds_remote_device_default_start_request_handler,
- .parent.complete_io_handler = scic_sds_remote_device_resetting_state_complete_request_handler,
- .parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
- .parent.start_task_handler = scic_sds_remote_device_default_start_request_handler,
- .parent.complete_task_handler = scic_sds_remote_device_resetting_state_complete_request_handler,
- .suspend_handler = scic_sds_remote_device_default_suspend_handler,
- .resume_handler = scic_sds_remote_device_default_resume_handler,
- .event_handler = scic_sds_remote_device_default_event_handler,
- .frame_handler = scic_sds_remote_device_general_frame_handler
+ .start_handler = scic_sds_remote_device_default_start_handler,
+ .stop_handler = scic_sds_remote_device_resetting_state_stop_handler,
+ .fail_handler = scic_sds_remote_device_default_fail_handler,
+ .destruct_handler = scic_sds_remote_device_default_destruct_handler,
+ .reset_handler = scic_sds_remote_device_default_reset_handler,
+ .reset_complete_handler = scic_sds_remote_device_resetting_state_reset_complete_handler,
+ .start_io_handler = scic_sds_remote_device_default_start_request_handler,
+ .complete_io_handler = scic_sds_remote_device_resetting_state_complete_request_handler,
+ .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
+ .start_task_handler = scic_sds_remote_device_default_start_request_handler,
+ .complete_task_handler = scic_sds_remote_device_resetting_state_complete_request_handler,
+ .suspend_handler = scic_sds_remote_device_default_suspend_handler,
+ .resume_handler = scic_sds_remote_device_default_resume_handler,
+ .event_handler = scic_sds_remote_device_default_event_handler,
+ .frame_handler = scic_sds_remote_device_general_frame_handler
},
[SCI_BASE_REMOTE_DEVICE_STATE_FINAL] = {
- .parent.start_handler = scic_sds_remote_device_default_start_handler,
- .parent.stop_handler = scic_sds_remote_device_default_stop_handler,
- .parent.fail_handler = scic_sds_remote_device_default_fail_handler,
- .parent.destruct_handler = scic_sds_remote_device_default_destruct_handler,
- .parent.reset_handler = scic_sds_remote_device_default_reset_handler,
- .parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
- .parent.start_io_handler = scic_sds_remote_device_default_start_request_handler,
- .parent.complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
- .parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
- .parent.start_task_handler = scic_sds_remote_device_default_start_request_handler,
- .parent.complete_task_handler = scic_sds_remote_device_default_complete_request_handler,
- .suspend_handler = scic_sds_remote_device_default_suspend_handler,
- .resume_handler = scic_sds_remote_device_default_resume_handler,
- .event_handler = scic_sds_remote_device_default_event_handler,
- .frame_handler = scic_sds_remote_device_default_frame_handler
+ .start_handler = scic_sds_remote_device_default_start_handler,
+ .stop_handler = scic_sds_remote_device_default_stop_handler,
+ .fail_handler = scic_sds_remote_device_default_fail_handler,
+ .destruct_handler = scic_sds_remote_device_default_destruct_handler,
+ .reset_handler = scic_sds_remote_device_default_reset_handler,
+ .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+ .start_io_handler = scic_sds_remote_device_default_start_request_handler,
+ .complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
+ .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
+ .start_task_handler = scic_sds_remote_device_default_start_request_handler,
+ .complete_task_handler = scic_sds_remote_device_default_complete_request_handler,
+ .suspend_handler = scic_sds_remote_device_default_suspend_handler,
+ .resume_handler = scic_sds_remote_device_default_resume_handler,
+ .event_handler = scic_sds_remote_device_default_event_handler,
+ .frame_handler = scic_sds_remote_device_default_frame_handler
}
};
{
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,
SCI_BASE_REMOTE_DEVICE_STATE_INITIAL);
/* 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);
}
struct isci_host *ihost;
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);
ihost = sci_object_get_association(scic);
idev = sci_object_get_association(sci_dev);
/* If we are entering from the stopping state let the SCI User know that
* 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)
isci_remote_device_stop_complete(ihost, idev, SCI_SUCCESS);
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),
- parent.parent);
+ parent);
struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
struct isci_host *ihost = sci_object_get_association(scic);
struct isci_remote_device *idev = sci_object_get_association(sci_dev);
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),
- parent.parent);
+ parent);
struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
struct isci_host *ihost = sci_object_get_association(scic);
struct isci_remote_device *idev = sci_object_get_association(sci_dev);
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),
- parent.parent);
+ parent);
struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
struct isci_host *ihost = sci_object_get_association(scic);
struct isci_remote_device *idev = sci_object_get_association(sci_dev);
struct sci_base_object *object)
{
struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
- parent.parent);
+ parent);
if (sci_dev->has_ready_substate_machine)
sci_base_state_machine_stop(&sci_dev->ready_substate_machine);
else {
sci_dev->owning_port = sci_port;
sci_dev->started_request_count = 0;
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,
- 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(
#ifndef _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
- * struct scic_sds_remote_device object.
+ * enum scic_sds_remote_device_states - This enumeration depicts all the states
+ * 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"
-#include "scu_remote_node_context.h"
-#include "scic_sds_remote_node_context.h"
+ /**
+ * 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,
-struct scic_sds_controller;
-struct scic_sds_port;
-struct scic_sds_request;
-struct scic_sds_remote_device_state_handler;
+ /**
+ * 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,
+};
/**
* enum scic_sds_ssp_remote_device_ready_substates -
*/
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
- * the RCN data structure to tell the SCU how many open connections this
- * device can have.
+ * This field is the programmed device port width. This value is
+ * written to the RCN data structure to tell the SCU how many open
+ * connections this device can have.
*/
u32 device_port_width;
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)(
struct scic_sds_remote_device *this_device);
*
*/
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_resume_handler_t resume_handler;
scic_sds_remote_device_event_handler_t event_handler;
void scic_sds_remote_device_continue_request(void *sci_dev);
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(
- struct sci_base_remote_device *this_device);
+ struct scic_sds_remote_device *this_device);
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(
- struct sci_base_remote_device *device);
+ struct scic_sds_remote_device *device);
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(
- struct sci_base_remote_device *device,
+ struct scic_sds_remote_device *device,
struct scic_sds_request *request);
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);
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);
enum sci_status scic_sds_remote_device_default_suspend_handler(
u32 frame_index);
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(
- struct sci_base_remote_device *device);
+ struct scic_sds_remote_device *device);
enum sci_status scic_sds_remote_device_general_frame_handler(
struct scic_sds_remote_device *this_device,
* the idle state. enum sci_status
*/
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)
{
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? */
- status = this_device->owning_port->state_handlers->start_io_handler(
- this_device->owning_port, this_device, request);
+ status = device->owning_port->state_handlers->start_io_handler(
+ device->owning_port, device, request);
if (status == SCI_SUCCESS) {
- status =
- scic_sds_remote_node_context_start_io(this_device->rnc, request);
+ status = scic_sds_remote_node_context_start_io(
+ device->rnc, request);
if (status == SCI_SUCCESS)
status = scic_sds_request_start(request);
if (status == SCI_SUCCESS) {
- this_device->working_request = request;
+ device->working_request = request;
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_remote_device_start_request(this_device, request, status);
+ scic_sds_remote_device_start_request(device, request, status);
}
return status;
* until this one is complete. enum sci_status
*/
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)
{
return SCI_FAILURE_INVALID_STATE;
*
* enum sci_status
*/
-static enum sci_status scic_sds_smp_remote_device_ready_cmd_substate_complete_io_handler(
- struct sci_base_remote_device *device,
+static enum sci_status
+scic_sds_smp_remote_device_ready_cmd_substate_complete_io_handler(
+ struct scic_sds_remote_device *device,
struct scic_sds_request *request)
{
enum sci_status status;
- struct scic_sds_remote_device *this_device;
struct scic_sds_request *the_request;
- this_device = (struct scic_sds_remote_device *)device;
the_request = (struct scic_sds_request *)request;
status = scic_sds_io_request_complete(the_request);
if (status == SCI_SUCCESS) {
status = scic_sds_port_complete_io(
- this_device->owning_port, this_device, the_request);
+ device->owning_port, device, the_request);
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(
- &this_device->ready_substate_machine,
+ &device->ready_substate_machine,
SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE
);
} else
- dev_err(scirdev_to_dev(this_device),
+ dev_err(scirdev_to_dev(device),
"%s: SCIC SDS Remote Device 0x%p io request "
"0x%p could not be completd on the port 0x%p "
"failed with status %d.\n",
__func__,
- this_device,
+ device,
the_request,
- this_device->owning_port,
+ device->owning_port,
status);
}
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] = {
- .parent.start_handler = scic_sds_remote_device_default_start_handler,
- .parent.stop_handler = scic_sds_remote_device_ready_state_stop_handler,
- .parent.fail_handler = scic_sds_remote_device_default_fail_handler,
- .parent.destruct_handler = scic_sds_remote_device_default_destruct_handler,
- .parent.reset_handler = scic_sds_remote_device_default_reset_handler,
- .parent.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,
- .parent.complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
- .parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
- .parent.start_task_handler = scic_sds_remote_device_default_start_request_handler,
- .parent.complete_task_handler = scic_sds_remote_device_default_complete_request_handler,
- .suspend_handler = scic_sds_remote_device_default_suspend_handler,
- .resume_handler = scic_sds_remote_device_default_resume_handler,
- .event_handler = scic_sds_remote_device_general_event_handler,
- .frame_handler = scic_sds_remote_device_default_frame_handler
+ .start_handler = scic_sds_remote_device_default_start_handler,
+ .stop_handler = scic_sds_remote_device_ready_state_stop_handler,
+ .fail_handler = scic_sds_remote_device_default_fail_handler,
+ .destruct_handler = scic_sds_remote_device_default_destruct_handler,
+ .reset_handler = scic_sds_remote_device_default_reset_handler,
+ .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+ .start_io_handler = scic_sds_smp_remote_device_ready_idle_substate_start_io_handler,
+ .complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
+ .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
+ .start_task_handler = scic_sds_remote_device_default_start_request_handler,
+ .complete_task_handler = scic_sds_remote_device_default_complete_request_handler,
+ .suspend_handler = scic_sds_remote_device_default_suspend_handler,
+ .resume_handler = scic_sds_remote_device_default_resume_handler,
+ .event_handler = scic_sds_remote_device_general_event_handler,
+ .frame_handler = scic_sds_remote_device_default_frame_handler
},
[SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD] = {
- .parent.start_handler = scic_sds_remote_device_default_start_handler,
- .parent.stop_handler = scic_sds_remote_device_ready_state_stop_handler,
- .parent.fail_handler = scic_sds_remote_device_default_fail_handler,
- .parent.destruct_handler = scic_sds_remote_device_default_destruct_handler,
- .parent.reset_handler = scic_sds_remote_device_default_reset_handler,
- .parent.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,
- .parent.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,
- .parent.start_task_handler = scic_sds_remote_device_default_start_request_handler,
- .parent.complete_task_handler = scic_sds_remote_device_default_complete_request_handler,
- .suspend_handler = scic_sds_remote_device_default_suspend_handler,
- .resume_handler = scic_sds_remote_device_default_resume_handler,
- .event_handler = scic_sds_remote_device_general_event_handler,
- .frame_handler = scic_sds_smp_remote_device_ready_cmd_substate_frame_handler
+ .start_handler = scic_sds_remote_device_default_start_handler,
+ .stop_handler = scic_sds_remote_device_ready_state_stop_handler,
+ .fail_handler = scic_sds_remote_device_default_fail_handler,
+ .destruct_handler = scic_sds_remote_device_default_destruct_handler,
+ .reset_handler = scic_sds_remote_device_default_reset_handler,
+ .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+ .start_io_handler = scic_sds_smp_remote_device_ready_cmd_substate_start_io_handler,
+ .complete_io_handler = scic_sds_smp_remote_device_ready_cmd_substate_complete_io_handler,
+ .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
+ .start_task_handler = scic_sds_remote_device_default_start_request_handler,
+ .complete_task_handler = scic_sds_remote_device_default_complete_request_handler,
+ .suspend_handler = scic_sds_remote_device_default_suspend_handler,
+ .resume_handler = scic_sds_remote_device_default_resume_handler,
+ .event_handler = scic_sds_remote_device_general_event_handler,
+ .frame_handler = scic_sds_smp_remote_device_ready_cmd_substate_frame_handler
}
};
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),
- parent.parent);
+ parent);
struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
struct isci_host *ihost = sci_object_get_association(scic);
struct isci_remote_device *idev = sci_object_get_association(sci_dev);
struct sci_base_object *object)
{
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 isci_host *ihost = sci_object_get_association(scic);
struct isci_remote_device *idev = sci_object_get_association(sci_dev);
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),
- parent.parent);
+ parent);
sci_dev->working_request = NULL;
}
* completed successfully.
*/
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_remote_device *this_device = (struct scic_sds_remote_device *)device;
enum sci_status status;
status = scic_sds_io_request_complete(request);
if (status == SCI_SUCCESS) {
status = scic_sds_port_complete_io(
- this_device->owning_port, this_device, request);
+ device->owning_port, device, request);
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) {
/*
* This request causes hardware error, device needs to be Lun Reset.
* can reach RNC state handler, these IOs will be completed by RNC with
* status of "DEVICE_RESET_REQUIRED", instead of "INVALID 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
);
- } 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(
- &this_device->ready_substate_machine,
+ &device->ready_substate_machine,
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE
);
}
}
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 "
"could not complete\n",
__func__,
- this_device->owning_port,
- this_device,
+ device->owning_port,
+ device,
request,
status);
* callback will be called.
*/
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)
{
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? */
- status = this_device->owning_port->state_handlers->start_io_handler(
- this_device->owning_port, this_device, request);
+ status = device->owning_port->state_handlers->start_io_handler(
+ device->owning_port, device, request);
if (status != SCI_SUCCESS)
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)
goto out;
* Note: If the remote device state is not IDLE this will replace
* the request that probably resulted in the task management request.
*/
- this_device->working_request = request;
- sci_base_state_machine_change_state(&this_device->ready_substate_machine,
+ device->working_request = request;
+ sci_base_state_machine_change_state(&device->ready_substate_machine,
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD);
/*
* remote node context state machine will take the correct action when
* 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);
- scic_sds_remote_node_context_resume(this_device->rnc,
+ scic_sds_remote_node_context_resume(device->rnc,
scic_sds_remote_device_continue_request,
- this_device);
+ device);
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
* post TC yet. We will provide a callback function to post TC when RNC gets
* enum sci_status
*/
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)
{
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 *)sci_object_get_association(request);
/* Will the port allow the io request to start? */
- status = device->owning_port->state_handlers->start_io_handler(
- device->owning_port, device, request);
+ status = sci_dev->owning_port->state_handlers->start_io_handler(
+ sci_dev->owning_port, sci_dev, request);
if (status != SCI_SUCCESS)
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)
goto out;
goto out;
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);
} else {
- device->working_request = request;
- sci_base_state_machine_change_state(&device->ready_substate_machine,
+ sci_dev->working_request = request;
+ sci_base_state_machine_change_state(&sci_dev->ready_substate_machine,
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD);
}
out:
- scic_sds_remote_device_start_request(device, request, status);
+ scic_sds_remote_device_start_request(sci_dev, request, status);
return status;
}
* ***************************************************************************** */
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)
{
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 *)sci_object_get_association(request);
if (isci_sata_get_sat_protocol(isci_request) == SAT_PROTOCOL_FPDMA) {
- status = device->owning_port->state_handlers->start_io_handler(
- device->owning_port,
- device,
+ status = sci_dev->owning_port->state_handlers->start_io_handler(
+ sci_dev->owning_port,
+ sci_dev,
request);
if (status == SCI_SUCCESS) {
status = scic_sds_remote_node_context_start_io(
- device->rnc,
+ sci_dev->rnc,
request);
if (status == SCI_SUCCESS)
status = request->state_handlers->start_handler(request);
- scic_sds_remote_device_start_request(device,
+ scic_sds_remote_device_start_request(sci_dev,
request,
status);
}
* enum sci_status
*/
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)
{
return SCI_FAILURE_INVALID_STATE;
* * STP REMOTE DEVICE READY AWAIT RESET SUBSTATE HANDLERS
* ***************************************************************************** */
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)
{
return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED;
* completed successfully.
*/
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_remote_device *this_device = (struct scic_sds_remote_device *)device;
struct scic_sds_request *the_request = (struct scic_sds_request *)request;
enum sci_status status;
if (status == SCI_SUCCESS) {
status = scic_sds_port_complete_io(
- this_device->owning_port, this_device, the_request
+ device->owning_port, device, the_request
);
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)
- 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 "
"could not complete\n",
__func__,
- this_device->owning_port,
- this_device,
+ device->owning_port,
+ device,
the_request,
status);
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] = {
- .parent.start_handler = scic_sds_remote_device_default_start_handler,
- .parent.stop_handler = scic_sds_remote_device_ready_state_stop_handler,
- .parent.fail_handler = scic_sds_remote_device_default_fail_handler,
- .parent.destruct_handler = scic_sds_remote_device_default_destruct_handler,
- .parent.reset_handler = scic_sds_remote_device_ready_state_reset_handler,
- .parent.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,
- .parent.complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
- .parent.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,
- .parent.complete_task_handler = scic_sds_remote_device_default_complete_request_handler,
+ .start_handler = scic_sds_remote_device_default_start_handler,
+ .stop_handler = scic_sds_remote_device_ready_state_stop_handler,
+ .fail_handler = scic_sds_remote_device_default_fail_handler,
+ .destruct_handler = scic_sds_remote_device_default_destruct_handler,
+ .reset_handler = scic_sds_remote_device_ready_state_reset_handler,
+ .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+ .start_io_handler = scic_sds_stp_remote_device_ready_idle_substate_start_io_handler,
+ .complete_io_handler = scic_sds_remote_device_default_complete_request_handler,
+ .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
+ .start_task_handler = scic_sds_stp_remote_device_ready_substate_start_request_handler,
+ .complete_task_handler = scic_sds_remote_device_default_complete_request_handler,
.suspend_handler = scic_sds_remote_device_default_suspend_handler,
.resume_handler = scic_sds_remote_device_default_resume_handler,
.event_handler = scic_sds_stp_remote_device_ready_idle_substate_event_handler,
.frame_handler = scic_sds_remote_device_default_frame_handler
},
[SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD] = {
- .parent.start_handler = scic_sds_remote_device_default_start_handler,
- .parent.stop_handler = scic_sds_remote_device_ready_state_stop_handler,
- .parent.fail_handler = scic_sds_remote_device_default_fail_handler,
- .parent.destruct_handler = scic_sds_remote_device_default_destruct_handler,
- .parent.reset_handler = scic_sds_remote_device_ready_state_reset_handler,
- .parent.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,
- .parent.complete_io_handler = scic_sds_stp_remote_device_complete_request,
- .parent.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,
- .parent.complete_task_handler = scic_sds_stp_remote_device_complete_request,
+ .start_handler = scic_sds_remote_device_default_start_handler,
+ .stop_handler = scic_sds_remote_device_ready_state_stop_handler,
+ .fail_handler = scic_sds_remote_device_default_fail_handler,
+ .destruct_handler = scic_sds_remote_device_default_destruct_handler,
+ .reset_handler = scic_sds_remote_device_ready_state_reset_handler,
+ .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+ .start_io_handler = scic_sds_stp_remote_device_ready_cmd_substate_start_io_handler,
+ .complete_io_handler = scic_sds_stp_remote_device_complete_request,
+ .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
+ .start_task_handler = scic_sds_stp_remote_device_ready_substate_start_request_handler,
+ .complete_task_handler = scic_sds_stp_remote_device_complete_request,
.suspend_handler = scic_sds_stp_remote_device_ready_cmd_substate_suspend_handler,
.resume_handler = scic_sds_remote_device_default_resume_handler,
.event_handler = scic_sds_remote_device_general_event_handler,
.frame_handler = scic_sds_stp_remote_device_ready_cmd_substate_frame_handler
},
[SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ] = {
- .parent.start_handler = scic_sds_remote_device_default_start_handler,
- .parent.stop_handler = scic_sds_remote_device_ready_state_stop_handler,
- .parent.fail_handler = scic_sds_remote_device_default_fail_handler,
- .parent.destruct_handler = scic_sds_remote_device_default_destruct_handler,
- .parent.reset_handler = scic_sds_remote_device_ready_state_reset_handler,
- .parent.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,
- .parent.complete_io_handler = scic_sds_stp_remote_device_complete_request,
- .parent.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,
- .parent.complete_task_handler = scic_sds_stp_remote_device_complete_request,
+ .start_handler = scic_sds_remote_device_default_start_handler,
+ .stop_handler = scic_sds_remote_device_ready_state_stop_handler,
+ .fail_handler = scic_sds_remote_device_default_fail_handler,
+ .destruct_handler = scic_sds_remote_device_default_destruct_handler,
+ .reset_handler = scic_sds_remote_device_ready_state_reset_handler,
+ .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+ .start_io_handler = scic_sds_stp_remote_device_ready_ncq_substate_start_io_handler,
+ .complete_io_handler = scic_sds_stp_remote_device_complete_request,
+ .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
+ .start_task_handler = scic_sds_stp_remote_device_ready_substate_start_request_handler,
+ .complete_task_handler = scic_sds_stp_remote_device_complete_request,
.suspend_handler = scic_sds_remote_device_default_suspend_handler,
.resume_handler = scic_sds_remote_device_default_resume_handler,
.event_handler = scic_sds_remote_device_general_event_handler,
.frame_handler = scic_sds_stp_remote_device_ready_ncq_substate_frame_handler
},
[SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR] = {
- .parent.start_handler = scic_sds_remote_device_default_start_handler,
- .parent.stop_handler = scic_sds_remote_device_ready_state_stop_handler,
- .parent.fail_handler = scic_sds_remote_device_default_fail_handler,
- .parent.destruct_handler = scic_sds_remote_device_default_destruct_handler,
- .parent.reset_handler = scic_sds_remote_device_ready_state_reset_handler,
- .parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
- .parent.start_io_handler = scic_sds_remote_device_default_start_request_handler,
- .parent.complete_io_handler = scic_sds_stp_remote_device_complete_request,
- .parent.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,
- .parent.complete_task_handler = scic_sds_stp_remote_device_complete_request,
+ .start_handler = scic_sds_remote_device_default_start_handler,
+ .stop_handler = scic_sds_remote_device_ready_state_stop_handler,
+ .fail_handler = scic_sds_remote_device_default_fail_handler,
+ .destruct_handler = scic_sds_remote_device_default_destruct_handler,
+ .reset_handler = scic_sds_remote_device_ready_state_reset_handler,
+ .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+ .start_io_handler = scic_sds_remote_device_default_start_request_handler,
+ .complete_io_handler = scic_sds_stp_remote_device_complete_request,
+ .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
+ .start_task_handler = scic_sds_stp_remote_device_ready_substate_start_request_handler,
+ .complete_task_handler = scic_sds_stp_remote_device_complete_request,
.suspend_handler = scic_sds_remote_device_default_suspend_handler,
.resume_handler = scic_sds_remote_device_default_resume_handler,
.event_handler = scic_sds_remote_device_general_event_handler,
},
#if !defined(DISABLE_ATAPI)
[SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_ATAPI_ERROR] = {
- .parent.start_handler = scic_sds_remote_device_default_start_handler,
- .parent.stop_handler = scic_sds_remote_device_ready_state_stop_handler,
- .parent.fail_handler = scic_sds_remote_device_default_fail_handler,
- .parent.destruct_handler = scic_sds_remote_device_default_destruct_handler,
- .parent.reset_handler = scic_sds_remote_device_ready_state_reset_handler,
- .parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
- .parent.start_io_handler = scic_sds_remote_device_default_start_request_handler,
- .parent.complete_io_handler = scic_sds_stp_remote_device_complete_request,
- .parent.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,
- .parent.complete_task_handler = scic_sds_stp_remote_device_complete_request,
+ .start_handler = scic_sds_remote_device_default_start_handler,
+ .stop_handler = scic_sds_remote_device_ready_state_stop_handler,
+ .fail_handler = scic_sds_remote_device_default_fail_handler,
+ .destruct_handler = scic_sds_remote_device_default_destruct_handler,
+ .reset_handler = scic_sds_remote_device_ready_state_reset_handler,
+ .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+ .start_io_handler = scic_sds_remote_device_default_start_request_handler,
+ .complete_io_handler = scic_sds_stp_remote_device_complete_request,
+ .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
+ .start_task_handler = scic_sds_stp_remote_device_ready_substate_start_request_handler,
+ .complete_task_handler = scic_sds_stp_remote_device_complete_request,
.suspend_handler = scic_sds_remote_device_default_suspend_handler,
.resume_handler = scic_sds_remote_device_default_resume_handler,
.event_handler = scic_sds_stp_remote_device_ready_atapi_error_substate_event_handler,
},
#endif
[SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET] = {
- .parent.start_handler = scic_sds_remote_device_default_start_handler,
- .parent.stop_handler = scic_sds_remote_device_ready_state_stop_handler,
- .parent.fail_handler = scic_sds_remote_device_default_fail_handler,
- .parent.destruct_handler = scic_sds_remote_device_default_destruct_handler,
- .parent.reset_handler = scic_sds_remote_device_ready_state_reset_handler,
- .parent.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,
- .parent.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,
- .parent.start_task_handler = scic_sds_stp_remote_device_ready_substate_start_request_handler,
- .parent.complete_task_handler = scic_sds_stp_remote_device_complete_request,
+ .start_handler = scic_sds_remote_device_default_start_handler,
+ .stop_handler = scic_sds_remote_device_ready_state_stop_handler,
+ .fail_handler = scic_sds_remote_device_default_fail_handler,
+ .destruct_handler = scic_sds_remote_device_default_destruct_handler,
+ .reset_handler = scic_sds_remote_device_ready_state_reset_handler,
+ .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
+ .start_io_handler = scic_sds_stp_remote_device_ready_await_reset_substate_start_io_handler,
+ .complete_io_handler = scic_sds_stp_remote_device_ready_await_reset_substate_complete_request_handler,
+ .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
+ .start_task_handler = scic_sds_stp_remote_device_ready_substate_start_request_handler,
+ .complete_task_handler = scic_sds_stp_remote_device_complete_request,
.suspend_handler = scic_sds_remote_device_default_suspend_handler,
.resume_handler = scic_sds_remote_device_default_resume_handler,
.event_handler = scic_sds_remote_device_general_event_handler,
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),
- parent.parent);
+ parent);
struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
struct isci_host *ihost = sci_object_get_association(scic);
struct isci_remote_device *idev = sci_object_get_association(sci_dev);
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),
- parent.parent);
+ parent);
SET_STATE_HANDLER(sci_dev,
scic_sds_stp_remote_device_ready_substate_handler_table,
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ);
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),
- parent.parent);
+ parent);
struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
struct isci_host *ihost = sci_object_get_association(scic);
struct isci_remote_device *idev = sci_object_get_association(sci_dev);