Add SHUTDOWN_PRI_DRIVER and move all driver shutdown functions from
authorMatthew Dillon <dillon@dragonflybsd.org>
Wed, 11 Jul 2007 23:46:58 +0000 (23:46 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Wed, 11 Jul 2007 23:46:58 +0000 (23:46 +0000)
SHUTDOWN_PRI_DEFAULT to SHUTDOWN_PRI_DRIVER.  This allows the CAM subsystem
to shutdown SCSI before individual SCSI drivers shutdown.

Reported-by: Peter Avalos <pavalos@theshell.com>
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue713>

12 files changed:
sys/dev/atm/hea/eni.c
sys/dev/atm/hfa/fore_load.c
sys/dev/disk/aic7xxx/aic79xx_osm.c
sys/dev/disk/aic7xxx/aic7xxx_osm.c
sys/dev/netif/en_pci/if_en_pci.c
sys/dev/netif/fpa/if_fpa.c
sys/dev/netif/ie/if_ie.c
sys/dev/raid/aac/aac.c
sys/dev/raid/dpt/dpt_scsi.c
sys/dev/raid/iir/iir.c
sys/dev/raid/pst/pst-raid.c
sys/sys/eventhandler.h

index 95f3988..7ef940f 100644 (file)
@@ -24,7 +24,7 @@
  * notice must be reproduced on all copies.
  *
  *     @(#) $FreeBSD: src/sys/dev/hea/eni.c,v 1.10 1999/08/28 00:41:42 peter Exp $
- *     @(#) $DragonFly: src/sys/dev/atm/hea/eni.c,v 1.9 2006/12/20 18:14:38 dillon Exp $
+ *     @(#) $DragonFly: src/sys/dev/atm/hea/eni.c,v 1.10 2007/07/11 23:46:56 dillon Exp $
  */
 
 /*
@@ -533,7 +533,7 @@ eni_pci_attach ( pcici_t config_id, int unit )
         * Add hook to out shutdown function
         */
        EVENTHANDLER_REGISTER(shutdown_post_sync, eni_pci_shutdown, eup,
-                             SHUTDOWN_PRI_DEFAULT);
+                             SHUTDOWN_PRI_DRIVER);
 
        /*
         * Initialize driver processing
index ff7e8be..373348a 100644 (file)
@@ -24,7 +24,7 @@
  * notice must be reproduced on all copies.
  *
  *     @(#) $FreeBSD: src/sys/dev/hfa/fore_load.c,v 1.13 1999/09/25 18:23:49 phk Exp $
- *     @(#) $DragonFly: src/sys/dev/atm/hfa/fore_load.c,v 1.12 2005/06/16 21:12:29 dillon Exp $
+ *     @(#) $DragonFly: src/sys/dev/atm/hfa/fore_load.c,v 1.13 2007/07/11 23:46:58 dillon Exp $
  */
 
 /*
@@ -339,7 +339,7 @@ fore_pci_attach(config_id, unit)
         * Add hook to our shutdown function
         */
        EVENTHANDLER_REGISTER(shutdown_post_sync, fore_pci_shutdown, fup,
-                             SHUTDOWN_PRI_DEFAULT);
+                             SHUTDOWN_PRI_DRIVER);
 
        /*
         * Initialize the CP microcode program.
index af538a7..360dea5 100644 (file)
@@ -32,7 +32,7 @@
  * $Id: //depot/aic7xxx/freebsd/dev/aic7xxx/aic79xx_osm.c#35 $
  *
  * $FreeBSD: src/sys/dev/aic7xxx/aic79xx_osm.c,v 1.23 2005/12/04 02:12:40 ru Exp $
- * $DragonFly: src/sys/dev/disk/aic7xxx/aic79xx_osm.c,v 1.20 2007/07/07 01:06:07 pavalos Exp $
+ * $DragonFly: src/sys/dev/disk/aic7xxx/aic79xx_osm.c,v 1.21 2007/07/11 23:46:58 dillon Exp $
  */
 
 #include "aic79xx_osm.h"
@@ -167,7 +167,7 @@ fail:
                /* We have to wait until after any system dumps... */
                ahd->platform_data->eh =
                    EVENTHANDLER_REGISTER(shutdown_post_sync, ahd_shutdown,
-                                         ahd, SHUTDOWN_PRI_DEFAULT);
+                                         ahd, SHUTDOWN_PRI_DRIVER);
                ahd_intr_enable(ahd, TRUE);
        }
 
