1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-24 11:29:10 +00:00

Synchronize with sys/i386/isa/sio.c revison 1.167.

This commit is contained in:
KATO Takenori 1997-05-19 12:39:42 +00:00
parent e2e7cf5071
commit beaea33867
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=25924
2 changed files with 82 additions and 10 deletions

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)com.c 7.5 (Berkeley) 5/16/91 * from: @(#)com.c 7.5 (Berkeley) 5/16/91
* $Id: sio.c,v 1.22 1997/04/19 14:54:32 kato Exp $ * $Id: sio.c,v 1.23 1997/04/27 13:22:09 kato Exp $
*/ */
#include "opt_comconsole.h" #include "opt_comconsole.h"
@ -198,6 +198,7 @@
#define COM_LOSESOUTINTS(dev) ((dev)->id_flags & 0x08) #define COM_LOSESOUTINTS(dev) ((dev)->id_flags & 0x08)
#define COM_NOFIFO(dev) ((dev)->id_flags & 0x02) #define COM_NOFIFO(dev) ((dev)->id_flags & 0x02)
#define COM_VERBOSE(dev) ((dev)->id_flags & 0x80) #define COM_VERBOSE(dev) ((dev)->id_flags & 0x80)
#define COM_NOTST3(dev) ((dev)->id_flags & 0x10000)
#ifndef PC98 #ifndef PC98
#define com_scr 7 /* scratch register for 16450-16550 (R/W) */ #define com_scr 7 /* scratch register for 16450-16550 (R/W) */
@ -965,7 +966,7 @@ sioprobe(dev)
failures[1] = inb(iobase + com_ier) - IER_ETXRDY; failures[1] = inb(iobase + com_ier) - IER_ETXRDY;
failures[2] = inb(iobase + com_mcr) - mcr_image; failures[2] = inb(iobase + com_mcr) - mcr_image;
DELAY(10000); /* Some internal modems need this time */ DELAY(10000); /* Some internal modems need this time */
if (idev->id_irq != 0) if (idev->id_irq != 0 && !COM_NOTST3(idev))
failures[3] = isa_irq_pending(idev) ? 0 : 1; failures[3] = isa_irq_pending(idev) ? 0 : 1;
failures[4] = (inb(iobase + com_iir) & IIR_IMASK) - IIR_TXRDY; failures[4] = (inb(iobase + com_iir) & IIR_IMASK) - IIR_TXRDY;
DELAY(1000); /* XXX */ DELAY(1000); /* XXX */
@ -1235,12 +1236,47 @@ sioattach(isdp)
printf(" 16550?"); printf(" 16550?");
break; break;
case FIFO_RX_HIGH: case FIFO_RX_HIGH:
printf(" 16550A");
if (COM_NOFIFO(isdp)) { if (COM_NOFIFO(isdp)) {
printf(" fifo disabled"); printf(" 16550A fifo disabled");
} else { } else {
/* Detect the fifo size. */
int i, n;
/* Enable and reset the FIFO. */
outb (iobase+com_fifo, FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST);
/* Set the loopback mode, 57600 baud. */
outb (iobase+com_cfcr, CFCR_DLAB);
outb (iobase+com_dlbh, 0);
outb (iobase+com_dlbl, 2);
outb (iobase+com_cfcr, CFCR_8BITS);
outb (iobase+com_mcr, MCR_LOOPBACK);
inb (iobase+com_lsr);
/* Put data into transmit FIFO and wait until overrun. */
for (i=n=0; i<20000; ++i) {
unsigned char lsr = inb (iobase+com_lsr);
if (lsr & LSR_OE)
break;
if (lsr & LSR_TXRDY) {
outb (iobase+com_data, 0x5A);
++n;
}
}
outb (iobase+com_mcr, 0);
outb (iobase+com_fifo, 0);
com->hasfifo = TRUE; com->hasfifo = TRUE;
if (n > 40) {
com->tx_fifo_size = 64;
printf(" 16750");
} else if (n > 24) {
com->tx_fifo_size = 32;
printf(" 16650");
} else {
com->tx_fifo_size = 16; com->tx_fifo_size = 16;
printf(" 16550A");
}
#ifdef COM_ESP #ifdef COM_ESP
for (espp = likely_esp_ports; *espp != 0; espp++) for (espp = likely_esp_ports; *espp != 0; espp++)
if (espattach(isdp, com, *espp)) { if (espattach(isdp, com, *espp)) {

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* from: @(#)com.c 7.5 (Berkeley) 5/16/91 * from: @(#)com.c 7.5 (Berkeley) 5/16/91
* $Id: sio.c,v 1.22 1997/04/19 14:54:32 kato Exp $ * $Id: sio.c,v 1.23 1997/04/27 13:22:09 kato Exp $
*/ */
#include "opt_comconsole.h" #include "opt_comconsole.h"
@ -198,6 +198,7 @@
#define COM_LOSESOUTINTS(dev) ((dev)->id_flags & 0x08) #define COM_LOSESOUTINTS(dev) ((dev)->id_flags & 0x08)
#define COM_NOFIFO(dev) ((dev)->id_flags & 0x02) #define COM_NOFIFO(dev) ((dev)->id_flags & 0x02)
#define COM_VERBOSE(dev) ((dev)->id_flags & 0x80) #define COM_VERBOSE(dev) ((dev)->id_flags & 0x80)
#define COM_NOTST3(dev) ((dev)->id_flags & 0x10000)
#ifndef PC98 #ifndef PC98
#define com_scr 7 /* scratch register for 16450-16550 (R/W) */ #define com_scr 7 /* scratch register for 16450-16550 (R/W) */
@ -965,7 +966,7 @@ sioprobe(dev)
failures[1] = inb(iobase + com_ier) - IER_ETXRDY; failures[1] = inb(iobase + com_ier) - IER_ETXRDY;
failures[2] = inb(iobase + com_mcr) - mcr_image; failures[2] = inb(iobase + com_mcr) - mcr_image;
DELAY(10000); /* Some internal modems need this time */ DELAY(10000); /* Some internal modems need this time */
if (idev->id_irq != 0) if (idev->id_irq != 0 && !COM_NOTST3(idev))
failures[3] = isa_irq_pending(idev) ? 0 : 1; failures[3] = isa_irq_pending(idev) ? 0 : 1;
failures[4] = (inb(iobase + com_iir) & IIR_IMASK) - IIR_TXRDY; failures[4] = (inb(iobase + com_iir) & IIR_IMASK) - IIR_TXRDY;
DELAY(1000); /* XXX */ DELAY(1000); /* XXX */
@ -1235,12 +1236,47 @@ sioattach(isdp)
printf(" 16550?"); printf(" 16550?");
break; break;
case FIFO_RX_HIGH: case FIFO_RX_HIGH:
printf(" 16550A");
if (COM_NOFIFO(isdp)) { if (COM_NOFIFO(isdp)) {
printf(" fifo disabled"); printf(" 16550A fifo disabled");
} else { } else {
/* Detect the fifo size. */
int i, n;
/* Enable and reset the FIFO. */
outb (iobase+com_fifo, FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST);
/* Set the loopback mode, 57600 baud. */
outb (iobase+com_cfcr, CFCR_DLAB);
outb (iobase+com_dlbh, 0);
outb (iobase+com_dlbl, 2);
outb (iobase+com_cfcr, CFCR_8BITS);
outb (iobase+com_mcr, MCR_LOOPBACK);
inb (iobase+com_lsr);
/* Put data into transmit FIFO and wait until overrun. */
for (i=n=0; i<20000; ++i) {
unsigned char lsr = inb (iobase+com_lsr);
if (lsr & LSR_OE)
break;
if (lsr & LSR_TXRDY) {
outb (iobase+com_data, 0x5A);
++n;
}
}
outb (iobase+com_mcr, 0);
outb (iobase+com_fifo, 0);
com->hasfifo = TRUE; com->hasfifo = TRUE;
if (n > 40) {
com->tx_fifo_size = 64;
printf(" 16750");
} else if (n > 24) {
com->tx_fifo_size = 32;
printf(" 16650");
} else {
com->tx_fifo_size = 16; com->tx_fifo_size = 16;
printf(" 16550A");
}
#ifdef COM_ESP #ifdef COM_ESP
for (espp = likely_esp_ports; *espp != 0; espp++) for (espp = likely_esp_ports; *espp != 0; espp++)
if (espattach(isdp, com, *espp)) { if (espattach(isdp, com, *espp)) {