Add some support for the 16650 type UARTS.

This commit is contained in:
John Dyson 1997-07-17 06:01:15 +00:00
parent 5aaef07c50
commit 955bc15107
6 changed files with 147 additions and 27 deletions

View File

@ -2,7 +2,7 @@
# LINT -- config file for checking all the sources, tries to pull in
# as much of the source tree as it can.
#
# $Id: LINT,v 1.349 1997/07/01 00:14:39 bde Exp $
# $Id: LINT,v 1.350 1997/07/08 15:39:29 ache Exp $
#
# NB: You probably don't want to try running a kernel built from this
# file. Instead, you should start from GENERIC, and add options from
@ -834,6 +834,7 @@ device sio0 at isa? port "IO_COM1" tty flags 0x10 irq 4 vector siointr
# 0x20 force this unit to be the console (unless there is another
# higher priority console). This replaces the COMCONSOLE option.
# 0x40 reserve this unit for low level console operations. Do not
# 0x20000 supports 16650 type devices with hardware RTS/CTS && larger buffers.
#
# Options for serial drivers that support consoles (only for sio now):

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
* $Id: sio.c,v 1.170 1997/06/04 04:52:39 pst Exp $
* $Id: sio.c,v 1.171 1997/06/04 16:25:14 pst Exp $
*/
#include "opt_comconsole.h"
@ -121,6 +121,7 @@
#define COM_NOFIFO(dev) ((dev)->id_flags & 0x02)
#define COM_VERBOSE(dev) ((dev)->id_flags & 0x80)
#define COM_NOTST3(dev) ((dev)->id_flags & 0x10000)
#define COM_ST16650A(dev) ((dev)->id_flags & 0x20000)
#define COM_FIFOSIZE(dev) (((dev)->id_flags & 0xff000000) >> 24)
#define com_scr 7 /* scratch register for 16450-16550 (R/W) */
@ -198,6 +199,7 @@ struct com_s {
u_char extra_state; /* more flag bits, separate for order trick */
u_char fifo_image; /* copy of value written to FIFO */
bool_t hasfifo; /* nonzero for 16550 UARTs */
bool_t st16650a; /* Is a Startech 16650A or RTS/CTS compat */
bool_t loses_outints; /* nonzero if device loses output interrupts */
u_char mcr_image; /* copy of value written to MCR */
#ifdef COM_MULTIPORT
@ -934,6 +936,7 @@ sioattach(isdp)
}
outb(iobase + com_fifo, FIFO_ENABLE | FIFO_RX_HIGH);
DELAY(100);
com->st16650a = 0;
switch (inb(com->int_id_port) & IIR_FIFO_MASK) {
case FIFO_RX_LOW:
printf(" 16450");
@ -949,8 +952,14 @@ sioattach(isdp)
printf(" 16550A fifo disabled");
} else {
com->hasfifo = TRUE;
printf(" 16550A");
com->tx_fifo_size = COM_FIFOSIZE(isdp);
if (COM_ST16650A(isdp)) {
com->st16650a = 1;
com->tx_fifo_size = 32;
printf(" ST16650A");
} else {
com->tx_fifo_size = COM_FIFOSIZE(isdp);
printf(" 16550A");
}
}
#ifdef COM_ESP
for (espp = likely_esp_ports; *espp != 0; espp++)
@ -959,11 +968,14 @@ sioattach(isdp)
break;
}
#endif
if (!com->tx_fifo_size)
com->tx_fifo_size = 16;
else
printf(" lookalike with %d bytes FIFO",
com->tx_fifo_size);
if (!com->st16650a) {
if (!com->tx_fifo_size)
com->tx_fifo_size = 16;
else
printf(" lookalike with %d bytes FIFO",
com->tx_fifo_size);
}
break;
}
@ -2082,10 +2094,18 @@ comparam(tp, t)
if (inb(iobase + com_dlbh) != dlbh)
outb(iobase + com_dlbh, dlbh);
}
outb(iobase + com_cfcr, com->cfcr_image = cfcr);
if (!(tp->t_state & TS_TTSTOP))
com->state |= CS_TTGO;
if (cflag & CRTS_IFLOW) {
if (com->st16650a) {
outb(iobase + com_cfcr, 0xbf);
outb(iobase + com_fifo, inb(iobase + com_fifo) | 0x40);
}
com->state |= CS_RTS_IFLOW;
/*
* If CS_RTS_IFLOW just changed from off to on, the change
@ -2100,8 +2120,13 @@ comparam(tp, t)
* on here, since comstart() won't do it later.
*/
outb(com->modem_ctl_port, com->mcr_image |= MCR_RTS);
if (com->st16650a) {
outb(iobase + com_cfcr, 0xbf);
outb(iobase + com_fifo, inb(iobase + com_fifo) & ~0x40);
}
}
/*
* Set up state to handle output flow control.
* XXX - worth handling MDMBUF (DCD) flow control at the lowest level?
@ -2113,7 +2138,21 @@ comparam(tp, t)
com->state |= CS_CTS_OFLOW;
if (!(com->last_modem_status & MSR_CTS))
com->state &= ~CS_ODEVREADY;
if (com->st16650a) {
outb(iobase + com_cfcr, 0xbf);
outb(iobase + com_fifo, inb(iobase + com_fifo) | 0x80);
}
} else {
if (com->st16650a) {
outb(iobase + com_cfcr, 0xbf);
outb(iobase + com_fifo, inb(iobase + com_fifo) & ~0x80);
}
}
outb(iobase + com_cfcr, com->cfcr_image);
/* XXX shouldn't call functions while intrs are disabled. */
disc_optim(tp, t, com);
/*

View File

@ -2,7 +2,7 @@
# LINT -- config file for checking all the sources, tries to pull in
# as much of the source tree as it can.
#
# $Id: LINT,v 1.349 1997/07/01 00:14:39 bde Exp $
# $Id: LINT,v 1.350 1997/07/08 15:39:29 ache Exp $
#
# NB: You probably don't want to try running a kernel built from this
# file. Instead, you should start from GENERIC, and add options from
@ -834,6 +834,7 @@ device sio0 at isa? port "IO_COM1" tty flags 0x10 irq 4 vector siointr
# 0x20 force this unit to be the console (unless there is another
# higher priority console). This replaces the COMCONSOLE option.
# 0x40 reserve this unit for low level console operations. Do not
# 0x20000 supports 16650 type devices with hardware RTS/CTS && larger buffers.
#
# Options for serial drivers that support consoles (only for sio now):

View File

@ -2,7 +2,7 @@
# LINT -- config file for checking all the sources, tries to pull in
# as much of the source tree as it can.
#
# $Id: LINT,v 1.349 1997/07/01 00:14:39 bde Exp $
# $Id: LINT,v 1.350 1997/07/08 15:39:29 ache Exp $
#
# NB: You probably don't want to try running a kernel built from this
# file. Instead, you should start from GENERIC, and add options from
@ -834,6 +834,7 @@ device sio0 at isa? port "IO_COM1" tty flags 0x10 irq 4 vector siointr
# 0x20 force this unit to be the console (unless there is another
# higher priority console). This replaces the COMCONSOLE option.
# 0x40 reserve this unit for low level console operations. Do not
# 0x20000 supports 16650 type devices with hardware RTS/CTS && larger buffers.
#
# Options for serial drivers that support consoles (only for sio now):

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
* $Id: sio.c,v 1.170 1997/06/04 04:52:39 pst Exp $
* $Id: sio.c,v 1.171 1997/06/04 16:25:14 pst Exp $
*/
#include "opt_comconsole.h"
@ -121,6 +121,7 @@
#define COM_NOFIFO(dev) ((dev)->id_flags & 0x02)
#define COM_VERBOSE(dev) ((dev)->id_flags & 0x80)
#define COM_NOTST3(dev) ((dev)->id_flags & 0x10000)
#define COM_ST16650A(dev) ((dev)->id_flags & 0x20000)
#define COM_FIFOSIZE(dev) (((dev)->id_flags & 0xff000000) >> 24)
#define com_scr 7 /* scratch register for 16450-16550 (R/W) */
@ -198,6 +199,7 @@ struct com_s {
u_char extra_state; /* more flag bits, separate for order trick */
u_char fifo_image; /* copy of value written to FIFO */
bool_t hasfifo; /* nonzero for 16550 UARTs */
bool_t st16650a; /* Is a Startech 16650A or RTS/CTS compat */
bool_t loses_outints; /* nonzero if device loses output interrupts */
u_char mcr_image; /* copy of value written to MCR */
#ifdef COM_MULTIPORT
@ -934,6 +936,7 @@ sioattach(isdp)
}
outb(iobase + com_fifo, FIFO_ENABLE | FIFO_RX_HIGH);
DELAY(100);
com->st16650a = 0;
switch (inb(com->int_id_port) & IIR_FIFO_MASK) {
case FIFO_RX_LOW:
printf(" 16450");
@ -949,8 +952,14 @@ sioattach(isdp)
printf(" 16550A fifo disabled");
} else {
com->hasfifo = TRUE;
printf(" 16550A");
com->tx_fifo_size = COM_FIFOSIZE(isdp);
if (COM_ST16650A(isdp)) {
com->st16650a = 1;
com->tx_fifo_size = 32;
printf(" ST16650A");
} else {
com->tx_fifo_size = COM_FIFOSIZE(isdp);
printf(" 16550A");
}
}
#ifdef COM_ESP
for (espp = likely_esp_ports; *espp != 0; espp++)
@ -959,11 +968,14 @@ sioattach(isdp)
break;
}
#endif
if (!com->tx_fifo_size)
com->tx_fifo_size = 16;
else
printf(" lookalike with %d bytes FIFO",
com->tx_fifo_size);
if (!com->st16650a) {
if (!com->tx_fifo_size)
com->tx_fifo_size = 16;
else
printf(" lookalike with %d bytes FIFO",
com->tx_fifo_size);
}
break;
}
@ -2082,10 +2094,18 @@ comparam(tp, t)
if (inb(iobase + com_dlbh) != dlbh)
outb(iobase + com_dlbh, dlbh);
}
outb(iobase + com_cfcr, com->cfcr_image = cfcr);
if (!(tp->t_state & TS_TTSTOP))
com->state |= CS_TTGO;
if (cflag & CRTS_IFLOW) {
if (com->st16650a) {
outb(iobase + com_cfcr, 0xbf);
outb(iobase + com_fifo, inb(iobase + com_fifo) | 0x40);
}
com->state |= CS_RTS_IFLOW;
/*
* If CS_RTS_IFLOW just changed from off to on, the change
@ -2100,8 +2120,13 @@ comparam(tp, t)
* on here, since comstart() won't do it later.
*/
outb(com->modem_ctl_port, com->mcr_image |= MCR_RTS);
if (com->st16650a) {
outb(iobase + com_cfcr, 0xbf);
outb(iobase + com_fifo, inb(iobase + com_fifo) & ~0x40);
}
}
/*
* Set up state to handle output flow control.
* XXX - worth handling MDMBUF (DCD) flow control at the lowest level?
@ -2113,7 +2138,21 @@ comparam(tp, t)
com->state |= CS_CTS_OFLOW;
if (!(com->last_modem_status & MSR_CTS))
com->state &= ~CS_ODEVREADY;
if (com->st16650a) {
outb(iobase + com_cfcr, 0xbf);
outb(iobase + com_fifo, inb(iobase + com_fifo) | 0x80);
}
} else {
if (com->st16650a) {
outb(iobase + com_cfcr, 0xbf);
outb(iobase + com_fifo, inb(iobase + com_fifo) & ~0x80);
}
}
outb(iobase + com_cfcr, com->cfcr_image);
/* XXX shouldn't call functions while intrs are disabled. */
disc_optim(tp, t, com);
/*

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
* $Id: sio.c,v 1.170 1997/06/04 04:52:39 pst Exp $
* $Id: sio.c,v 1.171 1997/06/04 16:25:14 pst Exp $
*/
#include "opt_comconsole.h"
@ -121,6 +121,7 @@
#define COM_NOFIFO(dev) ((dev)->id_flags & 0x02)
#define COM_VERBOSE(dev) ((dev)->id_flags & 0x80)
#define COM_NOTST3(dev) ((dev)->id_flags & 0x10000)
#define COM_ST16650A(dev) ((dev)->id_flags & 0x20000)
#define COM_FIFOSIZE(dev) (((dev)->id_flags & 0xff000000) >> 24)
#define com_scr 7 /* scratch register for 16450-16550 (R/W) */
@ -198,6 +199,7 @@ struct com_s {
u_char extra_state; /* more flag bits, separate for order trick */
u_char fifo_image; /* copy of value written to FIFO */
bool_t hasfifo; /* nonzero for 16550 UARTs */
bool_t st16650a; /* Is a Startech 16650A or RTS/CTS compat */
bool_t loses_outints; /* nonzero if device loses output interrupts */
u_char mcr_image; /* copy of value written to MCR */
#ifdef COM_MULTIPORT
@ -934,6 +936,7 @@ sioattach(isdp)
}
outb(iobase + com_fifo, FIFO_ENABLE | FIFO_RX_HIGH);
DELAY(100);
com->st16650a = 0;
switch (inb(com->int_id_port) & IIR_FIFO_MASK) {
case FIFO_RX_LOW:
printf(" 16450");
@ -949,8 +952,14 @@ sioattach(isdp)
printf(" 16550A fifo disabled");
} else {
com->hasfifo = TRUE;
printf(" 16550A");
com->tx_fifo_size = COM_FIFOSIZE(isdp);
if (COM_ST16650A(isdp)) {
com->st16650a = 1;
com->tx_fifo_size = 32;
printf(" ST16650A");
} else {
com->tx_fifo_size = COM_FIFOSIZE(isdp);
printf(" 16550A");
}
}
#ifdef COM_ESP
for (espp = likely_esp_ports; *espp != 0; espp++)
@ -959,11 +968,14 @@ sioattach(isdp)
break;
}
#endif
if (!com->tx_fifo_size)
com->tx_fifo_size = 16;
else
printf(" lookalike with %d bytes FIFO",
com->tx_fifo_size);
if (!com->st16650a) {
if (!com->tx_fifo_size)
com->tx_fifo_size = 16;
else
printf(" lookalike with %d bytes FIFO",
com->tx_fifo_size);
}
break;
}
@ -2082,10 +2094,18 @@ comparam(tp, t)
if (inb(iobase + com_dlbh) != dlbh)
outb(iobase + com_dlbh, dlbh);
}
outb(iobase + com_cfcr, com->cfcr_image = cfcr);
if (!(tp->t_state & TS_TTSTOP))
com->state |= CS_TTGO;
if (cflag & CRTS_IFLOW) {
if (com->st16650a) {
outb(iobase + com_cfcr, 0xbf);
outb(iobase + com_fifo, inb(iobase + com_fifo) | 0x40);
}
com->state |= CS_RTS_IFLOW;
/*
* If CS_RTS_IFLOW just changed from off to on, the change
@ -2100,8 +2120,13 @@ comparam(tp, t)
* on here, since comstart() won't do it later.
*/
outb(com->modem_ctl_port, com->mcr_image |= MCR_RTS);
if (com->st16650a) {
outb(iobase + com_cfcr, 0xbf);
outb(iobase + com_fifo, inb(iobase + com_fifo) & ~0x40);
}
}
/*
* Set up state to handle output flow control.
* XXX - worth handling MDMBUF (DCD) flow control at the lowest level?
@ -2113,7 +2138,21 @@ comparam(tp, t)
com->state |= CS_CTS_OFLOW;
if (!(com->last_modem_status & MSR_CTS))
com->state &= ~CS_ODEVREADY;
if (com->st16650a) {
outb(iobase + com_cfcr, 0xbf);
outb(iobase + com_fifo, inb(iobase + com_fifo) | 0x80);
}
} else {
if (com->st16650a) {
outb(iobase + com_cfcr, 0xbf);
outb(iobase + com_fifo, inb(iobase + com_fifo) & ~0x80);
}
}
outb(iobase + com_cfcr, com->cfcr_image);
/* XXX shouldn't call functions while intrs are disabled. */
disc_optim(tp, t, com);
/*