isci: make command/response iu explicit request object members

Final elimination of the anonymous data at the end of the request
structure.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
Dan Williams 2011-05-08 02:35:32 -07:00
parent 26298264a5
commit b7645818cf
10 changed files with 101 additions and 420 deletions

View File

@ -103,14 +103,6 @@ typedef enum {
} SCIC_TRANSPORT_PROTOCOL;
/**
* scic_io_request_get_object_size() - This method simply returns the size
* required to build an SCI based IO request object.
*
* Return the size of the SCI IO request object.
*/
u32 scic_io_request_get_object_size(void);
/**
* scic_io_request_construct() - This method is called by the SCI user to
* construct all SCI Core IO requests. Memory initialization and
@ -222,32 +214,6 @@ enum sci_status scic_io_request_construct_smp(
u32 scic_request_get_controller_status(
struct scic_sds_request *io_request);
/**
* scic_io_request_get_command_iu_address() - This method will return the
* address to the command information unit.
* @scic_io_request: This parameter specifies the handle to the io request
* object to be built.
*
* The address of the SSP/SMP command information unit.
*/
void *scic_io_request_get_command_iu_address(
struct scic_sds_request *scic_io_request);
/**
* scic_io_request_get_response_iu_address() - This method will return the
* address to the response information unit. For an SSP request this buffer
* is only valid if the IO request is completed with the status
* SCI_FAILURE_IO_RESPONSE_VALID.
* @scic_io_request: This parameter specifies the handle to the io request
* object to be built.
*
* The address of the SSP/SMP response information unit.
*/
void *scic_io_request_get_response_iu_address(
struct scic_sds_request *scic_io_request);
/**
* scic_io_request_get_io_tag() - This method will return the IO tag utilized
* by the IO request.
@ -279,33 +245,6 @@ void scic_stp_io_request_set_ncq_tag(
struct scic_sds_request *scic_io_request,
u16 ncq_tag);
/**
* scic_stp_io_request_get_h2d_reg_address() - This method will return the
* address of the host to device register fis region for the io request
* object.
* @scic_io_request: This parameter specifies the handle to the io request
* object from which to get the host to device register fis buffer.
*
* The address of the host to device register fis buffer in the io request
* object. This function is only valid for SATA requests.
*/
void *scic_stp_io_request_get_h2d_reg_address(
struct scic_sds_request *scic_io_request);
/**
* scic_stp_io_request_get_d2h_reg_address() - This method will return the
* address of the device to host register fis region for the io request
* object.
* @scic_io_request: This parameter specifies teh handle to the io request
* object from which to get the device to host register fis buffer.
*
* The address fo the device to host register fis ending the io request. This
* function is only valid for SATA requests.
*/
void *scic_stp_io_request_get_d2h_reg_address(
struct scic_sds_request *scic_io_request);
/**
* scic_io_request_get_number_of_bytes_transferred() - This method will return
* the number of bytes transferred from the SCU

View File

@ -83,93 +83,6 @@
#define SCIC_SDS_IO_REQUEST_MINIMUM_TIMER_COUNT (0)
#define SCIC_SDS_IO_REQUEST_MAXIMUM_TIMER_COUNT (0)
/*
* ****************************************************************************
* * SCIC SDS IO REQUEST MACROS
* **************************************************************************** */
/**
* scic_ssp_io_request_get_object_size() -
*
* This macro returns the sizeof memory required to store the an SSP IO
* request. This does not include the size of the SGL or SCU Task Context
* memory.
*/
#define scic_ssp_io_request_get_object_size() \
(\
sizeof(struct ssp_cmd_iu) \
+ SSP_RESP_IU_MAX_SIZE \
)
/**
* scic_sds_ssp_request_get_command_buffer() -
*
* This macro returns the address of the ssp command buffer in the io request
* memory
*/
#define scic_sds_ssp_request_get_command_buffer(memory) \
((struct ssp_cmd_iu *)(\
((char *)(memory)) + sizeof(struct scic_sds_request) \
))
/**
* scic_sds_ssp_request_get_response_buffer() -
*
* This macro returns the address of the ssp response buffer in the io request
* memory
*/
#define scic_sds_ssp_request_get_response_buffer(memory) \
((struct ssp_response_iu *)(\
((char *)(scic_sds_ssp_request_get_command_buffer(memory))) \
+ sizeof(struct ssp_cmd_iu) \
))
/**
* scic_ssp_task_request_get_object_size() -
*
* This macro returns the sizeof of memory required to store an SSP Task
* request. This does not include the size of the SCU Task Context memory.
*/
#define scic_ssp_task_request_get_object_size() \
(\
sizeof(struct ssp_task_iu) \
+ SSP_RESP_IU_MAX_SIZE \
)
/**
* scic_sds_ssp_task_request_get_command_buffer() -
*
* This macro returns the address of the ssp command buffer in the task request
* memory. Yes its the same as the above macro except for the name.
*/
#define scic_sds_ssp_task_request_get_command_buffer(memory) \
((struct ssp_task_iu *)(\
((char *)(memory)) + sizeof(struct scic_sds_request) \
))
/**
* scic_sds_ssp_task_request_get_response_buffer() -
*
* This macro returns the address of the ssp response buffer in the task
* request memory.
*/
#define scic_sds_ssp_task_request_get_response_buffer(memory) \
((struct ssp_response_iu *)(\
((char *)(scic_sds_ssp_task_request_get_command_buffer(memory))) \
+ sizeof(struct ssp_task_iu) \
))
/**
*
*
* This method returns the size required to store an SSP IO request object. u32
*/
static u32 scic_sds_ssp_request_get_object_size(void)
{
return sizeof(struct scic_sds_request)
+ scic_ssp_io_request_get_object_size();
}
/**
* This method returns the sgl element pair for the specificed sgl_pair index.
* @sci_req: This parameter specifies the IO request for which to retrieve
@ -268,21 +181,8 @@ void scic_sds_request_build_sgl(struct scic_sds_request *sds_request)
}
}
/**
* This method build the remainder of the IO request object.
* @sci_req: This parameter specifies the request object being constructed.
*
* The scic_sds_general_request_construct() must be called before this call is
* valid. none
*/
static void scic_sds_ssp_io_request_assign_buffers(
struct scic_sds_request *sci_req)
static void scic_sds_ssp_io_request_assign_buffers(struct scic_sds_request *sci_req)
{
sci_req->command_buffer =
scic_sds_ssp_request_get_command_buffer(sci_req);
sci_req->response_buffer =
scic_sds_ssp_request_get_response_buffer(sci_req);
if (sci_req->was_tag_assigned_by_user == false)
sci_req->task_context_buffer = &sci_req->tc;
}
@ -293,7 +193,7 @@ static void scic_sds_io_request_build_ssp_command_iu(struct scic_sds_request *sc
struct isci_request *ireq = sci_req->ireq;
struct sas_task *task = isci_request_access_task(ireq);
cmd_iu = sci_req->command_buffer;
cmd_iu = &sci_req->ssp.cmd;
memcpy(cmd_iu->LUN, task->ssp_task.LUN, 8);
cmd_iu->add_cdb_len = 0;
@ -315,7 +215,7 @@ static void scic_sds_task_request_build_ssp_task_iu(struct scic_sds_request *sci
struct sas_task *task = isci_request_access_task(ireq);
struct isci_tmf *isci_tmf = isci_request_access_tmf(ireq);
task_iu = sci_req->command_buffer;
task_iu = &sci_req->ssp.tmf;
memset(task_iu, 0, sizeof(struct ssp_task_iu));
@ -411,7 +311,7 @@ static void scu_ssp_reqeust_construct_task_context(
* SCU Task Context
*/
dma_addr = scic_io_request_get_dma_addr(sds_request,
sds_request->command_buffer);
&sds_request->ssp.cmd);
task_context->command_iu_upper = upper_32_bits(dma_addr);
task_context->command_iu_lower = lower_32_bits(dma_addr);
@ -421,7 +321,7 @@ static void scu_ssp_reqeust_construct_task_context(
* SCU Task Context
*/
dma_addr = scic_io_request_get_dma_addr(sds_request,
sds_request->response_buffer);
&sds_request->ssp.rsp);
task_context->response_iu_upper = upper_32_bits(dma_addr);
task_context->response_iu_lower = lower_32_bits(dma_addr);
@ -464,22 +364,8 @@ static void scu_ssp_io_request_construct_task_context(
scic_sds_request_build_sgl(sci_req);
}
/**
* This method will fill in the remainder of the io request object for SSP Task
* requests.
* @sci_req:
*
*/
static void scic_sds_ssp_task_request_assign_buffers(
struct scic_sds_request *sci_req)
static void scic_sds_ssp_task_request_assign_buffers(struct scic_sds_request *sci_req)
{
/* Assign all of the buffer pointers */
sci_req->command_buffer =
scic_sds_ssp_task_request_get_command_buffer(sci_req);
sci_req->response_buffer =
scic_sds_ssp_task_request_get_response_buffer(sci_req);
if (sci_req->was_tag_assigned_by_user == false)
sci_req->task_context_buffer = &sci_req->tc;
}
@ -589,19 +475,6 @@ scic_io_request_construct_sata(struct scic_sds_request *sci_req,
return status;
}
u32 scic_io_request_get_object_size(void)
{
u32 ssp_request_size;
u32 stp_request_size;
u32 smp_request_size;
ssp_request_size = scic_sds_ssp_request_get_object_size();
stp_request_size = scic_sds_stp_request_get_object_size();
smp_request_size = scic_sds_smp_request_get_object_size();
return max(ssp_request_size, max(stp_request_size, smp_request_size));
}
enum sci_status scic_io_request_construct_basic_ssp(
struct scic_sds_request *sci_req)
{
@ -712,21 +585,6 @@ u32 scic_request_get_controller_status(
return sci_req->scu_status;
}
void *scic_io_request_get_command_iu_address(
struct scic_sds_request *sci_req)
{
return sci_req->command_buffer;
}
void *scic_io_request_get_response_iu_address(
struct scic_sds_request *sci_req)
{
return sci_req->response_buffer;
}
#define SCU_TASK_CONTEXT_SRAM 0x200000
u32 scic_io_request_get_number_of_bytes_transferred(
struct scic_sds_request *scic_sds_request)
@ -885,7 +743,7 @@ void scic_sds_io_request_copy_response(struct scic_sds_request *sci_req)
struct isci_request *ireq = sci_req->ireq;
struct isci_tmf *isci_tmf = isci_request_access_tmf(ireq);
ssp_response = sci_req->response_buffer;
ssp_response = &sci_req->ssp.rsp;
resp_buf = &isci_tmf->resp.resp_iu;
@ -1053,11 +911,11 @@ scic_sds_request_started_state_tc_completion_handler(
* truly a failed request or a good request that just got
* completed early.
*/
struct ssp_response_iu *resp = sci_req->response_buffer;
struct ssp_response_iu *resp = &sci_req->ssp.rsp;
ssize_t word_cnt = SSP_RESP_IU_MAX_SIZE / sizeof(u32);
sci_swab32_cpy(sci_req->response_buffer,
sci_req->response_buffer,
sci_swab32_cpy(&sci_req->ssp.rsp,
&sci_req->ssp.rsp,
word_cnt);
if (resp->status == 0) {
@ -1078,8 +936,8 @@ scic_sds_request_started_state_tc_completion_handler(
{
ssize_t word_cnt = SSP_RESP_IU_MAX_SIZE / sizeof(u32);
sci_swab32_cpy(sci_req->response_buffer,
sci_req->response_buffer,
sci_swab32_cpy(&sci_req->ssp.rsp,
&sci_req->ssp.rsp,
word_cnt);
scic_sds_request_set_status(sci_req,
@ -1094,7 +952,7 @@ scic_sds_request_started_state_tc_completion_handler(
* guaranteed to be received before this completion status is
* posted?
*/
resp_iu = sci_req->response_buffer;
resp_iu = &sci_req->ssp.rsp;
datapres = resp_iu->datapres;
if ((datapres == 0x01) || (datapres == 0x02)) {
@ -1222,10 +1080,10 @@ scic_sds_request_started_state_frame_handler(struct scic_sds_request *sci_req,
frame_index,
(void **)&resp_iu);
sci_swab32_cpy(sci_req->response_buffer,
sci_swab32_cpy(&sci_req->ssp.rsp,
resp_iu, word_cnt);
resp_iu = sci_req->response_buffer;
resp_iu = &sci_req->ssp.rsp;
if ((resp_iu->datapres == 0x01) ||
(resp_iu->datapres == 0x02)) {
@ -1627,12 +1485,10 @@ scic_io_request_construct(struct scic_sds_controller *scic,
else if ((dev->dev_type == SATA_DEV) ||
(dev->tproto & SAS_PROTOCOL_STP)) {
scic_sds_stp_request_assign_buffers(sci_req);
memset(sci_req->command_buffer,
0,
sizeof(struct host_to_dev_fis));
memset(&sci_req->stp.cmd, 0, sizeof(sci_req->stp.cmd));
} else if (dev_is_expander(dev)) {
scic_sds_smp_request_assign_buffers(sci_req);
memset(sci_req->command_buffer, 0, sizeof(struct smp_req));
memset(&sci_req->smp.cmd, 0, sizeof(sci_req->smp.cmd));
} else
status = SCI_FAILURE_UNSUPPORTED_PROTOCOL;

View File

@ -61,6 +61,7 @@
#include "scu_task_context.h"
#include "scic_sds_stp_request.h"
#include "scu_constants.h"
#include "sas.h"
struct scic_sds_controller;
struct scic_sds_remote_device;
@ -181,8 +182,6 @@ struct scic_sds_request {
*/
u32 post_context;
void *command_buffer;
void *response_buffer;
struct scu_task_context *task_context_buffer;
struct scu_task_context tc ____cacheline_aligned;
@ -232,9 +231,30 @@ struct scic_sds_request {
*/
u8 device_sequence;
struct {
struct scic_sds_stp_request req;
} stp;
union {
struct {
union {
struct ssp_cmd_iu cmd;
struct ssp_task_iu tmf;
};
union {
struct ssp_response_iu rsp;
u8 rsp_buf[SSP_RESP_IU_MAX_SIZE];
};
} ssp;
struct {
struct smp_req cmd;
struct smp_resp rsp;
} smp;
struct {
struct scic_sds_stp_request req;
struct host_to_dev_fis cmd;
struct dev_to_host_fis rsp;
} stp;
};
};
static inline struct scic_sds_request *to_sci_req(struct scic_sds_stp_request *stp_req)

View File

@ -69,45 +69,8 @@ static void scu_smp_request_construct_task_context(
struct scic_sds_request *sci_req,
struct smp_req *smp_req);
/**
*
*
* This method return the memory space required for STP PIO requests. u32
*/
u32 scic_sds_smp_request_get_object_size(void)
{
return sizeof(struct scic_sds_request)
+ sizeof(struct smp_req)
+ sizeof(struct smp_resp);
}
/**
* scic_sds_smp_request_get_command_buffer() -
*
* This macro returns the address of the smp command buffer in the smp request
* memory. No need to cast to SMP request type.
*/
#define scic_sds_smp_request_get_command_buffer(memory) \
(((char *)(memory)) + sizeof(struct scic_sds_request))
/**
* scic_sds_smp_request_get_response_buffer() -
*
* This macro returns the address of the smp response buffer in the smp request
* memory.
*/
#define scic_sds_smp_request_get_response_buffer(memory) \
(((char *)(scic_sds_smp_request_get_command_buffer(memory))) \
+ sizeof(struct smp_req))
void scic_sds_smp_request_assign_buffers(struct scic_sds_request *sci_req)
{
/* Assign all of the buffer pointers */
sci_req->command_buffer =
scic_sds_smp_request_get_command_buffer(sci_req);
sci_req->response_buffer =
scic_sds_smp_request_get_response_buffer(sci_req);
if (sci_req->was_tag_assigned_by_user == false)
sci_req->task_context_buffer = &sci_req->tc;
}
@ -135,7 +98,7 @@ scu_smp_request_construct_task_context(struct scic_sds_request *sci_req,
ssize_t word_cnt = sizeof(struct smp_req) / sizeof(u32);
/* byte swap the smp request. */
sci_swab32_cpy(sci_req->command_buffer, smp_req,
sci_swab32_cpy(&sci_req->smp.cmd, smp_req,
word_cnt);
task_context = scic_sds_request_get_task_context(sci_req);
@ -185,9 +148,7 @@ scu_smp_request_construct_task_context(struct scic_sds_request *sci_req,
* 18h ~ 30h, protocol specific
* since commandIU has been build by framework at this point, we just
* copy the frist DWord from command IU to this location. */
memcpy((void *)(&task_context->type.smp),
sci_req->command_buffer,
sizeof(u32));
memcpy(&task_context->type.smp, &sci_req->smp.cmd, sizeof(u32));
/*
* 40h
@ -228,8 +189,7 @@ scu_smp_request_construct_task_context(struct scic_sds_request *sci_req,
* Context command buffer should not contain command header.
*/
dma_addr = scic_io_request_get_dma_addr(sci_req,
(char *)
(sci_req->command_buffer) +
((char *) &sci_req->smp.cmd) +
sizeof(u32));
task_context->command_iu_upper = upper_32_bits(dma_addr);
@ -255,14 +215,12 @@ scu_smp_request_construct_task_context(struct scic_sds_request *sci_req,
* indicates successful processing of the TC response.
*/
static enum sci_status
scic_sds_smp_request_await_response_frame_handler(
struct scic_sds_request *sci_req,
u32 frame_index)
scic_sds_smp_request_await_response_frame_handler(struct scic_sds_request *sci_req,
u32 frame_index)
{
enum sci_status status;
void *frame_header;
struct smp_resp *rsp_hdr;
u8 *usr_smp_buf = sci_req->response_buffer;
struct smp_resp *rsp_hdr = &sci_req->smp.rsp;
ssize_t word_cnt = SMP_RESP_HDR_SZ / sizeof(u32);
status = scic_sds_unsolicited_frame_control_get_header(
@ -271,9 +229,7 @@ scic_sds_smp_request_await_response_frame_handler(
&frame_header);
/* byte swap the header. */
sci_swab32_cpy(usr_smp_buf, frame_header, word_cnt);
rsp_hdr = (struct smp_resp *)usr_smp_buf;
sci_swab32_cpy(rsp_hdr, frame_header, word_cnt);
if (rsp_hdr->frame_type == SMP_RESPONSE) {
void *smp_resp;
@ -286,7 +242,7 @@ scic_sds_smp_request_await_response_frame_handler(
word_cnt = (sizeof(struct smp_req) - SMP_RESP_HDR_SZ) /
sizeof(u32);
sci_swab32_cpy(usr_smp_buf + SMP_RESP_HDR_SZ,
sci_swab32_cpy(((u8 *) rsp_hdr) + SMP_RESP_HDR_SZ,
smp_resp, word_cnt);
scic_sds_request_set_status(
@ -532,7 +488,7 @@ enum sci_status scic_io_request_construct_smp(struct scic_sds_request *sci_req)
);
/* Construct the SMP SCU Task Context */
memcpy(smp_req, sci_req->command_buffer, sizeof(*smp_req));
memcpy(smp_req, &sci_req->smp.cmd, sizeof(*smp_req));
/*
* Look at the SMP requests' header fields; for certain SAS 1.x SMP

View File

@ -70,48 +70,8 @@
#include "scu_event_codes.h"
#include "scu_task_context.h"
/**
* scic_sds_stp_request_get_h2d_reg_buffer() -
*
* This macro returns the address of the stp h2d reg fis buffer in the io
* request memory
*/
#define scic_sds_stp_request_get_h2d_reg_buffer(memory) \
((struct host_to_dev_fis *)(\
((char *)(memory)) + sizeof(struct scic_sds_stp_request) \
))
/**
* scic_sds_stp_request_get_response_buffer() -
*
* This macro returns the address of the ssp response iu buffer in the io
* request memory
*/
#define scic_sds_stp_request_get_response_buffer(memory) \
((struct dev_to_host_fis *)(\
((char *)(scic_sds_stp_request_get_h2d_reg_buffer(memory))) \
+ sizeof(struct host_to_dev_fis) \
))
/**
*
*
* This method return the memory space required for STP PIO requests. u32
*/
u32 scic_sds_stp_request_get_object_size(void)
{
return sizeof(struct scic_sds_stp_request)
+ sizeof(struct host_to_dev_fis)
+ sizeof(struct dev_to_host_fis);
}
void scic_sds_stp_request_assign_buffers(struct scic_sds_request *sci_req)
{
struct scic_sds_stp_request *stp_req = &sci_req->stp.req;
sci_req->command_buffer = scic_sds_stp_request_get_h2d_reg_buffer(stp_req);
sci_req->response_buffer = scic_sds_stp_request_get_response_buffer(stp_req);
if (sci_req->was_tag_assigned_by_user == false)
sci_req->task_context_buffer = &sci_req->tc;
}
@ -129,7 +89,7 @@ void scic_sds_stp_request_assign_buffers(struct scic_sds_request *sci_req)
* determine what is common for SSP/SMP/STP task context structures.
*/
static void scu_sata_reqeust_construct_task_context(
struct scic_sds_request *sds_request,
struct scic_sds_request *sci_req,
struct scu_task_context *task_context)
{
dma_addr_t dma_addr;
@ -137,9 +97,9 @@ static void scu_sata_reqeust_construct_task_context(
struct scic_sds_remote_device *target_device;
struct scic_sds_port *target_port;
controller = scic_sds_request_get_controller(sds_request);
target_device = scic_sds_request_get_device(sds_request);
target_port = scic_sds_request_get_port(sds_request);
controller = scic_sds_request_get_controller(sci_req);
target_device = scic_sds_request_get_device(sci_req);
target_port = scic_sds_request_get_port(sci_req);
/* Fill in the TC with the its required data */
task_context->abort = 0;
@ -155,7 +115,7 @@ static void scu_sata_reqeust_construct_task_context(
task_context->context_type = SCU_TASK_CONTEXT_TYPE;
task_context->remote_node_index =
scic_sds_remote_device_get_index(sds_request->target_device);
scic_sds_remote_device_get_index(sci_req->target_device);
task_context->command_code = 0;
task_context->link_layer_control = 0;
@ -172,21 +132,21 @@ static void scu_sata_reqeust_construct_task_context(
(sizeof(struct host_to_dev_fis) - sizeof(u32)) / sizeof(u32);
/* Set the first word of the H2D REG FIS */
task_context->type.words[0] = *(u32 *)sds_request->command_buffer;
task_context->type.words[0] = *(u32 *)&sci_req->stp.cmd;
if (sds_request->was_tag_assigned_by_user) {
if (sci_req->was_tag_assigned_by_user) {
/*
* Build the task context now since we have already read
* the data
*/
sds_request->post_context =
sci_req->post_context =
(SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC |
(scic_sds_controller_get_protocol_engine_group(
controller) <<
SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT) |
(scic_sds_port_get_index(target_port) <<
SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT) |
scic_sds_io_tag_get_index(sds_request->io_tag));
scic_sds_io_tag_get_index(sci_req->io_tag));
} else {
/*
* Build the task context now since we have already read
@ -194,7 +154,7 @@ static void scu_sata_reqeust_construct_task_context(
* I/O tag index is not assigned because we have to wait
* until we get a TCi.
*/
sds_request->post_context =
sci_req->post_context =
(SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC |
(scic_sds_controller_get_protocol_engine_group(
controller) <<
@ -208,11 +168,9 @@ static void scu_sata_reqeust_construct_task_context(
* Context. We must offset the command buffer by 4 bytes because the
* first 4 bytes are transfered in the body of the TC.
*/
dma_addr =
scic_io_request_get_dma_addr(sds_request,
(char *)sds_request->
command_buffer +
sizeof(u32));
dma_addr = scic_io_request_get_dma_addr(sci_req,
((char *) &sci_req->stp.cmd) +
sizeof(u32));
task_context->command_iu_upper = upper_32_bits(dma_addr);
task_context->command_iu_lower = lower_32_bits(dma_addr);
@ -334,21 +292,6 @@ void scic_stp_io_request_set_ncq_tag(
req->task_context_buffer->type.stp.ncq_tag = ncq_tag;
}
void *scic_stp_io_request_get_h2d_reg_address(
struct scic_sds_request *req)
{
return req->command_buffer;
}
void *scic_stp_io_request_get_d2h_reg_address(struct scic_sds_request *sci_req)
{
struct scic_sds_stp_request *stp_req = &sci_req->stp.req;
return &stp_req->d2h_reg_fis;
}
/**
*
* @sci_req:
@ -478,7 +421,7 @@ static enum sci_status scic_sds_stp_request_non_data_await_d2h_frame_handler(
frame_index,
(void **)&frame_buffer);
scic_sds_controller_copy_sata_response(&stp_req->d2h_reg_fis,
scic_sds_controller_copy_sata_response(&sci_req->stp.rsp,
frame_header,
frame_buffer);
@ -830,11 +773,11 @@ static enum sci_status scic_sds_stp_request_pio_await_frame_frame_handler(struct
/* ending_status: 4th byte in the 3rd dword */
stp_req->type.pio.ending_status = (frame_buffer[2] >> 24) & 0xff;
scic_sds_controller_copy_sata_response(&stp_req->d2h_reg_fis,
scic_sds_controller_copy_sata_response(&sci_req->stp.rsp,
frame_header,
frame_buffer);
stp_req->d2h_reg_fis.status = stp_req->type.pio.ending_status;
sci_req->stp.rsp.status = stp_req->type.pio.ending_status;
/* The next state is dependent on whether the
* request was PIO Data-in or Data out
@ -873,7 +816,7 @@ static enum sci_status scic_sds_stp_request_pio_await_frame_frame_handler(struct
frame_index,
(void **)&frame_buffer);
scic_sds_controller_copy_sata_response(&stp_req->d2h_reg_fis,
scic_sds_controller_copy_sata_response(&sci_req->stp.req,
frame_header,
frame_buffer);
@ -1220,7 +1163,6 @@ static enum sci_status scic_sds_stp_request_udma_general_frame_handler(struct sc
u32 frame_index)
{
struct scic_sds_controller *scic = sci_req->owning_controller;
struct scic_sds_stp_request *stp_req = &sci_req->stp.req;
struct dev_to_host_fis *frame_header;
enum sci_status status;
u32 *frame_buffer;
@ -1235,7 +1177,7 @@ static enum sci_status scic_sds_stp_request_udma_general_frame_handler(struct sc
frame_index,
(void **)&frame_buffer);
scic_sds_controller_copy_sata_response(&stp_req->d2h_reg_fis,
scic_sds_controller_copy_sata_response(&sci_req->stp.rsp,
frame_header,
frame_buffer);
}
@ -1249,7 +1191,6 @@ static enum sci_status scic_sds_stp_request_udma_await_tc_completion_tc_completi
struct scic_sds_request *sci_req,
u32 completion_code)
{
struct scic_sds_stp_request *stp_req = &sci_req->stp.req;
enum sci_status status = SCI_SUCCESS;
switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) {
@ -1263,7 +1204,7 @@ static enum sci_status scic_sds_stp_request_udma_await_tc_completion_tc_completi
/*
* We must check ther response buffer to see if the D2H Register FIS was
* received before we got the TC completion. */
if (stp_req->d2h_reg_fis.fis_type == FIS_REGD2H) {
if (sci_req->stp.rsp.fis_type == FIS_REGD2H) {
scic_sds_remote_device_suspend(sci_req->target_device,
SCU_EVENT_SPECIFIC(SCU_NORMALIZE_COMPLETION_STATUS(completion_code)));
@ -1523,7 +1464,7 @@ static enum sci_status scic_sds_stp_request_soft_reset_await_d2h_frame_handler(
frame_index,
(void **)&frame_buffer);
scic_sds_controller_copy_sata_response(&stp_req->d2h_reg_fis,
scic_sds_controller_copy_sata_response(&sci_req->stp.rsp,
frame_header,
frame_buffer);
@ -1595,7 +1536,7 @@ static void scic_sds_stp_request_started_soft_reset_await_h2d_diagnostic_complet
enum sci_status status;
/* Clear the SRST bit */
h2d_fis = scic_stp_io_request_get_h2d_reg_address(sci_req);
h2d_fis = &sci_req->stp.cmd;
h2d_fis->control = 0;
/* Clear the TC control bit */

View File

@ -60,8 +60,6 @@
#include <scsi/sas.h>
struct scic_sds_stp_request {
struct dev_to_host_fis d2h_reg_fis;
union {
u32 ncq;

View File

@ -433,7 +433,7 @@ int isci_host_init(struct isci_host *isci_host)
* when trying to convert virtual addresses to physical addresses
*/
isci_host->dma_pool_alloc_size = sizeof(struct isci_request) +
scic_io_request_get_object_size();
sizeof(struct scic_sds_request);
isci_host->dma_pool = dmam_pool_create(DRV_NAME, &isci_host->pdev->dev,
isci_host->dma_pool_alloc_size,
SLAB_HWCACHE_ALIGN, 0);

View File

@ -126,7 +126,6 @@ static enum sci_status isci_smp_request_build(struct isci_request *ireq)
enum sci_status status = SCI_FAILURE;
struct sas_task *task = isci_request_access_task(ireq);
struct scic_sds_request *sci_req = ireq->sci_request_handle;
void *cmd_iu = sci_req->command_buffer;
dev_dbg(&ireq->isci_host->pdev->dev,
"%s: request = %p\n", __func__, ireq);
@ -138,7 +137,7 @@ static enum sci_status isci_smp_request_build(struct isci_request *ireq)
/* copy the smp_command to the address; */
sg_copy_to_buffer(&task->smp_task.smp_req, 1,
(char *)cmd_iu,
&sci_req->smp.cmd,
sizeof(struct smp_req));
status = scic_io_request_construct_smp(sci_req);
@ -998,25 +997,15 @@ void isci_request_io_request_complete(
task);
if (sas_protocol_ata(task->task_proto)) {
resp_buf
= scic_stp_io_request_get_d2h_reg_address(
request->sci_request_handle
);
resp_buf = &request->sci_request_handle->stp.rsp;
isci_request_process_stp_response(task,
resp_buf
);
resp_buf);
} else if (SAS_PROTOCOL_SSP == task->task_proto) {
/* crack the iu response buffer. */
resp_iu
= scic_io_request_get_response_iu_address(
request->sci_request_handle
);
resp_iu = &request->sci_request_handle->ssp.rsp;
isci_request_process_response_iu(task, resp_iu,
&isci_host->pdev->dev
);
&isci_host->pdev->dev);
} else if (SAS_PROTOCOL_SMP == task->task_proto) {
@ -1045,11 +1034,7 @@ void isci_request_io_request_complete(
request->complete_in_target = true;
if (task->task_proto == SAS_PROTOCOL_SMP) {
u8 *command_iu_address
= scic_io_request_get_command_iu_address(
request->sci_request_handle
);
void *rsp = &request->sci_request_handle->smp.rsp;
dev_dbg(&isci_host->pdev->dev,
"%s: SMP protocol completion\n",
@ -1057,9 +1042,7 @@ void isci_request_io_request_complete(
sg_copy_from_buffer(
&task->smp_task.smp_resp, 1,
command_iu_address
+ sizeof(struct smp_req),
sizeof(struct smp_resp));
rsp, sizeof(struct smp_resp));
} else if (completion_status
== SCI_IO_SUCCESS_IO_DONE_EARLY) {

View File

@ -71,24 +71,17 @@
*/
struct host_to_dev_fis *isci_sata_task_to_fis_copy(struct sas_task *task)
{
struct isci_request *request = task->lldd_task;
struct host_to_dev_fis *register_fis =
scic_stp_io_request_get_h2d_reg_address(
request->sci_request_handle
);
struct isci_request *ireq = task->lldd_task;
struct host_to_dev_fis *fis = &ireq->sci_request_handle->stp.cmd;
memcpy(
(u8 *)register_fis,
(u8 *)&task->ata_task.fis,
sizeof(struct host_to_dev_fis)
);
memcpy(fis, &task->ata_task.fis, sizeof(struct host_to_dev_fis));
if (!task->ata_task.device_control_reg_update)
register_fis->flags |= 0x80;
fis->flags |= 0x80;
register_fis->flags &= 0xF0;
fis->flags &= 0xF0;
return register_fis;
return fis;
}
/**
@ -161,36 +154,32 @@ void isci_request_process_stp_response(struct sas_task *task,
ts->resp = SAS_TASK_COMPLETE;
}
enum sci_status isci_sata_management_task_request_build(
struct isci_request *isci_request)
enum sci_status isci_sata_management_task_request_build(struct isci_request *ireq)
{
struct scic_sds_request *sci_req = ireq->sci_request_handle;
struct isci_tmf *isci_tmf;
enum sci_status status;
if (tmf_task != isci_request->ttype)
if (tmf_task != ireq->ttype)
return SCI_FAILURE;
isci_tmf = isci_request_access_tmf(isci_request);
isci_tmf = isci_request_access_tmf(ireq);
switch (isci_tmf->tmf_code) {
case isci_tmf_sata_srst_high:
case isci_tmf_sata_srst_low:
{
struct host_to_dev_fis *register_fis =
scic_stp_io_request_get_h2d_reg_address(
isci_request->sci_request_handle
);
case isci_tmf_sata_srst_low: {
struct host_to_dev_fis *fis = &sci_req->stp.cmd;
memset(register_fis, 0, sizeof(*register_fis));
memset(fis, 0, sizeof(*fis));
register_fis->fis_type = 0x27;
register_fis->flags &= ~0x80;
register_fis->flags &= 0xF0;
fis->fis_type = 0x27;
fis->flags &= ~0x80;
fis->flags &= 0xF0;
if (isci_tmf->tmf_code == isci_tmf_sata_srst_high)
register_fis->control |= ATA_SRST;
fis->control |= ATA_SRST;
else
register_fis->control &= ~ATA_SRST;
fis->control &= ~ATA_SRST;
break;
}
/* other management commnd go here... */
@ -202,7 +191,7 @@ enum sci_status isci_sata_management_task_request_build(
* based on the h2d fis.
*/
status = scic_task_request_construct_sata(
isci_request->sci_request_handle
ireq->sci_request_handle
);
return status;

View File

@ -1431,7 +1431,6 @@ isci_task_request_complete(struct isci_host *ihost,
struct isci_tmf *tmf = isci_request_access_tmf(ireq);
struct completion *tmf_complete;
struct scic_sds_request *sci_req = ireq->sci_request_handle;
struct scic_sds_stp_request *stp_req = &sci_req->stp.req;
dev_dbg(&ihost->pdev->dev,
"%s: request = %p, status=%d\n",
@ -1444,11 +1443,11 @@ isci_task_request_complete(struct isci_host *ihost,
if (tmf->proto == SAS_PROTOCOL_SSP) {
memcpy(&tmf->resp.resp_iu,
sci_req->response_buffer,
&sci_req->ssp.rsp,
SSP_RESP_IU_MAX_SIZE);
} else if (tmf->proto == SAS_PROTOCOL_SATA) {
memcpy(&tmf->resp.d2h_fis,
&stp_req->d2h_reg_fis,
&sci_req->stp.rsp,
sizeof(struct dev_to_host_fis));
}