From 817cdab66614ef779c5de9c13f3831285ffb8fd8 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Fri, 3 Jun 2005 16:50:13 +0000 Subject: [PATCH] Remove spl*() calls from net/i4b, replacing them with critical sections. --- sys/net/i4b/capi/capi_l4if.c | 43 +++++++++--------- sys/net/i4b/capi/iavc/iavc_card.c | 8 ++-- sys/net/i4b/capi/iavc/iavc_lli.c | 12 ++--- sys/net/i4b/driver/i4b_ing.c | 23 +++++----- sys/net/i4b/driver/i4b_ipr.c | 52 ++++++++++------------ sys/net/i4b/driver/i4b_rbch.c | 3 +- sys/net/i4b/driver/i4b_trace.c | 32 ++++++------- sys/net/i4b/include/i4b_global.h | 12 ++--- sys/net/i4b/layer1/ifpi/i4b_ifpi_l1.c | 13 +++--- sys/net/i4b/layer1/ifpi/i4b_ifpi_l1fsm.c | 7 +-- sys/net/i4b/layer1/ifpi/i4b_ifpi_pci.c | 28 ++++++------ sys/net/i4b/layer1/ifpi2/i4b_ifpi2_l1.c | 13 +++--- sys/net/i4b/layer1/ifpi2/i4b_ifpi2_l1fsm.c | 8 ++-- sys/net/i4b/layer1/ifpi2/i4b_ifpi2_pci.c | 28 ++++++------ sys/net/i4b/layer1/ifpnp/i4b_ifpnp_avm.c | 28 ++++++------ sys/net/i4b/layer1/ifpnp/i4b_ifpnp_l1.c | 13 +++--- sys/net/i4b/layer1/ifpnp/i4b_ifpnp_l1fsm.c | 8 ++-- sys/net/i4b/layer1/isic/i4b_bchan.c | 22 +++++---- sys/net/i4b/layer1/isic/i4b_l1.c | 12 ++--- sys/net/i4b/layer1/isic/i4b_l1fsm.c | 7 +-- sys/net/i4b/layer1/itjc/i4b_itjc_l1.c | 12 ++--- sys/net/i4b/layer1/itjc/i4b_itjc_l1fsm.c | 7 +-- sys/net/i4b/layer1/itjc/i4b_itjc_pci.c | 35 +++++++-------- sys/net/i4b/layer1/iwic/i4b_iwic_bchan.c | 21 +++++---- sys/net/i4b/layer1/iwic/i4b_iwic_dchan.c | 15 +++---- sys/net/i4b/layer2/i4b_iframe.c | 3 +- sys/net/i4b/layer2/i4b_l2.c | 3 +- sys/net/i4b/layer2/i4b_l2timer.c | 3 +- sys/net/i4b/layer2/i4b_util.c | 3 +- sys/net/i4b/layer3/i4b_l3fsm.c | 14 +++--- sys/net/i4b/layer3/i4b_l3timer.c | 3 +- sys/net/i4b/layer3/i4b_q931.c | 10 ++--- sys/net/i4b/layer4/i4b_i4bdrv.c | 49 ++++++++------------ sys/net/i4b/layer4/i4b_l4.c | 14 +++--- sys/net/i4b/layer4/i4b_l4mgmt.c | 26 +++++------ sys/net/i4b/layer4/i4b_l4timer.c | 3 +- 36 files changed, 279 insertions(+), 314 deletions(-) diff --git a/sys/net/i4b/capi/capi_l4if.c b/sys/net/i4b/capi/capi_l4if.c index 5294226be9..f88e034a2a 100644 --- a/sys/net/i4b/capi/capi_l4if.c +++ b/sys/net/i4b/capi/capi_l4if.c @@ -25,7 +25,7 @@ * capi/capi_l4if.c The CAPI i4b L4/device interface. * * $FreeBSD: src/sys/i4b/capi/capi_l4if.c,v 1.1.2.1 2001/08/10 14:08:34 obrien Exp $ - * $DragonFly: src/sys/net/i4b/capi/capi_l4if.c,v 1.6 2005/01/23 13:47:24 joerg Exp $ + * $DragonFly: src/sys/net/i4b/capi/capi_l4if.c,v 1.7 2005/06/03 16:49:54 dillon Exp $ */ #include @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -115,31 +116,30 @@ static void i4b_capi_bch_start_tx(int unit, int chan) { capi_softc_t *sc = capi_sc[unit]; - int s; - - s = SPLI4B(); + crit_enter(); if (sc->sc_bchan[chan].state != B_CONNECTED) { - splx(s); + crit_exit(); printf("capi%d: start_tx on unconnected channel\n", sc->sc_unit); return; } if (sc->sc_bchan[chan].busy) { - splx(s); + crit_exit(); return; } capi_start_tx(sc, chan); - splx(s); + crit_exit(); } static void i4b_capi_bch_stat(int unit, int chan, bchan_statistics_t *bsp) { capi_softc_t *sc = capi_sc[unit]; - int s = SPLI4B(); + + crit_enter(); bsp->outbytes = sc->sc_bchan[chan].txcount; bsp->inbytes = sc->sc_bchan[chan].rxcount; @@ -147,7 +147,7 @@ i4b_capi_bch_stat(int unit, int chan, bchan_statistics_t *bsp) sc->sc_bchan[chan].txcount = 0; sc->sc_bchan[chan].rxcount = 0; - splx(s); + crit_exit(); } int capi_start_tx(capi_softc_t *sc, int chan) @@ -313,7 +313,7 @@ n_connect_request(u_int cdid) { call_desc_t *cd = cd_by_cdid(cdid); capi_softc_t *sc; - int bch, s; + int bch; if (!cd) { printf("capi?: invalid cdid %d\n", cdid); @@ -323,7 +323,7 @@ n_connect_request(u_int cdid) sc = capi_sc[ctrl_desc[cd->controller].unit]; bch = cd->channelid; - s = SPLI4B(); + crit_enter(); if ((bch < 0) || (bch >= sc->sc_nbch)) for (bch = 0; bch < sc->sc_nbch; bch++) @@ -331,7 +331,7 @@ n_connect_request(u_int cdid) break; if (bch == sc->sc_nbch) { - splx(s); + crit_exit(); printf("capi%d: no free B channel\n", sc->sc_unit); return; } @@ -339,7 +339,7 @@ n_connect_request(u_int cdid) cd->channelid = bch; capi_connect_req(sc, cd); - splx(s); + crit_exit(); } /* @@ -354,7 +354,7 @@ n_connect_response(u_int cdid, int response, int cause) { call_desc_t *cd = cd_by_cdid(cdid); capi_softc_t *sc; - int bch, s; + int bch; if (!cd) { printf("capi?: invalid cdid %d\n", cdid); @@ -369,9 +369,9 @@ n_connect_response(u_int cdid, int response, int cause) cd->response = response; cd->cause_out = cause; - s = SPLI4B(); + crit_enter(); capi_connect_resp(sc, cd); - splx(s); + crit_exit(); } /* @@ -385,7 +385,7 @@ n_disconnect_request(u_int cdid, int cause) { call_desc_t *cd = cd_by_cdid(cdid); capi_softc_t *sc; - int bch, s; + int bch; if (!cd) { printf("capi?: invalid cdid %d\n", cdid); @@ -397,9 +397,9 @@ n_disconnect_request(u_int cdid, int cause) cd->cause_out = cause; - s = SPLI4B(); + crit_enter(); capi_disconnect_req(sc, cd); - splx(s); + crit_exit(); } /* @@ -412,7 +412,6 @@ n_alert_request(u_int cdid) { call_desc_t *cd = cd_by_cdid(cdid); capi_softc_t *sc; - int s; if (!cd) { printf("capi?: invalid cdid %d\n", cdid); @@ -421,9 +420,9 @@ n_alert_request(u_int cdid) sc = capi_sc[ctrl_desc[cd->controller].unit]; - s = SPLI4B(); + crit_enter(); capi_alert_req(sc, cd); - splx(s); + crit_exit(); } /* diff --git a/sys/net/i4b/capi/iavc/iavc_card.c b/sys/net/i4b/capi/iavc/iavc_card.c index acf6220c7c..f186f85508 100644 --- a/sys/net/i4b/capi/iavc/iavc_card.c +++ b/sys/net/i4b/capi/iavc/iavc_card.c @@ -26,7 +26,7 @@ * The AVM ISDN controllers' card specific support routines. * * $FreeBSD: src/sys/i4b/capi/iavc/iavc_card.c,v 1.1.2.1 2001/08/10 14:08:34 obrien Exp $ - * $DragonFly: src/sys/net/i4b/capi/iavc/iavc_card.c,v 1.5 2004/04/16 15:40:21 joerg Exp $ + * $DragonFly: src/sys/net/i4b/capi/iavc/iavc_card.c,v 1.6 2005/06/03 16:49:55 dillon Exp $ */ #include @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -151,8 +152,7 @@ int b1dma_detect(iavc_softc_t *sc) void b1dma_reset(iavc_softc_t *sc) { - int s = SPLI4B(); - + crit_enter(); sc->sc_csr = 0; AMCC_WRITE(sc, AMCC_INTCSR, sc->sc_csr); AMCC_WRITE(sc, AMCC_MCSR, 0); @@ -162,7 +162,7 @@ void b1dma_reset(iavc_softc_t *sc) iavc_write_port(sc, 0x10, 0x00); /* XXX magic numbers from */ iavc_write_port(sc, 0x07, 0x00); /* XXX the linux driver */ - splx(s); + crit_exit(); AMCC_WRITE(sc, AMCC_MCSR, 0); DELAY(10 * 1000); diff --git a/sys/net/i4b/capi/iavc/iavc_lli.c b/sys/net/i4b/capi/iavc/iavc_lli.c index ccaa9f5cb7..76ad08dd92 100644 --- a/sys/net/i4b/capi/iavc/iavc_lli.c +++ b/sys/net/i4b/capi/iavc/iavc_lli.c @@ -26,7 +26,7 @@ * The AVM ISDN controllers' Low Level Interface. * * $FreeBSD: src/sys/i4b/capi/iavc/iavc_lli.c,v 1.2.2.1 2001/08/10 14:08:34 obrien Exp $ - * $DragonFly: src/sys/net/i4b/capi/iavc/iavc_lli.c,v 1.6 2005/01/23 13:47:24 joerg Exp $ + * $DragonFly: src/sys/net/i4b/capi/iavc/iavc_lli.c,v 1.7 2005/06/03 16:49:55 dillon Exp $ */ #include @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -141,7 +142,7 @@ int iavc_load(capi_softc_t *capi_sc, int len, u_int8_t *cp) if (sc->sc_dma) { /* Start the DMA engine */ - int s = SPLI4B(); + crit_enter(); sc->sc_csr = AVM_FLAG; AMCC_WRITE(sc, AMCC_INTCSR, sc->sc_csr); @@ -158,7 +159,7 @@ int iavc_load(capi_softc_t *capi_sc, int len, u_int8_t *cp) sc->sc_csr |= EN_RX_TC_INT|EN_TX_TC_INT; AMCC_WRITE(sc, AMCC_INTCSR, sc->sc_csr); - splx(s); + crit_exit(); } if(sc->sc_capi.card_type == CARD_TYPEC_AVM_B1_ISA) @@ -279,7 +280,6 @@ static int iavc_send_init(iavc_softc_t *sc) { struct mbuf *m = i4b_Dgetmbuf(15); u_int8_t *p; - int s; if (!m) { printf("iavc%d: can't get memory\n", sc->sc_unit); @@ -300,13 +300,13 @@ static int iavc_send_init(iavc_softc_t *sc) p = amcc_put_word(p, sc->sc_capi.sc_nbch); p = amcc_put_word(p, sc->sc_unit); - s = SPLI4B(); + crit_enter(); IF_ENQUEUE(&sc->sc_txq, m); iavc_start_tx(sc); sc->sc_state = IAVC_INIT; - splx(s); + crit_exit(); return 0; } diff --git a/sys/net/i4b/driver/i4b_ing.c b/sys/net/i4b/driver/i4b_ing.c index 6f24a7a0ec..2efb048216 100644 --- a/sys/net/i4b/driver/i4b_ing.c +++ b/sys/net/i4b/driver/i4b_ing.c @@ -28,7 +28,7 @@ * ------------------------------------------------- * * $FreeBSD: src/sys/i4b/driver/i4b_ing.c,v 1.10.2.4 2002/07/02 23:44:02 archie Exp $ - * $DragonFly: src/sys/net/i4b/driver/i4b_ing.c,v 1.6 2004/09/16 04:36:30 dillon Exp $ + * $DragonFly: src/sys/net/i4b/driver/i4b_ing.c,v 1.7 2005/06/03 16:49:57 dillon Exp $ * * last edit-date: [Tue Jan 1 10:43:58 2002] * @@ -50,6 +50,7 @@ #include #include #include +#include #include @@ -344,9 +345,9 @@ ingclearqueue(struct ifqueue *iq) for(;;) { - x = splimp(); + crit_enter(); IF_DEQUEUE(iq, m); - splx(x); + crit_exit(); if(m) m_freem(m); @@ -367,11 +368,10 @@ static void ing_connect(int unit, void *cdp) { struct ing_softc *sc = &ing_softc[unit]; - int s; sc->sc_cdp = (call_desc_t *)cdp; - s = SPLI4B(); + crit_enter(); NDBGL4(L4_DIALST, "ing%d: setting dial state to ST_CONNECTED", unit); @@ -391,7 +391,7 @@ ing_connect(int unit, void *cdp) sc->sc_state = ST_CONNECTED; - splx(s); + crit_exit(); } /*---------------------------------------------------------------------------* @@ -754,7 +754,6 @@ ng_ing_rcvdata(hook_p hook, struct mbuf *m, meta_p meta) { struct ing_softc *sc = hook->node->private; struct ifqueue *xmitq_p; - int s; if(hook->private == NULL) { @@ -783,12 +782,12 @@ ng_ing_rcvdata(hook_p hook, struct mbuf *m, meta_p meta) xmitq_p = (&sc->xmitq); } - s = splimp(); + crit_enter(); if (IF_QFULL(xmitq_p)) { IF_DROP(xmitq_p); - splx(s); + crit_exit(); NG_FREE_DATA(m, meta); return(ENOBUFS); } @@ -797,7 +796,7 @@ ng_ing_rcvdata(hook_p hook, struct mbuf *m, meta_p meta) ing_tx_queue_empty(sc->sc_unit); - splx(s); + crit_exit(); return (0); } @@ -840,12 +839,10 @@ static int ng_ing_disconnect(hook_p hook) { struct ing_softc *sc = hook->node->private; - int s; if(hook->private) { - s = splimp(); - splx(s); + splz(); } else { diff --git a/sys/net/i4b/driver/i4b_ipr.c b/sys/net/i4b/driver/i4b_ipr.c index 3f5478648f..3754d5e8b5 100644 --- a/sys/net/i4b/driver/i4b_ipr.c +++ b/sys/net/i4b/driver/i4b_ipr.c @@ -28,7 +28,7 @@ * --------------------------------------------------------- * * $FreeBSD: src/sys/i4b/driver/i4b_ipr.c,v 1.8.2.3 2001/10/27 15:48:17 hm Exp $ - * $DragonFly: src/sys/net/i4b/driver/i4b_ipr.c,v 1.15 2005/02/10 00:20:09 joerg Exp $ + * $DragonFly: src/sys/net/i4b/driver/i4b_ipr.c,v 1.16 2005/06/03 16:49:57 dillon Exp $ * * last edit-date: [Fri Oct 26 19:32:38 2001] * @@ -86,6 +86,7 @@ #endif #include +#include #include #include @@ -384,10 +385,9 @@ i4biproutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, { struct ipr_softc *sc; int unit; - int s; struct ip *ip; - s = SPLI4B(); + crit_enter(); #if (defined(__FreeBSD__) && !defined(__DragonFly__)) || (defined(__bsdi__)) unit = ifp->if_unit; @@ -403,7 +403,7 @@ i4biproutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, { printf(IPR_FMT "af%d not supported\n", IPR_ARG(sc), dst->sa_family); m_freem(m); - splx(s); + crit_exit(); sc->sc_if.if_noproto++; sc->sc_if.if_oerrors++; return(EAFNOSUPPORT); @@ -415,7 +415,7 @@ i4biproutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, { NDBGL4(L4_IPRDBG, "ipr%d: interface is DOWN!", unit); m_freem(m); - splx(s); + crit_exit(); sc->sc_if.if_oerrors++; return(ENETDOWN); } @@ -433,7 +433,7 @@ i4biproutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, m_freem(m); iprclearqueues(sc); sc->sc_dialresp = DSTAT_NONE; - splx(s); + crit_exit(); sc->sc_if.if_oerrors++; return(ENETUNREACH); break; @@ -443,7 +443,7 @@ i4biproutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, m_freem(m); iprclearqueues(sc); sc->sc_dialresp = DSTAT_NONE; - splx(s); + crit_exit(); sc->sc_if.if_oerrors++; return(EHOSTUNREACH); break; @@ -453,7 +453,7 @@ i4biproutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, m_freem(m); iprclearqueues(sc); sc->sc_dialresp = DSTAT_NONE; - splx(s); + crit_exit(); sc->sc_if.if_oerrors++; return(EHOSTUNREACH); break; @@ -492,7 +492,7 @@ i4biproutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, if (netisr_queue(NETISR_IP, m)) { NDBGL4(L4_IPRDBG, "ipr%d: send queue full!", unit); - splx(s); + crit_exit(); sc->sc_if.if_oerrors++; return(ENOBUFS); } @@ -502,7 +502,7 @@ i4biproutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, ipr_tx_queue_empty(unit); - splx(s); + crit_exit(); return (0); } @@ -526,10 +526,9 @@ i4biprioctl(struct ifnet *ifp, u_long cmd, caddr_t data) struct ifreq *ifr = (struct ifreq *)data; struct ifaddr *ifa = (struct ifaddr *)data; - int s; int error = 0; - s = SPLI4B(); + crit_enter(); switch (cmd) { @@ -609,7 +608,7 @@ i4biprioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; } - splx(s); + crit_exit(); return(error); } @@ -620,21 +619,19 @@ i4biprioctl(struct ifnet *ifp, u_long cmd, caddr_t data) static void iprclearqueues(struct ipr_softc *sc) { - int x; - #if defined (__FreeBSD__) && __FreeBSD__ > 4 - x = splimp(); + crit_enter(); IF_DRAIN(&sc->sc_fastq); IF_DRAIN(&sc->sc_if.if_snd); - splx(x); + crit_exit(); #else struct mbuf *m; for(;;) { - x = splimp(); + crit_enter(); IF_DEQUEUE(&sc->sc_fastq, m); - splx(x); + crit_exit(); if(m) m_freem(m); else @@ -643,9 +640,9 @@ iprclearqueues(struct ipr_softc *sc) for(;;) { - x = splimp(); + crit_enter(); IF_DEQUEUE(&sc->sc_if.if_snd, m); - splx(x); + crit_exit(); if(m) m_freem(m); else @@ -720,7 +717,7 @@ iprwatchdog(struct ifnet *ifp) static void i4bipr_connect_startio(struct ipr_softc *sc) { - int s = SPLI4B(); + crit_enter(); if(sc->sc_state == ST_CONNECTED_W) { @@ -728,7 +725,7 @@ i4bipr_connect_startio(struct ipr_softc *sc) ipr_tx_queue_empty(THE_UNIT); } - splx(s); + crit_exit(); } /*---------------------------------------------------------------------------* @@ -738,11 +735,10 @@ static void ipr_connect(int unit, void *cdp) { struct ipr_softc *sc = &ipr_softc[unit]; - int s; sc->sc_cdp = (call_desc_t *)cdp; - s = SPLI4B(); + crit_enter(); NDBGL4(L4_DIALST, "ipr%d: setting dial state to ST_CONNECTED", unit); @@ -797,7 +793,7 @@ ipr_connect(int unit, void *cdp) ipr_tx_queue_empty(unit); } - splx(s); + crit_exit(); /* we don't need any negotiation - pass event back right now */ i4b_l4_negcomplete(sc->sc_cdp); @@ -876,8 +872,8 @@ ipr_updown(int unit, int updown) /*---------------------------------------------------------------------------* * this routine is called from the HSCX interrupt handler * when a new frame (mbuf) has been received and was put on - * the rx queue. It is assumed that this routines runs at - * pri level splimp() ! Keep it short ! + * the rx queue. It is assumed that this routines runs in + * a critical section ! Keep it short ! *---------------------------------------------------------------------------*/ static void ipr_rx_data_rdy(int unit) diff --git a/sys/net/i4b/driver/i4b_rbch.c b/sys/net/i4b/driver/i4b_rbch.c index 69578671d3..30829641be 100644 --- a/sys/net/i4b/driver/i4b_rbch.c +++ b/sys/net/i4b/driver/i4b_rbch.c @@ -28,7 +28,7 @@ * --------------------------------------------------- * * $FreeBSD: src/sys/i4b/driver/i4b_rbch.c,v 1.10.2.3 2001/08/12 16:22:48 hm Exp $ - * $DragonFly: src/sys/net/i4b/driver/i4b_rbch.c,v 1.13 2005/01/23 13:47:24 joerg Exp $ + * $DragonFly: src/sys/net/i4b/driver/i4b_rbch.c,v 1.14 2005/06/03 16:49:57 dillon Exp $ * * last edit-date: [Sat Aug 11 18:06:57 2001] * @@ -48,6 +48,7 @@ #include #include #include +#include #if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 #include diff --git a/sys/net/i4b/driver/i4b_trace.c b/sys/net/i4b/driver/i4b_trace.c index 7163770dc1..9efe14285f 100644 --- a/sys/net/i4b/driver/i4b_trace.c +++ b/sys/net/i4b/driver/i4b_trace.c @@ -30,9 +30,7 @@ * last edit-date: [Sat Aug 11 18:07:15 2001] * * $FreeBSD: src/sys/i4b/driver/i4b_trace.c,v 1.9.2.3 2001/08/12 16:22:48 hm Exp $ - * $DragonFly: src/sys/net/i4b/driver/i4b_trace.c,v 1.11 2005/01/23 13:47:24 joerg Exp $ - * - * NOTE: the code assumes that SPLI4B >= splimp ! + * $DragonFly: src/sys/net/i4b/driver/i4b_trace.c,v 1.12 2005/06/03 16:49:57 dillon Exp $ * *---------------------------------------------------------------------------*/ @@ -56,6 +54,7 @@ #include #include #include +#include #if defined(__DragonFly__) || defined(__FreeBSD__) @@ -240,7 +239,6 @@ int get_trace_data_from_l1(i4b_trace_hdr_t *hdr, int len, char *buf) { struct mbuf *m; - int x; int unit; int trunc = 0; int totlen = len + sizeof(i4b_trace_hdr_t); @@ -300,9 +298,9 @@ get_trace_data_from_l1(i4b_trace_hdr_t *hdr, int len, char *buf) { struct mbuf *m1; - x = SPLI4B(); + crit_enter(); IF_DEQUEUE(&trace_queue[unit], m1); - splx(x); + crit_exit(); i4b_Bfreembuf(m1); } @@ -316,7 +314,7 @@ get_trace_data_from_l1(i4b_trace_hdr_t *hdr, int len, char *buf) else memcpy(&m->m_data[sizeof(i4b_trace_hdr_t)], buf, len); - x = SPLI4B(); + crit_enter(); IF_ENQUEUE(&trace_queue[unit], m); @@ -326,7 +324,7 @@ get_trace_data_from_l1(i4b_trace_hdr_t *hdr, int len, char *buf) wakeup((caddr_t) &trace_queue[unit]); } - splx(x); + crit_exit(); return(1); } @@ -337,7 +335,6 @@ get_trace_data_from_l1(i4b_trace_hdr_t *hdr, int len, char *buf) PDEVSTATIC int i4btrcopen(dev_t dev, int flag, int fmt, struct thread *td) { - int x; int unit = minor(dev); if(unit >= NI4BTRC) @@ -349,11 +346,11 @@ i4btrcopen(dev_t dev, int flag, int fmt, struct thread *td) if(analyzemode && (unit == outunit || unit == rxunit || unit == txunit)) return(EBUSY); - x = SPLI4B(); + crit_enter(); device_state[unit] = ST_ISOPEN; - splx(x); + crit_exit(); return(0); } @@ -365,7 +362,7 @@ PDEVSTATIC int i4btrcclose(dev_t dev, int flag, int fmt, struct thread *td) { int unit = minor(dev); - int i, x; + int i; int cno = -1; for(i=0; i < nctrl; i++) @@ -397,9 +394,9 @@ i4btrcclose(dev_t dev, int flag, int fmt, struct thread *td) (*ctrl_desc[cno].N_MGMT_COMMAND)(ctrl_desc[cno].unit, CMR_SETTRACE, TRACE_OFF); } - x = SPLI4B(); + crit_enter(); device_state[unit] = ST_IDLE; - splx(x); + crit_exit(); return(0); } @@ -411,14 +408,13 @@ PDEVSTATIC int i4btrcread(dev_t dev, struct uio * uio, int ioflag) { struct mbuf *m; - int x; int error = 0; int unit = minor(dev); if(!(device_state[unit] & ST_ISOPEN)) return(EIO); - x = SPLI4B(); + crit_enter(); while(IF_QEMPTY(&trace_queue[unit]) && (device_state[unit] & ST_ISOPEN)) { @@ -435,7 +431,7 @@ i4btrcread(dev_t dev, struct uio * uio, int ioflag) #endif { device_state[unit] &= ~ST_WAITDATA; - splx(x); + crit_exit(); return(error); } } @@ -450,7 +446,7 @@ i4btrcread(dev_t dev, struct uio * uio, int ioflag) if(m) i4b_Bfreembuf(m); - splx(x); + crit_exit(); return(error); } diff --git a/sys/net/i4b/include/i4b_global.h b/sys/net/i4b/include/i4b_global.h index ec73a41a90..0681dadb7f 100644 --- a/sys/net/i4b/include/i4b_global.h +++ b/sys/net/i4b/include/i4b_global.h @@ -28,7 +28,7 @@ * -------------------------------------- * * $FreeBSD: src/sys/i4b/include/i4b_global.h,v 1.6.2.2 2002/07/07 10:17:10 hm Exp $ - * $DragonFly: src/sys/net/i4b/include/i4b_global.h,v 1.4 2005/01/23 13:47:24 joerg Exp $ + * $DragonFly: src/sys/net/i4b/include/i4b_global.h,v 1.5 2005/06/03 16:49:58 dillon Exp $ * * last edit-date: [Sun Jul 7 12:11:35 2002] * @@ -152,15 +152,11 @@ #define TIMER_IDLE 1 /* a timer is running */ #define TIMER_ACTIVE 2 /* a timer is idle */ -/* i4b's spl */ - -#define SPLI4B() splimp() /* spl for i4b */ - /* critial code region handling macros */ -#define CRIT_VAR int _svd_spl_ /* declare variable */ -#define CRIT_BEG _svd_spl_ = SPLI4B() /* save spl */ -#define CRIT_END splx(_svd_spl_) /* restore spl */ +#define CRIT_VAR int _svd_spl_ __unused; /* dummy */ +#define CRIT_BEG crit_enter() +#define CRIT_END crit_exit() /* definitions for the STATUS indications L1 -> L2 -> L3 */ diff --git a/sys/net/i4b/layer1/ifpi/i4b_ifpi_l1.c b/sys/net/i4b/layer1/ifpi/i4b_ifpi_l1.c index f58f74faee..173d10491b 100644 --- a/sys/net/i4b/layer1/ifpi/i4b_ifpi_l1.c +++ b/sys/net/i4b/layer1/ifpi/i4b_ifpi_l1.c @@ -30,7 +30,7 @@ * $Id: i4b_ifpi_l1.c,v 1.4 2000/06/02 16:14:36 hm Exp $ * * $FreeBSD: src/sys/i4b/layer1/ifpi/i4b_ifpi_l1.c,v 1.4.2.1 2001/08/10 14:08:36 obrien Exp $ - * $DragonFly: src/sys/net/i4b/layer1/ifpi/i4b_ifpi_l1.c,v 1.4 2003/08/07 21:54:31 dillon Exp $ + * $DragonFly: src/sys/net/i4b/layer1/ifpi/i4b_ifpi_l1.c,v 1.5 2005/06/03 16:50:00 dillon Exp $ * * last edit-date: [Fri Jun 2 14:54:30 2000] * @@ -45,7 +45,7 @@ #include #include #include - +#include #include @@ -83,7 +83,6 @@ int ifpi_ph_data_req(int unit, struct mbuf *m, int freeflag) { u_char cmd; - int s; struct l1_softc *sc = ifpi_scp[unit]; #ifdef NOTDEF @@ -93,7 +92,7 @@ ifpi_ph_data_req(int unit, struct mbuf *m, int freeflag) if(m == NULL) /* failsafe */ return (0); - s = SPLI4B(); + crit_enter(); if(sc->sc_I430state == ST_F3) /* layer 1 not running ? */ { @@ -124,7 +123,7 @@ ifpi_ph_data_req(int unit, struct mbuf *m, int freeflag) MICROTIME(hdr.time); i4b_l1_trace_ind(&hdr, m->m_len, m->m_data); } - splx(s); + crit_exit(); return(1); } @@ -133,7 +132,7 @@ ifpi_ph_data_req(int unit, struct mbuf *m, int freeflag) if(freeflag == MBUF_FREE) i4b_Dfreembuf(m); - splx(s); + crit_exit(); return (0); } @@ -182,7 +181,7 @@ ifpi_ph_data_req(int unit, struct mbuf *m, int freeflag) ISAC_WRITE(I_CMDR, cmd); ISACCMDRWRDELAY(); - splx(s); + crit_exit(); return(1); } diff --git a/sys/net/i4b/layer1/ifpi/i4b_ifpi_l1fsm.c b/sys/net/i4b/layer1/ifpi/i4b_ifpi_l1fsm.c index 14cc775813..9b7cf7bcb5 100644 --- a/sys/net/i4b/layer1/ifpi/i4b_ifpi_l1fsm.c +++ b/sys/net/i4b/layer1/ifpi/i4b_ifpi_l1fsm.c @@ -30,7 +30,7 @@ * $Id: i4b_ifpi_l1fsm.c,v 1.4 2000/05/29 15:41:41 hm Exp $ * * $FreeBSD: src/sys/i4b/layer1/ifpi/i4b_ifpi_l1fsm.c,v 1.4.2.1 2001/08/10 14:08:37 obrien Exp $ - * $DragonFly: src/sys/net/i4b/layer1/ifpi/i4b_ifpi_l1fsm.c,v 1.5 2004/09/16 04:36:32 dillon Exp $ + * $DragonFly: src/sys/net/i4b/layer1/ifpi/i4b_ifpi_l1fsm.c,v 1.6 2005/06/03 16:50:00 dillon Exp $ * * last edit-date: [Mon May 29 15:23:15 2000] * @@ -45,6 +45,7 @@ #include #include #include +#include #include @@ -124,7 +125,7 @@ timer3_expired(struct l1_softc *sc) /*XXX*/ if(sc->sc_init_tries > 4) { - int s = SPLI4B(); + crit_enter(); sc->sc_init_tries = 0; @@ -142,7 +143,7 @@ timer3_expired(struct l1_softc *sc) sc->sc_ol = 0; } - splx(s); + crit_exit(); i4b_l1_mph_status_ind(L0IFPIUNIT(sc->sc_unit), STI_NOL1ACC, 0, NULL); } diff --git a/sys/net/i4b/layer1/ifpi/i4b_ifpi_pci.c b/sys/net/i4b/layer1/ifpi/i4b_ifpi_pci.c index bf254f4af7..feef4e6648 100644 --- a/sys/net/i4b/layer1/ifpi/i4b_ifpi_pci.c +++ b/sys/net/i4b/layer1/ifpi/i4b_ifpi_pci.c @@ -36,7 +36,7 @@ * $Id: i4b_ifpi_pci.c,v 1.4 2000/06/02 11:58:56 hm Exp $ * * $FreeBSD: src/sys/i4b/layer1/ifpi/i4b_ifpi_pci.c,v 1.6.2.1 2001/08/10 14:08:37 obrien Exp $ - * $DragonFly: src/sys/net/i4b/layer1/ifpi/i4b_ifpi_pci.c,v 1.9 2005/05/24 20:59:05 dillon Exp $ + * $DragonFly: src/sys/net/i4b/layer1/ifpi/i4b_ifpi_pci.c,v 1.10 2005/06/03 16:50:00 dillon Exp $ * * last edit-date: [Fri Jan 12 17:01:26 2001] * @@ -56,6 +56,7 @@ #include #include #include +#include #include #include @@ -491,7 +492,6 @@ avma1pp_attach_avma1pp(device_t dev) struct l1_softc *sc; u_int v; int unit, error = 0; - int s; u_int16_t did, vid; void *ih = 0; bus_space_handle_t bhandle; @@ -500,7 +500,7 @@ avma1pp_attach_avma1pp(device_t dev) l1_bchan_state_t *chan; #endif - s = splimp(); + crit_enter(); vid = pci_get_vendor(dev); did = pci_get_device(dev); @@ -511,7 +511,7 @@ avma1pp_attach_avma1pp(device_t dev) /* probably not really required */ if(unit > IFPI_MAXUNIT) { printf("avma1pp%d: Error, unit > IFPI_MAXUNIT!\n", unit); - splx(s); + crit_exit(); return(ENXIO); } @@ -696,7 +696,7 @@ avma1pp_attach_avma1pp(device_t dev) i4b_l1_mph_status_ind(L0IFPIUNIT(sc->sc_unit), STI_ATTACH, sc->sc_cardtyp, &avma1pp_l1mux_func); fail: - splx(s); + crit_exit(); return(error); } @@ -1119,7 +1119,7 @@ avma1pp_bchannel_setup(int unit, int h_chan, int bprot, int activate) #endif l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - int s = SPLI4B(); + crit_enter(); if(activate == 0) { @@ -1174,7 +1174,7 @@ avma1pp_bchannel_setup(int unit, int h_chan, int bprot, int activate) chan->state |= HSCX_AVMA1PP_ACTIVE; } - splx(s); + crit_exit(); } static void @@ -1186,13 +1186,12 @@ avma1pp_bchannel_start(int unit, int h_chan) struct l1_softc *sc = isic_find_sc(unit); #endif l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - int s; int activity = -1; - s = SPLI4B(); /* enter critical section */ + crit_enter(); if(chan->state & HSCX_TX_ACTIVE) /* already running ? */ { - splx(s); + crit_exit(); return; /* yes, leave */ } @@ -1202,7 +1201,7 @@ avma1pp_bchannel_start(int unit, int h_chan) if(chan->out_mbuf_head == NULL) /* queue empty ? */ { - splx(s); /* leave critical section */ + crit_exit(); return; /* yes, exit */ } @@ -1244,7 +1243,7 @@ avma1pp_bchannel_start(int unit, int h_chan) if(activity == ACT_RX || activity == ACT_TX) (*chan->isic_drvr_linktab->bch_activity)(chan->isic_drvr_linktab->unit, activity); - splx(s); + crit_exit(); } /*---------------------------------------------------------------------------* @@ -1340,9 +1339,8 @@ avma1pp_bchannel_stat(int unit, int h_chan, bchan_statistics_t *bsp) struct l1_softc *sc = isic_find_sc(unit); #endif l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - int s; - s = SPLI4B(); + crit_enter(); bsp->outbytes = chan->txcount; bsp->inbytes = chan->rxcount; @@ -1350,7 +1348,7 @@ avma1pp_bchannel_stat(int unit, int h_chan, bchan_statistics_t *bsp) chan->txcount = 0; chan->rxcount = 0; - splx(s); + crit_exit(); } /*---------------------------------------------------------------------------* diff --git a/sys/net/i4b/layer1/ifpi2/i4b_ifpi2_l1.c b/sys/net/i4b/layer1/ifpi2/i4b_ifpi2_l1.c index 206807b6f6..9fb6aec33c 100644 --- a/sys/net/i4b/layer1/ifpi2/i4b_ifpi2_l1.c +++ b/sys/net/i4b/layer1/ifpi2/i4b_ifpi2_l1.c @@ -31,7 +31,7 @@ * $Id$ * * $FreeBSD: src/sys/i4b/layer1/ifpi2/i4b_ifpi2_l1.c,v 1.2.2.1 2002/04/25 20:26:50 gj Exp $ - * $DragonFly: src/sys/net/i4b/layer1/ifpi2/i4b_ifpi2_l1.c,v 1.3 2003/08/07 21:17:25 dillon Exp $ + * $DragonFly: src/sys/net/i4b/layer1/ifpi2/i4b_ifpi2_l1.c,v 1.4 2005/06/03 16:50:02 dillon Exp $ * * last edit-date: [Fri Jun 2 14:54:30 2000] * @@ -46,7 +46,7 @@ #include #include #include - +#include #include @@ -84,7 +84,6 @@ int ifpi2_ph_data_req(int unit, struct mbuf *m, int freeflag) { u_char cmd; - int s; struct l1_softc *sc = ifpi2_scp[unit]; #ifdef NOTDEF @@ -94,7 +93,7 @@ ifpi2_ph_data_req(int unit, struct mbuf *m, int freeflag) if(m == NULL) /* failsafe */ return (0); - s = SPLI4B(); + crit_enter(); if(sc->sc_I430state == ST_F3) /* layer 1 not running ? */ { @@ -125,7 +124,7 @@ ifpi2_ph_data_req(int unit, struct mbuf *m, int freeflag) MICROTIME(hdr.time); i4b_l1_trace_ind(&hdr, m->m_len, m->m_data); } - splx(s); + crit_exit(); return(1); } @@ -134,7 +133,7 @@ ifpi2_ph_data_req(int unit, struct mbuf *m, int freeflag) if(freeflag == MBUF_FREE) i4b_Dfreembuf(m); - splx(s); + crit_exit(); return (0); } @@ -183,7 +182,7 @@ ifpi2_ph_data_req(int unit, struct mbuf *m, int freeflag) ISAC_WRITE(I_CMDR, cmd); ISACCMDRWRDELAY(); - splx(s); + crit_exit(); return(1); } diff --git a/sys/net/i4b/layer1/ifpi2/i4b_ifpi2_l1fsm.c b/sys/net/i4b/layer1/ifpi2/i4b_ifpi2_l1fsm.c index 7fd2e15402..2cbc0f465a 100644 --- a/sys/net/i4b/layer1/ifpi2/i4b_ifpi2_l1fsm.c +++ b/sys/net/i4b/layer1/ifpi2/i4b_ifpi2_l1fsm.c @@ -30,7 +30,7 @@ * $Id$ * * $FreeBSD: src/sys/i4b/layer1/ifpi2/i4b_ifpi2_l1fsm.c,v 1.1.2.1 2002/04/25 20:26:50 gj Exp $ - * $DragonFly: src/sys/net/i4b/layer1/ifpi2/i4b_ifpi2_l1fsm.c,v 1.4 2004/09/16 04:36:32 dillon Exp $ + * $DragonFly: src/sys/net/i4b/layer1/ifpi2/i4b_ifpi2_l1fsm.c,v 1.5 2005/06/03 16:50:02 dillon Exp $ * * last edit-date: [Mon May 29 15:23:15 2000] * @@ -45,7 +45,7 @@ #include #include #include - +#include #include @@ -124,7 +124,7 @@ timer3_expired(struct l1_softc *sc) /*XXX*/ if(sc->sc_init_tries > 4) { - int s = SPLI4B(); + crit_enter(); sc->sc_init_tries = 0; @@ -142,7 +142,7 @@ timer3_expired(struct l1_softc *sc) sc->sc_ol = 0; } - splx(s); + crit_exit(); i4b_l1_mph_status_ind(L0IFPI2UNIT(sc->sc_unit), STI_NOL1ACC, 0, NULL); } diff --git a/sys/net/i4b/layer1/ifpi2/i4b_ifpi2_pci.c b/sys/net/i4b/layer1/ifpi2/i4b_ifpi2_pci.c index 0a52e973e0..7705b56e2b 100644 --- a/sys/net/i4b/layer1/ifpi2/i4b_ifpi2_pci.c +++ b/sys/net/i4b/layer1/ifpi2/i4b_ifpi2_pci.c @@ -36,7 +36,7 @@ * $Id$ * * $FreeBSD: src/sys/i4b/layer1/ifpi2/i4b_ifpi2_pci.c,v 1.6.2.2 2002/05/15 08:12:42 gj Exp $ - * $DragonFly: src/sys/net/i4b/layer1/ifpi2/i4b_ifpi2_pci.c,v 1.8 2005/05/24 20:59:05 dillon Exp $ + * $DragonFly: src/sys/net/i4b/layer1/ifpi2/i4b_ifpi2_pci.c,v 1.9 2005/06/03 16:50:02 dillon Exp $ * * last edit-date: [Fri Jan 12 17:01:26 2001] * @@ -56,6 +56,7 @@ #include #include #include +#include #include #include @@ -447,7 +448,6 @@ avma1pp2_attach_avma1pp(device_t dev) struct l1_softc *sc; u_int v; int unit, error = 0; - int s; u_int16_t did, vid; void *ih = 0; bus_space_handle_t bhandle; @@ -456,7 +456,7 @@ avma1pp2_attach_avma1pp(device_t dev) l1_bchan_state_t *chan; #endif - s = splimp(); + crit_enter(); vid = pci_get_vendor(dev); did = pci_get_device(dev); @@ -467,7 +467,7 @@ avma1pp2_attach_avma1pp(device_t dev) /* probably not really required */ if(unit > IFPI2_MAXUNIT) { printf("ifpi2-%d: Error, unit > IFPI_MAXUNIT!\n", unit); - splx(s); + crit_exit(); return(ENXIO); } @@ -627,7 +627,7 @@ avma1pp2_attach_avma1pp(device_t dev) i4b_l1_mph_status_ind(L0IFPI2UNIT(sc->sc_unit), STI_ATTACH, sc->sc_cardtyp, &avma1pp2_l1mux_func); fail: - splx(s); + crit_exit(); return(error); } @@ -1060,7 +1060,7 @@ avma1pp2_bchannel_setup(int unit, int h_chan, int bprot, int activate) #endif l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - int s = SPLI4B(); + crit_enter(); if(activate == 0) { @@ -1115,7 +1115,7 @@ avma1pp2_bchannel_setup(int unit, int h_chan, int bprot, int activate) chan->state |= HSCX_AVMA1PP_ACTIVE; } - splx(s); + crit_exit(); } static void @@ -1127,13 +1127,12 @@ avma1pp2_bchannel_start(int unit, int h_chan) struct l1_softc *sc = isic_find_sc(unit); #endif l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - int s; int activity = -1; - s = SPLI4B(); /* enter critical section */ + crit_enter(); if(chan->state & HSCX_TX_ACTIVE) /* already running ? */ { - splx(s); + crit_exit(); return; /* yes, leave */ } @@ -1143,7 +1142,7 @@ avma1pp2_bchannel_start(int unit, int h_chan) if(chan->out_mbuf_head == NULL) /* queue empty ? */ { - splx(s); /* leave critical section */ + crit_exit(); return; /* yes, exit */ } @@ -1185,7 +1184,7 @@ avma1pp2_bchannel_start(int unit, int h_chan) if(activity == ACT_RX || activity == ACT_TX) (*chan->isic_drvr_linktab->bch_activity)(chan->isic_drvr_linktab->unit, activity); - splx(s); + crit_exit(); } /*---------------------------------------------------------------------------* @@ -1281,9 +1280,8 @@ avma1pp2_bchannel_stat(int unit, int h_chan, bchan_statistics_t *bsp) struct l1_softc *sc = isic_find_sc(unit); #endif l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - int s; - s = SPLI4B(); + crit_enter(); bsp->outbytes = chan->txcount; bsp->inbytes = chan->rxcount; @@ -1291,7 +1289,7 @@ avma1pp2_bchannel_stat(int unit, int h_chan, bchan_statistics_t *bsp) chan->txcount = 0; chan->rxcount = 0; - splx(s); + crit_exit(); } /*---------------------------------------------------------------------------* diff --git a/sys/net/i4b/layer1/ifpnp/i4b_ifpnp_avm.c b/sys/net/i4b/layer1/ifpnp/i4b_ifpnp_avm.c index 9a325334be..3d4de62cf2 100644 --- a/sys/net/i4b/layer1/ifpnp/i4b_ifpnp_avm.c +++ b/sys/net/i4b/layer1/ifpnp/i4b_ifpnp_avm.c @@ -34,7 +34,7 @@ * --------------------------------------------------- * * $FreeBSD: src/sys/i4b/layer1/ifpnp/i4b_ifpnp_avm.c,v 1.5.2.1 2001/08/10 14:08:37 obrien Exp $ - * $DragonFly: src/sys/net/i4b/layer1/ifpnp/i4b_ifpnp_avm.c,v 1.6 2005/05/24 20:59:05 dillon Exp $ + * $DragonFly: src/sys/net/i4b/layer1/ifpnp/i4b_ifpnp_avm.c,v 1.7 2005/06/03 16:50:03 dillon Exp $ * * last edit-date: [Fri Jan 12 17:05:28 2001] * @@ -57,6 +57,7 @@ #include #include +#include #include #include @@ -460,13 +461,12 @@ avm_pnp_attach(device_t dev) struct l1_softc *sc; u_int v; int unit, error = 0; - int s; u_int16_t vid; void *ih = 0; bus_space_handle_t bhandle; bus_space_tag_t btag; - s = splimp(); + crit_enter(); vid = isa_get_vendorid(dev); sc = device_get_softc(dev); @@ -476,7 +476,7 @@ avm_pnp_attach(device_t dev) /* probably not really required */ if(unit > IFPNP_MAXUNIT) { printf("avm_pnp%d: Error, unit > IFPNP_MAXUNIT!\n", unit); - splx(s); + crit_exit(); return(ENXIO); } @@ -621,7 +621,7 @@ avm_pnp_attach(device_t dev) i4b_l1_mph_status_ind(L0IFPNPUNIT(sc->sc_unit), STI_ATTACH, sc->sc_cardtyp, &avm_pnp_l1mux_func); fail: - splx(s); + crit_exit(); return(error); } @@ -1024,7 +1024,7 @@ avm_pnp_bchannel_setup(int unit, int h_chan, int bprot, int activate) struct l1_softc *sc = ifpnp_scp[unit]; l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - int s = SPLI4B(); + crit_enter(); if(activate == 0) { @@ -1086,7 +1086,7 @@ avm_pnp_bchannel_setup(int unit, int h_chan, int bprot, int activate) chan->state |= HSCX_AVMA1PP_ACTIVE; } - splx(s); + crit_exit(); } static void @@ -1094,13 +1094,12 @@ avm_pnp_bchannel_start(int unit, int h_chan) { struct l1_softc *sc = ifpnp_scp[unit]; l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - int s; int activity = -1; - s = SPLI4B(); /* enter critical section */ + crit_enter(); if(chan->state & HSCX_TX_ACTIVE) /* already running ? */ { - splx(s); + crit_exit(); return; /* yes, leave */ } @@ -1110,7 +1109,7 @@ avm_pnp_bchannel_start(int unit, int h_chan) if(chan->out_mbuf_head == NULL) /* queue empty ? */ { - splx(s); /* leave critical section */ + crit_exit(); return; /* yes, exit */ } @@ -1152,7 +1151,7 @@ avm_pnp_bchannel_start(int unit, int h_chan) if(activity == ACT_RX || activity == ACT_TX) (*chan->isic_drvr_linktab->bch_activity)(chan->isic_drvr_linktab->unit, activity); - splx(s); + crit_exit(); } /*---------------------------------------------------------------------------* @@ -1236,9 +1235,8 @@ avm_pnp_bchannel_stat(int unit, int h_chan, bchan_statistics_t *bsp) { struct l1_softc *sc = ifpnp_scp[unit]; l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - int s; - s = SPLI4B(); + crit_enter(); bsp->outbytes = chan->txcount; bsp->inbytes = chan->rxcount; @@ -1246,7 +1244,7 @@ avm_pnp_bchannel_stat(int unit, int h_chan, bchan_statistics_t *bsp) chan->txcount = 0; chan->rxcount = 0; - splx(s); + crit_exit(); } /*---------------------------------------------------------------------------* diff --git a/sys/net/i4b/layer1/ifpnp/i4b_ifpnp_l1.c b/sys/net/i4b/layer1/ifpnp/i4b_ifpnp_l1.c index 47da725e01..9743708848 100644 --- a/sys/net/i4b/layer1/ifpnp/i4b_ifpnp_l1.c +++ b/sys/net/i4b/layer1/ifpnp/i4b_ifpnp_l1.c @@ -31,7 +31,7 @@ * $Ust: src/i4b/layer1-nb/ifpnp/i4b_ifpnp_l1.c,v 1.4 2000/04/18 08:03:05 ust Exp $ * * $FreeBSD: src/sys/i4b/layer1/ifpnp/i4b_ifpnp_l1.c,v 1.4.2.1 2001/08/10 14:08:37 obrien Exp $ - * $DragonFly: src/sys/net/i4b/layer1/ifpnp/i4b_ifpnp_l1.c,v 1.3 2003/08/07 21:17:26 dillon Exp $ + * $DragonFly: src/sys/net/i4b/layer1/ifpnp/i4b_ifpnp_l1.c,v 1.4 2005/06/03 16:50:04 dillon Exp $ * * last edit-date: [Fri Jun 2 14:55:49 2000] * @@ -45,7 +45,7 @@ #include #include #include - +#include #include @@ -83,7 +83,6 @@ int ifpnp_ph_data_req(int unit, struct mbuf *m, int freeflag) { u_char cmd; - int s; struct l1_softc *sc = ifpnp_scp[unit]; #ifdef NOTDEF @@ -93,7 +92,7 @@ ifpnp_ph_data_req(int unit, struct mbuf *m, int freeflag) if(m == NULL) /* failsafe */ return (0); - s = SPLI4B(); + crit_enter(); if(sc->sc_I430state == ST_F3) /* layer 1 not running ? */ { @@ -124,7 +123,7 @@ ifpnp_ph_data_req(int unit, struct mbuf *m, int freeflag) MICROTIME(hdr.time); i4b_l1_trace_ind(&hdr, m->m_len, m->m_data); } - splx(s); + crit_exit(); return(1); } @@ -133,7 +132,7 @@ ifpnp_ph_data_req(int unit, struct mbuf *m, int freeflag) if(freeflag == MBUF_FREE) i4b_Dfreembuf(m); - splx(s); + crit_exit(); return (0); } @@ -182,7 +181,7 @@ ifpnp_ph_data_req(int unit, struct mbuf *m, int freeflag) ISAC_WRITE(I_CMDR, cmd); ISACCMDRWRDELAY(); - splx(s); + crit_exit(); return(1); } diff --git a/sys/net/i4b/layer1/ifpnp/i4b_ifpnp_l1fsm.c b/sys/net/i4b/layer1/ifpnp/i4b_ifpnp_l1fsm.c index 2177685381..723fdaf56d 100644 --- a/sys/net/i4b/layer1/ifpnp/i4b_ifpnp_l1fsm.c +++ b/sys/net/i4b/layer1/ifpnp/i4b_ifpnp_l1fsm.c @@ -31,7 +31,7 @@ * $Ust: src/i4b/layer1-nb/ifpnp/i4b_ifpnp_l1fsm.c,v 1.4 2000/04/18 08:03:05 ust Exp $ * * $FreeBSD: src/sys/i4b/layer1/ifpnp/i4b_ifpnp_l1fsm.c,v 1.4.2.1 2001/08/10 14:08:37 obrien Exp $ - * $DragonFly: src/sys/net/i4b/layer1/ifpnp/i4b_ifpnp_l1fsm.c,v 1.4 2004/09/16 04:36:32 dillon Exp $ + * $DragonFly: src/sys/net/i4b/layer1/ifpnp/i4b_ifpnp_l1fsm.c,v 1.5 2005/06/03 16:50:04 dillon Exp $ * * last edit-date: [Mon May 29 15:25:04 2000] * @@ -45,7 +45,7 @@ #include #include #include - +#include #include @@ -124,7 +124,7 @@ timer3_expired(struct l1_softc *sc) /*XXX*/ if(sc->sc_init_tries > 4) { - int s = SPLI4B(); + crit_enter(); sc->sc_init_tries = 0; @@ -142,7 +142,7 @@ timer3_expired(struct l1_softc *sc) sc->sc_ol = 0; } - splx(s); + crit_exit(); i4b_l1_mph_status_ind(L0IFPNPUNIT(sc->sc_unit), STI_NOL1ACC, 0, NULL); } diff --git a/sys/net/i4b/layer1/isic/i4b_bchan.c b/sys/net/i4b/layer1/isic/i4b_bchan.c index 0cae687af0..a8325ae246 100644 --- a/sys/net/i4b/layer1/isic/i4b_bchan.c +++ b/sys/net/i4b/layer1/isic/i4b_bchan.c @@ -28,7 +28,7 @@ * ---------------------------------------------- * * $FreeBSD: src/sys/i4b/layer1/isic/i4b_bchan.c,v 1.7.2.1 2001/08/10 14:08:38 obrien Exp $ - * $DragonFly: src/sys/net/i4b/layer1/isic/i4b_bchan.c,v 1.4 2003/08/07 21:17:26 dillon Exp $ + * $DragonFly: src/sys/net/i4b/layer1/isic/i4b_bchan.c,v 1.5 2005/06/03 16:50:05 dillon Exp $ * * last edit-date: [Wed Jan 24 09:07:12 2001] * @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -68,7 +69,7 @@ isic_bchannel_setup(int unit, int h_chan, int bprot, int activate) struct l1_softc *sc = &l1_sc[unit]; l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - int s = SPLI4B(); + crit_enter(); if(activate == 0) { @@ -129,7 +130,7 @@ isic_bchannel_setup(int unit, int h_chan, int bprot, int activate) isic_hscx_init(sc, h_chan, activate); } - splx(s); + crit_exit(); } /*---------------------------------------------------------------------------* @@ -142,15 +143,13 @@ isic_bchannel_start(int unit, int h_chan) l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; int next_len; int len; - - int s; int activity = -1; int cmd = 0; - s = SPLI4B(); /* enter critical section */ + crit_enter(); if(chan->state & HSCX_TX_ACTIVE) /* already running ? */ { - splx(s); + crit_exit(); return; /* yes, leave */ } @@ -160,7 +159,7 @@ isic_bchannel_start(int unit, int h_chan) if(chan->out_mbuf_head == NULL) /* queue empty ? */ { - splx(s); /* leave critical section */ + crit_exit(); return; /* yes, exit */ } @@ -311,7 +310,7 @@ isic_bchannel_start(int unit, int h_chan) if(cmd) isic_hscx_cmd(sc, h_chan, cmd); - splx(s); + crit_exit(); } /*---------------------------------------------------------------------------* @@ -322,9 +321,8 @@ isic_bchannel_stat(int unit, int h_chan, bchan_statistics_t *bsp) { struct l1_softc *sc = &l1_sc[unit]; l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - int s; - s = SPLI4B(); + crit_enter(); bsp->outbytes = chan->txcount; bsp->inbytes = chan->rxcount; @@ -332,7 +330,7 @@ isic_bchannel_stat(int unit, int h_chan, bchan_statistics_t *bsp) chan->txcount = 0; chan->rxcount = 0; - splx(s); + crit_exit(); } /*---------------------------------------------------------------------------* diff --git a/sys/net/i4b/layer1/isic/i4b_l1.c b/sys/net/i4b/layer1/isic/i4b_l1.c index 00e01518dc..c3da689536 100644 --- a/sys/net/i4b/layer1/isic/i4b_l1.c +++ b/sys/net/i4b/layer1/isic/i4b_l1.c @@ -28,7 +28,7 @@ * ----------------------------------- * * $FreeBSD: src/sys/i4b/layer1/isic/i4b_l1.c,v 1.5.2.1 2001/08/10 14:08:38 obrien Exp $ - * $DragonFly: src/sys/net/i4b/layer1/isic/i4b_l1.c,v 1.3 2003/08/07 21:17:26 dillon Exp $ + * $DragonFly: src/sys/net/i4b/layer1/isic/i4b_l1.c,v 1.4 2005/06/03 16:50:05 dillon Exp $ * * last edit-date: [Wed Jan 24 09:12:03 2001] * @@ -42,6 +42,7 @@ #include #include #include +#include #include @@ -77,7 +78,6 @@ int isic_ph_data_req(int unit, struct mbuf *m, int freeflag) { u_char cmd; - int s; struct l1_softc *sc = &l1_sc[unit]; #ifdef NOTDEF @@ -87,7 +87,7 @@ isic_ph_data_req(int unit, struct mbuf *m, int freeflag) if(m == NULL) /* failsafe */ return (0); - s = SPLI4B(); + crit_enter(); if(sc->sc_I430state == ST_F3) /* layer 1 not running ? */ { @@ -118,7 +118,7 @@ isic_ph_data_req(int unit, struct mbuf *m, int freeflag) MICROTIME(hdr.time); i4b_l1_trace_ind(&hdr, m->m_len, m->m_data); } - splx(s); + crit_exit(); return(1); } @@ -127,7 +127,7 @@ isic_ph_data_req(int unit, struct mbuf *m, int freeflag) if(freeflag == MBUF_FREE) i4b_Dfreembuf(m); - splx(s); + crit_exit(); return (0); } @@ -176,7 +176,7 @@ isic_ph_data_req(int unit, struct mbuf *m, int freeflag) ISAC_WRITE(I_CMDR, cmd); ISACCMDRWRDELAY(); - splx(s); + crit_exit(); return(1); } diff --git a/sys/net/i4b/layer1/isic/i4b_l1fsm.c b/sys/net/i4b/layer1/isic/i4b_l1fsm.c index 1c41b7b1b4..a92bf66bb6 100644 --- a/sys/net/i4b/layer1/isic/i4b_l1fsm.c +++ b/sys/net/i4b/layer1/isic/i4b_l1fsm.c @@ -28,7 +28,7 @@ * -------------------------------------------------- * * $FreeBSD: src/sys/i4b/layer1/isic/i4b_l1fsm.c,v 1.5.2.1 2001/08/10 14:08:38 obrien Exp $ - * $DragonFly: src/sys/net/i4b/layer1/isic/i4b_l1fsm.c,v 1.4 2004/09/16 04:36:32 dillon Exp $ + * $DragonFly: src/sys/net/i4b/layer1/isic/i4b_l1fsm.c,v 1.5 2005/06/03 16:50:05 dillon Exp $ * * last edit-date: [Wed Jan 24 09:12:18 2001] * @@ -42,6 +42,7 @@ #include #include #include +#include #include @@ -119,7 +120,7 @@ timer3_expired(struct l1_softc *sc) /*XXX*/ if(sc->sc_init_tries > 4) { - int s = SPLI4B(); + crit_enter(); sc->sc_init_tries = 0; @@ -137,7 +138,7 @@ timer3_expired(struct l1_softc *sc) sc->sc_ol = 0; } - splx(s); + crit_exit(); i4b_l1_mph_status_ind(L0ISICUNIT(sc->sc_unit), STI_NOL1ACC, 0, NULL); } diff --git a/sys/net/i4b/layer1/itjc/i4b_itjc_l1.c b/sys/net/i4b/layer1/itjc/i4b_itjc_l1.c index 15e7a8857e..9d52ea0c99 100644 --- a/sys/net/i4b/layer1/itjc/i4b_itjc_l1.c +++ b/sys/net/i4b/layer1/itjc/i4b_itjc_l1.c @@ -28,7 +28,7 @@ * --------------------------------------------- * * $FreeBSD: src/sys/i4b/layer1/itjc/i4b_itjc_l1.c,v 1.1.2.1 2001/08/10 14:08:39 obrien Exp $ - * $DragonFly: src/sys/net/i4b/layer1/itjc/i4b_itjc_l1.c,v 1.3 2003/08/07 21:17:28 dillon Exp $ + * $DragonFly: src/sys/net/i4b/layer1/itjc/i4b_itjc_l1.c,v 1.4 2005/06/03 16:50:07 dillon Exp $ * * last edit-date: [Wed Jan 10 17:16:19 2001] * @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -84,7 +85,6 @@ int itjc_ph_data_req(int unit, struct mbuf *m, int freeflag) { u_char cmd; - int s; struct l1_softc *sc = itjc_scp[unit]; NDBGL1(L1_PRIM, "PH-DATA-REQ, unit %d, freeflag=%d", unit, freeflag); @@ -92,7 +92,7 @@ itjc_ph_data_req(int unit, struct mbuf *m, int freeflag) if(m == NULL) /* failsafe */ return (0); - s = SPLI4B(); + crit_enter(); if(sc->sc_I430state == ST_F3) /* layer 1 not running ? */ { @@ -123,7 +123,7 @@ itjc_ph_data_req(int unit, struct mbuf *m, int freeflag) MICROTIME(hdr.time); i4b_l1_trace_ind(&hdr, m->m_len, m->m_data); } - splx(s); + crit_exit(); return(1); } @@ -132,7 +132,7 @@ itjc_ph_data_req(int unit, struct mbuf *m, int freeflag) if(freeflag == MBUF_FREE) i4b_Dfreembuf(m); - splx(s); + crit_exit(); return (0); } @@ -181,7 +181,7 @@ itjc_ph_data_req(int unit, struct mbuf *m, int freeflag) ISAC_WRITE(I_CMDR, cmd); ISACCMDRWRDELAY(); - splx(s); + crit_exit(); return(1); } diff --git a/sys/net/i4b/layer1/itjc/i4b_itjc_l1fsm.c b/sys/net/i4b/layer1/itjc/i4b_itjc_l1fsm.c index 825f5c276c..328bebd633 100644 --- a/sys/net/i4b/layer1/itjc/i4b_itjc_l1fsm.c +++ b/sys/net/i4b/layer1/itjc/i4b_itjc_l1fsm.c @@ -28,7 +28,7 @@ * ------------------------------------------------------------ * * $FreeBSD: src/sys/i4b/layer1/itjc/i4b_itjc_l1fsm.c,v 1.1.2.1 2001/08/10 14:08:39 obrien Exp $ - * $DragonFly: src/sys/net/i4b/layer1/itjc/i4b_itjc_l1fsm.c,v 1.4 2004/09/16 04:36:32 dillon Exp $ + * $DragonFly: src/sys/net/i4b/layer1/itjc/i4b_itjc_l1fsm.c,v 1.5 2005/06/03 16:50:07 dillon Exp $ * * last edit-date: [Wed Jan 10 17:16:33 2001] * @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -129,7 +130,7 @@ timer3_expired(struct l1_softc *sc) /*XXX*/ if(sc->sc_init_tries > 4) { - int s = SPLI4B(); + crit_enter(); sc->sc_init_tries = 0; @@ -147,7 +148,7 @@ timer3_expired(struct l1_softc *sc) sc->sc_ol = 0; } - splx(s); + crit_exit(); i4b_l1_mph_status_ind(L0ITJCUNIT(sc->sc_unit), STI_NOL1ACC, 0, NULL); } diff --git a/sys/net/i4b/layer1/itjc/i4b_itjc_pci.c b/sys/net/i4b/layer1/itjc/i4b_itjc_pci.c index 622d6953da..3316644c7d 100644 --- a/sys/net/i4b/layer1/itjc/i4b_itjc_pci.c +++ b/sys/net/i4b/layer1/itjc/i4b_itjc_pci.c @@ -34,7 +34,7 @@ * ---------------------------------------- * * $FreeBSD: src/sys/i4b/layer1/itjc/i4b_itjc_pci.c,v 1.1.2.1 2001/08/10 14:08:39 obrien Exp $ - * $DragonFly: src/sys/net/i4b/layer1/itjc/i4b_itjc_pci.c,v 1.10 2005/05/24 20:59:05 dillon Exp $ + * $DragonFly: src/sys/net/i4b/layer1/itjc/i4b_itjc_pci.c,v 1.11 2005/06/03 16:50:07 dillon Exp $ * * last edit-date: [Thu Jan 11 11:29:38 2001] * @@ -62,6 +62,7 @@ #include #include +#include #include #include @@ -640,8 +641,7 @@ itjc_bchannel_dma_setup(struct l1_softc *sc, int h_chan, int activate) *ring_end, *cp; - int s = SPLI4B(); - + crit_enter(); itjc_bus_setup(sc); if (activate) @@ -695,7 +695,7 @@ itjc_bchannel_dma_setup(struct l1_softc *sc, int h_chan, int activate) itjc_dma_stop(sc); } - splx(s); + crit_exit(); } @@ -1516,7 +1516,6 @@ itjc_attach(device_t dev) did = pci_get_device(dev); int unit = device_get_unit(dev), - s = splimp(), res_init_level = 0, error = 0; @@ -1524,13 +1523,14 @@ itjc_attach(device_t dev) dma_context_t *ctx = &dma_context[unit]; + crit_enter(); bzero(sc, sizeof(struct l1_softc)); /* Probably not really required. */ if (unit > ITJC_MAXUNIT) { printf("itjc%d: Error, unit > ITJC_MAXUNIT!\n", unit); - splx(s); + crit_exit(); return ENXIO; } @@ -1729,7 +1729,7 @@ itjc_attach(device_t dev) i4b_l1_mph_status_ind(L0ITJCUNIT(sc->sc_unit), STI_ATTACH, sc->sc_cardtyp, &itjc_l1mux_func); - splx(s); + crit_exit(); return 0; fail: @@ -1763,7 +1763,7 @@ itjc_attach(device_t dev) itjc_scp[unit] = NULL; - splx(s); + crit_exit(); return error; } @@ -1825,7 +1825,8 @@ itjc_bchannel_setup(int unit, int h_chan, int bprot, int activate) struct l1_softc *sc = isic_find_sc(unit); #endif l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - int s = SPLI4B(); + + crit_enter(); NDBGL1(L1_BCHAN, "unit=%d, channel=%d, %s", unit, h_chan, activate ? "activate" : "deactivate"); @@ -1881,7 +1882,7 @@ itjc_bchannel_setup(int unit, int h_chan, int bprot, int activate) if (activate) itjc_bchannel_dma_setup(sc, h_chan, activate); - splx(s); + crit_exit(); } @@ -1916,20 +1917,19 @@ itjc_bchannel_start(int unit, int h_chan) struct l1_softc *sc = isic_find_sc(unit); #endif l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - - int s = SPLI4B(); - dma_tx_context_t *txc = &dma_tx_context[unit][h_chan]; + crit_enter(); + if (chan->state & HSCX_TX_ACTIVE) { - splx(s); + crit_exit(); return; } itjc_dma_tx_intr(sc, chan, txc); - splx(s); + crit_exit(); #endif } @@ -2058,9 +2058,8 @@ itjc_bchannel_stat(int unit, int h_chan, bchan_statistics_t *bsp) struct l1_softc *sc = isic_find_sc(unit); #endif l1_bchan_state_t *chan = &sc->sc_chan[h_chan]; - int s; - s = SPLI4B(); + crit_enter(); bsp->outbytes = chan->txcount; bsp->inbytes = chan->rxcount; @@ -2068,7 +2067,7 @@ itjc_bchannel_stat(int unit, int h_chan, bchan_statistics_t *bsp) chan->txcount = 0; chan->rxcount = 0; - splx(s); + crit_exit(); } diff --git a/sys/net/i4b/layer1/iwic/i4b_iwic_bchan.c b/sys/net/i4b/layer1/iwic/i4b_iwic_bchan.c index 28dd06cace..d73f34913b 100644 --- a/sys/net/i4b/layer1/iwic/i4b_iwic_bchan.c +++ b/sys/net/i4b/layer1/iwic/i4b_iwic_bchan.c @@ -30,7 +30,7 @@ * ---------------------------------------- * * $FreeBSD: src/sys/i4b/layer1/iwic/i4b_iwic_bchan.c,v 1.7.2.1 2001/08/10 14:08:40 obrien Exp $ - * $DragonFly: src/sys/net/i4b/layer1/iwic/i4b_iwic_bchan.c,v 1.4 2003/08/07 21:17:28 dillon Exp $ + * $DragonFly: src/sys/net/i4b/layer1/iwic/i4b_iwic_bchan.c,v 1.5 2005/06/03 16:50:08 dillon Exp $ * * last edit-date: [Tue Jan 16 13:21:24 2001] * @@ -46,6 +46,7 @@ #include #include #include +#include #include @@ -415,7 +416,7 @@ iwic_bchannel_setup(int unit, int chan_no, int bprot, int activate) struct iwic_softc *sc = &iwic_sc[unit]; struct iwic_bchan *chan = &sc->sc_bchan[chan_no]; - int s = SPLI4B(); + crit_enter(); NDBGL1(L1_BCHAN, "unit %d, chan %d, bprot %d, activate %d", unit, chan_no, bprot, activate); @@ -473,7 +474,7 @@ iwic_bchannel_setup(int unit, int chan_no, int bprot, int activate) iwic_bchan_init(sc, chan_no, activate); } - splx(s); + crit_exit(); } /*---------------------------------------------------------------------------* @@ -534,18 +535,16 @@ iwic_bchannel_start(int unit, int chan_no) struct iwic_bchan *chan = &sc->sc_bchan[chan_no]; int next_len; int len; - - int s; int activity = -1; int cmd = 0; - s = SPLI4B(); /* enter critical section */ + crit_enter(); NDBGL1(L1_BCHAN, "unit %d, channel %d", unit, chan_no); if(chan->state & ST_TX_ACTIVE) /* already running ? */ { - splx(s); + crit_exit(); return; /* yes, leave */ } @@ -555,7 +554,7 @@ iwic_bchannel_start(int unit, int chan_no) if(chan->out_mbuf_head == NULL) /* queue empty ? */ { - splx(s); /* leave critical section */ + crit_exit(); return; /* yes, exit */ } @@ -695,7 +694,7 @@ iwic_bchannel_start(int unit, int chan_no) IWIC_WRITE(sc, chan->offset + B_CMDR, cmd); } - splx(s); + crit_exit(); } /*---------------------------------------------------------------------------* @@ -707,7 +706,7 @@ iwic_bchannel_stat(int unit, int chan_no, bchan_statistics_t *bsp) struct iwic_softc *sc = iwic_find_sc(unit); struct iwic_bchan *bchan = &sc->sc_bchan[chan_no]; - int s = SPLI4B(); + crit_enter(); bsp->outbytes = bchan->txcount; bsp->inbytes = bchan->rxcount; @@ -715,7 +714,7 @@ iwic_bchannel_stat(int unit, int chan_no, bchan_statistics_t *bsp) bchan->txcount = 0; bchan->rxcount = 0; - splx(s); + crit_exit(); } /*---------------------------------------------------------------------------* diff --git a/sys/net/i4b/layer1/iwic/i4b_iwic_dchan.c b/sys/net/i4b/layer1/iwic/i4b_iwic_dchan.c index 2cc4acba73..d45788f010 100644 --- a/sys/net/i4b/layer1/iwic/i4b_iwic_dchan.c +++ b/sys/net/i4b/layer1/iwic/i4b_iwic_dchan.c @@ -28,7 +28,7 @@ * ---------------------------------------- * * $FreeBSD: src/sys/i4b/layer1/iwic/i4b_iwic_dchan.c,v 1.4.2.1 2001/08/10 14:08:40 obrien Exp $ - * $DragonFly: src/sys/net/i4b/layer1/iwic/i4b_iwic_dchan.c,v 1.3 2003/08/07 21:17:28 dillon Exp $ + * $DragonFly: src/sys/net/i4b/layer1/iwic/i4b_iwic_dchan.c,v 1.4 2005/06/03 16:50:08 dillon Exp $ * * last edit-date: [Tue Jan 16 13:20:14 2001] * @@ -44,6 +44,7 @@ #include #include #include +#include #include @@ -227,9 +228,7 @@ iwic_dchan_xfer_irq(struct iwic_softc *sc, int ista) void iwic_dchan_disable(struct iwic_softc *sc) { - int s; - - s = SPLI4B(); + crit_enter(); if (sc->sc_dchan.obuf) { @@ -245,7 +244,7 @@ iwic_dchan_disable(struct iwic_softc *sc) sc->sc_dchan.obuf2 = NULL; } - splx(s); + crit_exit(); IWIC_WRITE(sc, CIX, CIX_DRC); } @@ -256,12 +255,10 @@ iwic_dchan_disable(struct iwic_softc *sc) int iwic_dchan_data_req(struct iwic_softc *sc, struct mbuf *m, int freeflag) { - int s; - if (!m) return 0; - s = SPLI4B(); + crit_enter(); /* Queue message */ @@ -287,7 +284,7 @@ iwic_dchan_data_req(struct iwic_softc *sc, struct mbuf *m, int freeflag) iwic_dchan_transmit(sc); - splx(s); + crit_exit(); return (0); } diff --git a/sys/net/i4b/layer2/i4b_iframe.c b/sys/net/i4b/layer2/i4b_iframe.c index 55bca7debb..661f83fb9d 100644 --- a/sys/net/i4b/layer2/i4b_iframe.c +++ b/sys/net/i4b/layer2/i4b_iframe.c @@ -30,7 +30,7 @@ * $Id: i4b_iframe.c,v 1.25 2000/08/24 11:48:57 hm Exp $ * * $FreeBSD: src/sys/i4b/layer2/i4b_iframe.c,v 1.6.2.1 2001/08/10 14:08:41 obrien Exp $ - * $DragonFly: src/sys/net/i4b/layer2/i4b_iframe.c,v 1.5 2004/09/16 04:36:32 dillon Exp $ + * $DragonFly: src/sys/net/i4b/layer2/i4b_iframe.c,v 1.6 2005/06/03 16:50:10 dillon Exp $ * * last edit-date: [Thu Aug 24 12:49:18 2000] * @@ -48,6 +48,7 @@ #include #include #include +#include #include #if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 diff --git a/sys/net/i4b/layer2/i4b_l2.c b/sys/net/i4b/layer2/i4b_l2.c index 28f86cc25c..0dbc327e54 100644 --- a/sys/net/i4b/layer2/i4b_l2.c +++ b/sys/net/i4b/layer2/i4b_l2.c @@ -28,7 +28,7 @@ * ------------------------------- * * $FreeBSD: src/sys/i4b/layer2/i4b_l2.c,v 1.6.2.1 2001/08/10 14:08:41 obrien Exp $ - * $DragonFly: src/sys/net/i4b/layer2/i4b_l2.c,v 1.6 2005/01/23 13:47:24 joerg Exp $ + * $DragonFly: src/sys/net/i4b/layer2/i4b_l2.c,v 1.7 2005/06/03 16:50:10 dillon Exp $ * * last edit-date: [Fri Jan 12 16:43:31 2001] * @@ -45,6 +45,7 @@ #include #include #include +#include #include #if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 diff --git a/sys/net/i4b/layer2/i4b_l2timer.c b/sys/net/i4b/layer2/i4b_l2timer.c index c4aa8be4b2..c7bc6118e7 100644 --- a/sys/net/i4b/layer2/i4b_l2timer.c +++ b/sys/net/i4b/layer2/i4b_l2timer.c @@ -30,7 +30,7 @@ * $Id: i4b_l2timer.c,v 1.20 2000/08/24 11:48:58 hm Exp $ * * $FreeBSD: src/sys/i4b/layer2/i4b_l2timer.c,v 1.6.2.1 2001/08/10 14:08:41 obrien Exp $ - * $DragonFly: src/sys/net/i4b/layer2/i4b_l2timer.c,v 1.5 2004/09/16 04:36:32 dillon Exp $ + * $DragonFly: src/sys/net/i4b/layer2/i4b_l2timer.c,v 1.6 2005/06/03 16:50:10 dillon Exp $ * * last edit-date: [Thu Aug 24 12:48:52 2000] * @@ -47,6 +47,7 @@ #include #include #include +#include #include #if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 diff --git a/sys/net/i4b/layer2/i4b_util.c b/sys/net/i4b/layer2/i4b_util.c index fad0f5a506..4e8d5bf5fa 100644 --- a/sys/net/i4b/layer2/i4b_util.c +++ b/sys/net/i4b/layer2/i4b_util.c @@ -30,7 +30,7 @@ * $Id: i4b_util.c,v 1.26 2000/08/24 11:48:58 hm Exp $ * * $FreeBSD: src/sys/i4b/layer2/i4b_util.c,v 1.6.2.1 2001/08/10 14:08:41 obrien Exp $ - * $DragonFly: src/sys/net/i4b/layer2/i4b_util.c,v 1.5 2005/01/23 13:47:24 joerg Exp $ + * $DragonFly: src/sys/net/i4b/layer2/i4b_util.c,v 1.6 2005/06/03 16:50:10 dillon Exp $ * * last edit-date: [Mon May 29 16:55:35 2000] * @@ -47,6 +47,7 @@ #include #include #include +#include #include #if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 diff --git a/sys/net/i4b/layer3/i4b_l3fsm.c b/sys/net/i4b/layer3/i4b_l3fsm.c index 0ae9043617..06631dabc1 100644 --- a/sys/net/i4b/layer3/i4b_l3fsm.c +++ b/sys/net/i4b/layer3/i4b_l3fsm.c @@ -30,7 +30,7 @@ * $Id: i4b_l3fsm.c,v 1.22 2000/08/24 11:48:58 hm Exp $ * * $FreeBSD: src/sys/i4b/layer3/i4b_l3fsm.c,v 1.6.2.1 2001/08/10 14:08:42 obrien Exp $ - * $DragonFly: src/sys/net/i4b/layer3/i4b_l3fsm.c,v 1.4 2004/02/13 17:45:50 joerg Exp $ + * $DragonFly: src/sys/net/i4b/layer3/i4b_l3fsm.c,v 1.5 2005/06/03 16:50:12 dillon Exp $ * * last edit-date: [Thu Oct 12 17:58:35 2000] * @@ -46,6 +46,7 @@ #include #include #include +#include #if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 #include @@ -281,23 +282,22 @@ char *print_l3state(call_desc_t *cd) *---------------------------------------------------------------------------*/ static void F_00A(call_desc_t *cd) { - int s; NDBGL3(L3_F_MSG, "FSM function F_00A executing"); cd->T303_first_to = 1; T303_start(cd); - s = SPLI4B(); + crit_enter(); if(i4b_get_dl_stat(cd) == DL_DOWN) { - splx(s); + crit_exit(); DL_Est_Req(ctrl_desc[cd->controller].unit); cd->Q931state = ST_OW; } else { cd->Q931state = ST_U1; - splx(s); + crit_exit(); i4b_l3_tx_setup(cd); } } @@ -552,11 +552,11 @@ static void F_06F(call_desc_t *cd) } else { - int s = SPLI4B(); + crit_enter(); i4b_l3_tx_release_complete(cd, 1); cd->Q931state = ST_U0; freecd_by_cd(cd); - splx(s); + crit_exit(); } } diff --git a/sys/net/i4b/layer3/i4b_l3timer.c b/sys/net/i4b/layer3/i4b_l3timer.c index 8076bb2591..9821898dd0 100644 --- a/sys/net/i4b/layer3/i4b_l3timer.c +++ b/sys/net/i4b/layer3/i4b_l3timer.c @@ -30,7 +30,7 @@ * $Id: i4b_l3timer.c,v 1.17 2000/08/24 11:48:58 hm Exp $ * * $FreeBSD: src/sys/i4b/layer3/i4b_l3timer.c,v 1.6.2.1 2001/08/10 14:08:42 obrien Exp $ - * $DragonFly: src/sys/net/i4b/layer3/i4b_l3timer.c,v 1.5 2004/09/16 04:36:32 dillon Exp $ + * $DragonFly: src/sys/net/i4b/layer3/i4b_l3timer.c,v 1.6 2005/06/03 16:50:12 dillon Exp $ * * last edit-date: [Thu Aug 24 12:49:50 2000] * @@ -46,6 +46,7 @@ #include #include #include +#include #include #if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 diff --git a/sys/net/i4b/layer3/i4b_q931.c b/sys/net/i4b/layer3/i4b_q931.c index 4002d3264f..f93908d54b 100644 --- a/sys/net/i4b/layer3/i4b_q931.c +++ b/sys/net/i4b/layer3/i4b_q931.c @@ -30,7 +30,7 @@ * $Id: i4b_q931.c,v 1.32 2000/08/24 11:48:58 hm Exp $ * * $FreeBSD: src/sys/i4b/layer3/i4b_q931.c,v 1.6.2.1 2001/08/10 14:08:42 obrien Exp $ - * $DragonFly: src/sys/net/i4b/layer3/i4b_q931.c,v 1.5 2004/02/16 20:48:33 dillon Exp $ + * $DragonFly: src/sys/net/i4b/layer3/i4b_q931.c,v 1.6 2005/06/03 16:50:12 dillon Exp $ * * last edit-date: [Mon May 29 16:56:52 2000] * @@ -47,6 +47,7 @@ #include #include #include +#include #if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 #include @@ -124,7 +125,6 @@ i4b_decode_q931(int unit, int msg_len, u_char *msg_ptr) int crflag = 0; int i; int offset; - int s; /* check protocol discriminator */ @@ -143,7 +143,7 @@ i4b_decode_q931(int unit, int msg_len, u_char *msg_ptr) msg_ptr++; msg_len--; - s = SPLI4B(); /* this has to be protected ! */ + crit_enter(); /* this has to be protected ! */ /* extract call reference */ @@ -196,12 +196,12 @@ i4b_decode_q931(int unit, int msg_len, u_char *msg_ptr) NDBGL3(L3_P_ERR, "cannot find calldescriptor for cr = 0x%x, crflag = 0x%x, msg = 0x%x, frame = ", crval, crflag, *msg_ptr); i4b_print_frame(msg_len, msg_ptr); } - splx(s); + crit_exit(); return; } } - splx(s); + crit_exit(); /* decode and handle message type */ diff --git a/sys/net/i4b/layer4/i4b_i4bdrv.c b/sys/net/i4b/layer4/i4b_i4bdrv.c index 75a9638d73..c92d31bc12 100644 --- a/sys/net/i4b/layer4/i4b_i4bdrv.c +++ b/sys/net/i4b/layer4/i4b_i4bdrv.c @@ -28,7 +28,7 @@ * -------------------------------------------- * * $FreeBSD: src/sys/i4b/layer4/i4b_i4bdrv.c,v 1.11.2.5 2001/12/16 15:12:59 hm Exp $ - * $DragonFly: src/sys/net/i4b/layer4/i4b_i4bdrv.c,v 1.11 2005/01/23 13:47:24 joerg Exp $ + * $DragonFly: src/sys/net/i4b/layer4/i4b_i4bdrv.c,v 1.12 2005/06/03 16:50:13 dillon Exp $ * * last edit-date: [Sat Aug 11 18:08:10 2001] * @@ -59,6 +59,7 @@ #include #include #include +#include #if defined(__FreeBSD__) && __FreeBSD_version >= 500014 #include #else @@ -281,18 +282,16 @@ i4battach() PDEVSTATIC int i4bopen(dev_t dev, int flag, int fmt, struct thread *td) { - int x; - if(minor(dev)) return(ENXIO); if(openflag) return(EBUSY); - x = splimp(); + crit_enter(); openflag = 1; i4b_l4_daemon_attached(); - splx(x); + crit_exit(); return(0); } @@ -303,11 +302,11 @@ i4bopen(dev_t dev, int flag, int fmt, struct thread *td) PDEVSTATIC int i4bclose(dev_t dev, int flag, int fmt, struct thread *td) { - int x = splimp(); + crit_enter(); openflag = 0; i4b_l4_daemon_detached(); i4b_Dcleanifq(&i4b_rdqueue); - splx(x); + crit_exit(); return(0); } @@ -318,13 +317,12 @@ PDEVSTATIC int i4bread(dev_t dev, struct uio *uio, int ioflag) { struct mbuf *m; - int x; int error = 0; if(minor(dev)) return(ENODEV); - x = splimp(); + crit_enter(); while(IF_QEMPTY(&i4b_rdqueue)) { readflag = 1; @@ -335,14 +333,14 @@ i4bread(dev_t dev, struct uio *uio, int ioflag) error = tsleep((caddr_t) &i4b_rdqueue, PCATCH, "bird", 0); #endif if (error != 0) { - splx(x); + crit_exit(); return error; } } IF_DEQUEUE(&i4b_rdqueue, m); - splx(x); + crit_exit(); if(m && m->m_len) error = uiomove(m->m_data, m->m_len, uio); @@ -636,7 +634,6 @@ i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) case I4B_TIMEOUT_UPD: { msg_timeout_upd_t *mtu; - int x; mtu = (msg_timeout_upd_t *)data; @@ -698,12 +695,12 @@ i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) if(error != 0) break; - x = SPLI4B(); + crit_enter(); cd->shorthold_data.shorthold_algorithm = mtu->shorthold_data.shorthold_algorithm; cd->shorthold_data.unitlen_time = mtu->shorthold_data.unitlen_time; cd->shorthold_data.idle_time = mtu->shorthold_data.idle_time; cd->shorthold_data.earlyhup_time = mtu->shorthold_data.earlyhup_time; - splx(x); + crit_exit(); break; } @@ -928,8 +925,6 @@ diag_done: PDEVSTATIC int i4bselect(dev_t dev, int rw, struct thread *td) { - int x; - if(minor(dev)) return(ENODEV); @@ -938,10 +933,10 @@ i4bselect(dev_t dev, int rw, struct thread *td) case FREAD: if(!IF_QEMPTY(&i4b_rdqueue)) return(1); - x = splimp(); + crit_enter(); selrecord(td, &select_rd_info); selflag = 1; - splx(x); + crit_exit(); return(0); break; @@ -960,8 +955,6 @@ i4bselect(dev_t dev, int rw, struct thread *td) PDEVSTATIC int i4bpoll(dev_t dev, int events, struct thread *td) { - int x; - if(minor(dev)) return(ENODEV); @@ -970,10 +963,10 @@ i4bpoll(dev_t dev, int events, struct thread *td) if(!IF_QEMPTY(&i4b_rdqueue)) return(1); - x = splimp(); + crit_enter(); selrecord(td, &select_rd_info); selflag = 1; - splx(x); + crit_exit(); return(0); } else if((events & POLLOUT) || (events & POLLWRNORM)) @@ -992,15 +985,13 @@ i4bpoll(dev_t dev, int events, struct thread *td) void i4bputqueue(struct mbuf *m) { - int x; - if(!openflag) { i4b_Dfreembuf(m); return; } - x = splimp(); + crit_enter(); if(IF_QFULL(&i4b_rdqueue)) { @@ -1012,7 +1003,7 @@ i4bputqueue(struct mbuf *m) IF_ENQUEUE(&i4b_rdqueue, m); - splx(x); + crit_exit(); if(readflag) { @@ -1033,15 +1024,13 @@ i4bputqueue(struct mbuf *m) void i4bputqueue_hipri(struct mbuf *m) { - int x; - if(!openflag) { i4b_Dfreembuf(m); return; } - x = splimp(); + crit_enter(); if(IF_QFULL(&i4b_rdqueue)) { @@ -1053,7 +1042,7 @@ i4bputqueue_hipri(struct mbuf *m) IF_PREPEND(&i4b_rdqueue, m); - splx(x); + crit_exit(); if(readflag) { diff --git a/sys/net/i4b/layer4/i4b_l4.c b/sys/net/i4b/layer4/i4b_l4.c index fa0d6e42bc..b0b692599f 100644 --- a/sys/net/i4b/layer4/i4b_l4.c +++ b/sys/net/i4b/layer4/i4b_l4.c @@ -30,7 +30,7 @@ * $Id: i4b_l4.c,v 1.54 2000/08/28 07:24:59 hm Exp $ * * $FreeBSD: src/sys/i4b/layer4/i4b_l4.c,v 1.6.2.2 2001/12/16 15:12:59 hm Exp $ - * $DragonFly: src/sys/net/i4b/layer4/i4b_l4.c,v 1.5 2004/09/16 04:36:32 dillon Exp $ + * $DragonFly: src/sys/net/i4b/layer4/i4b_l4.c,v 1.6 2005/06/03 16:50:13 dillon Exp $ * * last edit-date: [Sun Aug 27 14:53:42 2000] * @@ -45,6 +45,7 @@ #include #include #include +#include #ifdef __NetBSD__ #include @@ -416,10 +417,9 @@ i4b_l4_connect_ind(call_desc_t *cd) void i4b_l4_connect_active_ind(call_desc_t *cd) { - int s; struct mbuf *m; - s = SPLI4B(); + crit_enter(); cd->last_active_time = cd->connect_time = SECOND; @@ -431,7 +431,7 @@ i4b_l4_connect_active_ind(call_desc_t *cd) i4b_l4_setup_timeout(cd); - splx(s); + crit_exit(); if((m = i4b_Dgetmbuf(sizeof(msg_connect_active_ind_t))) != NULL) { @@ -935,12 +935,10 @@ i4b_l4_setup_timeout_var_unit(call_desc_t *cd) void i4b_idle_check(call_desc_t *cd) { - int s; - if(cd->cdid == CDID_UNUSED) return; - s = SPLI4B(); + crit_enter(); /* failsafe */ @@ -993,7 +991,7 @@ i4b_idle_check(call_desc_t *cd) break; } } - splx(s); + crit_exit(); } /*---------------------------------------------------------------------------* diff --git a/sys/net/i4b/layer4/i4b_l4mgmt.c b/sys/net/i4b/layer4/i4b_l4mgmt.c index a6c356b12e..37ce76187f 100644 --- a/sys/net/i4b/layer4/i4b_l4mgmt.c +++ b/sys/net/i4b/layer4/i4b_l4mgmt.c @@ -30,7 +30,7 @@ * $Id: i4b_l4mgmt.c,v 1.34 2000/09/01 14:11:51 hm Exp $ * * $FreeBSD: src/sys/i4b/layer4/i4b_l4mgmt.c,v 1.6.2.2 2001/08/10 14:08:43 obrien Exp $ - * $DragonFly: src/sys/net/i4b/layer4/i4b_l4mgmt.c,v 1.6 2004/09/16 04:36:32 dillon Exp $ + * $DragonFly: src/sys/net/i4b/layer4/i4b_l4mgmt.c,v 1.7 2005/06/03 16:50:13 dillon Exp $ * * last edit-date: [Fri Oct 13 15:58:34 2000] * @@ -43,6 +43,7 @@ #include #include #include +#include #if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 #include @@ -83,9 +84,8 @@ get_cdid(void) { static unsigned int cdid_count = 0; int i; - int x; - x = SPLI4B(); + crit_enter(); /* get next id */ @@ -108,7 +108,7 @@ again: } } - splx(x); + crit_exit(); return(cdid_count); } @@ -125,10 +125,9 @@ call_desc_t * reserve_cd(void) { call_desc_t *cd; - int x; int i; - x = SPLI4B(); + crit_enter(); cd = NULL; @@ -145,7 +144,7 @@ reserve_cd(void) } } - splx(x); + crit_exit(); if(cd == NULL) panic("reserve_cd: no free call descriptor available!"); @@ -167,7 +166,8 @@ void freecd_by_cd(call_desc_t *cd) { int i; - int x = SPLI4B(); + + crit_enter(); for(i=0; i < N_CALL_DESC; i++) { @@ -184,7 +184,7 @@ freecd_by_cd(call_desc_t *cd) if(i == N_CALL_DESC) panic("freecd_by_cd: ERROR, cd not found, cr = %d\n", cd->cr); - splx(x); + crit_exit(); } /*---------------------------------------------------------------------------* @@ -328,7 +328,7 @@ i4b_l4_daemon_attached(void) { int i; - int x = SPLI4B(); + crit_enter(); for(i=0; i < nctrl; i++) { @@ -338,7 +338,7 @@ i4b_l4_daemon_attached(void) (*ctrl_desc[i].N_MGMT_COMMAND)(ctrl_desc[i].unit, CMR_DOPEN, 0); } } - splx(x); + crit_exit(); } /*---------------------------------------------------------------------------* @@ -349,7 +349,7 @@ i4b_l4_daemon_detached(void) { int i; - int x = SPLI4B(); + crit_enter(); for(i=0; i < nctrl; i++) { @@ -359,7 +359,7 @@ i4b_l4_daemon_detached(void) (*ctrl_desc[i].N_MGMT_COMMAND)(ctrl_desc[i].unit, CMR_DCLOSE, 0); } } - splx(x); + crit_exit(); } #ifdef I4B_CD_DEBUG_PRINT diff --git a/sys/net/i4b/layer4/i4b_l4timer.c b/sys/net/i4b/layer4/i4b_l4timer.c index 51ea8b8550..1ff02c3f89 100644 --- a/sys/net/i4b/layer4/i4b_l4timer.c +++ b/sys/net/i4b/layer4/i4b_l4timer.c @@ -30,7 +30,7 @@ * $Id: i4b_l4timer.c,v 1.18 2000/08/24 11:48:58 hm Exp $ * * $FreeBSD: src/sys/i4b/layer4/i4b_l4timer.c,v 1.6.2.1 2001/08/10 14:08:43 obrien Exp $ - * $DragonFly: src/sys/net/i4b/layer4/i4b_l4timer.c,v 1.5 2004/09/16 04:36:32 dillon Exp $ + * $DragonFly: src/sys/net/i4b/layer4/i4b_l4timer.c,v 1.6 2005/06/03 16:50:13 dillon Exp $ * * last edit-date: [Thu Aug 24 12:50:17 2000] * @@ -43,6 +43,7 @@ #include #include #include +#include #if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000 #include -- 2.41.0