From: Matthew Dillon Date: Wed, 11 Jul 2007 23:46:58 +0000 (+0000) Subject: Add SHUTDOWN_PRI_DRIVER and move all driver shutdown functions from X-Git-Tag: v2.0.1~2594 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/30527035be37e9c9f33a8a54603e78987e0cee38 Add SHUTDOWN_PRI_DRIVER and move all driver shutdown functions from SHUTDOWN_PRI_DEFAULT to SHUTDOWN_PRI_DRIVER. This allows the CAM subsystem to shutdown SCSI before individual SCSI drivers shutdown. Reported-by: Peter Avalos Dragonfly-bug: --- diff --git a/sys/dev/atm/hea/eni.c b/sys/dev/atm/hea/eni.c index 95f3988bbd..7ef940f645 100644 --- a/sys/dev/atm/hea/eni.c +++ b/sys/dev/atm/hea/eni.c @@ -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 diff --git a/sys/dev/atm/hfa/fore_load.c b/sys/dev/atm/hfa/fore_load.c index ff7e8befff..373348a473 100644 --- a/sys/dev/atm/hfa/fore_load.c +++ b/sys/dev/atm/hfa/fore_load.c @@ -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. diff --git a/sys/dev/disk/aic7xxx/aic79xx_osm.c b/sys/dev/disk/aic7xxx/aic79xx_osm.c index af538a757f..360dea5c6e 100644 --- a/sys/dev/disk/aic7xxx/aic79xx_osm.c +++ b/sys/dev/disk/aic7xxx/aic79xx_osm.c @@ -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); } diff --git a/sys/dev/disk/aic7xxx/aic7xxx_osm.c b/sys/dev/disk/aic7xxx/aic7xxx_osm.c index 20c04412e0..8181836767 100644 --- a/sys/dev/disk/aic7xxx/aic7xxx_osm.c +++ b/sys/dev/disk/aic7xxx/aic7xxx_osm.c @@ -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); } diff --git a/sys/dev/netif/en_pci/if_en_pci.c b/sys/dev/netif/en_pci/if_en_pci.c index e6b030089d..35a61d061d 100644 --- a/sys/dev/netif/en_pci/if_en_pci.c +++ b/sys/dev/netif/en_pci/if_en_pci.c @@ -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); diff --git a/sys/dev/netif/fpa/if_fpa.c b/sys/dev/netif/fpa/if_fpa.c index 29009e3c05..1a2718c102 100644 --- a/sys/dev/netif/fpa/if_fpa.c +++ b/sys/dev/netif/fpa/if_fpa.c @@ -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); } diff --git a/sys/dev/netif/ie/if_ie.c b/sys/dev/netif/ie/if_ie.c index c026cdcbc1..1ceba78871 100644 --- a/sys/dev/netif/ie/if_ie.c +++ b/sys/dev/netif/ie/if_ie.c @@ -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); diff --git a/sys/dev/raid/aac/aac.c b/sys/dev/raid/aac/aac.c index 15f81da670..87135a4d71 100644 --- a/sys/dev/raid/aac/aac.c +++ b/sys/dev/raid/aac/aac.c @@ -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 */ diff --git a/sys/dev/raid/dpt/dpt_scsi.c b/sys/dev/raid/dpt/dpt_scsi.c index 6ac2782799..4ace5b032f 100644 --- a/sys/dev/raid/dpt/dpt_scsi.c +++ b/sys/dev/raid/dpt/dpt_scsi.c @@ -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); } diff --git a/sys/dev/raid/iir/iir.c b/sys/dev/raid/iir/iir.c index 399347ebed..89a562a16c 100644 --- a/sys/dev/raid/iir/iir.c +++ b/sys/dev/raid/iir/iir.c @@ -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; } diff --git a/sys/dev/raid/pst/pst-raid.c b/sys/dev/raid/pst/pst-raid.c index 69b18c2a6c..e65bd60f9e 100644 --- a/sys/dev/raid/pst/pst-raid.c +++ b/sys/dev/raid/pst/pst-raid.c @@ -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 @@ -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; } diff --git a/sys/sys/eventhandler.h b/sys/sys/eventhandler.h index ec5deadf1b..d1f50288cd 100644 --- a/sys/sys/eventhandler.h +++ b/sys/sys/eventhandler.h @@ -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 @@ -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 */