diff options
-rw-r--r-- | share/man/man4/man4.i386/sio.4 | 6 | ||||
-rw-r--r-- | share/man/man4/sio.4 | 6 | ||||
-rw-r--r-- | sys/conf/NOTES | 3 | ||||
-rw-r--r-- | sys/dev/sio/sio.c | 121 | ||||
-rw-r--r-- | sys/i386/conf/LINT | 3 | ||||
-rw-r--r-- | sys/i386/conf/NOTES | 3 | ||||
-rw-r--r-- | sys/i386/isa/sio.c | 121 | ||||
-rw-r--r-- | sys/isa/sio.c | 121 |
8 files changed, 376 insertions, 8 deletions
diff --git a/share/man/man4/man4.i386/sio.4 b/share/man/man4/man4.i386/sio.4 index ee403db..58fe59b 100644 --- a/share/man/man4/man4.i386/sio.4 +++ b/share/man/man4/man4.i386/sio.4 @@ -34,7 +34,7 @@ .\" .\" from: @(#)dca.4 5.2 (Berkeley) 3/27/91 .\" from: com.4,v 1.1 1993/08/06 11:19:07 cgd Exp -.\" $Id: sio.4,v 1.16 1995/06/26 06:05:30 bde Exp $ +.\" $Id: sio.4,v 1.17 1995/10/10 03:43:10 bde Exp $ .\" .Dd October 10, 1995 .Dt SIO 4 i386 @@ -63,6 +63,10 @@ For Boca Board compatible multiport cards with 8 ports: .Cd "..." .Cd "device sio11 at isa? port 0x138 tty flags 0xb05 irq 12 vector siointr" .sp +For Hayes ESP cards: +.Cd "options" \&"COM_ESP\&" +.Cd "..." +.sp Meaning of \fBflags\fR: .br \fB0x0001\fR shared IRQs diff --git a/share/man/man4/sio.4 b/share/man/man4/sio.4 index ee403db..58fe59b 100644 --- a/share/man/man4/sio.4 +++ b/share/man/man4/sio.4 @@ -34,7 +34,7 @@ .\" .\" from: @(#)dca.4 5.2 (Berkeley) 3/27/91 .\" from: com.4,v 1.1 1993/08/06 11:19:07 cgd Exp -.\" $Id: sio.4,v 1.16 1995/06/26 06:05:30 bde Exp $ +.\" $Id: sio.4,v 1.17 1995/10/10 03:43:10 bde Exp $ .\" .Dd October 10, 1995 .Dt SIO 4 i386 @@ -63,6 +63,10 @@ For Boca Board compatible multiport cards with 8 ports: .Cd "..." .Cd "device sio11 at isa? port 0x138 tty flags 0xb05 irq 12 vector siointr" .sp +For Hayes ESP cards: +.Cd "options" \&"COM_ESP\&" +.Cd "..." +.sp Meaning of \fBflags\fR: .br \fB0x0001\fR shared IRQs diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 72c9db5..48fd42b 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.229 1995/12/26 14:01:16 bde Exp $ +# $Id: LINT,v 1.230 1995/12/29 02:04:20 jkh 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 @@ -580,6 +580,7 @@ device sio0 at isa? port "IO_COM1" tty irq 4 vector siointr # Options for sio: options COMCONSOLE #prefer serial console to video console +options COM_ESP #code for Hayes ESP options COM_MULTIPORT #code for some cards with shared IRQs options DSI_SOFT_MODEM #code for DSI Softmodems options BREAK_TO_DEBUGGER #a BREAK on a comconsole goes to diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 7829045..712c18b 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.129 1995/12/10 20:54:38 bde Exp $ + * $Id: sio.c,v 1.130 1995/12/22 14:58:55 bde Exp $ */ #include "sio.h" @@ -68,6 +68,10 @@ #include <i386/isa/isa.h> #include <i386/isa/isa_device.h> #include <i386/isa/sioreg.h> + +#ifdef COM_ESP +#include <i386/isa/ic/esp.h> +#endif #include <i386/isa/ic/ns16550.h> #include "crd.h" @@ -170,6 +174,9 @@ struct com_s { u_char state; /* miscellaneous flag bits */ bool_t active_out; /* nonzero if the callout device is open */ u_char cfcr_image; /* copy of value written to CFCR */ +#ifdef COM_ESP + bool_t esp; /* is this unit a hayes esp board? */ +#endif u_char fifo_image; /* copy of value written to FIFO */ bool_t hasfifo; /* nonzero for 16550 UARTs */ bool_t loses_outints; /* nonzero if device loses output interrupts */ @@ -205,6 +212,9 @@ struct com_s { struct lbq obufs[2]; /* output buffers */ Port_t data_port; /* i/o ports */ +#ifdef COM_ESP + Port_t esp_port; +#endif Port_t int_id_port; Port_t iobase; Port_t modem_ctl_port; @@ -267,6 +277,8 @@ void siopoll __P((void)); #define siommap nommap #define siostrategy nostrategy +static int espattach __P((struct isa_device *isdp, struct com_s *com, + Port_t esp_port)); static int sioattach __P((struct isa_device *dev)); static timeout_t siodtrwakeup; static void comhardclose __P((struct com_s *com)); @@ -366,6 +378,11 @@ static struct kern_devconf kdc_sio[NSIO] = { { "Serial port", DC_CLS_SERIAL /* class */ } }; + +#ifdef COM_ESP +static Port_t likely_esp_ports[] = { 0x140, 0x180, 0x280, 0 }; +#endif + #if NCRD > 0 /* * PC-Card (PCMCIA) specific code. @@ -704,12 +721,81 @@ sioprobe(dev) return (result); } +#ifdef COM_ESP +static int +espattach(isdp, com, esp_port) + struct isa_device *isdp; + struct com_s *com; + Port_t esp_port; +{ + u_char dips; + u_char val; + + /* + * Check the ESP-specific I/O port to see if we're an ESP + * card. If not, return failure immediately. + */ + if ((inb(esp_port) & 0xf3) == 0) { + printf(" port 0x%x is not an ESP board?\n", esp_port); + return (0); + } + + /* + * We've got something that claims to be a Hayes ESP card. + * Let's hope so. + */ + + /* Get the dip-switch configuration */ + outb(esp_port + ESP_CMD1, ESP_GETDIPS); + dips = inb(esp_port + ESP_STATUS1); + + /* + * Bits 0,1 of dips say which COM port we are. + */ + if (com->iobase == likely_com_ports[dips & 0x03]) + printf(" : ESP"); + else { + printf(" esp_port has com %d\n", dips & 0x03); + return (0); + } + + /* + * Check for ESP version 2.0 or later: bits 4,5,6 = 010. + */ + outb(esp_port + ESP_CMD1, ESP_GETTEST); + val = inb(esp_port + ESP_STATUS1); /* clear reg 1 */ + val = inb(esp_port + ESP_STATUS2); + if ((val & 0x70) < 0x20) { + printf("-old (%o)", val & 0x70); + return (0); + } + + /* + * Check for ability to emulate 16550: bit 7 == 1 + */ + if ((dips & 0x80) == 0) { + printf(" slave"); + return (0); + } + + /* + * Okay, we seem to be a Hayes ESP card. Whee. + */ + com->esp = TRUE; + com->esp_port = esp_port; + return (1); +} +#endif /* COM_ESP */ + static int sioattach(isdp) struct isa_device *isdp; { struct com_s *com; dev_t dev; +#ifdef COM_ESP + Port_t *espp; +#endif Port_t iobase; char name[32]; int s; @@ -838,6 +924,15 @@ sioattach(isdp) com->tx_fifo_size = 16; kdc_sio[unit].kdc_description = "Serial port: National 16550A or compatible"; +#ifdef COM_ESP + for (espp = likely_esp_ports; *espp != 0; espp++) + if (espattach(isdp, com, *espp)) { + com->tx_fifo_size = 1024; + kdc_sio[unit].kdc_description = + "Serial port: Hayes ESP"; + break; + } +#endif } #if 0 /* @@ -868,6 +963,30 @@ sioattach(isdp) #endif break; } +#ifdef COM_ESP + if (com->esp) { + outb(iobase + com_fifo, + FIFO_DMA_MODE | FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST + | FIFO_RX_MEDH); + + /* Set 16550 compatibility mode. */ + outb(com->esp_port + ESP_CMD1, ESP_SETMODE); + outb(com->esp_port + ESP_CMD2, + ESP_MODE_SCALE | ESP_MODE_RTS | ESP_MODE_FIFO); + + /* Set RTS/CTS flow control. */ + outb(com->esp_port + ESP_CMD1, ESP_SETFLOWTYPE); + outb(com->esp_port + ESP_CMD2, ESP_FLOW_RTS); + outb(com->esp_port + ESP_CMD2, ESP_FLOW_CTS); + + /* Set flow-control levels. */ + outb(com->esp_port + ESP_CMD1, ESP_SETRXFLOW); + outb(com->esp_port + ESP_CMD2, HIBYTE(768)); + outb(com->esp_port + ESP_CMD2, LOBYTE(768)); + outb(com->esp_port + ESP_CMD2, HIBYTE(512)); + outb(com->esp_port + ESP_CMD2, LOBYTE(512)); + } +#endif /* COM_ESP */ outb(iobase + com_fifo, 0); determined_type: ; diff --git a/sys/i386/conf/LINT b/sys/i386/conf/LINT index 72c9db5..48fd42b 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.229 1995/12/26 14:01:16 bde Exp $ +# $Id: LINT,v 1.230 1995/12/29 02:04:20 jkh 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 @@ -580,6 +580,7 @@ device sio0 at isa? port "IO_COM1" tty irq 4 vector siointr # Options for sio: options COMCONSOLE #prefer serial console to video console +options COM_ESP #code for Hayes ESP options COM_MULTIPORT #code for some cards with shared IRQs options DSI_SOFT_MODEM #code for DSI Softmodems options BREAK_TO_DEBUGGER #a BREAK on a comconsole goes to diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES index 72c9db5..48fd42b 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.229 1995/12/26 14:01:16 bde Exp $ +# $Id: LINT,v 1.230 1995/12/29 02:04:20 jkh 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 @@ -580,6 +580,7 @@ device sio0 at isa? port "IO_COM1" tty irq 4 vector siointr # Options for sio: options COMCONSOLE #prefer serial console to video console +options COM_ESP #code for Hayes ESP options COM_MULTIPORT #code for some cards with shared IRQs options DSI_SOFT_MODEM #code for DSI Softmodems options BREAK_TO_DEBUGGER #a BREAK on a comconsole goes to diff --git a/sys/i386/isa/sio.c b/sys/i386/isa/sio.c index 7829045..712c18b 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.129 1995/12/10 20:54:38 bde Exp $ + * $Id: sio.c,v 1.130 1995/12/22 14:58:55 bde Exp $ */ #include "sio.h" @@ -68,6 +68,10 @@ #include <i386/isa/isa.h> #include <i386/isa/isa_device.h> #include <i386/isa/sioreg.h> + +#ifdef COM_ESP +#include <i386/isa/ic/esp.h> +#endif #include <i386/isa/ic/ns16550.h> #include "crd.h" @@ -170,6 +174,9 @@ struct com_s { u_char state; /* miscellaneous flag bits */ bool_t active_out; /* nonzero if the callout device is open */ u_char cfcr_image; /* copy of value written to CFCR */ +#ifdef COM_ESP + bool_t esp; /* is this unit a hayes esp board? */ +#endif u_char fifo_image; /* copy of value written to FIFO */ bool_t hasfifo; /* nonzero for 16550 UARTs */ bool_t loses_outints; /* nonzero if device loses output interrupts */ @@ -205,6 +212,9 @@ struct com_s { struct lbq obufs[2]; /* output buffers */ Port_t data_port; /* i/o ports */ +#ifdef COM_ESP + Port_t esp_port; +#endif Port_t int_id_port; Port_t iobase; Port_t modem_ctl_port; @@ -267,6 +277,8 @@ void siopoll __P((void)); #define siommap nommap #define siostrategy nostrategy +static int espattach __P((struct isa_device *isdp, struct com_s *com, + Port_t esp_port)); static int sioattach __P((struct isa_device *dev)); static timeout_t siodtrwakeup; static void comhardclose __P((struct com_s *com)); @@ -366,6 +378,11 @@ static struct kern_devconf kdc_sio[NSIO] = { { "Serial port", DC_CLS_SERIAL /* class */ } }; + +#ifdef COM_ESP +static Port_t likely_esp_ports[] = { 0x140, 0x180, 0x280, 0 }; +#endif + #if NCRD > 0 /* * PC-Card (PCMCIA) specific code. @@ -704,12 +721,81 @@ sioprobe(dev) return (result); } +#ifdef COM_ESP +static int +espattach(isdp, com, esp_port) + struct isa_device *isdp; + struct com_s *com; + Port_t esp_port; +{ + u_char dips; + u_char val; + + /* + * Check the ESP-specific I/O port to see if we're an ESP + * card. If not, return failure immediately. + */ + if ((inb(esp_port) & 0xf3) == 0) { + printf(" port 0x%x is not an ESP board?\n", esp_port); + return (0); + } + + /* + * We've got something that claims to be a Hayes ESP card. + * Let's hope so. + */ + + /* Get the dip-switch configuration */ + outb(esp_port + ESP_CMD1, ESP_GETDIPS); + dips = inb(esp_port + ESP_STATUS1); + + /* + * Bits 0,1 of dips say which COM port we are. + */ + if (com->iobase == likely_com_ports[dips & 0x03]) + printf(" : ESP"); + else { + printf(" esp_port has com %d\n", dips & 0x03); + return (0); + } + + /* + * Check for ESP version 2.0 or later: bits 4,5,6 = 010. + */ + outb(esp_port + ESP_CMD1, ESP_GETTEST); + val = inb(esp_port + ESP_STATUS1); /* clear reg 1 */ + val = inb(esp_port + ESP_STATUS2); + if ((val & 0x70) < 0x20) { + printf("-old (%o)", val & 0x70); + return (0); + } + + /* + * Check for ability to emulate 16550: bit 7 == 1 + */ + if ((dips & 0x80) == 0) { + printf(" slave"); + return (0); + } + + /* + * Okay, we seem to be a Hayes ESP card. Whee. + */ + com->esp = TRUE; + com->esp_port = esp_port; + return (1); +} +#endif /* COM_ESP */ + static int sioattach(isdp) struct isa_device *isdp; { struct com_s *com; dev_t dev; +#ifdef COM_ESP + Port_t *espp; +#endif Port_t iobase; char name[32]; int s; @@ -838,6 +924,15 @@ sioattach(isdp) com->tx_fifo_size = 16; kdc_sio[unit].kdc_description = "Serial port: National 16550A or compatible"; +#ifdef COM_ESP + for (espp = likely_esp_ports; *espp != 0; espp++) + if (espattach(isdp, com, *espp)) { + com->tx_fifo_size = 1024; + kdc_sio[unit].kdc_description = + "Serial port: Hayes ESP"; + break; + } +#endif } #if 0 /* @@ -868,6 +963,30 @@ sioattach(isdp) #endif break; } +#ifdef COM_ESP + if (com->esp) { + outb(iobase + com_fifo, + FIFO_DMA_MODE | FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST + | FIFO_RX_MEDH); + + /* Set 16550 compatibility mode. */ + outb(com->esp_port + ESP_CMD1, ESP_SETMODE); + outb(com->esp_port + ESP_CMD2, + ESP_MODE_SCALE | ESP_MODE_RTS | ESP_MODE_FIFO); + + /* Set RTS/CTS flow control. */ + outb(com->esp_port + ESP_CMD1, ESP_SETFLOWTYPE); + outb(com->esp_port + ESP_CMD2, ESP_FLOW_RTS); + outb(com->esp_port + ESP_CMD2, ESP_FLOW_CTS); + + /* Set flow-control levels. */ + outb(com->esp_port + ESP_CMD1, ESP_SETRXFLOW); + outb(com->esp_port + ESP_CMD2, HIBYTE(768)); + outb(com->esp_port + ESP_CMD2, LOBYTE(768)); + outb(com->esp_port + ESP_CMD2, HIBYTE(512)); + outb(com->esp_port + ESP_CMD2, LOBYTE(512)); + } +#endif /* COM_ESP */ outb(iobase + com_fifo, 0); determined_type: ; diff --git a/sys/isa/sio.c b/sys/isa/sio.c index 7829045..712c18b 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.129 1995/12/10 20:54:38 bde Exp $ + * $Id: sio.c,v 1.130 1995/12/22 14:58:55 bde Exp $ */ #include "sio.h" @@ -68,6 +68,10 @@ #include <i386/isa/isa.h> #include <i386/isa/isa_device.h> #include <i386/isa/sioreg.h> + +#ifdef COM_ESP +#include <i386/isa/ic/esp.h> +#endif #include <i386/isa/ic/ns16550.h> #include "crd.h" @@ -170,6 +174,9 @@ struct com_s { u_char state; /* miscellaneous flag bits */ bool_t active_out; /* nonzero if the callout device is open */ u_char cfcr_image; /* copy of value written to CFCR */ +#ifdef COM_ESP + bool_t esp; /* is this unit a hayes esp board? */ +#endif u_char fifo_image; /* copy of value written to FIFO */ bool_t hasfifo; /* nonzero for 16550 UARTs */ bool_t loses_outints; /* nonzero if device loses output interrupts */ @@ -205,6 +212,9 @@ struct com_s { struct lbq obufs[2]; /* output buffers */ Port_t data_port; /* i/o ports */ +#ifdef COM_ESP + Port_t esp_port; +#endif Port_t int_id_port; Port_t iobase; Port_t modem_ctl_port; @@ -267,6 +277,8 @@ void siopoll __P((void)); #define siommap nommap #define siostrategy nostrategy +static int espattach __P((struct isa_device *isdp, struct com_s *com, + Port_t esp_port)); static int sioattach __P((struct isa_device *dev)); static timeout_t siodtrwakeup; static void comhardclose __P((struct com_s *com)); @@ -366,6 +378,11 @@ static struct kern_devconf kdc_sio[NSIO] = { { "Serial port", DC_CLS_SERIAL /* class */ } }; + +#ifdef COM_ESP +static Port_t likely_esp_ports[] = { 0x140, 0x180, 0x280, 0 }; +#endif + #if NCRD > 0 /* * PC-Card (PCMCIA) specific code. @@ -704,12 +721,81 @@ sioprobe(dev) return (result); } +#ifdef COM_ESP +static int +espattach(isdp, com, esp_port) + struct isa_device *isdp; + struct com_s *com; + Port_t esp_port; +{ + u_char dips; + u_char val; + + /* + * Check the ESP-specific I/O port to see if we're an ESP + * card. If not, return failure immediately. + */ + if ((inb(esp_port) & 0xf3) == 0) { + printf(" port 0x%x is not an ESP board?\n", esp_port); + return (0); + } + + /* + * We've got something that claims to be a Hayes ESP card. + * Let's hope so. + */ + + /* Get the dip-switch configuration */ + outb(esp_port + ESP_CMD1, ESP_GETDIPS); + dips = inb(esp_port + ESP_STATUS1); + + /* + * Bits 0,1 of dips say which COM port we are. + */ + if (com->iobase == likely_com_ports[dips & 0x03]) + printf(" : ESP"); + else { + printf(" esp_port has com %d\n", dips & 0x03); + return (0); + } + + /* + * Check for ESP version 2.0 or later: bits 4,5,6 = 010. + */ + outb(esp_port + ESP_CMD1, ESP_GETTEST); + val = inb(esp_port + ESP_STATUS1); /* clear reg 1 */ + val = inb(esp_port + ESP_STATUS2); + if ((val & 0x70) < 0x20) { + printf("-old (%o)", val & 0x70); + return (0); + } + + /* + * Check for ability to emulate 16550: bit 7 == 1 + */ + if ((dips & 0x80) == 0) { + printf(" slave"); + return (0); + } + + /* + * Okay, we seem to be a Hayes ESP card. Whee. + */ + com->esp = TRUE; + com->esp_port = esp_port; + return (1); +} +#endif /* COM_ESP */ + static int sioattach(isdp) struct isa_device *isdp; { struct com_s *com; dev_t dev; +#ifdef COM_ESP + Port_t *espp; +#endif Port_t iobase; char name[32]; int s; @@ -838,6 +924,15 @@ sioattach(isdp) com->tx_fifo_size = 16; kdc_sio[unit].kdc_description = "Serial port: National 16550A or compatible"; +#ifdef COM_ESP + for (espp = likely_esp_ports; *espp != 0; espp++) + if (espattach(isdp, com, *espp)) { + com->tx_fifo_size = 1024; + kdc_sio[unit].kdc_description = + "Serial port: Hayes ESP"; + break; + } +#endif } #if 0 /* @@ -868,6 +963,30 @@ sioattach(isdp) #endif break; } +#ifdef COM_ESP + if (com->esp) { + outb(iobase + com_fifo, + FIFO_DMA_MODE | FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST + | FIFO_RX_MEDH); + + /* Set 16550 compatibility mode. */ + outb(com->esp_port + ESP_CMD1, ESP_SETMODE); + outb(com->esp_port + ESP_CMD2, + ESP_MODE_SCALE | ESP_MODE_RTS | ESP_MODE_FIFO); + + /* Set RTS/CTS flow control. */ + outb(com->esp_port + ESP_CMD1, ESP_SETFLOWTYPE); + outb(com->esp_port + ESP_CMD2, ESP_FLOW_RTS); + outb(com->esp_port + ESP_CMD2, ESP_FLOW_CTS); + + /* Set flow-control levels. */ + outb(com->esp_port + ESP_CMD1, ESP_SETRXFLOW); + outb(com->esp_port + ESP_CMD2, HIBYTE(768)); + outb(com->esp_port + ESP_CMD2, LOBYTE(768)); + outb(com->esp_port + ESP_CMD2, HIBYTE(512)); + outb(com->esp_port + ESP_CMD2, LOBYTE(512)); + } +#endif /* COM_ESP */ outb(iobase + com_fifo, 0); determined_type: ; |