aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/hpsa.c
diff options
context:
space:
mode:
authorStephen M. Cameron <scameron@beardog.cce.hp.com>2010-05-27 16:13:48 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-07-27 13:01:10 -0400
commiteb6b2ae9058accd183fe8b31f1985312bf333624 (patch)
treed0e289c5df268e1fd2de342fd0beb530482f5e1e /drivers/scsi/hpsa.c
parent3d0eab67cf556db4430a42fbb45dc90ef690d30c (diff)
[SCSI] hpsa: factor out hpsa_enter_simple_mode
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/hpsa.c')
-rw-r--r--drivers/scsi/hpsa.c62
1 files changed, 35 insertions, 27 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 9e81e0bcf1e2..4d4ecca399ae 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3410,9 +3410,41 @@ static inline void hpsa_p600_dma_prefetch_quirk(struct ctlr_info *h)
3410 writel(dma_prefetch, h->vaddr + I2O_DMA1_CFG); 3410 writel(dma_prefetch, h->vaddr + I2O_DMA1_CFG);
3411} 3411}
3412 3412
3413static int __devinit hpsa_enter_simple_mode(struct ctlr_info *h)
3414{
3415 int i;
3416
3417 h->max_commands = readl(&(h->cfgtable->CmdsOutMax));
3418 /* Update the field, and then ring the doorbell */
3419 writel(CFGTBL_Trans_Simple, &(h->cfgtable->HostWrite.TransportRequest));
3420 writel(CFGTBL_ChangeReq, h->vaddr + SA5_DOORBELL);
3421
3422 /* under certain very rare conditions, this can take awhile.
3423 * (e.g.: hot replace a failed 144GB drive in a RAID 5 set right
3424 * as we enter this code.)
3425 */
3426 for (i = 0; i < MAX_CONFIG_WAIT; i++) {
3427 if (!(readl(h->vaddr + SA5_DOORBELL) & CFGTBL_ChangeReq))
3428 break;
3429 /* delay and try again */
3430 msleep(10);
3431 }
3432
3433#ifdef HPSA_DEBUG
3434 print_cfg_table(&h->pdev->dev, h->cfgtable);
3435#endif /* HPSA_DEBUG */
3436
3437 if (!(readl(&(h->cfgtable->TransportActive)) & CFGTBL_Trans_Simple)) {
3438 dev_warn(&h->pdev->dev,
3439 "unable to get board into simple mode\n");
3440 return -ENODEV;
3441 }
3442 return 0;
3443}
3444
3413static int __devinit hpsa_pci_init(struct ctlr_info *h) 3445static int __devinit hpsa_pci_init(struct ctlr_info *h)
3414{ 3446{
3415 int i, prod_index, err; 3447 int prod_index, err;
3416 3448
3417 prod_index = hpsa_lookup_board_id(h->pdev, &h->board_id); 3449 prod_index = hpsa_lookup_board_id(h->pdev, &h->board_id);
3418 if (prod_index < 0) 3450 if (prod_index < 0)
@@ -3459,33 +3491,9 @@ static int __devinit hpsa_pci_init(struct ctlr_info *h)
3459 } 3491 }
3460 hpsa_enable_scsi_prefetch(h); 3492 hpsa_enable_scsi_prefetch(h);
3461 hpsa_p600_dma_prefetch_quirk(h); 3493 hpsa_p600_dma_prefetch_quirk(h);
3462 3494 err = hpsa_enter_simple_mode(h);
3463 h->max_commands = readl(&(h->cfgtable->CmdsOutMax)); 3495 if (err)
3464 /* Update the field, and then ring the doorbell */
3465 writel(CFGTBL_Trans_Simple, &(h->cfgtable->HostWrite.TransportRequest));
3466 writel(CFGTBL_ChangeReq, h->vaddr + SA5_DOORBELL);
3467
3468 /* under certain very rare conditions, this can take awhile.
3469 * (e.g.: hot replace a failed 144GB drive in a RAID 5 set right
3470 * as we enter this code.)
3471 */
3472 for (i = 0; i < MAX_CONFIG_WAIT; i++) {
3473 if (!(readl(h->vaddr + SA5_DOORBELL) & CFGTBL_ChangeReq))
3474 break;
3475 /* delay and try again */
3476 msleep(10);
3477 }
3478
3479#ifdef HPSA_DEBUG
3480 print_cfg_table(&h->pdev->dev, h->cfgtable);
3481#endif /* HPSA_DEBUG */
3482
3483 if (!(readl(&(h->cfgtable->TransportActive)) & CFGTBL_Trans_Simple)) {
3484 dev_warn(&h->pdev->dev,
3485 "unable to get board into simple mode\n");
3486 err = -ENODEV;
3487 goto err_out_free_res; 3496 goto err_out_free_res;
3488 }
3489 return 0; 3497 return 0;
3490 3498
3491err_out_free_res: 3499err_out_free_res: