aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci/port.h
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2011-06-29 16:09:25 -0400
committerDan Williams <dan.j.williams@intel.com>2011-07-03 07:04:52 -0400
commitffe191c92ff195d73f9130b1490045ca2dd4c5e0 (patch)
treec14a78903734b7f5e662e7cf49db4d7fd24e4d71 /drivers/scsi/isci/port.h
parent76802ce6756d605fbd7a9a43c196e9a471b3e57c (diff)
isci: unify isci_port and scic_sds_port
Remove the distinction between these two implementations and unify on isci_port (local instances named iport). The duplicate '->owning_port' and '->isci_port' in both isci_phy and isci_remote_device will be fixed in a later patch... this is just the straightforward rename/unification. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci/port.h')
-rw-r--r--drivers/scsi/isci/port.h174
1 files changed, 51 insertions, 123 deletions
diff --git a/drivers/scsi/isci/port.h b/drivers/scsi/isci/port.h
index b6ce56a6c11d..cdea48ece005 100644
--- a/drivers/scsi/isci/port.h
+++ b/drivers/scsi/isci/port.h
@@ -76,100 +76,19 @@ enum isci_status {
76}; 76};
77 77
78/** 78/**
79 * struct scic_sds_port 79 * struct isci_port - isci direct attached sas port object
80 * 80 * @event: counts bcns and port stop events (for bcn filtering)
81 * The core port object provides the the abstraction for an SCU port. 81 * @ready_exit: several states constitute 'ready'. When exiting ready we
82 */ 82 * need to take extra port-teardown actions that are
83struct scic_sds_port { 83 * skipped when exiting to another 'ready' state.
84 /** 84 * @logical_port_index: software port index
85 * This field contains the information for the base port state machine. 85 * @physical_port_index: hardware port index
86 */ 86 * @active_phy_mask: identifies phy members
87 struct sci_base_state_machine sm; 87 * @reserved_tag:
88 88 * @reserved_rni: reserver for port task scheduler workaround
89 bool ready_exit; 89 * @started_request_count: reference count for outstanding commands
90 90 * @not_ready_reason: set during state transitions and notified
91 /** 91 * @timer: timeout start/stop operations
92 * This field is the port index that is reported to the SCI USER.
93 * This allows the actual hardware physical port to change without
94 * the SCI USER getting a different answer for the get port index.
95 */
96 u8 logical_port_index;
97
98 /**
99 * This field is the port index used to program the SCU hardware.
100 */
101 u8 physical_port_index;
102
103 /**
104 * This field contains the active phy mask for the port.
105 * This mask is used in conjunction with the phy state to determine
106 * which phy to select for some port operations.
107 */
108 u8 active_phy_mask;
109
110 u16 reserved_rni;
111 u16 reserved_tag;
112
113 /**
114 * This field contains the count of the io requests started on this port
115 * object. It is used to control controller shutdown.
116 */
117 u32 started_request_count;
118
119 /**
120 * This field contains the number of devices assigned to this port.
121 * It is used to control port start requests.
122 */
123 u32 assigned_device_count;
124
125 /**
126 * This field contains the reason for the port not going ready. It is
127 * assigned in the state handlers and used in the state transition.
128 */
129 u32 not_ready_reason;
130
131 /**
132 * This field is the table of phys assigned to the port.
133 */
134 struct isci_phy *phy_table[SCI_MAX_PHYS];
135
136 /**
137 * This field is a pointer back to the controller that owns this
138 * port object.
139 */
140 struct scic_sds_controller *owning_controller;
141
142 /* timer used for port start/stop operations */
143 struct sci_timer timer;
144
145 /**
146 * This field is the pointer to the port task scheduler registers
147 * for the SCU hardware.
148 */
149 struct scu_port_task_scheduler_registers __iomem
150 *port_task_scheduler_registers;
151
152 /**
153 * This field is identical for all port objects and points to the port
154 * task scheduler group PE configuration registers.
155 * It is used to assign PEs to a port.
156 */
157 u32 __iomem *port_pe_configuration_register;
158
159 /**
160 * This field is the VIIT register space for ths port object.
161 */
162 struct scu_viit_entry __iomem *viit_registers;
163};
164
165
166
167/**
168 * struct isci_port - This class represents the port object used to internally
169 * represent libsas port objects. It also keeps a list of remote device
170 * objects.
171 *
172 *
173 */ 92 */
174struct isci_port { 93struct isci_port {
175 enum isci_status status; 94 enum isci_status status;
@@ -185,16 +104,25 @@ struct isci_port {
185 struct completion start_complete; 104 struct completion start_complete;
186 struct completion hard_reset_complete; 105 struct completion hard_reset_complete;
187 enum sci_status hard_reset_status; 106 enum sci_status hard_reset_status;
188 struct scic_sds_port sci; 107 struct sci_base_state_machine sm;
108 bool ready_exit;
109 u8 logical_port_index;
110 u8 physical_port_index;
111 u8 active_phy_mask;
112 u16 reserved_rni;
113 u16 reserved_tag;
114 u32 started_request_count;
115 u32 assigned_device_count;
116 u32 not_ready_reason;
117 struct isci_phy *phy_table[SCI_MAX_PHYS];
118 struct scic_sds_controller *owning_controller;
119 struct sci_timer timer;
120 struct scu_port_task_scheduler_registers __iomem *port_task_scheduler_registers;
121 /* XXX rework: only one register, no need to replicate per-port */
122 u32 __iomem *port_pe_configuration_register;
123 struct scu_viit_entry __iomem *viit_registers;
189}; 124};
190 125
191static inline struct isci_port *sci_port_to_iport(struct scic_sds_port *sci_port)
192{
193 struct isci_port *iport = container_of(sci_port, typeof(*iport), sci);
194
195 return iport;
196}
197
198enum scic_port_not_ready_reason_code { 126enum scic_port_not_ready_reason_code {
199 SCIC_PORT_NOT_READY_NO_ACTIVE_PHYS, 127 SCIC_PORT_NOT_READY_NO_ACTIVE_PHYS,
200 SCIC_PORT_NOT_READY_HARD_RESET_REQUESTED, 128 SCIC_PORT_NOT_READY_HARD_RESET_REQUESTED,
@@ -299,90 +227,90 @@ enum scic_sds_port_states {
299 ((this_port)->physical_port_index) 227 ((this_port)->physical_port_index)
300 228
301 229
302static inline void scic_sds_port_decrement_request_count(struct scic_sds_port *sci_port) 230static inline void scic_sds_port_decrement_request_count(struct isci_port *iport)
303{ 231{
304 if (WARN_ONCE(sci_port->started_request_count == 0, 232 if (WARN_ONCE(iport->started_request_count == 0,
305 "%s: tried to decrement started_request_count past 0!?", 233 "%s: tried to decrement started_request_count past 0!?",
306 __func__)) 234 __func__))
307 /* pass */; 235 /* pass */;
308 else 236 else
309 sci_port->started_request_count--; 237 iport->started_request_count--;
310} 238}
311 239
312#define scic_sds_port_active_phy(port, phy) \ 240#define scic_sds_port_active_phy(port, phy) \
313 (((port)->active_phy_mask & (1 << (phy)->phy_index)) != 0) 241 (((port)->active_phy_mask & (1 << (phy)->phy_index)) != 0)
314 242
315void scic_sds_port_construct( 243void scic_sds_port_construct(
316 struct scic_sds_port *sci_port, 244 struct isci_port *iport,
317 u8 port_index, 245 u8 port_index,
318 struct scic_sds_controller *scic); 246 struct scic_sds_controller *scic);
319 247
320enum sci_status scic_sds_port_initialize( 248enum sci_status scic_sds_port_initialize(
321 struct scic_sds_port *sci_port, 249 struct isci_port *iport,
322 void __iomem *port_task_scheduler_registers, 250 void __iomem *port_task_scheduler_registers,
323 void __iomem *port_configuration_regsiter, 251 void __iomem *port_configuration_regsiter,
324 void __iomem *viit_registers); 252 void __iomem *viit_registers);
325 253
326enum sci_status scic_sds_port_start(struct scic_sds_port *sci_port); 254enum sci_status scic_sds_port_start(struct isci_port *iport);
327enum sci_status scic_sds_port_stop(struct scic_sds_port *sci_port); 255enum sci_status scic_sds_port_stop(struct isci_port *iport);
328 256
329enum sci_status scic_sds_port_add_phy( 257enum sci_status scic_sds_port_add_phy(
330 struct scic_sds_port *sci_port, 258 struct isci_port *iport,
331 struct isci_phy *iphy); 259 struct isci_phy *iphy);
332 260
333enum sci_status scic_sds_port_remove_phy( 261enum sci_status scic_sds_port_remove_phy(
334 struct scic_sds_port *sci_port, 262 struct isci_port *iport,
335 struct isci_phy *iphy); 263 struct isci_phy *iphy);
336 264
337void scic_sds_port_setup_transports( 265void scic_sds_port_setup_transports(
338 struct scic_sds_port *sci_port, 266 struct isci_port *iport,
339 u32 device_id); 267 u32 device_id);
340 268
341void isci_port_bcn_enable(struct isci_host *, struct isci_port *); 269void isci_port_bcn_enable(struct isci_host *, struct isci_port *);
342 270
343void scic_sds_port_deactivate_phy( 271void scic_sds_port_deactivate_phy(
344 struct scic_sds_port *sci_port, 272 struct isci_port *iport,
345 struct isci_phy *iphy, 273 struct isci_phy *iphy,
346 bool do_notify_user); 274 bool do_notify_user);
347 275
348bool scic_sds_port_link_detected( 276bool scic_sds_port_link_detected(
349 struct scic_sds_port *sci_port, 277 struct isci_port *iport,
350 struct isci_phy *iphy); 278 struct isci_phy *iphy);
351 279
352enum sci_status scic_sds_port_link_up(struct scic_sds_port *sci_port, 280enum sci_status scic_sds_port_link_up(struct isci_port *iport,
353 struct isci_phy *iphy); 281 struct isci_phy *iphy);
354enum sci_status scic_sds_port_link_down(struct scic_sds_port *sci_port, 282enum sci_status scic_sds_port_link_down(struct isci_port *iport,
355 struct isci_phy *iphy); 283 struct isci_phy *iphy);
356 284
357struct isci_request; 285struct isci_request;
358struct scic_sds_remote_device; 286struct scic_sds_remote_device;
359enum sci_status scic_sds_port_start_io( 287enum sci_status scic_sds_port_start_io(
360 struct scic_sds_port *sci_port, 288 struct isci_port *iport,
361 struct scic_sds_remote_device *sci_dev, 289 struct scic_sds_remote_device *sci_dev,
362 struct isci_request *ireq); 290 struct isci_request *ireq);
363 291
364enum sci_status scic_sds_port_complete_io( 292enum sci_status scic_sds_port_complete_io(
365 struct scic_sds_port *sci_port, 293 struct isci_port *iport,
366 struct scic_sds_remote_device *sci_dev, 294 struct scic_sds_remote_device *sci_dev,
367 struct isci_request *ireq); 295 struct isci_request *ireq);
368 296
369enum sas_linkrate scic_sds_port_get_max_allowed_speed( 297enum sas_linkrate scic_sds_port_get_max_allowed_speed(
370 struct scic_sds_port *sci_port); 298 struct isci_port *iport);
371 299
372void scic_sds_port_broadcast_change_received( 300void scic_sds_port_broadcast_change_received(
373 struct scic_sds_port *sci_port, 301 struct isci_port *iport,
374 struct isci_phy *iphy); 302 struct isci_phy *iphy);
375 303
376bool scic_sds_port_is_valid_phy_assignment( 304bool scic_sds_port_is_valid_phy_assignment(
377 struct scic_sds_port *sci_port, 305 struct isci_port *iport,
378 u32 phy_index); 306 u32 phy_index);
379 307
380void scic_sds_port_get_sas_address( 308void scic_sds_port_get_sas_address(
381 struct scic_sds_port *sci_port, 309 struct isci_port *iport,
382 struct sci_sas_address *sas_address); 310 struct sci_sas_address *sas_address);
383 311
384void scic_sds_port_get_attached_sas_address( 312void scic_sds_port_get_attached_sas_address(
385 struct scic_sds_port *sci_port, 313 struct isci_port *iport,
386 struct sci_sas_address *sas_address); 314 struct sci_sas_address *sas_address);
387 315
388enum isci_status isci_port_get_state( 316enum isci_status isci_port_get_state(