]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/lpfc/lpfc_hbadisc.c
[SCSI] lpfc 8.1.2: Add ERROR and WARM_START modes for diagnostic purposes.
[linux-2.6-omap-h63xx.git] / drivers / scsi / lpfc / lpfc_hbadisc.c
index 5c396171ebe81a5eef361631f1f77494c1ff2644..55454923029dd3a91f8d12e877343bcf7184c000 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2004-2005 Emulex.  All rights reserved.           *
+ * Copyright (C) 2004-2006 Emulex.  All rights reserved.           *
  * EMULEX and SLI are trademarks of Emulex.                        *
  * www.emulex.com                                                  *
  * Portions Copyright (C) 2004-2005 Christoph Hellwig              *
@@ -120,11 +120,33 @@ lpfc_work_list_done(struct lpfc_hba * phba)
                        free_evt = 0;
                        break;
                case LPFC_EVT_ONLINE:
-                       *(int *)(evtp->evt_arg1)  = lpfc_online(phba);
+                       if (phba->hba_state < LPFC_LINK_DOWN)
+                               *(int *)(evtp->evt_arg1)  = lpfc_online(phba);
+                       else
+                               *(int *)(evtp->evt_arg1)  = 0;
                        complete((struct completion *)(evtp->evt_arg2));
                        break;
                case LPFC_EVT_OFFLINE:
-                       *(int *)(evtp->evt_arg1)  = lpfc_offline(phba);
+                       if (phba->hba_state >= LPFC_LINK_DOWN)
+                               lpfc_offline(phba);
+                       lpfc_sli_brdrestart(phba);
+                       *(int *)(evtp->evt_arg1) =
+                               lpfc_sli_brdready(phba,HS_FFRDY | HS_MBRDY);
+                       complete((struct completion *)(evtp->evt_arg2));
+                       break;
+               case LPFC_EVT_WARM_START:
+                       if (phba->hba_state >= LPFC_LINK_DOWN)
+                               lpfc_offline(phba);
+                       lpfc_sli_brdreset(phba);
+                       lpfc_hba_down_post(phba);
+                       *(int *)(evtp->evt_arg1) =
+                               lpfc_sli_brdready(phba, HS_MBRDY);
+                       complete((struct completion *)(evtp->evt_arg2));
+                       break;
+               case LPFC_EVT_KILL:
+                       if (phba->hba_state >= LPFC_LINK_DOWN)
+                               lpfc_offline(phba);
+                       *(int *)(evtp->evt_arg1)  = lpfc_sli_brdkill(phba);
                        complete((struct completion *)(evtp->evt_arg2));
                        break;
                }
@@ -287,6 +309,10 @@ lpfc_linkdown(struct lpfc_hba * phba)
        LPFC_MBOXQ_t     *mb;
        int               rc, i;
 
+       if (phba->hba_state == LPFC_LINK_DOWN) {
+               return 0;
+       }
+
        psli = &phba->sli;
 
        /* sysfs or selective reset may call this routine to clean up */