aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2012-02-01 03:23:10 -0500
committerDan Williams <dan.j.williams@intel.com>2012-05-17 15:27:11 -0400
commit11cc51835af0e6fbb2da9cb012bdaaa036497b7f (patch)
treec9afaa1c1afc1e185b85fa6137e60282657e1778 /drivers/scsi/isci
parent14e99b4a3f5323bb961754de5024daff79e59b98 (diff)
isci: kill ->is_direct_attached
domain_device ->parent conveys the same information. Occurrences of ->is_direct_attached appear next to incomplete open-coded versions of dev_is_sata(), clean those up as well. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci')
-rw-r--r--drivers/scsi/isci/host.h4
-rw-r--r--drivers/scsi/isci/remote_device.c29
-rw-r--r--drivers/scsi/isci/remote_device.h1
-rw-r--r--drivers/scsi/isci/remote_node_context.c27
-rw-r--r--drivers/scsi/isci/request.c5
5 files changed, 17 insertions, 49 deletions
diff --git a/drivers/scsi/isci/host.h b/drivers/scsi/isci/host.h
index adbad69d1069..a9679ee7084b 100644
--- a/drivers/scsi/isci/host.h
+++ b/drivers/scsi/isci/host.h
@@ -55,6 +55,7 @@
55#ifndef _SCI_HOST_H_ 55#ifndef _SCI_HOST_H_
56#define _SCI_HOST_H_ 56#define _SCI_HOST_H_
57 57
58#include <scsi/sas_ata.h>
58#include "remote_device.h" 59#include "remote_device.h"
59#include "phy.h" 60#include "phy.h"
60#include "isci.h" 61#include "isci.h"
@@ -378,8 +379,7 @@ static inline int sci_remote_device_node_count(struct isci_remote_device *idev)
378{ 379{
379 struct domain_device *dev = idev->domain_dev; 380 struct domain_device *dev = idev->domain_dev;
380 381
381 if ((dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) && 382 if (dev_is_sata(dev) && dev->parent)
382 !idev->is_direct_attached)
383 return SCU_STP_REMOTE_NODE_COUNT; 383 return SCU_STP_REMOTE_NODE_COUNT;
384 return SCU_SSP_REMOTE_NODE_COUNT; 384 return SCU_SSP_REMOTE_NODE_COUNT;
385} 385}
diff --git a/drivers/scsi/isci/remote_device.c b/drivers/scsi/isci/remote_device.c
index 8f501b0a81d6..71f509064737 100644
--- a/drivers/scsi/isci/remote_device.c
+++ b/drivers/scsi/isci/remote_device.c
@@ -1113,33 +1113,20 @@ static enum sci_status sci_remote_device_da_construct(struct isci_port *iport,
1113{ 1113{
1114 enum sci_status status; 1114 enum sci_status status;
1115 struct sci_port_properties properties; 1115 struct sci_port_properties properties;
1116 struct domain_device *dev = idev->domain_dev;
1117 1116
1118 sci_remote_device_construct(iport, idev); 1117 sci_remote_device_construct(iport, idev);
1119 1118
1120 /*
1121 * This information is request to determine how many remote node context
1122 * entries will be needed to store the remote node.
1123 */
1124 idev->is_direct_attached = true;
1125
1126 sci_port_get_properties(iport, &properties); 1119 sci_port_get_properties(iport, &properties);
1127 /* Get accurate port width from port's phy mask for a DA device. */ 1120 /* Get accurate port width from port's phy mask for a DA device. */
1128 idev->device_port_width = hweight32(properties.phy_mask); 1121 idev->device_port_width = hweight32(properties.phy_mask);
1129 1122
1130 status = sci_controller_allocate_remote_node_context(iport->owning_controller, 1123 status = sci_controller_allocate_remote_node_context(iport->owning_controller,
1131 idev, 1124 idev,
1132 &idev->rnc.remote_node_index); 1125 &idev->rnc.remote_node_index);
1133 1126
1134 if (status != SCI_SUCCESS) 1127 if (status != SCI_SUCCESS)
1135 return status; 1128 return status;
1136 1129
1137 if (dev->dev_type == SAS_END_DEV || dev->dev_type == SATA_DEV ||
1138 (dev->tproto & SAS_PROTOCOL_STP) || dev_is_expander(dev))
1139 /* pass */;
1140 else
1141 return SCI_FAILURE_UNSUPPORTED_PROTOCOL;
1142
1143 idev->connection_rate = sci_port_get_max_allowed_speed(iport); 1130 idev->connection_rate = sci_port_get_max_allowed_speed(iport);
1144 1131
1145 return SCI_SUCCESS; 1132 return SCI_SUCCESS;
@@ -1171,19 +1158,13 @@ static enum sci_status sci_remote_device_ea_construct(struct isci_port *iport,
1171 if (status != SCI_SUCCESS) 1158 if (status != SCI_SUCCESS)
1172 return status; 1159 return status;
1173 1160
1174 if (dev->dev_type == SAS_END_DEV || dev->dev_type == SATA_DEV || 1161 /* For SAS-2 the physical link rate is actually a logical link
1175 (dev->tproto & SAS_PROTOCOL_STP) || dev_is_expander(dev))
1176 /* pass */;
1177 else
1178 return SCI_FAILURE_UNSUPPORTED_PROTOCOL;
1179
1180 /*
1181 * For SAS-2 the physical link rate is actually a logical link
1182 * rate that incorporates multiplexing. The SCU doesn't 1162 * rate that incorporates multiplexing. The SCU doesn't
1183 * incorporate multiplexing and for the purposes of the 1163 * incorporate multiplexing and for the purposes of the
1184 * connection the logical link rate is that same as the 1164 * connection the logical link rate is that same as the
1185 * physical. Furthermore, the SAS-2 and SAS-1.1 fields overlay 1165 * physical. Furthermore, the SAS-2 and SAS-1.1 fields overlay
1186 * one another, so this code works for both situations. */ 1166 * one another, so this code works for both situations.
1167 */
1187 idev->connection_rate = min_t(u16, sci_port_get_max_allowed_speed(iport), 1168 idev->connection_rate = min_t(u16, sci_port_get_max_allowed_speed(iport),
1188 dev->linkrate); 1169 dev->linkrate);
1189 1170
diff --git a/drivers/scsi/isci/remote_device.h b/drivers/scsi/isci/remote_device.h
index 58637ee08f55..4a67ff0eb94e 100644
--- a/drivers/scsi/isci/remote_device.h
+++ b/drivers/scsi/isci/remote_device.h
@@ -94,7 +94,6 @@ struct isci_remote_device {
94 struct sci_base_state_machine sm; 94 struct sci_base_state_machine sm;
95 u32 device_port_width; 95 u32 device_port_width;
96 enum sas_linkrate connection_rate; 96 enum sas_linkrate connection_rate;
97 bool is_direct_attached;
98 struct isci_port *owning_port; 97 struct isci_port *owning_port;
99 struct sci_remote_node_context rnc; 98 struct sci_remote_node_context rnc;
100 /* XXX unify with device reference counting and delete */ 99 /* XXX unify with device reference counting and delete */
diff --git a/drivers/scsi/isci/remote_node_context.c b/drivers/scsi/isci/remote_node_context.c
index 994ec0c25a74..8ce5a35891e1 100644
--- a/drivers/scsi/isci/remote_node_context.c
+++ b/drivers/scsi/isci/remote_node_context.c
@@ -131,7 +131,7 @@ static void sci_remote_node_context_construct_buffer(struct sci_remote_node_cont
131 131
132 rnc->ssp.arbitration_wait_time = 0; 132 rnc->ssp.arbitration_wait_time = 0;
133 133
134 if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { 134 if (dev_is_sata(dev)) {
135 rnc->ssp.connection_occupancy_timeout = 135 rnc->ssp.connection_occupancy_timeout =
136 ihost->user_parameters.stp_max_occupancy_timeout; 136 ihost->user_parameters.stp_max_occupancy_timeout;
137 rnc->ssp.connection_inactivity_timeout = 137 rnc->ssp.connection_inactivity_timeout =
@@ -219,13 +219,12 @@ static void sci_remote_node_context_validate_context_buffer(struct sci_remote_no
219 219
220 rnc_buffer->ssp.is_valid = true; 220 rnc_buffer->ssp.is_valid = true;
221 221
222 if (!idev->is_direct_attached && 222 if (dev_is_sata(dev) && dev->parent) {
223 (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP))) {
224 sci_remote_device_post_request(idev, SCU_CONTEXT_COMMAND_POST_RNC_96); 223 sci_remote_device_post_request(idev, SCU_CONTEXT_COMMAND_POST_RNC_96);
225 } else { 224 } else {
226 sci_remote_device_post_request(idev, SCU_CONTEXT_COMMAND_POST_RNC_32); 225 sci_remote_device_post_request(idev, SCU_CONTEXT_COMMAND_POST_RNC_32);
227 226
228 if (idev->is_direct_attached) 227 if (!dev->parent)
229 sci_port_setup_transports(idev->owning_port, 228 sci_port_setup_transports(idev->owning_port,
230 sci_rnc->remote_node_index); 229 sci_rnc->remote_node_index);
231 } 230 }
@@ -287,10 +286,8 @@ static void sci_remote_node_context_resuming_state_enter(struct sci_base_state_m
287 * resume because of a target reset we also need to update 286 * resume because of a target reset we also need to update
288 * the STPTLDARNI register with the RNi of the device 287 * the STPTLDARNI register with the RNi of the device
289 */ 288 */
290 if ((dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) && 289 if (dev_is_sata(dev) && !dev->parent)
291 idev->is_direct_attached) 290 sci_port_setup_transports(idev->owning_port, rnc->remote_node_index);
292 sci_port_setup_transports(idev->owning_port,
293 rnc->remote_node_index);
294 291
295 sci_remote_device_post_request(idev, SCU_CONTEXT_COMMAND_POST_RNC_RESUME); 292 sci_remote_device_post_request(idev, SCU_CONTEXT_COMMAND_POST_RNC_RESUME);
296} 293}
@@ -553,18 +550,10 @@ enum sci_status sci_remote_node_context_resume(struct sci_remote_node_context *s
553 550
554 sci_remote_node_context_setup_to_resume(sci_rnc, cb_fn, cb_p); 551 sci_remote_node_context_setup_to_resume(sci_rnc, cb_fn, cb_p);
555 552
556 /* TODO: consider adding a resume action of NONE, INVALIDATE, WRITE_TLCR */ 553 if (dev_is_sata(dev) && dev->parent)
557 if (dev->dev_type == SAS_END_DEV || dev_is_expander(dev)) 554 sci_change_state(&sci_rnc->sm, SCI_RNC_INVALIDATING);
555 else
558 sci_change_state(&sci_rnc->sm, SCI_RNC_RESUMING); 556 sci_change_state(&sci_rnc->sm, SCI_RNC_RESUMING);
559 else if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) {
560 if (idev->is_direct_attached) {
561 /* @todo Fix this since I am being silly in writing to the STPTLDARNI register. */
562 sci_change_state(&sci_rnc->sm, SCI_RNC_RESUMING);
563 } else {
564 sci_change_state(&sci_rnc->sm, SCI_RNC_INVALIDATING);
565 }
566 } else
567 return SCI_FAILURE;
568 return SCI_SUCCESS; 557 return SCI_SUCCESS;
569 } 558 }
570 case SCI_RNC_TX_RX_SUSPENDED: 559 case SCI_RNC_TX_RX_SUSPENDED:
diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c
index 2def1e3960f6..01844ef19656 100644
--- a/drivers/scsi/isci/request.c
+++ b/drivers/scsi/isci/request.c
@@ -3193,7 +3193,7 @@ sci_io_request_construct(struct isci_host *ihost,
3193 3193
3194 if (dev->dev_type == SAS_END_DEV) 3194 if (dev->dev_type == SAS_END_DEV)
3195 /* pass */; 3195 /* pass */;
3196 else if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) 3196 else if (dev_is_sata(dev))
3197 memset(&ireq->stp.cmd, 0, sizeof(ireq->stp.cmd)); 3197 memset(&ireq->stp.cmd, 0, sizeof(ireq->stp.cmd));
3198 else if (dev_is_expander(dev)) 3198 else if (dev_is_expander(dev))
3199 /* pass */; 3199 /* pass */;
@@ -3215,8 +3215,7 @@ enum sci_status sci_task_request_construct(struct isci_host *ihost,
3215 /* Build the common part of the request */ 3215 /* Build the common part of the request */
3216 sci_general_request_construct(ihost, idev, ireq); 3216 sci_general_request_construct(ihost, idev, ireq);
3217 3217
3218 if (dev->dev_type == SAS_END_DEV || 3218 if (dev->dev_type == SAS_END_DEV || dev_is_sata(dev)) {
3219 dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) {
3220 set_bit(IREQ_TMF, &ireq->flags); 3219 set_bit(IREQ_TMF, &ireq->flags);
3221 memset(ireq->tc, 0, sizeof(struct scu_task_context)); 3220 memset(ireq->tc, 0, sizeof(struct scu_task_context));
3222 } else 3221 } else