index 20c0441..8181836 100644 (file)
@@ -31,7 +31,7 @@
  * $Id: //depot/aic7xxx/freebsd/dev/aic7xxx/aic7xxx_osm.c#20 $
  *
  * $FreeBSD: src/sys/dev/aic7xxx/aic7xxx_osm.c,v 1.45 2006/09/05 20:28:28 mjacob Exp $
- * $DragonFly: src/sys/dev/disk/aic7xxx/aic7xxx_osm.c,v 1.19 2007/07/07 01:36:02 pavalos Exp $
+ * $DragonFly: src/sys/dev/disk/aic7xxx/aic7xxx_osm.c,v 1.20 2007/07/11 23:46:58 dillon Exp $
  */
 
 #include "aic7xxx_osm.h"
@@ -272,7 +272,7 @@ fail:
                /* We have to wait until after any system dumps... */
                ahc->platform_data->eh =
                    EVENTHANDLER_REGISTER(shutdown_post_sync, ahc_shutdown,
-                                         ahc, SHUTDOWN_PRI_DEFAULT);
+                                         ahc, SHUTDOWN_PRI_DRIVER);
                ahc_intr_enable(ahc, TRUE);
        }
 
index e6b0300..35a61d0 100644 (file)
@@ -32,7 +32,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/pci/if_en_pci.c,v 1.12 1999/08/21 22:10:49 msmith Exp $
- * $DragonFly: src/sys/dev/netif/en_pci/if_en_pci.c,v 1.15 2006/12/22 23:26:19 swildner Exp $
+ * $DragonFly: src/sys/dev/netif/en_pci/if_en_pci.c,v 1.16 2007/07/11 23:46:58 dillon Exp $
  */
 
 /*
@@ -254,7 +254,7 @@ en_pci_attach(pcici_t config_id, int unit)
    * reboot before the driver initializes.
    */
   EVENTHANDLER_REGISTER(shutdown_post_sync, en_pci_shutdown, scp,
-                       SHUTDOWN_PRI_DEFAULT);
+                       SHUTDOWN_PRI_DRIVER);
 
   if (!pci_map_int(config_id, en_intr, (void *) sc)) {
     kprintf("%s: couldn't establish interrupt\n", sc->sc_dev.dv_xname);
index 29009e3..1a2718c 100644 (file)
@@ -22,7 +22,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/dev/pdq/if_fpa.c,v 1.13 1999/08/28 00:50:50 peter Exp $
- * $DragonFly: src/sys/dev/netif/fpa/Attic/if_fpa.c,v 1.17 2006/12/22 23:26:20 swildner Exp $
+ * $DragonFly: src/sys/dev/netif/fpa/Attic/if_fpa.c,v 1.18 2007/07/11 23:46:58 dillon Exp $
  */
 
 /*
@@ -192,7 +192,7 @@ pdq_pci_attach(
     pdq_ifattach(sc, pdq_pci_ifwatchdog);
     pci_map_int(config_id, pdq_pci_ifintr, (void*) sc);
     EVENTHANDLER_REGISTER(shutdown_post_sync, pdq_pci_shutdown, sc,
-                         SHUTDOWN_PRI_DEFAULT);
+                         SHUTDOWN_PRI_DRIVER);
 
 }
 
index c026cdc..1ceba78 100644 (file)
@@ -48,7 +48,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/dev/ie/if_ie.c,v 1.72.2.4 2003/03/27 21:01:49 mdodd Exp $
- * $DragonFly: src/sys/dev/netif/ie/if_ie.c,v 1.31 2006/12/22 23:26:20 swildner Exp $
+ * $DragonFly: src/sys/dev/netif/ie/if_ie.c,v 1.32 2007/07/11 23:46:58 dillon Exp $
  */
 
 /*
@@ -828,7 +828,7 @@ ieattach(struct isa_device *dvp)
 
        if (ie->hard_type == IE_EE16)
                EVENTHANDLER_REGISTER(shutdown_post_sync, ee16_shutdown,
-                                     ie, SHUTDOWN_PRI_DEFAULT);
+                                     ie, SHUTDOWN_PRI_DRIVER);
 
        ether_ifattach(ifp, ie->arpcom.ac_enaddr, NULL);
        return (1);
index 15f81da..87135a4 100644 (file)
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *     $FreeBSD: src/sys/dev/aac/aac.c,v 1.9.2.14 2003/04/08 13:22:08 scottl Exp $
- *     $DragonFly: src/sys/dev/raid/aac/aac.c,v 1.31 2007/06/04 17:21:57 dillon Exp $
+ *     $DragonFly: src/sys/dev/raid/aac/aac.c,v 1.32 2007/07/11 23:46:58 dillon Exp $
  */
 
 /*
@@ -305,7 +305,7 @@ aac_attach(struct aac_softc *sc)
 
        /* Register the shutdown method to only be called post-dump */
        if ((EVENTHANDLER_REGISTER(shutdown_post_sync, aac_shutdown, sc->aac_dev,
-                                  SHUTDOWN_PRI_DEFAULT)) == NULL)
+                                  SHUTDOWN_PRI_DRIVER)) == NULL)
        device_printf(sc->aac_dev, "shutdown event registration failed\n");
 
        /* Register with CAM for the non-DASD devices */
