Commit ce155ccecd4094e7b5e68058d26db691713240fc

Authored by brking@us.ibm.com
Committed by James Bottomley
1 parent ed7e8ef7f1

[SCSI] ipr: Driver initialization fix for kexec/kdump

When kexec booting a kernel when the previous kernel did not
call ipr's shutdown method, the ipr adapter does not get
properly initialized, which can result in the ipr adapter
completing commands issued by the previous kernel. Fix ipr
to detect this scenario by reading the adapter's interrupt
mask register and the microprocessor interrupt register.
If the interrupt mask register indicates that interrupts
are enabled or the reset alert bit is set when the card is
probed, this means the card is in an unknown state and we
hard reset the card.

Signed-off-by: Brian King <brking@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>

Showing 2 changed files with 19 additions and 3 deletions Side-by-side Diff

... ... @@ -5887,7 +5887,12 @@
5887 5887 ENTER;
5888 5888 spin_lock_irqsave(ioa_cfg->host->host_lock, host_lock_flags);
5889 5889 dev_dbg(&ioa_cfg->pdev->dev, "ioa_cfg adx: 0x%p\n", ioa_cfg);
5890   - _ipr_initiate_ioa_reset(ioa_cfg, ipr_reset_enable_ioa, IPR_SHUTDOWN_NONE);
  5890 + if (ioa_cfg->needs_hard_reset) {
  5891 + ioa_cfg->needs_hard_reset = 0;
  5892 + ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NONE);
  5893 + } else
  5894 + _ipr_initiate_ioa_reset(ioa_cfg, ipr_reset_enable_ioa,
  5895 + IPR_SHUTDOWN_NONE);
5891 5896  
5892 5897 spin_unlock_irqrestore(ioa_cfg->host->host_lock, host_lock_flags);
5893 5898 wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload);
... ... @@ -6264,6 +6269,7 @@
6264 6269 unsigned long ipr_regs_pci;
6265 6270 void __iomem *ipr_regs;
6266 6271 u32 rc = PCIBIOS_SUCCESSFUL;
  6272 + volatile u32 mask, uproc;
6267 6273  
6268 6274 ENTER;
6269 6275  
... ... @@ -6355,6 +6361,15 @@
6355 6361 "Couldn't allocate enough memory for device driver!\n");
6356 6362 goto cleanup_nomem;
6357 6363 }
  6364 +
  6365 + /*
  6366 + * If HRRQ updated interrupt is not masked, or reset alert is set,
  6367 + * the card is in an unknown state and needs a hard reset
  6368 + */
  6369 + mask = readl(ioa_cfg->regs.sense_interrupt_mask_reg);
  6370 + uproc = readl(ioa_cfg->regs.sense_uproc_interrupt_reg);
  6371 + if ((mask & IPR_PCII_HRRQ_UPDATED) == 0 || (uproc & IPR_UPROCI_RESET_ALERT))
  6372 + ioa_cfg->needs_hard_reset = 1;
6358 6373  
6359 6374 ipr_mask_and_clear_interrupts(ioa_cfg, ~IPR_PCII_IOA_TRANS_TO_OPER);
6360 6375 rc = request_irq(pdev->irq, ipr_isr, SA_SHIRQ, IPR_NAME, ioa_cfg);
... ... @@ -36,8 +36,8 @@
36 36 /*
37 37 * Literals
38 38 */
39   -#define IPR_DRIVER_VERSION "2.1.0"
40   -#define IPR_DRIVER_DATE "(October 31, 2005)"
  39 +#define IPR_DRIVER_VERSION "2.1.1"
  40 +#define IPR_DRIVER_DATE "(November 15, 2005)"
41 41  
42 42 /*
43 43 * IPR_MAX_CMD_PER_LUN: This defines the maximum number of outstanding
... ... @@ -922,6 +922,7 @@
922 922 u8 dump_taken:1;
923 923 u8 allow_cmds:1;
924 924 u8 allow_ml_add_del:1;
  925 + u8 needs_hard_reset:1;
925 926  
926 927 enum ipr_cache_state cache_state;
927 928 u16 type; /* CCIN of the card */