Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 254419
b: refs/heads/master
c: 9614395
h: refs/heads/master
i:
  254417: ae2a2f4
  254415: d5dcbda
v: v3
  • Loading branch information
Dan Williams committed Jul 3, 2011
1 parent 42ac11c commit 4ae58de
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 91 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: 7ab92c9ed22b49a50d9a10bbfdf4ee8ffe62c324
refs/heads/master: 9614395ea2eed076fa8341df422582b0017d330c
7 changes: 2 additions & 5 deletions trunk/drivers/scsi/isci/core/scic_sds_remote_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -1672,11 +1672,8 @@ void scic_remote_device_construct(struct scic_sds_port *sci_port,
&sci_dev->state_machine
);

scic_sds_remote_node_context_construct(
sci_dev,
&sci_dev->rnc,
SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX
);
scic_sds_remote_node_context_construct(&sci_dev->rnc,
SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX);

sci_object_set_association(&sci_dev->rnc, sci_dev);
}
9 changes: 9 additions & 0 deletions trunk/drivers/scsi/isci/core/scic_sds_remote_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,15 @@ struct scic_sds_remote_device {
const struct scic_sds_remote_device_state_handler *state_handlers;
};

static inline struct scic_sds_remote_device *rnc_to_dev(struct scic_sds_remote_node_context *rnc)
{
struct scic_sds_remote_device *sci_dev;

sci_dev = container_of(rnc, typeof(*sci_dev), rnc);

return sci_dev;
}

