diff options
author | Dan Williams <dan.j.williams@intel.com> | 2011-06-30 20:38:32 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-07-03 07:04:52 -0400 |
commit | d9dcb4ba791de2a06b19ac47cd61601cf3d4e208 (patch) | |
tree | 4b818b5b14c078703c034489c92e74975be6c06f /drivers/scsi/isci/host.h | |
parent | 78a6f06e0e82125787d7aa308fe28c2c8381540c (diff) |
isci: unify isci_host and scic_sds_controller
Remove the distinction between these two implementations and unify on
isci_host (local instances named ihost). Hmmm, we had two
'oem_parameters' instances, one was unused... nice.
Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci/host.h')
-rw-r--r-- | drivers/scsi/isci/host.h | 210 |
1 files changed, 46 insertions, 164 deletions
diff --git a/drivers/scsi/isci/host.h b/drivers/scsi/isci/host.h index ca2e3b0ee0dd..013f672a8fd7 100644 --- a/drivers/scsi/isci/host.h +++ b/drivers/scsi/isci/host.h | |||
@@ -106,7 +106,7 @@ struct scic_power_control { | |||
106 | }; | 106 | }; |
107 | 107 | ||
108 | struct scic_sds_port_configuration_agent; | 108 | struct scic_sds_port_configuration_agent; |
109 | typedef void (*port_config_fn)(struct scic_sds_controller *, | 109 | typedef void (*port_config_fn)(struct isci_host *, |
110 | struct scic_sds_port_configuration_agent *, | 110 | struct scic_sds_port_configuration_agent *, |
111 | struct isci_port *, struct isci_phy *); | 111 | struct isci_port *, struct isci_phy *); |
112 | 112 | ||
@@ -124,171 +124,66 @@ struct scic_sds_port_configuration_agent { | |||
124 | }; | 124 | }; |
125 | 125 | ||
126 | /** | 126 | /** |
127 | * struct scic_sds_controller - | 127 | * isci_host - primary host/controller object |
128 | * | 128 | * @timer: timeout start/stop operations |
129 | * This structure represents the SCU controller object. | 129 | * @device_table: rni (hw remote node index) to remote device lookup table |
130 | * @available_remote_nodes: rni allocator | ||
131 | * @power_control: manage device spin up | ||
132 | * @io_request_sequence: generation number for tci's (task contexts) | ||
133 | * @task_context_table: hw task context table | ||
134 | * @remote_node_context_table: hw remote node context table | ||
135 | * @completion_queue: hw-producer driver-consumer communication ring | ||
136 | * @completion_queue_get: tracks the driver 'head' of the ring to notify hw | ||
137 | * @logical_port_entries: min({driver|silicon}-supported-port-count) | ||
138 | * @remote_node_entries: min({driver|silicon}-supported-node-count) | ||
139 | * @task_context_entries: min({driver|silicon}-supported-task-count) | ||
140 | * @phy_timer: phy startup timer | ||
141 | * @invalid_phy_mask: if an invalid_link_up notification is reported a bit for | ||
142 | * the phy index is set so further notifications are not | ||
143 | * made. Once the phy reports link up and is made part of a | ||
144 | * port then this bit is cleared. | ||
145 | |||
130 | */ | 146 | */ |
131 | struct scic_sds_controller { | 147 | struct isci_host { |
132 | /** | ||
133 | * This field contains the information for the base controller state | ||
134 | * machine. | ||
135 | */ | ||
136 | struct sci_base_state_machine sm; | 148 | struct sci_base_state_machine sm; |
137 | 149 | /* XXX can we time this externally */ | |
138 | /** | ||
139 | * Timer for controller start/stop operations. | ||
140 | */ | ||
141 | struct sci_timer timer; | 150 | struct sci_timer timer; |
142 | 151 | /* XXX drop reference module params directly */ | |
143 | /** | ||
144 | * This field contains the user parameters to be utilized for this | ||
145 | * core controller object. | ||
146 | */ | ||
147 | union scic_user_parameters user_parameters; | 152 | union scic_user_parameters user_parameters; |
148 | 153 | /* XXX no need to be a union */ | |
149 | /** | ||
150 | * This field contains the OEM parameters to be utilized for this | ||
151 | * core controller object. | ||
152 | */ | ||
153 | union scic_oem_parameters oem_parameters; | 154 | union scic_oem_parameters oem_parameters; |
154 | |||
155 | /** | ||
156 | * This field contains the port configuration agent for this controller. | ||
157 | */ | ||
158 | struct scic_sds_port_configuration_agent port_agent; | 155 | struct scic_sds_port_configuration_agent port_agent; |
159 | |||
160 | /** | ||
161 | * This field is the array of device objects that are currently constructed | ||
162 | * for this controller object. This table is used as a fast lookup of device | ||
163 | * objects that need to handle device completion notifications from the | ||
164 | * hardware. The table is RNi based. | ||
165 | */ | ||
166 | struct isci_remote_device *device_table[SCI_MAX_REMOTE_DEVICES]; | 156 | struct isci_remote_device *device_table[SCI_MAX_REMOTE_DEVICES]; |
167 | |||
168 | /** | ||
169 | * This field is the free RNi data structure | ||
170 | */ | ||
171 | struct scic_remote_node_table available_remote_nodes; | 157 | struct scic_remote_node_table available_remote_nodes; |
172 | |||
173 | /** | ||
174 | * This filed is the struct scic_power_control data used to controll when direct | ||
175 | * attached devices can consume power. | ||
176 | */ | ||
177 | struct scic_power_control power_control; | 158 | struct scic_power_control power_control; |
178 | |||
179 | /* sequence number per tci */ | ||
180 | u8 io_request_sequence[SCI_MAX_IO_REQUESTS]; | 159 | u8 io_request_sequence[SCI_MAX_IO_REQUESTS]; |
181 | |||
182 | /** | ||
183 | * This field is a pointer to the memory allocated by the driver for the task | ||
184 | * context table. This data is shared between the hardware and software. | ||
185 | */ | ||
186 | struct scu_task_context *task_context_table; | 160 | struct scu_task_context *task_context_table; |
187 | dma_addr_t task_context_dma; | 161 | dma_addr_t task_context_dma; |
188 | |||
189 | /** | ||
190 | * This field is a pointer to the memory allocated by the driver for the | ||
191 | * remote node context table. This table is shared between the hardware and | ||
192 | * software. | ||
193 | */ | ||
194 | union scu_remote_node_context *remote_node_context_table; | 162 | union scu_remote_node_context *remote_node_context_table; |
195 | |||
196 | /** | ||
197 | * This field is a pointer to the completion queue. This memory is | ||
198 | * written to by the hardware and read by the software. | ||
199 | */ | ||
200 | u32 *completion_queue; | 163 | u32 *completion_queue; |
201 | |||
202 | /** | ||
203 | * This field is the software copy of the completion queue get pointer. The | ||
204 | * controller object writes this value to the hardware after processing the | ||
205 | * completion entries. | ||
206 | */ | ||
207 | u32 completion_queue_get; | 164 | u32 completion_queue_get; |
208 | |||
209 | /** | ||
210 | * This field is the minimum of the number of hardware supported port entries | ||
211 | * and the software requested port entries. | ||
212 | */ | ||
213 | u32 logical_port_entries; | 165 | u32 logical_port_entries; |
214 | |||
215 | /** | ||
216 | * This field is the minimum number of devices supported by the hardware and | ||
217 | * the number of devices requested by the software. | ||
218 | */ | ||
219 | u32 remote_node_entries; | 166 | u32 remote_node_entries; |
220 | |||
221 | /** | ||
222 | * This field is the minimum number of IO requests supported by the hardware | ||
223 | * and the number of IO requests requested by the software. | ||
224 | */ | ||
225 | u32 task_context_entries; | 167 | u32 task_context_entries; |
226 | |||
227 | /** | ||
228 | * This object contains all of the unsolicited frame specific | ||
229 | * data utilized by the core controller. | ||
230 | */ | ||
231 | struct scic_sds_unsolicited_frame_control uf_control; | 168 | struct scic_sds_unsolicited_frame_control uf_control; |
232 | 169 | ||
233 | /* Phy Startup Data */ | 170 | /* phy startup */ |
234 | /** | ||
235 | * Timer for controller phy request startup. On controller start the | ||
236 | * controller will start each PHY individually in order of phy index. | ||
237 | */ | ||
238 | struct sci_timer phy_timer; | 171 | struct sci_timer phy_timer; |
239 | 172 | /* XXX kill */ | |
240 | /** | ||
241 | * This field is set when the phy_timer is running and is cleared when | ||
242 | * the phy_timer is stopped. | ||
243 | */ | ||
244 | bool phy_startup_timer_pending; | 173 | bool phy_startup_timer_pending; |
245 | |||
246 | /** | ||
247 | * This field is the index of the next phy start. It is initialized to 0 and | ||
248 | * increments for each phy index that is started. | ||
249 | */ | ||
250 | u32 next_phy_to_start; | 174 | u32 next_phy_to_start; |
251 | |||
252 | /** | ||
253 | * This field controlls the invalid link up notifications to the SCI_USER. If | ||
254 | * an invalid_link_up notification is reported a bit for the PHY index is set | ||
255 | * so further notifications are not made. Once the PHY object reports link up | ||
256 | * and is made part of a port then this bit for the PHY index is cleared. | ||
257 | */ | ||
258 | u8 invalid_phy_mask; | 175 | u8 invalid_phy_mask; |
259 | 176 | ||
260 | /* | 177 | /* TODO attempt dynamic interrupt coalescing scheme */ |
261 | * This field saves the current interrupt coalescing number of the controller. | ||
262 | */ | ||
263 | u16 interrupt_coalesce_number; | 178 | u16 interrupt_coalesce_number; |
264 | |||
265 | /* | ||
266 | * This field saves the current interrupt coalescing timeout value in microseconds. | ||
267 | */ | ||
268 | u32 interrupt_coalesce_timeout; | 179 | u32 interrupt_coalesce_timeout; |
269 | |||
270 | /** | ||
271 | * This field is a pointer to the memory mapped register space for the | ||
272 | * struct smu_registers. | ||
273 | */ | ||
274 | struct smu_registers __iomem *smu_registers; | 180 | struct smu_registers __iomem *smu_registers; |
275 | |||
276 | /** | ||
277 | * This field is a pointer to the memory mapped register space for the | ||
278 | * struct scu_registers. | ||
279 | */ | ||
280 | struct scu_registers __iomem *scu_registers; | 181 | struct scu_registers __iomem *scu_registers; |
281 | 182 | ||
282 | }; | ||
283 | |||
284 | struct isci_host { | ||
285 | struct scic_sds_controller sci; | ||
286 | u16 tci_head; | 183 | u16 tci_head; |
287 | u16 tci_tail; | 184 | u16 tci_tail; |
288 | u16 tci_pool[SCI_MAX_IO_REQUESTS]; | 185 | u16 tci_pool[SCI_MAX_IO_REQUESTS]; |
289 | 186 | ||
290 | union scic_oem_parameters oem_parameters; | ||
291 | |||
292 | int id; /* unique within a given pci device */ | 187 | int id; /* unique within a given pci device */ |
293 | struct isci_phy phys[SCI_MAX_PHYS]; | 188 | struct isci_phy phys[SCI_MAX_PHYS]; |
294 | struct isci_port ports[SCI_MAX_PORTS + 1]; /* includes dummy port */ | 189 | struct isci_port ports[SCI_MAX_PORTS + 1]; /* includes dummy port */ |
@@ -464,14 +359,6 @@ static inline struct isci_host *dev_to_ihost(struct domain_device *dev) | |||
464 | return dev->port->ha->lldd_ha; | 359 | return dev->port->ha->lldd_ha; |
465 | } | 360 | } |
466 | 361 | ||
467 | static inline struct isci_host *scic_to_ihost(struct scic_sds_controller *scic) | ||
468 | { | ||
469 | /* XXX delete after merging scic_sds_contoller and isci_host */ | ||
470 | struct isci_host *ihost = container_of(scic, typeof(*ihost), sci); | ||
471 | |||
472 | return ihost; | ||
473 | } | ||
474 | |||
475 | /** | 362 | /** |
476 | * scic_sds_controller_get_protocol_engine_group() - | 363 | * scic_sds_controller_get_protocol_engine_group() - |
477 | * | 364 | * |
@@ -518,11 +405,6 @@ static inline int scic_sds_remote_device_node_count(struct isci_remote_device *i | |||
518 | #define scic_sds_controller_clear_invalid_phy(controller, phy) \ | 405 | #define scic_sds_controller_clear_invalid_phy(controller, phy) \ |
519 | ((controller)->invalid_phy_mask &= ~(1 << (phy)->phy_index)) | 406 | ((controller)->invalid_phy_mask &= ~(1 << (phy)->phy_index)) |
520 | 407 | ||
521 | static inline struct device *scic_to_dev(struct scic_sds_controller *scic) | ||
522 | { | ||
523 | return &scic_to_ihost(scic)->pdev->dev; | ||
524 | } | ||
525 | |||
526 | static inline struct device *sciphy_to_dev(struct isci_phy *iphy) | 408 | static inline struct device *sciphy_to_dev(struct isci_phy *iphy) |
527 | { | 409 | { |
528 | 410 | ||
@@ -578,54 +460,54 @@ static inline bool is_c0(void) | |||
578 | return isci_si_rev > ISCI_SI_REVB0; | 460 | return isci_si_rev > ISCI_SI_REVB0; |
579 | } | 461 | } |
580 | 462 | ||
581 | void scic_sds_controller_post_request(struct scic_sds_controller *scic, | 463 | void scic_sds_controller_post_request(struct isci_host *ihost, |
582 | u32 request); | 464 | u32 request); |
583 | void scic_sds_controller_release_frame(struct scic_sds_controller *scic, | 465 | void scic_sds_controller_release_frame(struct isci_host *ihost, |
584 | u32 frame_index); | 466 | u32 frame_index); |
585 | void scic_sds_controller_copy_sata_response(void *response_buffer, | 467 | void scic_sds_controller_copy_sata_response(void *response_buffer, |
586 | void *frame_header, | 468 | void *frame_header, |
587 | void *frame_buffer); | 469 | void *frame_buffer); |
588 | enum sci_status scic_sds_controller_allocate_remote_node_context(struct scic_sds_controller *scic, | 470 | enum sci_status scic_sds_controller_allocate_remote_node_context(struct isci_host *ihost, |
589 | struct isci_remote_device *idev, | 471 | struct isci_remote_device *idev, |
590 | u16 *node_id); | 472 | u16 *node_id); |
591 | void scic_sds_controller_free_remote_node_context( | 473 | void scic_sds_controller_free_remote_node_context( |
592 | struct scic_sds_controller *scic, | 474 | struct isci_host *ihost, |
593 | struct isci_remote_device *idev, | 475 | struct isci_remote_device *idev, |
594 | u16 node_id); | 476 | u16 node_id); |
595 | union scu_remote_node_context *scic_sds_controller_get_remote_node_context_buffer( | 477 | union scu_remote_node_context *scic_sds_controller_get_remote_node_context_buffer( |
596 | struct scic_sds_controller *scic, | 478 | struct isci_host *ihost, |
597 | u16 node_id); | 479 | u16 node_id); |
598 | 480 | ||
599 | struct isci_request *scic_request_by_tag(struct scic_sds_controller *scic, | 481 | struct isci_request *scic_request_by_tag(struct isci_host *ihost, |
600 | u16 io_tag); | 482 | u16 io_tag); |
601 | 483 | ||
602 | void scic_sds_controller_power_control_queue_insert( | 484 | void scic_sds_controller_power_control_queue_insert( |
603 | struct scic_sds_controller *scic, | 485 | struct isci_host *ihost, |
604 | struct isci_phy *iphy); | 486 | struct isci_phy *iphy); |
605 | 487 | ||
606 | void scic_sds_controller_power_control_queue_remove( | 488 | void scic_sds_controller_power_control_queue_remove( |
607 | struct scic_sds_controller *scic, | 489 | struct isci_host *ihost, |
608 | struct isci_phy *iphy); | 490 | struct isci_phy *iphy); |
609 | 491 | ||
610 | void scic_sds_controller_link_up( | 492 | void scic_sds_controller_link_up( |
611 | struct scic_sds_controller *scic, | 493 | struct isci_host *ihost, |
612 | struct isci_port *iport, | 494 | struct isci_port *iport, |
613 | struct isci_phy *iphy); | 495 | struct isci_phy *iphy); |
614 | 496 | ||
615 | void scic_sds_controller_link_down( | 497 | void scic_sds_controller_link_down( |
616 | struct scic_sds_controller *scic, | 498 | struct isci_host *ihost, |
617 | struct isci_port *iport, | 499 | struct isci_port *iport, |
618 | struct isci_phy *iphy); | 500 | struct isci_phy *iphy); |
619 | 501 | ||
620 | void scic_sds_controller_remote_device_stopped( | 502 | void scic_sds_controller_remote_device_stopped( |
621 | struct scic_sds_controller *scic, | 503 | struct isci_host *ihost, |
622 | struct isci_remote_device *idev); | 504 | struct isci_remote_device *idev); |
623 | 505 | ||
624 | void scic_sds_controller_copy_task_context( | 506 | void scic_sds_controller_copy_task_context( |
625 | struct scic_sds_controller *scic, | 507 | struct isci_host *ihost, |
626 | struct isci_request *ireq); | 508 | struct isci_request *ireq); |
627 | 509 | ||
628 | void scic_sds_controller_register_setup(struct scic_sds_controller *scic); | 510 | void scic_sds_controller_register_setup(struct isci_host *ihost); |
629 | 511 | ||
630 | enum sci_status scic_controller_continue_io(struct isci_request *ireq); | 512 | enum sci_status scic_controller_continue_io(struct isci_request *ireq); |
631 | int isci_host_scan_finished(struct Scsi_Host *, unsigned long); | 513 | int isci_host_scan_finished(struct Scsi_Host *, unsigned long); |
@@ -655,25 +537,25 @@ void isci_host_remote_device_start_complete( | |||
655 | enum sci_status); | 537 | enum sci_status); |
656 | 538 | ||
657 | void scic_controller_disable_interrupts( | 539 | void scic_controller_disable_interrupts( |
658 | struct scic_sds_controller *scic); | 540 | struct isci_host *ihost); |
659 | 541 | ||
660 | enum sci_status scic_controller_start_io( | 542 | enum sci_status scic_controller_start_io( |
661 | struct scic_sds_controller *scic, | 543 | struct isci_host *ihost, |
662 | struct isci_remote_device *idev, | 544 | struct isci_remote_device *idev, |
663 | struct isci_request *ireq); | 545 | struct isci_request *ireq); |
664 | 546 | ||
665 | enum sci_task_status scic_controller_start_task( | 547 | enum sci_task_status scic_controller_start_task( |
666 | struct scic_sds_controller *scic, | 548 | struct isci_host *ihost, |
667 | struct isci_remote_device *idev, | 549 | struct isci_remote_device *idev, |
668 | struct isci_request *ireq); | 550 | struct isci_request *ireq); |
669 | 551 | ||
670 | enum sci_status scic_controller_terminate_request( | 552 | enum sci_status scic_controller_terminate_request( |
671 | struct scic_sds_controller *scic, | 553 | struct isci_host *ihost, |
672 | struct isci_remote_device *idev, | 554 | struct isci_remote_device *idev, |
673 | struct isci_request *ireq); | 555 | struct isci_request *ireq); |
674 | 556 | ||
675 | enum sci_status scic_controller_complete_io( | 557 | enum sci_status scic_controller_complete_io( |
676 | struct scic_sds_controller *scic, | 558 | struct isci_host *ihost, |
677 | struct isci_remote_device *idev, | 559 | struct isci_remote_device *idev, |
678 | struct isci_request *ireq); | 560 | struct isci_request *ireq); |
679 | 561 | ||
@@ -681,6 +563,6 @@ void scic_sds_port_configuration_agent_construct( | |||
681 | struct scic_sds_port_configuration_agent *port_agent); | 563 | struct scic_sds_port_configuration_agent *port_agent); |
682 | 564 | ||
683 | enum sci_status scic_sds_port_configuration_agent_initialize( | 565 | enum sci_status scic_sds_port_configuration_agent_initialize( |
684 | struct scic_sds_controller *controller, | 566 | struct isci_host *ihost, |
685 | struct scic_sds_port_configuration_agent *port_agent); | 567 | struct scic_sds_port_configuration_agent *port_agent); |
686 | #endif | 568 | #endif |