Commit af5ae893 authored by Dave Jiang's avatar Dave Jiang Committed by Dan Williams

isci: Convert of sci_ssp_response_iu to ssp_response_iu

Converting to Linux native format. However the isci driver does a lot of
the calculation based on the max size of this data structure and the
Linux data structure only has a pointer to the response data. Thus the
sizeof(struct ssp_response_iu) will be incorrect and we need to define
the max size.
Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 0cfa890e
......@@ -160,52 +160,6 @@ enum sci_sas_frame_type {
SCI_SAS_TASK_FRAME = 0x16
};
#define SSP_RESPONSE_IU_MAX_DATA 64
#define SCI_SSP_RESPONSE_IU_DATA_PRESENT_MASK (0x03)
#define sci_ssp_get_sense_data_length(sense_data_length_buffer) \
SCIC_BUILD_DWORD(sense_data_length_buffer)
#define sci_ssp_get_response_data_length(response_data_length_buffer) \
SCIC_BUILD_DWORD(response_data_length_buffer)
/**
* struct sci_ssp_response_iu - This structure depicts the contents of the SSP
* RESPONSE INFORMATION UNIT. For specific information on each of these
* individual fields please reference the SAS specification SSP transport
* layer section.
*
*
*/
struct sci_ssp_response_iu {
u8 reserved0[8];
u8 retry_delay_timer[2];
u8 data_present;
u8 status;
u8 reserved1[4];
u8 sense_data_length[4];
u8 response_data_length[4];
u32 data[SSP_RESPONSE_IU_MAX_DATA];
};
/**
* enum _SCI_SAS_DATA_PRESENT_TYPE - This enumeration depicts the SAS
* specification defined SSP data present types in struct sci_ssp_response_iu.
*
*
*/
enum sci_ssp_response_iu_data_present_type {
SCI_SSP_RESPONSE_IU_NO_DATA = 0x00,
SCI_SSP_RESPONSE_IU_RESPONSE_DATA = 0x01,
SCI_SSP_RESPONSE_IU_SENSE_DATA = 0x02
};
/**
* struct sci_ssp_frame_header - This structure depicts the contents of an SSP
* frame header. For specific information on the individual fields please
......
This diff is collapsed.
......@@ -102,7 +102,7 @@
#define scic_sds_stp_request_get_task_context_buffer(memory) \
((struct scu_task_context *)(\
((char *)(scic_sds_stp_request_get_response_buffer(memory))) \
+ sizeof(struct sci_ssp_response_iu) \
+ SSP_RESP_IU_MAX_SIZE \
))
/**
......
......@@ -69,6 +69,9 @@
#define FIS_PIO_SETUP 0x5F
#define FIS_DATA 0x46
/**************************************************************************/
#define SSP_RESP_IU_MAX_SIZE 280
/*
* contents of the SSP COMMAND INFORMATION UNIT.
* For specific information on each of these individual fields please
......
......@@ -55,6 +55,7 @@
#include <linux/completion.h>
#include <linux/irqflags.h>
#include "sas.h"
#include "scic_task_request.h"
#include "scic_io_request.h"
#include "remote_device.h"
......@@ -63,7 +64,8 @@
#include "request.h"
#include "sata.h"
#include "task.h"
#include "core/scic_sds_request.h"
#include "scic_sds_stp_request.h"
/**
* isci_task_refuse() - complete the request to the upper layer driver in
* the case where an I/O needs to be completed back in the submit path.
......@@ -1411,108 +1413,74 @@ int isci_task_query_task(
return TMF_RESP_FUNC_SUCC;
}
/**
/*
* isci_task_request_complete() - This function is called by the sci core when
* an task request completes.
* @isci_host: This parameter specifies the ISCI host object
* @request: This parameter is the completed isci_request object.
* @ihost: This parameter specifies the ISCI host object
* @ireq: This parameter is the completed isci_request object.
* @completion_status: This parameter specifies the completion status from the
* sci core.
*
* none.
*/
void isci_task_request_complete(
struct isci_host *isci_host,
struct isci_request *request,
enum sci_task_status completion_status)
void
isci_task_request_complete(struct isci_host *ihost,
struct isci_request *ireq,
enum sci_task_status completion_status)
{
struct isci_remote_device *isci_device = request->isci_device;
struct isci_remote_device *idev = ireq->isci_device;
enum isci_request_status old_state;
struct isci_tmf *tmf = isci_request_access_tmf(request);
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 =
container_of(sci_req, typeof(*stp_req), parent);
dev_dbg(&isci_host->pdev->dev,
dev_dbg(&ihost->pdev->dev,
"%s: request = %p, status=%d\n",
__func__, request, completion_status);
__func__, ireq, completion_status);
old_state = isci_request_change_state(request, completed);
old_state = isci_request_change_state(ireq, completed);
tmf->status = completion_status;
request->complete_in_target = true;
if (SAS_PROTOCOL_SSP == tmf->proto) {
ireq->complete_in_target = true;
if (tmf->proto == SAS_PROTOCOL_SSP) {
memcpy(&tmf->resp.resp_iu,
scic_io_request_get_response_iu_address(
request->sci_request_handle
),
sizeof(struct sci_ssp_response_iu));
} else if (SAS_PROTOCOL_SATA == tmf->proto) {
sci_req->response_buffer,
SSP_RESP_IU_MAX_SIZE);
} else if (tmf->proto == SAS_PROTOCOL_SATA) {
memcpy(&tmf->resp.d2h_fis,
scic_stp_io_request_get_d2h_reg_address(
request->sci_request_handle),
&stp_req->d2h_reg_fis,
sizeof(struct dev_to_host_fis));
}
/* Manage the timer if it is still running. */
if (tmf->timeout_timer) {
isci_del_timer(isci_host, tmf->timeout_timer);
isci_del_timer(ihost, tmf->timeout_timer);
tmf->timeout_timer = NULL;
}
/* PRINT_TMF( ((struct isci_tmf *)request->task)); */
tmf_complete = tmf->complete;
scic_controller_complete_io(
isci_host->core_controller,
&isci_device->sci,
request->sci_request_handle);
/* NULL the request handle to make sure it cannot be terminated
scic_controller_complete_io(ihost->core_controller,
&idev->sci,
ireq->sci_request_handle);
/*
* NULL the request handle to make sure it cannot be terminated
* or completed again.
*/
request->sci_request_handle = NULL;
ireq->sci_request_handle = NULL;
isci_request_change_state(request, unallocated);
list_del_init(&request->dev_node);
isci_request_change_state(ireq, unallocated);
list_del_init(&ireq->dev_node);
/* The task management part completes last. */
complete(tmf_complete);
}
/**
* isci_task_ssp_request_get_response_data_address() - This function is called
* by the sci core to retrieve the response data address for a given task
* request.
* @request: This parameter is the isci_request object.
*
* response data address for specified task request.
*/
void *isci_task_ssp_request_get_response_data_address(
struct isci_request *request)
{
struct isci_tmf *isci_tmf = isci_request_access_tmf(request);
return &isci_tmf->resp.resp_iu;
}
/**
* isci_task_ssp_request_get_response_data_length() - This function is called
* by the sci core to retrieve the response data length for a given task
* request.
* @request: This parameter is the isci_request object.
*
* response data length for specified task request.
*/
u32 isci_task_ssp_request_get_response_data_length(
struct isci_request *request)
{
struct isci_tmf *isci_tmf = isci_request_access_tmf(request);
return sizeof(isci_tmf->resp.resp_iu);
}
/**
* isci_bus_reset_handler() - This function performs a target reset of the
* device referenced by "cmd'. This function is exported through the
......
......@@ -99,7 +99,7 @@ struct isci_tmf {
struct completion *complete;
enum sas_protocol proto;
union {
struct sci_ssp_response_iu resp_iu;
struct ssp_response_iu resp_iu;
struct dev_to_host_fis d2h_fis;
} resp;
unsigned char lun[8];
......@@ -120,8 +120,7 @@ struct isci_tmf {
};
static inline void isci_print_tmf(
struct isci_tmf *tmf)
static inline void isci_print_tmf(struct isci_tmf *tmf)
{
if (SAS_PROTOCOL_SATA == tmf->proto)
dev_dbg(&tmf->device->isci_port->isci_host->pdev->dev,
......@@ -144,16 +143,13 @@ static inline void isci_print_tmf(
"tmf->resp.resp_iu.data[3] = %x\n",
__func__,
tmf->status,
tmf->resp.resp_iu.data_present,
tmf->resp.resp_iu.datapres,
tmf->resp.resp_iu.status,
(tmf->resp.resp_iu.response_data_length[0] << 24) +
(tmf->resp.resp_iu.response_data_length[1] << 16) +
(tmf->resp.resp_iu.response_data_length[2] << 8) +
tmf->resp.resp_iu.response_data_length[3],
tmf->resp.resp_iu.data[0],
tmf->resp.resp_iu.data[1],
tmf->resp.resp_iu.data[2],
tmf->resp.resp_iu.data[3]);
be32_to_cpu(tmf->resp.resp_iu.response_data_len),
tmf->resp.resp_iu.resp_data[0],
tmf->resp.resp_iu.resp_data[1],
tmf->resp.resp_iu.resp_data[2],
tmf->resp.resp_iu.resp_data[3]);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment