Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Feb 2005 16:46:35 -0800
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        freebsd-isdn@freebsd.org
Subject:   mechanical i4b cleanups
Message-ID:  <20050226004635.GA2922@odin.ac.hmc.edu>

next in thread | raw e-mail | index | archive | help

--lrZ03NoBR/3+SXJZ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Below are some fairly mechanical patches I did 6-9 months ago to drag
some of i4b's drivers in the direction of a modern implementation.  I
don't have the ability to test them and I don't have time to work on
them.  Perhaps someone here does.

The patches are also at:

http://people.freebsd.org/~brooks/patches/i4b.diff

-- Brooks

diff -ru freebsd/sys/i4b/capi/iavc/iavc_isa.c cleanup/sys/i4b/capi/iavc/iav=
c_isa.c
--- freebsd/sys/i4b/capi/iavc/iavc_isa.c	Sat Jan  8 10:40:04 2005
+++ cleanup/sys/i4b/capi/iavc/iavc_isa.c	Sat Jan  8 21:41:51 2005
@@ -28,6 +28,7 @@
=20
 #include <sys/param.h>
 #include <sys/kernel.h>
+#include <sys/module.h>
 #include <sys/systm.h>
 #include <sys/mbuf.h>
 #include <sys/socket.h>
diff -ru freebsd/sys/i4b/capi/iavc/iavc_pci.c cleanup/sys/i4b/capi/iavc/iav=
c_pci.c
--- freebsd/sys/i4b/capi/iavc/iavc_pci.c	Sat Jan  8 10:40:04 2005
+++ cleanup/sys/i4b/capi/iavc/iavc_pci.c	Sat Jan  8 21:41:51 2005
@@ -32,6 +32,7 @@
=20
 #include <sys/param.h>
 #include <sys/kernel.h>
+#include <sys/module.h>
 #include <sys/systm.h>
 #include <sys/mbuf.h>
 #include <sys/socket.h>
diff -ru freebsd/sys/i4b/driver/i4b_ctl.c cleanup/sys/i4b/driver/i4b_ctl.c
--- freebsd/sys/i4b/driver/i4b_ctl.c	Sat Jan  8 10:40:05 2005
+++ cleanup/sys/i4b/driver/i4b_ctl.c	Sat Jan  8 21:41:52 2005
@@ -37,6 +37,7 @@
 #include <sys/param.h>
 #include <sys/ioccom.h>
 #include <sys/kernel.h>
+#include <sys/module.h>
 #include <sys/systm.h>
 #include <sys/conf.h>
 #include <sys/socket.h>
@@ -69,7 +70,28 @@
 };
=20
 static void i4bctlattach(void *);
-PSEUDO_SET(i4bctlattach, i4b_i4bctldrv);
+
+static int i4bctl_modevent(module_t mod, int type, void *data)
+{
+	switch(type) {
+	case MOD_LOAD:
+		i4bctlattach(NULL);
+		break;
+	case MOD_UNLOAD:
+		printf("i4bctl module unload - not possiable for this module type\b");
+		return (EINVAL);
+	}
+
+	return (0);
+}
+
+static moduledata_t i4bctl_mod =3D {
+	"i4bctl",
+	i4bctl_modevent,
+	NULL
+};
+
+DECLARE_MODULE(i4bctl, i4bctl_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
=20
 /*------------------------------------------------------------------------=
---*
  *	interface attach routine
diff -ru freebsd/sys/i4b/driver/i4b_ing.c cleanup/sys/i4b/driver/i4b_ing.c
--- freebsd/sys/i4b/driver/i4b_ing.c	Sat Jan  8 10:40:05 2005
+++ cleanup/sys/i4b/driver/i4b_ing.c	Sat Jan  8 21:41:52 2005
@@ -38,8 +38,10 @@
=20
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/bus.h>
 #include <sys/kernel.h>
 #include <sys/mbuf.h>
+#include <sys/module.h>
 #include <sys/socket.h>
 #include <sys/errno.h>
 #include <sys/malloc.h>
@@ -65,9 +67,6 @@
=20
 /* initialized by L4 */
=20
-static drvr_link_t ing_drvr_linktab[NI4BING];
-static isdn_link_t *isdn_linktab[NI4BING];
-
 struct ing_softc {
 	int		sc_unit;	/* unit number			*/
 	int		sc_state;	/* state of the interface	*/
@@ -103,7 +102,9 @@
 	u_int   	packets_out;	/* packets out towards downstream */
 	u_int32_t	flags;
=20
-} ing_softc[NI4BING];
+	drvr_link_t	ing_drvr_linktab;
+	isdn_link_t 	*isdn_linktab;
+};
=20
 enum ing_states {
 	ST_IDLE,			/* initialized, ready, idle	*/
@@ -111,11 +112,37 @@
 	ST_CONNECTED			/* connected to remote		*/
 };
=20
-static void i4bingattach(void *);
+static struct ing_softc *ing_softc;
+
+static drvr_link_t *ing_ret_linktab(int unit);
+static void ing_set_linktab(int unit, isdn_link_t *ilt);
+
+static void i4bingattach(void);
+
+static int i4bing_modevent(module_t mod, int type, void *data)
+{
+	switch(type) {
+	case MOD_LOAD:
+		i4bingattach();
+		break;
+	case MOD_UNLOAD:
+		printf("i4bing module unload - not possiable for this module type\b");
+		return (EINVAL);
+	}
+
+	return (0);
+}
+
+static moduledata_t i4bing_mod =3D {
+	"i4bing",
+	i4bing_modevent,
+	NULL
+};
=20
-PSEUDO_SET(i4bingattach, i4b_ing);
+DECLARE_MODULE(i4bing, i4bing_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
=20
-static void ing_init_linktab(int unit);
+static void ing_init_softc(int unit, struct ing_softc *sc);
+static void ing_init_linktab(int unit, drvr_link_t *lt);
 static void ing_tx_queue_empty(int unit);
=20
 /* =3D=3D=3D=3D=3D=3D=3D=3D=3D NETGRAPH =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D */
@@ -219,19 +246,31 @@
  *	interface attach routine at kernel boot time
  *------------------------------------------------------------------------=
---*/
 static void
-i4bingattach(void *dummy)
+i4bingattach(void)
 {
-	struct ing_softc *sc =3D ing_softc;
+	struct ing_softc *sc;
 	int i;
-	int ret;
+	int n_ing =3D NI4BING;
=20
-	printf("i4bing: %d i4b NetGraph ISDN B-channel device(s) attached\n", NI4=
BING);
+	sc =3D ing_softc =3D malloc(sizeof(struct ing_softc) * n_ing,
+	    M_I4B, M_WAITOK);
+
+	printf("i4bing: %d i4b NetGraph ISDN B-channel device(s) attached\n",
+	    n_ing);
 =09
-	for(i=3D0; i < NI4BING; sc++, i++)
-	{
-		sc->sc_unit =3D i;
+	for(i=3D0; i < n_ing; sc++, i++)
+		ing_init_softc(i, sc);
+
+	ing_ret_linktab_p =3D ing_ret_linktab;
+	ing_set_linktab_p =3D ing_set_linktab;
+}
+
+static void
+ing_init_softc(int unit, struct ing_softc *sc)
+{
+	int ret;
 	=09
-		ing_init_linktab(i);
+		ing_init_linktab(unit, &sc->ing_drvr_linktab);
=20
 		NDBGL4(L4_DIALST, "setting dial state to ST_IDLE");
=20
@@ -259,7 +298,7 @@
=20
 		sc->sc_dialresp =3D DSTAT_NONE;	/* no response */
 		sc->sc_lastdialresp =3D DSTAT_NONE;
-	=09
+
 		/* setup a netgraph node */
=20
 		if ((ret =3D ng_make_node_common(&typestruct, &sc->node)))
@@ -274,7 +313,7 @@
 		{
 			printf("ing: ng_name node, ret =3D %d\n!", ret);
 			NG_NODE_UNREF(sc->node);
-			break;
+			return;
 		}
=20
 		NG_NODE_SET_PRIVATE(sc->node, sc);
@@ -285,7 +324,6 @@
 			mtx_init(&sc->xmitq.ifq_mtx, "i4b_ing_xmitq", NULL, MTX_DEF);
 		if(!mtx_initialized(&sc->xmitq_hipri.ifq_mtx))
 			mtx_init(&sc->xmitq_hipri.ifq_mtx, "i4b_ing_hipri", NULL, MTX_DEF);
-	}
 }
=20
 #ifdef I4BINGACCT
@@ -300,8 +338,9 @@
=20
 	/* get # of bytes in and out from the HSCX driver */=20
 =09
-	(*isdn_linktab[unit]->bch_stat)
-		(isdn_linktab[unit]->unit, isdn_linktab[unit]->channel, &bs);
+	(ing_softc[unit].isdn_linktab->bch_stat)
+		(ing_softc[unit].isdn_linktab->unit,
+		ing_softc[unit].isdn_linktab->channel, &bs);
=20
 	sc->sc_ioutb +=3D bs.outbytes;
 	sc->sc_iinb +=3D bs.inbytes;
@@ -460,7 +499,7 @@
 	register struct mbuf *m;
 	int error;
 =09
-	if((m =3D *isdn_linktab[unit]->rx_mbuf) =3D=3D NULL)
+	if((m =3D *ing_softc[unit].isdn_linktab->rx_mbuf) =3D=3D NULL)
 		return;
=20
 #if I4BINGACCT
@@ -506,14 +545,16 @@
=20
 		x =3D 1;
=20
-		if(! IF_HANDOFF(isdn_linktab[unit]->tx_queue, m, NULL))
+		if(! IF_HANDOFF(ing_softc[unit].isdn_linktab->tx_queue, m, NULL))
 		{
 			NDBGL4(L4_INGDBG, "ing%d: tx queue full!", unit);
 		}
 	}
=20
 	if(x)
-		(*isdn_linktab[unit]->bch_tx_start)(isdn_linktab[unit]->unit, isdn_linkt=
ab[unit]->channel);
+		(*ing_softc[unit].isdn_linktab->bch_tx_start)(
+		    ing_softc[unit].isdn_linktab->unit,
+		    ing_softc[unit].isdn_linktab->channel);
 }
=20
 /*------------------------------------------------------------------------=
---*
@@ -530,35 +571,35 @@
 /*------------------------------------------------------------------------=
---*
  *	return this drivers linktab address
  *------------------------------------------------------------------------=
---*/
-drvr_link_t *
+static drvr_link_t *
 ing_ret_linktab(int unit)
 {
-	return(&ing_drvr_linktab[unit]);
+	return(&ing_softc[unit].ing_drvr_linktab);
 }
