aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci/remote_device.h
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2011-06-30 19:31:37 -0400
committerDan Williams <dan.j.williams@intel.com>2011-07-03 07:04:52 -0400
commit78a6f06e0e82125787d7aa308fe28c2c8381540c (patch)
tree55ab54546aab6dbaccda4ff6d196d8995f453c83 /drivers/scsi/isci/remote_device.h
parentffe191c92ff195d73f9130b1490045ca2dd4c5e0 (diff)
isci: unify isci_remote_device and scic_sds_remote_device
Remove the distinction between these two implementations and unify on isci_remote_device (local instances named idev). Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci/remote_device.h')
-rw-r--r--drivers/scsi/isci/remote_device.h148
1 files changed, 47 insertions, 101 deletions
diff --git a/drivers/scsi/isci/remote_device.h b/drivers/scsi/isci/remote_device.h
index 578d75b8cd16..45798582fc14 100644
--- a/drivers/scsi/isci/remote_device.h
+++ b/drivers/scsi/isci/remote_device.h
@@ -70,65 +70,14 @@ enum scic_remote_device_not_ready_reason_code {
70 SCIC_REMOTE_DEVICE_NOT_READY_REASON_CODE_MAX 70 SCIC_REMOTE_DEVICE_NOT_READY_REASON_CODE_MAX
71}; 71};
72 72
73struct scic_sds_remote_device { 73/**
74 /** 74 * isci_remote_device - isci representation of a sas expander / end point
75 * This field contains the information for the base remote device state 75 * @device_port_width: hw setting for number of simultaneous connections
76 * machine. 76 * @connection_rate: per-taskcontext connection rate for this device
77 */ 77 * @working_request: SATA requests have no tag we for unaccelerated
78 struct sci_base_state_machine sm; 78 * protocols we need a method to associate unsolicited
79 79 * frames with a pending request
80 /** 80 */
81 * This field is the programmed device port width. This value is
82 * written to the RCN data structure to tell the SCU how many open
83 * connections this device can have.
84 */
85 u32 device_port_width;
86
87 /**
88 * This field is the programmed connection rate for this remote device. It is
89 * used to program the TC with the maximum allowed connection rate.
90 */
91 enum sas_linkrate connection_rate;
92
93 /**
94 * This filed is assinged the value of true if the device is directly
95 * attached to the port.
96 */
97 bool is_direct_attached;
98
99 /**
100 * This filed contains a pointer back to the port to which this device
101 * is assigned.
102 */
103 struct isci_port *owning_port;
104
105 /**
106 * This field contains the SCU silicon remote node context specific
107 * information.
108 */
109 struct scic_sds_remote_node_context rnc;
110
111 /**
112 * This field contains the stated request count for the remote device. The
113 * device can not reach the SCI_DEV_STOPPED until all
114 * requests are complete and the rnc_posted value is false.
115 */
116 u32 started_request_count;
117
118 /**
119 * This field contains a pointer to the working request object. It is only
120 * used only for SATA requests since the unsolicited frames we get from the
121 * hardware have no Tag value to look up the io request object.
122 */
123 struct isci_request *working_request;
124
125 /**
126 * This field contains the reason for the remote device going not_ready. It is
127 * assigned in the state handlers and used in the state transition.
128 */
129 u32 not_ready_reason;
130};
131
132struct isci_remote_device { 81struct isci_remote_device {
133 #define IDEV_START_PENDING 0 82 #define IDEV_START_PENDING 0
134 #define IDEV_STOP_PENDING 1 83 #define IDEV_STOP_PENDING 1
@@ -143,7 +92,16 @@ struct isci_remote_device {
143 struct domain_device *domain_dev; 92 struct domain_device *domain_dev;
144 struct list_head node; 93 struct list_head node;
145 struct list_head reqs_in_process; 94 struct list_head reqs_in_process;
146 struct scic_sds_remote_device sci; 95 struct sci_base_state_machine sm;
96 u32 device_port_width;
97 enum sas_linkrate connection_rate;
98 bool is_direct_attached;
99 struct isci_port *owning_port;
100 struct scic_sds_remote_node_context rnc;
101 /* XXX unify with device reference counting and delete */
102 u32 started_request_count;
103 struct isci_request *working_request;
104 u32 not_ready_reason;
147}; 105};
148 106
149#define ISCI_REMOTE_DEVICE_START_TIMEOUT 5000 107#define ISCI_REMOTE_DEVICE_START_TIMEOUT 5000
@@ -191,7 +149,7 @@ void isci_device_clear_reset_pending(struct isci_host *ihost,
191 * successfully stopped. 149 * successfully stopped.
192 */ 150 */
193enum sci_status scic_remote_device_stop( 151enum sci_status scic_remote_device_stop(
194 struct scic_sds_remote_device *remote_device, 152 struct isci_remote_device *idev,
195 u32 timeout); 153 u32 timeout);
196 154
197/** 155/**
@@ -207,7 +165,7 @@ enum sci_status scic_remote_device_stop(
207 * started. 165 * started.
208 */ 166 */
209enum sci_status scic_remote_device_reset( 167enum sci_status scic_remote_device_reset(
210 struct scic_sds_remote_device *remote_device); 168 struct isci_remote_device *idev);
211 169
212/** 170/**
213 * scic_remote_device_reset_complete() - This method informs the device object 171 * scic_remote_device_reset_complete() - This method informs the device object
@@ -220,7 +178,7 @@ enum sci_status scic_remote_device_reset(
220 * is resuming operation. 178 * is resuming operation.
221 */ 179 */
222enum sci_status scic_remote_device_reset_complete( 180enum sci_status scic_remote_device_reset_complete(
223 struct scic_sds_remote_device *remote_device); 181 struct isci_remote_device *idev);
224 182
225#define scic_remote_device_is_atapi(device_handle) false 183#define scic_remote_device_is_atapi(device_handle) false
226 184
@@ -335,27 +293,15 @@ enum scic_sds_remote_device_states {
335 SCI_DEV_FINAL, 293 SCI_DEV_FINAL,
336}; 294};
337 295
338static inline struct scic_sds_remote_device *rnc_to_dev(struct scic_sds_remote_node_context *rnc) 296static inline struct isci_remote_device *rnc_to_dev(struct scic_sds_remote_node_context *rnc)
339{ 297{
340 struct scic_sds_remote_device *sci_dev; 298 struct isci_remote_device *idev;
341 299
342 sci_dev = container_of(rnc, typeof(*sci_dev), rnc); 300 idev = container_of(rnc, typeof(*idev), rnc);
343
344 return sci_dev;
345}
346
347static inline struct isci_remote_device *sci_dev_to_idev(struct scic_sds_remote_device *sci_dev)
348{
349 struct isci_remote_device *idev = container_of(sci_dev, typeof(*idev), sci);
350 301
351 return idev; 302 return idev;
352} 303}
353 304
354static inline struct domain_device *sci_dev_to_domain(struct scic_sds_remote_device *sci_dev)
355{
356 return sci_dev_to_idev(sci_dev)->domain_dev;
357}
358
359static inline bool dev_is_expander(struct domain_device *dev) 305static inline bool dev_is_expander(struct domain_device *dev)
360{ 306{
361 return dev->dev_type == EDGE_DEV || dev->dev_type == FANOUT_DEV; 307 return dev->dev_type == EDGE_DEV || dev->dev_type == FANOUT_DEV;
@@ -366,8 +312,8 @@ static inline bool dev_is_expander(struct domain_device *dev)
366 * 312 *
367 * This macro incrments the request count for this device 313 * This macro incrments the request count for this device
368 */ 314 */
369#define scic_sds_remote_device_increment_request_count(sci_dev) \ 315#define scic_sds_remote_device_increment_request_count(idev) \
370 ((sci_dev)->started_request_count++) 316 ((idev)->started_request_count++)
371 317
372/** 318/**
373 * scic_sds_remote_device_decrement_request_count() - 319 * scic_sds_remote_device_decrement_request_count() -
@@ -375,44 +321,44 @@ static inline bool dev_is_expander(struct domain_device *dev)
375 * This macro decrements the request count for this device. This count will 321 * This macro decrements the request count for this device. This count will
376 * never decrment past 0. 322 * never decrment past 0.
377 */ 323 */
378#define scic_sds_remote_device_decrement_request_count(sci_dev) \ 324#define scic_sds_remote_device_decrement_request_count(idev) \
379 ((sci_dev)->started_request_count > 0 ? \ 325 ((idev)->started_request_count > 0 ? \
380 (sci_dev)->started_request_count-- : 0) 326 (idev)->started_request_count-- : 0)
381 327
382/** 328/**
383 * scic_sds_remote_device_get_request_count() - 329 * scic_sds_remote_device_get_request_count() -
384 * 330 *
385 * This is a helper macro to return the current device request count. 331 * This is a helper macro to return the current device request count.
386 */ 332 */
387#define scic_sds_remote_device_get_request_count(sci_dev) \ 333#define scic_sds_remote_device_get_request_count(idev) \
388 ((sci_dev)->started_request_count) 334 ((idev)->started_request_count)
389 335
390/** 336/**
391 * scic_sds_remote_device_get_controller() - 337 * scic_sds_remote_device_get_controller() -
392 * 338 *
393 * This macro returns the controller object that contains this device object 339 * This macro returns the controller object that contains this device object
394 */ 340 */
395#define scic_sds_remote_device_get_controller(sci_dev) \ 341#define scic_sds_remote_device_get_controller(idev) \
396 scic_sds_port_get_controller(scic_sds_remote_device_get_port(sci_dev)) 342 scic_sds_port_get_controller(scic_sds_remote_device_get_port(idev))
397 343
398/** 344/**
399 * scic_sds_remote_device_get_port() - 345 * scic_sds_remote_device_get_port() -
400 * 346 *
401 * This macro returns the owning port of this device 347 * This macro returns the owning port of this device
402 */ 348 */
403#define scic_sds_remote_device_get_port(sci_dev) \ 349#define scic_sds_remote_device_get_port(idev) \
404 ((sci_dev)->owning_port) 350 ((idev)->owning_port)
405 351
406/** 352/**
407 * scic_sds_remote_device_get_controller_peg() - 353 * scic_sds_remote_device_get_controller_peg() -
408 * 354 *
409 * This macro returns the controllers protocol engine group 355 * This macro returns the controllers protocol engine group
410 */ 356 */
411#define scic_sds_remote_device_get_controller_peg(sci_dev) \ 357#define scic_sds_remote_device_get_controller_peg(idev) \
412 (\ 358 (\
413 scic_sds_controller_get_protocol_engine_group(\ 359 scic_sds_controller_get_protocol_engine_group(\
414 scic_sds_port_get_controller(\ 360 scic_sds_port_get_controller(\
415 scic_sds_remote_device_get_port(sci_dev) \ 361 scic_sds_remote_device_get_port(idev) \
416 ) \ 362 ) \
417 ) \ 363 ) \
418 ) 364 )
@@ -422,8 +368,8 @@ static inline bool dev_is_expander(struct domain_device *dev)
422 * 368 *
423 * This macro returns the remote node index for this device object 369 * This macro returns the remote node index for this device object
424 */ 370 */
425#define scic_sds_remote_device_get_index(sci_dev) \ 371#define scic_sds_remote_device_get_index(idev) \
426 ((sci_dev)->rnc.remote_node_index) 372 ((idev)->rnc.remote_node_index)
427 373
428/** 374/**
429 * scic_sds_remote_device_build_command_context() - 375 * scic_sds_remote_device_build_command_context() -
@@ -448,36 +394,36 @@ static inline bool dev_is_expander(struct domain_device *dev)
448 ((device)->working_request = (request)) 394 ((device)->working_request = (request))
449 395
450enum sci_status scic_sds_remote_device_frame_handler( 396enum sci_status scic_sds_remote_device_frame_handler(
451 struct scic_sds_remote_device *sci_dev, 397 struct isci_remote_device *idev,
452 u32 frame_index); 398 u32 frame_index);
453 399
454enum sci_status scic_sds_remote_device_event_handler( 400enum sci_status scic_sds_remote_device_event_handler(
455 struct scic_sds_remote_device *sci_dev, 401 struct isci_remote_device *idev,
456 u32 event_code); 402 u32 event_code);
457 403
458enum sci_status scic_sds_remote_device_start_io( 404enum sci_status scic_sds_remote_device_start_io(
459 struct scic_sds_controller *controller, 405 struct scic_sds_controller *controller,
460 struct scic_sds_remote_device *sci_dev, 406 struct isci_remote_device *idev,
461 struct isci_request *ireq); 407 struct isci_request *ireq);
462 408
463enum sci_status scic_sds_remote_device_start_task( 409enum sci_status scic_sds_remote_device_start_task(
464 struct scic_sds_controller *controller, 410 struct scic_sds_controller *controller,
465 struct scic_sds_remote_device *sci_dev, 411 struct isci_remote_device *idev,
466 struct isci_request *ireq); 412 struct isci_request *ireq);
467 413
468enum sci_status scic_sds_remote_device_complete_io( 414enum sci_status scic_sds_remote_device_complete_io(
469 struct scic_sds_controller *controller, 415 struct scic_sds_controller *controller,
470 struct scic_sds_remote_device *sci_dev, 416 struct isci_remote_device *idev,
471 struct isci_request *ireq); 417 struct isci_request *ireq);
472 418
473enum sci_status scic_sds_remote_device_suspend( 419enum sci_status scic_sds_remote_device_suspend(
474 struct scic_sds_remote_device *sci_dev, 420 struct isci_remote_device *idev,
475 u32 suspend_type); 421 u32 suspend_type);
476 422
477void scic_sds_remote_device_post_request( 423void scic_sds_remote_device_post_request(
478 struct scic_sds_remote_device *sci_dev, 424 struct isci_remote_device *idev,
479 u32 request); 425 u32 request);
480 426
481#define scic_sds_remote_device_is_atapi(sci_dev) false 427#define scic_sds_remote_device_is_atapi(idev) false
482 428
483#endif /* !defined(_ISCI_REMOTE_DEVICE_H_) */ 429#endif /* !defined(_ISCI_REMOTE_DEVICE_H_) */