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: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
a7e536c7d6
commit
82d29928c1
@ -61,13 +61,6 @@
|
||||
#define sci_cb_make_physical_address(physical_addr, addr_upper, addr_lower) \
|
||||
((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 {
|
||||
SCI_MODE_SPEED, /* Optimized for performance */
|
||||
SCI_MODE_SIZE /* Optimized for memory use */
|
||||
|
@ -588,34 +588,34 @@ static void scu_ssp_reqeust_construct_task_context(
|
||||
*
|
||||
*/
|
||||
static void scu_ssp_io_request_construct_task_context(
|
||||
struct scic_sds_request *this_request,
|
||||
SCI_IO_REQUEST_DATA_DIRECTION data_direction,
|
||||
u32 transfer_length_bytes)
|
||||
struct scic_sds_request *sci_req,
|
||||
enum dma_data_direction dir,
|
||||
u32 len)
|
||||
{
|
||||
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->type.ssp.frame_type = SCI_SAS_COMMAND_FRAME;
|
||||
|
||||
switch (data_direction) {
|
||||
case SCI_IO_REQUEST_DATA_IN:
|
||||
case SCI_IO_REQUEST_NO_DATA:
|
||||
switch (dir) {
|
||||
case DMA_FROM_DEVICE:
|
||||
case DMA_NONE:
|
||||
default:
|
||||
task_context->task_type = SCU_TASK_TYPE_IOREAD;
|
||||
break;
|
||||
case SCI_IO_REQUEST_DATA_OUT:
|
||||
case DMA_TO_DEVICE:
|
||||
task_context->task_type = SCU_TASK_TYPE_IOWRITE;
|
||||
break;
|
||||
}
|
||||
|
||||
task_context->transfer_length_bytes = transfer_length_bytes;
|
||||
task_context->transfer_length_bytes = len;
|
||||
|
||||
if (task_context->transfer_length_bytes > 0) {
|
||||
scic_sds_request_build_sgl(this_request);
|
||||
}
|
||||
if (task_context->transfer_length_bytes > 0)
|
||||
scic_sds_request_build_sgl(sci_req);
|
||||
}
|
||||
|
||||
|
||||
@ -694,37 +694,35 @@ static void scu_ssp_task_request_construct_task_context(
|
||||
*
|
||||
* enum sci_status
|
||||
*/
|
||||
static enum sci_status scic_io_request_construct_sata(
|
||||
struct scic_sds_request *this_request,
|
||||
u8 sat_protocol,
|
||||
u32 transfer_length,
|
||||
SCI_IO_REQUEST_DATA_DIRECTION data_direction,
|
||||
bool copy_rx_frame)
|
||||
static enum sci_status scic_io_request_construct_sata(struct scic_sds_request *sci_req,
|
||||
u8 proto, u32 len,
|
||||
enum dma_data_direction dir,
|
||||
bool copy)
|
||||
{
|
||||
enum sci_status status = SCI_SUCCESS;
|
||||
|
||||
switch (sat_protocol) {
|
||||
switch (proto) {
|
||||
case SAT_PROTOCOL_PIO_DATA_IN:
|
||||
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;
|
||||
|
||||
case SAT_PROTOCOL_UDMA_DATA_IN:
|
||||
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;
|
||||
|
||||
case SAT_PROTOCOL_ATA_HARD_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;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
#if !defined(DISABLE_ATAPI)
|
||||
@ -733,7 +731,7 @@ static enum sci_status scic_io_request_construct_sata(
|
||||
case SAT_PROTOCOL_PACKET_DMA_DATA_OUT:
|
||||
case SAT_PROTOCOL_PACKET_PIO_DATA_IN:
|
||||
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;
|
||||
#endif
|
||||
|
||||
@ -743,10 +741,10 @@ static enum sci_status scic_io_request_construct_sata(
|
||||
case SAT_PROTOCOL_DEVICE_RESET:
|
||||
case SAT_PROTOCOL_RETURN_RESPONSE_INFO:
|
||||
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 "
|
||||
"SAT Protocl %d.\n",
|
||||
__func__, this_request, sat_protocol);
|
||||
__func__, sci_req, proto);
|
||||
|
||||
status = SCI_FAILURE;
|
||||
break;
|
||||
@ -945,35 +943,25 @@ enum sci_status scic_task_request_construct_ssp(
|
||||
}
|
||||
|
||||
|
||||
enum sci_status scic_io_request_construct_basic_sata(
|
||||
struct scic_sds_request *sci_req)
|
||||
enum sci_status scic_io_request_construct_basic_sata(struct scic_sds_request *sci_req)
|
||||
{
|
||||
enum sci_status status;
|
||||
struct scic_sds_stp_request *this_stp_request;
|
||||
u8 sat_protocol;
|
||||
u32 transfer_length;
|
||||
SCI_IO_REQUEST_DATA_DIRECTION data_direction;
|
||||
bool copy_rx_frame = false;
|
||||
struct scic_sds_stp_request *stp_req;
|
||||
u8 proto;
|
||||
u32 len;
|
||||
enum dma_data_direction dir;
|
||||
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;
|
||||
|
||||
transfer_length =
|
||||
scic_cb_io_request_get_transfer_length(sci_req->user_request);
|
||||
data_direction =
|
||||
scic_cb_io_request_get_data_direction(sci_req->user_request);
|
||||
len = scic_cb_io_request_get_transfer_length(sci_req->user_request);
|
||||
dir = scic_cb_io_request_get_data_direction(sci_req->user_request);
|
||||
proto = scic_cb_request_get_sat_protocol(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);
|
||||
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
|
||||
);
|
||||
status = scic_io_request_construct_sata(sci_req, proto, len, dir, copy);
|
||||
|
||||
if (status == SCI_SUCCESS)
|
||||
sci_base_state_machine_change_state(
|
||||
|
@ -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_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
|
||||
@ -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
|
||||
* returns an indication as to whether the construction was successful.
|
||||
*/
|
||||
static void scic_sds_stp_optimized_request_construct(
|
||||
struct scic_sds_request *this_request,
|
||||
u8 optimized_task_type,
|
||||
u32 transfer_length,
|
||||
SCI_IO_REQUEST_DATA_DIRECTION data_direction)
|
||||
static void scic_sds_stp_optimized_request_construct(struct scic_sds_request *sci_req,
|
||||
u8 optimized_task_type,
|
||||
u32 len,
|
||||
enum dma_data_direction dir)
|
||||
{
|
||||
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 */
|
||||
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 */
|
||||
scic_sds_request_build_sgl(this_request);
|
||||
scic_sds_request_build_sgl(sci_req);
|
||||
|
||||
/* 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
|
||||
* values are consistent with the difference between FPDMA READ
|
||||
@ -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 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 *this_request,
|
||||
u32 transfer_length,
|
||||
SCI_IO_REQUEST_DATA_DIRECTION data_direction)
|
||||
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(this_request);
|
||||
scic_sds_stp_non_ncq_request_construct(sci_req);
|
||||
|
||||
scic_sds_stp_optimized_request_construct(
|
||||
this_request,
|
||||
SCU_TASK_TYPE_DMA_IN,
|
||||
transfer_length,
|
||||
data_direction
|
||||
);
|
||||
scic_sds_stp_optimized_request_construct(sci_req, SCU_TASK_TYPE_DMA_IN,
|
||||
len, dir);
|
||||
|
||||
sci_base_state_machine_construct(
|
||||
&this_request->started_substate_machine,
|
||||
&this_request->parent.parent,
|
||||
&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
|
||||
);
|
||||
@ -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 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_ncq_request_construct(
|
||||
struct scic_sds_request *this_request,
|
||||
u32 transfer_length,
|
||||
SCI_IO_REQUEST_DATA_DIRECTION data_direction)
|
||||
enum sci_status scic_sds_stp_ncq_request_construct(struct scic_sds_request *sci_req,
|
||||
u32 len,
|
||||
enum dma_data_direction dir)
|
||||
{
|
||||
scic_sds_stp_optimized_request_construct(
|
||||
this_request,
|
||||
SCU_TASK_TYPE_FPDMAQ_READ,
|
||||
transfer_length,
|
||||
data_direction
|
||||
);
|
||||
scic_sds_stp_optimized_request_construct(sci_req,
|
||||
SCU_TASK_TYPE_FPDMAQ_READ,
|
||||
len, dir);
|
||||
return SCI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -56,6 +56,7 @@
|
||||
#ifndef _SCIC_SDS_STP_REQUEST_T_
|
||||
#define _SCIC_SDS_STP_REQUEST_T_
|
||||
|
||||
#include <linux/dma-mapping.h>
|
||||
#include "intel_sata.h"
|
||||
#include "sci_types.h"
|
||||
#include "scic_sds_request.h"
|
||||
@ -201,7 +202,7 @@ enum sci_status scic_sds_stp_pio_request_construct_pass_through(
|
||||
enum sci_status scic_sds_stp_udma_request_construct(
|
||||
struct scic_sds_request *this_request,
|
||||
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(
|
||||
struct scic_sds_request *this_request);
|
||||
@ -212,7 +213,7 @@ enum sci_status scic_sds_stp_soft_reset_request_construct(
|
||||
enum sci_status scic_sds_stp_ncq_request_construct(
|
||||
struct scic_sds_request *this_request,
|
||||
u32 transfer_length,
|
||||
SCI_IO_REQUEST_DATA_DIRECTION data_direction);
|
||||
enum dma_data_direction dir);
|
||||
|
||||
void scu_stp_raw_request_construct_task_context(
|
||||
struct scic_sds_stp_request *this_request,
|
||||
|
@ -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
|
||||
* 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(
|
||||
void *scic_user_io_request);
|
||||
enum dma_data_direction scic_cb_io_request_get_data_direction(void *req);
|
||||
|
||||
#ifndef SCI_SGL_OPTIMIZATION_ENABLED
|
||||
/**
|
||||
|
@ -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
|
||||
* object. It is a cookie that allows the user to provide the necessary
|
||||
* 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(
|
||||
void *scic_user_io_request)
|
||||
enum dma_data_direction scic_cb_io_request_get_data_direction(void *req)
|
||||
{
|
||||
return isci_request_io_request_get_data_direction(
|
||||
scic_user_io_request
|
||||
);
|
||||
return isci_request_io_request_get_data_direction(req);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1237,44 +1237,12 @@ u32 isci_request_io_request_get_transfer_length(struct isci_request *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 sas_task *task = isci_request_access_task(request);
|
||||
SCI_IO_REQUEST_DATA_DIRECTION ret;
|
||||
|
||||
switch (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;
|
||||
return task->data_dir;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -346,8 +346,7 @@ void isci_request_io_request_complete(
|
||||
u32 isci_request_io_request_get_transfer_length(
|
||||
struct isci_request *request);
|
||||
|
||||
SCI_IO_REQUEST_DATA_DIRECTION isci_request_io_request_get_data_direction(
|
||||
struct isci_request *request);
|
||||
enum dma_data_direction isci_request_io_request_get_data_direction(struct isci_request *req);
|
||||
|
||||
/**
|
||||
* isci_request_io_request_get_next_sge() - This function is called by the sci
|
||||
|
Loading…
Reference in New Issue
Block a user