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:
parent
26298264a5
commit
b7645818cf
|
@ -103,14 +103,6 @@ typedef enum {
|
||||||
} SCIC_TRANSPORT_PROTOCOL;
|
} 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
|
* scic_io_request_construct() - This method is called by the SCI user to
|
||||||
* construct all SCI Core IO requests. Memory initialization and
|
* 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(
|
u32 scic_request_get_controller_status(
|
||||||
struct scic_sds_request *io_request);
|
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
|
* scic_io_request_get_io_tag() - This method will return the IO tag utilized
|
||||||
* by the IO request.
|
* by the IO request.
|
||||||
|
@ -279,33 +245,6 @@ void scic_stp_io_request_set_ncq_tag(
|
||||||
struct scic_sds_request *scic_io_request,
|
struct scic_sds_request *scic_io_request,
|
||||||
u16 ncq_tag);
|
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
|
* scic_io_request_get_number_of_bytes_transferred() - This method will return
|
||||||
* the number of bytes transferred from the SCU
|
* the number of bytes transferred from the SCU
|
||||||
|
|
|
@ -83,93 +83,6 @@
|
||||||
#define SCIC_SDS_IO_REQUEST_MINIMUM_TIMER_COUNT (0)
|
#define SCIC_SDS_IO_REQUEST_MINIMUM_TIMER_COUNT (0)
|
||||||
#define SCIC_SDS_IO_REQUEST_MAXIMUM_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.
|
* 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
|
* @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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static void scic_sds_ssp_io_request_assign_buffers(struct scic_sds_request *sci_req)
|
||||||
* 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)
|
|
||||||
{
|
{
|
||||||
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)
|
if (sci_req->was_tag_assigned_by_user == false)
|
||||||
sci_req->task_context_buffer = &sci_req->tc;
|
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 isci_request *ireq = sci_req->ireq;
|
||||||
struct sas_task *task = isci_request_access_task(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);
|
memcpy(cmd_iu->LUN, task->ssp_task.LUN, 8);
|
||||||
cmd_iu->add_cdb_len = 0;
|
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 sas_task *task = isci_request_access_task(ireq);
|
||||||
struct isci_tmf *isci_tmf = isci_request_access_tmf(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));
|
memset(task_iu, 0, sizeof(struct ssp_task_iu));
|
||||||
|
|
||||||
|
@ -411,7 +311,7 @@ static void scu_ssp_reqeust_construct_task_context(
|
||||||
* SCU Task Context
|
* SCU Task Context
|
||||||
*/
|
*/
|
||||||
dma_addr = scic_io_request_get_dma_addr(sds_request,
|
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_upper = upper_32_bits(dma_addr);
|
||||||
task_context->command_iu_lower = lower_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
|
* SCU Task Context
|
||||||
*/
|
*/
|
||||||
dma_addr = scic_io_request_get_dma_addr(sds_request,
|
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_upper = upper_32_bits(dma_addr);
|
||||||
task_context->response_iu_lower = lower_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);
|
scic_sds_request_build_sgl(sci_req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void scic_sds_ssp_task_request_assign_buffers(struct scic_sds_request *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)
|
|
||||||
{
|
{
|
||||||
/* 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)
|
if (sci_req->was_tag_assigned_by_user == false)
|
||||||
sci_req->task_context_buffer = &sci_req->tc;
|
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;
|
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(
|
enum sci_status scic_io_request_construct_basic_ssp(
|
||||||
struct scic_sds_request *sci_req)
|
struct scic_sds_request *sci_req)
|
||||||
{
|
{
|
||||||
|
@ -712,21 +585,6 @@ u32 scic_request_get_controller_status(
|
||||||
return sci_req->scu_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
|
#define SCU_TASK_CONTEXT_SRAM 0x200000
|
||||||
u32 scic_io_request_get_number_of_bytes_transferred(
|
u32 scic_io_request_get_number_of_bytes_transferred(
|
||||||
struct scic_sds_request *scic_sds_request)
|
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_request *ireq = sci_req->ireq;
|
||||||
struct isci_tmf *isci_tmf = isci_request_access_tmf(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;
|
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
|
* truly a failed request or a good request that just got
|
||||||
* completed early.
|
* 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);
|
ssize_t word_cnt = SSP_RESP_IU_MAX_SIZE / sizeof(u32);
|
||||||
|
|
||||||
sci_swab32_cpy(sci_req->response_buffer,
|
sci_swab32_cpy(&sci_req->ssp.rsp,
|
||||||
sci_req->response_buffer,
|
&sci_req->ssp.rsp,
|
||||||
word_cnt);
|
word_cnt);
|
||||||
|
|
||||||
if (resp->status == 0) {
|
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);
|
ssize_t word_cnt = SSP_RESP_IU_MAX_SIZE / sizeof(u32);
|
||||||
|
|
||||||
sci_swab32_cpy(sci_req->response_buffer,
|
sci_swab32_cpy(&sci_req->ssp.rsp,
|
||||||
sci_req->response_buffer,
|
&sci_req->ssp.rsp,
|
||||||
word_cnt);
|
word_cnt);
|
||||||
|
|
||||||
scic_sds_request_set_status(sci_req,
|
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
|
* guaranteed to be received before this completion status is
|
||||||
* posted?
|
* posted?
|
||||||
*/
|
*/
|
||||||
resp_iu = sci_req->response_buffer;
|
resp_iu = &sci_req->ssp.rsp;
|
||||||
datapres = resp_iu->datapres;
|
datapres = resp_iu->datapres;
|
||||||
|
|
||||||
if ((datapres == 0x01) || (datapres == 0x02)) {
|
if ((datapres == 0x01) || (datapres == 0x02)) {
|
||||||
|
@ -1222,10 +1080,10 @@ scic_sds_request_started_state_frame_handler(struct scic_sds_request *sci_req,
|
||||||
frame_index,
|
frame_index,
|
||||||
(void **)&resp_iu);
|
(void **)&resp_iu);
|
||||||
|
|
||||||
sci_swab32_cpy(sci_req->response_buffer,
|
sci_swab32_cpy(&sci_req->ssp.rsp,
|
||||||
resp_iu, word_cnt);
|
resp_iu, word_cnt);
|
||||||
|
|
||||||
resp_iu = sci_req->response_buffer;
|
resp_iu = &sci_req->ssp.rsp;
|
||||||
|
|
||||||
if ((resp_iu->datapres == 0x01) ||
|
if ((resp_iu->datapres == 0x01) ||
|
||||||
(resp_iu->datapres == 0x02)) {
|
(resp_iu->datapres == 0x02)) {
|
||||||
|
@ -1627,12 +1485,10 @@ scic_io_request_construct(struct scic_sds_controller *scic,
|
||||||
else if ((dev->dev_type == SATA_DEV) ||
|
else if ((dev->dev_type == SATA_DEV) ||
|
||||||
(dev->tproto & SAS_PROTOCOL_STP)) {
|
(dev->tproto & SAS_PROTOCOL_STP)) {
|
||||||
scic_sds_stp_request_assign_buffers(sci_req);
|
scic_sds_stp_request_assign_buffers(sci_req);
|
||||||
memset(sci_req->command_buffer,
|
memset(&sci_req->stp.cmd, 0, sizeof(sci_req->stp.cmd));
|
||||||
0,
|
|
||||||
sizeof(struct host_to_dev_fis));
|
|
||||||
} else if (dev_is_expander(dev)) {
|
} else if (dev_is_expander(dev)) {
|
||||||
scic_sds_smp_request_assign_buffers(sci_req);
|
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
|
} else
|
||||||
status = SCI_FAILURE_UNSUPPORTED_PROTOCOL;
|
status = SCI_FAILURE_UNSUPPORTED_PROTOCOL;
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@
|
||||||
#include "scu_task_context.h"
|
#include "scu_task_context.h"
|
||||||
#include "scic_sds_stp_request.h"
|
#include "scic_sds_stp_request.h"
|
||||||
#include "scu_constants.h"
|
#include "scu_constants.h"
|
||||||
|
#include "sas.h"
|
||||||
|
|
||||||
struct scic_sds_controller;
|
struct scic_sds_controller;
|
||||||
struct scic_sds_remote_device;
|
struct scic_sds_remote_device;
|
||||||
|
@ -181,8 +182,6 @@ struct scic_sds_request {
|
||||||
*/
|
*/
|
||||||
u32 post_context;
|
u32 post_context;
|
||||||
|
|
||||||
void *command_buffer;
|
|
||||||
void *response_buffer;
|
|
||||||
struct scu_task_context *task_context_buffer;
|
struct scu_task_context *task_context_buffer;
|
||||||
struct scu_task_context tc ____cacheline_aligned;
|
struct scu_task_context tc ____cacheline_aligned;
|
||||||
|
|
||||||
|
@ -232,9 +231,30 @@ struct scic_sds_request {
|
||||||
*/
|
*/
|
||||||
u8 device_sequence;
|
u8 device_sequence;
|
||||||
|
|
||||||
struct {
|
union {
|
||||||
struct scic_sds_stp_request req;
|
struct {
|
||||||
} stp;
|
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)
|
static inline struct scic_sds_request *to_sci_req(struct scic_sds_stp_request *stp_req)
|
||||||
|
|
|
@ -69,45 +69,8 @@ static void scu_smp_request_construct_task_context(
|
||||||
struct scic_sds_request *sci_req,
|
struct scic_sds_request *sci_req,
|
||||||
struct smp_req *smp_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)
|
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)
|
if (sci_req->was_tag_assigned_by_user == false)
|
||||||
sci_req->task_context_buffer = &sci_req->tc;
|
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);
|
ssize_t word_cnt = sizeof(struct smp_req) / sizeof(u32);
|
||||||
|
|
||||||
/* byte swap the smp request. */
|
/* 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);
|
word_cnt);
|
||||||
|
|
||||||
task_context = scic_sds_request_get_task_context(sci_req);
|
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
|
* 18h ~ 30h, protocol specific
|
||||||
* since commandIU has been build by framework at this point, we just
|
* since commandIU has been build by framework at this point, we just
|
||||||
* copy the frist DWord from command IU to this location. */
|
* copy the frist DWord from command IU to this location. */
|
||||||
memcpy((void *)(&task_context->type.smp),
|
memcpy(&task_context->type.smp, &sci_req->smp.cmd, sizeof(u32));
|
||||||
sci_req->command_buffer,
|
|
||||||
sizeof(u32));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 40h
|
* 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.
|
* Context command buffer should not contain command header.
|
||||||
*/
|
*/
|
||||||
dma_addr = scic_io_request_get_dma_addr(sci_req,
|
dma_addr = scic_io_request_get_dma_addr(sci_req,
|
||||||
(char *)
|
((char *) &sci_req->smp.cmd) +
|
||||||
(sci_req->command_buffer) +
|
|
||||||
sizeof(u32));
|
sizeof(u32));
|
||||||
|
|
||||||
task_context->command_iu_upper = upper_32_bits(dma_addr);
|
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.
|
* indicates successful processing of the TC response.
|
||||||
*/
|
*/
|
||||||
static enum sci_status
|
static enum sci_status
|
||||||
scic_sds_smp_request_await_response_frame_handler(
|
scic_sds_smp_request_await_response_frame_handler(struct scic_sds_request *sci_req,
|
||||||
struct scic_sds_request *sci_req,
|
u32 frame_index)
|
||||||
u32 frame_index)
|
|
||||||
{
|
{
|
||||||
enum sci_status status;
|
enum sci_status status;
|
||||||
void *frame_header;
|
void *frame_header;
|
||||||
struct smp_resp *rsp_hdr;
|
struct smp_resp *rsp_hdr = &sci_req->smp.rsp;
|
||||||
u8 *usr_smp_buf = sci_req->response_buffer;
|
|
||||||
ssize_t word_cnt = SMP_RESP_HDR_SZ / sizeof(u32);
|
ssize_t word_cnt = SMP_RESP_HDR_SZ / sizeof(u32);
|
||||||
|
|
||||||
status = scic_sds_unsolicited_frame_control_get_header(
|
status = scic_sds_unsolicited_frame_control_get_header(
|
||||||
|
@ -271,9 +229,7 @@ scic_sds_smp_request_await_response_frame_handler(
|
||||||
&frame_header);
|
&frame_header);
|
||||||
|
|
||||||
/* byte swap the header. */
|
/* byte swap the header. */
|
||||||
sci_swab32_cpy(usr_smp_buf, frame_header, word_cnt);
|
sci_swab32_cpy(rsp_hdr, frame_header, word_cnt);
|
||||||
|
|
||||||
rsp_hdr = (struct smp_resp *)usr_smp_buf;
|
|
||||||
|
|
||||||
if (rsp_hdr->frame_type == SMP_RESPONSE) {
|
if (rsp_hdr->frame_type == SMP_RESPONSE) {
|
||||||
void *smp_resp;
|
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) /
|
word_cnt = (sizeof(struct smp_req) - SMP_RESP_HDR_SZ) /
|
||||||
sizeof(u32);
|
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);
|
smp_resp, word_cnt);
|
||||||
|
|
||||||
scic_sds_request_set_status(
|
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 */
|
/* 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
|
* Look at the SMP requests' header fields; for certain SAS 1.x SMP
|
||||||
|
|
|
@ -70,48 +70,8 @@
|
||||||
#include "scu_event_codes.h"
|
#include "scu_event_codes.h"
|
||||||
#include "scu_task_context.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)
|
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)
|
if (sci_req->was_tag_assigned_by_user == false)
|
||||||
sci_req->task_context_buffer = &sci_req->tc;
|
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.
|
* determine what is common for SSP/SMP/STP task context structures.
|
||||||
*/
|
*/
|
||||||
static void scu_sata_reqeust_construct_task_context(
|
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)
|
struct scu_task_context *task_context)
|
||||||
{
|
{
|
||||||
dma_addr_t dma_addr;
|
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_remote_device *target_device;
|
||||||
struct scic_sds_port *target_port;
|
struct scic_sds_port *target_port;
|
||||||
|
|
||||||
controller = scic_sds_request_get_controller(sds_request);
|
controller = scic_sds_request_get_controller(sci_req);
|
||||||
target_device = scic_sds_request_get_device(sds_request);
|
target_device = scic_sds_request_get_device(sci_req);
|
||||||
target_port = scic_sds_request_get_port(sds_request);
|
target_port = scic_sds_request_get_port(sci_req);
|
||||||
|
|
||||||
/* Fill in the TC with the its required data */
|
/* Fill in the TC with the its required data */
|
||||||
task_context->abort = 0;
|
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->context_type = SCU_TASK_CONTEXT_TYPE;
|
||||||
|
|
||||||
task_context->remote_node_index =
|
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->command_code = 0;
|
||||||
|
|
||||||
task_context->link_layer_control = 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);
|
(sizeof(struct host_to_dev_fis) - sizeof(u32)) / sizeof(u32);
|
||||||
|
|
||||||
/* Set the first word of the H2D REG FIS */
|
/* 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
|
* Build the task context now since we have already read
|
||||||
* the data
|
* the data
|
||||||
*/
|
*/
|
||||||
sds_request->post_context =
|
sci_req->post_context =
|
||||||
(SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC |
|
(SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC |
|
||||||
(scic_sds_controller_get_protocol_engine_group(
|
(scic_sds_controller_get_protocol_engine_group(
|
||||||
controller) <<
|
controller) <<
|
||||||
SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT) |
|
SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT) |
|
||||||
(scic_sds_port_get_index(target_port) <<
|
(scic_sds_port_get_index(target_port) <<
|
||||||
SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT) |
|
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 {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Build the task context now since we have already read
|
* 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
|
* I/O tag index is not assigned because we have to wait
|
||||||
* until we get a TCi.
|
* until we get a TCi.
|
||||||
*/
|
*/
|
||||||
sds_request->post_context =
|
sci_req->post_context =
|
||||||
(SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC |
|
(SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC |
|
||||||
(scic_sds_controller_get_protocol_engine_group(
|
(scic_sds_controller_get_protocol_engine_group(
|
||||||
controller) <<
|
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
|
* Context. We must offset the command buffer by 4 bytes because the
|
||||||
* first 4 bytes are transfered in the body of the TC.
|
* first 4 bytes are transfered in the body of the TC.
|
||||||
*/
|
*/
|
||||||
dma_addr =
|
dma_addr = scic_io_request_get_dma_addr(sci_req,
|
||||||
scic_io_request_get_dma_addr(sds_request,
|
((char *) &sci_req->stp.cmd) +
|
||||||
(char *)sds_request->
|
sizeof(u32));
|
||||||
command_buffer +
|
|
||||||
sizeof(u32));
|
|
||||||
|
|
||||||
task_context->command_iu_upper = upper_32_bits(dma_addr);
|
task_context->command_iu_upper = upper_32_bits(dma_addr);
|
||||||
task_context->command_iu_lower = lower_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;
|
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:
|
* @sci_req:
|
||||||
|
@ -478,7 +421,7 @@ static enum sci_status scic_sds_stp_request_non_data_await_d2h_frame_handler(
|
||||||
frame_index,
|
frame_index,
|
||||||
(void **)&frame_buffer);
|
(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_header,
|
||||||
frame_buffer);
|
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 */
|
/* ending_status: 4th byte in the 3rd dword */
|
||||||
stp_req->type.pio.ending_status = (frame_buffer[2] >> 24) & 0xff;
|
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_header,
|
||||||
frame_buffer);
|
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
|
/* The next state is dependent on whether the
|
||||||
* request was PIO Data-in or Data out
|
* 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,
|
frame_index,
|
||||||
(void **)&frame_buffer);
|
(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_header,
|
||||||
frame_buffer);
|
frame_buffer);
|
||||||
|
|
||||||
|
@ -1220,7 +1163,6 @@ static enum sci_status scic_sds_stp_request_udma_general_frame_handler(struct sc
|
||||||
u32 frame_index)
|
u32 frame_index)
|
||||||
{
|
{
|
||||||
struct scic_sds_controller *scic = sci_req->owning_controller;
|
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;
|
struct dev_to_host_fis *frame_header;
|
||||||
enum sci_status status;
|
enum sci_status status;
|
||||||
u32 *frame_buffer;
|
u32 *frame_buffer;
|
||||||
|
@ -1235,7 +1177,7 @@ static enum sci_status scic_sds_stp_request_udma_general_frame_handler(struct sc
|
||||||
frame_index,
|
frame_index,
|
||||||
(void **)&frame_buffer);
|
(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_header,
|
||||||
frame_buffer);
|
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,
|
struct scic_sds_request *sci_req,
|
||||||
u32 completion_code)
|
u32 completion_code)
|
||||||
{
|
{
|
||||||
struct scic_sds_stp_request *stp_req = &sci_req->stp.req;
|
|
||||||
enum sci_status status = SCI_SUCCESS;
|
enum sci_status status = SCI_SUCCESS;
|
||||||
|
|
||||||
switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) {
|
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
|
* We must check ther response buffer to see if the D2H Register FIS was
|
||||||
* received before we got the TC completion. */
|
* 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,
|
scic_sds_remote_device_suspend(sci_req->target_device,
|
||||||
SCU_EVENT_SPECIFIC(SCU_NORMALIZE_COMPLETION_STATUS(completion_code)));
|
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,
|
frame_index,
|
||||||
(void **)&frame_buffer);
|
(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_header,
|
||||||
frame_buffer);
|
frame_buffer);
|
||||||
|
|
||||||
|
@ -1595,7 +1536,7 @@ static void scic_sds_stp_request_started_soft_reset_await_h2d_diagnostic_complet
|
||||||
enum sci_status status;
|
enum sci_status status;
|
||||||
|
|
||||||
/* Clear the SRST bit */
|
/* 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;
|
h2d_fis->control = 0;
|
||||||
|
|
||||||
/* Clear the TC control bit */
|
/* Clear the TC control bit */
|
||||||
|
|
|
@ -60,8 +60,6 @@
|
||||||
#include <scsi/sas.h>
|
#include <scsi/sas.h>
|
||||||
|
|
||||||
struct scic_sds_stp_request {
|
struct scic_sds_stp_request {
|
||||||
struct dev_to_host_fis d2h_reg_fis;
|
|
||||||
|
|
||||||
union {
|
union {
|
||||||
u32 ncq;
|
u32 ncq;
|
||||||
|
|
||||||
|
|
|
@ -433,7 +433,7 @@ int isci_host_init(struct isci_host *isci_host)
|
||||||
* when trying to convert virtual addresses to physical addresses
|
* when trying to convert virtual addresses to physical addresses
|
||||||
*/
|
*/
|
||||||
isci_host->dma_pool_alloc_size = sizeof(struct isci_request) +
|
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 = dmam_pool_create(DRV_NAME, &isci_host->pdev->dev,
|
||||||
isci_host->dma_pool_alloc_size,
|
isci_host->dma_pool_alloc_size,
|
||||||
SLAB_HWCACHE_ALIGN, 0);
|
SLAB_HWCACHE_ALIGN, 0);
|
||||||
|
|
|
@ -126,7 +126,6 @@ static enum sci_status isci_smp_request_build(struct isci_request *ireq)
|
||||||
enum sci_status status = SCI_FAILURE;
|
enum sci_status status = SCI_FAILURE;
|
||||||
struct sas_task *task = isci_request_access_task(ireq);
|
struct sas_task *task = isci_request_access_task(ireq);
|
||||||
struct scic_sds_request *sci_req = ireq->sci_request_handle;
|
struct scic_sds_request *sci_req = ireq->sci_request_handle;
|
||||||
void *cmd_iu = sci_req->command_buffer;
|
|
||||||
|
|
||||||
dev_dbg(&ireq->isci_host->pdev->dev,
|
dev_dbg(&ireq->isci_host->pdev->dev,
|
||||||
"%s: request = %p\n", __func__, ireq);
|
"%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; */
|
/* copy the smp_command to the address; */
|
||||||
sg_copy_to_buffer(&task->smp_task.smp_req, 1,
|
sg_copy_to_buffer(&task->smp_task.smp_req, 1,
|
||||||
(char *)cmd_iu,
|
&sci_req->smp.cmd,
|
||||||
sizeof(struct smp_req));
|
sizeof(struct smp_req));
|
||||||
|
|
||||||
status = scic_io_request_construct_smp(sci_req);
|
status = scic_io_request_construct_smp(sci_req);
|
||||||
|
@ -998,25 +997,15 @@ void isci_request_io_request_complete(
|
||||||
task);
|
task);
|
||||||
|
|
||||||
if (sas_protocol_ata(task->task_proto)) {
|
if (sas_protocol_ata(task->task_proto)) {
|
||||||
resp_buf
|
resp_buf = &request->sci_request_handle->stp.rsp;
|
||||||
= scic_stp_io_request_get_d2h_reg_address(
|
|
||||||
request->sci_request_handle
|
|
||||||
);
|
|
||||||
isci_request_process_stp_response(task,
|
isci_request_process_stp_response(task,
|
||||||
resp_buf
|
resp_buf);
|
||||||
);
|
|
||||||
|
|
||||||
} else if (SAS_PROTOCOL_SSP == task->task_proto) {
|
} else if (SAS_PROTOCOL_SSP == task->task_proto) {
|
||||||
|
|
||||||
/* crack the iu response buffer. */
|
/* crack the iu response buffer. */
|
||||||
resp_iu
|
resp_iu = &request->sci_request_handle->ssp.rsp;
|
||||||
= scic_io_request_get_response_iu_address(
|
|
||||||
request->sci_request_handle
|
|
||||||
);
|
|
||||||
|
|
||||||
isci_request_process_response_iu(task, resp_iu,
|
isci_request_process_response_iu(task, resp_iu,
|
||||||
&isci_host->pdev->dev
|
&isci_host->pdev->dev);
|
||||||
);
|
|
||||||
|
|
||||||
} else if (SAS_PROTOCOL_SMP == task->task_proto) {
|
} else if (SAS_PROTOCOL_SMP == task->task_proto) {
|
||||||
|
|
||||||
|
@ -1045,11 +1034,7 @@ void isci_request_io_request_complete(
|
||||||
request->complete_in_target = true;
|
request->complete_in_target = true;
|
||||||
|
|
||||||
if (task->task_proto == SAS_PROTOCOL_SMP) {
|
if (task->task_proto == SAS_PROTOCOL_SMP) {
|
||||||
|
void *rsp = &request->sci_request_handle->smp.rsp;
|
||||||
u8 *command_iu_address
|
|
||||||
= scic_io_request_get_command_iu_address(
|
|
||||||
request->sci_request_handle
|
|
||||||
);
|
|
||||||
|
|
||||||
dev_dbg(&isci_host->pdev->dev,
|
dev_dbg(&isci_host->pdev->dev,
|
||||||
"%s: SMP protocol completion\n",
|
"%s: SMP protocol completion\n",
|
||||||
|
@ -1057,9 +1042,7 @@ void isci_request_io_request_complete(
|
||||||
|
|
||||||
sg_copy_from_buffer(
|
sg_copy_from_buffer(
|
||||||
&task->smp_task.smp_resp, 1,
|
&task->smp_task.smp_resp, 1,
|
||||||
command_iu_address
|
rsp, sizeof(struct smp_resp));
|
||||||
+ sizeof(struct smp_req),
|
|
||||||
sizeof(struct smp_resp));
|
|
||||||
} else if (completion_status
|
} else if (completion_status
|
||||||
== SCI_IO_SUCCESS_IO_DONE_EARLY) {
|
== SCI_IO_SUCCESS_IO_DONE_EARLY) {
|
||||||
|
|
||||||
|
|
|
@ -71,24 +71,17 @@
|
||||||
*/
|
*/
|
||||||
struct host_to_dev_fis *isci_sata_task_to_fis_copy(struct sas_task *task)
|
struct host_to_dev_fis *isci_sata_task_to_fis_copy(struct sas_task *task)
|
||||||
{
|
{
|
||||||
struct isci_request *request = task->lldd_task;
|
struct isci_request *ireq = task->lldd_task;
|
||||||
struct host_to_dev_fis *register_fis =
|
struct host_to_dev_fis *fis = &ireq->sci_request_handle->stp.cmd;
|
||||||
scic_stp_io_request_get_h2d_reg_address(
|
|
||||||
request->sci_request_handle
|
|
||||||
);
|
|
||||||
|
|
||||||
memcpy(
|
memcpy(fis, &task->ata_task.fis, sizeof(struct host_to_dev_fis));
|
||||||
(u8 *)register_fis,
|
|
||||||
(u8 *)&task->ata_task.fis,
|
|
||||||
sizeof(struct host_to_dev_fis)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!task->ata_task.device_control_reg_update)
|
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;
|
ts->resp = SAS_TASK_COMPLETE;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum sci_status isci_sata_management_task_request_build(
|
enum sci_status isci_sata_management_task_request_build(struct isci_request *ireq)
|
||||||
struct isci_request *isci_request)
|
|
||||||
{
|
{
|
||||||
|
struct scic_sds_request *sci_req = ireq->sci_request_handle;
|
||||||
struct isci_tmf *isci_tmf;
|
struct isci_tmf *isci_tmf;
|
||||||
enum sci_status status;
|
enum sci_status status;
|
||||||
|
|
||||||
if (tmf_task != isci_request->ttype)
|
if (tmf_task != ireq->ttype)
|
||||||
return SCI_FAILURE;
|
return SCI_FAILURE;
|
||||||
|
|
||||||
isci_tmf = isci_request_access_tmf(isci_request);
|
isci_tmf = isci_request_access_tmf(ireq);
|
||||||
|
|
||||||
switch (isci_tmf->tmf_code) {
|
switch (isci_tmf->tmf_code) {
|
||||||
|
|
||||||
case isci_tmf_sata_srst_high:
|
case isci_tmf_sata_srst_high:
|
||||||
case isci_tmf_sata_srst_low:
|
case isci_tmf_sata_srst_low: {
|
||||||
{
|
struct host_to_dev_fis *fis = &sci_req->stp.cmd;
|
||||||
struct host_to_dev_fis *register_fis =
|
|
||||||
scic_stp_io_request_get_h2d_reg_address(
|
|
||||||
isci_request->sci_request_handle
|
|
||||||
);
|
|
||||||
|
|
||||||
memset(register_fis, 0, sizeof(*register_fis));
|
memset(fis, 0, sizeof(*fis));
|
||||||
|
|
||||||
register_fis->fis_type = 0x27;
|
fis->fis_type = 0x27;
|
||||||
register_fis->flags &= ~0x80;
|
fis->flags &= ~0x80;
|
||||||
register_fis->flags &= 0xF0;
|
fis->flags &= 0xF0;
|
||||||
if (isci_tmf->tmf_code == isci_tmf_sata_srst_high)
|
if (isci_tmf->tmf_code == isci_tmf_sata_srst_high)
|
||||||
register_fis->control |= ATA_SRST;
|
fis->control |= ATA_SRST;
|
||||||
else
|
else
|
||||||
register_fis->control &= ~ATA_SRST;
|
fis->control &= ~ATA_SRST;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* other management commnd go here... */
|
/* other management commnd go here... */
|
||||||
|
@ -202,7 +191,7 @@ enum sci_status isci_sata_management_task_request_build(
|
||||||
* based on the h2d fis.
|
* based on the h2d fis.
|
||||||
*/
|
*/
|
||||||
status = scic_task_request_construct_sata(
|
status = scic_task_request_construct_sata(
|
||||||
isci_request->sci_request_handle
|
ireq->sci_request_handle
|
||||||
);
|
);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
|
|
@ -1431,7 +1431,6 @@ isci_task_request_complete(struct isci_host *ihost,
|
||||||
struct isci_tmf *tmf = isci_request_access_tmf(ireq);
|
struct isci_tmf *tmf = isci_request_access_tmf(ireq);
|
||||||
struct completion *tmf_complete;
|
struct completion *tmf_complete;
|
||||||
struct scic_sds_request *sci_req = ireq->sci_request_handle;
|
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,
|
dev_dbg(&ihost->pdev->dev,
|
||||||
"%s: request = %p, status=%d\n",
|
"%s: request = %p, status=%d\n",
|
||||||
|
@ -1444,11 +1443,11 @@ isci_task_request_complete(struct isci_host *ihost,
|
||||||
|
|
||||||
if (tmf->proto == SAS_PROTOCOL_SSP) {
|
if (tmf->proto == SAS_PROTOCOL_SSP) {
|
||||||
memcpy(&tmf->resp.resp_iu,
|
memcpy(&tmf->resp.resp_iu,
|
||||||
sci_req->response_buffer,
|
&sci_req->ssp.rsp,
|
||||||
SSP_RESP_IU_MAX_SIZE);
|
SSP_RESP_IU_MAX_SIZE);
|
||||||
} else if (tmf->proto == SAS_PROTOCOL_SATA) {
|
} else if (tmf->proto == SAS_PROTOCOL_SATA) {
|
||||||
memcpy(&tmf->resp.d2h_fis,
|
memcpy(&tmf->resp.d2h_fis,
|
||||||
&stp_req->d2h_reg_fis,
|
&sci_req->stp.rsp,
|
||||||
sizeof(struct dev_to_host_fis));
|
sizeof(struct dev_to_host_fis));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue