diff options
author | dyson <dyson@FreeBSD.org> | 1997-07-17 06:01:15 +0000 |
---|---|---|
committer | dyson <dyson@FreeBSD.org> | 1997-07-17 06:01:15 +0000 |
commit | 926b6969fa00c0ba84e4a364a91a8fdd8a1acddb (patch) | |
tree | 5979608261eef2cecf24ef54e777574c7d6c27fd /sys | |
parent | 8e56f80f0ed008608b35f7c2f781637a60931659 (diff) | |
download | FreeBSD-src-926b6969fa00c0ba84e4a364a91a8fdd8a1acddb.zip FreeBSD-src-926b6969fa00c0ba84e4a364a91a8fdd8a1acddb.tar.gz |
Add some support for the 16650 type UARTS.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/conf/NOTES | 3 | ||||
-rw-r--r-- | sys/dev/sio/sio.c | 55 | ||||
-rw-r--r-- | sys/i386/conf/LINT | 3 | ||||
-rw-r--r-- | sys/i386/conf/NOTES | 3 | ||||
-rw-r--r-- | sys/i386/isa/sio.c | 55 | ||||
-rw-r--r-- | sys/isa/sio.c | 55 |
6 files changed, 147 insertions, 27 deletions
diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 5a50e45..d4a5886 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -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): diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 2fe4aa0..90e50a4 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.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 @@ retry: 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 @@ retry: * 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 @@ retry: 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); /* diff --git a/sys/i386/conf/LINT b/sys/i386/conf/LINT index 5a50e45..d4a5886 100644 --- a/sys/i386/conf/LINT +++ b/sys/i386/conf/LINT @@ -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): diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES index 5a50e45..d4a5886 100644 --- a/sys/i386/conf/NOTES +++ b/sys/i386/conf/NOTES @@ -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): diff --git a/sys/i386/isa/sio.c b/sys/i386/isa/sio.c index 2fe4aa0..90e50a4 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.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 @@ retry: 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 @@ retry: * 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 @@ retry: 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); /* diff --git a/sys/isa/sio.c b/sys/isa/sio.c index 2fe4aa0..90e50a4 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.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 @@ retry: 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 @@ retry: * 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 @@ retry: 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); /* |