typedef enum sci_status (*scic_sds_remote_device_request_handler_t)(
struct scic_sds_remote_device *device,
struct scic_sds_request *request);
Expand Down
124 changes: 52 additions & 72 deletions trunk/drivers/scsi/isci/core/scic_sds_remote_node_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,27 +108,24 @@ static void scic_sds_remote_node_context_construct_buffer(
struct scic_sds_remote_node_context *sci_rnc)
{
union scu_remote_node_context *rnc;
struct scic_sds_remote_device *sci_dev = rnc_to_dev(sci_rnc);
struct scic_sds_controller *scic;

scic = scic_sds_remote_device_get_controller(sci_rnc->device);
scic = scic_sds_remote_device_get_controller(sci_dev);

rnc = scic_sds_controller_get_remote_node_context_buffer(
scic, sci_rnc->remote_node_index);

memset(
rnc,
0x00,
sizeof(union scu_remote_node_context)
* scic_sds_remote_device_node_count(sci_rnc->device)
);
memset(rnc, 0, sizeof(union scu_remote_node_context)
* scic_sds_remote_device_node_count(sci_dev));

rnc->ssp.remote_node_index = sci_rnc->remote_node_index;
rnc->ssp.remote_node_port_width = sci_rnc->device->device_port_width;
rnc->ssp.remote_node_port_width = sci_dev->device_port_width;
rnc->ssp.logical_port_index =
scic_sds_remote_device_get_port_index(sci_rnc->device);
scic_sds_remote_device_get_port_index(sci_dev);

rnc->ssp.remote_sas_address_hi = SCIC_SWAP_DWORD(sci_rnc->device->device_address.high);
rnc->ssp.remote_sas_address_lo = SCIC_SWAP_DWORD(sci_rnc->device->device_address.low);
rnc->ssp.remote_sas_address_hi = SCIC_SWAP_DWORD(sci_dev->device_address.high);
rnc->ssp.remote_sas_address_lo = SCIC_SWAP_DWORD(sci_dev->device_address.low);

rnc->ssp.nexus_loss_timer_enable = true;
rnc->ssp.check_bit = false;
Expand All @@ -140,8 +137,8 @@ static void scic_sds_remote_node_context_construct_buffer(


if (
sci_rnc->device->target_protocols.u.bits.attached_sata_device
|| sci_rnc->device->target_protocols.u.bits.attached_stp_target
sci_dev->target_protocols.u.bits.attached_sata_device
|| sci_dev->target_protocols.u.bits.attached_stp_target
) {
rnc->ssp.connection_occupancy_timeout =
scic->user_parameters.sds1.stp_max_occupancy_timeout;
Expand All @@ -157,7 +154,7 @@ static void scic_sds_remote_node_context_construct_buffer(
rnc->ssp.initial_arbitration_wait_time = 0;

/* Open Address Frame Parameters */
rnc->ssp.oaf_connection_rate = sci_rnc->device->connection_rate;
rnc->ssp.oaf_connection_rate = sci_dev->connection_rate;
rnc->ssp.oaf_features = 0;
rnc->ssp.oaf_source_zone_group = 0;
rnc->ssp.oaf_more_compatibility_features = 0;
Expand Down Expand Up @@ -234,7 +231,7 @@ static enum sci_status scic_sds_remote_node_context_default_destruct_handler(
scics_sds_remote_node_context_callback callback,
void *callback_parameter)
{
dev_warn(scirdev_to_dev(sci_rnc->device),
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
"%s: SCIC Remote Node Context 0x%p requested to stop while "
"in unexpected state %d\n",
__func__,
Expand All @@ -253,7 +250,7 @@ static enum sci_status scic_sds_remote_node_context_default_suspend_handler(
scics_sds_remote_node_context_callback callback,
void *callback_parameter)
{
dev_warn(scirdev_to_dev(sci_rnc->device),
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
"%s: SCIC Remote Node Context 0x%p requested to suspend "
"while in wrong state %d\n",
__func__,
Expand All @@ -268,7 +265,7 @@ static enum sci_status scic_sds_remote_node_context_default_resume_handler(
scics_sds_remote_node_context_callback callback,
void *callback_parameter)
{
dev_warn(scirdev_to_dev(sci_rnc->device),
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
"%s: SCIC Remote Node Context 0x%p requested to resume "
"while in wrong state %d\n",
__func__,
Expand All @@ -282,7 +279,7 @@ static enum sci_status scic_sds_remote_node_context_default_start_io_handler(
struct scic_sds_remote_node_context *sci_rnc,
struct scic_sds_request *sci_req)
{
dev_warn(scirdev_to_dev(sci_rnc->device),
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
"%s: SCIC Remote Node Context 0x%p requested to start io "
"0x%p while in wrong state %d\n",
__func__,
Expand All @@ -297,7 +294,7 @@ static enum sci_status scic_sds_remote_node_context_default_start_task_handler(
struct scic_sds_remote_node_context *sci_rnc,
struct scic_sds_request *sci_req)
{
dev_warn(scirdev_to_dev(sci_rnc->device),
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
"%s: SCIC Remote Node Context 0x%p requested to start "
"task 0x%p while in wrong state %d\n",
__func__,
Expand All @@ -312,7 +309,7 @@ static enum sci_status scic_sds_remote_node_context_default_event_handler(
struct scic_sds_remote_node_context *sci_rnc,
u32 event_code)
{
dev_warn(scirdev_to_dev(sci_rnc->device),
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
"%s: SCIC Remote Node Context 0x%p requested to process "
"event 0x%x while in wrong state %d\n",
__func__,
Expand Down Expand Up @@ -412,7 +409,7 @@ static enum sci_status scic_sds_remote_node_context_posting_state_event_handler(

default:
status = SCI_FAILURE;
dev_warn(scirdev_to_dev(sci_rnc->device),
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
"%s: SCIC Remote Node Context 0x%p requested to "
"process unexpected event 0x%x while in posting "
"state\n",
Expand Down Expand Up @@ -466,7 +463,7 @@ static enum sci_status scic_sds_remote_node_context_invalidating_state_event_han
/*
* We really dont care if the hardware is going to suspend
* the device since it's being invalidated anyway */
dev_dbg(scirdev_to_dev(sci_rnc->device),
dev_dbg(scirdev_to_dev(rnc_to_dev(sci_rnc)),
"%s: SCIC Remote Node Context 0x%p was "
"suspeneded by hardware while being "
"invalidated.\n",
Expand All @@ -476,7 +473,7 @@ static enum sci_status scic_sds_remote_node_context_invalidating_state_event_han
break;

default:
dev_warn(scirdev_to_dev(sci_rnc->device),
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
"%s: SCIC Remote Node Context 0x%p "
"requested to process event 0x%x while "
"in state %d.\n",
Expand Down Expand Up @@ -516,7 +513,7 @@ static enum sci_status scic_sds_remote_node_context_resuming_state_event_handler
/*
* We really dont care if the hardware is going to suspend
* the device since it's being resumed anyway */
dev_dbg(scirdev_to_dev(sci_rnc->device),
dev_dbg(scirdev_to_dev(rnc_to_dev(sci_rnc)),
"%s: SCIC Remote Node Context 0x%p was "
"suspeneded by hardware while being resumed.\n",
__func__,
Expand All @@ -525,7 +522,7 @@ static enum sci_status scic_sds_remote_node_context_resuming_state_event_handler
break;

default:
dev_warn(scirdev_to_dev(sci_rnc->device),
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
"%s: SCIC Remote Node Context 0x%p requested "
"to process event 0x%x while in state %d.\n",
__func__,
Expand Down Expand Up @@ -563,10 +560,8 @@ static enum sci_status scic_sds_remote_node_context_ready_state_suspend_handler(
sci_rnc->suspension_code = suspend_type;

if (suspend_type == SCI_SOFTWARE_SUSPENSION) {
scic_sds_remote_device_post_request(
sci_rnc->device,
SCU_CONTEXT_COMMAND_POST_RNC_SUSPEND_TX
);
scic_sds_remote_device_post_request(rnc_to_dev(sci_rnc),
SCU_CONTEXT_COMMAND_POST_RNC_SUSPEND_TX);
}

sci_base_state_machine_change_state(
Expand Down Expand Up @@ -622,7 +617,7 @@ static enum sci_status scic_sds_remote_node_context_ready_state_event_handler(
break;

default:
dev_warn(scirdev_to_dev(sci_rnc->device),
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
"%s: SCIC Remote Node Context 0x%p requested to "
"process event 0x%x while in state %d.\n",
__func__,
Expand Down Expand Up @@ -654,7 +649,7 @@ static enum sci_status scic_sds_remote_node_context_tx_suspended_state_resume_ha

/* TODO: consider adding a resume action of NONE, INVALIDATE, WRITE_TLCR */

scic_remote_device_get_protocols(sci_rnc->device, &protocols);
scic_remote_device_get_protocols(rnc_to_dev(sci_rnc), &protocols);

if (
(protocols.u.bits.attached_ssp_target == 1)
Expand All @@ -667,7 +662,7 @@ static enum sci_status scic_sds_remote_node_context_tx_suspended_state_resume_ha

status = SCI_SUCCESS;
} else if (protocols.u.bits.attached_stp_target == 1) {
if (sci_rnc->device->is_direct_attached) {
if (rnc_to_dev(sci_rnc)->is_direct_attached) {
/* @todo Fix this since I am being silly in writing to the STPTLDARNI register. */
sci_base_state_machine_change_state(
&sci_rnc->state_machine,
Expand Down Expand Up @@ -792,7 +787,7 @@ static enum sci_status scic_sds_remote_node_context_await_suspension_state_event
break;

default:
dev_warn(scirdev_to_dev(sci_rnc->device),
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
"%s: SCIC Remote Node Context 0x%p requested to "
"process event 0x%x while in state %d.\n",
__func__,
Expand Down Expand Up @@ -937,34 +932,26 @@ static void scic_sds_remote_node_context_continue_state_transitions(
static void scic_sds_remote_node_context_validate_context_buffer(
struct scic_sds_remote_node_context *sci_rnc)
{
struct scic_sds_remote_device *sci_dev = rnc_to_dev(sci_rnc);
union scu_remote_node_context *rnc_buffer;

rnc_buffer = scic_sds_controller_get_remote_node_context_buffer(
scic_sds_remote_device_get_controller(sci_rnc->device),
scic_sds_remote_device_get_controller(sci_dev),
sci_rnc->remote_node_index
);

rnc_buffer->ssp.is_valid = true;

if (
!sci_rnc->device->is_direct_attached
&& sci_rnc->device->target_protocols.u.bits.attached_stp_target
) {
scic_sds_remote_device_post_request(
sci_rnc->device,
SCU_CONTEXT_COMMAND_POST_RNC_96
);
if (!sci_dev->is_direct_attached &&
sci_dev->target_protocols.u.bits.attached_stp_target) {
scic_sds_remote_device_post_request(sci_dev,
SCU_CONTEXT_COMMAND_POST_RNC_96);
} else {
scic_sds_remote_device_post_request(
sci_rnc->device,
SCU_CONTEXT_COMMAND_POST_RNC_32
);
scic_sds_remote_device_post_request(sci_dev, SCU_CONTEXT_COMMAND_POST_RNC_32);

if (sci_rnc->device->is_direct_attached) {
scic_sds_port_setup_transports(
sci_rnc->device->owning_port,
sci_rnc->remote_node_index
);
if (sci_dev->is_direct_attached) {
scic_sds_port_setup_transports(sci_dev->owning_port,
sci_rnc->remote_node_index);
}
}
}
Expand All @@ -981,16 +968,13 @@ static void scic_sds_remote_node_context_invalidate_context_buffer(
union scu_remote_node_context *rnc_buffer;

rnc_buffer = scic_sds_controller_get_remote_node_context_buffer(
scic_sds_remote_device_get_controller(sci_rnc->device),
sci_rnc->remote_node_index
);
scic_sds_remote_device_get_controller(rnc_to_dev(sci_rnc)),
sci_rnc->remote_node_index);

rnc_buffer->ssp.is_valid = false;

scic_sds_remote_device_post_request(
sci_rnc->device,
SCU_CONTEXT_COMMAND_POST_RNC_INVALIDATE
);
scic_sds_remote_device_post_request(rnc_to_dev(sci_rnc),
SCU_CONTEXT_COMMAND_POST_RNC_INVALIDATE);
}

/*
Expand Down Expand Up @@ -1081,8 +1065,10 @@ static void scic_sds_remote_node_context_resuming_state_enter(
{
struct scic_sds_remote_node_context *rnc;
struct smp_discover_response_protocols protocols;
struct scic_sds_remote_device *sci_dev;

rnc = (struct scic_sds_remote_node_context *)object;
sci_dev = rnc_to_dev(rnc);

SET_STATE_HANDLER(
rnc,
Expand All @@ -1096,18 +1082,15 @@ static void scic_sds_remote_node_context_resuming_state_enter(
* resume because of a target reset we also need to update
* the STPTLDARNI register with the RNi of the device
*/
scic_remote_device_get_protocols(rnc->device, &protocols);
scic_remote_device_get_protocols(sci_dev, &protocols);

if ((protocols.u.bits.attached_stp_target == 1) &&
(rnc->device->is_direct_attached)) {
scic_sds_port_setup_transports(
rnc->device->owning_port, rnc->remote_node_index);
if (protocols.u.bits.attached_stp_target == 1 &&
sci_dev->is_direct_attached) {
scic_sds_port_setup_transports(sci_dev->owning_port,
rnc->remote_node_index);
}

scic_sds_remote_device_post_request(
rnc->device,
SCU_CONTEXT_COMMAND_POST_RNC_RESUME
);
scic_sds_remote_device_post_request(sci_dev, SCU_CONTEXT_COMMAND_POST_RNC_RESUME);
}

/**
Expand Down Expand Up @@ -1225,15 +1208,12 @@ static const struct sci_base_state scic_sds_remote_node_context_state_table[] =
},
};

void scic_sds_remote_node_context_construct(
struct scic_sds_remote_device *device,
struct scic_sds_remote_node_context *rnc,
u16 remote_node_index)
void scic_sds_remote_node_context_construct(struct scic_sds_remote_node_context *rnc,
u16 remote_node_index)
{
memset(rnc, 0, sizeof(struct scic_sds_remote_node_context));

rnc->remote_node_index = remote_node_index;
rnc->device = device;
rnc->destination_state = SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_UNSPECIFIED;

sci_base_state_machine_construct(
Expand Down
15 changes: 2 additions & 13 deletions trunk/drivers/scsi/isci/core/scic_sds_remote_node_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,6 @@ struct scic_sds_remote_node_context {
*/
struct sci_base_object parent;

/**
* This pointer simply points to the remote device object containing
* this RNC.
*
* @todo Consider making the device pointer the associated object of the
* the parent object.
*/
struct scic_sds_remote_device *device;

/**
* This field indicates the remote node index (RNI) associated with
* this RNC.
Expand Down Expand Up @@ -279,10 +270,8 @@ struct scic_sds_remote_node_context {
struct scic_sds_remote_node_context_handlers *state_handlers;
};

void scic_sds_remote_node_context_construct(
struct scic_sds_remote_device *device,
struct scic_sds_remote_node_context *rnc,
u16 remote_node_index);
void scic_sds_remote_node_context_construct(struct scic_sds_remote_node_context *rnc,
u16 remote_node_index);


bool scic_sds_remote_node_context_is_ready(
Expand Down

0 comments on commit 4ae58de

Please sign in to comment.