=20
 /*------------------------------------------------------------------------=
---*
  *	setup the isdn_linktab for this driver
  *------------------------------------------------------------------------=
---*/
-void
+static void
 ing_set_linktab(int unit, isdn_link_t *ilt)
 {
-	isdn_linktab[unit] =3D ilt;
+	ing_softc[unit].isdn_linktab =3D ilt;
 }
=20
 /*------------------------------------------------------------------------=
---*
  *	initialize this drivers linktab
  *------------------------------------------------------------------------=
---*/
 static void
-ing_init_linktab(int unit)
+ing_init_linktab(int unit, drvr_link_t *lt)
 {
-	ing_drvr_linktab[unit].unit =3D unit;
-	ing_drvr_linktab[unit].bch_rx_data_ready =3D ing_rx_data_rdy;
-	ing_drvr_linktab[unit].bch_tx_queue_empty =3D ing_tx_queue_empty;
-	ing_drvr_linktab[unit].bch_activity =3D ing_activity;
-	ing_drvr_linktab[unit].line_connected =3D ing_connect;
-	ing_drvr_linktab[unit].line_disconnected =3D ing_disconnect;
-	ing_drvr_linktab[unit].dial_response =3D ing_dialresponse;
-	ing_drvr_linktab[unit].updown_ind =3D ing_updown;=09
+	lt->unit =3D unit;
+	lt->bch_rx_data_ready =3D ing_rx_data_rdy;
+	lt->bch_tx_queue_empty =3D ing_tx_queue_empty;
+	lt->bch_activity =3D ing_activity;
+	lt->line_connected =3D ing_connect;
+	lt->line_disconnected =3D ing_disconnect;
+	lt->dial_response =3D ing_dialresponse;
+	lt->updown_ind =3D ing_updown;=09
 }
=20
 /*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D*
diff -ru freebsd/sys/i4b/driver/i4b_ipr.c cleanup/sys/i4b/driver/i4b_ipr.c
--- freebsd/sys/i4b/driver/i4b_ipr.c	Sat Jan  8 10:40:06 2005
+++ cleanup/sys/i4b/driver/i4b_ipr.c	Sat Jan  8 21:41:52 2005
@@ -61,12 +61,14 @@
=20
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/bus.h>
 #include <sys/mbuf.h>
 #include <sys/socket.h>
 #include <sys/errno.h>
 #include <sys/ioccom.h>
 #include <sys/sockio.h>
 #include <sys/kernel.h>
+#include <sys/module.h>
 #include <net/if.h>
 #include <net/if_types.h>
 #include <net/netisr.h>
@@ -120,9 +122,6 @@
=20
 /* initialized by L4 */
=20
-static drvr_link_t ipr_drvr_linktab[NI4BIPR];
-static isdn_link_t *isdn_linktab[NI4BIPR];
-
 struct ipr_softc {
 	struct ifnet	sc_if;		/* network-visible interface	*/
 	int		sc_state;	/* state of the interface	*/
@@ -158,7 +157,10 @@
 #endif
 #endif
=20
-} ipr_softc[NI4BIPR];
+	drvr_link_t ipr_drvr_linktab;
+	isdn_link_t *isdn_linktab;
+};
+static struct ipr_softc *ipr_softc;
=20
 enum ipr_states {
 	ST_IDLE,			/* initialized, ready, idle	*/
@@ -168,7 +170,8 @@
 };
=20
 static void i4biprattach(void *);
-PSEUDO_SET(i4biprattach, i4b_ipr);
+drvr_link_t * ipr_ret_linktab(int unit);
+void ipr_set_linktab(int unit, isdn_link_t *ilt);
 static int i4biprioctl(struct ifnet *ifp, u_long cmd, caddr_t data);
=20
 static void iprwatchdog(struct ifnet *ifp);
@@ -181,22 +184,47 @@
  *			DEVICE DRIVER ROUTINES
  *=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D*/
=20
+static int i4bipr_modevent(module_t mod, int type, void *data)
+{
+	switch(type) {
+	case MOD_LOAD:
+		i4biprattach(NULL);
+		break;
+	case MOD_UNLOAD:
+		printf("i4bipr module unload - not possiable for this module type\b");
+		return (EINVAL);
+	}
+
+	return (0);
+}
+
+static moduledata_t i4bipr_mod =3D {
+	"i4bipr",
+	i4bipr_modevent,
+	NULL
+};
+
+DECLARE_MODULE(i4bipr, i4bipr_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
+
 /*------------------------------------------------------------------------=
---*
  *	interface attach routine at kernel boot time
  *------------------------------------------------------------------------=
---*/
 static void
 i4biprattach(void *dummy)
 {
-	struct ipr_softc *sc =3D ipr_softc;
+	struct ipr_softc *sc;
 	int i;
+	int n_ipr =3D NI4BIPR;
+
+	sc =3D ipr_softc =3D malloc(sizeof(struct ipr_softc), M_I4B, M_WAITOK);
=20
 #ifdef IPR_VJ
-	printf("i4bipr: %d IP over raw HDLC ISDN device(s) attached (VJ header co=
mpression)\n", NI4BIPR);
+	printf("i4bipr: %d IP over raw HDLC ISDN device(s) attached (VJ header co=
mpression)\n", n_ipr);
 #else
-	printf("i4bipr: %d IP over raw HDLC ISDN device(s) attached\n", NI4BIPR);
+	printf("i4bipr: %d IP over raw HDLC ISDN device(s) attached\n", n_ipr);
 #endif
 =09
-	for(i=3D0; i < NI4BIPR; sc++, i++)
+	for(i=3D0; i < n_ipr; sc++, i++)
 	{
 		ipr_init_linktab(i);
=20
@@ -271,6 +299,9 @@
=20
 		bpfattach(&sc->sc_if, DLT_NULL, sizeof(u_int));
 	}
+
+	ipr_ret_linktab_p =3D ipr_ret_linktab;
+	ipr_set_linktab_p =3D ipr_set_linktab;
 }
=20
 /*------------------------------------------------------------------------=
---*
@@ -521,8 +552,9 @@
 =09
 	/* get # of bytes in and out from the HSCX driver */=20
 =09
-	(*isdn_linktab[unit]->bch_stat)
-		(isdn_linktab[unit]->unit, isdn_linktab[unit]->channel, &bs);
+	(*ipr_softc[unit].isdn_linktab->bch_stat)(
+	    ipr_softc[unit].isdn_linktab->unit,
+	    ipr_softc[unit].isdn_linktab->channel, &bs);
=20
 	sc->sc_ioutb +=3D bs.outbytes;
 	sc->sc_iinb +=3D bs.inbytes;
@@ -729,7 +761,7 @@
 	int len, c;
 #endif
 =09
-	if((m =3D *isdn_linktab[unit]->rx_mbuf) =3D=3D NULL)
+	if((m =3D *ipr_softc[unit].isdn_linktab->rx_mbuf) =3D=3D NULL)
 		return;
=20
 	m->m_pkthdr.rcvif =3D &sc->sc_if;
@@ -952,8 +984,8 @@
 #endif
 		x =3D 1;
=20
-		IF_LOCK(isdn_linktab[unit]->tx_queue);
-		if(_IF_QFULL(isdn_linktab[unit]->tx_queue))
+		IF_LOCK(ipr_softc[unit].isdn_linktab->tx_queue);
+		if(_IF_QFULL(ipr_softc[unit].isdn_linktab->tx_queue))
 		{
 			NDBGL4(L4_IPRDBG, "ipr%d: tx queue full!", unit);
 			m_freem(m);
@@ -964,14 +996,16 @@
=20
 			sc->sc_if.if_opackets++;
=20
-			_IF_ENQUEUE(isdn_linktab[unit]->tx_queue, m);
+			_IF_ENQUEUE(ipr_softc[unit].isdn_linktab->tx_queue, m);
=20
 		}
-		IF_UNLOCK(isdn_linktab[unit]->tx_queue);
+		IF_UNLOCK(ipr_softc[unit].isdn_linktab->tx_queue);
 	}
=20
 	if(x)
-		(*isdn_linktab[unit]->bch_tx_start)(isdn_linktab[unit]->unit, isdn_linkt=
ab[unit]->channel);
+		(*ipr_softc[unit].isdn_linktab->bch_tx_start)(
+		    ipr_softc[unit].isdn_linktab->unit,
+		    ipr_softc[unit].isdn_linktab->channel);
 }
=20
 /*------------------------------------------------------------------------=
---*
@@ -991,7 +1025,7 @@
 drvr_link_t *
 ipr_ret_linktab(int unit)
 {
-	return(&ipr_drvr_linktab[unit]);
+	return(&ipr_softc[unit].ipr_drvr_linktab);
 }
=20
 /*------------------------------------------------------------------------=
---*
@@ -1000,7 +1034,7 @@
 void
 ipr_set_linktab(int unit, isdn_link_t *ilt)
 {
-	isdn_linktab[unit] =3D ilt;
+	ipr_softc[unit].isdn_linktab =3D ilt;
 }
=20
 /*------------------------------------------------------------------------=
---*
@@ -1009,14 +1043,14 @@
 static void
 ipr_init_linktab(int unit)
 {
-	ipr_drvr_linktab[unit].unit =3D unit;
-	ipr_drvr_linktab[unit].bch_rx_data_ready =3D ipr_rx_data_rdy;
-	ipr_drvr_linktab[unit].bch_tx_queue_empty =3D ipr_tx_queue_empty;
-	ipr_drvr_linktab[unit].bch_activity =3D ipr_activity;
-	ipr_drvr_linktab[unit].line_connected =3D ipr_connect;
-	ipr_drvr_linktab[unit].line_disconnected =3D ipr_disconnect;
-	ipr_drvr_linktab[unit].dial_response =3D ipr_dialresponse;
-	ipr_drvr_linktab[unit].updown_ind =3D ipr_updown;=09
+	ipr_softc[unit].ipr_drvr_linktab.unit =3D unit;
+	ipr_softc[unit].ipr_drvr_linktab.bch_rx_data_ready =3D ipr_rx_data_rdy;
+	ipr_softc[unit].ipr_drvr_linktab.bch_tx_queue_empty =3D ipr_tx_queue_empt=
y;
+	ipr_softc[unit].ipr_drvr_linktab.bch_activity =3D ipr_activity;
+	ipr_softc[unit].ipr_drvr_linktab.line_connected =3D ipr_connect;
+	ipr_softc[unit].ipr_drvr_linktab.line_disconnected =3D ipr_disconnect;
+	ipr_softc[unit].ipr_drvr_linktab.dial_response =3D ipr_dialresponse;
+	ipr_softc[unit].ipr_drvr_linktab.updown_ind =3D ipr_updown;=09
 }
=20
 /*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D*/