index 6ac2782..4ace5b0 100644 (file)
@@ -44,7 +44,7 @@
  */
 
 #ident "$FreeBSD: src/sys/dev/dpt/dpt_scsi.c,v 1.28.2.3 2003/01/31 02:47:10 grog Exp $"
-#ident "$DragonFly: src/sys/dev/raid/dpt/dpt_scsi.c,v 1.14 2007/06/04 17:21:58 dillon Exp $"
+#ident "$DragonFly: src/sys/dev/raid/dpt/dpt_scsi.c,v 1.15 2007/07/11 23:46:58 dillon Exp $"
 
 #define _DPT_C_
 
@@ -1494,7 +1494,7 @@ dpt_attach(dpt_softc_t *dpt)
        cam_simq_release(devq);
        if (i > 0)
                EVENTHANDLER_REGISTER(shutdown_post_sync, dptshutdown,
-                                     dpt, SHUTDOWN_PRI_DEFAULT);
+                                     dpt, SHUTDOWN_PRI_DRIVER);
        return (i);
 }
 
index 399347e..89a562a 100644 (file)
@@ -1,5 +1,5 @@
 /* $FreeBSD: src/sys/dev/iir/iir.c,v 1.2.2.3 2002/05/05 08:18:12 asmodai Exp $ */
-/* $DragonFly: src/sys/dev/raid/iir/iir.c,v 1.17 2007/06/04 17:22:00 dillon Exp $ */
+/* $DragonFly: src/sys/dev/raid/iir/iir.c,v 1.18 2007/07/11 23:46:58 dillon Exp $ */
 /*
  *       Copyright (c) 2000-01 Intel Corporation
  *       All Rights Reserved
@@ -501,7 +501,7 @@ iir_attach(struct gdt_softc *gdt)
     cam_simq_release(devq);
     if (i > 0)
         EVENTHANDLER_REGISTER(shutdown_post_sync, iir_shutdown,
-                              gdt, SHUTDOWN_PRI_DEFAULT);
+                              gdt, SHUTDOWN_PRI_DRIVER);
     /* iir_watchdog(gdt); */
     gdt->sc_state = GDT_NORMAL;
 }
index 69b18c2..e65bd60 100644 (file)
@@ -26,7 +26,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/dev/pst/pst-raid.c,v 1.2.2.1 2002/08/18 12:32:36 sos Exp $
- * $DragonFly: src/sys/dev/raid/pst/pst-raid.c,v 1.23 2007/05/15 00:01:04 dillon Exp $
+ * $DragonFly: src/sys/dev/raid/pst/pst-raid.c,v 1.24 2007/07/11 23:46:58 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -187,7 +187,7 @@ pst_attach(device_t dev)
           device_get_nameunit(psc->iop->dev));
 #if 0
     EVENTHANDLER_REGISTER(shutdown_post_sync, pst_shutdown,
-                         dev, SHUTDOWN_PRI_DEFAULT);
+                         dev, SHUTDOWN_PRI_DRIVER);
 #endif
     return 0;
 }
index ec5dead..d1f5028 100644 (file)
@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/sys/eventhandler.h,v 1.5 2000/01/16 06:11:33 bde Exp $
- * $DragonFly: src/sys/sys/eventhandler.h,v 1.7 2006/05/21 03:43:47 dillon Exp $
+ * $DragonFly: src/sys/sys/eventhandler.h,v 1.8 2007/07/11 23:46:54 dillon Exp $
  */
 
 #include <sys/queue.h>
@@ -163,6 +163,7 @@ typedef void (*shutdown_fn) (void *, int);
 
 #define        SHUTDOWN_PRI_FIRST      EVENTHANDLER_PRI_FIRST
 #define        SHUTDOWN_PRI_DEFAULT    EVENTHANDLER_PRI_ANY
+#define        SHUTDOWN_PRI_DRIVER     (EVENTHANDLER_PRI_ANY + 5000)
 #define        SHUTDOWN_PRI_LAST       EVENTHANDLER_PRI_LAST
 
 EVENTHANDLER_DECLARE(shutdown_pre_sync, shutdown_fn);  /* before fs sync */