From 088be0f1b3a3259b7c44d73b40925a26e39f8428 Mon Sep 17 00:00:00 2001 From: bde Date: Tue, 11 Aug 1998 17:01:32 +0000 Subject: [PATCH] Register tty software interrupt handlers at run time using register_swi() instead of at compile time using ifdefs. Use _swi_null instead of dummycamisr. CAM and dpt should call register_swi() instead of hacking on ihandlers[] directly. --- sys/amd64/amd64/apic_vector.S | 4 ++-- sys/amd64/isa/atpic_vector.S | 4 ++-- sys/amd64/isa/icu_vector.S | 4 ++-- sys/amd64/isa/icu_vector.s | 4 ++-- sys/dev/cy/cy.c | 26 +++++++++++--------------- sys/dev/cy/cy_isa.c | 26 +++++++++++--------------- sys/dev/rc/rc.c | 19 +++++++------------ sys/dev/sio/sio.c | 25 ++++++++++--------------- sys/i386/i386/apic_vector.s | 4 ++-- sys/i386/isa/apic_vector.s | 4 ++-- sys/i386/isa/atpic_vector.s | 4 ++-- sys/i386/isa/cy.c | 26 +++++++++++--------------- sys/i386/isa/icu_vector.s | 4 ++-- sys/i386/isa/ipl.s | 29 +---------------------------- sys/i386/isa/rc.c | 19 +++++++------------ sys/i386/isa/sio.c | 25 ++++++++++--------------- sys/isa/sio.c | 25 ++++++++++--------------- 17 files changed, 94 insertions(+), 158 deletions(-) diff --git a/sys/amd64/amd64/apic_vector.S b/sys/amd64/amd64/apic_vector.S index 2db57dadd3a9..1a70f1d535a1 100644 --- a/sys/amd64/amd64/apic_vector.S +++ b/sys/amd64/amd64/apic_vector.S @@ -1,6 +1,6 @@ /* * from: vector.s, 386BSD 0.1 unknown origin - * $Id: apic_vector.s,v 1.30 1998/05/17 22:12:04 tegge Exp $ + * $Id: apic_vector.s,v 1.31 1998/08/11 15:08:12 bde Exp $ */ @@ -938,7 +938,7 @@ _ihandlers: * ipl.s: doreti_unpend * apic_ipl.s: splz_unpend */ - .long swi_tty, swi_net, dummycamisr, dummycamisr + .long _swi_null, swi_net, _swi_null, _swi_null .long _swi_vm, _swi_null, _softclock, swi_ast imasks: /* masks for interrupt handlers */ diff --git a/sys/amd64/isa/atpic_vector.S b/sys/amd64/isa/atpic_vector.S index 47560380bd72..042614b829e2 100644 --- a/sys/amd64/isa/atpic_vector.S +++ b/sys/amd64/isa/atpic_vector.S @@ -1,6 +1,6 @@ /* * from: vector.s, 386BSD 0.1 unknown origin - * $Id: icu_vector.s,v 1.7 1998/01/15 07:33:59 gibbs Exp $ + * $Id: icu_vector.s,v 1.8 1998/08/11 15:08:12 bde Exp $ */ /* @@ -201,7 +201,7 @@ _ihandlers: /* addresses of interrupt handlers */ .long Xresume4, Xresume5, Xresume6, Xresume7 .long Xresume8, Xresume9, Xresume10, Xresume11 .long Xresume12, Xresume13, Xresume14, Xresume15 - .long swi_tty, swi_net, dummycamisr, dummycamisr + .long _swi_null, swi_net, _swi_null, _swi_null .long _swi_vm, _swi_null, _swi_null, _swi_null .long _swi_null, _swi_null, _swi_null, _swi_null .long _swi_null, _swi_null, _softclock, swi_ast diff --git a/sys/amd64/isa/icu_vector.S b/sys/amd64/isa/icu_vector.S index 47560380bd72..042614b829e2 100644 --- a/sys/amd64/isa/icu_vector.S +++ b/sys/amd64/isa/icu_vector.S @@ -1,6 +1,6 @@ /* * from: vector.s, 386BSD 0.1 unknown origin - * $Id: icu_vector.s,v 1.7 1998/01/15 07:33:59 gibbs Exp $ + * $Id: icu_vector.s,v 1.8 1998/08/11 15:08:12 bde Exp $ */ /* @@ -201,7 +201,7 @@ _ihandlers: /* addresses of interrupt handlers */ .long Xresume4, Xresume5, Xresume6, Xresume7 .long Xresume8, Xresume9, Xresume10, Xresume11 .long Xresume12, Xresume13, Xresume14, Xresume15 - .long swi_tty, swi_net, dummycamisr, dummycamisr + .long _swi_null, swi_net, _swi_null, _swi_null .long _swi_vm, _swi_null, _swi_null, _swi_null .long _swi_null, _swi_null, _swi_null, _swi_null .long _swi_null, _swi_null, _softclock, swi_ast diff --git a/sys/amd64/isa/icu_vector.s b/sys/amd64/isa/icu_vector.s index 47560380bd72..042614b829e2 100644 --- a/sys/amd64/isa/icu_vector.s +++ b/sys/amd64/isa/icu_vector.s @@ -1,6 +1,6 @@ /* * from: vector.s, 386BSD 0.1 unknown origin - * $Id: icu_vector.s,v 1.7 1998/01/15 07:33:59 gibbs Exp $ + * $Id: icu_vector.s,v 1.8 1998/08/11 15:08:12 bde Exp $ */ /* @@ -201,7 +201,7 @@ _ihandlers: /* addresses of interrupt handlers */ .long Xresume4, Xresume5, Xresume6, Xresume7 .long Xresume8, Xresume9, Xresume10, Xresume11 .long Xresume12, Xresume13, Xresume14, Xresume15 - .long swi_tty, swi_net, dummycamisr, dummycamisr + .long _swi_null, swi_net, _swi_null, _swi_null .long _swi_vm, _swi_null, _swi_null, _swi_null .long _swi_null, _swi_null, _swi_null, _swi_null .long _swi_null, _swi_null, _softclock, swi_ast diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c index 38bac420bc58..afeeb5227641 100644 --- a/sys/dev/cy/cy.c +++ b/sys/dev/cy/cy.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cy.c,v 1.64 1998/07/15 12:18:12 bde Exp $ + * $Id: cy.c,v 1.65 1998/07/29 18:48:20 bde Exp $ */ #include "opt_compat.h" @@ -78,6 +78,7 @@ #include #include #include +#include #include #include #include @@ -86,6 +87,7 @@ #endif #include +#include #include #include @@ -118,6 +120,7 @@ #define comhardclose cyhardclose #define commctl cymctl #define comparam cyparam +#define siopoll_registered cypoll_registered #define comspeed cyspeed #define comstart cystart #define comwakeup cywakeup @@ -325,19 +328,6 @@ struct com_s { #endif }; -/* - * XXX public functions in drivers should be declared in headers produced - * by `config', not here. - */ - -/* Interrupt handling entry point. */ -void siopoll __P((void)); - -/* Device switch entry points. */ -#define sioreset noreset -#define siommap nommap -#define siostrategy nostrategy - /* PCI driver entry point. */ int cyattach_common __P((cy_addr cy_iobase, int cy_align)); @@ -351,6 +341,7 @@ static void siointr1 __P((struct com_s *com)); #endif static int commctl __P((struct com_s *com, int bits, int how)); static int comparam __P((struct tty *tp, struct termios *t)); +static swihand_t siopoll; static int sioprobe __P((struct isa_device *dev)); static void siosettimeout __P((void)); static int comspeed __P((speed_t speed, int *prescaler_io)); @@ -392,6 +383,7 @@ static struct cdevsw sio_cdevsw = { static int comconsole = -1; static speed_t comdefaultrate = TTYDEF_SPEED; static u_int com_events; /* input chars + weighted output completions */ +static bool_t siopoll_registered; static int sio_timeout; static int sio_timeouts_until_log; static struct callout_handle sio_timeout_handle @@ -622,6 +614,10 @@ cyattach_common(cy_iobase, cy_align) #endif } } + if (!siopoll_registered) { + register_swi(SWI_TTY, siopoll); + siopoll_registered = TRUE; + } /* ensure an edge for the next interrupt */ cd_outb(cy_iobase, CY_CLEAR_INTR, cy_align, 0); @@ -1538,7 +1534,7 @@ sioioctl(dev, cmd, data, flag, p) return (0); } -void +static void siopoll() { int unit; diff --git a/sys/dev/cy/cy_isa.c b/sys/dev/cy/cy_isa.c index 38bac420bc58..afeeb5227641 100644 --- a/sys/dev/cy/cy_isa.c +++ b/sys/dev/cy/cy_isa.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cy.c,v 1.64 1998/07/15 12:18:12 bde Exp $ + * $Id: cy.c,v 1.65 1998/07/29 18:48:20 bde Exp $ */ #include "opt_compat.h" @@ -78,6 +78,7 @@ #include #include #include +#include #include #include #include @@ -86,6 +87,7 @@ #endif #include +#include #include #include @@ -118,6 +120,7 @@ #define comhardclose cyhardclose #define commctl cymctl #define comparam cyparam +#define siopoll_registered cypoll_registered #define comspeed cyspeed #define comstart cystart #define comwakeup cywakeup @@ -325,19 +328,6 @@ struct com_s { #endif }; -/* - * XXX public functions in drivers should be declared in headers produced - * by `config', not here. - */ - -/* Interrupt handling entry point. */ -void siopoll __P((void)); - -/* Device switch entry points. */ -#define sioreset noreset -#define siommap nommap -#define siostrategy nostrategy - /* PCI driver entry point. */ int cyattach_common __P((cy_addr cy_iobase, int cy_align)); @@ -351,6 +341,7 @@ static void siointr1 __P((struct com_s *com)); #endif static int commctl __P((struct com_s *com, int bits, int how)); static int comparam __P((struct tty *tp, struct termios *t)); +static swihand_t siopoll; static int sioprobe __P((struct isa_device *dev)); static void siosettimeout __P((void)); static int comspeed __P((speed_t speed, int *prescaler_io)); @@ -392,6 +383,7 @@ static struct cdevsw sio_cdevsw = { static int comconsole = -1; static speed_t comdefaultrate = TTYDEF_SPEED; static u_int com_events; /* input chars + weighted output completions */ +static bool_t siopoll_registered; static int sio_timeout; static int sio_timeouts_until_log; static struct callout_handle sio_timeout_handle @@ -622,6 +614,10 @@ cyattach_common(cy_iobase, cy_align) #endif } } + if (!siopoll_registered) { + register_swi(SWI_TTY, siopoll); + siopoll_registered = TRUE; + } /* ensure an edge for the next interrupt */ cd_outb(cy_iobase, CY_CLEAR_INTR, cy_align, 0); @@ -1538,7 +1534,7 @@ sioioctl(dev, cmd, data, flag, p) return (0); } -void +static void siopoll() { int unit; diff --git a/sys/dev/rc/rc.c b/sys/dev/rc/rc.c index 24e73433d36f..021f089cea73 100644 --- a/sys/dev/rc/rc.c +++ b/sys/dev/rc/rc.c @@ -45,12 +45,14 @@ #include #include #include +#include #include #ifdef DEVFS #include #endif /*DEVFS*/ #include +#include #include @@ -62,15 +64,6 @@ static int rcprobe __P((struct isa_device *)); static int rcattach __P((struct isa_device *)); -/*- - * This space intentionally left blank to stop __LINE__ from screwing up - * regression tests :-(. - * - * - * - */ -void rcpoll __P((void)); - #define rcin(port) RC_IN (nec, port) #define rcout(port,v) RC_OUT (nec, port, v) @@ -183,6 +176,7 @@ static void rc_hardclose __P((struct rc_chans *)); static int rc_modctl __P((struct rc_chans *, int, int)); static void rc_start __P((struct tty *)); static int rc_param __P((struct tty *, struct termios *)); +static swihand_t rcpoll; static void rc_reinit __P((struct rc_softc *)); #ifdef RCDEBUG static void printrcflags(); @@ -231,7 +225,7 @@ rcattach(dvp) register int chan, nec = dvp->id_iobase; struct rc_softc *rcb = &rc_softc[dvp->id_unit]; struct rc_chans *rc = &rc_chans[dvp->id_unit * CD180_NCHAN]; - static int rc_wakeup_started = 0; + static int rc_started = 0; struct tty *tp; /* Thorooughly test the device */ @@ -271,9 +265,10 @@ rcattach(dvp) #endif } rcb->rcb_probed = RC_ATTACHED; - if (!rc_wakeup_started) { + if (!rc_started) { + register_swi(SWI_TTY, rcpoll); rc_wakeup((void *)NULL); - rc_wakeup_started = 1; + rc_started = 0; } return 1; } diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 5a7c340cab8c..de9407bcd36e 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.208 1998/06/24 09:23:32 phk Exp $ + * $Id: sio.c,v 1.209 1998/07/15 12:18:14 bde Exp $ */ #include "opt_comconsole.h" @@ -70,6 +70,7 @@ #include #include #include +#include #include #include #include @@ -78,6 +79,7 @@ #endif #include +#include #include #include @@ -301,19 +303,6 @@ struct com_s { #endif }; -/* - * XXX public functions in drivers should be declared in headers produced - * by `config', not here. - */ - -/* Interrupt handling entry point. */ -void siopoll __P((void)); - -/* Device switch entry points. */ -#define sioreset noreset -#define siommap nommap -#define siostrategy nostrategy - #ifdef COM_ESP static int espattach __P((struct isa_device *isdp, struct com_s *com, Port_t esp_port)); @@ -325,6 +314,7 @@ static void comhardclose __P((struct com_s *com)); static void siointr1 __P((struct com_s *com)); static int commctl __P((struct com_s *com, int bits, int how)); static int comparam __P((struct tty *tp, struct termios *t)); +static swihand_t siopoll; static int sioprobe __P((struct isa_device *dev)); static void siosettimeout __P((void)); static void comstart __P((struct tty *tp)); @@ -366,6 +356,7 @@ static int comconsole = -1; static volatile speed_t comdefaultrate = CONSPEED; static u_int com_events; /* input chars + weighted output completions */ static Port_t siocniobase; +static bool_t siopoll_registered; static int sio_timeout; static int sio_timeouts_until_log; static struct callout_handle sio_timeout_handle @@ -1102,6 +1093,10 @@ determined_type: ; unit | CALLOUT_MASK | CONTROL_LOCK_STATE, DV_CHR, UID_UUCP, GID_DIALER, 0660, "cuala%r", unit); #endif + if (!siopoll_registered) { + register_swi(SWI_TTY, siopoll); + siopoll_registered = TRUE; + } com->id_flags = isdp->id_flags; /* Heritate id_flags for later */ return (1); } @@ -1877,7 +1872,7 @@ sioioctl(dev, cmd, data, flag, p) return (0); } -void +static void siopoll() { int unit; diff --git a/sys/i386/i386/apic_vector.s b/sys/i386/i386/apic_vector.s index 2db57dadd3a9..1a70f1d535a1 100644 --- a/sys/i386/i386/apic_vector.s +++ b/sys/i386/i386/apic_vector.s @@ -1,6 +1,6 @@ /* * from: vector.s, 386BSD 0.1 unknown origin - * $Id: apic_vector.s,v 1.30 1998/05/17 22:12:04 tegge Exp $ + * $Id: apic_vector.s,v 1.31 1998/08/11 15:08:12 bde Exp $ */ @@ -938,7 +938,7 @@ _ihandlers: * ipl.s: doreti_unpend * apic_ipl.s: splz_unpend */ - .long swi_tty, swi_net, dummycamisr, dummycamisr + .long _swi_null, swi_net, _swi_null, _swi_null .long _swi_vm, _swi_null, _softclock, swi_ast imasks: /* masks for interrupt handlers */ diff --git a/sys/i386/isa/apic_vector.s b/sys/i386/isa/apic_vector.s index 2db57dadd3a9..1a70f1d535a1 100644 --- a/sys/i386/isa/apic_vector.s +++ b/sys/i386/isa/apic_vector.s @@ -1,6 +1,6 @@ /* * from: vector.s, 386BSD 0.1 unknown origin - * $Id: apic_vector.s,v 1.30 1998/05/17 22:12:04 tegge Exp $ + * $Id: apic_vector.s,v 1.31 1998/08/11 15:08:12 bde Exp $ */ @@ -938,7 +938,7 @@ _ihandlers: * ipl.s: doreti_unpend * apic_ipl.s: splz_unpend */ - .long swi_tty, swi_net, dummycamisr, dummycamisr + .long _swi_null, swi_net, _swi_null, _swi_null .long _swi_vm, _swi_null, _softclock, swi_ast imasks: /* masks for interrupt handlers */ diff --git a/sys/i386/isa/atpic_vector.s b/sys/i386/isa/atpic_vector.s index 47560380bd72..042614b829e2 100644 --- a/sys/i386/isa/atpic_vector.s +++ b/sys/i386/isa/atpic_vector.s @@ -1,6 +1,6 @@ /* * from: vector.s, 386BSD 0.1 unknown origin - * $Id: icu_vector.s,v 1.7 1998/01/15 07:33:59 gibbs Exp $ + * $Id: icu_vector.s,v 1.8 1998/08/11 15:08:12 bde Exp $ */ /* @@ -201,7 +201,7 @@ _ihandlers: /* addresses of interrupt handlers */ .long Xresume4, Xresume5, Xresume6, Xresume7 .long Xresume8, Xresume9, Xresume10, Xresume11 .long Xresume12, Xresume13, Xresume14, Xresume15 - .long swi_tty, swi_net, dummycamisr, dummycamisr + .long _swi_null, swi_net, _swi_null, _swi_null .long _swi_vm, _swi_null, _swi_null, _swi_null .long _swi_null, _swi_null, _swi_null, _swi_null .long _swi_null, _swi_null, _softclock, swi_ast diff --git a/sys/i386/isa/cy.c b/sys/i386/isa/cy.c index 38bac420bc58..afeeb5227641 100644 --- a/sys/i386/isa/cy.c +++ b/sys/i386/isa/cy.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cy.c,v 1.64 1998/07/15 12:18:12 bde Exp $ + * $Id: cy.c,v 1.65 1998/07/29 18:48:20 bde Exp $ */ #include "opt_compat.h" @@ -78,6 +78,7 @@ #include #include #include +#include #include #include #include @@ -86,6 +87,7 @@ #endif #include +#include #include #include @@ -118,6 +120,7 @@ #define comhardclose cyhardclose #define commctl cymctl #define comparam cyparam +#define siopoll_registered cypoll_registered #define comspeed cyspeed #define comstart cystart #define comwakeup cywakeup @@ -325,19 +328,6 @@ struct com_s { #endif }; -/* - * XXX public functions in drivers should be declared in headers produced - * by `config', not here. - */ - -/* Interrupt handling entry point. */ -void siopoll __P((void)); - -/* Device switch entry points. */ -#define sioreset noreset -#define siommap nommap -#define siostrategy nostrategy - /* PCI driver entry point. */ int cyattach_common __P((cy_addr cy_iobase, int cy_align)); @@ -351,6 +341,7 @@ static void siointr1 __P((struct com_s *com)); #endif static int commctl __P((struct com_s *com, int bits, int how)); static int comparam __P((struct tty *tp, struct termios *t)); +static swihand_t siopoll; static int sioprobe __P((struct isa_device *dev)); static void siosettimeout __P((void)); static int comspeed __P((speed_t speed, int *prescaler_io)); @@ -392,6 +383,7 @@ static struct cdevsw sio_cdevsw = { static int comconsole = -1; static speed_t comdefaultrate = TTYDEF_SPEED; static u_int com_events; /* input chars + weighted output completions */ +static bool_t siopoll_registered; static int sio_timeout; static int sio_timeouts_until_log; static struct callout_handle sio_timeout_handle @@ -622,6 +614,10 @@ cyattach_common(cy_iobase, cy_align) #endif } } + if (!siopoll_registered) { + register_swi(SWI_TTY, siopoll); + siopoll_registered = TRUE; + } /* ensure an edge for the next interrupt */ cd_outb(cy_iobase, CY_CLEAR_INTR, cy_align, 0); @@ -1538,7 +1534,7 @@ sioioctl(dev, cmd, data, flag, p) return (0); } -void +static void siopoll() { int unit; diff --git a/sys/i386/isa/icu_vector.s b/sys/i386/isa/icu_vector.s index 47560380bd72..042614b829e2 100644 --- a/sys/i386/isa/icu_vector.s +++ b/sys/i386/isa/icu_vector.s @@ -1,6 +1,6 @@ /* * from: vector.s, 386BSD 0.1 unknown origin - * $Id: icu_vector.s,v 1.7 1998/01/15 07:33:59 gibbs Exp $ + * $Id: icu_vector.s,v 1.8 1998/08/11 15:08:12 bde Exp $ */ /* @@ -201,7 +201,7 @@ _ihandlers: /* addresses of interrupt handlers */ .long Xresume4, Xresume5, Xresume6, Xresume7 .long Xresume8, Xresume9, Xresume10, Xresume11 .long Xresume12, Xresume13, Xresume14, Xresume15 - .long swi_tty, swi_net, dummycamisr, dummycamisr + .long _swi_null, swi_net, _swi_null, _swi_null .long _swi_vm, _swi_null, _swi_null, _swi_null .long _swi_null, _swi_null, _swi_null, _swi_null .long _swi_null, _swi_null, _softclock, swi_ast diff --git a/sys/i386/isa/ipl.s b/sys/i386/isa/ipl.s index e6f4eb0829e3..836ac4806623 100644 --- a/sys/i386/isa/ipl.s +++ b/sys/i386/isa/ipl.s @@ -36,7 +36,7 @@ * * @(#)ipl.s * - * $Id: ipl.s,v 1.22 1998/07/27 16:51:33 jlemon Exp $ + * $Id: ipl.s,v 1.23 1998/08/11 15:08:12 bde Exp $ */ @@ -405,33 +405,6 @@ dummynetisr: MCOUNT ret - ALIGN_TEXT -dummycamisr: - MCOUNT - ret - -/* - * This function will go away soon when register_swi() is used to register - * the poll functions. - */ - ALIGN_TEXT -swi_tty: - MCOUNT -#include "cy.h" -#if NCY > 0 - call _cypoll -#endif -#include "rc.h" -#if NRC > 0 - call _rcpoll -#endif -#include "sio.h" -#if NSIO > 0 - jmp _siopoll -#else - ret -#endif - /* * The arg is in a nonstandard place, so swi_dispatcher() can't be called * directly and swi_generic() can't use ENTRY() or MCOUNT. diff --git a/sys/i386/isa/rc.c b/sys/i386/isa/rc.c index 24e73433d36f..021f089cea73 100644 --- a/sys/i386/isa/rc.c +++ b/sys/i386/isa/rc.c @@ -45,12 +45,14 @@ #include #include #include +#include #include #ifdef DEVFS #include #endif /*DEVFS*/ #include +#include #include @@ -62,15 +64,6 @@ static int rcprobe __P((struct isa_device *)); static int rcattach __P((struct isa_device *)); -/*- - * This space intentionally left blank to stop __LINE__ from screwing up - * regression tests :-(. - * - * - * - */ -void rcpoll __P((void)); - #define rcin(port) RC_IN (nec, port) #define rcout(port,v) RC_OUT (nec, port, v) @@ -183,6 +176,7 @@ static void rc_hardclose __P((struct rc_chans *)); static int rc_modctl __P((struct rc_chans *, int, int)); static void rc_start __P((struct tty *)); static int rc_param __P((struct tty *, struct termios *)); +static swihand_t rcpoll; static void rc_reinit __P((struct rc_softc *)); #ifdef RCDEBUG static void printrcflags(); @@ -231,7 +225,7 @@ rcattach(dvp) register int chan, nec = dvp->id_iobase; struct rc_softc *rcb = &rc_softc[dvp->id_unit]; struct rc_chans *rc = &rc_chans[dvp->id_unit * CD180_NCHAN]; - static int rc_wakeup_started = 0; + static int rc_started = 0; struct tty *tp; /* Thorooughly test the device */ @@ -271,9 +265,10 @@ rcattach(dvp) #endif } rcb->rcb_probed = RC_ATTACHED; - if (!rc_wakeup_started) { + if (!rc_started) { + register_swi(SWI_TTY, rcpoll); rc_wakeup((void *)NULL); - rc_wakeup_started = 1; + rc_started = 0; } return 1; } diff --git a/sys/i386/isa/sio.c b/sys/i386/isa/sio.c index 5a7c340cab8c..de9407bcd36e 100644 --- a/sys/i386/isa/sio.c +++ b/sys/i386/isa/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.208 1998/06/24 09:23:32 phk Exp $ + * $Id: sio.c,v 1.209 1998/07/15 12:18:14 bde Exp $ */ #include "opt_comconsole.h" @@ -70,6 +70,7 @@ #include #include #include +#include #include #include #include @@ -78,6 +79,7 @@ #endif #include +#include #include #include @@ -301,19 +303,6 @@ struct com_s { #endif }; -/* - * XXX public functions in drivers should be declared in headers produced - * by `config', not here. - */ - -/* Interrupt handling entry point. */ -void siopoll __P((void)); - -/* Device switch entry points. */ -#define sioreset noreset -#define siommap nommap -#define siostrategy nostrategy - #ifdef COM_ESP static int espattach __P((struct isa_device *isdp, struct com_s *com, Port_t esp_port)); @@ -325,6 +314,7 @@ static void comhardclose __P((struct com_s *com)); static void siointr1 __P((struct com_s *com)); static int commctl __P((struct com_s *com, int bits, int how)); static int comparam __P((struct tty *tp, struct termios *t)); +static swihand_t siopoll; static int sioprobe __P((struct isa_device *dev)); static void siosettimeout __P((void)); static void comstart __P((struct tty *tp)); @@ -366,6 +356,7 @@ static int comconsole = -1; static volatile speed_t comdefaultrate = CONSPEED; static u_int com_events; /* input chars + weighted output completions */ static Port_t siocniobase; +static bool_t siopoll_registered; static int sio_timeout; static int sio_timeouts_until_log; static struct callout_handle sio_timeout_handle @@ -1102,6 +1093,10 @@ determined_type: ; unit | CALLOUT_MASK | CONTROL_LOCK_STATE, DV_CHR, UID_UUCP, GID_DIALER, 0660, "cuala%r", unit); #endif + if (!siopoll_registered) { + register_swi(SWI_TTY, siopoll); + siopoll_registered = TRUE; + } com->id_flags = isdp->id_flags; /* Heritate id_flags for later */ return (1); } @@ -1877,7 +1872,7 @@ sioioctl(dev, cmd, data, flag, p) return (0); } -void +static void siopoll() { int unit; diff --git a/sys/isa/sio.c b/sys/isa/sio.c index 5a7c340cab8c..de9407bcd36e 100644 --- a/sys/isa/sio.c +++ b/sys/isa/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.208 1998/06/24 09:23:32 phk Exp $ + * $Id: sio.c,v 1.209 1998/07/15 12:18:14 bde Exp $ */ #include "opt_comconsole.h" @@ -70,6 +70,7 @@ #include #include #include +#include #include #include #include @@ -78,6 +79,7 @@ #endif #include +#include #include #include @@ -301,19 +303,6 @@ struct com_s { #endif }; -/* - * XXX public functions in drivers should be declared in headers produced - * by `config', not here. - */ - -/* Interrupt handling entry point. */ -void siopoll __P((void)); - -/* Device switch entry points. */ -#define sioreset noreset -#define siommap nommap -#define siostrategy nostrategy - #ifdef COM_ESP static int espattach __P((struct isa_device *isdp, struct com_s *com, Port_t esp_port)); @@ -325,6 +314,7 @@ static void comhardclose __P((struct com_s *com)); static void siointr1 __P((struct com_s *com)); static int commctl __P((struct com_s *com, int bits, int how)); static int comparam __P((struct tty *tp, struct termios *t)); +static swihand_t siopoll; static int sioprobe __P((struct isa_device *dev)); static void siosettimeout __P((void)); static void comstart __P((struct tty *tp)); @@ -366,6 +356,7 @@ static int comconsole = -1; static volatile speed_t comdefaultrate = CONSPEED; static u_int com_events; /* input chars + weighted output completions */ static Port_t siocniobase; +static bool_t siopoll_registered; static int sio_timeout; static int sio_timeouts_until_log; static struct callout_handle sio_timeout_handle @@ -1102,6 +1093,10 @@ determined_type: ; unit | CALLOUT_MASK | CONTROL_LOCK_STATE, DV_CHR, UID_UUCP, GID_DIALER, 0660, "cuala%r", unit); #endif + if (!siopoll_registered) { + register_swi(SWI_TTY, siopoll); + siopoll_registered = TRUE; + } com->id_flags = isdp->id_flags; /* Heritate id_flags for later */ return (1); } @@ -1877,7 +1872,7 @@ sioioctl(dev, cmd, data, flag, p) return (0); } -void +static void siopoll() { int unit;