提交 35173d57 编写于 作者: D Dan Williams

isci: namespacecheck cleanups

* mark needlessly global routines static
* delete unused functions
* move kernel-doc blocks from header files to source
* reorder some functions to delete declarations
* more default handler cleanups phy
Signed-off-by: NDan Williams <dan.j.williams@intel.com>
上级 068b2c03
......@@ -188,16 +188,4 @@ struct sci_base_port_state_handler {
SCI_BASE_PORT_PHY_HANDLER_T remove_phy_handler;
};
/**
* sci_base_port_construct() - Construct the base port object
* @this_port: This parameter specifies the base port to be constructed.
* @state_table: This parameter specifies the table of state definitions to be
* utilized for the domain state machine.
*
*/
void sci_base_port_construct(
struct sci_base_port *this_port,
const struct sci_base_state *state_table);
#endif /* _SCI_BASE_PORT_H_ */
......@@ -260,19 +260,6 @@ enum sci_status scic_user_parameters_set(
struct scic_sds_controller *controller,
union scic_user_parameters *user_parameters);
/**
* scic_user_parameters_get() - This method allows the user to retrieve the
* user parameters utilized by the controller.
* @controller: This parameter specifies the controller on which to set the
* user parameters.
* @user_parameters: This parameter specifies the USER_PARAMETERS object into
* which the framework shall save it's parameters.
*
*/
void scic_user_parameters_get(
struct scic_sds_controller *controller,
union scic_user_parameters *user_parameters);
/**
* scic_oem_parameters_set() - This method allows the user to attempt to change
* the OEM parameters utilized by the controller.
......
......@@ -325,7 +325,7 @@ enum sci_status scic_io_request_construct(
struct scic_sds_remote_device *scic_remote_device,
u16 io_tag,
void *user_io_request_object,
void *scic_io_request_memory,
struct scic_sds_request *scic_io_request_memory,
struct scic_sds_request **new_scic_io_request_handle);
/**
......
......@@ -56,14 +56,6 @@
#ifndef _SCIC_PORT_H_
#define _SCIC_PORT_H_
/**
* This file contains all of the interface methods that can be called by an SCI
* Core user on a SAS or SATA port.
*
*
*/
#include "sci_status.h"
#include "intel_sas.h"
......@@ -78,118 +70,28 @@ enum SCIC_PORT_NOT_READY_REASON_CODE {
SCIC_PORT_NOT_READY_REASON_CODE_MAX
};
/**
* struct scic_port_end_point_properties - This structure defines the
* properties that can be retrieved for each end-point local or remote
* (attached) port in the controller.
*
*
*/
struct scic_port_end_point_properties {
/**
* This field indicates the SAS address for the associated end
* point in the port.
*/
struct sci_sas_address sas_address;
/**
* This field indicates the protocols supported by the associated
* end-point in the port.
*/
struct sci_sas_identify_address_frame_protocols protocols;
};
/**
* struct scic_port_properties - This structure defines the properties that can
* be retrieved for each port in the controller.
*
*
*/
struct scic_port_properties {
/**
* This field specifies the logical index of the port (0 relative).
*/
u32 index;
/**
* This field indicates the local end-point properties for port.
*/
struct scic_port_end_point_properties local;
/**
* This field indicates the remote (attached) end-point properties
* for the port.
*/
struct scic_port_end_point_properties remote;
/**
* This field specifies the phys contained inside the port.
*/
u32 phy_mask;
};
/**
* scic_port_get_properties() - This method simply returns the properties
* regarding the port, such as: physical index, protocols, sas address, etc.
* @port: this parameter specifies the port for which to retrieve the physical
* index.
* @properties: This parameter specifies the properties structure into which to
* copy the requested information.
*
* Indicate if the user specified a valid port. SCI_SUCCESS This value is
* returned if the specified port was valid. SCI_FAILURE_INVALID_PORT This
* value is returned if the specified port is not valid. When this value is
* returned, no data is copied to the properties output parameter.
*/
enum sci_status scic_port_get_properties(
struct scic_sds_port *port,
struct scic_port_properties *properties);
/**
* scic_port_stop() - This method will make the port no longer ready for
* operation. After invoking this method IO operation is not possible.
* @port: This parameter specifies the port to be stopped.
*
* Indicate if the port was successfully stopped. SCI_SUCCESS This value is
* returned if the port was successfully stopped. SCI_WARNING_ALREADY_IN_STATE
* This value is returned if the port is already stopped or in the process of
* stopping. SCI_FAILURE_INVALID_PORT This value is returned if the supplied
* port is not valid. SCI_FAILURE_INVALID_STATE This value is returned if a
* stop operation can't be completed due to the state of port.
*/
enum sci_status scic_port_stop(
struct scic_sds_port *port);
/**
* scic_port_hard_reset() - This method will request the SCI implementation to
* perform a HARD RESET on the SAS Port. If/When the HARD RESET completes
* the SCI user will be notified via an SCI OS callback indicating a direct
* attached device was found.
* @port: a handle corresponding to the SAS port to be hard reset.
* @reset_timeout: This parameter specifies the number of milliseconds in which
* the port reset operation should complete.
*
* The SCI User callback in SCIC_USER_CALLBACKS_T will only be called once for
* each phy in the SAS Port at completion of the hard reset sequence. Return a
* status indicating whether the hard reset started successfully. SCI_SUCCESS
* This value is returned if the hard reset operation started successfully.
*/
enum sci_status scic_port_hard_reset(
struct scic_sds_port *port,
u32 reset_timeout);
/**
* scic_port_enable_broadcast_change_notification() - This API method enables
* the broadcast change notification from underneath hardware.
* @port: The port upon which broadcast change notifications (BCN) are to be
* enabled.
*
*/
void scic_port_enable_broadcast_change_notification(
struct scic_sds_port *port);
#endif /* _SCIC_PORT_H_ */
......@@ -402,7 +402,6 @@ struct scic_sds_controller_state_handler {
extern const struct scic_sds_controller_state_handler
scic_sds_controller_state_handler_table[];
extern const struct sci_base_state scic_sds_controller_state_table[];
/**
* INCREMENT_QUEUE_GET() -
......@@ -535,7 +534,6 @@ extern const struct sci_base_state scic_sds_controller_state_table[];
/* --------------------------------------------------------------------------- */
u32 scic_sds_controller_get_object_size(void);
/* --------------------------------------------------------------------------- */
......@@ -615,8 +613,6 @@ void scic_sds_controller_link_down(
* * CORE CONTROLLER REMOTE DEVICE MESSAGE PROCESSING
* ***************************************************************************** */
bool scic_sds_controller_has_remote_devices_stopping(
struct scic_sds_controller *this_controller);
void scic_sds_controller_remote_device_started(
struct scic_sds_controller *this_controller,
......@@ -626,67 +622,11 @@ void scic_sds_controller_remote_device_stopped(
struct scic_sds_controller *this_controller,
struct scic_sds_remote_device *the_device);
/*
* *****************************************************************************
* * CORE CONTROLLER PRIVATE METHODS
* ***************************************************************************** */
enum sci_status scic_sds_controller_validate_memory_descriptor_table(
struct scic_sds_controller *this_controller);
void scic_sds_controller_ram_initialization(
struct scic_sds_controller *this_controller);
void scic_sds_controller_assign_task_entries(
struct scic_sds_controller *this_controller);
void scic_sds_controller_afe_initialization(
struct scic_sds_controller *this_controller);
void scic_sds_controller_enable_port_task_scheduler(
struct scic_sds_controller *this_controller);
void scic_sds_controller_initialize_completion_queue(
struct scic_sds_controller *this_controller);
void scic_sds_controller_initialize_unsolicited_frame_queue(
struct scic_sds_controller *this_controller);
void scic_sds_controller_phy_timer_stop(
struct scic_sds_controller *this_controller);
enum sci_status scic_sds_controller_start_next_phy(
struct scic_sds_controller *this_controller);
enum sci_status scic_sds_controller_stop_phys(
struct scic_sds_controller *this_controller);
enum sci_status scic_sds_controller_stop_ports(
struct scic_sds_controller *this_controller);
enum sci_status scic_sds_controller_stop_devices(
struct scic_sds_controller *this_controller);
void scic_sds_controller_copy_task_context(
struct scic_sds_controller *this_controller,
struct scic_sds_request *this_request);
void scic_sds_controller_timeout_handler(void *controller);
void scic_sds_controller_initialize_power_control(
struct scic_sds_controller *this_controller);
void scic_sds_controller_register_setup(
struct scic_sds_controller *this_controller);
void scic_sds_controller_reset_hardware(
struct scic_sds_controller *this_controller);
enum sci_status scic_sds_controller_initialize_phy_startup(
struct scic_sds_controller *this_controller);
void scic_sds_controller_build_memory_descriptor_table(
struct scic_sds_controller *this_controller);
#endif /* _SCIC_SDS_CONTROLLER_H_ */
......@@ -257,7 +257,7 @@ scic_sds_phy_link_layer_initialization(struct scic_sds_phy *sci_phy,
* restart the starting substate machine since we dont know what has actually
* happening.
*/
void scic_sds_phy_sata_timeout(void *phy)
static void scic_sds_phy_sata_timeout(void *phy)
{
struct scic_sds_phy *sci_phy = phy;
......@@ -273,47 +273,6 @@ void scic_sds_phy_sata_timeout(void *phy)
SCI_BASE_PHY_STATE_STARTING);
}
/**
* This method will construct the struct scic_sds_phy object
* @this_phy:
* @owning_port:
* @phy_index:
*
*/
void scic_sds_phy_construct(
struct scic_sds_phy *this_phy,
struct scic_sds_port *owning_port,
u8 phy_index)
{
/*
* Call the base constructor first
*/
sci_base_phy_construct(
&this_phy->parent,
scic_sds_phy_state_table
);
/* Copy the rest of the input data to our locals */
this_phy->owning_port = owning_port;
this_phy->phy_index = phy_index;
this_phy->bcn_received_while_port_unassigned = false;
this_phy->protocol = SCIC_SDS_PHY_PROTOCOL_UNKNOWN;
this_phy->link_layer_registers = NULL;
this_phy->max_negotiated_speed = SCI_SAS_NO_LINK_RATE;
this_phy->sata_timeout_timer = NULL;
/* Clear out the identification buffer data */
memset(&this_phy->phy_type, 0, sizeof(this_phy->phy_type));
/* Initialize the the substate machines */
sci_base_state_machine_construct(
&this_phy->starting_substate_machine,
&this_phy->parent.parent,
scic_sds_phy_starting_substates,
SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL
);
}
/**
* This method returns the port currently containing this phy. If the phy is
* currently contained by the dummy port, then the phy is considered to not
......@@ -426,7 +385,7 @@ void scic_sds_phy_setup_transport(
* This function will perform the register reads/writes to suspend the SCU
* hardware protocol engine. none
*/
void scic_sds_phy_suspend(
static void scic_sds_phy_suspend(
struct scic_sds_phy *this_phy)
{
u32 scu_sas_pcfg_value;
......@@ -1416,7 +1375,62 @@ static enum sci_status scic_sds_phy_starting_substate_await_sata_power_consume_p
return SCI_SUCCESS;
}
const struct scic_sds_phy_state_handler scic_sds_phy_starting_substate_handler_table[] = {
static enum sci_status default_phy_handler(struct sci_base_phy *base_phy, const char *func)
{
struct scic_sds_phy *sci_phy;
sci_phy = container_of(base_phy, typeof(*sci_phy), parent);
dev_dbg(sciphy_to_dev(sci_phy),
"%s: in wrong state: %d\n", func,
sci_base_state_machine_get_state(&base_phy->state_machine));
return SCI_FAILURE_INVALID_STATE;
}
static enum sci_status scic_sds_phy_default_start_handler(struct sci_base_phy *base_phy)
{
return default_phy_handler(base_phy, __func__);
}
static enum sci_status scic_sds_phy_default_stop_handler(struct sci_base_phy *base_phy)
{
return default_phy_handler(base_phy, __func__);
}
static enum sci_status scic_sds_phy_default_reset_handler(struct sci_base_phy *base_phy)
{
return default_phy_handler(base_phy, __func__);
}
static enum sci_status scic_sds_phy_default_destroy_handler(struct sci_base_phy *base_phy)
{
return default_phy_handler(base_phy, __func__);
}
static enum sci_status scic_sds_phy_default_frame_handler(struct scic_sds_phy *sci_phy,
u32 frame_index)
{
struct scic_sds_controller *scic = scic_sds_phy_get_controller(sci_phy);
default_phy_handler(&sci_phy->parent, __func__);
scic_sds_controller_release_frame(scic, frame_index);
return SCI_FAILURE_INVALID_STATE;
}
static enum sci_status scic_sds_phy_default_event_handler(struct scic_sds_phy *sci_phy,
u32 event_code)
{
return default_phy_handler(&sci_phy->parent, __func__);
}
static enum sci_status scic_sds_phy_default_consume_power_handler(struct scic_sds_phy *sci_phy)
{
return default_phy_handler(&sci_phy->parent, __func__);
}
static const struct scic_sds_phy_state_handler scic_sds_phy_starting_substate_handler_table[] = {
[SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL] = {
.parent.start_handler = scic_sds_phy_default_start_handler,
.parent.stop_handler = scic_sds_phy_starting_substate_general_stop_handler,
......@@ -1867,7 +1881,7 @@ static void scic_sds_phy_starting_final_substate_enter(struct sci_base_object *o
/* --------------------------------------------------------------------------- */
const struct sci_base_state scic_sds_phy_starting_substates[] = {
static const struct sci_base_state scic_sds_phy_starting_substates[] = {
[SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL] = {
.enter_state = scic_sds_phy_starting_initial_substate_enter,
},
......@@ -1905,196 +1919,6 @@ const struct sci_base_state scic_sds_phy_starting_substates[] = {
}
};
/*
* ***************************************************************************
* * DEFAULT HANDLERS
* *************************************************************************** */
/**
*
* @phy: This is the struct sci_base_phy object which is cast into a struct scic_sds_phy
* object.
*
* This is the default method for phy a start request. It will report a
* warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE
*/
enum sci_status scic_sds_phy_default_start_handler(
struct sci_base_phy *phy)
{
struct scic_sds_phy *this_phy;
this_phy = (struct scic_sds_phy *)phy;
dev_warn(sciphy_to_dev(this_phy),
"%s: SCIC Phy 0x%p requested to start from invalid "
"state %d\n",
__func__,
this_phy,
sci_base_state_machine_get_state(
&this_phy->parent.state_machine));
return SCI_FAILURE_INVALID_STATE;
}
/**
*
* @phy: This is the struct sci_base_phy object which is cast into a
* struct scic_sds_phy object.
*
* This is the default method for phy a stop request. It will report a warning
* and exit. enum sci_status SCI_FAILURE_INVALID_STATE
*/
enum sci_status scic_sds_phy_default_stop_handler(struct sci_base_phy *base_phy)
{
struct scic_sds_phy *sci_phy;
sci_phy = (struct scic_sds_phy *)base_phy;
dev_dbg(sciphy_to_dev(sci_phy),
"%s: SCIC Phy 0x%p requested to stop from invalid state %d\n",
__func__,
sci_phy,
sci_base_state_machine_get_state(
&sci_phy->parent.state_machine));
return SCI_FAILURE_INVALID_STATE;
}
/**
*
* @phy: This is the struct sci_base_phy object which is cast into a struct scic_sds_phy
* object.
*
* This is the default method for phy a reset request. It will report a
* warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE
*/
enum sci_status scic_sds_phy_default_reset_handler(
struct sci_base_phy *phy)
{
struct scic_sds_phy *this_phy;
this_phy = (struct scic_sds_phy *)phy;
dev_warn(sciphy_to_dev(this_phy),
"%s: SCIC Phy 0x%p requested to reset from invalid state "
"%d\n",
__func__,
this_phy,
sci_base_state_machine_get_state(
&this_phy->parent.state_machine));
return SCI_FAILURE_INVALID_STATE;
}
/**
*
* @phy: This is the struct sci_base_phy object which is cast into a struct scic_sds_phy
* object.
*
* This is the default method for phy a destruct request. It will report a
* warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE
*/
enum sci_status scic_sds_phy_default_destroy_handler(
struct sci_base_phy *phy)
{
struct scic_sds_phy *this_phy;
this_phy = (struct scic_sds_phy *)phy;
/* / @todo Implement something for the default */
dev_warn(sciphy_to_dev(this_phy),
"%s: SCIC Phy 0x%p requested to destroy from invalid "
"state %d\n",
__func__,
this_phy,
sci_base_state_machine_get_state(
&this_phy->parent.state_machine));
return SCI_FAILURE_INVALID_STATE;
}
/**
*
* @phy: This is the struct sci_base_phy object which is cast into a struct scic_sds_phy
* object.
* @frame_index: This is the frame index that was received from the SCU
* hardware.
*
* This is the default method for a phy frame handling request. It will report
* a warning, release the frame and exit. enum sci_status SCI_FAILURE_INVALID_STATE
*/
enum sci_status scic_sds_phy_default_frame_handler(
struct scic_sds_phy *this_phy,
u32 frame_index)
{
dev_warn(sciphy_to_dev(this_phy),
"%s: SCIC Phy 0x%p received unexpected frame data %d "
"while in state %d\n",
__func__,
this_phy,
frame_index,
sci_base_state_machine_get_state(
&this_phy->parent.state_machine));
scic_sds_controller_release_frame(
scic_sds_phy_get_controller(this_phy), frame_index);
return SCI_FAILURE_INVALID_STATE;
}
/**
*
* @phy: This is the struct sci_base_phy object which is cast into a struct scic_sds_phy
* object.
* @event_code: This is the event code that was received from the SCU hardware.
*
* This is the default method for a phy event handler. It will report a
* warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE
*/
enum sci_status scic_sds_phy_default_event_handler(
struct scic_sds_phy *this_phy,
u32 event_code)
{
dev_dbg(sciphy_to_dev(this_phy),
"%s: SCIC Phy 0x%p received unexpected event status %x "
"while in state %d\n",
__func__,
this_phy,
event_code,
sci_base_state_machine_get_state(
&this_phy->parent.state_machine));
return SCI_FAILURE_INVALID_STATE;
}
/**
*
* @phy: This is the struct sci_base_phy object which is cast into a struct scic_sds_phy
* object.
*
* This is the default method for a phy consume power handler. It will report
* a warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE
*/
enum sci_status scic_sds_phy_default_consume_power_handler(
struct scic_sds_phy *this_phy)
{
dev_warn(sciphy_to_dev(this_phy),
"%s: SCIC Phy 0x%p given unexpected permission to consume "
"power while in state %d\n",
__func__,
this_phy,
sci_base_state_machine_get_state(
&this_phy->parent.state_machine));
return SCI_FAILURE_INVALID_STATE;
}
/*
* ******************************************************************************
* * PHY STOPPED STATE HANDLERS
* ****************************************************************************** */
/**
*
* @phy: This is the struct sci_base_phy object which is cast into a
......@@ -2219,7 +2043,7 @@ static enum sci_status scic_sds_phy_resetting_state_event_handler(struct scic_sd
/* --------------------------------------------------------------------------- */
const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[] = {
static const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[] = {
[SCI_BASE_PHY_STATE_INITIAL] = {
.parent.start_handler = scic_sds_phy_default_start_handler,
.parent.stop_handler = scic_sds_phy_default_stop_handler,
......@@ -2563,7 +2387,7 @@ static void scic_sds_phy_final_state_enter(
/* --------------------------------------------------------------------------- */
const struct sci_base_state scic_sds_phy_state_table[] = {
static const struct sci_base_state scic_sds_phy_state_table[] = {
[SCI_BASE_PHY_STATE_INITIAL] = {
.enter_state = scic_sds_phy_initial_state_enter,
},
......@@ -2585,3 +2409,29 @@ const struct sci_base_state scic_sds_phy_state_table[] = {
},
};
void scic_sds_phy_construct(struct scic_sds_phy *sci_phy,
struct scic_sds_port *owning_port, u8 phy_index)
{
/*
* Call the base constructor first
*/
sci_base_phy_construct(&sci_phy->parent, scic_sds_phy_state_table);
/* Copy the rest of the input data to our locals */
sci_phy->owning_port = owning_port;
sci_phy->phy_index = phy_index;
sci_phy->bcn_received_while_port_unassigned = false;
sci_phy->protocol = SCIC_SDS_PHY_PROTOCOL_UNKNOWN;
sci_phy->link_layer_registers = NULL;
sci_phy->max_negotiated_speed = SCI_SAS_NO_LINK_RATE;
sci_phy->sata_timeout_timer = NULL;
/* Clear out the identification buffer data */
memset(&sci_phy->phy_type, 0, sizeof(sci_phy->phy_type));
/* Initialize the the substate machines */
sci_base_state_machine_construct(&sci_phy->starting_substate_machine,
&sci_phy->parent.parent,
scic_sds_phy_starting_substates,
SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL);
}
......@@ -293,12 +293,6 @@ struct scic_sds_phy_state_handler {
};
extern const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[];
extern const struct sci_base_state scic_sds_phy_state_table[];
extern const struct sci_base_state scic_sds_phy_starting_substates[];
extern const struct scic_sds_phy_state_handler scic_sds_phy_starting_substate_handler_table[];
/**
* scic_sds_phy_get_index() -
*
......@@ -362,12 +356,6 @@ enum sci_status scic_sds_phy_stop(
enum sci_status scic_sds_phy_reset(
struct scic_sds_phy *this_phy);
void scic_sds_phy_sata_timeout(
void *cookie);
void scic_sds_phy_suspend(
struct scic_sds_phy *this_phy);
void scic_sds_phy_resume(
struct scic_sds_phy *this_phy);
......@@ -402,27 +390,4 @@ void scic_sds_phy_get_attached_phy_protocols(
struct scic_sds_phy *this_phy,
struct sci_sas_identify_address_frame_protocols *protocols);
enum sci_status scic_sds_phy_default_start_handler(
struct sci_base_phy *phy);
enum sci_status scic_sds_phy_default_stop_handler(
struct sci_base_phy *phy);
enum sci_status scic_sds_phy_default_reset_handler(
struct sci_base_phy *phy);
enum sci_status scic_sds_phy_default_destroy_handler(
struct sci_base_phy *phy);
enum sci_status scic_sds_phy_default_frame_handler(
struct scic_sds_phy *phy,
u32 frame_index);
enum sci_status scic_sds_phy_default_event_handler(
struct scic_sds_phy *phy,
u32 evnet_code);
enum sci_status scic_sds_phy_default_consume_power_handler(
struct scic_sds_phy *phy);
#endif /* _SCIC_SDS_PHY_H_ */
......@@ -236,12 +236,6 @@ struct scic_sds_port_state_handler {
};
extern const struct sci_base_state scic_sds_port_state_table[];
extern const struct sci_base_state scic_sds_port_ready_substate_table[];
extern struct scic_sds_port_state_handler scic_sds_port_state_handler_table[];
extern struct scic_sds_port_state_handler scic_sds_port_ready_substate_handler_table[];
/**
* scic_sds_port_get_controller() -
*
......@@ -351,10 +345,6 @@ void scic_sds_port_setup_transports(
struct scic_sds_port *this_port,
u32 device_id);
void scic_sds_port_activate_phy(
struct scic_sds_port *this_port,
struct scic_sds_phy *phy,
bool do_notify_user);
void scic_sds_port_deactivate_phy(
struct scic_sds_port *this_port,
......@@ -363,10 +353,6 @@ void scic_sds_port_deactivate_phy(
void scic_sds_port_general_link_up_handler(
struct scic_sds_port *this_port,
struct scic_sds_phy *the_phy,
bool do_notify_user);
bool scic_sds_port_link_detected(
struct scic_sds_port *this_port,
......@@ -397,47 +383,19 @@ enum sci_status scic_sds_port_complete_io(
/* --------------------------------------------------------------------------- */
void scic_sds_port_update_viit_entry(
struct scic_sds_port *this_port);
/* --------------------------------------------------------------------------- */
enum sci_status scic_sds_port_default_start_handler(
struct sci_base_port *port);
enum sci_status scic_sds_port_default_destruct_handler(
struct sci_base_port *port);
enum sci_status scic_sds_port_default_reset_handler(
struct sci_base_port *port,
u32 timeout);
enum sci_status scic_sds_port_default_remove_phy_handler(
struct sci_base_port *port,
struct sci_base_phy *phy);
enum sci_status scic_sds_port_default_frame_handler(
struct scic_sds_port *port,
u32 frame_index);
enum sci_status scic_sds_port_default_event_handler(
struct scic_sds_port *port,
u32 event_code);
void scic_sds_port_default_link_up_handler(
struct scic_sds_port *this_port,
struct scic_sds_phy *phy);
void scic_sds_port_default_link_down_handler(
struct scic_sds_port *this_port,
struct scic_sds_phy *phy);
enum sci_status scic_sds_port_default_start_io_handler(
struct scic_sds_port *port,
struct scic_sds_remote_device *device,
struct scic_sds_request *io_request);
enum sci_sas_link_rate scic_sds_port_get_max_allowed_speed(
......@@ -451,12 +409,7 @@ bool scic_sds_port_is_valid_phy_assignment(
struct scic_sds_port *this_port,
u32 phy_index);
bool scic_sds_port_is_phy_mask_valid(
struct scic_sds_port *this_port,
u32 phy_mask);
u32 scic_sds_port_get_phys(
struct scic_sds_port *this_port);
void scic_sds_port_get_sas_address(
struct scic_sds_port *this_port,
......@@ -470,13 +423,7 @@ void scic_sds_port_get_attached_protocols(
struct scic_sds_port *this_port,
struct sci_sas_identify_address_frame_protocols *protocols);
enum sci_status scic_sds_port_set_phy(
struct scic_sds_port *port,
struct scic_sds_phy *phy);
enum sci_status scic_sds_port_clear_phy(
struct scic_sds_port *port,
struct scic_sds_phy *phy);
......
......@@ -87,30 +87,6 @@ u32 scic_remote_device_get_object_size(void)
+ sizeof(struct scic_sds_remote_node_context);
}
/* --------------------------------------------------------------------------- */
void scic_remote_device_construct(struct scic_sds_port *sci_port,
struct scic_sds_remote_device *sci_dev)
{
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_base_remote_device_construct(
&sci_dev->parent,
scic_sds_remote_device_state_table
);
scic_sds_remote_node_context_construct(
sci_dev,
sci_dev->rnc,
SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX
);
sci_object_set_association(sci_dev->rnc, sci_dev);
}
enum sci_status scic_remote_device_da_construct(
struct scic_sds_remote_device *sci_dev)
{
......@@ -1330,7 +1306,7 @@ static enum sci_status scic_sds_remote_device_resetting_state_complete_request_h
/* --------------------------------------------------------------------------- */
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] = {
.parent.start_handler = scic_sds_remote_device_default_start_handler,
.parent.stop_handler = scic_sds_remote_device_default_stop_handler,
......@@ -1741,7 +1717,7 @@ static void scic_sds_remote_device_final_state_enter(
/* --------------------------------------------------------------------------- */
const struct sci_base_state scic_sds_remote_device_state_table[] = {
static const struct sci_base_state scic_sds_remote_device_state_table[] = {
[SCI_BASE_REMOTE_DEVICE_STATE_INITIAL] = {
.enter_state = scic_sds_remote_device_initial_state_enter,
},
......@@ -1771,3 +1747,23 @@ const struct sci_base_state scic_sds_remote_device_state_table[] = {
},
};
void scic_remote_device_construct(struct scic_sds_port *sci_port,
struct scic_sds_remote_device *sci_dev)
{
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_base_remote_device_construct(
&sci_dev->parent,
scic_sds_remote_device_state_table
);
scic_sds_remote_node_context_construct(
sci_dev,
sci_dev->rnc,
SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX
);
sci_object_set_association(sci_dev->rnc, sci_dev);
}
......@@ -316,15 +316,10 @@ struct scic_sds_remote_device_state_handler {
scic_sds_remote_device_frame_handler_t frame_handler;
};
extern const struct sci_base_state scic_sds_remote_device_state_table[];
extern const struct sci_base_state scic_sds_ssp_remote_device_ready_substate_table[];
extern const struct sci_base_state scic_sds_stp_remote_device_ready_substate_table[];
extern const struct sci_base_state scic_sds_smp_remote_device_ready_substate_table[];
extern const struct scic_sds_remote_device_state_handler scic_sds_remote_device_state_handler_table[];
extern const struct scic_sds_remote_device_state_handler scic_sds_stp_remote_device_ready_substate_handler_table[];
extern const struct scic_sds_remote_device_state_handler scic_sds_smp_remote_device_ready_substate_handler_table[];
/**
* scic_sds_remote_device_increment_request_count() -
*
......
......@@ -64,26 +64,6 @@
#include "scu_event_codes.h"
#include "scu_task_context.h"
void scic_sds_remote_node_context_construct(
struct scic_sds_remote_device *device,
struct scic_sds_remote_node_context *rnc,
u16 remote_node_index)
{
memset(rnc, 0, sizeof(struct scic_sds_remote_node_context));
rnc->remote_node_index = remote_node_index;
rnc->device = device;
rnc->destination_state = SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_UNSPECIFIED;
sci_base_state_machine_construct(
&rnc->state_machine,
&rnc->parent,
scic_sds_remote_node_context_state_table,
SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE
);
sci_base_state_machine_start(&rnc->state_machine);
}
/**
*
......@@ -124,7 +104,7 @@ bool scic_sds_remote_node_context_is_ready(
*
* This method will construct the RNC buffer for this remote device object. none
*/
void scic_sds_remote_node_context_construct_buffer(
static void scic_sds_remote_node_context_construct_buffer(
struct scic_sds_remote_node_context *this_rnc)
{
union scu_remote_node_context *rnc;
......@@ -830,7 +810,7 @@ static enum sci_status scic_sds_remote_node_context_await_suspension_state_event
/* --------------------------------------------------------------------------- */
struct scic_sds_remote_node_context_handlers
static struct scic_sds_remote_node_context_handlers
scic_sds_remote_node_context_state_handler_table[
SCIC_SDS_REMOTE_NODE_CONTEXT_MAX_STATES] =
{
......@@ -1218,7 +1198,7 @@ static void scic_sds_remote_node_context_await_suspension_state_enter(
/* --------------------------------------------------------------------------- */
const struct sci_base_state scic_sds_remote_node_context_state_table[] = {
static const struct sci_base_state scic_sds_remote_node_context_state_table[] = {
[SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE] = {
.enter_state = scic_sds_remote_node_context_initial_state_enter,
},
......@@ -1245,3 +1225,23 @@ const struct sci_base_state scic_sds_remote_node_context_state_table[] = {
},
};
void scic_sds_remote_node_context_construct(
struct scic_sds_remote_device *device,
struct scic_sds_remote_node_context *rnc,
u16 remote_node_index)
{
memset(rnc, 0, sizeof(struct scic_sds_remote_node_context));
rnc->remote_node_index = remote_node_index;
rnc->device = device;
rnc->destination_state = SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_UNSPECIFIED;
sci_base_state_machine_construct(
&rnc->state_machine,
&rnc->parent,
scic_sds_remote_node_context_state_table,
SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE
);
sci_base_state_machine_start(&rnc->state_machine);
}
......@@ -279,19 +279,11 @@ struct scic_sds_remote_node_context {
struct scic_sds_remote_node_context_handlers *state_handlers;
};
extern const struct sci_base_state scic_sds_remote_node_context_state_table[];
extern struct scic_sds_remote_node_context_handlers
scic_sds_remote_node_context_state_handler_table[
SCIC_SDS_REMOTE_NODE_CONTEXT_MAX_STATES];
void scic_sds_remote_node_context_construct(
struct scic_sds_remote_device *device,
struct scic_sds_remote_node_context *rnc,
u16 remote_node_index);
void scic_sds_remote_node_context_construct_buffer(
struct scic_sds_remote_node_context *rnc);
bool scic_sds_remote_node_context_is_ready(
struct scic_sds_remote_node_context *this_rnc);
......
......@@ -325,59 +325,6 @@ void scic_sds_request_build_sgl(struct scic_sds_request *sds_request)
}
}
/**
* This method initializes common portions of the io request object. This
* includes construction of the struct sci_base_request parent.
* @the_controller: This parameter specifies the controller for which the
* request is being constructed.
* @the_target: This parameter specifies the remote device for which the
* request is being constructed.
* @io_tag: This parameter specifies the IO tag to be utilized for this
* request. This parameter can be set to SCI_CONTROLLER_INVALID_IO_TAG.
* @user_io_request_object: This parameter specifies the user request object
* for which the request is being constructed.
* @this_request: This parameter specifies the request being constructed.
*
*/
static void scic_sds_general_request_construct(
struct scic_sds_controller *the_controller,
struct scic_sds_remote_device *the_target,
u16 io_tag,
void *user_io_request_object,
struct scic_sds_request *this_request)
{
sci_base_request_construct(
&this_request->parent,
scic_sds_request_state_table
);
this_request->io_tag = io_tag;
this_request->user_request = user_io_request_object;
this_request->owning_controller = the_controller;
this_request->target_device = the_target;
this_request->has_started_substate_machine = false;
this_request->protocol = SCIC_NO_PROTOCOL;
this_request->saved_rx_frame_index = SCU_INVALID_FRAME_INDEX;
this_request->device_sequence = scic_sds_remote_device_get_sequence(the_target);
this_request->sci_status = SCI_SUCCESS;
this_request->scu_status = 0;
this_request->post_context = 0xFFFFFFFF;
this_request->is_task_management_request = false;
if (io_tag == SCI_CONTROLLER_INVALID_IO_TAG) {
this_request->was_tag_assigned_by_user = false;
this_request->task_context_buffer = NULL;
} else {
this_request->was_tag_assigned_by_user = true;
this_request->task_context_buffer =
scic_sds_controller_get_task_context_buffer(
this_request->owning_controller, io_tag);
}
}
/**
* This method build the remainder of the IO request object.
* @this_request: This parameter specifies the request object being constructed.
......@@ -754,16 +701,6 @@ static enum sci_status scic_io_request_construct_sata(struct scic_sds_request *s
return status;
}
/*
* ****************************************************************************
* * SCIC Interface Implementation
* **************************************************************************** */
/* --------------------------------------------------------------------------- */
u32 scic_io_request_get_object_size(void)
{
u32 ssp_request_size;
......@@ -777,128 +714,6 @@ u32 scic_io_request_get_object_size(void)
return max(ssp_request_size, max(stp_request_size, smp_request_size));
}
/* --------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------- */
enum sci_status scic_io_request_construct(
struct scic_sds_controller *scic_controller,
struct scic_sds_remote_device *scic_remote_device,
u16 io_tag,
void *user_io_request_object,
void *scic_io_request_memory,
struct scic_sds_request **new_scic_io_request_handle)
{
enum sci_status status = SCI_SUCCESS;
struct scic_sds_request *this_request;
struct smp_discover_response_protocols device_protocol;
this_request = (struct scic_sds_request *)scic_io_request_memory;
/* Build the common part of the request */
scic_sds_general_request_construct(
(struct scic_sds_controller *)scic_controller,
(struct scic_sds_remote_device *)scic_remote_device,
io_tag,
user_io_request_object,
this_request
);
if (
scic_sds_remote_device_get_index((struct scic_sds_remote_device *)scic_remote_device)
== SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX
) {
return SCI_FAILURE_INVALID_REMOTE_DEVICE;
}
scic_remote_device_get_protocols(scic_remote_device, &device_protocol);
if (device_protocol.u.bits.attached_ssp_target) {
scic_sds_ssp_io_request_assign_buffers(this_request);
} else if (device_protocol.u.bits.attached_stp_target) {
scic_sds_stp_request_assign_buffers(this_request);
memset(this_request->command_buffer, 0, sizeof(struct sata_fis_reg_h2d));
} else if (device_protocol.u.bits.attached_smp_target) {
scic_sds_smp_request_assign_buffers(this_request);
memset(this_request->command_buffer, 0, sizeof(struct smp_request));
} else {
status = SCI_FAILURE_UNSUPPORTED_PROTOCOL;
}
if (status == SCI_SUCCESS) {
memset(
this_request->task_context_buffer,
0,
SCI_FIELD_OFFSET(struct scu_task_context, sgl_pair_ab)
);
*new_scic_io_request_handle = scic_io_request_memory;
}
return status;
}
/* --------------------------------------------------------------------------- */
enum sci_status scic_task_request_construct(
struct scic_sds_controller *controller,
struct scic_sds_remote_device *remote_device,
u16 io_tag,
void *user_io_request_object,
void *scic_task_request_memory,
struct scic_sds_request **new_scic_task_request_handle)
{
enum sci_status status = SCI_SUCCESS;
struct scic_sds_request *this_request = (struct scic_sds_request *)
scic_task_request_memory;
struct smp_discover_response_protocols device_protocol;
/* Build the common part of the request */
scic_sds_general_request_construct(
(struct scic_sds_controller *)controller,
(struct scic_sds_remote_device *)remote_device,
io_tag,
user_io_request_object,
this_request
);
scic_remote_device_get_protocols(remote_device, &device_protocol);
if (device_protocol.u.bits.attached_ssp_target) {
scic_sds_ssp_task_request_assign_buffers(this_request);
this_request->has_started_substate_machine = true;
/* Construct the started sub-state machine. */
sci_base_state_machine_construct(
&this_request->started_substate_machine,
&this_request->parent.parent,
scic_sds_io_request_started_task_mgmt_substate_table,
SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_COMPLETION
);
} else if (device_protocol.u.bits.attached_stp_target) {
scic_sds_stp_request_assign_buffers(this_request);
} else {
status = SCI_FAILURE_UNSUPPORTED_PROTOCOL;
}
if (status == SCI_SUCCESS) {
this_request->is_task_management_request = true;
memset(this_request->task_context_buffer, 0x00, sizeof(struct scu_task_context));
*new_scic_task_request_handle = scic_task_request_memory;
}
return status;
}
enum sci_status scic_io_request_construct_basic_ssp(
struct scic_sds_request *sci_req)
{
......@@ -1915,9 +1730,7 @@ static enum sci_status scic_sds_request_aborting_state_frame_handler(
return SCI_SUCCESS;
}
/* --------------------------------------------------------------------------- */
const struct scic_sds_io_request_state_handler scic_sds_request_state_handler_table[] = {
static const struct scic_sds_io_request_state_handler scic_sds_request_state_handler_table[] = {
[SCI_BASE_REQUEST_STATE_INITIAL] = {
.parent.start_handler = scic_sds_request_default_start_handler,
.parent.abort_handler = scic_sds_request_default_abort_handler,
......@@ -2142,9 +1955,7 @@ static void scic_sds_request_final_state_enter(
);
}
/* --------------------------------------------------------------------------- */
const struct sci_base_state scic_sds_request_state_table[] = {
static const struct sci_base_state scic_sds_request_state_table[] = {
[SCI_BASE_REQUEST_STATE_INITIAL] = {
.enter_state = scic_sds_request_initial_state_enter,
},
......@@ -2166,3 +1977,119 @@ const struct sci_base_state scic_sds_request_state_table[] = {
},
};
static void scic_sds_general_request_construct(struct scic_sds_controller *scic,
struct scic_sds_remote_device *sci_dev,
u16 io_tag,
void *user_io_request_object,
struct scic_sds_request *sci_req)
{
sci_base_request_construct(&sci_req->parent, scic_sds_request_state_table);
sci_req->io_tag = io_tag;
sci_req->user_request = user_io_request_object;
sci_req->owning_controller = scic;
sci_req->target_device = sci_dev;
sci_req->has_started_substate_machine = false;
sci_req->protocol = SCIC_NO_PROTOCOL;
sci_req->saved_rx_frame_index = SCU_INVALID_FRAME_INDEX;
sci_req->device_sequence = scic_sds_remote_device_get_sequence(sci_dev);
sci_req->sci_status = SCI_SUCCESS;
sci_req->scu_status = 0;
sci_req->post_context = 0xFFFFFFFF;
sci_req->is_task_management_request = false;
if (io_tag == SCI_CONTROLLER_INVALID_IO_TAG) {
sci_req->was_tag_assigned_by_user = false;
sci_req->task_context_buffer = NULL;
} else {
sci_req->was_tag_assigned_by_user = true;
sci_req->task_context_buffer =
scic_sds_controller_get_task_context_buffer(scic, io_tag);
}
}
enum sci_status scic_io_request_construct(struct scic_sds_controller *scic,
struct scic_sds_remote_device *sci_dev,
u16 io_tag,
void *user_io_request_object,
struct scic_sds_request *sci_req,
struct scic_sds_request **new_scic_io_request_handle)
{
enum sci_status status = SCI_SUCCESS;
struct smp_discover_response_protocols device_protocol;
/* Build the common part of the request */
scic_sds_general_request_construct(scic, sci_dev, io_tag,
user_io_request_object, sci_req);
if (sci_dev->rnc->remote_node_index == SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX)
return SCI_FAILURE_INVALID_REMOTE_DEVICE;
scic_remote_device_get_protocols(sci_dev, &device_protocol);
if (device_protocol.u.bits.attached_ssp_target) {
scic_sds_ssp_io_request_assign_buffers(sci_req);
} else if (device_protocol.u.bits.attached_stp_target) {
scic_sds_stp_request_assign_buffers(sci_req);
memset(sci_req->command_buffer, 0, sizeof(struct sata_fis_reg_h2d));
} else if (device_protocol.u.bits.attached_smp_target) {
scic_sds_smp_request_assign_buffers(sci_req);
memset(sci_req->command_buffer, 0, sizeof(struct smp_request));
} else {
status = SCI_FAILURE_UNSUPPORTED_PROTOCOL;
}
if (status == SCI_SUCCESS) {
memset(sci_req->task_context_buffer, 0,
SCI_FIELD_OFFSET(struct scu_task_context, sgl_pair_ab));
*new_scic_io_request_handle = sci_req;
}
return status;
}
enum sci_status scic_task_request_construct(struct scic_sds_controller *scic,
struct scic_sds_remote_device *sci_dev,
u16 io_tag,
void *user_io_request_object,
struct scic_sds_request *sci_req,
struct scic_sds_request **new_sci_req)
{
enum sci_status status = SCI_SUCCESS;
struct smp_discover_response_protocols device_protocol;
/* Build the common part of the request */
scic_sds_general_request_construct(scic, sci_dev, io_tag,
user_io_request_object,
sci_req);
scic_remote_device_get_protocols(sci_dev, &device_protocol);
if (device_protocol.u.bits.attached_ssp_target) {
scic_sds_ssp_task_request_assign_buffers(sci_req);
sci_req->has_started_substate_machine = true;
/* Construct the started sub-state machine. */
sci_base_state_machine_construct(
&sci_req->started_substate_machine,
&sci_req->parent.parent,
scic_sds_io_request_started_task_mgmt_substate_table,
SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_COMPLETION
);
} else if (device_protocol.u.bits.attached_stp_target) {
scic_sds_stp_request_assign_buffers(sci_req);
} else {
status = SCI_FAILURE_UNSUPPORTED_PROTOCOL;
}
if (status == SCI_SUCCESS) {
sci_req->is_task_management_request = true;
memset(sci_req->task_context_buffer, 0, sizeof(struct scu_task_context));
*new_sci_req = sci_req;
}
return status;
}
......@@ -256,14 +256,7 @@ struct scic_sds_io_request_state_handler {
};
extern const struct sci_base_state scic_sds_request_state_table[];
extern const struct scic_sds_io_request_state_handler scic_sds_request_state_handler_table[];
extern const struct sci_base_state scic_sds_io_request_started_task_mgmt_substate_table[];
extern const struct scic_sds_io_request_state_handler scic_sds_ssp_task_request_started_substate_handler_table[];
extern const struct sci_base_state scic_sds_smp_request_started_substate_table[];
extern const struct scic_sds_io_request_state_handler scic_sds_smp_request_started_substate_handler_table[];
/**
*
......
......@@ -207,7 +207,7 @@ static enum sci_status scic_sds_smp_remote_device_ready_cmd_substate_frame_handl
/* --------------------------------------------------------------------------- */
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] = {
.parent.start_handler = scic_sds_remote_device_default_start_handler,
.parent.stop_handler = scic_sds_remote_device_ready_state_stop_handler,
......
......@@ -142,73 +142,6 @@ void scic_sds_smp_request_assign_buffers(
}
}
/**
* This method is called by the SCI user to build an SMP IO request.
*
* - The user must have previously called scic_io_request_construct() on the
* supplied IO request. Indicate if the controller successfully built the IO
* request. SCI_SUCCESS This value is returned if the IO request was
* successfully built. SCI_FAILURE_UNSUPPORTED_PROTOCOL This value is returned
* if the remote_device does not support the SMP protocol.
* SCI_FAILURE_INVALID_ASSOCIATION This value is returned if the user did not
* properly set the association between the SCIC IO request and the user's IO
* request. Please refer to the sci_object_set_association() routine for more
* information.
*/
enum sci_status scic_io_request_construct_smp(
struct scic_sds_request *sci_req)
{
struct smp_request *smp_req = kmalloc(sizeof(*smp_req), GFP_KERNEL);
if (!smp_req)
return SCI_FAILURE_INSUFFICIENT_RESOURCES;
sci_req->protocol = SCIC_SMP_PROTOCOL;
sci_req->has_started_substate_machine = true;
/* Construct the started sub-state machine. */
sci_base_state_machine_construct(
&sci_req->started_substate_machine,
&sci_req->parent.parent,
scic_sds_smp_request_started_substate_table,
SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_RESPONSE
);
/* Construct the SMP SCU Task Context */
memcpy(smp_req, sci_req->command_buffer, sizeof(*smp_req));
/*
* Look at the SMP requests' header fields; for certain SAS 1.x SMP
* functions under SAS 2.0, a zero request length really indicates
* a non-zero default length. */
if (smp_req->header.request_length == 0) {
switch (smp_req->header.function) {
case SMP_FUNCTION_DISCOVER:
case SMP_FUNCTION_REPORT_PHY_ERROR_LOG:
case SMP_FUNCTION_REPORT_PHY_SATA:
case SMP_FUNCTION_REPORT_ROUTE_INFORMATION:
smp_req->header.request_length = 2;
break;
case SMP_FUNCTION_CONFIGURE_ROUTE_INFORMATION:
case SMP_FUNCTION_PHY_CONTROL:
case SMP_FUNCTION_PHY_TEST:
smp_req->header.request_length = 9;
break;
/* Default - zero is a valid default for 2.0. */
}
}
scu_smp_request_construct_task_context(sci_req, smp_req);
sci_base_state_machine_change_state(
&sci_req->parent.state_machine,
SCI_BASE_REQUEST_STATE_CONSTRUCTED
);
kfree(smp_req);
return SCI_SUCCESS;
}
/**
* This method is called by the SCI user to build an SMP pass-through IO
......@@ -595,7 +528,7 @@ static enum sci_status scic_sds_smp_request_await_tc_completion_tc_completion_ha
}
const struct scic_sds_io_request_state_handler scic_sds_smp_request_started_substate_handler_table[] = {
static const struct scic_sds_io_request_state_handler scic_sds_smp_request_started_substate_handler_table[] = {
[SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_RESPONSE] = {
.parent.start_handler = scic_sds_request_default_start_handler,
.parent.abort_handler = scic_sds_request_started_state_abort_handler,
......@@ -658,7 +591,7 @@ static void scic_sds_smp_request_started_await_tc_completion_substate_enter(
);
}
const struct sci_base_state scic_sds_smp_request_started_substate_table[] = {
static const struct sci_base_state scic_sds_smp_request_started_substate_table[] = {
[SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_RESPONSE] = {
.enter_state = scic_sds_smp_request_started_await_response_substate_enter,
},
......@@ -667,3 +600,69 @@ const struct sci_base_state scic_sds_smp_request_started_substate_table[] = {
},
};
/**
* This method is called by the SCI user to build an SMP IO request.
*
* - The user must have previously called scic_io_request_construct() on the
* supplied IO request. Indicate if the controller successfully built the IO
* request. SCI_SUCCESS This value is returned if the IO request was
* successfully built. SCI_FAILURE_UNSUPPORTED_PROTOCOL This value is returned
* if the remote_device does not support the SMP protocol.
* SCI_FAILURE_INVALID_ASSOCIATION This value is returned if the user did not
* properly set the association between the SCIC IO request and the user's IO
* request. Please refer to the sci_object_set_association() routine for more
* information.
*/
enum sci_status scic_io_request_construct_smp(struct scic_sds_request *sci_req)
{
struct smp_request *smp_req = kmalloc(sizeof(*smp_req), GFP_KERNEL);
if (!smp_req)
return SCI_FAILURE_INSUFFICIENT_RESOURCES;
sci_req->protocol = SCIC_SMP_PROTOCOL;
sci_req->has_started_substate_machine = true;
/* Construct the started sub-state machine. */
sci_base_state_machine_construct(
&sci_req->started_substate_machine,
&sci_req->parent.parent,
scic_sds_smp_request_started_substate_table,
SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_RESPONSE
);
/* Construct the SMP SCU Task Context */
memcpy(smp_req, sci_req->command_buffer, sizeof(*smp_req));
/*
* Look at the SMP requests' header fields; for certain SAS 1.x SMP
* functions under SAS 2.0, a zero request length really indicates
* a non-zero default length. */
if (smp_req->header.request_length == 0) {
switch (smp_req->header.function) {
case SMP_FUNCTION_DISCOVER:
case SMP_FUNCTION_REPORT_PHY_ERROR_LOG:
case SMP_FUNCTION_REPORT_PHY_SATA:
case SMP_FUNCTION_REPORT_ROUTE_INFORMATION:
smp_req->header.request_length = 2;
break;
case SMP_FUNCTION_CONFIGURE_ROUTE_INFORMATION:
case SMP_FUNCTION_PHY_CONTROL:
case SMP_FUNCTION_PHY_TEST:
smp_req->header.request_length = 9;
break;
/* Default - zero is a valid default for 2.0. */
}
}
scu_smp_request_construct_task_context(sci_req, smp_req);
sci_base_state_machine_change_state(
&sci_req->parent.state_machine,
SCI_BASE_REQUEST_STATE_CONSTRUCTED
);
kfree(smp_req);
return SCI_SUCCESS;
}
......@@ -193,7 +193,7 @@ static enum sci_status scic_sds_ssp_task_request_await_tc_response_frame_handler
return SCI_SUCCESS;
}
const struct scic_sds_io_request_state_handler scic_sds_ssp_task_request_started_substate_handler_table[] = {
static const struct scic_sds_io_request_state_handler scic_sds_ssp_task_request_started_substate_handler_table[] = {
[SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_COMPLETION] = {
.parent.start_handler = scic_sds_request_default_start_handler,
.parent.abort_handler = scic_sds_request_started_state_abort_handler,
......
......@@ -99,18 +99,7 @@ enum _SCIC_SDS_STP_REQUEST_STARTED_PIO_SUBSTATES {
SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_OUT_TRANSMIT_DATA_SUBSTATE,
};
/* --------------------------------------------------------------------------- */
extern const struct scic_sds_io_request_state_handler scic_sds_stp_request_started_pio_substate_handler_table[];
extern const struct sci_base_state scic_sds_stp_request_started_pio_substate_table[];
/* --------------------------------------------------------------------------- */
struct scic_sds_stp_request;
struct scu_sgl_element *scic_sds_stp_request_pio_get_next_sgl(
struct scic_sds_stp_request *this_request);
#endif /* _SCIC_SDS_SATA_PIO_REQUEST_H_ */
......@@ -565,7 +565,7 @@ enum sci_status scic_sds_stp_remote_device_ready_atapi_error_substate_event_hand
/* --------------------------------------------------------------------------- */
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] = {
.parent.start_handler = scic_sds_remote_device_default_start_handler,
.parent.stop_handler = scic_sds_remote_device_ready_state_stop_handler,
......
......@@ -267,7 +267,7 @@ static void scu_sata_reqeust_construct_task_context(
* This method will perform any general sata request construction. What part of
* SATA IO request construction is general? none
*/
void scic_sds_stp_non_ncq_request_construct(
static void scic_sds_stp_non_ncq_request_construct(
struct scic_sds_request *this_request)
{
this_request->has_started_substate_machine = true;
......@@ -318,33 +318,6 @@ static void scic_sds_stp_optimized_request_construct(struct scic_sds_request *sc
}
}
/**
*
* @sci_req: This parameter specifies the request to be constructed.
*
* This method will construct the STP UDMA request and its associated TC data.
* This method returns an indication as to whether the construction was
* successful. SCI_SUCCESS Currently this method always returns this value.
*/
enum sci_status scic_sds_stp_udma_request_construct(struct scic_sds_request *sci_req,
u32 len,
enum dma_data_direction dir)
{
scic_sds_stp_non_ncq_request_construct(sci_req);
scic_sds_stp_optimized_request_construct(sci_req, SCU_TASK_TYPE_DMA_IN,
len, dir);
sci_base_state_machine_construct(
&sci_req->started_substate_machine,
&sci_req->parent.parent,
scic_sds_stp_request_started_udma_substate_table,
SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE
);
return SCI_SUCCESS;
}
/**
*
* @sci_req: This parameter specifies the request to be constructed.
......@@ -364,7 +337,7 @@ enum sci_status scic_sds_stp_ncq_request_construct(struct scic_sds_request *sci_
}
/**
*
* scu_stp_raw_request_construct_task_context -
* @this_request: This parameter specifies the STP request object for which to
* construct a RAW command frame task context.
* @task_context: This parameter specifies the SCU specific task context buffer
......@@ -373,7 +346,7 @@ enum sci_status scic_sds_stp_ncq_request_construct(struct scic_sds_request *sci_
* This method performs the operations common to all SATA/STP requests
* utilizing the raw frame method. none
*/
void scu_stp_raw_request_construct_task_context(
static void scu_stp_raw_request_construct_task_context(
struct scic_sds_stp_request *this_request,
struct scu_task_context *task_context)
{
......@@ -386,59 +359,6 @@ void scu_stp_raw_request_construct_task_context(
task_context->transfer_length_bytes = sizeof(struct sata_fis_reg_h2d) - sizeof(u32);
}
/**
*
* @this_request: This parameter specifies the core request object to
* construction into an STP/SATA non-data request.
*
* This method will construct the STP Non-data request and its associated TC
* data. A non-data request essentially behaves like a 0 length read request
* in the SCU. This method currently always returns SCI_SUCCESS
*/
enum sci_status scic_sds_stp_non_data_request_construct(
struct scic_sds_request *this_request)
{
scic_sds_stp_non_ncq_request_construct(this_request);
/* Build the STP task context structure */
scu_stp_raw_request_construct_task_context(
(struct scic_sds_stp_request *)this_request,
this_request->task_context_buffer
);
sci_base_state_machine_construct(
&this_request->started_substate_machine,
&this_request->parent.parent,
scic_sds_stp_request_started_non_data_substate_table,
SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_H2D_COMPLETION_SUBSTATE
);
return SCI_SUCCESS;
}
enum sci_status scic_sds_stp_soft_reset_request_construct(
struct scic_sds_request *this_request)
{
scic_sds_stp_non_ncq_request_construct(this_request);
/* Build the STP task context structure */
scu_stp_raw_request_construct_task_context(
(struct scic_sds_stp_request *)this_request,
this_request->task_context_buffer
);
sci_base_state_machine_construct(
&this_request->started_substate_machine,
&this_request->parent.parent,
scic_sds_stp_request_started_soft_reset_substate_table,
SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_ASSERTED_COMPLETION_SUBSTATE
);
return SCI_SUCCESS;
}
void scic_stp_io_request_set_ncq_tag(
struct scic_sds_request *req,
u16 ncq_tag)
......@@ -474,7 +394,7 @@ void *scic_stp_io_request_get_d2h_reg_address(
* - if there are more SGL element pairs - advance to the next pair and return
* element A struct scu_sgl_element*
*/
struct scu_sgl_element *scic_sds_stp_request_pio_get_next_sgl(struct scic_sds_stp_request *stp_req)
static struct scu_sgl_element *scic_sds_stp_request_pio_get_next_sgl(struct scic_sds_stp_request *stp_req)
{
struct scu_sgl_element *current_sgl;
struct scic_sds_request *sci_req = &stp_req->parent;
......@@ -508,60 +428,6 @@ struct scu_sgl_element *scic_sds_stp_request_pio_get_next_sgl(struct scic_sds_st
return current_sgl;
}
/**
*
* @scic_io_request: The core request object which is cast to a SATA PIO
* request object.
*
* This method will construct the SATA PIO request. This method returns an
* indication as to whether the construction was successful. SCI_SUCCESS
* Currently this method always returns this value.
*/
enum sci_status scic_sds_stp_pio_request_construct(
struct scic_sds_request *scic_io_request,
u8 sat_protocol,
bool copy_rx_frame)
{
struct scic_sds_stp_request *this_request;
this_request = (struct scic_sds_stp_request *)scic_io_request;
scic_sds_stp_non_ncq_request_construct(&this_request->parent);
scu_stp_raw_request_construct_task_context(
this_request, this_request->parent.task_context_buffer
);
this_request->type.pio.current_transfer_bytes = 0;
this_request->type.pio.ending_error = 0;
this_request->type.pio.ending_status = 0;
this_request->type.pio.request_current.sgl_offset = 0;
this_request->type.pio.request_current.sgl_set = SCU_SGL_ELEMENT_PAIR_A;
this_request->type.pio.sat_protocol = sat_protocol;
if (copy_rx_frame) {
scic_sds_request_build_sgl(&this_request->parent);
/*
* Since the IO request copy of the TC contains the same data as
* the actual TC this pointer is vaild for either. */
this_request->type.pio.request_current.sgl_pair =
&this_request->parent.task_context_buffer->sgl_pair_ab;
} else {
/* The user does not want the data copied to the SGL buffer location */
this_request->type.pio.request_current.sgl_pair = NULL;
}
sci_base_state_machine_construct(
&this_request->parent.started_substate_machine,
&this_request->parent.parent.parent,
scic_sds_stp_request_started_pio_substate_table,
SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_H2D_COMPLETION_SUBSTATE
);
return SCI_SUCCESS;
}
/**
*
* @this_request:
......@@ -689,7 +555,7 @@ static enum sci_status scic_sds_stp_request_non_data_await_d2h_frame_handler(
/* --------------------------------------------------------------------------- */
const struct scic_sds_io_request_state_handler scic_sds_stp_request_started_non_data_substate_handler_table[] = {
static const struct scic_sds_io_request_state_handler scic_sds_stp_request_started_non_data_substate_handler_table[] = {
[SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_H2D_COMPLETION_SUBSTATE] = {
.parent.start_handler = scic_sds_request_default_start_handler,
.parent.abort_handler = scic_sds_request_started_state_abort_handler,
......@@ -740,7 +606,7 @@ static void scic_sds_stp_request_started_non_data_await_d2h_enter(
/* --------------------------------------------------------------------------- */
const struct sci_base_state scic_sds_stp_request_started_non_data_substate_table[] = {
static const struct sci_base_state scic_sds_stp_request_started_non_data_substate_table[] = {
[SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_H2D_COMPLETION_SUBSTATE] = {
.enter_state = scic_sds_stp_request_started_non_data_await_h2d_completion_enter,
},
......@@ -749,6 +615,23 @@ const struct sci_base_state scic_sds_stp_request_started_non_data_substate_table
},
};
enum sci_status scic_sds_stp_non_data_request_construct(struct scic_sds_request *sci_req)
{
struct scic_sds_stp_request *stp_req = container_of(sci_req, typeof(*stp_req), parent);
scic_sds_stp_non_ncq_request_construct(sci_req);
/* Build the STP task context structure */
scu_stp_raw_request_construct_task_context(stp_req, sci_req->task_context_buffer);
sci_base_state_machine_construct(&sci_req->started_substate_machine,
&sci_req->parent.parent,
scic_sds_stp_request_started_non_data_substate_table,
SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_H2D_COMPLETION_SUBSTATE);
return SCI_SUCCESS;
}
#define SCU_MAX_FRAME_BUFFER_SIZE 0x400 /* 1K is the maximum SCU frame data payload */
/**
......@@ -1330,7 +1213,7 @@ static enum sci_status scic_sds_stp_request_pio_data_in_await_data_event_handler
/* --------------------------------------------------------------------------- */
const struct scic_sds_io_request_state_handler scic_sds_stp_request_started_pio_substate_handler_table[] = {
static const struct scic_sds_io_request_state_handler scic_sds_stp_request_started_pio_substate_handler_table[] = {
[SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_H2D_COMPLETION_SUBSTATE] = {
.parent.start_handler = scic_sds_request_default_start_handler,
.parent.abort_handler = scic_sds_request_started_state_abort_handler,
......@@ -1422,7 +1305,7 @@ static void scic_sds_stp_request_started_pio_data_out_transmit_data_enter(
/* --------------------------------------------------------------------------- */
const struct sci_base_state scic_sds_stp_request_started_pio_substate_table[] = {
static const struct sci_base_state scic_sds_stp_request_started_pio_substate_table[] = {
[SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_H2D_COMPLETION_SUBSTATE] = {
.enter_state = scic_sds_stp_request_started_pio_await_h2d_completion_enter,
},
......@@ -1437,6 +1320,45 @@ const struct sci_base_state scic_sds_stp_request_started_pio_substate_table[] =
}
};
enum sci_status scic_sds_stp_pio_request_construct(struct scic_sds_request *sci_req,
u8 sat_protocol,
bool copy_rx_frame)
{
struct scic_sds_stp_request *stp_req = container_of(sci_req, typeof(*stp_req), parent);
struct scic_sds_stp_pio_request *pio = &stp_req->type.pio;
scic_sds_stp_non_ncq_request_construct(sci_req);
scu_stp_raw_request_construct_task_context(stp_req,
sci_req->task_context_buffer);
pio->current_transfer_bytes = 0;
pio->ending_error = 0;
pio->ending_status = 0;
pio->request_current.sgl_offset = 0;
pio->request_current.sgl_set = SCU_SGL_ELEMENT_PAIR_A;
pio->sat_protocol = sat_protocol;
if (copy_rx_frame) {
scic_sds_request_build_sgl(sci_req);
/* Since the IO request copy of the TC contains the same data as
* the actual TC this pointer is vaild for either.
*/
pio->request_current.sgl_pair = &sci_req->task_context_buffer->sgl_pair_ab;
} else {
/* The user does not want the data copied to the SGL buffer location */
pio->request_current.sgl_pair = NULL;
}
sci_base_state_machine_construct(&sci_req->started_substate_machine,
&sci_req->parent.parent,
scic_sds_stp_request_started_pio_substate_table,
SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_H2D_COMPLETION_SUBSTATE);
return SCI_SUCCESS;
}
static void scic_sds_stp_request_udma_complete_request(
struct scic_sds_request *this_request,
u32 scu_status,
......@@ -1594,7 +1516,7 @@ static enum sci_status scic_sds_stp_request_udma_await_d2h_reg_fis_frame_handler
/* --------------------------------------------------------------------------- */
const struct scic_sds_io_request_state_handler scic_sds_stp_request_started_udma_substate_handler_table[] = {
static const struct scic_sds_io_request_state_handler scic_sds_stp_request_started_udma_substate_handler_table[] = {
[SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE] = {
.parent.start_handler = scic_sds_request_default_start_handler,
.parent.abort_handler = scic_sds_request_started_state_abort_handler,
......@@ -1648,7 +1570,7 @@ static void scic_sds_stp_request_started_udma_await_d2h_reg_fis_enter(
/* --------------------------------------------------------------------------- */
const struct sci_base_state scic_sds_stp_request_started_udma_substate_table[] = {
static const struct sci_base_state scic_sds_stp_request_started_udma_substate_table[] = {
[SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE] = {
.enter_state = scic_sds_stp_request_started_udma_await_tc_completion_enter,
},
......@@ -1657,6 +1579,25 @@ const struct sci_base_state scic_sds_stp_request_started_udma_substate_table[] =
},
};
enum sci_status scic_sds_stp_udma_request_construct(struct scic_sds_request *sci_req,
u32 len,
enum dma_data_direction dir)
{
scic_sds_stp_non_ncq_request_construct(sci_req);
scic_sds_stp_optimized_request_construct(sci_req, SCU_TASK_TYPE_DMA_IN,
len, dir);
sci_base_state_machine_construct(
&sci_req->started_substate_machine,
&sci_req->parent.parent,
scic_sds_stp_request_started_udma_substate_table,
SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE
);
return SCI_SUCCESS;
}
/**
*
* @this_request:
......@@ -1831,7 +1772,7 @@ static enum sci_status scic_sds_stp_request_soft_reset_await_d2h_frame_handler(
/* --------------------------------------------------------------------------- */
const struct scic_sds_io_request_state_handler scic_sds_stp_request_started_soft_reset_substate_handler_table[] = {
static const struct scic_sds_io_request_state_handler scic_sds_stp_request_started_soft_reset_substate_handler_table[] = {
[SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_ASSERTED_COMPLETION_SUBSTATE] = {
.parent.start_handler = scic_sds_request_default_start_handler,
.parent.abort_handler = scic_sds_request_started_state_abort_handler,
......@@ -1925,9 +1866,7 @@ static void scic_sds_stp_request_started_soft_reset_await_d2h_response_enter(
);
}
/* --------------------------------------------------------------------------- */
const struct sci_base_state scic_sds_stp_request_started_soft_reset_substate_table[] = {
static const struct sci_base_state scic_sds_stp_request_started_soft_reset_substate_table[] = {
[SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_ASSERTED_COMPLETION_SUBSTATE] = {
.enter_state = scic_sds_stp_request_started_soft_reset_await_h2d_asserted_completion_enter,
},
......@@ -1939,3 +1878,19 @@ const struct sci_base_state scic_sds_stp_request_started_soft_reset_substate_tab
},
};
enum sci_status scic_sds_stp_soft_reset_request_construct(struct scic_sds_request *sci_req)
{
struct scic_sds_stp_request *stp_req = container_of(sci_req, typeof(*stp_req), parent);
scic_sds_stp_non_ncq_request_construct(sci_req);
/* Build the STP task context structure */
scu_stp_raw_request_construct_task_context(stp_req, sci_req->task_context_buffer);
sci_base_state_machine_construct(&sci_req->started_substate_machine,
&sci_req->parent.parent,
scic_sds_stp_request_started_soft_reset_substate_table,
SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_ASSERTED_COMPLETION_SUBSTATE);
return SCI_SUCCESS;
}
......@@ -76,7 +76,7 @@ struct scic_sds_stp_request {
u32 udma;
struct {
struct scic_sds_stp_pio_request {
/**
* Total transfer for the entire PIO request recorded at request constuction
* time.
......@@ -169,26 +169,8 @@ enum SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_SUBSTATES {
SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_D2H_RESPONSE_FRAME_SUBSTATE,
};
extern const struct scic_sds_io_request_state_handler scic_sds_stp_request_started_udma_substate_handler_table[];
extern const struct sci_base_state scic_sds_stp_request_started_udma_substate_table[];
extern const struct scic_sds_io_request_state_handler scic_sds_stp_request_started_non_data_substate_handler_table[];
extern const struct sci_base_state scic_sds_stp_request_started_non_data_substate_table[];
extern const struct scic_sds_io_request_state_handler scic_sds_stp_request_started_soft_reset_substate_handler_table[];
extern const struct sci_base_state scic_sds_stp_request_started_soft_reset_substate_table[];
/* --------------------------------------------------------------------------- */
u32 scic_sds_stp_request_get_object_size(void);
void scic_sds_stp_non_ncq_request_construct(
struct scic_sds_request *this_request);
enum sci_status scic_sds_stp_pio_request_construct(
struct scic_sds_request *scic_io_request,
u8 sat_protocol,
......@@ -214,8 +196,5 @@ enum sci_status scic_sds_stp_ncq_request_construct(
u32 transfer_length,
enum dma_data_direction dir);
void scu_stp_raw_request_construct_task_context(
struct scic_sds_stp_request *this_request,
struct scu_task_context *task_context);
#endif /* _SCIC_SDS_STP_REQUEST_T_ */
......@@ -32,5 +32,5 @@ Header Type - u8: 0xf
==============================================================================
Place isci_firmware.bin in /lib/firmware
Be sure to recreate the initramfs image to include the firmware.
Be sure to recreate the initramfs image to include the firmware.
......@@ -201,7 +201,7 @@ void isci_port_link_up(
call_status = scic_sata_phy_get_properties(phy,
&sata_phy_properties);
/*
/*
* XXX I am concerned about this "assert". shouldn't we
* handle the return appropriately?
*/
......
......@@ -1263,47 +1263,6 @@ enum dma_data_direction isci_request_io_request_get_data_direction(
*
* physical address in the specified sge.
*/
dma_addr_t isci_request_sge_get_address_field(
struct isci_request *request,
void *sge_address)
{
struct sas_task *task = isci_request_access_task(request);
dma_addr_t ret;
struct isci_host *isci_host = isci_host_from_sas_ha(
task->dev->port->ha);
dev_dbg(&isci_host->pdev->dev,
"%s: request = %p, sge_address = %p\n",
__func__,
request,
sge_address);
if (task->data_dir == PCI_DMA_NONE)
return 0;
/* the case where num_scatter == 0 is special, in that
* task->scatter is the actual buffer address, not an sgl.
* so a map single is required here.
*/
if ((task->num_scatter == 0) &&
!sas_protocol_ata(task->task_proto)) {
ret = dma_map_single(
&isci_host->pdev->dev,
task->scatter,
task->total_xfer_len,
task->data_dir
);
request->zero_scatter_daddr = ret;
} else
ret = sg_dma_address(((struct scatterlist *)sge_address));
dev_dbg(&isci_host->pdev->dev,
"%s: bus address = %lx\n",
__func__,
(unsigned long)ret);
return ret;
}
/**
......@@ -1314,38 +1273,6 @@ dma_addr_t isci_request_sge_get_address_field(
*
* length field value in the specified sge.
*/
u32 isci_request_sge_get_length_field(
struct isci_request *request,
void *sge_address)
{
struct sas_task *task = isci_request_access_task(request);
int ret;
dev_dbg(&request->isci_host->pdev->dev,
"%s: request = %p, sge_address = %p\n",
__func__,
request,
sge_address);
if (task->data_dir == PCI_DMA_NONE)
return 0;
/* the case where num_scatter == 0 is special, in that
* task->scatter is the actual buffer address, not an sgl.
* so we return total_xfer_len here.
*/
if (task->num_scatter == 0)
ret = task->total_xfer_len;
else
ret = sg_dma_len((struct scatterlist *)sge_address);
dev_dbg(&request->isci_host->pdev->dev,
"%s: len = %d\n",
__func__,
ret);
return ret;
}
/**
......
......@@ -391,13 +391,7 @@ static inline void *isci_request_io_request_get_next_sge(
return ret;
}
dma_addr_t isci_request_sge_get_address_field(
struct isci_request *request,
void *sge_address);
u32 isci_request_sge_get_length_field(
struct isci_request *request,
void *sge_address);
void *isci_request_ssp_io_request_get_cdb_address(
struct isci_request *request);
......
......@@ -588,7 +588,7 @@ void isci_task_build_tmf(
tmf->cb_data = cb_data;
}
void isci_task_build_abort_task_tmf(
static void isci_task_build_abort_task_tmf(
struct isci_tmf *tmf,
struct isci_remote_device *isci_device,
enum isci_tmf_function_codes code,
......@@ -1528,15 +1528,6 @@ void isci_task_request_complete(
*
* lun for specified task request.
*/
u32 isci_task_ssp_request_get_lun(struct isci_request *request)
{
struct isci_tmf *isci_tmf = isci_request_access_tmf(request);
dev_dbg(&request->isci_host->pdev->dev,
"%s: lun = %d\n", __func__, isci_tmf->lun[0]);
/* @todo: build lun from array of bytes to 32 bit */
return isci_tmf->lun[0];
}
/**
* isci_task_ssp_request_get_function() - This function is called by the sci
......
......@@ -202,8 +202,6 @@ u16 isci_task_ssp_request_get_io_tag_to_manage(
u8 isci_task_ssp_request_get_function(
struct isci_request *request);
u32 isci_task_ssp_request_get_lun(
struct isci_request *request);
void *isci_task_ssp_request_get_response_data_address(
struct isci_request *request);
......@@ -226,14 +224,6 @@ void isci_task_build_tmf(
void *),
void *cb_data);
void isci_task_build_abort_task_tmf(
struct isci_tmf *tmf,
struct isci_remote_device *isci_device,
enum isci_tmf_function_codes code,
void (*tmf_sent_cb)(
enum isci_tmf_cb_state,
struct isci_tmf *, void *),
struct isci_request *old_request);
int isci_task_execute_tmf(
struct isci_host *isci_host,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册