diff options
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_attr.c | 3 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_crtn.h | 1 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_mbox.c | 16 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.c | 11 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.h | 6 |
5 files changed, 32 insertions, 5 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 762d623018f3..4ccce1474f2d 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c | |||
@@ -1000,7 +1000,8 @@ sysfs_mbox_read(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
1000 | spin_unlock_irq(phba->host->host_lock); | 1000 | spin_unlock_irq(phba->host->host_lock); |
1001 | rc = lpfc_sli_issue_mbox_wait (phba, | 1001 | rc = lpfc_sli_issue_mbox_wait (phba, |
1002 | phba->sysfs_mbox.mbox, | 1002 | phba->sysfs_mbox.mbox, |
1003 | phba->fc_ratov * 2); | 1003 | lpfc_mbox_tmo_val(phba, |
1004 | phba->sysfs_mbox.mbox->mb.mbxCommand) * HZ); | ||
1004 | spin_lock_irq(phba->host->host_lock); | 1005 | spin_lock_irq(phba->host->host_lock); |
1005 | } | 1006 | } |
1006 | 1007 | ||
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index 517e9e4dd461..2a176467f71b 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h | |||
@@ -127,6 +127,7 @@ void lpfc_config_port(struct lpfc_hba *, LPFC_MBOXQ_t *); | |||
127 | void lpfc_kill_board(struct lpfc_hba *, LPFC_MBOXQ_t *); | 127 | void lpfc_kill_board(struct lpfc_hba *, LPFC_MBOXQ_t *); |
128 | void lpfc_mbox_put(struct lpfc_hba *, LPFC_MBOXQ_t *); | 128 | void lpfc_mbox_put(struct lpfc_hba *, LPFC_MBOXQ_t *); |
129 | LPFC_MBOXQ_t *lpfc_mbox_get(struct lpfc_hba *); | 129 | LPFC_MBOXQ_t *lpfc_mbox_get(struct lpfc_hba *); |
130 | int lpfc_mbox_tmo_val(struct lpfc_hba *, int); | ||
130 | 131 | ||
131 | int lpfc_mem_alloc(struct lpfc_hba *); | 132 | int lpfc_mem_alloc(struct lpfc_hba *); |
132 | void lpfc_mem_free(struct lpfc_hba *); | 133 | void lpfc_mem_free(struct lpfc_hba *); |
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c index e42f22aaf71b..4d016c2a1b26 100644 --- a/drivers/scsi/lpfc/lpfc_mbox.c +++ b/drivers/scsi/lpfc/lpfc_mbox.c | |||
@@ -651,3 +651,19 @@ lpfc_mbox_get(struct lpfc_hba * phba) | |||
651 | 651 | ||
652 | return mbq; | 652 | return mbq; |
653 | } | 653 | } |
654 | |||
655 | int | ||
656 | lpfc_mbox_tmo_val(struct lpfc_hba *phba, int cmd) | ||
657 | { | ||
658 | switch (cmd) { | ||
659 | case MBX_WRITE_NV: /* 0x03 */ | ||
660 | case MBX_UPDATE_CFG: /* 0x1B */ | ||
661 | case MBX_DOWN_LOAD: /* 0x1C */ | ||
662 | case MBX_DEL_LD_ENTRY: /* 0x1D */ | ||
663 | case MBX_LOAD_AREA: /* 0x81 */ | ||
664 | case MBX_FLASH_WR_ULA: /* 0x98 */ | ||
665 | case MBX_LOAD_EXP_ROM: /* 0x9C */ | ||
666 | return LPFC_MBOX_TMO_FLASH_CMD; | ||
667 | } | ||
668 | return LPFC_MBOX_TMO; | ||
669 | } | ||
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index f453fccd67c8..4dc2d584319e 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -2197,7 +2197,8 @@ lpfc_sli_issue_mbox(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmbox, uint32_t flag) | |||
2197 | return (MBX_NOT_FINISHED); | 2197 | return (MBX_NOT_FINISHED); |
2198 | } | 2198 | } |
2199 | /* timeout active mbox command */ | 2199 | /* timeout active mbox command */ |
2200 | mod_timer(&psli->mbox_tmo, jiffies + HZ * LPFC_MBOX_TMO); | 2200 | mod_timer(&psli->mbox_tmo, (jiffies + |
2201 | (HZ * lpfc_mbox_tmo_val(phba, mb->mbxCommand)))); | ||
2201 | } | 2202 | } |
2202 | 2203 | ||
2203 | /* Mailbox cmd <cmd> issue */ | 2204 | /* Mailbox cmd <cmd> issue */ |
@@ -2257,7 +2258,6 @@ lpfc_sli_issue_mbox(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmbox, uint32_t flag) | |||
2257 | break; | 2258 | break; |
2258 | 2259 | ||
2259 | case MBX_POLL: | 2260 | case MBX_POLL: |
2260 | i = 0; | ||
2261 | psli->mbox_active = NULL; | 2261 | psli->mbox_active = NULL; |
2262 | if (psli->sli_flag & LPFC_SLI2_ACTIVE) { | 2262 | if (psli->sli_flag & LPFC_SLI2_ACTIVE) { |
2263 | /* First read mbox status word */ | 2263 | /* First read mbox status word */ |
@@ -2271,11 +2271,14 @@ lpfc_sli_issue_mbox(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmbox, uint32_t flag) | |||
2271 | /* Read the HBA Host Attention Register */ | 2271 | /* Read the HBA Host Attention Register */ |
2272 | ha_copy = readl(phba->HAregaddr); | 2272 | ha_copy = readl(phba->HAregaddr); |
2273 | 2273 | ||
2274 | i = lpfc_mbox_tmo_val(phba, mb->mbxCommand); | ||
2275 | i *= 1000; /* Convert to ms */ | ||
2276 | |||
2274 | /* Wait for command to complete */ | 2277 | /* Wait for command to complete */ |
2275 | while (((word0 & OWN_CHIP) == OWN_CHIP) || | 2278 | while (((word0 & OWN_CHIP) == OWN_CHIP) || |
2276 | (!(ha_copy & HA_MBATT) && | 2279 | (!(ha_copy & HA_MBATT) && |
2277 | (phba->hba_state > LPFC_WARM_START))) { | 2280 | (phba->hba_state > LPFC_WARM_START))) { |
2278 | if (i++ >= 100) { | 2281 | if (i-- <= 0) { |
2279 | psli->sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; | 2282 | psli->sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; |
2280 | spin_unlock_irqrestore(phba->host->host_lock, | 2283 | spin_unlock_irqrestore(phba->host->host_lock, |
2281 | drvr_flag); | 2284 | drvr_flag); |
@@ -2293,7 +2296,7 @@ lpfc_sli_issue_mbox(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmbox, uint32_t flag) | |||
2293 | 2296 | ||
2294 | /* Can be in interrupt context, do not sleep */ | 2297 | /* Can be in interrupt context, do not sleep */ |
2295 | /* (or might be called with interrupts disabled) */ | 2298 | /* (or might be called with interrupts disabled) */ |
2296 | mdelay(i); | 2299 | mdelay(1); |
2297 | 2300 | ||
2298 | spin_lock_irqsave(phba->host->host_lock, drvr_flag); | 2301 | spin_lock_irqsave(phba->host->host_lock, drvr_flag); |
2299 | 2302 | ||
diff --git a/drivers/scsi/lpfc/lpfc_sli.h b/drivers/scsi/lpfc/lpfc_sli.h index 478e799c2bbf..e26de6809358 100644 --- a/drivers/scsi/lpfc/lpfc_sli.h +++ b/drivers/scsi/lpfc/lpfc_sli.h | |||
@@ -225,3 +225,9 @@ struct lpfc_sli { | |||
225 | 225 | ||
226 | #define LPFC_MBOX_TMO 30 /* Sec tmo for outstanding mbox | 226 | #define LPFC_MBOX_TMO 30 /* Sec tmo for outstanding mbox |
227 | command */ | 227 | command */ |
228 | #define LPFC_MBOX_TMO_FLASH_CMD 300 /* Sec tmo for outstanding FLASH write | ||
229 | * or erase cmds. This is especially | ||
230 | * long because of the potential of | ||
231 | * multiple flash erases that can be | ||
232 | * spawned. | ||
233 | */ | ||