Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 254487
b: refs/heads/master
c: 67ea838
h: refs/heads/master
i:
  254485: d451903
  254483: f16aa02
  254479: b7fc053
v: v3
  • Loading branch information
Dan Williams committed Jul 3, 2011
1 parent 50e726b commit e7d0699
Show file tree
Hide file tree
Showing 16 changed files with 129 additions and 258 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b7645818cff1536038c0b21407eefb6b9d5755e6
refs/heads/master: 67ea838d17acdad3331aeae848683c768df96aaa
9 changes: 4 additions & 5 deletions trunk/drivers/scsi/isci/core/sci_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,29 +59,28 @@

void *scic_request_get_virt_addr(struct scic_sds_request *sci_req, dma_addr_t phys_addr)
{
struct isci_request *ireq = sci_req->ireq;
struct isci_request *ireq = sci_req_to_ireq(sci_req);
dma_addr_t offset;

BUG_ON(phys_addr < ireq->request_daddr);

offset = phys_addr - ireq->request_daddr;

BUG_ON(offset >= ireq->request_alloc_size);
BUG_ON(offset >= sizeof(*ireq));

return (char *)ireq + offset;
}

dma_addr_t scic_io_request_get_dma_addr(struct scic_sds_request *sds_request,
void *virt_addr)
{
struct isci_request *isci_request = sds_request->ireq;
struct isci_request *isci_request = sci_req_to_ireq(sds_request);

char *requested_addr = (char *)virt_addr;
char *base_addr = (char *)isci_request;

BUG_ON(requested_addr < base_addr);
BUG_ON((requested_addr - base_addr) >=
isci_request->request_alloc_size);
BUG_ON((requested_addr - base_addr) >= sizeof(*isci_request));

return isci_request->request_daddr + (requested_addr - base_addr);
}
3 changes: 0 additions & 3 deletions trunk/drivers/scsi/isci/core/sci_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@
| ((char_buffer)[3]) \
)

#define SCI_FIELD_OFFSET(type, field) ((unsigned long)&(((type *)0)->field))


#define sci_cb_make_physical_address(physical_addr, addr_upper, addr_lower) \
((physical_addr) = (addr_lower) | ((u64)addr_upper) << 32)

Expand Down
33 changes: 1 addition & 32 deletions trunk/drivers/scsi/isci/core/scic_io_request.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,41 +102,10 @@ typedef enum {

} SCIC_TRANSPORT_PROTOCOL;


/**
* scic_io_request_construct() - This method is called by the SCI user to
* construct all SCI Core IO requests. Memory initialization and
* functionality common to all IO request types is performed in this method.
* @scic_controller: the handle to the core controller object for which to
* build an IO request.
* @scic_remote_device: the handle to the core remote device object for which
* to build an IO request.
* @io_tag: This parameter specifies the IO tag to be associated with this
* request. If SCI_CONTROLLER_INVALID_IO_TAG is passed, then a copy of the
* request is built internally. The request will be copied into the actual
* controller request memory when the IO tag is allocated internally during
* the scic_controller_start_io() method.
* @user_io_request_object: This parameter specifies the user IO request to be
* utilized during IO construction. This IO pointer will become the
* associated object for the core IO request object.
* @scic_io_request_memory: This parameter specifies the memory location to be
* utilized when building the core request.
* @new_scic_io_request_handle: This parameter specifies a pointer to the
* handle the core will expect in further interactions with the core IO
* request object.
*
* The SCI core implementation will create an association between the user IO
* request object and the core IO request object. Indicate if the controller
* successfully built the IO request. SCI_SUCCESS This value is returned if the
* IO request was successfully built.
*/
enum sci_status scic_io_request_construct(
struct scic_sds_controller *scic_controller,
struct scic_sds_remote_device *scic_remote_device,
u16 io_tag,
void *user_io_request_object,
struct scic_sds_request *scic_io_request_memory,
struct scic_sds_request **new_scic_io_request_handle);
u16 io_tag, struct scic_sds_request *sci_req);

