#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_sds_ssp_request_get_task_context_buffer() -
- *
- * This macro returns the address of the task context buffer in the io request
- * memory
- */
-#define scic_sds_ssp_request_get_task_context_buffer(memory) \
- ((struct scu_task_context *)(\
- ((char *)(scic_sds_ssp_request_get_response_buffer(memory))) \
- + SSP_RESP_IU_MAX_SIZE \
- ))
-
-/**
- * scic_sds_ssp_request_get_sgl_element_buffer() -
- *
- * This macro returns the address of the sgl elment pairs in the io request
- * memory buffer
- */
-#define scic_sds_ssp_request_get_sgl_element_buffer(memory) \
- ((struct scu_sgl_element_pair *)(\
- ((char *)(scic_sds_ssp_request_get_task_context_buffer(memory))) \
- + sizeof(struct scu_task_context) \
- ))
-
-
-/**
- * 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) \
- ))
-
-/**
- * scic_sds_ssp_task_request_get_task_context_buffer() -
- *
- * This macro returs the task context buffer for the SSP task request.
- */
-#define scic_sds_ssp_task_request_get_task_context_buffer(memory) \
- ((struct scu_task_context *)(\
- ((char *)(scic_sds_ssp_task_request_get_response_buffer(memory))) \
- + SSP_RESP_IU_MAX_SIZE \
- ))
-
-
-
-/*
- * ****************************************************************************
- * * SCIC SDS IO REQUEST PRIVATE METHODS
- * **************************************************************************** */
-
-/**
- *
- *
- * 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()
- + sizeof(struct scu_task_context)
- + SMP_CACHE_BYTES
- + sizeof(struct scu_sgl_element_pair) * SCU_MAX_SGL_ELEMENT_PAIRS;
-}
-
/**
* 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
return &task_context->sgl_pair_cd;
}
- return &sci_req->sgl_element_pair_buffer[sgl_pair_index - 2];
+ return &sci_req->sg_table[sgl_pair_index - 2];
}
/**
*/
void scic_sds_request_build_sgl(struct scic_sds_request *sds_request)
{
- struct isci_request *isci_request = sds_request->ireq;
+ struct isci_request *isci_request = sci_req_to_ireq(sds_request);
struct isci_host *isci_host = isci_request->isci_host;
struct sas_task *task = isci_request_access_task(isci_request);
struct scatterlist *sg = NULL;
}
}
-/**
- * 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);
- sci_req->sgl_element_pair_buffer =
- scic_sds_ssp_request_get_sgl_element_buffer(sci_req);
- sci_req->sgl_element_pair_buffer =
- PTR_ALIGN(sci_req->sgl_element_pair_buffer,
- sizeof(struct scu_sgl_element_pair));
-
- if (sci_req->was_tag_assigned_by_user == false) {
- sci_req->task_context_buffer =
- scic_sds_ssp_request_get_task_context_buffer(sci_req);
- sci_req->task_context_buffer =
- PTR_ALIGN(sci_req->task_context_buffer,
- SMP_CACHE_BYTES);
- }
+ if (sci_req->was_tag_assigned_by_user == false)
+ sci_req->task_context_buffer = &sci_req->tc;
}
static void scic_sds_io_request_build_ssp_command_iu(struct scic_sds_request *sci_req)
{
struct ssp_cmd_iu *cmd_iu;
- struct isci_request *ireq = sci_req->ireq;
+ struct isci_request *ireq = sci_req_to_ireq(sci_req);
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;
static void scic_sds_task_request_build_ssp_task_iu(struct scic_sds_request *sci_req)
{
struct ssp_task_iu *task_iu;
- struct isci_request *ireq = sci_req->ireq;
+ struct isci_request *ireq = sci_req_to_ireq(sci_req);
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));
* 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);
* 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);
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);
- sci_req->sgl_element_pair_buffer = NULL;
-
- if (sci_req->was_tag_assigned_by_user == false) {
- sci_req->task_context_buffer =
- scic_sds_ssp_task_request_get_task_context_buffer(sci_req);
- sci_req->task_context_buffer =
- PTR_ALIGN(sci_req->task_context_buffer, SMP_CACHE_BYTES);
- }
+ if (sci_req->was_tag_assigned_by_user == false)
+ sci_req->task_context_buffer = &sci_req->tc;
}
/**
bool copy)
{
enum sci_status status = SCI_SUCCESS;
- struct isci_request *ireq = sci_req->ireq;
+ struct isci_request *ireq = sci_req_to_ireq(sci_req);
struct sas_task *task = isci_request_access_task(ireq);
/* check for management protocols */
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)
{
- struct isci_request *isci_request = sci_req->ireq;
+ struct isci_request *ireq = sci_req_to_ireq(sci_req);
+ struct sas_task *task = isci_request_access_task(ireq);
sci_req->protocol = SCIC_SSP_PROTOCOL;
- scu_ssp_io_request_construct_task_context(
- sci_req,
- isci_request_io_request_get_data_direction(isci_request),
- isci_request_io_request_get_transfer_length(isci_request));
+ scu_ssp_io_request_construct_task_context(sci_req,
+ task->data_dir,
+ task->total_xfer_len);
scic_sds_io_request_build_ssp_command_iu(sci_req);
- sci_base_state_machine_change_state(&sci_req->state_machine,
- SCI_BASE_REQUEST_STATE_CONSTRUCTED);
+ sci_base_state_machine_change_state(
+ &sci_req->state_machine,
+ SCI_BASE_REQUEST_STATE_CONSTRUCTED);
return SCI_SUCCESS;
}
{
enum sci_status status;
struct scic_sds_stp_request *stp_req;
- u32 len;
- enum dma_data_direction dir;
bool copy = false;
- struct isci_request *isci_request = sci_req->ireq;
+ struct isci_request *isci_request = sci_req_to_ireq(sci_req);
struct sas_task *task = isci_request_access_task(isci_request);
- stp_req = container_of(sci_req, typeof(*stp_req), parent);
-
+ stp_req = &sci_req->stp.req;
sci_req->protocol = SCIC_STP_PROTOCOL;
- len = isci_request_io_request_get_transfer_length(isci_request);
- dir = isci_request_io_request_get_data_direction(isci_request);
copy = (task->data_dir == DMA_NONE) ? false : true;
- status = scic_io_request_construct_sata(sci_req, len, dir, copy);
+ status = scic_io_request_construct_sata(sci_req,
+ task->total_xfer_len,
+ task->data_dir,
+ copy);
if (status == SCI_SUCCESS)
sci_base_state_machine_change_state(&sci_req->state_machine,
}
-enum sci_status scic_task_request_construct_sata(
- struct scic_sds_request *sci_req)
+enum sci_status scic_task_request_construct_sata(struct scic_sds_request *sci_req)
{
enum sci_status status = SCI_SUCCESS;
- struct isci_request *ireq = sci_req->ireq;
+ struct isci_request *ireq = sci_req_to_ireq(sci_req);
/* check for management protocols */
if (ireq->ttype == tmf_task) {
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)
void *resp_buf;
u32 len;
struct ssp_response_iu *ssp_response;
- struct isci_request *ireq = sci_req->ireq;
+ struct isci_request *ireq = sci_req_to_ireq(sci_req);
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;
* 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) {
{
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,
* 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)) {
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)) {
struct scic_sds_request *sci_req = object;
struct scic_sds_controller *scic =
scic_sds_request_get_controller(sci_req);
- struct isci_host *ihost = scic->ihost;
- struct isci_request *ireq = sci_req->ireq;
+ struct isci_host *ihost = scic_to_ihost(scic);
+ struct isci_request *ireq = sci_req_to_ireq(sci_req);
SET_STATE_HANDLER(sci_req,
scic_sds_request_state_handler_table,
static void scic_sds_general_request_construct(struct scic_sds_controller *scic,
struct scic_sds_remote_device *sci_dev,
- u16 io_tag,
- void *user_io_request_object,
- struct scic_sds_request *sci_req)
+ u16 io_tag, struct scic_sds_request *sci_req)
{
sci_base_state_machine_construct(&sci_req->state_machine, sci_req,
scic_sds_request_state_table, SCI_BASE_REQUEST_STATE_INITIAL);
sci_base_state_machine_start(&sci_req->state_machine);
sci_req->io_tag = io_tag;
- sci_req->user_request = user_io_request_object;
sci_req->owning_controller = scic;
sci_req->target_device = sci_dev;
sci_req->has_started_substate_machine = false;
enum sci_status
scic_io_request_construct(struct scic_sds_controller *scic,
struct scic_sds_remote_device *sci_dev,
- u16 io_tag,
- void *user_req,
- struct scic_sds_request *sci_req,
- struct scic_sds_request **new_sci_req)
+ u16 io_tag, struct scic_sds_request *sci_req)
{
struct domain_device *dev = sci_dev_to_domain(sci_dev);
enum sci_status status = SCI_SUCCESS;
/* Build the common part of the request */
- scic_sds_general_request_construct(scic,
- sci_dev,
- io_tag,
- user_req,
- sci_req);
+ scic_sds_general_request_construct(scic, sci_dev, io_tag, sci_req);
if (sci_dev->rnc.remote_node_index ==
SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX)
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;
if (status == SCI_SUCCESS) {
- memset(sci_req->task_context_buffer,
- 0,
- SCI_FIELD_OFFSET(struct scu_task_context, sgl_pair_ab));
- *new_sci_req = sci_req;
+ memset(sci_req->task_context_buffer, 0,
+ offsetof(struct scu_task_context, sgl_pair_ab));
}
return status;
enum sci_status scic_task_request_construct(struct scic_sds_controller *scic,
struct scic_sds_remote_device *sci_dev,
- u16 io_tag,
- void *user_io_request_object,
- struct scic_sds_request *sci_req,
- struct scic_sds_request **new_sci_req)
+ u16 io_tag, struct scic_sds_request *sci_req)
{
struct domain_device *dev = sci_dev_to_domain(sci_dev);
enum sci_status status = SCI_SUCCESS;
/* Build the common part of the request */
- scic_sds_general_request_construct(scic, sci_dev, io_tag,
- user_io_request_object,
- sci_req);
+ scic_sds_general_request_construct(scic, sci_dev, io_tag, sci_req);
if (dev->dev_type == SAS_END_DEV) {
scic_sds_ssp_task_request_assign_buffers(sci_req);
if (status == SCI_SUCCESS) {
sci_req->is_task_management_request = true;
memset(sci_req->task_context_buffer, 0, sizeof(struct scu_task_context));
- *new_sci_req = sci_req;
}
return status;