Commit 82d29928 authored by Dan Williams's avatar Dan Williams

isci: kill SCI_IO_REQUEST_DATA_DIRECTION

It's an unnecessary typedef that mirrors the kernel's enum
dma_data_direction.

Also cleanup some long variable names along the way.
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent a7e536c7
...@@ -61,13 +61,6 @@ ...@@ -61,13 +61,6 @@
#define sci_cb_make_physical_address(physical_addr, addr_upper, addr_lower) \ #define sci_cb_make_physical_address(physical_addr, addr_upper, addr_lower) \
((physical_addr) = (addr_lower) | ((u64)addr_upper) << 32) ((physical_addr) = (addr_lower) | ((u64)addr_upper) << 32)
typedef enum {
SCI_IO_REQUEST_DATA_IN = 0, /* Read operation */
SCI_IO_REQUEST_DATA_OUT, /* Write operation */
SCI_IO_REQUEST_NO_DATA
} SCI_IO_REQUEST_DATA_DIRECTION;
enum sci_controller_mode { enum sci_controller_mode {
SCI_MODE_SPEED, /* Optimized for performance */ SCI_MODE_SPEED, /* Optimized for performance */
SCI_MODE_SIZE /* Optimized for memory use */ SCI_MODE_SIZE /* Optimized for memory use */
......
...@@ -588,34 +588,34 @@ static void scu_ssp_reqeust_construct_task_context( ...@@ -588,34 +588,34 @@ static void scu_ssp_reqeust_construct_task_context(
* *
*/ */
static void scu_ssp_io_request_construct_task_context( static void scu_ssp_io_request_construct_task_context(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
SCI_IO_REQUEST_DATA_DIRECTION data_direction, enum dma_data_direction dir,
u32 transfer_length_bytes) u32 len)
{ {
struct scu_task_context *task_context; struct scu_task_context *task_context;
task_context = scic_sds_request_get_task_context(this_request); task_context = scic_sds_request_get_task_context(sci_req);
scu_ssp_reqeust_construct_task_context(this_request, task_context); scu_ssp_reqeust_construct_task_context(sci_req, task_context);
task_context->ssp_command_iu_length = sizeof(struct sci_ssp_command_iu) / sizeof(u32); task_context->ssp_command_iu_length = sizeof(struct sci_ssp_command_iu) / sizeof(u32);
task_context->type.ssp.frame_type = SCI_SAS_COMMAND_FRAME; task_context->type.ssp.frame_type = SCI_SAS_COMMAND_FRAME;
switch (data_direction) { switch (dir) {
case SCI_IO_REQUEST_DATA_IN: case DMA_FROM_DEVICE:
case SCI_IO_REQUEST_NO_DATA: case DMA_NONE:
default:
task_context->task_type = SCU_TASK_TYPE_IOREAD; task_context->task_type = SCU_TASK_TYPE_IOREAD;
break; break;
case SCI_IO_REQUEST_DATA_OUT: case DMA_TO_DEVICE:
task_context->task_type = SCU_TASK_TYPE_IOWRITE; task_context->task_type = SCU_TASK_TYPE_IOWRITE;
break; break;
} }
task_context->transfer_length_bytes = transfer_length_bytes; task_context->transfer_length_bytes = len;
if (task_context->transfer_length_bytes > 0) { if (task_context->transfer_length_bytes > 0)
scic_sds_request_build_sgl(this_request); scic_sds_request_build_sgl(sci_req);
}
} }
...@@ -694,37 +694,35 @@ static void scu_ssp_task_request_construct_task_context( ...@@ -694,37 +694,35 @@ static void scu_ssp_task_request_construct_task_context(
* *
* enum sci_status * enum sci_status
*/ */
static enum sci_status scic_io_request_construct_sata( static enum sci_status scic_io_request_construct_sata(struct scic_sds_request *sci_req,
struct scic_sds_request *this_request, u8 proto, u32 len,
u8 sat_protocol, enum dma_data_direction dir,
u32 transfer_length, bool copy)
SCI_IO_REQUEST_DATA_DIRECTION data_direction,
bool copy_rx_frame)
{ {
enum sci_status status = SCI_SUCCESS; enum sci_status status = SCI_SUCCESS;
switch (sat_protocol) { switch (proto) {
case SAT_PROTOCOL_PIO_DATA_IN: case SAT_PROTOCOL_PIO_DATA_IN:
case SAT_PROTOCOL_PIO_DATA_OUT: case SAT_PROTOCOL_PIO_DATA_OUT:
status = scic_sds_stp_pio_request_construct(this_request, sat_protocol, copy_rx_frame); status = scic_sds_stp_pio_request_construct(sci_req, proto, copy);
break; break;
case SAT_PROTOCOL_UDMA_DATA_IN: case SAT_PROTOCOL_UDMA_DATA_IN:
case SAT_PROTOCOL_UDMA_DATA_OUT: case SAT_PROTOCOL_UDMA_DATA_OUT:
status = scic_sds_stp_udma_request_construct(this_request, transfer_length, data_direction); status = scic_sds_stp_udma_request_construct(sci_req, len, dir);
break; break;
case SAT_PROTOCOL_ATA_HARD_RESET: case SAT_PROTOCOL_ATA_HARD_RESET:
case SAT_PROTOCOL_SOFT_RESET: case SAT_PROTOCOL_SOFT_RESET:
status = scic_sds_stp_soft_reset_request_construct(this_request); status = scic_sds_stp_soft_reset_request_construct(sci_req);
break; break;
case SAT_PROTOCOL_NON_DATA: case SAT_PROTOCOL_NON_DATA:
status = scic_sds_stp_non_data_request_construct(this_request); status = scic_sds_stp_non_data_request_construct(sci_req);
break; break;
case SAT_PROTOCOL_FPDMA: case SAT_PROTOCOL_FPDMA:
status = scic_sds_stp_ncq_request_construct(this_request, transfer_length, data_direction); status = scic_sds_stp_ncq_request_construct(sci_req, len, dir);
break; break;
#if !defined(DISABLE_ATAPI) #if !defined(DISABLE_ATAPI)
...@@ -733,7 +731,7 @@ static enum sci_status scic_io_request_construct_sata( ...@@ -733,7 +731,7 @@ static enum sci_status scic_io_request_construct_sata(
case SAT_PROTOCOL_PACKET_DMA_DATA_OUT: case SAT_PROTOCOL_PACKET_DMA_DATA_OUT:
case SAT_PROTOCOL_PACKET_PIO_DATA_IN: case SAT_PROTOCOL_PACKET_PIO_DATA_IN:
case SAT_PROTOCOL_PACKET_PIO_DATA_OUT: case SAT_PROTOCOL_PACKET_PIO_DATA_OUT:
status = scic_sds_stp_packet_request_construct(this_request); status = scic_sds_stp_packet_request_construct(sci_req);
break; break;
#endif #endif
...@@ -743,10 +741,10 @@ static enum sci_status scic_io_request_construct_sata( ...@@ -743,10 +741,10 @@ static enum sci_status scic_io_request_construct_sata(
case SAT_PROTOCOL_DEVICE_RESET: case SAT_PROTOCOL_DEVICE_RESET:
case SAT_PROTOCOL_RETURN_RESPONSE_INFO: case SAT_PROTOCOL_RETURN_RESPONSE_INFO:
default: default:
dev_err(scic_to_dev(this_request->owning_controller), dev_err(scic_to_dev(sci_req->owning_controller),
"%s: SCIC IO Request 0x%p received un-handled " "%s: SCIC IO Request 0x%p received un-handled "
"SAT Protocl %d.\n", "SAT Protocl %d.\n",
__func__, this_request, sat_protocol); __func__, sci_req, proto);
status = SCI_FAILURE; status = SCI_FAILURE;
break; break;
...@@ -945,35 +943,25 @@ enum sci_status scic_task_request_construct_ssp( ...@@ -945,35 +943,25 @@ enum sci_status scic_task_request_construct_ssp(
} }
enum sci_status scic_io_request_construct_basic_sata( enum sci_status scic_io_request_construct_basic_sata(struct scic_sds_request *sci_req)
struct scic_sds_request *sci_req)
{ {
enum sci_status status; enum sci_status status;
struct scic_sds_stp_request *this_stp_request; struct scic_sds_stp_request *stp_req;
u8 sat_protocol; u8 proto;
u32 transfer_length; u32 len;
SCI_IO_REQUEST_DATA_DIRECTION data_direction; enum dma_data_direction dir;
bool copy_rx_frame = false; bool copy = false;
this_stp_request = (struct scic_sds_stp_request *)sci_req; stp_req = container_of(sci_req, typeof(*stp_req), parent);
sci_req->protocol = SCIC_STP_PROTOCOL; sci_req->protocol = SCIC_STP_PROTOCOL;
transfer_length = len = scic_cb_io_request_get_transfer_length(sci_req->user_request);
scic_cb_io_request_get_transfer_length(sci_req->user_request); dir = scic_cb_io_request_get_data_direction(sci_req->user_request);
data_direction = proto = scic_cb_request_get_sat_protocol(sci_req->user_request);
scic_cb_io_request_get_data_direction(sci_req->user_request); copy = scic_cb_io_request_do_copy_rx_frames(stp_req->parent.user_request);
sat_protocol = scic_cb_request_get_sat_protocol(sci_req->user_request); status = scic_io_request_construct_sata(sci_req, proto, len, dir, copy);
copy_rx_frame = scic_cb_io_request_do_copy_rx_frames(this_stp_request->parent.user_request);
status = scic_io_request_construct_sata(
sci_req,
sat_protocol,
transfer_length,
data_direction,
copy_rx_frame
);
if (status == SCI_SUCCESS) if (status == SCI_SUCCESS)
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
......
...@@ -288,7 +288,7 @@ void scic_sds_stp_non_ncq_request_construct( ...@@ -288,7 +288,7 @@ void scic_sds_stp_non_ncq_request_construct(
/** /**
* *
* @this_request: This parameter specifies the request to be constructed as an * @sci_req: This parameter specifies the request to be constructed as an
* optimized request. * optimized request.
* @optimized_task_type: This parameter specifies whether the request is to be * @optimized_task_type: This parameter specifies whether the request is to be
* an UDMA request or a NCQ request. - A value of 0 indicates UDMA. - A * an UDMA request or a NCQ request. - A value of 0 indicates UDMA. - A
...@@ -298,24 +298,23 @@ void scic_sds_stp_non_ncq_request_construct( ...@@ -298,24 +298,23 @@ void scic_sds_stp_non_ncq_request_construct(
* requests that are optimized by the silicon (i.e. UDMA, NCQ). This method * requests that are optimized by the silicon (i.e. UDMA, NCQ). This method
* returns an indication as to whether the construction was successful. * returns an indication as to whether the construction was successful.
*/ */
static void scic_sds_stp_optimized_request_construct( static void scic_sds_stp_optimized_request_construct(struct scic_sds_request *sci_req,
struct scic_sds_request *this_request, u8 optimized_task_type,
u8 optimized_task_type, u32 len,
u32 transfer_length, enum dma_data_direction dir)
SCI_IO_REQUEST_DATA_DIRECTION data_direction)
{ {
struct scu_task_context *task_context = this_request->task_context_buffer; struct scu_task_context *task_context = sci_req->task_context_buffer;
/* Build the STP task context structure */ /* Build the STP task context structure */
scu_sata_reqeust_construct_task_context(this_request, task_context); scu_sata_reqeust_construct_task_context(sci_req, task_context);
/* Copy over the SGL elements */ /* Copy over the SGL elements */
scic_sds_request_build_sgl(this_request); scic_sds_request_build_sgl(sci_req);
/* Copy over the number of bytes to be transfered */ /* Copy over the number of bytes to be transfered */
task_context->transfer_length_bytes = transfer_length; task_context->transfer_length_bytes = len;
if (data_direction == SCI_IO_REQUEST_DATA_OUT) { if (dir == DMA_TO_DEVICE) {
/* /*
* The difference between the DMA IN and DMA OUT request task type * The difference between the DMA IN and DMA OUT request task type
* values are consistent with the difference between FPDMA READ * values are consistent with the difference between FPDMA READ
...@@ -334,29 +333,24 @@ static void scic_sds_stp_optimized_request_construct( ...@@ -334,29 +333,24 @@ static void scic_sds_stp_optimized_request_construct(
/** /**
* *
* @this_request: This parameter specifies the request to be constructed. * @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 will construct the STP UDMA request and its associated TC data.
* This method returns an indication as to whether the construction was * This method returns an indication as to whether the construction was
* successful. SCI_SUCCESS Currently this method always returns this value. * successful. SCI_SUCCESS Currently this method always returns this value.
*/ */
enum sci_status scic_sds_stp_udma_request_construct( enum sci_status scic_sds_stp_udma_request_construct(struct scic_sds_request *sci_req,
struct scic_sds_request *this_request, u32 len,
u32 transfer_length, enum dma_data_direction dir)
SCI_IO_REQUEST_DATA_DIRECTION data_direction)
{ {
scic_sds_stp_non_ncq_request_construct(this_request); scic_sds_stp_non_ncq_request_construct(sci_req);
scic_sds_stp_optimized_request_construct( scic_sds_stp_optimized_request_construct(sci_req, SCU_TASK_TYPE_DMA_IN,
this_request, len, dir);
SCU_TASK_TYPE_DMA_IN,
transfer_length,
data_direction
);
sci_base_state_machine_construct( sci_base_state_machine_construct(
&this_request->started_substate_machine, &sci_req->started_substate_machine,
&this_request->parent.parent, &sci_req->parent.parent,
scic_sds_stp_request_started_udma_substate_table, scic_sds_stp_request_started_udma_substate_table,
SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE
); );
...@@ -366,23 +360,19 @@ enum sci_status scic_sds_stp_udma_request_construct( ...@@ -366,23 +360,19 @@ enum sci_status scic_sds_stp_udma_request_construct(
/** /**
* *
* @this_request: This parameter specifies the request to be constructed. * @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 will construct the STP UDMA request and its associated TC data.
* This method returns an indication as to whether the construction was * This method returns an indication as to whether the construction was
* successful. SCI_SUCCESS Currently this method always returns this value. * successful. SCI_SUCCESS Currently this method always returns this value.
*/ */
enum sci_status scic_sds_stp_ncq_request_construct( enum sci_status scic_sds_stp_ncq_request_construct(struct scic_sds_request *sci_req,
struct scic_sds_request *this_request, u32 len,
u32 transfer_length, enum dma_data_direction dir)
SCI_IO_REQUEST_DATA_DIRECTION data_direction)
{ {
scic_sds_stp_optimized_request_construct( scic_sds_stp_optimized_request_construct(sci_req,
this_request, SCU_TASK_TYPE_FPDMAQ_READ,
SCU_TASK_TYPE_FPDMAQ_READ, len, dir);
transfer_length,
data_direction
);
return SCI_SUCCESS; return SCI_SUCCESS;
} }
......
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
#ifndef _SCIC_SDS_STP_REQUEST_T_ #ifndef _SCIC_SDS_STP_REQUEST_T_
#define _SCIC_SDS_STP_REQUEST_T_ #define _SCIC_SDS_STP_REQUEST_T_
#include <linux/dma-mapping.h>
#include "intel_sata.h" #include "intel_sata.h"
#include "sci_types.h" #include "sci_types.h"
#include "scic_sds_request.h" #include "scic_sds_request.h"
...@@ -201,7 +202,7 @@ enum sci_status scic_sds_stp_pio_request_construct_pass_through( ...@@ -201,7 +202,7 @@ enum sci_status scic_sds_stp_pio_request_construct_pass_through(
enum sci_status scic_sds_stp_udma_request_construct( enum sci_status scic_sds_stp_udma_request_construct(
struct scic_sds_request *this_request, struct scic_sds_request *this_request,
u32 transfer_length, u32 transfer_length,
SCI_IO_REQUEST_DATA_DIRECTION data_direction); enum dma_data_direction dir);
enum sci_status scic_sds_stp_non_data_request_construct( enum sci_status scic_sds_stp_non_data_request_construct(
struct scic_sds_request *this_request); struct scic_sds_request *this_request);
...@@ -212,7 +213,7 @@ enum sci_status scic_sds_stp_soft_reset_request_construct( ...@@ -212,7 +213,7 @@ enum sci_status scic_sds_stp_soft_reset_request_construct(
enum sci_status scic_sds_stp_ncq_request_construct( enum sci_status scic_sds_stp_ncq_request_construct(
struct scic_sds_request *this_request, struct scic_sds_request *this_request,
u32 transfer_length, u32 transfer_length,
SCI_IO_REQUEST_DATA_DIRECTION data_direction); enum dma_data_direction dir);
void scu_stp_raw_request_construct_task_context( void scu_stp_raw_request_construct_task_context(
struct scic_sds_stp_request *this_request, struct scic_sds_stp_request *this_request,
......
...@@ -246,11 +246,8 @@ u32 scic_cb_io_request_get_transfer_length( ...@@ -246,11 +246,8 @@ u32 scic_cb_io_request_get_transfer_length(
* object. It is a cookie that allows the user to provide the necessary * object. It is a cookie that allows the user to provide the necessary
* information for this callback. * information for this callback.
* *
* This method returns the value of SCI_IO_REQUEST_DATA_OUT or
* SCI_IO_REQUEST_DATA_IN, or SCI_IO_REQUEST_NO_DATA.
*/ */
SCI_IO_REQUEST_DATA_DIRECTION scic_cb_io_request_get_data_direction( enum dma_data_direction scic_cb_io_request_get_data_direction(void *req);
void *scic_user_io_request);
#ifndef SCI_SGL_OPTIMIZATION_ENABLED #ifndef SCI_SGL_OPTIMIZATION_ENABLED
/** /**
......
...@@ -139,16 +139,10 @@ u32 scic_cb_io_request_get_transfer_length( ...@@ -139,16 +139,10 @@ u32 scic_cb_io_request_get_transfer_length(
* @scic_user_io_request: This parameter points to the user's IO request * @scic_user_io_request: This parameter points to the user's IO request
* object. It is a cookie that allows the user to provide the necessary * object. It is a cookie that allows the user to provide the necessary
* information for this callback. * information for this callback.
*
* This method returns the value of SCI_IO_REQUEST_DATA_OUT or
* SCI_IO_REQUEST_DATA_IN, or SCI_IO_REQUEST_NO_DATA.
*/ */
SCI_IO_REQUEST_DATA_DIRECTION scic_cb_io_request_get_data_direction( enum dma_data_direction scic_cb_io_request_get_data_direction(void *req)
void *scic_user_io_request)
{ {
return isci_request_io_request_get_data_direction( return isci_request_io_request_get_data_direction(req);
scic_user_io_request
);
} }
......
...@@ -1237,44 +1237,12 @@ u32 isci_request_io_request_get_transfer_length(struct isci_request *request) ...@@ -1237,44 +1237,12 @@ u32 isci_request_io_request_get_transfer_length(struct isci_request *request)
* *
* data direction for specified request. * data direction for specified request.
*/ */
SCI_IO_REQUEST_DATA_DIRECTION isci_request_io_request_get_data_direction( enum dma_data_direction isci_request_io_request_get_data_direction(
struct isci_request *request) struct isci_request *request)
{ {
struct sas_task *task = isci_request_access_task(request); struct sas_task *task = isci_request_access_task(request);
SCI_IO_REQUEST_DATA_DIRECTION ret;
switch (task->data_dir) { return task->data_dir;
case DMA_FROM_DEVICE:
ret = SCI_IO_REQUEST_DATA_IN;
dev_dbg(&request->isci_host->pdev->dev,
"%s: request=%p, FROM_DEVICE\n",
__func__,
request);
break;
case DMA_TO_DEVICE:
ret = SCI_IO_REQUEST_DATA_OUT;
dev_dbg(&request->isci_host->pdev->dev,
"%s: request=%p, TO_DEVICE\n",
__func__,
request);
break;
case DMA_BIDIRECTIONAL:
case DMA_NONE:
default:
ret = SCI_IO_REQUEST_NO_DATA;
dev_dbg(&request->isci_host->pdev->dev,
"%s: request=%p, unhandled direction case, "
"data_dir=%d\n",
__func__,
request,
task->data_dir);
break;
}
return ret;
} }
/** /**
......
...@@ -346,8 +346,7 @@ void isci_request_io_request_complete( ...@@ -346,8 +346,7 @@ void isci_request_io_request_complete(
u32 isci_request_io_request_get_transfer_length( u32 isci_request_io_request_get_transfer_length(
struct isci_request *request); struct isci_request *request);
SCI_IO_REQUEST_DATA_DIRECTION isci_request_io_request_get_data_direction( enum dma_data_direction isci_request_io_request_get_data_direction(struct isci_request *req);
struct isci_request *request);
/** /**
* isci_request_io_request_get_next_sge() - This function is called by the sci * isci_request_io_request_get_next_sge() - This function is called by the sci
......
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