diff -ru freebsd/sys/i4b/driver/i4b_isppp.c cleanup/sys/i4b/driver/i4b_ispp=
p.c
--- freebsd/sys/i4b/driver/i4b_isppp.c	Sat Jan  8 10:40:06 2005
+++ cleanup/sys/i4b/driver/i4b_isppp.c	Sat Jan  8 21:41:52 2005
@@ -52,6 +52,7 @@
 #include <sys/ioccom.h>
 #include <sys/sockio.h>
 #include <sys/kernel.h>
+#include <sys/module.h>
=20
 #include <net/if.h>
 #include <net/if_types.h>
@@ -72,7 +73,6 @@
=20
 #define ISPPP_FMT	"isp%d: "
 #define	ISPPP_ARG(sc)	((sc)->sc_if.if_dunit)
-#define	PDEVSTATIC	static
 #define IFP2UNIT(ifp)	(ifp)->if_dunit
 	=09
 #  define CALLOUT_INIT(chan)		callout_handle_init(chan)
@@ -80,8 +80,7 @@
 #  define UNTIMEOUT(fun, arg, chan)	untimeout(fun, arg, chan)
 #  define IOCTL_CMD_T u_long
=20
-PDEVSTATIC void i4bispppattach(void *);
-PSEUDO_SET(i4bispppattach, i4b_isppp);
+static void i4bispppattach(void *);
=20
 #define I4BISPPPACCT		1	/* enable accounting messages */
 #define	I4BISPPPACCTINTVL	2	/* accounting msg interval in secs */
@@ -119,6 +118,10 @@
 	struct callout_handle sc_ch;
 } i4bisppp_softc[NI4BISPPP];
=20
+extern time_t (*i4bisppp_idletime_p)(int);
+
+static drvr_link_t *i4bisppp_ret_linktab(int unit);
+static void i4bisppp_set_linktab(int unit, isdn_link_t *ilt);
 static void	i4bisppp_init_linktab(int unit);
 static int	i4bisppp_ioctl(struct ifnet *ifp, IOCTL_CMD_T cmd, caddr_t data=
);
=20
@@ -154,10 +157,35 @@
  *			DEVICE DRIVER ROUTINES
  *=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D*/
