diff options
author | Stephen M. Cameron <scameron@beardog.cce.hp.com> | 2010-05-27 16:14:08 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-07-27 13:01:13 -0400 |
commit | 3f4336f33314e7d3687ff46af1fcaa970e3f4e00 (patch) | |
tree | cb61f029d7d6d6dafa6e4448901bfeaa7dc040cb /drivers/scsi | |
parent | 7136f9a78eece43226dee1a46ec6fc144f561239 (diff) |
[SCSI] hpsa: factor out hpsa_wait_for_mode_change_ack
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')
-rw-r--r-- | drivers/scsi/hpsa.c | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index d495d8b19c9c..e89c40aa2b35 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
@@ -3410,19 +3410,9 @@ 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 | ||
3413 | static int __devinit hpsa_enter_simple_mode(struct ctlr_info *h) | 3413 | static void __devinit hpsa_wait_for_mode_change_ack(struct ctlr_info *h) |
3414 | { | 3414 | { |
3415 | int i; | 3415 | int i; |
3416 | u32 trans_support; | ||
3417 | |||
3418 | trans_support = readl(&(h->cfgtable->TransportSupport)); | ||
3419 | if (!(trans_support & SIMPLE_MODE)) | ||
3420 | return -ENOTSUPP; | ||
3421 | |||
3422 | h->max_commands = readl(&(h->cfgtable->CmdsOutMax)); | ||
3423 | /* Update the field, and then ring the doorbell */ | ||
3424 | writel(CFGTBL_Trans_Simple, &(h->cfgtable->HostWrite.TransportRequest)); | ||
3425 | writel(CFGTBL_ChangeReq, h->vaddr + SA5_DOORBELL); | ||
3426 | 3416 | ||
3427 | /* under certain very rare conditions, this can take awhile. | 3417 | /* under certain very rare conditions, this can take awhile. |
3428 | * (e.g.: hot replace a failed 144GB drive in a RAID 5 set right | 3418 | * (e.g.: hot replace a failed 144GB drive in a RAID 5 set right |
@@ -3434,6 +3424,21 @@ static int __devinit hpsa_enter_simple_mode(struct ctlr_info *h) | |||
3434 | /* delay and try again */ | 3424 | /* delay and try again */ |
3435 | msleep(10); | 3425 | msleep(10); |
3436 | } | 3426 | } |
3427 | } | ||
3428 | |||
3429 | static int __devinit hpsa_enter_simple_mode(struct ctlr_info *h) | ||
3430 | { | ||
3431 | u32 trans_support; | ||
3432 | |||
3433 | trans_support = readl(&(h->cfgtable->TransportSupport)); | ||
3434 | if (!(trans_support & SIMPLE_MODE)) | ||
3435 | return -ENOTSUPP; | ||
3436 | |||
3437 | h->max_commands = readl(&(h->cfgtable->CmdsOutMax)); | ||
3438 | /* Update the field, and then ring the doorbell */ | ||
3439 | writel(CFGTBL_Trans_Simple, &(h->cfgtable->HostWrite.TransportRequest)); | ||
3440 | writel(CFGTBL_ChangeReq, h->vaddr + SA5_DOORBELL); | ||
3441 | hpsa_wait_for_mode_change_ack(h); | ||
3437 | print_cfg_table(&h->pdev->dev, h->cfgtable); | 3442 | print_cfg_table(&h->pdev->dev, h->cfgtable); |
3438 | if (!(readl(&(h->cfgtable->TransportActive)) & CFGTBL_Trans_Simple)) { | 3443 | if (!(readl(&(h->cfgtable->TransportActive)) & CFGTBL_Trans_Simple)) { |
3439 | dev_warn(&h->pdev->dev, | 3444 | dev_warn(&h->pdev->dev, |
@@ -3814,7 +3819,6 @@ static __devinit void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h) | |||
3814 | */ | 3819 | */ |
3815 | int bft[8] = {5, 6, 8, 10, 12, 20, 28, 35}; /* for scatter/gathers */ | 3820 | int bft[8] = {5, 6, 8, 10, 12, 20, 28, 35}; /* for scatter/gathers */ |
3816 | int i = 0; | 3821 | int i = 0; |
3817 | int l = 0; | ||
3818 | unsigned long register_value; | 3822 | unsigned long register_value; |
3819 | 3823 | ||
3820 | trans_support = readl(&(h->cfgtable->TransportSupport)); | 3824 | trans_support = readl(&(h->cfgtable->TransportSupport)); |
@@ -3858,17 +3862,7 @@ static __devinit void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h) | |||
3858 | writel(CFGTBL_Trans_Performant, | 3862 | writel(CFGTBL_Trans_Performant, |
3859 | &(h->cfgtable->HostWrite.TransportRequest)); | 3863 | &(h->cfgtable->HostWrite.TransportRequest)); |
3860 | writel(CFGTBL_ChangeReq, h->vaddr + SA5_DOORBELL); | 3864 | writel(CFGTBL_ChangeReq, h->vaddr + SA5_DOORBELL); |
3861 | /* under certain very rare conditions, this can take awhile. | 3865 | hpsa_wait_for_mode_change_ack(h); |
3862 | * (e.g.: hot replace a failed 144GB drive in a RAID 5 set right | ||
3863 | * as we enter this code.) */ | ||
3864 | for (l = 0; l < MAX_CONFIG_WAIT; l++) { | ||
3865 | register_value = readl(h->vaddr + SA5_DOORBELL); | ||
3866 | if (!(register_value & CFGTBL_ChangeReq)) | ||
3867 | break; | ||
3868 | /* delay and try again */ | ||
3869 | set_current_state(TASK_INTERRUPTIBLE); | ||
3870 | schedule_timeout(10); | ||
3871 | } | ||
3872 | register_value = readl(&(h->cfgtable->TransportActive)); | 3866 | register_value = readl(&(h->cfgtable->TransportActive)); |
3873 | if (!(register_value & CFGTBL_Trans_Performant)) { | 3867 | if (!(register_value & CFGTBL_Trans_Performant)) { |
3874 | dev_warn(&h->pdev->dev, "unable to get board into" | 3868 | dev_warn(&h->pdev->dev, "unable to get board into" |