Commit 35173d57 authored by Dan Williams's avatar 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: default avatarDan Williams <dan.j.williams@intel.com>
parent 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.
......
This diff is collapsed.
......@@ -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_ */
This diff is collapsed.
......@@ -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_ */
This diff is collapsed.
......@@ -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);
......
This diff is collapsed.
......@@ -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,
......
......@@ -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_ */
......@@ -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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment