summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1995-04-02 01:47:06 +0000
committerache <ache@FreeBSD.org>1995-04-02 01:47:06 +0000
commitc52ef7084edadde6d4660218771e70067c39463c (patch)
tree3fef4e0b055604529c915c851fe4d12ebd949327
parent0eb0d8c0e573fd8faa9f216b0dbd6dda81e13301 (diff)
downloadFreeBSD-src-c52ef7084edadde6d4660218771e70067c39463c.zip
FreeBSD-src-c52ef7084edadde6d4660218771e70067c39463c.tar.gz
Move SET_BYPASS macro to function per Bruce suggestion.
Add set_bypass() call after l_close. Move ttioctl()/set_bypass() pair under spltty() protection
-rw-r--r--sys/dev/sio/sio.c49
-rw-r--r--sys/i386/isa/sio.c49
-rw-r--r--sys/isa/sio.c49
3 files changed, 87 insertions, 60 deletions
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c
index 80d7e6a..7b67e4c 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.82 1995/04/01 22:57:43 ache Exp $
+ * $Id: sio.c,v 1.83 1995/04/01 23:56:08 ache Exp $
*/
#include "sio.h"
@@ -86,19 +86,6 @@ termioschars(t)
#define RB_I_HIGH_WATER (TTYHOG - 2 * RS_IBUFSIZE)
#define RS_IBUFSIZE 256
-#define SET_BYPASS(tp, t) \
- if (!((t)->c_iflag & (ICRNL | IGNCR | IMAXBEL | INLCR | ISTRIP \
- | IXOFF | IXON)) \
- && (!((t)->c_iflag & BRKINT) || ((t)->c_iflag & IGNBRK)) \
- && (!((t)->c_iflag & PARMRK) || \
- ((t)->c_iflag & (IGNPAR|IGNBRK)) == (IGNPAR|IGNBRK)) \
- && !((t)->c_lflag & (ECHO | ECHONL | ICANON | IEXTEN | ISIG \
- | PENDIN)) \
- && linesw[(tp)->t_line].l_rint == ttyinput) \
- (tp)->t_state |= TS_CAN_BYPASS_L_RINT; \
- else \
- (tp)->t_state &= ~TS_CAN_BYPASS_L_RINT
-
#define CALLOUT_MASK 0x80
#define CONTROL_MASK 0x60
#define CONTROL_INIT_STATE 0x20
@@ -293,6 +280,7 @@ static void sioregisterdev __P((struct isa_device *id));
static void comstart __P((struct tty *tp));
static timeout_t comwakeup;
static int tiocm_xxx2mcr __P((int tiocm_xxx));
+static void set_bypass __P((struct tty *tp, struct termios *t));
#ifdef DSI_SOFT_MODEM
static int LoadSoftModem __P((int unit,int base_io, u_long size, u_char *ptr));
@@ -898,7 +886,7 @@ open_top:
goto open_top;
}
error = (*linesw[tp->t_line].l_open)(dev, tp);
- SET_BYPASS(tp, &(tp->t_termios));
+ set_bypass(tp, &(tp->t_termios));
if (tp->t_state & TS_ISOPEN && mynor & CALLOUT_MASK)
com->active_out = TRUE;
out:
@@ -928,6 +916,7 @@ sioclose(dev, flag, mode, p)
tp = com->tp;
s = spltty();
(*linesw[tp->t_line].l_close)(tp, flag);
+ set_bypass(tp, &(tp->t_termios));
siostop(tp, FREAD | FWRITE);
comhardclose(com);
ttyclose(tp);
@@ -1354,11 +1343,13 @@ sioioctl(dev, cmd, data, flag, p)
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
if (error >= 0)
return (error);
+ s = spltty();
error = ttioctl(tp, cmd, data, flag);
- SET_BYPASS(tp, &(tp->t_termios));
- if (error >= 0)
+ set_bypass(tp, &(tp->t_termios));
+ if (error >= 0) {
+ splx(s);
return (error);
- s = spltty();
+ }
switch (cmd) {
case TIOCSBRK:
outb(iobase + com_cfcr, com->cfcr_image |= CFCR_SBREAK);
@@ -1755,8 +1746,7 @@ retry:
if (!(com->last_modem_status & MSR_CTS))
com->state &= ~CS_ODEVREADY;
}
-
- SET_BYPASS(tp, t);
+ set_bypass(tp, t);
/*
* Recover from fiddling with CS_TTGO. We used to call siointr1()
* unconditionally, but that defeated the careful discarding of
@@ -1978,6 +1968,25 @@ comwakeup(chan)
}
}
+static void
+set_bypass(tp, t)
+ struct tty *tp;
+ struct termios *t;
+{
+
+ if (!(t->c_iflag & (ICRNL | IGNCR | IMAXBEL | INLCR | ISTRIP
+ | IXOFF | IXON))
+ && (!(t->c_iflag & BRKINT) || (t->c_iflag & IGNBRK))
+ && (!(t->c_iflag & PARMRK) ||
+ (t->c_iflag & (IGNPAR|IGNBRK)) == (IGNPAR|IGNBRK))
+ && !(t->c_lflag & (ECHO | ECHONL | ICANON | IEXTEN | ISIG
+ | PENDIN))
+ && linesw[tp->t_line].l_rint == ttyinput)
+ tp->t_state |= TS_CAN_BYPASS_L_RINT;
+ else
+ tp->t_state &= ~TS_CAN_BYPASS_L_RINT;
+}
+
/*
* Following are all routines needed for SIO to act as console
*/
diff --git a/sys/i386/isa/sio.c b/sys/i386/isa/sio.c
index 80d7e6a..7b67e4c 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.82 1995/04/01 22:57:43 ache Exp $
+ * $Id: sio.c,v 1.83 1995/04/01 23:56:08 ache Exp $
*/
#include "sio.h"
@@ -86,19 +86,6 @@ termioschars(t)
#define RB_I_HIGH_WATER (TTYHOG - 2 * RS_IBUFSIZE)
#define RS_IBUFSIZE 256
-#define SET_BYPASS(tp, t) \
- if (!((t)->c_iflag & (ICRNL | IGNCR | IMAXBEL | INLCR | ISTRIP \
- | IXOFF | IXON)) \
- && (!((t)->c_iflag & BRKINT) || ((t)->c_iflag & IGNBRK)) \
- && (!((t)->c_iflag & PARMRK) || \
- ((t)->c_iflag & (IGNPAR|IGNBRK)) == (IGNPAR|IGNBRK)) \
- && !((t)->c_lflag & (ECHO | ECHONL | ICANON | IEXTEN | ISIG \
- | PENDIN)) \
- && linesw[(tp)->t_line].l_rint == ttyinput) \
- (tp)->t_state |= TS_CAN_BYPASS_L_RINT; \
- else \
- (tp)->t_state &= ~TS_CAN_BYPASS_L_RINT
-
#define CALLOUT_MASK 0x80
#define CONTROL_MASK 0x60
#define CONTROL_INIT_STATE 0x20
@@ -293,6 +280,7 @@ static void sioregisterdev __P((struct isa_device *id));
static void comstart __P((struct tty *tp));
static timeout_t comwakeup;
static int tiocm_xxx2mcr __P((int tiocm_xxx));
+static void set_bypass __P((struct tty *tp, struct termios *t));
#ifdef DSI_SOFT_MODEM
static int LoadSoftModem __P((int unit,int base_io, u_long size, u_char *ptr));
@@ -898,7 +886,7 @@ open_top:
goto open_top;
}
error = (*linesw[tp->t_line].l_open)(dev, tp);
- SET_BYPASS(tp, &(tp->t_termios));
+ set_bypass(tp, &(tp->t_termios));
if (tp->t_state & TS_ISOPEN && mynor & CALLOUT_MASK)
com->active_out = TRUE;
out:
@@ -928,6 +916,7 @@ sioclose(dev, flag, mode, p)
tp = com->tp;
s = spltty();
(*linesw[tp->t_line].l_close)(tp, flag);
+ set_bypass(tp, &(tp->t_termios));
siostop(tp, FREAD | FWRITE);
comhardclose(com);
ttyclose(tp);
@@ -1354,11 +1343,13 @@ sioioctl(dev, cmd, data, flag, p)
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
if (error >= 0)
return (error);
+ s = spltty();
error = ttioctl(tp, cmd, data, flag);
- SET_BYPASS(tp, &(tp->t_termios));
- if (error >= 0)
+ set_bypass(tp, &(tp->t_termios));
+ if (error >= 0) {
+ splx(s);
return (error);
- s = spltty();
+ }
switch (cmd) {
case TIOCSBRK:
outb(iobase + com_cfcr, com->cfcr_image |= CFCR_SBREAK);
@@ -1755,8 +1746,7 @@ retry:
if (!(com->last_modem_status & MSR_CTS))
com->state &= ~CS_ODEVREADY;
}
-
- SET_BYPASS(tp, t);
+ set_bypass(tp, t);
/*
* Recover from fiddling with CS_TTGO. We used to call siointr1()
* unconditionally, but that defeated the careful discarding of
@@ -1978,6 +1968,25 @@ comwakeup(chan)
}
}
+static void
+set_bypass(tp, t)
+ struct tty *tp;
+ struct termios *t;
+{
+
+ if (!(t->c_iflag & (ICRNL | IGNCR | IMAXBEL | INLCR | ISTRIP
+ | IXOFF | IXON))
+ && (!(t->c_iflag & BRKINT) || (t->c_iflag & IGNBRK))
+ && (!(t->c_iflag & PARMRK) ||
+ (t->c_iflag & (IGNPAR|IGNBRK)) == (IGNPAR|IGNBRK))
+ && !(t->c_lflag & (ECHO | ECHONL | ICANON | IEXTEN | ISIG
+ | PENDIN))
+ && linesw[tp->t_line].l_rint == ttyinput)
+ tp->t_state |= TS_CAN_BYPASS_L_RINT;
+ else
+ tp->t_state &= ~TS_CAN_BYPASS_L_RINT;
+}
+
/*
* Following are all routines needed for SIO to act as console
*/
diff --git a/sys/isa/sio.c b/sys/isa/sio.c
index 80d7e6a..7b67e4c 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.82 1995/04/01 22:57:43 ache Exp $
+ * $Id: sio.c,v 1.83 1995/04/01 23:56:08 ache Exp $
*/
#include "sio.h"
@@ -86,19 +86,6 @@ termioschars(t)
#define RB_I_HIGH_WATER (TTYHOG - 2 * RS_IBUFSIZE)
#define RS_IBUFSIZE 256
-#define SET_BYPASS(tp, t) \
- if (!((t)->c_iflag & (ICRNL | IGNCR | IMAXBEL | INLCR | ISTRIP \
- | IXOFF | IXON)) \
- && (!((t)->c_iflag & BRKINT) || ((t)->c_iflag & IGNBRK)) \
- && (!((t)->c_iflag & PARMRK) || \
- ((t)->c_iflag & (IGNPAR|IGNBRK)) == (IGNPAR|IGNBRK)) \
- && !((t)->c_lflag & (ECHO | ECHONL | ICANON | IEXTEN | ISIG \
- | PENDIN)) \
- && linesw[(tp)->t_line].l_rint == ttyinput) \
- (tp)->t_state |= TS_CAN_BYPASS_L_RINT; \
- else \
- (tp)->t_state &= ~TS_CAN_BYPASS_L_RINT
-
#define CALLOUT_MASK 0x80
#define CONTROL_MASK 0x60
#define CONTROL_INIT_STATE 0x20
@@ -293,6 +280,7 @@ static void sioregisterdev __P((struct isa_device *id));
static void comstart __P((struct tty *tp));
static timeout_t comwakeup;
static int tiocm_xxx2mcr __P((int tiocm_xxx));
+static void set_bypass __P((struct tty *tp, struct termios *t));
#ifdef DSI_SOFT_MODEM
static int LoadSoftModem __P((int unit,int base_io, u_long size, u_char *ptr));
@@ -898,7 +886,7 @@ open_top:
goto open_top;
}
error = (*linesw[tp->t_line].l_open)(dev, tp);
- SET_BYPASS(tp, &(tp->t_termios));
+ set_bypass(tp, &(tp->t_termios));
if (tp->t_state & TS_ISOPEN && mynor & CALLOUT_MASK)
com->active_out = TRUE;
out:
@@ -928,6 +916,7 @@ sioclose(dev, flag, mode, p)
tp = com->tp;
s = spltty();
(*linesw[tp->t_line].l_close)(tp, flag);
+ set_bypass(tp, &(tp->t_termios));
siostop(tp, FREAD | FWRITE);
comhardclose(com);
ttyclose(tp);
@@ -1354,11 +1343,13 @@ sioioctl(dev, cmd, data, flag, p)
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
if (error >= 0)
return (error);
+ s = spltty();
error = ttioctl(tp, cmd, data, flag);
- SET_BYPASS(tp, &(tp->t_termios));
- if (error >= 0)
+ set_bypass(tp, &(tp->t_termios));
+ if (error >= 0) {
+ splx(s);
return (error);
- s = spltty();
+ }
switch (cmd) {
case TIOCSBRK:
outb(iobase + com_cfcr, com->cfcr_image |= CFCR_SBREAK);
@@ -1755,8 +1746,7 @@ retry:
if (!(com->last_modem_status & MSR_CTS))
com->state &= ~CS_ODEVREADY;
}
-
- SET_BYPASS(tp, t);
+ set_bypass(tp, t);
/*
* Recover from fiddling with CS_TTGO. We used to call siointr1()
* unconditionally, but that defeated the careful discarding of
@@ -1978,6 +1968,25 @@ comwakeup(chan)
}
}
+static void
+set_bypass(tp, t)
+ struct tty *tp;
+ struct termios *t;
+{
+
+ if (!(t->c_iflag & (ICRNL | IGNCR | IMAXBEL | INLCR | ISTRIP
+ | IXOFF | IXON))
+ && (!(t->c_iflag & BRKINT) || (t->c_iflag & IGNBRK))
+ && (!(t->c_iflag & PARMRK) ||
+ (t->c_iflag & (IGNPAR|IGNBRK)) == (IGNPAR|IGNBRK))
+ && !(t->c_lflag & (ECHO | ECHONL | ICANON | IEXTEN | ISIG
+ | PENDIN))
+ && linesw[tp->t_line].l_rint == ttyinput)
+ tp->t_state |= TS_CAN_BYPASS_L_RINT;
+ else
+ tp->t_state &= ~TS_CAN_BYPASS_L_RINT;
+}
+
/*
* Following are all routines needed for SIO to act as console
*/
OpenPOWER on IntegriCloud