=20
+static int i4bisppp_modevent(module_t mod, int type, void *data)
+{
+	switch(type) {
+	case MOD_LOAD:=20
+		i4bisppp_ret_linktab_p =3D i4bisppp_ret_linktab;
+		i4bisppp_set_linktab_p =3D i4bisppp_set_linktab;
+		i4bisppp_idletime_p =3D i4bisppp_idletime;
+		i4bispppattach(NULL);
+		break;
+	case MOD_UNLOAD:
+		printf("i4bisppp module unload - not possiable for this module type\b");
+		return (EINVAL);  =20
+	}
+=20
+	return (0);
+}
+
+static moduledata_t i4bisppp_mod =3D {
+	"i4bisppp",
+	i4bisppp_modevent,
+	NULL
+};
+
+DECLARE_MODULE(i4bisppp, i4bisppp_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
+
 /*------------------------------------------------------------------------=
---*
  *	interface attach routine at kernel boot time
  *------------------------------------------------------------------------=
---*/
-PDEVSTATIC void
+static void
 i4bispppattach(void *dummy)
 {
 	struct i4bisppp_softc *sc =3D i4bisppp_softc;
@@ -649,7 +677,7 @@
 /*------------------------------------------------------------------------=
---*
  *	return this drivers linktab address
  *------------------------------------------------------------------------=
---*/
-drvr_link_t *
+static drvr_link_t *
 i4bisppp_ret_linktab(int unit)
 {
 	return(&i4bisppp_drvr_linktab[unit]);
@@ -658,7 +686,7 @@
 /*------------------------------------------------------------------------=
---*
  *	setup the isdn_linktab for this driver
  *------------------------------------------------------------------------=
---*/
-void
+static void
 i4bisppp_set_linktab(int unit, isdn_link_t *ilt)
 {
 	isdn_linktab[unit] =3D ilt;
diff -ru freebsd/sys/i4b/driver/i4b_rbch.c cleanup/sys/i4b/driver/i4b_rbch.c
--- freebsd/sys/i4b/driver/i4b_rbch.c	Sat Jan  8 10:40:06 2005
+++ cleanup/sys/i4b/driver/i4b_rbch.c	Sat Jan  8 21:41:53 2005
@@ -39,8 +39,10 @@
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/conf.h>
+#include <sys/bus.h>
 #include <sys/uio.h>
 #include <sys/kernel.h>
+#include <sys/module.h>
 #include <sys/mbuf.h>
 #include <sys/socket.h>
 #include <sys/filio.h>
@@ -61,13 +63,10 @@
 #include <sys/ioccom.h>
 #include <sys/poll.h>
=20
-static drvr_link_t rbch_drvr_linktab[NI4BRBCH];
-static isdn_link_t *isdn_linktab[NI4BRBCH];
-
 #define I4BRBCHACCT		1 	/* enable accounting messages */
 #define	I4BRBCHACCTINTVL	2	/* accounting msg interval in secs */
=20
-static struct rbch_softc {
+struct rbch_softc {
 	int sc_unit;			/* unit number 		*/
=20
 	int sc_devstate;		/* state of driver	*/
@@ -95,13 +94,19 @@
 	int		sc_loutb;	/* last # of bytes tx'd 	*/
 	int		sc_fn;		/* flag, first null acct	*/
 #endif=09
-} rbch_softc[NI4BRBCH];
+
+	drvr_link_t rbch_drvr_linktab;
+	isdn_link_t *isdn_linktab;
+};
+static struct rbch_softc *rbch_softc;
=20
 static void rbch_rx_data_rdy(int unit);
 static void rbch_tx_queue_empty(int unit);
 static void rbch_connect(int unit, void *cdp);
 static void rbch_disconnect(int unit, void *cdp);
 static void rbch_init_linktab(int unit);
+static drvr_link_t * rbch_ret_linktab(int unit);
+static void rbch_set_linktab(int unit, isdn_link_t *ilt);
 static void rbch_clrq(int unit);
=20
 static 	d_open_t	i4brbchopen;
@@ -111,6 +116,7 @@
 static 	d_ioctl_t	i4brbchioctl;
 static 	d_poll_t	i4brbchpoll;
=20
+static	int		n_rbch =3D NI4BRBCH;
=20
 static struct cdevsw i4brbch_cdevsw =3D {
 	.d_version =3D	D_VERSION,
@@ -125,11 +131,33 @@
 };
=20
 static void i4brbchattach(void *);
-PSEUDO_SET(i4brbchattach, i4b_rbch);
=20
 /*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D*
  *			DEVICE DRIVER ROUTINES
  *=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D*/
+static int i4brbch_modevent(module_t mod, int type, void *data)
+{
+	switch(type) {
+	case MOD_LOAD:
+		rbch_ret_linktab_p =3D rbch_ret_linktab;
+		rbch_set_linktab_p =3D rbch_set_linktab;
+		i4brbchattach(NULL);
+		break;
+	case MOD_UNLOAD:
+		printf("i4brbch module unload - not possiable for this module type\b");
+		return (EINVAL);
+	}
+=20
+	return (0);
+}
+  =20
+static moduledata_t i4brbch_mod =3D {
+	"i4brbch",
+	i4brbch_modevent,
+	NULL
+};
+=20
+DECLARE_MODULE(i4brbch, i4brbch_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
=20
 /*------------------------------------------------------------------------=
---*
  *	interface attach routine
@@ -139,9 +167,12 @@
 {
 	int i;
=20
-	printf("i4brbch: %d raw B channel access device(s) attached\n", NI4BRBCH);
+	rbch_softc =3D malloc(sizeof(struct rbch_softc) * n_rbch, M_I4B,
+	    M_WAITOK);
+
+	printf("i4brbch: %d raw B channel access device(s) attached\n", n_rbch);
 =09
-	for(i=3D0; i < NI4BRBCH; i++)
+	for(i=3D0; i < n_rbch; i++)
 	{
 		make_dev(&i4brbch_cdevsw, i,
 			UID_ROOT, GID_WHEEL, 0600, "i4brbch%d", i);
@@ -171,7 +202,7 @@
 {
 	int unit =3D minor(dev);
 =09
-	if(unit >=3D NI4BRBCH)
+	if(unit >=3D n_rbch)
 		return(ENXIO);
=20
 	if(rbch_softc[unit].sc_devstate & ST_ISOPEN)
@@ -243,7 +274,7 @@
 		if(sc->sc_bprot =3D=3D BPROT_RHDLC)
 			iqp =3D &sc->sc_hdlcq;
 		else
-			iqp =3D isdn_linktab[unit]->rx_queue;=09
+			iqp =3D rbch_softc[unit].isdn_linktab->rx_queue;=09
=20
 		if(IF_QEMPTY(iqp) && (sc->sc_devstate & ST_ISOPEN)) {
 			CRIT_END;
@@ -269,7 +300,7 @@
 		if(sc->sc_bprot =3D=3D BPROT_RHDLC)
 			iqp =3D &sc->sc_hdlcq;
 		else
-			iqp =3D isdn_linktab[unit]->rx_queue;=09
+			iqp =3D rbch_softc[unit].isdn_linktab->rx_queue;=09
=20
 		while(IF_QEMPTY(iqp) && (sc->sc_devstate & ST_ISOPEN))
 		{
@@ -277,7 +308,7 @@
 	=09
 			NDBGL4(L4_RBCHDBG, "unit %d, wait read data", unit);
 	=09
-			if((error =3D tsleep( &isdn_linktab[unit]->rx_queue,
+			if((error =3D tsleep( &rbch_softc[unit].isdn_linktab->rx_queue,
 					   I4BPRI | PCATCH,
 					   "rrbch", 0 )) !=3D 0)
 			{
@@ -340,7 +371,7 @@
 			CRIT_END;
 			return(EWOULDBLOCK);
 		}
-		if(_IF_QFULL(isdn_linktab[unit]->tx_queue) && (sc->sc_devstate & ST_ISOP=
EN)) {
+		if(_IF_QFULL(rbch_softc[unit].isdn_linktab->tx_queue) && (sc->sc_devstat=
e & ST_ISOPEN)) {
 			CRIT_END;
 			return(EWOULDBLOCK);
 	}
@@ -373,13 +404,13 @@
 			tsleep( &rbch_softc[unit], I4BPRI | PCATCH, "xrbch", (hz*1));
 		}
=20
-		while(_IF_QFULL(isdn_linktab[unit]->tx_queue) && (sc->sc_devstate & ST_I=
SOPEN))
+		while(_IF_QFULL(rbch_softc[unit].isdn_linktab->tx_queue) && (sc->sc_devs=
tate & ST_ISOPEN))
 		{
 			sc->sc_devstate |=3D ST_WRWAITEMPTY;
=20
 			NDBGL4(L4_RBCHDBG, "unit %d, write queue full", unit);
 	=09
-			if ((error =3D tsleep( &isdn_linktab[unit]->tx_queue,
+			if ((error =3D tsleep( &rbch_softc[unit].isdn_linktab->tx_queue,
 					    I4BPRI | PCATCH,
 					    "wrbch", 0)) !=3D 0) {
 				sc->sc_devstate &=3D ~ST_WRWAITEMPTY;
@@ -419,9 +450,11 @@
 	=09
 		error =3D uiomove(m->m_data, m->m_len, uio);
=20
-		(void) IF_HANDOFF(isdn_linktab[unit]->tx_queue, m, NULL);
+		(void) IF_HANDOFF(rbch_softc[unit].isdn_linktab->tx_queue, m, NULL);
=20
-		(*isdn_linktab[unit]->bch_tx_start)(isdn_linktab[unit]->unit, isdn_linkt=
ab[unit]->channel);
+		(*rbch_softc[unit].isdn_linktab->bch_tx_start)(
+		    rbch_softc[unit].isdn_linktab->unit,
+		    rbch_softc[unit].isdn_linktab->channel);
 	}
=20
 	CRIT_END;
@@ -554,7 +587,7 @@
 	=20
 	if((events & (POLLOUT|POLLWRNORM)) &&
 	   (sc->sc_devstate & ST_CONNECTED) &&
-	   !_IF_QFULL(isdn_linktab[unit]->tx_queue))
+	   !_IF_QFULL(rbch_softc[unit].isdn_linktab->tx_queue))
 	{
 		revents |=3D (events & (POLLOUT|POLLWRNORM));
 	}
@@ -569,7 +602,7 @@
 		if(sc->sc_bprot =3D=3D BPROT_RHDLC)
 			iqp =3D &sc->sc_hdlcq;
 		else
-			iqp =3D isdn_linktab[unit]->rx_queue;=09
+			iqp =3D rbch_softc[unit].isdn_linktab->rx_queue;=09
=20
 		if(!IF_QEMPTY(iqp))
 			revents |=3D (events & (POLLIN|POLLRDNORM));
@@ -594,8 +627,9 @@
=20
 	/* get # of bytes in and out from the HSCX driver */=20
 =09
-	(*isdn_linktab[unit]->bch_stat)
-		(isdn_linktab[unit]->unit, isdn_linktab[unit]->channel, &bs);
+	(*rbch_softc[unit].isdn_linktab->bch_stat)(
+	    rbch_softc[unit].isdn_linktab->unit,
+	    rbch_softc[unit].isdn_linktab->channel, &bs);
=20
 	sc->sc_ioutb +=3D bs.outbytes;
 	sc->sc_iinb +=3D bs.inbytes;
@@ -718,7 +752,7 @@
 	{
 		register struct mbuf *m;
 	=09
-		if((m =3D *isdn_linktab[unit]->rx_mbuf) =3D=3D NULL)
+		if((m =3D *rbch_softc[unit].isdn_linktab->rx_mbuf) =3D=3D NULL)
 			return;
=20
 		m->m_pkthdr.len =3D m->m_len;
@@ -733,7 +767,7 @@
 	{
 		NDBGL4(L4_RBCHDBG, "unit %d, wakeup", unit);
 		rbch_softc[unit].sc_devstate &=3D ~ST_RDWAITDATA;
-		wakeup( &isdn_linktab[unit]->rx_queue);
+		wakeup( &rbch_softc[unit].isdn_linktab->rx_queue);
 	}
 	else
 	{
@@ -754,7 +788,7 @@
 	{
 		NDBGL4(L4_RBCHDBG, "unit %d, wakeup", unit);
 		rbch_softc[unit].sc_devstate &=3D ~ST_WRWAITEMPTY;
-		wakeup( &isdn_linktab[unit]->tx_queue);
+		wakeup(&rbch_softc[unit].isdn_linktab->tx_queue);
 	}
 	else
 	{
@@ -791,20 +825,20 @@
 /*------------------------------------------------------------------------=
---*
  *	return this drivers linktab address
  *------------------------------------------------------------------------=
---*/
-drvr_link_t *
+static drvr_link_t *
 rbch_ret_linktab(int unit)
 {
 	rbch_init_linktab(unit);
-	return(&rbch_drvr_linktab[unit]);
+	return(&rbch_softc[unit].rbch_drvr_linktab);
 }
=20
 /*------------------------------------------------------------------------=
---*
  *	setup the isdn_linktab for this driver
  *------------------------------------------------------------------------=
---*/
-void
+static void
 rbch_set_linktab(int unit, isdn_link_t *ilt)
 {
-	isdn_linktab[unit] =3D ilt;
+	rbch_softc[unit].isdn_linktab =3D ilt;
 }
=20
 /*------------------------------------------------------------------------=
---*
@@ -813,14 +847,14 @@
 static void
 rbch_init_linktab(int unit)
 {
-	rbch_drvr_linktab[unit].unit =3D unit;
-	rbch_drvr_linktab[unit].bch_rx_data_ready =3D rbch_rx_data_rdy;
-	rbch_drvr_linktab[unit].bch_tx_queue_empty =3D rbch_tx_queue_empty;
-	rbch_drvr_linktab[unit].bch_activity =3D rbch_activity;=09
-	rbch_drvr_linktab[unit].line_connected =3D rbch_connect;
-	rbch_drvr_linktab[unit].line_disconnected =3D rbch_disconnect;
-	rbch_drvr_linktab[unit].dial_response =3D rbch_dialresponse;
-	rbch_drvr_linktab[unit].updown_ind =3D rbch_updown;=09
+	rbch_softc[unit].rbch_drvr_linktab.unit =3D unit;
+	rbch_softc[unit].rbch_drvr_linktab.bch_rx_data_ready =3D rbch_rx_data_rdy;
+	rbch_softc[unit].rbch_drvr_linktab.bch_tx_queue_empty =3D rbch_tx_queue_e=
mpty;
+	rbch_softc[unit].rbch_drvr_linktab.bch_activity =3D rbch_activity;=09
+	rbch_softc[unit].rbch_drvr_linktab.line_connected =3D rbch_connect;
+	rbch_softc[unit].rbch_drvr_linktab.line_disconnected =3D rbch_disconnect;
+	rbch_softc[unit].rbch_drvr_linktab.dial_response =3D rbch_dialresponse;
+	rbch_softc[unit].rbch_drvr_linktab.updown_ind =3D rbch_updown;=09
 }
=20
 /*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D*/
diff -ru freebsd/sys/i4b/driver/i4b_tel.c cleanup/sys/i4b/driver/i4b_tel.c
--- freebsd/sys/i4b/driver/i4b_tel.c	Sat Jan  8 10:40:07 2005
+++ cleanup/sys/i4b/driver/i4b_tel.c	Sat Jan  8 21:41:53 2005
@@ -43,8 +43,10 @@
 #include <sys/ioccom.h>
 #include <sys/poll.h>
 #include <sys/conf.h>
+#include <sys/bus.h>
 #include <sys/uio.h>
 #include <sys/kernel.h>
+#include <sys/module.h>
 #include <sys/mbuf.h>
 #include <sys/socket.h>
 #include <net/if.h>
@@ -109,13 +111,16 @@
=20
 } tel_sc_t;
=20
-static tel_sc_t tel_sc[NI4BTEL][NOFUNCS];
+static int	n_tel =3D NI4BTEL;
+static tel_sc_t	*tel_sc;
 =09
 /* forward decl */
=20
 static void tel_rx_data_rdy(int unit);
 static void tel_tx_queue_empty(int unit);
 static void tel_init_linktab(int unit);
+static drvr_link_t *tel_ret_linktab(int unit);
+static void tel_set_linktab(int unit, isdn_link_t *ilt);
 static void tel_connect(int unit, void *cdp);
 static void tel_disconnect(int unit, void *cdp);
 static void tel_tone(tel_sc_t *sc);
@@ -148,12 +153,34 @@
=20
 static void i4btelattach(void *);
=20
-PSEUDO_SET(i4btelattach, i4b_tel);
-
 /*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D*
  *			DEVICE DRIVER ROUTINES
  *=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D*/
=20
+static int i4btel_modevent(module_t mod, int type, void *data)
+{
+	switch(type) {
+	case MOD_LOAD:
+		tel_ret_linktab_p =3D tel_ret_linktab;
+		tel_set_linktab_p =3D tel_set_linktab;
+		i4btelattach(NULL);
+		break;
+	case MOD_UNLOAD:
+		printf("i4btel module unload - not possiable for this module type\b");
+		return (EINVAL);
+	}
+=20
+	return (0);
+}
+  =20
+static moduledata_t i4btel_mod =3D {
+	"i4btel",
+	i4btel_modevent,
+	NULL
+};
+=20
+DECLARE_MODULE(i4btel, i4btel_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
+
 /*------------------------------------------------------------------------=
---*
  *	interface attach routine
  *------------------------------------------------------------------------=
---*/
@@ -162,17 +189,19 @@
 {
 	int i, j;
=20
-	printf("i4btel: %d ISDN telephony interface device(s) attached\n", NI4BTE=
L);
+	printf("i4btel: %d ISDN telephony interface device(s) attached\n", n_tel);
+
+	tel_sc =3D malloc(sizeof(tel_sc_t)*n_tel*NOFUNCS, M_I4B, M_WAITOK);
 =09
-	for(i=3D0; i < NI4BTEL; i++)
+	for(i=3D0; i < n_tel; i++)
 	{
 		for(j=3D0; j < NOFUNCS; j++)
 		{
-			tel_sc[i][j].devstate =3D ST_IDLE;
-			tel_sc[i][j].audiofmt =3D CVT_NONE;
-			tel_sc[i][j].rcvttab =3D 0;
-			tel_sc[i][j].wcvttab =3D 0;
-			tel_sc[i][j].result =3D 0;
+			tel_sc[i + n_tel * j].devstate =3D ST_IDLE;
+			tel_sc[i + n_tel * j].audiofmt =3D CVT_NONE;
+			tel_sc[i + n_tel * j].rcvttab =3D 0;
+			tel_sc[i + n_tel * j].wcvttab =3D 0;
+			tel_sc[i + n_tel * j].result =3D 0;
=20
 			switch(j)
 			{
@@ -204,10 +233,10 @@
 =09
 	tel_sc_t *sc;
 =09
-	if(unit >=3D NI4BTEL)
+	if(unit >=3D n_tel)
 		return(ENXIO);
=20
-	sc =3D &tel_sc[unit][func];	=09
+	sc =3D &tel_sc[unit + n_tel*func];	=09
=20
 	if(sc->devstate & ST_ISOPEN)
 		return(EBUSY);
@@ -234,10 +263,10 @@
 	int error =3D 0;
 	int x;
 =09
-	if(unit > NI4BTEL)
+	if(unit > n_tel)
 		return(ENXIO);
=20
-	sc =3D &tel_sc[unit][func];	=09
+	sc =3D &tel_sc[unit + n_tel * func];	=09
=20
 	x =3D splimp();
 	sc->devstate &=3D ~ST_TONE;	=09
@@ -277,7 +306,7 @@
         struct mbuf *m;
         int s;
=20
-	tel_sc_t *sc =3D &tel_sc[unit][func];
+	tel_sc_t *sc =3D &tel_sc[unit + n_tel * func];
=20
 	if(func =3D=3D FUNCTEL)
 	{
@@ -400,7 +429,7 @@
 	int s;
 	int error =3D 0;
=20
-	tel_sc_t *sc =3D &tel_sc[unit][func];
+	tel_sc_t *sc =3D &tel_sc[unit + n_tel * func];
 =09
 	if(!(sc->devstate & ST_ISOPEN))
 		return(EIO);
@@ -531,7 +560,7 @@
 	struct mbuf *m;
 	int s;
 	int error =3D 0;
-	tel_sc_t *sc =3D &tel_sc[unit][func];
+	tel_sc_t *sc =3D &tel_sc[unit + n_tel * func];
 =09
 	if(!(sc->devstate & ST_ISOPEN))
 	{
@@ -691,7 +720,7 @@
 	int unit =3D UNIT(dev);
 	int func =3D FUNC(dev);=09
=20
-	tel_sc_t *sc =3D &tel_sc[unit][func];
+	tel_sc_t *sc =3D &tel_sc[unit + n_tel * func];
 =09
 	s =3D splhigh();
=20
@@ -770,7 +799,7 @@
 static void
 tel_connect(int unit, void *cdp)
 {
-	tel_sc_t *sc =3D &tel_sc[unit][FUNCTEL];
+	tel_sc_t *sc =3D &tel_sc[unit + n_tel * FUNCTEL];
=20
 	/* audio device */
 =09
@@ -780,7 +809,7 @@
=20
 	/* dialer device */
 =09
-	sc =3D &tel_sc[unit][FUNCDIAL];
+	sc =3D &tel_sc[unit + n_tel * FUNCDIAL];
=20
 	if(sc->devstate & ST_ISOPEN)
 	{
@@ -804,7 +833,7 @@
 {
 /*	call_desc_t *cd =3D (call_desc_t *)cdp; */
=20
-	tel_sc_t *sc =3D &tel_sc[unit][FUNCTEL];
+	tel_sc_t *sc =3D &tel_sc[unit + n_tel * FUNCTEL];
 =09
 	/* audio device */
 =09
@@ -824,7 +853,7 @@
=20
 	/* dialer device */
 =09
-	sc =3D &tel_sc[unit][FUNCDIAL];
+	sc =3D &tel_sc[unit + n_tel * FUNCDIAL];
=20
 	if(sc->devstate & ST_ISOPEN)
 	{
@@ -851,7 +880,7 @@
 static void
 tel_dialresponse(int unit, int status, cause_t cause)
 {=09
-	tel_sc_t *sc =3D &tel_sc[unit][FUNCDIAL];
+	tel_sc_t *sc =3D &tel_sc[unit + n_tel * FUNCDIAL];
=20
 	NDBGL4(L4_TELDBG, "i4btel%d,  status=3D%d, cause=3D0x%4x", unit, status, =
cause);
=20
@@ -885,7 +914,7 @@
 static void
 tel_rx_data_rdy(int unit)
 {
-	tel_sc_t *sc =3D &tel_sc[unit][FUNCTEL];
+	tel_sc_t *sc =3D &tel_sc[unit + n_tel * FUNCTEL];
 =09
 	if(sc->devstate & ST_RDWAITDATA)
 	{
@@ -903,7 +932,7 @@
 static void
 tel_tx_queue_empty(int unit)
 {
-	tel_sc_t *sc =3D &tel_sc[unit][FUNCTEL];
+	tel_sc_t *sc =3D &tel_sc[unit + n_tel * FUNCTEL];
=20
 	if(sc->devstate & ST_WRWAITEMPTY)
 	{
@@ -924,17 +953,17 @@
 static void
 tel_activity(int unit, int rxtx)
 {
-	if(tel_sc[unit][FUNCTEL].cdp)
-		tel_sc[unit][FUNCTEL].cdp->last_active_time =3D SECOND;
+	if(tel_sc[unit + n_tel * FUNCTEL].cdp)
+		tel_sc[unit + n_tel * FUNCTEL].cdp->last_active_time =3D SECOND;
 }
=20
 /*------------------------------------------------------------------------=
---*
  *	return this drivers linktab address
  *------------------------------------------------------------------------=
---*/
-drvr_link_t *
+static drvr_link_t *
 tel_ret_linktab(int unit)
 {
-	tel_sc_t *sc =3D &tel_sc[unit][FUNCTEL];
+	tel_sc_t *sc =3D &tel_sc[unit + n_tel * FUNCTEL];
 =09
 	tel_init_linktab(unit);
 	return(&sc->drvr_linktab);
@@ -943,10 +972,10 @@
 /*------------------------------------------------------------------------=
---*
  *	setup the isdn_linktab for this driver
  *------------------------------------------------------------------------=
---*/
-void
+static void
 tel_set_linktab(int unit, isdn_link_t *ilt)
 {
-	tel_sc_t *sc =3D &tel_sc[unit][FUNCTEL];
+	tel_sc_t *sc =3D &tel_sc[unit + n_tel * FUNCTEL];
 	sc->isdn_linktab =3D ilt;
 }
=20
@@ -956,7 +985,7 @@
 static void
 tel_init_linktab(int unit)
 {
-	tel_sc_t *sc =3D &tel_sc[unit][FUNCTEL];
+	tel_sc_t *sc =3D &tel_sc[unit + n_tel * FUNCTEL];
 =09
 	sc->drvr_linktab.unit =3D unit;
 	sc->drvr_linktab.bch_rx_data_ready =3D tel_rx_data_rdy;
diff -ru freebsd/sys/i4b/driver/i4b_trace.c cleanup/sys/i4b/driver/i4b_trac=
e.c
--- freebsd/sys/i4b/driver/i4b_trace.c	Sat Jan  8 10:40:07 2005
+++ cleanup/sys/i4b/driver/i4b_trace.c	Sat Jan  8 21:41:53 2005
@@ -42,8 +42,10 @@
 #include <sys/systm.h>
 #include <sys/ioccom.h>
 #include <sys/conf.h>
+#include <sys/bus.h>
 #include <sys/uio.h>
 #include <sys/kernel.h>
+#include <sys/module.h>
 #include <sys/mbuf.h>
 #include <sys/socket.h>
 #include <net/if.h>
@@ -56,18 +58,23 @@
 #include <i4b/include/i4b_global.h>
 #include <i4b/include/i4b_l3l4.h>
=20
-static struct ifqueue trace_queue[NI4BTRC];
-
-static int device_state[NI4BTRC];
+struct trc_softc {
+	struct ifqueue trace_queue;
+	int device_state;
 #define ST_IDLE		0x00
 #define ST_ISOPEN	0x01
 #define ST_WAITDATA	0x02
+};
+
+static struct trc_softc *trc_softc;
=20
 static int analyzemode =3D 0;
 static int rxunit =3D -1;
 static int txunit =3D -1;
 static int outunit =3D -1;
=20
+static int n_trc =3D NI4BTRC;
+
 static d_open_t	i4btrcopen;
 static d_close_t i4btrcclose;
 static d_read_t i4btrcread;
@@ -87,10 +94,31 @@
 };
=20
 static void i4btrcattach(void *);
-PSEUDO_SET(i4btrcattach, i4b_trace);
=20
 int get_trace_data_from_l1(i4b_trace_hdr_t *hdr, int len, char *buf);
=20
+static int i4btrc_modevent(module_t mod, int type, void *data)
+{
+	switch(type) {
+	case MOD_LOAD:
+		i4btrcattach(NULL);
+		break;
+	case MOD_UNLOAD:
+		printf("i4btrc module unload - not possiable for this module type\b");
+		return (EINVAL);
+	}
+=20
+	return (0);
+}
+  =20
+static moduledata_t i4btrc_mod =3D {
+	"i4btrc",
+	i4btrc_modevent,
+	NULL
+};
+=20
+DECLARE_MODULE(i4btrc, i4btrc_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
+
 /*------------------------------------------------------------------------=
---*
  *	interface attach routine
  *------------------------------------------------------------------------=
---*/
@@ -99,18 +127,21 @@
 {
 	int i;
=20
-	printf("i4btrc: %d ISDN trace device(s) attached\n", NI4BTRC);
+	printf("i4btrc: %d ISDN trace device(s) attached\n", n_trc);
+
+	trc_softc =3D malloc(sizeof(struct trc_softc) * n_trc, M_I4B, M_WAITOK);
 =09
-	for(i=3D0; i < NI4BTRC; i++)
+	for(i=3D0; i < n_trc; i++)
 	{
 		make_dev(&i4btrc_cdevsw, i,
 				     UID_ROOT, GID_WHEEL, 0600, "i4btrc%d", i);
-		trace_queue[i].ifq_maxlen =3D IFQ_MAXLEN;
+		trc_softc[i].trace_queue.ifq_maxlen =3D IFQ_MAXLEN;
=20
-		if(!mtx_initialized(&trace_queue[i].ifq_mtx))
-			mtx_init(&trace_queue[i].ifq_mtx, "i4b_trace", NULL, MTX_DEF);
+		if(!mtx_initialized(&trc_softc[i].trace_queue.ifq_mtx))
+			mtx_init(&trc_softc[i].trace_queue.ifq_mtx,
+			    "i4b_trace", NULL, MTX_DEF);
=20
-		device_state[i] =3D ST_IDLE;
+		trc_softc[i].device_state =3D ST_IDLE;
 	}
 }
=20
@@ -157,9 +188,9 @@
 =09
 	/* check valid unit no */
 =09
-	if((unit =3D hdr->unit) >=3D NI4BTRC)
+	if((unit =3D hdr->unit) >=3D n_trc)
 	{
-		printf("i4b_trace: get_trace_data_from_l1 - unit > NI4BTRC!\n");=20
+		printf("i4b_trace: get_trace_data_from_l1 - unit > n_trc!\n");=20
 		return(0);
 	}
=20
@@ -182,14 +213,14 @@
 		unit =3D outunit;		=09
 	}
=20
-	IF_LOCK(&trace_queue[unit]);
+	IF_LOCK(&trc_softc[unit].trace_queue);
=20
-	if(_IF_QFULL(&trace_queue[unit]))
+	if(_IF_QFULL(&trc_softc[unit].trace_queue))
 	{
 		struct mbuf *m1;
=20
 		x =3D SPLI4B();
-		_IF_DEQUEUE(&trace_queue[unit], m1);
+		_IF_DEQUEUE(&trc_softc[unit].trace_queue, m1);
 		splx(x);	=09
=20
 		i4b_Bfreembuf(m1);
@@ -206,13 +237,13 @@
=20
 	x =3D SPLI4B();
 =09
-	_IF_ENQUEUE(&trace_queue[unit], m);
-	IF_UNLOCK(&trace_queue[unit]);
+	_IF_ENQUEUE(&trc_softc[unit].trace_queue, m);
+	IF_UNLOCK(&trc_softc[unit].trace_queue);
 =09
-	if(device_state[unit] & ST_WAITDATA)
+	if(trc_softc[unit].device_state & ST_WAITDATA)
 	{
-		device_state[unit] &=3D ~ST_WAITDATA;
-		wakeup( &trace_queue[unit]);
+		trc_softc[unit].device_state &=3D ~ST_WAITDATA;
+		wakeup( &trc_softc[unit].trace_queue);
 	}
=20
 	splx(x);
@@ -229,10 +260,10 @@
 	int x;
 	int unit =3D minor(dev);
=20
-	if(unit >=3D NI4BTRC)
+	if(unit >=3D n_trc)
 		return(ENXIO);
=20
-	if(device_state[unit] & ST_ISOPEN)
+	if(trc_softc[unit].device_state & ST_ISOPEN)
 		return(EBUSY);
=20
 	if(analyzemode && (unit =3D=3D outunit || unit =3D=3D rxunit || unit =3D=
=3D txunit))
@@ -240,7 +271,7 @@
=20
 	x =3D SPLI4B();
 =09
-	device_state[unit] =3D ST_ISOPEN;	=09
+	trc_softc[unit].device_state =3D ST_ISOPEN;	=09
=20
 	splx(x);
 =09
@@ -287,7 +318,7 @@
 	}
=20
 	x =3D SPLI4B();
-	device_state[unit] =3D ST_IDLE;
+	trc_softc[unit].device_state =3D ST_IDLE;
 	splx(x);
 =09
 	return(0);
@@ -304,31 +335,32 @@
 	int error =3D 0;
 	int unit =3D minor(dev);
 =09
-	if(!(device_state[unit] & ST_ISOPEN))
+	if(!(trc_softc[unit].device_state & ST_ISOPEN))
 		return(EIO);
=20
 	x =3D SPLI4B();
 =09
-	IF_LOCK(&trace_queue[unit]);
+	IF_LOCK(&trc_softc[unit].trace_queue);
=20
-	while(IF_QEMPTY(&trace_queue[unit]) && (device_state[unit] & ST_ISOPEN))
+	while(IF_QEMPTY(&trc_softc[unit].trace_queue) &&
+	   (trc_softc[unit].device_state & ST_ISOPEN))
 	{
-		device_state[unit] |=3D ST_WAITDATA;
+		trc_softc[unit].device_state |=3D ST_WAITDATA;
 	=09
-		if((error =3D msleep( &trace_queue[unit],
-					&trace_queue[unit].ifq_mtx,
+		if((error =3D msleep( &trc_softc[unit].trace_queue,
+					&trc_softc[unit].trace_queue.ifq_mtx,
 					I4BPRI | PCATCH,
 					"bitrc", 0 )) !=3D 0)
 		{
-			device_state[unit] &=3D ~ST_WAITDATA;
-			IF_UNLOCK(&trace_queue[unit]);
+			trc_softc[unit].device_state &=3D ~ST_WAITDATA;
+			IF_UNLOCK(&trc_softc[unit].trace_queue);
 			splx(x);
 			return(error);
 		}
 	}
=20
-	_IF_DEQUEUE(&trace_queue[unit], m);
-	IF_UNLOCK(&trace_queue[unit]);
+	_IF_DEQUEUE(&trc_softc[unit].trace_queue, m);
+	IF_UNLOCK(&trc_softc[unit].trace_queue);
=20
 	if(m && m->m_len)
 		error =3D uiomove(m->m_data, m->m_len, uio);
@@ -387,12 +419,12 @@
 		case I4B_TRC_SETA:
 			tsa =3D (i4b_trace_setupa_t *)data;
=20
-			if(tsa->rxunit >=3D 0 && tsa->rxunit < NI4BTRC)
+			if(tsa->rxunit >=3D 0 && tsa->rxunit < n_trc)
 				rxunit =3D tsa->rxunit;
 			else
 				error =3D EINVAL;
=20
-			if(tsa->txunit >=3D 0 && tsa->txunit < NI4BTRC)
+			if(tsa->txunit >=3D 0 && tsa->txunit < n_trc)
 				txunit =3D tsa->txunit;
 			else
 				error =3D EINVAL;
diff -ru freebsd/sys/i4b/include/i4b_global.h cleanup/sys/i4b/include/i4b_g=
lobal.h
--- freebsd/sys/i4b/include/i4b_global.h	Sat Jan  8 10:40:07 2005
+++ cleanup/sys/i4b/include/i4b_global.h	Sat Jan  8 21:41:53 2005
@@ -37,40 +37,6 @@
 #ifndef _I4B_GLOBAL_H_
 #define _I4B_GLOBAL_H_
=20
-/*------------------------------------------------------------------------=
---*
- *	hiding OS differences in the kernel
- *------------------------------------------------------------------------=
---*/=20
-
-#if defined(__FreeBSD__) && __FreeBSD__ >=3D 5
-/*
- * Deprecated LKM interface.
- */
-#include <sys/module.h>
-#define	PSEUDO_SET(sym, name) \
-	static int name ## _modevent(module_t mod, int type, void *data) \
-	{ \
-		void (*initfunc)(void *) =3D (void (*)(void *))data; \
-		switch (type) { \
-		case MOD_LOAD: \
-			/* printf(#name " module load\n"); */ \
-			initfunc(NULL); \
-			break; \
-		case MOD_UNLOAD: \
-			printf(#name " module unload - not possible for this module type\n"); \
-			return EINVAL; \
-		default: \
-			return EOPNOTSUPP; \
-		} \
-		return 0; \
-	} \
-	static moduledata_t name ## _mod =3D { \
-		#name, \
-		name ## _modevent, \
-		(void *)sym \
-	}; \
-	DECLARE_MODULE(name, name ## _mod, SI_SUB_PSEUDO, SI_ORDER_ANY)
-#endif
-
 /*---------------*/
 /* time handling */
 /*---------------*/
@@ -126,5 +92,7 @@
 #define CMR_SETTRACE	2	/* set D-channel and B-channel trace	*/
 #define CMR_GCST	3	/* get chipset statistics		*/
 #define CMR_CCST	4	/* clear chipset statistics		*/
+
+MALLOC_DECLARE(M_I4B);
=20
 #endif /* _I4B_GLOBAL_H_ */
diff -ru freebsd/sys/i4b/include/i4b_l3l4.h cleanup/sys/i4b/include/i4b_l3l=
4.h
--- freebsd/sys/i4b/include/i4b_l3l4.h	Sat Jan  8 10:40:08 2005
+++ cleanup/sys/i4b/include/i4b_l3l4.h	Sat Jan  8 21:41:54 2005
@@ -96,28 +96,28 @@
=20
 /* global linktab functions for RBCH userland driver */
=20
-drvr_link_t *rbch_ret_linktab(int unit);
-void rbch_set_linktab(int unit, isdn_link_t *ilt);
+extern drvr_link_t *(*rbch_ret_linktab_p)(int);
+extern void (*rbch_set_linktab_p)(int, isdn_link_t *);
=20
 /* global linktab functions for IPR network driver */
=20
-drvr_link_t *ipr_ret_linktab(int unit);
-void ipr_set_linktab(int unit, isdn_link_t *ilt);
+extern drvr_link_t *(*ipr_ret_linktab_p)(int);
+extern void (*ipr_set_linktab_p)(int, isdn_link_t *);
=20
 /* global linktab functions for TEL userland driver */
=20
-drvr_link_t *tel_ret_linktab(int unit);
-void tel_set_linktab(int unit, isdn_link_t *ilt);
+extern drvr_link_t *(*tel_ret_linktab_p)(int);
+extern void (*tel_set_linktab_p)(int, isdn_link_t *);
=20
 /* global linktab functions for ISPPP userland driver */
=20
-drvr_link_t *i4bisppp_ret_linktab(int unit);
-void i4bisppp_set_linktab(int unit, isdn_link_t *ilt);
+extern drvr_link_t *(*i4bisppp_ret_linktab_p)(int);
+extern void (*i4bisppp_set_linktab_p)(int, isdn_link_t *);
=20
 /* global linktab functions for ING network driver */
=20
-drvr_link_t *ing_ret_linktab(int unit);
-void ing_set_linktab(int unit, isdn_link_t *ilt);
+extern drvr_link_t *(*ing_ret_linktab_p)(int);
+extern void (*ing_set_linktab_p)(int, isdn_link_t *);
=20
=20
 /*------------------------------------------------------------------------=
---*
diff -ru freebsd/sys/i4b/layer1/i4b_l1dmux.c cleanup/sys/i4b/layer1/i4b_l1d=
mux.c
--- freebsd/sys/i4b/layer1/i4b_l1dmux.c	Sat Jan  8 10:40:09 2005
+++ cleanup/sys/i4b/layer1/i4b_l1dmux.c	Sat Jan  8 21:41:54 2005
@@ -36,6 +36,7 @@
=20
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/malloc.h>
=20
 #include <machine/i4b_debug.h>
 #include <machine/i4b_ioctl.h>
diff -ru freebsd/sys/i4b/layer1/ifpi/i4b_ifpi_pci.c cleanup/sys/i4b/layer1/=
ifpi/i4b_ifpi_pci.c
--- freebsd/sys/i4b/layer1/ifpi/i4b_ifpi_pci.c	Sat Jan  8 10:40:12 2005
+++ cleanup/sys/i4b/layer1/ifpi/i4b_ifpi_pci.c	Sat Jan  8 21:41:55 2005
@@ -41,10 +41,9 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/sys/i4b/layer1/ifpi/i4b_ifpi_pci.c,v 1.17 2005/01/=
06 22:18:19 imp Exp $");
=20
-#include "opt_i4b.h"
-
 #include <sys/param.h>
 #include <sys/kernel.h>
+#include <sys/module.h>
 #include <sys/systm.h>
 #include <sys/mbuf.h>
=20
diff -ru freebsd/sys/i4b/layer1/ifpi2/i4b_ifpi2_pci.c cleanup/sys/i4b/layer=
1/ifpi2/i4b_ifpi2_pci.c
--- freebsd/sys/i4b/layer1/ifpi2/i4b_ifpi2_pci.c	Sat Jan  8 10:40:13 2005
+++ cleanup/sys/i4b/layer1/ifpi2/i4b_ifpi2_pci.c	Sat Jan  8 21:41:57 2005
@@ -40,10 +40,9 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/sys/i4b/layer1/ifpi2/i4b_ifpi2_pci.c,v 1.17 2005/0=
1/06 22:18:19 imp Exp $");
=20
-#include "opt_i4b.h"
-
 #include <sys/param.h>
 #include <sys/kernel.h>
+#include <sys/module.h>
 #include <sys/systm.h>
 #include <sys/mbuf.h>
=20
diff -ru freebsd/sys/i4b/layer1/ifpnp/i4b_ifpnp_avm.c cleanup/sys/i4b/layer=
1/ifpnp/i4b_ifpnp_avm.c
--- freebsd/sys/i4b/layer1/ifpnp/i4b_ifpnp_avm.c	Sat Jan  8 10:40:14 2005
+++ cleanup/sys/i4b/layer1/ifpnp/i4b_ifpnp_avm.c	Sat Jan  8 21:41:57 2005
@@ -40,10 +40,9 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/sys/i4b/layer1/ifpnp/i4b_ifpnp_avm.c,v 1.12 2005/0=
1/06 22:18:19 imp Exp $");
=20
-#include "opt_i4b.h"
-
 #include <sys/param.h>
 #include <sys/kernel.h>
+#include <sys/module.h>
 #include <sys/systm.h>
 #include <sys/mbuf.h>
=20
diff -ru freebsd/sys/i4b/layer1/ihfc/i4b_ihfc_pnp.c cleanup/sys/i4b/layer1/=
ihfc/i4b_ihfc_pnp.c
--- freebsd/sys/i4b/layer1/ihfc/i4b_ihfc_pnp.c	Sat Jan  8 10:40:16 2005
+++ cleanup/sys/i4b/layer1/ihfc/i4b_ihfc_pnp.c	Sat Jan  8 21:41:59 2005
@@ -41,6 +41,7 @@
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
+#include <sys/module.h>
 #include <sys/socket.h>
 #include <net/if.h>
=20
diff -ru freebsd/sys/i4b/layer1/itjc/i4b_itjc_isac.c cleanup/sys/i4b/layer1=
/itjc/i4b_itjc_isac.c
--- freebsd/sys/i4b/layer1/itjc/i4b_itjc_isac.c	Sat Jan  8 10:40:25 2005
+++ cleanup/sys/i4b/layer1/itjc/i4b_itjc_isac.c	Sat Jan  8 21:42:03 2005
@@ -34,8 +34,6 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/sys/i4b/layer1/itjc/i4b_itjc_isac.c,v 1.5 2005/01/=
06 22:18:20 imp Exp $");
=20
-#include "opt_i4b.h"
-
 #include <sys/param.h>
 #include <sys/kernel.h>
 #include <sys/systm.h>
diff -ru freebsd/sys/i4b/layer1/itjc/i4b_itjc_pci.c cleanup/sys/i4b/layer1/=
itjc/i4b_itjc_pci.c
--- freebsd/sys/i4b/layer1/itjc/i4b_itjc_pci.c	Sat Jan  8 10:40:31 2005
+++ cleanup/sys/i4b/layer1/itjc/i4b_itjc_pci.c	Sat Jan  8 21:42:04 2005
@@ -40,10 +40,9 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/sys/i4b/layer1/itjc/i4b_itjc_pci.c,v 1.14 2005/01/=
06 22:18:20 imp Exp $");
=20
-#include "opt_i4b.h"
-
 #include <sys/param.h>
 #include <sys/kernel.h>
+#include <sys/module.h>
 #include <sys/systm.h>
 #include <sys/mbuf.h>
=20
diff -ru freebsd/sys/i4b/layer1/iwic/i4b_iwic_bchan.c cleanup/sys/i4b/layer=
1/iwic/i4b_iwic_bchan.c
--- freebsd/sys/i4b/layer1/iwic/i4b_iwic_bchan.c	Sat Jan  8 10:40:31 2005
+++ cleanup/sys/i4b/layer1/iwic/i4b_iwic_bchan.c	Sat Jan  8 21:42:04 2005
@@ -35,8 +35,6 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/sys/i4b/layer1/iwic/i4b_iwic_bchan.c,v 1.14 2005/0=
1/06 22:18:21 imp Exp $");
=20
-#include "opt_i4b.h"
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/mbuf.h>
diff -ru freebsd/sys/i4b/layer1/iwic/i4b_iwic_dchan.c cleanup/sys/i4b/layer=
1/iwic/i4b_iwic_dchan.c
--- freebsd/sys/i4b/layer1/iwic/i4b_iwic_dchan.c	Sat Jan  8 10:40:31 2005
+++ cleanup/sys/i4b/layer1/iwic/i4b_iwic_dchan.c	Sat Jan  8 21:42:05 2005
@@ -34,8 +34,6 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/sys/i4b/layer1/iwic/i4b_iwic_dchan.c,v 1.8 2005/01=
/06 22:18:21 imp Exp $");
=20
-#include "opt_i4b.h"
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/mbuf.h>
diff -ru freebsd/sys/i4b/layer1/iwic/i4b_iwic_fsm.c cleanup/sys/i4b/layer1/=
iwic/i4b_iwic_fsm.c
--- freebsd/sys/i4b/layer1/iwic/i4b_iwic_fsm.c	Sat Jan  8 10:40:32 2005
+++ cleanup/sys/i4b/layer1/iwic/i4b_iwic_fsm.c	Sat Jan  8 21:42:05 2005
@@ -34,8 +34,6 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/sys/i4b/layer1/iwic/i4b_iwic_fsm.c,v 1.8 2005/01/0=
6 22:18:21 imp Exp $");
=20
-#include "opt_i4b.h"
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/socket.h>
diff -ru freebsd/sys/i4b/layer1/iwic/i4b_iwic_l1if.c cleanup/sys/i4b/layer1=
/iwic/i4b_iwic_l1if.c
--- freebsd/sys/i4b/layer1/iwic/i4b_iwic_l1if.c	Sat Jan  8 10:40:33 2005
+++ cleanup/sys/i4b/layer1/iwic/i4b_iwic_l1if.c	Sat Jan  8 21:42:05 2005
@@ -34,8 +34,6 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/sys/i4b/layer1/iwic/i4b_iwic_l1if.c,v 1.9 2005/01/=
06 22:18:21 imp Exp $");
=20
-#include "opt_i4b.h"
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/socket.h>
diff -ru freebsd/sys/i4b/layer1/iwic/i4b_iwic_pci.c cleanup/sys/i4b/layer1/=
iwic/i4b_iwic_pci.c
--- freebsd/sys/i4b/layer1/iwic/i4b_iwic_pci.c	Sat Jan  8 10:40:33 2005
+++ cleanup/sys/i4b/layer1/iwic/i4b_iwic_pci.c	Sat Jan  8 21:42:05 2005
@@ -34,10 +34,9 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/sys/i4b/layer1/iwic/i4b_iwic_pci.c,v 1.13 2005/01/=
06 22:18:21 imp Exp $");
=20
-#include "opt_i4b.h"
-
 #include <sys/param.h>
 #include <sys/kernel.h>
+#include <sys/module.h>
 #include <sys/systm.h>
 #include <sys/socket.h>
 #include <net/if.h>
diff -ru freebsd/sys/i4b/layer4/i4b_i4bdrv.c cleanup/sys/i4b/layer4/i4b_i4b=
drv.c
--- freebsd/sys/i4b/layer4/i4b_i4bdrv.c	Sat Jan  8 10:40:48 2005
+++ cleanup/sys/i4b/layer4/i4b_i4bdrv.c	Sat Jan  8 21:42:08 2005
@@ -34,13 +34,12 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/sys/i4b/layer4/i4b_i4bdrv.c,v 1.43 2005/01/06 22:1=
8:21 imp Exp $");
=20
-#include "opt_i4b.h"
-
 #include <sys/param.h>
 #include <sys/ioccom.h>
 #include <sys/malloc.h>
 #include <sys/uio.h>
 #include <sys/kernel.h>
+#include <sys/module.h>
 #include <sys/systm.h>
 #include <sys/conf.h>
 #include <sys/mbuf.h>
@@ -62,6 +61,12 @@
=20
 struct selinfo select_rd_info;
=20
+drvr_link_t *(*rbch_ret_linktab_p)(int);
+drvr_link_t *(*ipr_ret_linktab_p)(int);
+drvr_link_t *(*tel_ret_linktab_p)(int);
+drvr_link_t *(*i4bisppp_ret_linktab_p)(int);
+drvr_link_t *(*ing_ret_linktab_p)(int);
+
 static struct ifqueue i4b_rdqueue;
 static int openflag =3D 0;
 static int selflag =3D 0;
@@ -73,6 +78,7 @@
 static	d_ioctl_t	i4bioctl;
 static	d_poll_t	i4bpoll;
=20
+MALLOC_DEFINE(M_I4B, "I4B", "Memory for isdb4bsd");
=20
 static struct cdevsw i4b_cdevsw =3D {
 	.d_version =3D	D_VERSION,
@@ -86,7 +92,28 @@
 };
=20
 static void i4battach(void *);
-PSEUDO_SET(i4battach, i4b_i4bdrv);
+
+static int i4b_modevent(module_t mod, int type, void *data)
+{
+        switch(type) {
+        case MOD_LOAD:
+                i4battach(NULL);
+                break;
+        case MOD_UNLOAD:
+                printf("i4b module unload - not possiable for this module =
type\b");
+                return (EINVAL);
+        }
+=20
+        return (0);
+}
+  =20
+static moduledata_t i4b_mod =3D {
+        "i4b",
+        i4b_modevent,
+        NULL
+};
+=20
+DECLARE_MODULE(i4b, i4b_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
=20
 /*------------------------------------------------------------------------=
---*
  *	interface attach routine
@@ -423,35 +450,25 @@
=20
 			switch(mdrsp->driver)
 			{
-#if NI4BIPR > 0
 				case BDRV_IPR:
-					dlt =3D ipr_ret_linktab(mdrsp->driver_unit);
+					if (ipr_ret_linktab_p !=3D NULL)
+						dlt =3D ipr_ret_linktab_p(mdrsp->driver_unit);
 					break;
-#endif				=09
=20
-#if NI4BISPPP > 0
 				case BDRV_ISPPP:
-					dlt =3D i4bisppp_ret_linktab(mdrsp->driver_unit);
+					if (i4bisppp_ret_linktab_p !=3D NULL)
+						dlt =3D i4bisppp_ret_linktab_p(mdrsp->driver_unit);
 					break;
-#endif
=20
-#if NI4BTEL > 0
 				case BDRV_TEL:
-					dlt =3D tel_ret_linktab(mdrsp->driver_unit);
-					break;
-#endif
-
-#if NIBC > 0
-				case BDRV_IBC:
-					dlt =3D ibc_ret_linktab(mdrsp->driver_unit);
+					if (tel_ret_linktab_p !=3D NULL)
+						dlt =3D tel_ret_linktab_p(mdrsp->driver_unit);
 					break;
-#endif
=20
-#if NI4BING > 0
 				case BDRV_ING:
-					dlt =3D ing_ret_linktab(mdrsp->driver_unit);
+					if (ing_ret_linktab_p !=3D NULL)
+						dlt =3D ing_ret_linktab_p(mdrsp->driver_unit);
 					break;
-#endif				=09
 			}
=20
 			if(dlt !=3D NULL)	=09
@@ -543,14 +560,12 @@
 		=09
 			mui =3D (msg_updown_ind_t *)data;
=20
-#if NI4BIPR > 0
 			if(mui->driver =3D=3D BDRV_IPR)
 			{
 				drvr_link_t *dlt;
-				dlt =3D ipr_ret_linktab(mui->driver_unit);
+				dlt =3D ipr_ret_linktab_p(mui->driver_unit);
 				(*dlt->updown_ind)(mui->driver_unit, mui->updown);
 			}
-#endif
 			break;
 		}
 	=09
diff -ru freebsd/sys/i4b/layer4/i4b_l4.c cleanup/sys/i4b/layer4/i4b_l4.c
--- freebsd/sys/i4b/layer4/i4b_l4.c	Sat Jan  8 10:40:49 2005
+++ cleanup/sys/i4b/layer4/i4b_l4.c	Sat Jan  8 21:42:08 2005
@@ -34,8 +34,6 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/sys/i4b/layer4/i4b_l4.c,v 1.19 2005/01/06 22:18:21=
 imp Exp $");
=20
-#include "opt_i4b.h"
-
 #include <sys/param.h>
 #include <sys/kernel.h>
 #include <sys/systm.h>
@@ -63,9 +61,13 @@
 static void i4b_l4_setup_timeout_var_unit(call_desc_t *cd);
 static time_t i4b_get_idletime(call_desc_t *cd);
=20
-#if NI4BISPPP > 0
-extern time_t i4bisppp_idletime(int);
-#endif
+time_t (*i4bisppp_idletime_p)(int);
+
+void (*rbch_set_linktab_p)(int, isdn_link_t *);
+void (*ipr_set_linktab_p)(int, isdn_link_t *);
+void (*tel_set_linktab_p)(int, isdn_link_t *);
+void (*i4bisppp_set_linktab_p)(int, isdn_link_t *);
+void (*ing_set_linktab_p)(int, isdn_link_t *);
=20
 /*------------------------------------------------------------------------=
---*
  *	send MSG_PDEACT_IND message to userland
@@ -621,41 +623,30 @@
=20
 	switch(cd->driver)
 	{
-#if NI4BRBCH > 0
 		case BDRV_RBCH:
-			cd->dlt =3D rbch_ret_linktab(cd->driver_unit);
+			if (rbch_ret_linktab_p !=3D NULL)
+				cd->dlt =3D rbch_ret_linktab_p(cd->driver_unit);
 			break;
-#endif
 	=09
-#if NI4BTEL > 0
 		case BDRV_TEL:
-			cd->dlt =3D tel_ret_linktab(cd->driver_unit);
+			if (tel_ret_linktab_p !=3D NULL)
+				cd->dlt =3D tel_ret_linktab_p(cd->driver_unit);
 			break;
-#endif
=20
-#if NI4BIPR > 0
 		case BDRV_IPR:
-			cd->dlt =3D ipr_ret_linktab(cd->driver_unit);
+			if (ipr_ret_linktab_p !=3D NULL)
+				cd->dlt =3D ipr_ret_linktab_p(cd->driver_unit);
 			break;
-#endif
=20
-#if NI4BISPPP > 0
 		case BDRV_ISPPP:
-			cd->dlt =3D i4bisppp_ret_linktab(cd->driver_unit);
-			break;
-#endif
-
-#if NIBC > 0
-		case BDRV_IBC:
-			cd->dlt =3D ibc_ret_linktab(cd->driver_unit);
+			if (i4bisppp_ret_linktab_p !=3D NULL)
+				cd->dlt =3D i4bisppp_ret_linktab_p(cd->driver_unit);
 			break;
-#endif
=20
-#if NI4BING > 0
 		case BDRV_ING:
-			cd->dlt =3D ing_ret_linktab(cd->driver_unit);
+			if (ing_ret_linktab_p !=3D NULL)
+				cd->dlt =3D ing_ret_linktab_p(cd->driver_unit);
 			break;
-#endif
=20
 		default:
 			cd->dlt =3D NULL;
@@ -675,41 +666,30 @@
=20
 	switch(cd->driver)
 	{
-#if NI4BRBCH > 0
 		case BDRV_RBCH:
-			rbch_set_linktab(cd->driver_unit, cd->ilt);
+			if (rbch_set_linktab_p !=3D NULL)
+				rbch_set_linktab_p(cd->driver_unit, cd->ilt);
 			break;
-#endif
=20
-#if NI4BTEL > 0
 		case BDRV_TEL:
-			tel_set_linktab(cd->driver_unit, cd->ilt);
+			if (tel_set_linktab_p !=3D NULL)
+				tel_set_linktab_p(cd->driver_unit, cd->ilt);
 			break;
-#endif
=20
-#if NI4BIPR > 0
 		case BDRV_IPR:
-			ipr_set_linktab(cd->driver_unit, cd->ilt);
+			if (ipr_set_linktab_p !=3D NULL)
+				ipr_set_linktab_p(cd->driver_unit, cd->ilt);
 			break;
-#endif
=20
-#if NI4BISPPP > 0
 		case BDRV_ISPPP:
-			i4bisppp_set_linktab(cd->driver_unit, cd->ilt);
-			break;
-#endif
-
-#if NIBC > 0
-		case BDRV_IBC:
-			ibc_set_linktab(cd->driver_unit, cd->ilt);
+			if (i4bisppp_set_linktab_p !=3D NULL)
+				i4bisppp_set_linktab_p(cd->driver_unit, cd->ilt);
 			break;
-#endif
=20
-#if NI4BING > 0
 		case BDRV_ING:
-			ing_set_linktab(cd->driver_unit, cd->ilt);
+			if (ing_set_linktab_p !=3D NULL)
+				ing_set_linktab_p(cd->driver_unit, cd->ilt);
 			break;
-#endif
=20
 		default:
 			return(0);
@@ -794,11 +774,12 @@
 i4b_get_idletime(call_desc_t *cd)
 {
 	switch (cd->driver) {
-#if NI4BISPPP > 0
 		case BDRV_ISPPP:
-			return i4bisppp_idletime(cd->driver_unit);
+			if (i4bisppp_idletime_p !=3D NULL)
+				return i4bisppp_idletime_p(cd->driver_unit);
+			else
+				return (0);
 		break;
-#endif
 		default:
 			return cd->last_active_time;
 		break;
diff -ru freebsd/sys/i4b/layer4/i4b_l4timer.c cleanup/sys/i4b/layer4/i4b_l4=
timer.c
--- freebsd/sys/i4b/layer4/i4b_l4timer.c	Sat Jan  8 10:40:51 2005
+++ cleanup/sys/i4b/layer4/i4b_l4timer.c	Sat Jan  8 21:42:09 2005
@@ -36,6 +36,7 @@
 #include <sys/param.h>
 #include <sys/kernel.h>
 #include <sys/systm.h>
+#include <sys/malloc.h>
=20
 #include <machine/i4b_debug.h>
 #include <machine/i4b_ioctl.h>

--=20
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4

--lrZ03NoBR/3+SXJZ
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFCH8bqXY6L6fI4GtQRAlflAKDG+MOef7HYppWTbEuLMXrLNulTHwCg10gq
CLtZCuIaXwVansDA1thuYlU=
=FCgX
-----END PGP SIGNATURE-----

--lrZ03NoBR/3+SXJZ--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050226004635.GA2922>