summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>1999-08-21 06:24:40 +0000
committermsmith <msmith@FreeBSD.org>1999-08-21 06:24:40 +0000
commitb51f157bff8b959d943b0836a1c57f065b9318d5 (patch)
treee447ab34080a4d202ed41db3476df31ef1f56a50 /sys/dev
parenta753b272ec1066c690e1ba83c8780af55e3a6c78 (diff)
downloadFreeBSD-src-b51f157bff8b959d943b0836a1c57f065b9318d5.zip
FreeBSD-src-b51f157bff8b959d943b0836a1c57f065b9318d5.tar.gz
Implement a new generic mechanism for attaching handler functions to
events, in order to pave the way for removing a number of the ad-hoc implementations currently in use. Retire the at_shutdown family of functions and replace them with new event handler lists. Rework kern_shutdown.c to take greater advantage of the use of event handlers. Reviewed by: green
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/aic7xxx/aic7xxx.c9
-rw-r--r--sys/dev/de/if_de.c5
-rw-r--r--sys/dev/dpt/dpt_scsi.c11
-rw-r--r--sys/dev/en/if_en_pci.c9
-rw-r--r--sys/dev/hea/eni.c14
-rw-r--r--sys/dev/hfa/fore_load.c13
-rw-r--r--sys/dev/ie/if_ie.c9
-rw-r--r--sys/dev/pdq/if_fpa.c11
-rw-r--r--sys/dev/syscons/syscons.c10
-rw-r--r--sys/dev/tx/if_tx.c11
-rw-r--r--sys/dev/vx/if_vx_pci.c9
-rw-r--r--sys/dev/wi/if_wi.c13
12 files changed, 69 insertions, 55 deletions
diff --git a/sys/dev/aic7xxx/aic7xxx.c b/sys/dev/aic7xxx/aic7xxx.c
index 7acab86..1d0d043 100644
--- a/sys/dev/aic7xxx/aic7xxx.c
+++ b/sys/dev/aic7xxx/aic7xxx.c
@@ -36,7 +36,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: aic7xxx.c,v 1.31 1999/05/23 18:55:58 gibbs Exp $
+ * $Id: aic7xxx.c,v 1.32 1999/08/16 22:49:28 gibbs Exp $
*/
/*
* A few notes on features of the driver.
@@ -96,6 +96,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
+#include <sys/eventhandler.h>
#include <sys/buf.h>
#include <sys/proc.h>
@@ -209,7 +210,7 @@ static bus_dmamap_callback_t ahcdmamapcb;
#if UNUSED
static void ahc_dump_targcmd(struct target_cmd *cmd);
#endif
-static void ahc_shutdown(int howto, void *arg);
+static void ahc_shutdown(void *arg, int howto);
static cam_status
ahc_find_tmode_devs(struct ahc_softc *ahc,
struct cam_sim *sim, union ccb *ccb,
@@ -4291,7 +4292,7 @@ ahc_init(struct ahc_softc *ahc)
ahc_loadseq(ahc);
/* We have to wait until after any system dumps... */
- at_shutdown(ahc_shutdown, ahc, SHUTDOWN_FINAL);
+ EVENTHANDLER_REGISTER(shutdown_final, ahc_shutdown, ahc, SHUTDOWN_PRI_DEFAULT);
return (0);
}
@@ -6436,7 +6437,7 @@ ahc_dump_targcmd(struct target_cmd *cmd)
#endif
static void
-ahc_shutdown(int howto, void *arg)
+ahc_shutdown(void *arg, int howto)
{
struct ahc_softc *ahc;
int i;
diff --git a/sys/dev/de/if_de.c b/sys/dev/de/if_de.c
index c1a290f..45829b0 100644
--- a/sys/dev/de/if_de.c
+++ b/sys/dev/de/if_de.c
@@ -5126,7 +5126,7 @@ static struct pci_device dedevice = {
COMPAT_PCI_DRIVER(de, dedevice);
static void
-tulip_shutdown(int howto, void *arg)
+tulip_shutdown(void *arg, int howto)
{
tulip_softc_t * const sc = arg;
TULIP_CSR_WRITE(sc, csr_busmode, TULIP_BUSMODE_SWRESET);
@@ -5313,7 +5313,8 @@ tulip_pci_attach(pcici_t config_id, int unit)
return;
}
}
- at_shutdown(tulip_shutdown, sc, SHUTDOWN_POST_SYNC);
+ EVENTHANDLER_REGISTER(shutdown_post_sync, tulip_shutdown, sc,
+ SHUTDOWN_PRI_DEFAULT);
#if defined(TULIP_USE_SOFTINTR)
if (sc->tulip_unit > tulip_softintr_max_unit)
tulip_softintr_max_unit = sc->tulip_unit;
diff --git a/sys/dev/dpt/dpt_scsi.c b/sys/dev/dpt/dpt_scsi.c
index bb7362e..aae96a9 100644
--- a/sys/dev/dpt/dpt_scsi.c
+++ b/sys/dev/dpt/dpt_scsi.c
@@ -43,7 +43,7 @@
* arrays that span controllers (Wow!).
*/
-#ident "$Id: dpt_scsi.c,v 1.23 1999/05/06 20:16:22 ken Exp $"
+#ident "$Id: dpt_scsi.c,v 1.24 1999/08/16 01:49:35 gibbs Exp $"
#define _DPT_C_
@@ -155,7 +155,7 @@ static void dptprocesserror(dpt_softc_t *dpt, dpt_ccb_t *dccb,
u_int scsi_stat, u_int32_t resid);
static void dpttimeout(void *arg);
-static void dptshutdown(int howto, void *arg);
+static void dptshutdown(void *arg, int howto);
/* ================= Private Inline Function definitions ====================*/
static __inline int
@@ -1407,7 +1407,8 @@ dpt_attach(dpt_softc_t *dpt)
}
if (i > 0)
- at_shutdown(dptshutdown, dpt, SHUTDOWN_FINAL);
+ EVENTHANDLER_REGISTER(shutdown_final, dptshutdown,
+ dpt, SHUTDOWN_PRI_DEFAULT);
return (i);
}
@@ -1639,10 +1640,10 @@ dpttimeout(void *arg)
/*
* Shutdown the controller and ensure that the cache is completely flushed.
- * Called via at_shutdown(9) after all disk access has completed.
+ * Called from the shutdown_final event after all disk access has completed.
*/
static void
-dptshutdown(int howto, void *arg)
+dptshutdown(void *arg, int howto)
{
dpt_softc_t *dpt;
diff --git a/sys/dev/en/if_en_pci.c b/sys/dev/en/if_en_pci.c
index 0f0e3a7..30d9e98 100644
--- a/sys/dev/en/if_en_pci.c
+++ b/sys/dev/en/if_en_pci.c
@@ -70,7 +70,7 @@
static void en_pci_attach __P((pcici_t, int));
static const char *en_pci_probe __P((pcici_t, pcidi_t));
-static void en_pci_shutdown __P((int, void *));
+static void en_pci_shutdown __P((void *, int));
/*
* local structures
@@ -266,7 +266,8 @@ int unit;
* doing so could allow DMA to corrupt kernel memory during the
* reboot before the driver initializes.
*/
- at_shutdown(en_pci_shutdown, scp, SHUTDOWN_POST_SYNC);
+ EVENTHANDLER_REGISTER(shutdown_post_sync, en_pci_shutdown, scp,
+ SHUTDOWN_PRI_DEFAULT);
if (!pci_map_int(config_id, en_intr, (void *) sc, &net_imask)) {
printf("%s: couldn't establish interrupt\n", sc->sc_dev.dv_xname);
@@ -304,8 +305,8 @@ int unit;
static void
en_pci_shutdown(
- int howto,
- void *sc)
+ void *sc,
+ int howto)
{
struct en_pci_softc *psc = (struct en_pci_softc *)sc;
diff --git a/sys/dev/hea/eni.c b/sys/dev/hea/eni.c
index f6f1549..7077680 100644
--- a/sys/dev/hea/eni.c
+++ b/sys/dev/hea/eni.c
@@ -23,7 +23,7 @@
* Copies of this Software may be made, however, the above copyright
* notice must be reproduced on all copies.
*
- * @(#) $Id: eni.c,v 1.7 1999/05/09 17:07:27 peter Exp $
+ * @(#) $Id: eni.c,v 1.8 1999/05/10 22:53:41 mks Exp $
*
*/
@@ -42,7 +42,7 @@
#include <dev/hea/eni_var.h>
#ifndef lint
-__RCSID("@(#) $Id: eni.c,v 1.7 1999/05/09 17:07:27 peter Exp $");
+__RCSID("@(#) $Id: eni.c,v 1.8 1999/05/10 22:53:41 mks Exp $");
#endif
/*
@@ -57,7 +57,7 @@ static void eni_read_seeprom __P((Eni_unit *));
#if BSD < 199506
static int eni_pci_shutdown __P((struct kern_devconf *, int));
#else
-static void eni_pci_shutdown __P((int, void *));
+static void eni_pci_shutdown __P((void *, int));
#endif
static void eni_pci_reset __P((Eni_unit *));
#endif /* __FreeBSD__ */
@@ -549,7 +549,9 @@ eni_pci_attach ( pcici_t config_id, int unit )
/*
* Add hook to out shutdown function
*/
- at_shutdown ( (bootlist_fn)eni_pci_shutdown, eup, SHUTDOWN_POST_SYNC );
+ EVENTHANDLER_REGISTER(shutdown_post_sync, eni_pci_shutdown, eup,
+ SHUTDOWN_PRI_DEFAULT);
+
#endif
/*
@@ -654,9 +656,9 @@ eni_pci_shutdown ( kdc, force )
*
*/
static void
-eni_pci_shutdown ( howto, eup )
- int howto;
+eni_pci_shutdown ( eup, howto )
void *eup;
+ int howto;
{
/* Do device reset */
diff --git a/sys/dev/hfa/fore_load.c b/sys/dev/hfa/fore_load.c
index 3921475..f7eeeec 100644
--- a/sys/dev/hfa/fore_load.c
+++ b/sys/dev/hfa/fore_load.c
@@ -23,7 +23,7 @@
* Copies of this Software may be made, however, the above copyright
* notice must be reproduced on all copies.
*
- * @(#) $Id: fore_load.c,v 1.8 1999/05/10 22:53:45 mks Exp $
+ * @(#) $Id: fore_load.c,v 1.9 1999/05/30 16:51:25 phk Exp $
*
*/
@@ -38,7 +38,7 @@
#include <dev/hfa/fore_include.h>
#ifndef lint
-__RCSID("@(#) $Id: fore_load.c,v 1.8 1999/05/10 22:53:45 mks Exp $");
+__RCSID("@(#) $Id: fore_load.c,v 1.9 1999/05/30 16:51:25 phk Exp $");
#endif
@@ -59,7 +59,7 @@ static void fore_pci_attach __P((pcici_t, int));
#if BSD < 199506
static int fore_pci_shutdown __P((struct kern_devconf *, int));
#else
-static void fore_pci_shutdown __P((int, void *));
+static void fore_pci_shutdown __P((void *, int));
#endif
#endif
static void fore_unattach __P((Fore_unit *));
@@ -1055,7 +1055,8 @@ fore_pci_attach(config_id, unit)
/*
* Add hook to our shutdown function
*/
- at_shutdown(fore_pci_shutdown, fup, SHUTDOWN_POST_SYNC);
+ EVENTHANDLER_REGISTER(shutdown_post_sync, fore_pci_shutdown, fup,
+ SHUTDOWN_PRI_DEFAULT);
#endif
/*
@@ -1125,9 +1126,9 @@ fore_pci_shutdown(kdc, force)
*
*/
static void
-fore_pci_shutdown(howto, fup)
- int howto;
+fore_pci_shutdown(fup, howto)
void *fup;
+ int howto;
{
fore_reset((Fore_unit *) fup);
diff --git a/sys/dev/ie/if_ie.c b/sys/dev/ie/if_ie.c
index f9b155a..b7e04df 100644
--- a/sys/dev/ie/if_ie.c
+++ b/sys/dev/ie/if_ie.c
@@ -47,7 +47,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: if_ie.c,v 1.64 1999/08/20 14:12:13 mdodd Exp $
+ * $Id: if_ie.c,v 1.65 1999/08/20 14:36:40 mdodd Exp $
*/
/*
@@ -190,7 +190,7 @@ static void ee16_eeprom_outbits(struct ie_softc * ie, int edata, int cnt);
static void ee16_eeprom_clock(struct ie_softc * ie, int state);
static u_short ee16_read_eeprom(struct ie_softc * ie, int location);
static int ee16_eeprom_inbits(struct ie_softc * ie);
-static void ee16_shutdown(int howto, void *sc);
+static void ee16_shutdown(void *sc, int howto);
static void iereset(int unit);
static void ie_readframe(int unit, struct ie_softc * ie, int bufno);
@@ -550,7 +550,7 @@ ni_probe(struct isa_device *dvp)
static void
-ee16_shutdown(int howto, void *sc)
+ee16_shutdown(void *sc, int howto)
{
struct ie_softc *ie = (struct ie_softc *)sc;
int unit = ie - &ie_softc[0];
@@ -832,7 +832,8 @@ ieattach(struct isa_device *dvp)
ifp->if_hdrlen = 14;
if (ie->hard_type == IE_EE16)
- at_shutdown(ee16_shutdown, ie, SHUTDOWN_POST_SYNC);
+ EVENTHANDLER_REGISTER(shutdown_post_sync, ee16_shutdown,
+ ie, SHUTDOWN_PRI_DEFAULT);
#if NBPF > 0
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
diff --git a/sys/dev/pdq/if_fpa.c b/sys/dev/pdq/if_fpa.c
index 839b939..57bc72d 100644
--- a/sys/dev/pdq/if_fpa.c
+++ b/sys/dev/pdq/if_fpa.c
@@ -21,7 +21,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: if_fpa.c,v 1.9 1999/04/24 20:14:00 peter Exp $
+ * $Id: if_fpa.c,v 1.10 1999/05/09 17:06:54 peter Exp $
*
*/
@@ -128,7 +128,7 @@ pdq_pci_ifintr(
#endif /* __FreeBSD && BSD */
#if defined(__FreeBSD__)
-static void pdq_pci_shutdown(int, void *);
+static void pdq_pci_shutdown(void *, int);
/*
* This is the PCI configuration support. Since the PDQ is available
@@ -192,14 +192,15 @@ pdq_pci_attach(
pdqs_pci[unit] = sc;
pdq_ifattach(sc, pdq_pci_ifwatchdog);
pci_map_int(config_id, pdq_pci_ifintr, (void*) sc, &net_imask);
- at_shutdown(pdq_pci_shutdown, (void *) sc, SHUTDOWN_POST_SYNC);
+ EVENTHANDLER_REGISTER(shutdown_post_sync, pdq_pci_shutdown, sc,
+ SHUTDOWN_PRI_DEFAULT);
}
static void
pdq_pci_shutdown(
- int howto,
- void *sc)
+ void *sc,
+ int howto)
{
pdq_hwreset(((pdq_softc_t *)sc)->sc_pdq);
}
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
index 271f942..8fcaaa4 100644
--- a/sys/dev/syscons/syscons.c
+++ b/sys/dev/syscons/syscons.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: syscons.c,v 1.317 1999/08/13 16:17:54 dt Exp $
+ * $Id: syscons.c,v 1.318 1999/08/17 22:06:17 billf Exp $
*/
#include "sc.h"
@@ -39,6 +39,7 @@
#if NSC > 0
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/eventhandler.h>
#include <sys/reboot.h>
#include <sys/conf.h>
#include <sys/proc.h>
@@ -140,7 +141,7 @@ static void scinit(int unit, int flags);
#if __i386__
static void scterm(int unit, int flags);
#endif
-static void scshutdown(int howto, void *arg);
+static void scshutdown(void *arg, int howto);
static u_int scgetc(sc_softc_t *sc, u_int flags);
#define SCGETC_CN 1
#define SCGETC_NONBLOCK 2
@@ -359,7 +360,8 @@ sc_attach_unit(int unit, int flags)
/* register a shutdown callback for the kernel console */
if (sc_console_unit == unit)
- at_shutdown(scshutdown, (void *)(uintptr_t)unit, SHUTDOWN_PRE_SYNC);
+ EVENTHANDLER_REGISTER(shutdown_pre_sync, scshutdown,
+ (void *)(uintptr_t)unit, SHUTDOWN_PRI_DEFAULT);
/*
* syscons's cdevsw must be registered from here. As syscons and
@@ -3380,7 +3382,7 @@ scterm(int unit, int flags)
#endif
static void
-scshutdown(int howto, void *arg)
+scshutdown(void *arg, int howto)
{
/* assert(sc_console != NULL) */
diff --git a/sys/dev/tx/if_tx.c b/sys/dev/tx/if_tx.c
index 8899237..af694f6 100644
--- a/sys/dev/tx/if_tx.c
+++ b/sys/dev/tx/if_tx.c
@@ -1,5 +1,5 @@
/* $OpenBSD: if_tx.c,v 1.3 1998/10/10 04:30:09 jason Exp $ */
-/* $Id: if_tx.c,v 1.28 1999/07/03 20:17:05 peter Exp $ */
+/* $Id: if_tx.c,v 1.29 1999/07/06 19:23:30 des Exp $ */
/*-
* Copyright (c) 1997 Semen Ustimenko (semen@iclub.nsu.ru)
@@ -378,7 +378,7 @@ epic_shutdown(
static const char* epic_freebsd_probe __P((pcici_t, pcidi_t));
static void epic_freebsd_attach __P((pcici_t, int));
-static void epic_shutdown __P((int, void *));
+static void epic_shutdown __P((void *, int));
/* Global variables */
static u_long epic_pci_count;
@@ -546,7 +546,8 @@ epic_freebsd_attach(
}
/* Set shut down routine to stop DMA processes on reboot */
- at_shutdown(epic_shutdown, sc, SHUTDOWN_POST_SYNC);
+ EVENTHANDLER_REGISTER(shutdown_post_sync, epic_shutdown, sc,
+ SHUTDOWN_PRI_DEFAULT);
/* Attach to if manager */
if_attach(ifp);
@@ -565,8 +566,8 @@ epic_freebsd_attach(
static void
epic_shutdown(
- int howto,
- void *sc)
+ void *sc,
+ int howto)
{
epic_stop(sc);
}
diff --git a/sys/dev/vx/if_vx_pci.c b/sys/dev/vx/if_vx_pci.c
index 2bad3b0..386ba42 100644
--- a/sys/dev/vx/if_vx_pci.c
+++ b/sys/dev/vx/if_vx_pci.c
@@ -44,14 +44,14 @@
#include <dev/vx/if_vxreg.h>
-static void vx_pci_shutdown(int, void *);
+static void vx_pci_shutdown(void *, int);
static const char *vx_pci_probe(pcici_t, pcidi_t);
static void vx_pci_attach(pcici_t, int unit);
static void
vx_pci_shutdown(
- int howto,
- void *sc)
+ void *sc,
+ int howto)
{
vxstop(sc);
vxfree(sc);
@@ -122,7 +122,8 @@ vx_pci_attach(
* doing do could allow DMA to corrupt kernel memory during the
* reboot before the driver initializes.
*/
- at_shutdown(vx_pci_shutdown, sc, SHUTDOWN_POST_SYNC);
+ EVENTHANDLER_REGISTER(shutdown_post_sync, vx_pci_shutdown, sc,
+ SHUTDOWN_PRI_DEFAULT);
pci_map_int(config_id, vxintr, (void *) sc, &net_imask);
}
diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c
index 4e2b2cf..5b6467f 100644
--- a/sys/dev/wi/if_wi.c
+++ b/sys/dev/wi/if_wi.c
@@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: if_wi.c,v 1.7 1999/07/04 14:40:22 wpaul Exp $
+ * $Id: if_wi.c,v 1.8 1999/07/06 19:22:53 des Exp $
*/
/*
@@ -116,7 +116,7 @@
#if !defined(lint)
static const char rcsid[] =
- "$Id: if_wi.c,v 1.7 1999/07/04 14:40:22 wpaul Exp $";
+ "$Id: if_wi.c,v 1.8 1999/07/06 19:22:53 des Exp $";
#endif
static struct wi_softc wi_softc[NWI];
@@ -136,7 +136,7 @@ static void wi_init __P((void *));
static void wi_start __P((struct ifnet *));
static void wi_stop __P((struct wi_softc *));
static void wi_watchdog __P((struct ifnet *));
-static void wi_shutdown __P((int, void *));
+static void wi_shutdown __P((void *, int));
static void wi_rxeof __P((struct wi_softc *));
static void wi_txeof __P((struct wi_softc *, int));
static void wi_update_stats __P((struct wi_softc *));
@@ -367,7 +367,8 @@ static int wi_attach(isa_dev)
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
- at_shutdown(wi_shutdown, sc, SHUTDOWN_POST_SYNC);
+ EVENTHANDLER_REGISTER(shutdown_post_sync, wi_shutdown, sc,
+ SHUTDOWN_PRI_DEFAULT);
}
return(0);
@@ -1336,9 +1337,9 @@ static void wi_watchdog(ifp)
return;
}
-static void wi_shutdown(howto, arg)
- int howto;
+static void wi_shutdown(arg, howto)
void *arg;
+ int howto;
{
struct wi_softc *sc;
OpenPOWER on IntegriCloud