diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1999-07-26 12:31:45 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1999-07-26 12:31:45 +0000 |
commit | 5bb5cc058d123fb26a0d836a05f8ea92c6a381a3 (patch) | |
tree | 0fcd76d4e40685abd77ab014a905861d7d39f261 /sys/arch | |
parent | 5fc5357816e696990c15bc4b5fe0042d5d46cfb1 (diff) |
Remove obsolete detach code that has been dead for very long
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/i386/isa/pccom.c | 310 | ||||
-rw-r--r-- | sys/arch/i386/isa/pccomvar.h | 6 |
2 files changed, 13 insertions, 303 deletions
diff --git a/sys/arch/i386/isa/pccom.c b/sys/arch/i386/isa/pccom.c index 8710482c71f..4d54d805279 100644 --- a/sys/arch/i386/isa/pccom.c +++ b/sys/arch/i386/isa/pccom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pccom.c,v 1.30 1999/05/21 16:06:13 rees Exp $ */ +/* $OpenBSD: pccom.c,v 1.31 1999/07/26 12:31:44 niklas Exp $ */ /* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */ /* @@ -119,8 +119,6 @@ void pccom_xr16850_fifo_init __P((bus_space_tag_t, bus_space_handle_t)); */ int comprobe __P((struct device *, void *, void *)); void comattach __P((struct device *, struct device *, void *)); -void com_absent_notify __P((struct com_softc *sc)); -void comstart_pending __P((void *)); void compwroff __P((struct com_softc *)); void com_raisedtr __P((void *)); @@ -202,225 +200,6 @@ extern int kgdb_debug_init; #define IS_ISAPNP(parent) 0 #endif -#if 0 -#if NPCCOM_PCMCIA -#include <dev/pcmcia/pcmciavar.h> - -int com_pcmcia_match __P((struct device *, void *, void *)); -void com_pcmcia_attach __P((struct device *, struct device *, void *)); -int com_pcmcia_detach __P((struct device *)); - -struct cfattach pccom_pcmcia_ca = { - sizeof(struct com_softc), com_pcmcia_match, comattach, - com_pcmcia_detach -}; - -int com_pcmcia_mod __P((struct pcmcia_link *pc_link, struct device *self, - struct pcmcia_conf *pc_cf, struct cfdata *cf)); - -/* additional setup needed for pcmcia devices */ -/* modify config entry */ -int -com_pcmcia_mod(pc_link, self, pc_cf, cf) - struct pcmcia_link *pc_link; - struct device *self; - struct pcmcia_conf *pc_cf; - struct cfdata *cf; -{ - int err; - if (!(err = PCMCIA_BUS_CONFIG(pc_link->adapter, pc_link, self, - pc_cf, cf))) { - pc_cf->memwin = 0; - if (pc_cf->cfgtype == 0) - pc_cf->cfgtype = CFGENTRYID; /* determine from ioaddr */ - } - return err; -} - -int com_pcmcia_isa_attach __P((struct device *, void *, void *, - struct pcmcia_link *)); -int com_pcmcia_remove __P((struct pcmcia_link *, struct device *)); - -static struct pcmcia_com { - struct pcmcia_device pcd; -} pcmcia_com = { - {"PCMCIA Modem card", com_pcmcia_mod, com_pcmcia_isa_attach, - NULL, com_pcmcia_remove} -}; - - -struct pcmciadevs pcmcia_com_devs[] = { - { "pccom", 0, - NULL, "*MODEM*", NULL, NULL, - NULL, (void *)&pcmcia_com - }, - { "pccom", 0, - NULL, "*Modem*", NULL, NULL, - NULL, (void *)&pcmcia_com - }, - { "pccom", 0, - NULL, "*modem*", NULL, NULL, - NULL, (void *)&pcmcia_com - }, - { "pccom", 0, - NULL, NULL, "*MODEM*", NULL, - NULL, (void *)&pcmcia_com - }, - { "pccom", 0, - NULL, NULL, "*Modem*", NULL, - NULL, (void *)&pcmcia_com - }, - { "pccom", 0, - NULL, NULL, "*modem*", NULL, - NULL, (void *)&pcmcia_com - }, - { "pccom", 0, - NULL, NULL, NULL, "*MODEM*", - NULL, (void *)&pcmcia_com - }, - { "pccom", 0, - NULL, NULL, NULL, "*Modem*", - NULL, (void *)&pcmcia_com - }, - { "pccom", 0, - NULL, NULL, NULL, "*modem*", - NULL, (void *)&pcmcia_com - }, - {NULL} -}; -#define ncom_pcmcia_devs sizeof(pcmcia_com_devs)/sizeof(pcmcia_com_devs[0]) - -int -com_pcmcia_match(parent, match, aux) - struct device *parent; - void *match, *aux; -{ - return pcmcia_slave_match(parent, match, aux, pcmcia_com_devs, - ncom_pcmcia_devs); -} - -int -com_pcmcia_isa_attach(parent, match, aux, pc_link) - struct device *parent; - void *match; - void *aux; - struct pcmcia_link *pc_link; -{ - struct isa_attach_args *ia = aux; - struct com_softc *sc = match; - - int rval; - if ((rval = comprobe(parent, sc->sc_dev.dv_cfdata, ia))) { - if (ISSET(pc_link->flags, PCMCIA_REATTACH)) { -#ifdef PCCOM_DEBUG - printf("comreattach, hwflags=%x\n", sc->sc_hwflags); -#endif - sc->sc_hwflags = COM_HW_REATTACH | - (sc->sc_hwflags & (COM_HW_ABSENT_PENDING|COM_HW_CONSOLE)); - } else - sc->sc_hwflags = 0; - sc->sc_ic = ia->ia_ic; - } - return rval; -} - - -/* - * Called by config_detach attempts, shortly after com_pcmcia_remove - * was called. - */ -int -com_pcmcia_detach(self) - struct device *self; -{ - struct com_softc *sc = (void *)self; - - if (ISSET(sc->sc_hwflags, COM_HW_ABSENT_PENDING)) { - /* don't let it really be detached, it is still open */ - return EBUSY; - } - return 0; /* OK! */ -} - -/* - * called by pcmcia framework to accept/reject remove attempts. - * If we return 0, then the detach will proceed. - */ -int -com_pcmcia_remove(pc_link, self) - struct pcmcia_link *pc_link; - struct device *self; -{ - struct com_softc *sc = (void *)self; - struct tty *tp; - int s; - - if (!sc->sc_tty) - goto ok; - tp = sc->sc_tty; - - /* not in use ? if so, return "OK" */ - if (!ISSET(tp->t_state, TS_ISOPEN) && - !ISSET(tp->t_state, TS_WOPEN)) { - ttyfree(sc->sc_tty); - sc->sc_tty = NULL; - ok: - isa_intr_disestablish(sc->sc_ic, sc->sc_ih); - sc->sc_ih = NULL; - SET(sc->sc_hwflags, COM_HW_ABSENT); - return 0; /* OK! */ - } - /* - * Not easily removed. Put device into a dead state, clean state - * as best we can. notify all waiters. - */ - SET(sc->sc_hwflags, COM_HW_ABSENT|COM_HW_ABSENT_PENDING); -#ifdef PCCOM_DEBUG - printf("pending detach flags %x\n", sc->sc_hwflags); -#endif - - s = spltty(); - com_absent_notify(sc); - splx(s); - - return 0; -} - -#if 0 -void -com_pcmcia_attach(parent, self, aux) - struct device *parent, *self; - void *aux; -{ - struct pcmcia_attach_args *paa = aux; - - printf("com_pcmcia_attach %p %p %p\n", parent, self, aux); - delay(2000000); - if (!pcmcia_configure(parent, self, paa->paa_link)) { - struct com_softc *sc = (void *)self; - sc->sc_hwflags |= COM_HW_ABSENT; - printf(": not attached\n"); - } -} -#endif -#endif -#endif - -/* - * must be called at spltty() or higher. - */ -void -com_absent_notify(sc) - struct com_softc *sc; -{ - struct tty *tp = sc->sc_tty; - - if (tp) { - CLR(tp->t_state, TS_CARR_ON|TS_BUSY); - ttyflush(tp, FREAD|FWRITE); - } -} - int comspeed(speed) long speed; @@ -624,13 +403,7 @@ comattach(parent, self, aux) * XXX for commulti attach, with a helper function that contains * XXX most of the interesting stuff. */ - if (ISSET(sc->sc_hwflags, COM_HW_REATTACH)) { - int s; - s = spltty(); - com_absent_notify(sc); - splx(s); - } else - sc->sc_hwflags = 0; + sc->sc_hwflags = 0; sc->sc_swflags = 0; /* #if NPCCOM_ISA || NPCCOM_PCMCIA || NPCCOM_ISAPNP */ #if NPCCOM_ISA || NPCCOM_ISAPNP @@ -914,7 +687,7 @@ comopen(dev, flag, mode, p) if (unit >= pccom_cd.cd_ndevs) return ENXIO; sc = pccom_cd.cd_devs[unit]; - if (!sc || ISSET(sc->sc_hwflags, COM_HW_ABSENT|COM_HW_ABSENT_PENDING)) + if (!sc) return ENXIO; s = spltty(); @@ -1151,28 +924,19 @@ comclose(dev, flag, mode, p) (*linesw[tp->t_line].l_close)(tp, flag); s = spltty(); - if (!ISSET(sc->sc_hwflags, COM_HW_ABSENT|COM_HW_ABSENT_PENDING)) { - if (ISSET(tp->t_state, TS_WOPEN)) { - /* tty device is waiting for carrier; drop dtr then re-raise */ - CLR(sc->sc_mcr, MCR_DTR | MCR_RTS); - bus_space_write_1(iot, ioh, com_mcr, sc->sc_mcr); - timeout(com_raisedtr, sc, hz * 2); - } else { - /* no one else waiting; turn off the uart */ - compwroff(sc); - } + if (ISSET(tp->t_state, TS_WOPEN)) { + /* tty device is waiting for carrier; drop dtr then re-raise */ + CLR(sc->sc_mcr, MCR_DTR | MCR_RTS); + bus_space_write_1(iot, ioh, com_mcr, sc->sc_mcr); + timeout(com_raisedtr, sc, hz * 2); + } else { + /* no one else waiting; turn off the uart */ + compwroff(sc); } CLR(tp->t_state, TS_BUSY | TS_FLUSH); sc->sc_cua = 0; splx(s); ttyclose(tp); -#ifdef PCCOM_DEBUG - /* mark it ready for more use if reattached earlier */ - if (ISSET(sc->sc_hwflags, COM_HW_ABSENT_PENDING)) { - printf("comclose pending cleared\n"); - } -#endif - CLR(sc->sc_hwflags, COM_HW_ABSENT_PENDING); #ifdef notyet /* XXXX */ if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE)) { @@ -1247,13 +1011,6 @@ comread(dev, uio, flag) struct com_softc *sc = pccom_cd.cd_devs[DEVUNIT(dev)]; struct tty *tp = sc->sc_tty; - if (ISSET(sc->sc_hwflags, COM_HW_ABSENT|COM_HW_ABSENT_PENDING)) { - int s = spltty(); - com_absent_notify(sc); - splx(s); - return EIO; - } - return ((*linesw[tp->t_line].l_read)(tp, uio, flag)); } @@ -1266,13 +1023,6 @@ comwrite(dev, uio, flag) struct com_softc *sc = pccom_cd.cd_devs[DEVUNIT(dev)]; struct tty *tp = sc->sc_tty; - if (ISSET(sc->sc_hwflags, COM_HW_ABSENT|COM_HW_ABSENT_PENDING)) { - int s = spltty(); - com_absent_notify(sc); - splx(s); - return EIO; - } - return ((*linesw[tp->t_line].l_write)(tp, uio, flag)); } @@ -1314,13 +1064,6 @@ comioctl(dev, cmd, data, flag, p) bus_space_handle_t ioh = sc->sc_ioh; int error; - if (ISSET(sc->sc_hwflags, COM_HW_ABSENT|COM_HW_ABSENT_PENDING)) { - int s = spltty(); - com_absent_notify(sc); - splx(s); - return EIO; - } - error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); if (error >= 0) return error; @@ -1435,13 +1178,6 @@ comparam(tp, t) tcflag_t oldcflag; int s; - if (ISSET(sc->sc_hwflags, COM_HW_ABSENT|COM_HW_ABSENT_PENDING)) { - int s = spltty(); - com_absent_notify(sc); - splx(s); - return EIO; - } - /* check requested parameters */ if (ospeed < 0 || (t->c_ispeed && t->c_ispeed != t->c_ospeed)) return EINVAL; @@ -1602,18 +1338,6 @@ comparam(tp, t) return 0; } -void -comstart_pending(arg) - void *arg; -{ - struct com_softc *sc = arg; - int s; - - s = spltty(); - com_absent_notify(sc); - splx(s); -} - /* * (un)block input via hw flowcontrol */ @@ -1668,16 +1392,6 @@ comstart(tp) int s, count; s = spltty(); - if (ISSET(sc->sc_hwflags, COM_HW_ABSENT|COM_HW_ABSENT_PENDING)) { - /* - * not quite good enough: if caller is ttywait() it will - * go to sleep immediately, so hang out a bit and then - * prod caller again. - */ - com_absent_notify(sc); - timeout(comstart_pending, sc, 1); - goto out; - } if (ISSET(tp->t_state, TS_BUSY)) goto out; if (ISSET(tp->t_state, TS_TIMEOUT | TS_TTSTOP) || sc->sc_halt > 0) @@ -1877,7 +1591,7 @@ comintr(arg) u_int8_t lsr; u_int rxput; - if (ISSET(sc->sc_hwflags, COM_HW_ABSENT) || !sc->sc_tty) + if (!sc->sc_tty) return (0); /* can't do squat. */ if (ISSET(bus_space_read_1(iot, ioh, com_iir), IIR_NOPEND)) diff --git a/sys/arch/i386/isa/pccomvar.h b/sys/arch/i386/isa/pccomvar.h index e522066cafc..5aa03ef8cb5 100644 --- a/sys/arch/i386/isa/pccomvar.h +++ b/sys/arch/i386/isa/pccomvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pccomvar.h,v 1.6 1998/04/05 07:36:45 downsj Exp $ */ +/* $OpenBSD: pccomvar.h,v 1.7 1999/07/26 12:31:44 niklas Exp $ */ /* $NetBSD: comvar.h,v 1.5 1996/05/05 19:50:47 christos Exp $ */ /* @@ -78,9 +78,6 @@ struct com_softc { #define COM_HW_NOIEN 0x01 #define COM_HW_FIFO 0x02 #define COM_HW_HAYESP 0x04 -#define COM_HW_ABSENT_PENDING 0x08 /* reattached, awaiting close/reopen */ -#define COM_HW_ABSENT 0x10 /* configure actually failed, or removed */ -#define COM_HW_REATTACH 0x20 /* reattaching */ #define COM_HW_CONSOLE 0x40 u_char sc_swflags; #define COM_SW_SOFTCAR 0x01 @@ -107,7 +104,6 @@ struct com_softc { int comprobe1 __P((bus_space_tag_t, bus_space_handle_t)); void cominit __P((bus_space_tag_t, bus_space_handle_t, int)); int comintr __P((void *)); -void com_absent_notify __P((struct com_softc *sc)); #ifdef COM_HAYESP int comprobeHAYESP __P((bus_space_handle_t hayespioh, struct com_softc *sc)); |