aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_init.c
diff options
context:
space:
mode:
authorJamie Wellnitz <Jamie.Wellnitz@emulex.com>2006-02-28 19:25:27 -0500
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-02-28 20:00:36 -0500
commit41415862a23f422b80eccc92cf885935139e2415 (patch)
treee3a9537653e472f15405778c4dcc678a56304848 /drivers/scsi/lpfc/lpfc_init.c
parentd9d959c41f013439508e0fa1d31f5644d8d626ef (diff)
[SCSI] lpfc 8.1.2: Add ERROR and WARM_START modes for diagnostic purposes.
Add ERROR and WARM_START modes for diagnostic purposes. Signed-off-by: Jamie Wellnitz <Jamie.Wellnitz@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_init.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c57
1 files changed, 41 insertions, 16 deletions
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 5e92c451f96e..391ca50293f2 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -1,7 +1,7 @@
1/******************************************************************* 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2005 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2006 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. * 5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com * 6 * www.emulex.com *
7 * Portions Copyright (C) 2004-2005 Christoph Hellwig * 7 * Portions Copyright (C) 2004-2005 Christoph Hellwig *
@@ -459,11 +459,47 @@ lpfc_hba_down_prep(struct lpfc_hba * phba)
459 lpfc_els_flush_cmd(phba); 459 lpfc_els_flush_cmd(phba);
460 lpfc_disc_flush_list(phba); 460 lpfc_disc_flush_list(phba);
461 461
462 /* Disable SLI2 since we disabled interrupts */
463 phba->sli.sli_flag &= ~LPFC_SLI2_ACTIVE;
462 return (0); 464 return (0);
463} 465}
464 466
465/************************************************************************/ 467/************************************************************************/
466/* */ 468/* */
469/* lpfc_hba_down_post */
470/* This routine will do uninitialization after the HBA is reset */
471/* when bringing down the SLI Layer. */
472/* This routine returns 0 on success. Any other return value */
473/* indicates an error. */
474/* */
475/************************************************************************/
476int
477lpfc_hba_down_post(struct lpfc_hba * phba)
478{
479 struct lpfc_sli *psli = &phba->sli;
480 struct lpfc_sli_ring *pring;
481 struct lpfc_dmabuf *mp, *next_mp;
482 int i;
483
484 /* Cleanup preposted buffers on the ELS ring */
485 pring = &psli->ring[LPFC_ELS_RING];
486 list_for_each_entry_safe(mp, next_mp, &pring->postbufq, list) {
487 list_del(&mp->list);
488 pring->postbufq_cnt--;
489 lpfc_mbuf_free(phba, mp->virt, mp->phys);
490 kfree(mp);
491 }
492
493 for (i = 0; i < psli->num_rings; i++) {
494 pring = &psli->ring[i];
495 lpfc_sli_abort_iocb_ring(phba, pring);
496 }
497
498 return 0;
499}
500
501/************************************************************************/
502/* */
467/* lpfc_handle_eratt */ 503/* lpfc_handle_eratt */
468/* This routine will handle processing a Host Attention */ 504/* This routine will handle processing a Host Attention */
469/* Error Status event. This will be initialized */ 505/* Error Status event. This will be initialized */
@@ -476,20 +512,6 @@ lpfc_handle_eratt(struct lpfc_hba * phba)
476 struct lpfc_sli *psli = &phba->sli; 512 struct lpfc_sli *psli = &phba->sli;
477 struct lpfc_sli_ring *pring; 513 struct lpfc_sli_ring *pring;
478 514
479 /*
480 * If a reset is sent to the HBA restore PCI configuration registers.
481 */
482 if ( phba->hba_state == LPFC_INIT_START ) {
483 mdelay(1);
484 readl(phba->HCregaddr); /* flush */
485 writel(0, phba->HCregaddr);
486 readl(phba->HCregaddr); /* flush */
487
488 /* Restore PCI cmd register */
489 pci_write_config_word(phba->pcidev,
490 PCI_COMMAND, phba->pci_cfg_value);
491 }
492
493 if (phba->work_hs & HS_FFER6) { 515 if (phba->work_hs & HS_FFER6) {
494 /* Re-establishing Link */ 516 /* Re-establishing Link */
495 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, 517 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT,
@@ -516,6 +538,7 @@ lpfc_handle_eratt(struct lpfc_hba * phba)
516 * attempt to restart it. 538 * attempt to restart it.
517 */ 539 */
518 lpfc_offline(phba); 540 lpfc_offline(phba);
541 lpfc_sli_brdrestart(phba);
519 if (lpfc_online(phba) == 0) { /* Initialize the HBA */ 542 if (lpfc_online(phba) == 0) { /* Initialize the HBA */
520 mod_timer(&phba->fc_estabtmo, jiffies + HZ * 60); 543 mod_timer(&phba->fc_estabtmo, jiffies + HZ * 60);
521 return; 544 return;
@@ -532,7 +555,8 @@ lpfc_handle_eratt(struct lpfc_hba * phba)
532 phba->work_status[0], phba->work_status[1]); 555 phba->work_status[0], phba->work_status[1]);
533 556
534 lpfc_offline(phba); 557 lpfc_offline(phba);
535 558 phba->hba_state = LPFC_HBA_ERROR;
559 lpfc_hba_down_post(phba);
536 } 560 }
537} 561}
538 562
@@ -1695,6 +1719,7 @@ lpfc_pci_remove_one(struct pci_dev *pdev)
1695 * the HBA. 1719 * the HBA.
1696 */ 1720 */
1697 lpfc_sli_hba_down(phba); 1721 lpfc_sli_hba_down(phba);
1722 lpfc_sli_brdrestart(phba);
1698 1723
1699 /* Release the irq reservation */ 1724 /* Release the irq reservation */
1700 free_irq(phba->pcidev->irq, phba); 1725 free_irq(phba->pcidev->irq, phba);