Index: arch/arm/at91/at91dbgu.c =================================================================== RCS file: /cvsroot/src/sys/arch/arm/at91/at91dbgu.c,v retrieving revision 1.8 diff -u -u -r1.8 at91dbgu.c --- arch/arm/at91/at91dbgu.c 2 Feb 2012 19:42:57 -0000 1.8 +++ arch/arm/at91/at91dbgu.c 11 Aug 2012 08:22:45 -0000 @@ -134,6 +134,7 @@ static int at91dbgu_param(struct tty *, struct termios *); static void at91dbgu_start(struct tty *); +static void at91dbgu_flush(struct tty *); static int at91dbgu_hwiflow(struct tty *, int); #if 0 @@ -245,6 +246,7 @@ tp = tty_alloc(); tp->t_oproc = at91dbgu_start; + tp->t_flush = at91dbgu_flush; tp->t_param = at91dbgu_param; tp->t_hwiflow = at91dbgu_hwiflow; @@ -385,6 +387,17 @@ } static void +at91dbgu_flush(struct tty *tp) +{ + struct at91dbgu_softc *sc + = device_lookup_private(&at91dbgu_cd, COMUNIT(tp->t_dev)); + if (COM_ISALIVE(sc) == 0) + return; + sc->sc_tba = tp->t_outq.c_cf; + sc->sc_tbc = ndqb(&tp->t_outq, 0); +} + +static void at91dbgu_start(struct tty *tp) { struct at91dbgu_softc *sc Index: arch/arm/at91/at91usart.c =================================================================== RCS file: /cvsroot/src/sys/arch/arm/at91/at91usart.c,v retrieving revision 1.6 diff -u -u -r1.6 at91usart.c --- arch/arm/at91/at91usart.c 2 Feb 2012 19:42:57 -0000 1.6 +++ arch/arm/at91/at91usart.c 11 Aug 2012 08:22:49 -0000 @@ -126,6 +126,7 @@ static int at91usart_param(struct tty *, struct termios *); static void at91usart_start(struct tty *); +static void at91usart_flush(struct tty *); static int at91usart_hwiflow(struct tty *, int); #if 0 @@ -279,6 +280,7 @@ tp = tty_alloc(); tp->t_oproc = at91usart_start; + tp->t_flush = at91usart_flush; tp->t_param = at91usart_param; tp->t_hwiflow = at91usart_hwiflow; @@ -469,6 +471,18 @@ } static void +at91usart_flush(struct tty *tp) +{ + struct at91usart_softc *sc + = device_lookup_private(&at91usart_cd, COMUNIT(tp->t_dev)); + + if (COM_ISALIVE(sc) == 0) + return; + sc->sc_tba = tp->t_outq.c_cf; + sc->sc_tbc = ndqb(&tp->t_outq, 0); +} + +static void at91usart_start(struct tty *tp) { struct at91usart_softc *sc Index: arch/arm/ep93xx/epcom.c =================================================================== RCS file: /cvsroot/src/sys/arch/arm/ep93xx/epcom.c,v retrieving revision 1.22 diff -u -u -r1.22 epcom.c --- arch/arm/ep93xx/epcom.c 2 Feb 2012 19:42:57 -0000 1.22 +++ arch/arm/ep93xx/epcom.c 11 Aug 2012 08:22:50 -0000 @@ -122,6 +122,7 @@ static int epcomparam(struct tty *, struct termios *); static void epcomstart(struct tty *); +static void epcomflush(struct tty *); static int epcomhwiflow(struct tty *, int); static u_int cflag2lcrhi(tcflag_t); @@ -203,6 +204,7 @@ tp = tty_alloc(); tp->t_oproc = epcomstart; + tp->t_flush = epcomflush; tp->t_param = epcomparam; tp->t_hwiflow = epcomhwiflow; @@ -346,6 +348,17 @@ } static void +epcomflush(struct tty *tp) +{ + struct epcom_softc *sc + = device_lookup_private(&epcom_cd, COMUNIT(tp->t_dev)); + if (COM_ISALIVE(sc) == 0) + return; + sc->sc_tba = tp->t_outq.c_cf; + sc->sc_tbc = ndqb(&tp->t_outq, 0); +} + +static void epcomstart(struct tty *tp) { struct epcom_softc *sc Index: arch/arm/imx/imxuart.c =================================================================== RCS file: /cvsroot/src/sys/arch/arm/imx/imxuart.c,v retrieving revision 1.9 diff -u -u -r1.9 imxuart.c --- arch/arm/imx/imxuart.c 2 Feb 2012 19:42:58 -0000 1.9 +++ arch/arm/imx/imxuart.c 11 Aug 2012 08:22:52 -0000 @@ -277,6 +277,7 @@ int imxuspeed(long, struct imxuart_baudrate_ratio *); int imxuparam(struct tty *, struct termios *); void imxustart(struct tty *); +void imxuflush(struct tty *); int imxuhwiflow(struct tty *, int); void imxuart_shutdown(struct imxuart_softc *); @@ -435,6 +436,7 @@ tp = tty_alloc(); tp->t_oproc = imxustart; + tp->t_flush = imxuflush; tp->t_param = imxuparam; tp->t_hwiflow = imxuhwiflow; @@ -1515,6 +1517,17 @@ #endif } +void +imxuflush(struct tty *tp) +{ + struct imxuart_softc *sc = + device_lookup_private(&imxuart_cd, IMXUART_UNIT(tp->t_dev)); + + if (IMXUART_ISALIVE(sc) == 0) + return; + sc->sc_tba = tp->t_outq.c_cf; + sc->sc_tbc = ndqb(&tp->t_outq, 0); +} void imxustart(struct tty *tp) Index: arch/arm/include/cpufunc.h =================================================================== RCS file: /cvsroot/src/sys/arch/arm/include/cpufunc.h,v retrieving revision 1.57 diff -u -u -r1.57 cpufunc.h --- arch/arm/include/cpufunc.h 21 Jul 2012 12:19:15 -0000 1.57 +++ arch/arm/include/cpufunc.h 11 Aug 2012 08:22:52 -0000 @@ -156,7 +156,7 @@ extern struct cpu_functions cpufuncs; extern u_int cputype; -#define cpu_id() cpufuncs.cf_id() +#define cpu_idnum() cpufuncs.cf_id() #define cpu_control(c, e) cpufuncs.cf_control(c, e) #define cpu_domains(d) cpufuncs.cf_domains(d) Index: arch/arm/ixp12x0/ixp12x0_com.c =================================================================== RCS file: /cvsroot/src/sys/arch/arm/ixp12x0/ixp12x0_com.c,v retrieving revision 1.40 diff -u -u -r1.40 ixp12x0_com.c --- arch/arm/ixp12x0/ixp12x0_com.c 2 Feb 2012 19:42:58 -0000 1.40 +++ arch/arm/ixp12x0/ixp12x0_com.c 11 Aug 2012 08:22:54 -0000 @@ -105,6 +105,7 @@ static int ixpcomparam(struct tty *, struct termios *); static void ixpcomstart(struct tty *); +static void ixpcomflush(struct tty *); static int ixpcomhwiflow(struct tty *, int); static u_int cflag2cr(tcflag_t); @@ -202,6 +203,7 @@ tp = tty_alloc(); tp->t_oproc = ixpcomstart; + tp->t_flush = ixpcomflush; tp->t_param = ixpcomparam; tp->t_hwiflow = ixpcomhwiflow; @@ -363,6 +365,17 @@ } static void +ixpcomflush(struct tty *tp) +{ + struct ixpcom_softc *sc + = device_lookup_private(&ixpcom_cd, COMUNIT(tp->t_dev)); + if (COM_ISALIVE(sc) == 0) + return; + sc->sc_tba = tp->t_outq.c_cf; + sc->sc_tbc = ndqb(&tp->t_outq, 0); +} + +static void ixpcomstart(struct tty *tp) { struct ixpcom_softc *sc Index: arch/arm/s3c2xx0/sscom.c =================================================================== RCS file: /cvsroot/src/sys/arch/arm/s3c2xx0/sscom.c,v retrieving revision 1.37 diff -u -u -r1.37 sscom.c --- arch/arm/s3c2xx0/sscom.c 7 Feb 2012 09:06:05 -0000 1.37 +++ arch/arm/s3c2xx0/sscom.c 11 Aug 2012 08:22:56 -0000 @@ -470,6 +470,7 @@ tp = tty_alloc(); tp->t_oproc = sscomstart; + tp->t_flush = sscomflush; tp->t_param = sscomparam; tp->t_hwiflow = sscomhwiflow; @@ -1267,6 +1268,17 @@ void +sscomflush(struct tty *tp) +{ + struct sscom_softc *sc = device_lookup_private(&sscom_cd, SSCOMUNIT(tp->t_dev)); + + if (SSCOM_ISALIVE(sc) == 0) + return; + sc->sc_tba = tp->t_outq.c_cf; + sc->sc_tbc = ndqb(&tp->t_outq, 0); +} + +void sscomstart(struct tty *tp) { struct sscom_softc *sc = device_lookup_private(&sscom_cd, SSCOMUNIT(tp->t_dev)); Index: arch/arm/s3c2xx0/sscom_var.h =================================================================== RCS file: /cvsroot/src/sys/arch/arm/s3c2xx0/sscom_var.h,v retrieving revision 1.11 diff -u -u -r1.11 sscom_var.h --- arch/arm/s3c2xx0/sscom_var.h 2 Feb 2012 19:42:58 -0000 1.11 +++ arch/arm/s3c2xx0/sscom_var.h 11 Aug 2012 08:22:56 -0000 @@ -281,6 +281,7 @@ void sscom_shutdown(struct sscom_softc *); void sscomdiag (void *); void sscomstart(struct tty *); +void sscomflush(struct tty *); int sscomparam(struct tty *, struct termios *); int sscomread(dev_t, struct uio *, int); void sscom_config(struct sscom_softc *); Index: arch/arm/sa11x0/sa11x0_com.c =================================================================== RCS file: /cvsroot/src/sys/arch/arm/sa11x0/sa11x0_com.c,v retrieving revision 1.50 diff -u -u -r1.50 sa11x0_com.c --- arch/arm/sa11x0/sa11x0_com.c 2 Feb 2012 19:42:58 -0000 1.50 +++ arch/arm/sa11x0/sa11x0_com.c 11 Aug 2012 08:22:58 -0000 @@ -135,6 +135,7 @@ static u_int cflag2cr0(tcflag_t); int sacomparam(struct tty *, struct termios *); void sacomstart(struct tty *); +void sacomflush(struct tty *); int sacomhwiflow(struct tty *, int); void sacom_loadchannelregs(struct sacom_softc *); @@ -298,6 +299,7 @@ tp = tty_alloc(); tp->t_oproc = sacomstart; + tp->t_flush = sacomflush; tp->t_param = sacomparam; tp->t_hwiflow = sacomhwiflow; @@ -1040,6 +1042,17 @@ void +sacomflush(struct tty *tp) +{ + struct sacom_softc *sc = + device_lookup_private(&sacom_cd, COMUNIT(tp->t_dev)); + if (COM_ISALIVE(sc) == 0) + return; + sc->sc_tba = tp->t_outq.c_cf; + sc->sc_tbc = ndqb(&tp->t_outq, 0); +} + +void sacomstart(struct tty *tp) { struct sacom_softc *sc = Index: arch/atari/dev/ser.c =================================================================== RCS file: /cvsroot/src/sys/arch/atari/dev/ser.c,v retrieving revision 1.52 diff -u -u -r1.52 ser.c --- arch/atari/dev/ser.c 24 Apr 2011 16:26:55 -0000 1.52 +++ arch/atari/dev/ser.c 11 Aug 2012 08:22:59 -0000 @@ -225,6 +225,7 @@ static int sertrintr(void *); static int serparam(struct tty *, struct termios *); static void serstart(struct tty *); +static void serflush(struct tty *); struct consdev; void sercnprobe(struct consdev *); @@ -402,6 +403,7 @@ /* Add some entry points needed by the tty layer. */ tp->t_oproc = serstart; + tp->t_flush = serflush; tp->t_param = serparam; tp->t_hwiflow = serhwiflow; tp->t_dev = dev; @@ -916,6 +918,16 @@ } void +serflush(struct tty *tp) +{ + struct ser_softc *sc = + device_lookup_private(&ser_cd, SERUNIT(tp->t_dev)); + + sc->sc_tba = tp->t_outq.c_cf; + sc->sc_tbc = ndqb(&tp->t_outq, 0); +} + +void serstart(struct tty *tp) { struct ser_softc *sc = Index: arch/atari/dev/zs.c =================================================================== RCS file: /cvsroot/src/sys/arch/atari/dev/zs.c,v retrieving revision 1.74 diff -u -u -r1.74 zs.c --- arch/atari/dev/zs.c 30 Jun 2011 20:09:21 -0000 1.74 +++ arch/atari/dev/zs.c 11 Aug 2012 08:23:00 -0000 @@ -251,6 +251,7 @@ /* Routines called from other code. */ static void zsstart(struct tty *); +static void zsflush(struct tty *); /* Routines purely local to this driver. */ static void zsoverrun(int, long *, const char *); @@ -409,6 +410,7 @@ tty_attach(tp); tp->t_dev = dev; tp->t_oproc = zsstart; + tp->t_flush = zsflush; tp->t_param = zsparam; } @@ -961,6 +963,17 @@ return 0; } +static void +zsflush(struct tty *tp) +{ + int unit = ZS_UNIT(tp->t_dev); + struct zs_softc *sc = device_lookup_private(&zs_cd, unit >> 1); + struct zs_chanstate *cs = sc->sc_cs[unit & 1]; + + cs->cs_tba = tp->t_outq.c_cf; + cs->cs_tbc = ndqb(&tp->t_outq, 0); +} + /* * Start or restart transmission. */ Index: arch/evbarm/dev/plcom.c =================================================================== RCS file: /cvsroot/src/sys/arch/evbarm/dev/plcom.c,v retrieving revision 1.40 diff -u -u -r1.40 plcom.c --- arch/evbarm/dev/plcom.c 25 Jul 2012 07:26:17 -0000 1.40 +++ arch/evbarm/dev/plcom.c 11 Aug 2012 08:23:06 -0000 @@ -153,6 +153,7 @@ static u_char cflag2lcr (tcflag_t); int plcomparam (struct tty *, struct termios *); void plcomstart (struct tty *); +void plcomflush (struct tty *); int plcomhwiflow (struct tty *, int); void plcom_loadchannelregs (struct plcom_softc *); @@ -505,6 +506,7 @@ tp = tty_alloc(); tp->t_oproc = plcomstart; + tp->t_flush = plcomflush; tp->t_param = plcomparam; tp->t_hwiflow = plcomhwiflow; @@ -1625,6 +1627,18 @@ void +plcomflush(struct tty *tp) +{ + struct plcom_softc *sc = + device_lookup_private(&plcom_cd, PLCOMUNIT(tp->t_dev)); + + if (PLCOM_ISALIVE(sc) == 0) + return; + sc->sc_tba = tp->t_outq.c_cf; + sc->sc_tbc = ndqb(&tp->t_outq, 0); +} + +void plcomstart(struct tty *tp) { struct plcom_softc *sc = Index: arch/evbppc/virtex/dev/xlcom.c =================================================================== RCS file: /cvsroot/src/sys/arch/evbppc/virtex/dev/xlcom.c,v retrieving revision 1.9 diff -u -u -r1.9 xlcom.c --- arch/evbppc/virtex/dev/xlcom.c 18 Jun 2011 06:44:27 -0000 1.9 +++ arch/evbppc/virtex/dev/xlcom.c 11 Aug 2012 08:23:08 -0000 @@ -147,6 +147,7 @@ /* Terminal line. */ static int xlcom_param(struct tty *, struct termios *); static void xlcom_start(struct tty *); +static void xlcom_flush(struct tty *); /* Generic device. */ static void xlcom_attach(device_t, device_t, void *); @@ -222,6 +223,7 @@ tp = tty_alloc(); tp->t_dev = dev; tp->t_oproc = xlcom_start; + tp->t_flush = xlcom_flush; tp->t_param = xlcom_param; tp->t_hwiflow = NULL; /* No HW flow control */ tty_attach(tp); @@ -585,6 +587,17 @@ } static void +xlcom_flush(struct tty *tp) +{ + struct xlcom_softc *sc; + sc = device_lookup_private(&xlcom_cd, UNIT(tp->t_dev)); + if (sc == NULL) + return; + sc->sc_tba = tp->t_outq.c_cf; + sc->sc_tbc = ndqb(&tp->t_outq, 0); +} + +static void xlcom_start(struct tty *tp) { struct xlcom_softc *sc; Index: arch/hpcmips/tx/txcom.c =================================================================== RCS file: /cvsroot/src/sys/arch/hpcmips/tx/txcom.c,v retrieving revision 1.45 diff -u -u -r1.45 txcom.c --- arch/hpcmips/tx/txcom.c 24 Apr 2011 16:26:56 -0000 1.45 +++ arch/hpcmips/tx/txcom.c 11 Aug 2012 08:23:13 -0000 @@ -135,6 +135,7 @@ void txcom_break(struct txcom_softc *, int); void txcom_modem(struct txcom_softc *, int); void txcomstart(struct tty *); +void txcomflush(struct tty *); int txcomparam(struct tty *, struct termios *); void txcom_reset (struct txcom_chip *); @@ -232,6 +233,7 @@ tp = tty_alloc(); tp->t_oproc = txcomstart; + tp->t_flush = txcomflush; tp->t_param = txcomparam; tp->t_hwiflow = NULL; sc->sc_tty = tp; @@ -1017,6 +1019,15 @@ } void +txcomflush(struct tty *tp) +{ + struct txcom_softc *sc; + sc = device_lookup_private(&txcom_cd, minor(tp->t_dev)); + sc->sc_tba = tp->t_outq.c_cf; + sc->sc_tbc = ndqb(&tp->t_outq, 0); +} + +void txcomstart(struct tty *tp) { struct txcom_softc *sc; Index: arch/mips/sibyte/dev/sbjcn.c =================================================================== RCS file: /cvsroot/src/sys/arch/mips/sibyte/dev/sbjcn.c,v retrieving revision 1.28 diff -u -u -r1.28 sbjcn.c --- arch/mips/sibyte/dev/sbjcn.c 10 Jul 2011 23:32:03 -0000 1.28 +++ arch/mips/sibyte/dev/sbjcn.c 11 Aug 2012 08:23:20 -0000 @@ -148,6 +148,7 @@ static int cflag2modes(tcflag_t, u_char *, u_char *); int sbjcn_param(struct tty *, struct termios *); void sbjcn_start(struct tty *); +void sbjcn_flush(struct tty *); int sbjcn_hwiflow(struct tty *, int); void sbjcn_loadchannelregs(struct sbjcn_channel *); @@ -308,6 +309,7 @@ tp = tty_alloc(); tp->t_oproc = sbjcn_start; + tp->t_flush = sbjcn_flush; tp->t_param = sbjcn_param; tp->t_hwiflow = sbjcn_hwiflow; @@ -1109,6 +1111,15 @@ } void +sbjcn_flush(struct tty *tp) +{ + struct sbjcn_softc *sc = device_lookup_private(&sbjcn_cd, SBJCN_UNIT(tp->t_dev)); + struct sbjcn_channel *ch = &sc->sc_channels[SBJCN_CHAN(tp->t_dev)]; + ch->ch_tba = tp->t_outq.c_cf; + ch->ch_tbc = ndqb(&tp->t_outq, 0); +} + +void sbjcn_start(struct tty *tp) { struct sbjcn_softc *sc = device_lookup_private(&sbjcn_cd, SBJCN_UNIT(tp->t_dev)); Index: arch/mips/sibyte/dev/sbscn.c =================================================================== RCS file: /cvsroot/src/sys/arch/mips/sibyte/dev/sbscn.c,v retrieving revision 1.37 diff -u -u -r1.37 sbscn.c --- arch/mips/sibyte/dev/sbscn.c 2 Feb 2012 19:43:00 -0000 1.37 +++ arch/mips/sibyte/dev/sbscn.c 11 Aug 2012 08:23:23 -0000 @@ -157,6 +157,7 @@ static int cflag2modes(tcflag_t, u_char *, u_char *); int sbscn_param(struct tty *, struct termios *); void sbscn_start(struct tty *); +void sbscn_flush(struct tty *); int sbscn_hwiflow(struct tty *, int); void sbscn_loadchannelregs(struct sbscn_channel *); @@ -337,6 +338,7 @@ tp = tty_alloc(); tp->t_oproc = sbscn_start; + tp->t_flush = sbscn_flush; tp->t_param = sbscn_param; tp->t_hwiflow = sbscn_hwiflow; @@ -1216,6 +1218,15 @@ } void +sbscn_flush(struct tty *tp) +{ + struct sbscn_softc *sc = device_lookup_private(&sbscn_cd, SBSCN_UNIT(tp->t_dev)); + struct sbscn_channel *ch = &sc->sc_channels[SBSCN_CHAN(tp->t_dev)]; + ch->ch_tba = tp->t_outq.c_cf; + ch->ch_tbc = ndqb(&tp->t_outq, 0); +} + +void sbscn_start(struct tty *tp) { struct sbscn_softc *sc = device_lookup_private(&sbscn_cd, SBSCN_UNIT(tp->t_dev)); Index: arch/sh3/dev/sci.c =================================================================== RCS file: /cvsroot/src/sys/arch/sh3/dev/sci.c,v retrieving revision 1.54 diff -u -u -r1.54 sci.c --- arch/sh3/dev/sci.c 2 Feb 2012 19:43:00 -0000 1.54 +++ arch/sh3/dev/sci.c 11 Aug 2012 08:23:28 -0000 @@ -120,6 +120,7 @@ #include static void scistart(struct tty *); +static void sciflush(struct tty *); static int sciparam(struct tty *, struct termios *); void scicnprobe(struct consdev *); @@ -404,6 +405,7 @@ tp = tty_alloc(); tp->t_oproc = scistart; + tp->t_flush = sciflush; tp->t_param = sciparam; tp->t_hwiflow = NULL; @@ -419,6 +421,14 @@ tty_attach(tp); } +static void +sciflush(struct tty *tp) +{ + struct sci_softc *sc = device_lookup_private(&sci_cd,SCIUNIT(tp->t_dev)); + sc->sc_tba = tp->t_outq.c_cf; + sc->sc_tbc = ndqb(&tp->t_outq, 0); +} + /* * Start or restart transmission. */ Index: arch/sh3/dev/scif.c =================================================================== RCS file: /cvsroot/src/sys/arch/sh3/dev/scif.c,v retrieving revision 1.61 diff -u -u -r1.61 scif.c --- arch/sh3/dev/scif.c 2 Feb 2012 19:43:00 -0000 1.61 +++ arch/sh3/dev/scif.c 11 Aug 2012 08:23:30 -0000 @@ -219,6 +219,7 @@ /* struct tty */ static void scifstart(struct tty *); +static void scifflush(struct tty *); static int scifparam(struct tty *, struct termios *); @@ -482,6 +483,7 @@ tp = tty_alloc(); tp->t_oproc = scifstart; + tp->t_flush = scifflush; tp->t_param = scifparam; tp->t_hwiflow = NULL; @@ -500,6 +502,17 @@ aprint_error_dev(self, "unable to establish power handler\n"); } +static void +scifflush(struct tty *tp) +{ + struct scif_softc *sc; + + sc = device_lookup_private(&scif_cd, SCIFUNIT(tp->t_dev)); + sc->sc_tba = tp->t_outq.c_cf; + sc->sc_tbc = ndqb(&tp->t_outq, 0); + +} + /* * Start or restart transmission. */ Index: arch/sparc64/dev/sab.c =================================================================== RCS file: /cvsroot/src/sys/arch/sparc64/dev/sab.c,v retrieving revision 1.48 diff -u -u -r1.48 sab.c --- arch/sparc64/dev/sab.c 2 Jun 2011 00:24:23 -0000 1.48 +++ arch/sparc64/dev/sab.c 11 Aug 2012 08:23:31 -0000 @@ -141,6 +141,7 @@ int sabtty_match(device_t, cfdata_t, void *); void sabtty_attach(device_t, device_t, void *); void sabtty_start(struct tty *); +void sabtty_flush(struct tty *); int sabtty_param(struct tty *, struct termios *); int sabtty_intr(struct sabtty_softc *, int *); void sabtty_softintr(struct sabtty_softc *); @@ -393,6 +394,7 @@ } tty_attach(sc->sc_tty); sc->sc_tty->t_oproc = sabtty_start; + sc->sc_tty->t_flush = sabtty_flush; sc->sc_tty->t_param = sabtty_param; } @@ -1077,6 +1079,14 @@ } void +sabtty_flush(struct tty *tp) +{ + struct sabtty_softc *sc = device_lookup_private(&sabtty_cd, SABUNIT(tp->t_dev)); + sc->sc_txc = ndqb(&tp->t_outq, 0); + sc->sc_txp = tp->t_outq.c_cf; +} + +void sabtty_start(struct tty *tp) { struct sabtty_softc *sc = device_lookup_private(&sabtty_cd, SABUNIT(tp->t_dev)); Index: dev/ic/cd18xx.c =================================================================== RCS file: /cvsroot/src/sys/dev/ic/cd18xx.c,v retrieving revision 1.28 diff -u -u -r1.28 cd18xx.c --- dev/ic/cd18xx.c 24 Apr 2011 16:26:59 -0000 1.28 +++ dev/ic/cd18xx.c 11 Aug 2012 08:23:41 -0000 @@ -151,6 +151,7 @@ static void cdtty_shutdown(struct cd18xx_softc *, struct cdtty_port *); static void cdttystart(struct tty *); +static void cdttyflush(struct tty *); static int cdttyparam(struct tty *, struct termios *); static void cdtty_break(struct cd18xx_softc *, struct cdtty_port *, int); static void cdtty_modem(struct cd18xx_softc *, struct cdtty_port *, int); @@ -330,6 +331,7 @@ /* get a tty structure */ p->p_tty = tty_alloc(); p->p_tty->t_oproc = cdttystart; + p->p_tty->t_flush = cdttyflush; p->p_tty->t_param = cdttyparam; p->p_tty->t_hwiflow = cdttyhwiflow; @@ -634,6 +636,15 @@ return (0); } +static void +cdttyflush(struct tty *tp) +{ + struct cd18xx_softc *sc = device_lookup_private(&clcd_cd, CD18XX_INSTANCE(tp->t_dev)); + struct cdtty_port *p = &sc->sc_ports[CD18XX_CHANNEL(tp->t_dev)]; + p->p_tba = tp->t_outq.c_cf; + p->p_tbc = ndqb(&tp->t_outq, 0); +} + /* * Start or restart transmission. */ Index: dev/ic/clmpcc.c =================================================================== RCS file: /cvsroot/src/sys/dev/ic/clmpcc.c,v retrieving revision 1.45 diff -u -u -r1.45 clmpcc.c --- dev/ic/clmpcc.c 1 Oct 2011 15:59:01 -0000 1.45 +++ dev/ic/clmpcc.c 11 Aug 2012 08:23:42 -0000 @@ -73,6 +73,7 @@ static int clmpcc_param(struct tty *, struct termios *); static void clmpcc_set_params(struct clmpcc_chan *); static void clmpcc_start(struct tty *); +static void clmpcc_flush(struct tty *); static int clmpcc_modem_control(struct clmpcc_chan *, int, int); #define CLMPCCUNIT(x) (minor(x) & 0x7fffc) @@ -290,6 +291,7 @@ tp = tty_alloc(); tp->t_oproc = clmpcc_start; + tp->t_flush = clmpcc_flush; tp->t_param = clmpcc_param; ch->ch_tty = tp; @@ -978,10 +980,21 @@ } static void +clmpcc_flush(struct tty *tp) +{ + struct clmpcc_softc *sc = + device_lookup_private(&clmpcc_cd, CLMPCCUNIT(tp->t_dev)); + struct clmpcc_chan *ch = &sc->sc_chans[CLMPCCCHAN(tp->t_dev)]; + ch->ch_obuf_addr = tp->t_outq.c_cf; + ch->ch_obuf_size = ndqb(&tp->t_outq, 0); +} + +static void clmpcc_start(struct tty *tp) { struct clmpcc_softc *sc = device_lookup_private(&clmpcc_cd, CLMPCCUNIT(tp->t_dev)); + struct clmpcc_chan *ch = &sc->sc_chans[CLMPCCCHAN(tp->t_dev)]; u_int oldch; int s; Index: dev/ic/com.c =================================================================== RCS file: /cvsroot/src/sys/dev/ic/com.c,v retrieving revision 1.306 diff -u -u -r1.306 com.c --- dev/ic/com.c 21 May 2012 20:51:46 -0000 1.306 +++ dev/ic/com.c 11 Aug 2012 08:23:43 -0000 @@ -162,6 +162,7 @@ static u_char cflag2lcr(tcflag_t); int comparam(struct tty *, struct termios *); void comstart(struct tty *); +void comflush(struct tty *); int comhwiflow(struct tty *, int); void com_loadchannelregs(struct com_softc *); @@ -504,6 +505,7 @@ tp = tty_alloc(); tp->t_oproc = comstart; + tp->t_flush = comflush; tp->t_param = comparam; tp->t_hwiflow = comhwiflow; @@ -1590,6 +1592,18 @@ CSR_WRITE_1(regsp, COM_REG_MCR, sc->sc_mcr_active); } +void +comflush(struct tty *tp) +{ + struct com_softc *sc = + device_lookup_private(&com_cd, COMUNIT(tp->t_dev)); + + if (COM_ISALIVE(sc) == 0) + return; + + sc->sc_tba = tp->t_outq.c_cf; + sc->sc_tbc = ndqb(&tp->t_outq, 0); +} void comstart(struct tty *tp) Index: dev/ic/z8530tty.c =================================================================== RCS file: /cvsroot/src/sys/dev/ic/z8530tty.c,v retrieving revision 1.128 diff -u -u -r1.128 z8530tty.c --- dev/ic/z8530tty.c 24 Apr 2011 16:27:00 -0000 1.128 +++ dev/ic/z8530tty.c 11 Aug 2012 08:23:46 -0000 @@ -260,6 +260,7 @@ static void zs_shutdown(struct zstty_softc *); static void zsstart(struct tty *); +static void zsflush(struct tty *); static int zsparam(struct tty *, struct termios *); static void zs_modem(struct zstty_softc *, int); static void tiocm_to_zs(struct zstty_softc *, u_long, int); @@ -393,6 +394,7 @@ tp = tty_alloc(); tp->t_dev = dev; tp->t_oproc = zsstart; + tp->t_flush = zsflush; tp->t_param = zsparam; tp->t_hwiflow = zshwiflow; tty_attach(tp); @@ -875,6 +877,15 @@ return (error); } +static void +zsflush(struct tty *tp) +{ + struct zstty_softc *zst = + device_lookup_private(&zstty_cd, ZSUNIT(tp->t_dev)); + zst->zst_tba = tp->t_outq.c_cf; + zst->zst_tbc = ndqb(&tp->t_outq, 0); +} + /* * Start or restart transmission. */ Index: dev/marvell/gtmpsc.c =================================================================== RCS file: /cvsroot/src/sys/dev/marvell/gtmpsc.c,v retrieving revision 1.43 diff -u -u -r1.43 gtmpsc.c --- dev/marvell/gtmpsc.c 24 Apr 2011 16:27:00 -0000 1.43 +++ dev/marvell/gtmpsc.c 11 Aug 2012 08:23:47 -0000 @@ -116,6 +116,7 @@ STATIC void gtmpsc_softintr(void *); STATIC void gtmpscstart(struct tty *); +STATIC void gtmpscflush(struct tty *); STATIC int gtmpscparam(struct tty *, struct termios *); STATIC void gtmpsc_shutdownhook(void *); @@ -330,6 +331,7 @@ sc->sc_tty = tp = tty_alloc(); tp->t_oproc = gtmpscstart; + tp->t_flush = gtmpscflush; tp->t_param = gtmpscparam; tty_attach(tp); @@ -749,6 +751,20 @@ STATIC void +gtmpscflush(struct tty *tp) +{ + struct gtmpsc_softc *sc; + unsigned int unit; + + unit = GTMPSCUNIT(tp->t_dev); + sc = device_lookup_private(>mpsc_cd, unit); + if (sc == NULL) + return; + sc->sc_tba = tp->t_outq.c_cf; + sc->sc_tbc = ndqb(&tp->t_outq, 0); +} + +STATIC void gtmpscstart(struct tty *tp) { struct gtmpsc_softc *sc; Index: dev/sbus/magma.c =================================================================== RCS file: /cvsroot/src/sys/dev/sbus/magma.c,v retrieving revision 1.55 diff -u -u -r1.55 magma.c --- dev/sbus/magma.c 24 Apr 2011 16:27:01 -0000 1.55 +++ dev/sbus/magma.c 11 Aug 2012 08:23:53 -0000 @@ -811,6 +811,7 @@ * mttytty return tty pointer for mtty * mttystop stop mtty device * mtty_start start mtty device + * mtty_flush reset output queue * mtty_param set mtty parameters * mtty_modem_control set modem control lines */ @@ -848,6 +849,7 @@ } tty_attach(tp); tp->t_oproc = mtty_start; + tp->t_flush = mtty_flush; tp->t_param = mtty_param; mp->mp_tty = tp; @@ -1156,6 +1158,16 @@ splx(s); } +void +mtty_flush(struct tty *tp) +{ + struct mtty_softc *ms = device_lookup_private(&mtty_cd, + MAGMA_CARD(tp->t_dev)); + struct mtty_port *mp = &ms->ms_port[MAGMA_PORT(tp->t_dev)]; + mp->mp_txc = ndqb(&tp->t_outq, 0); + mp->mp_txp = tp->t_outq.c_cf; +} + /* * Start output, after a stop. */ Index: dev/sbus/magmareg.h =================================================================== RCS file: /cvsroot/src/sys/dev/sbus/magmareg.h,v retrieving revision 1.16 diff -u -u -r1.16 magmareg.h --- dev/sbus/magmareg.h 17 Sep 2009 16:28:12 -0000 1.16 +++ dev/sbus/magmareg.h 11 Aug 2012 08:23:54 -0000 @@ -212,6 +212,7 @@ int mtty_modem_control(struct mtty_port *, int, int); int mtty_param(struct tty *, struct termios *); void mtty_start(struct tty *); +void mtty_flush(struct tty *); int mbpp_match(device_t, cfdata_t, void *); void mbpp_attach(device_t, device_t, void *); Index: dev/sbus/spif.c =================================================================== RCS file: /cvsroot/src/sys/dev/sbus/spif.c,v retrieving revision 1.28 diff -u -u -r1.28 spif.c --- dev/sbus/spif.c 18 Jul 2011 00:58:52 -0000 1.28 +++ dev/sbus/spif.c 11 Aug 2012 08:23:55 -0000 @@ -294,6 +294,7 @@ tp = tty_alloc(); tp->t_oproc = stty_start; + tp->t_flush = stty_flush; tp->t_param = stty_param; sp->sp_tty = tp; @@ -689,6 +690,16 @@ } void +stty_flush(struct tty *tp) +{ + struct stty_softc *stc = device_lookup_private(&stty_cd, + SPIF_CARD(tp->t_dev)); + struct stty_port *sp = &stc->sc_port[SPIF_PORT(tp->t_dev)]; + sp->sp_txc = ndqb(&tp->t_outq, 0); + sp->sp_txp = tp->t_outq.c_cf; +} + +void stty_start(struct tty *tp) { struct stty_softc *stc = device_lookup_private(&stty_cd, Index: dev/sbus/spifreg.h =================================================================== RCS file: /cvsroot/src/sys/dev/sbus/spifreg.h,v retrieving revision 1.4 diff -u -u -r1.4 spifreg.h --- dev/sbus/spifreg.h 12 May 2009 14:43:59 -0000 1.4 +++ dev/sbus/spifreg.h 11 Aug 2012 08:23:55 -0000 @@ -408,6 +408,7 @@ void stty_write_ccr(struct spif_softc *, u_int8_t); int stty_compute_baud(speed_t, int, u_int8_t *, u_int8_t *); void stty_start(struct tty *); +void stty_flush(struct tty *); int sbpp_match(device_t, cfdata_t, void *); void sbpp_attach(device_t, device_t, void *); Index: kern/tty.c =================================================================== RCS file: /cvsroot/src/sys/kern/tty.c,v retrieving revision 1.250 diff -u -u -r1.250 tty.c --- kern/tty.c 12 Mar 2012 18:27:08 -0000 1.250 +++ kern/tty.c 11 Aug 2012 08:24:03 -0000 @@ -1349,8 +1349,11 @@ break; case TIOCSQSIZE: if ((error = tty_get_qsize(&s, *(int *)data)) == 0 && - s != tp->t_qsize) + s != tp->t_qsize) { tty_set_qsize(tp, s); + if (tp->t_flush) + (*tp->t_flush)(tp); + } return error; default: /* We may have to load the compat module for this. */ Index: sys/tty.h =================================================================== RCS file: /cvsroot/src/sys/sys/tty.h,v retrieving revision 1.90 diff -u -u -r1.90 tty.h --- sys/tty.h 24 Sep 2011 00:05:38 -0000 1.90 +++ sys/tty.h 11 Aug 2012 08:24:11 -0000 @@ -134,8 +134,8 @@ struct termios t_termios; /* Termios state. */ struct winsize t_winsize; /* Window size. */ /* Start output. */ - void (*t_oproc)(struct tty *); - /* Set hardware state. */ + void (*t_oproc)(struct tty *);/* Set hardware state. */ + void (*t_flush)(struct tty *);/* Reset output queue. */ int (*t_param)(struct tty *, struct termios *); /* Set hardware flow control. */ int (*t_hwiflow)(struct tty *, int);