/**
* scic_io_request_construct_basic_ssp() - This method is called by the SCI
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/scsi/isci/core/scic_sds_controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -1572,7 +1572,7 @@ void scic_sds_controller_copy_task_context(

memcpy(task_context_buffer,
sci_req->task_context_buffer,
SCI_FIELD_OFFSET(struct scu_task_context, sgl_snapshot_ac));
offsetof(struct scu_task_context, sgl_snapshot_ac));

/*
* Now that the soft copy of the TC has been copied into the TC
Expand Down
53 changes: 17 additions & 36 deletions trunk/drivers/scsi/isci/core/scic_sds_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ static struct scu_sgl_element_pair *scic_sds_request_get_sgl_element_pair(
*/
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;
Expand Down Expand Up @@ -190,7 +190,7 @@ static void scic_sds_ssp_io_request_assign_buffers(struct scic_sds_request *sci_
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->ssp.cmd;
Expand All @@ -211,7 +211,7 @@ static void scic_sds_io_request_build_ssp_command_iu(struct scic_sds_request *sc
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);

Expand Down Expand Up @@ -429,7 +429,7 @@ scic_io_request_construct_sata(struct scic_sds_request *sci_req,
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 */
Expand Down Expand Up @@ -478,7 +478,7 @@ scic_io_request_construct_sata(struct scic_sds_request *sci_req,
enum sci_status scic_io_request_construct_basic_ssp(
struct scic_sds_request *sci_req)
{
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);

sci_req->protocol = SCIC_SSP_PROTOCOL;
Expand Down Expand Up @@ -519,7 +519,7 @@ enum sci_status scic_io_request_construct_basic_sata(
enum sci_status status;
struct scic_sds_stp_request *stp_req;
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 = &sci_req->stp.req;
Expand All @@ -540,11 +540,10 @@ enum sci_status scic_io_request_construct_basic_sata(
}


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) {
Expand Down Expand Up @@ -740,7 +739,7 @@ void scic_sds_io_request_copy_response(struct scic_sds_request *sci_req)
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->ssp.rsp;
Expand Down Expand Up @@ -1342,7 +1341,7 @@ static void scic_sds_request_completed_state_enter(void *object)
struct scic_sds_controller *scic =
scic_sds_request_get_controller(sci_req);
struct isci_host *ihost = scic_to_ihost(scic);
struct isci_request *ireq = sci_req->ireq;
struct isci_request *ireq = sci_req_to_ireq(sci_req);

SET_STATE_HANDLER(sci_req,
scic_sds_request_state_handler_table,
Expand Down Expand Up @@ -1424,16 +1423,13 @@ static const struct sci_base_state scic_sds_request_state_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;
Expand Down Expand Up @@ -1461,20 +1457,13 @@ static void scic_sds_general_request_construct(struct scic_sds_controller *scic,
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)
Expand All @@ -1493,29 +1482,22 @@ scic_io_request_construct(struct scic_sds_controller *scic,
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);
Expand All @@ -1537,7 +1519,6 @@ enum sci_status scic_task_request_construct(struct scic_sds_controller *scic,
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;
Expand Down
14 changes: 0 additions & 14 deletions trunk/drivers/scsi/isci/core/scic_sds_request.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,26 +113,12 @@ enum scic_sds_smp_request_started_substates {
SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_TC_COMPLETION,
};

struct isci_request;
/**
* struct scic_sds_request - This structure contains or references all of
* the data necessary to process a task management or normal IO request.
*
*
*/
struct scic_sds_request {
/**
* The field specifies that the peer object for the request object.
*/
struct isci_request *ireq;

/**
* This field contains the information for the base request state machine.
*/
struct sci_base_state_machine state_machine;

void *user_request;

/**
* This field simply points to the controller to which this IO request
* is associated.
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/scsi/isci/core/scic_sds_stp_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ scic_sds_stp_request_pio_data_in_copy_data_buffer(struct scic_sds_stp_request *s
int total_len = len;

sci_req = to_sci_req(stp_req);
ireq = scic_sds_request_get_user_request(sci_req);
ireq = sci_req_to_ireq(sci_req);
task = isci_request_access_task(ireq);
src_addr = data_buf;

Expand Down Expand Up @@ -737,7 +737,7 @@ static enum sci_status scic_sds_stp_request_pio_await_frame_frame_handler(struct
{
struct scic_sds_controller *scic = sci_req->owning_controller;
struct scic_sds_stp_request *stp_req = &sci_req->stp.req;
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 dev_to_host_fis *frame_header;
enum sci_status status;
Expand Down
36 changes: 1 addition & 35 deletions trunk/drivers/scsi/isci/core/scic_task_request.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,44 +72,10 @@ struct scic_sds_remote_device;
struct scic_sds_controller;


/**
* scic_task_request_construct() - This method is called by the SCI user to
* construct all SCI Core task management requests, regardless of protocol.
* Memory initialization and functionality common to all task request types
* is performed in this method.
* @scic_controller: the handle to the core controller object for which to
* build the task managmement request.
* @scic_remote_device: the handle to the core remote device object for which
* to build the task management request. passed, then a copy of the request
* is built internally. The request will be copied into the actual
* controller request memory when the task is allocated internally during
* the scic_controller_start_task() method.
* @io_tag: This parameter specifies the IO tag to be associated with this
* request. If SCI_CONTROLLER_INVALID_IO_TAG is passed, then a copy of the
* request is built internally. The request will be copied into the actual
* controller request memory when the IO tag is allocated internally during
* the scic_controller_start_io() method.
* @user_task_request_object: This parameter specifies the user task request to
* be utilized during construction. This task pointer will become the
* associated object for the core task request object.
* @scic_task_request_memory: This parameter specifies the memory location to
* be utilized when building the core request.
* @new_scic_task_request_handle: This parameter specifies a pointer to the
* handle the core will expect in further interactions with the core task
* request object.
*
* The SCI core implementation will create an association between the user task
* request object and the core task request object. Indicate if the controller
* successfully built the task request. SCI_SUCCESS This value is returned if
* the task request was successfully built.
*/
enum sci_status scic_task_request_construct(
struct scic_sds_controller *scic_controller,
struct scic_sds_remote_device *scic_remote_device,
u16 io_tag,
void *user_task_request_object,
void *scic_task_request_memory,
struct scic_sds_request **new_scic_task_request_handle);
u16 io_tag, struct scic_sds_request *sci_req);

/**
* scic_task_request_construct_ssp() - This method is called by the SCI user to
Expand Down
8 changes: 1 addition & 7 deletions trunk/drivers/scsi/isci/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,14 +428,8 @@ int isci_host_init(struct isci_host *isci_host)
if (err)
return err;

/*
* keep the pool alloc size around, will use it for a bounds checking
* when trying to convert virtual addresses to physical addresses
*/
isci_host->dma_pool_alloc_size = sizeof(struct isci_request) +
sizeof(struct scic_sds_request);
isci_host->dma_pool = dmam_pool_create(DRV_NAME, &isci_host->pdev->dev,
isci_host->dma_pool_alloc_size,
sizeof(struct isci_request),
SLAB_HWCACHE_ALIGN, 0);

if (!isci_host->dma_pool)
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/scsi/isci/host.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ struct isci_host {
struct list_head timers;
void *core_ctrl_memory;
struct dma_pool *dma_pool;
unsigned int dma_pool_alloc_size;
struct isci_phy phys[SCI_MAX_PHYS];
struct isci_port ports[SCI_MAX_PORTS + 1]; /* includes dummy port */
struct sas_ha_struct sas_ha;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/scsi/isci/remote_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic
struct sci_base_state_machine *sm = &sci_dev->state_machine;
enum scic_sds_remote_device_states state = sm->current_state_id;
struct scic_sds_port *sci_port = sci_dev->owning_port;
struct isci_request *ireq = sci_req->ireq;
struct isci_request *ireq = sci_req_to_ireq(sci_req);
enum sci_status status;

switch (state) {
Expand Down
Loading

0 comments on commit e7d0699

Please sign in to comment.