aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci/host.c
diff options
context:
space:
mode:
authorArtur Wojcik <artur.wojcik@intel.com>2011-05-04 03:58:16 -0400
committerDan Williams <dan.j.williams@intel.com>2011-07-03 07:04:46 -0400
commitcc3dbd0a9178865d4444f8e28b51715808e9ac85 (patch)
tree4f8da28b4740e0ddaeb3163a3d317f36bc49571c /drivers/scsi/isci/host.c
parentd06b487b78f28a02efdcdcc9ec295bf230b9d0e8 (diff)
isci: unify isci_host data structures
Make it explicit that isci_host and scic_sds_controller are one in the same object. Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> [removed ->ihost back pointer] Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci/host.c')
-rw-r--r--drivers/scsi/isci/host.c51
1 files changed, 17 insertions, 34 deletions
diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c
index 55bfa3dbfb8f..d180ad8a8bcf 100644
--- a/drivers/scsi/isci/host.c
+++ b/drivers/scsi/isci/host.c
@@ -65,9 +65,8 @@
65irqreturn_t isci_msix_isr(int vec, void *data) 65irqreturn_t isci_msix_isr(int vec, void *data)
66{ 66{
67 struct isci_host *ihost = data; 67 struct isci_host *ihost = data;
68 struct scic_sds_controller *scic = ihost->core_controller;
69 68
70 if (scic_sds_controller_isr(scic)) 69 if (scic_sds_controller_isr(&ihost->sci))
71 tasklet_schedule(&ihost->completion_tasklet); 70 tasklet_schedule(&ihost->completion_tasklet);
72 71
73 return IRQ_HANDLED; 72 return IRQ_HANDLED;
@@ -77,7 +76,7 @@ irqreturn_t isci_intx_isr(int vec, void *data)
77{ 76{
78 irqreturn_t ret = IRQ_NONE; 77 irqreturn_t ret = IRQ_NONE;
79 struct isci_host *ihost = data; 78 struct isci_host *ihost = data;
80 struct scic_sds_controller *scic = ihost->core_controller; 79 struct scic_sds_controller *scic = &ihost->sci;
81 80
82 if (scic_sds_controller_isr(scic)) { 81 if (scic_sds_controller_isr(scic)) {
83 writel(SMU_ISR_COMPLETION, &scic->smu_registers->interrupt_status); 82 writel(SMU_ISR_COMPLETION, &scic->smu_registers->interrupt_status);
@@ -96,10 +95,9 @@ irqreturn_t isci_intx_isr(int vec, void *data)
96irqreturn_t isci_error_isr(int vec, void *data) 95irqreturn_t isci_error_isr(int vec, void *data)
97{ 96{
98 struct isci_host *ihost = data; 97 struct isci_host *ihost = data;
99 struct scic_sds_controller *scic = ihost->core_controller;
100 98
101 if (scic_sds_controller_error_isr(scic)) 99 if (scic_sds_controller_error_isr(&ihost->sci))
102 scic_sds_controller_error_handler(scic); 100 scic_sds_controller_error_handler(&ihost->sci);
103 101
104 return IRQ_HANDLED; 102 return IRQ_HANDLED;
105} 103}
@@ -145,21 +143,20 @@ int isci_host_scan_finished(struct Scsi_Host *shost, unsigned long time)
145void isci_host_scan_start(struct Scsi_Host *shost) 143void isci_host_scan_start(struct Scsi_Host *shost)
146{ 144{
147 struct isci_host *ihost = SHOST_TO_SAS_HA(shost)->lldd_ha; 145 struct isci_host *ihost = SHOST_TO_SAS_HA(shost)->lldd_ha;
148 struct scic_sds_controller *scic = ihost->core_controller; 146 unsigned long tmo = scic_controller_get_suggested_start_timeout(&ihost->sci);
149 unsigned long tmo = scic_controller_get_suggested_start_timeout(scic);
150 147
151 set_bit(IHOST_START_PENDING, &ihost->flags); 148 set_bit(IHOST_START_PENDING, &ihost->flags);
152 149
153 spin_lock_irq(&ihost->scic_lock); 150 spin_lock_irq(&ihost->scic_lock);
154 scic_controller_start(scic, tmo); 151 scic_controller_start(&ihost->sci, tmo);
155 scic_controller_enable_interrupts(scic); 152 scic_controller_enable_interrupts(&ihost->sci);
156 spin_unlock_irq(&ihost->scic_lock); 153 spin_unlock_irq(&ihost->scic_lock);
157} 154}
158 155
159void isci_host_stop_complete(struct isci_host *ihost, enum sci_status completion_status) 156void isci_host_stop_complete(struct isci_host *ihost, enum sci_status completion_status)
160{ 157{
161 isci_host_change_state(ihost, isci_stopped); 158 isci_host_change_state(ihost, isci_stopped);
162 scic_controller_disable_interrupts(ihost->core_controller); 159 scic_controller_disable_interrupts(&ihost->sci);
163 clear_bit(IHOST_STOP_PENDING, &ihost->flags); 160 clear_bit(IHOST_STOP_PENDING, &ihost->flags);
164 wake_up(&ihost->eventq); 161 wake_up(&ihost->eventq);
165} 162}
@@ -188,7 +185,7 @@ static void isci_host_completion_routine(unsigned long data)
188 185
189 spin_lock_irq(&isci_host->scic_lock); 186 spin_lock_irq(&isci_host->scic_lock);
190 187
191 scic_sds_controller_completion_handler(isci_host->core_controller); 188 scic_sds_controller_completion_handler(&isci_host->sci);
192 189
193 /* Take the lists of completed I/Os from the host. */ 190 /* Take the lists of completed I/Os from the host. */
194 191
@@ -276,7 +273,6 @@ static void isci_host_completion_routine(unsigned long data)
276 273
277void isci_host_deinit(struct isci_host *ihost) 274void isci_host_deinit(struct isci_host *ihost)
278{ 275{
279 struct scic_sds_controller *scic = ihost->core_controller;
280 int i; 276 int i;
281 277
282 isci_host_change_state(ihost, isci_stopping); 278 isci_host_change_state(ihost, isci_stopping);
@@ -293,11 +289,11 @@ void isci_host_deinit(struct isci_host *ihost)
293 set_bit(IHOST_STOP_PENDING, &ihost->flags); 289 set_bit(IHOST_STOP_PENDING, &ihost->flags);
294 290
295 spin_lock_irq(&ihost->scic_lock); 291 spin_lock_irq(&ihost->scic_lock);
296 scic_controller_stop(scic, SCIC_CONTROLLER_STOP_TIMEOUT); 292 scic_controller_stop(&ihost->sci, SCIC_CONTROLLER_STOP_TIMEOUT);
297 spin_unlock_irq(&ihost->scic_lock); 293 spin_unlock_irq(&ihost->scic_lock);
298 294
299 wait_for_stop(ihost); 295 wait_for_stop(ihost);
300 scic_controller_reset(scic); 296 scic_controller_reset(&ihost->sci);
301 isci_timer_list_destroy(ihost); 297 isci_timer_list_destroy(ihost);
302} 298}
303 299
@@ -347,25 +343,12 @@ int isci_host_init(struct isci_host *isci_host)
347{ 343{
348 int err = 0, i; 344 int err = 0, i;
349 enum sci_status status; 345 enum sci_status status;
350 struct scic_sds_controller *controller;
351 union scic_oem_parameters oem; 346 union scic_oem_parameters oem;
352 union scic_user_parameters scic_user_params; 347 union scic_user_parameters scic_user_params;
353 struct isci_pci_info *pci_info = to_pci_info(isci_host->pdev); 348 struct isci_pci_info *pci_info = to_pci_info(isci_host->pdev);
354 349
355 isci_timer_list_construct(isci_host); 350 isci_timer_list_construct(isci_host);
356 351
357 controller = scic_controller_alloc(&isci_host->pdev->dev);
358
359 if (!controller) {
360 dev_err(&isci_host->pdev->dev,
361 "%s: failed (%d)\n",
362 __func__,
363 err);
364 return -ENOMEM;
365 }
366
367 isci_host->core_controller = controller;
368 controller->ihost = isci_host;
369 spin_lock_init(&isci_host->state_lock); 352 spin_lock_init(&isci_host->state_lock);
370 spin_lock_init(&isci_host->scic_lock); 353 spin_lock_init(&isci_host->scic_lock);
371 spin_lock_init(&isci_host->queue_lock); 354 spin_lock_init(&isci_host->queue_lock);
@@ -374,7 +357,7 @@ int isci_host_init(struct isci_host *isci_host)
374 isci_host_change_state(isci_host, isci_starting); 357 isci_host_change_state(isci_host, isci_starting);
375 isci_host->can_queue = ISCI_CAN_QUEUE_VAL; 358 isci_host->can_queue = ISCI_CAN_QUEUE_VAL;
376 359
377 status = scic_controller_construct(controller, scu_base(isci_host), 360 status = scic_controller_construct(&isci_host->sci, scu_base(isci_host),
378 smu_base(isci_host)); 361 smu_base(isci_host));
379 362
380 if (status != SCI_SUCCESS) { 363 if (status != SCI_SUCCESS) {
@@ -393,7 +376,7 @@ int isci_host_init(struct isci_host *isci_host)
393 * parameters 376 * parameters
394 */ 377 */
395 isci_user_parameters_get(isci_host, &scic_user_params); 378 isci_user_parameters_get(isci_host, &scic_user_params);
396 status = scic_user_parameters_set(isci_host->core_controller, 379 status = scic_user_parameters_set(&isci_host->sci,
397 &scic_user_params); 380 &scic_user_params);
398 if (status != SCI_SUCCESS) { 381 if (status != SCI_SUCCESS) {
399 dev_warn(&isci_host->pdev->dev, 382 dev_warn(&isci_host->pdev->dev,
@@ -402,7 +385,7 @@ int isci_host_init(struct isci_host *isci_host)
402 return -ENODEV; 385 return -ENODEV;
403 } 386 }
404 387
405 scic_oem_parameters_get(controller, &oem); 388 scic_oem_parameters_get(&isci_host->sci, &oem);
406 389
407 /* grab any OEM parameters specified in orom */ 390 /* grab any OEM parameters specified in orom */
408 if (pci_info->orom) { 391 if (pci_info->orom) {
@@ -416,7 +399,7 @@ int isci_host_init(struct isci_host *isci_host)
416 } 399 }
417 } 400 }
418 401
419 status = scic_oem_parameters_set(isci_host->core_controller, &oem); 402 status = scic_oem_parameters_set(&isci_host->sci, &oem);
420 if (status != SCI_SUCCESS) { 403 if (status != SCI_SUCCESS) {
421 dev_warn(&isci_host->pdev->dev, 404 dev_warn(&isci_host->pdev->dev,
422 "%s: scic_oem_parameters_set failed\n", 405 "%s: scic_oem_parameters_set failed\n",
@@ -431,7 +414,7 @@ int isci_host_init(struct isci_host *isci_host)
431 INIT_LIST_HEAD(&isci_host->requests_to_errorback); 414 INIT_LIST_HEAD(&isci_host->requests_to_errorback);
432 415
433 spin_lock_irq(&isci_host->scic_lock); 416 spin_lock_irq(&isci_host->scic_lock);
434 status = scic_controller_initialize(isci_host->core_controller); 417 status = scic_controller_initialize(&isci_host->sci);
435 spin_unlock_irq(&isci_host->scic_lock); 418 spin_unlock_irq(&isci_host->scic_lock);
436 if (status != SCI_SUCCESS) { 419 if (status != SCI_SUCCESS) {
437 dev_warn(&isci_host->pdev->dev, 420 dev_warn(&isci_host->pdev->dev,
@@ -441,7 +424,7 @@ int isci_host_init(struct isci_host *isci_host)
441 return -ENODEV; 424 return -ENODEV;
442 } 425 }
443 426
444 err = scic_controller_mem_init(isci_host->core_controller); 427 err = scic_controller_mem_init(&isci_host->sci);
445 if (err) 428 if (err)
446 return err; 429 return err;
447 430