Date: Mon, 23 Dec 2002 17:30:09 -0800 (PST) From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 22679 for review Message-ID: <200212240130.gBO1U90C056209@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=22679 Change 22679 by marcel@marcel_nfs on 2002/12/23 17:29:10 o Axe support for the Hayes ESP. It still uses ports and could only bitrot further. Once the driver stabilizes, support can be added back, although it looks to me that any support we add here would annihilate the purpose of having an ESP because in enhanced mode it doesn't look like an UART at all so we can only support it in compat mode. o Remove COM_MULTIPORT code. There's too much weirdness trying to deal with multi-port boards in the core of the UART driver that it makes more sense to use puc(4) to abstract them. The intention is for the puc(4) driver to detect the multi-port cards and to deal with the weirdness. It provides an abstracted bus for sio(4) to attach too with minimal tweaks. This keeps the sio(4) core clean and yields the most flexible environment. o Strip sioprobe. The complexity of probing depends on the bus and should be done where it can least interfere with other busses. This removes the isa_irq_pending() references. Also, we want to minimize the fiddling with the UART at probe time because we may not even attach to it. Hence, presetting of the UART has been moved to sioattach. Note that identification will be moved to sioprobe so that we can properly set the description. o Enable interrupts again. The decision to use puc(4) for multi-port cards allows us to deal with the IRQ resource here. We still need a way to not assume polling mode in the case no IRQ resource exists. This follows later. Use of puc(4) discussed with imp. Current status: The sio(4) driver works on BigSur, which has an ISA legacy. On the HP box we don't seem to have any sio(4) interrupts. vmstat -i does list sio(4) devices at all. No indication exists that this is a sio(4) specific problem. Affected files ... .. //depot/projects/ia64/sys/dev/sio/sio.c#24 edit .. //depot/projects/ia64/sys/dev/sio/siovar.h#10 edit Differences ... ==== //depot/projects/ia64/sys/dev/sio/sio.c#24 (text+ko) ==== @@ -76,10 +76,6 @@ #include <dev/sio/sioreg.h> #include <dev/sio/siovar.h> -#ifdef COM_ESP -#include <dev/ic/esp.h> -#endif - #define LOTS_OF_EVENTS 64 /* helps separate urgent events from input */ #define CALLOUT_MASK 0x80 @@ -92,17 +88,6 @@ #define UNIT_TO_MINOR(unit) ((((unit) & ~0x1fU) << (8 + 3)) \ | ((unit) & 0x1f)) -#ifdef COM_MULTIPORT -/* checks in flags for multiport and which is multiport "master chip" - * for a given card - */ -#define COM_ISMULTIPORT(flags) ((flags) & 0x01) -#define COM_MPMASTER(flags) (((flags) >> 8) & 0x0ff) -#define COM_NOTAST4(flags) ((flags) & 0x04) -#else -#define COM_ISMULTIPORT(flags) (0) -#endif /* COM_MULTIPORT */ - #define COM_CONSOLE(flags) ((flags) & 0x10) #define COM_FORCECONSOLE(flags) ((flags) & 0x20) #define COM_LLCONSOLE(flags) ((flags) & 0x40) @@ -154,15 +139,6 @@ #define CE_RECORD(com, errnum) (++(com)->delta_error_counts[errnum]) -/* types. XXX - should be elsewhere */ -#ifdef COM_ESP -typedef u_int Port_t; /* hardware port */ -#endif - -#ifdef COM_ESP -static int espattach(struct com_s *com, Port_t esp_port); -#endif - static timeout_t siobusycheck; static timeout_t siodtrwakeup; static void comhardclose(struct com_s *com); @@ -231,13 +207,6 @@ = CALLOUT_HANDLE_INITIALIZER(&sio_timeout_handle); static int sio_numunits; -#ifdef COM_ESP -/* XXX configure this properly. */ -/* XXX quite broken for new-bus. */ -static Port_t likely_com_ports[] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, }; -static Port_t likely_esp_ports[] = { 0x140, 0x180, 0x280, 0 }; -#endif - /* * handle sysctl read/write requests for console speed * @@ -323,7 +292,6 @@ /* * Do some non-destructive (for this device that is) tests * to make sure we have something that looks like an UART. - * */ int sioprobe1(struct com_s *sc) { @@ -340,7 +308,7 @@ if (val & 0xe0) goto fail; - /* Check known 0 bits that depend on ~DLAB. */ + /* Check known 0 bits that depend on !DLAB. */ val = sio_getreg(sc, com_ier); if (val & 0xf0) goto fail; @@ -368,10 +336,9 @@ * read and write do not hang. */ int -siodetach(dev) - device_t dev; +siodetach(device_t dev) { - struct com_s *com; + struct com_s *com; int i; com = (struct com_s *)device_get_softc(dev); @@ -385,13 +352,14 @@ ttwakeup(com->tp); ttwwakeup(com->tp); } - + if (com->irqres) { + bus_teardown_intr(dev, com->irqres, com->cookie); + bus_release_resource(dev, SYS_RES_IRQ, 0, com->irqres); + } for (i = 0 ; i < 6; i++) destroy_dev(com->devs[i]); - if (com->ibuf != NULL) free(com->ibuf, M_DEVBUF); - return (0); } @@ -399,17 +367,8 @@ sioprobe(device_t dev) { struct com_s *com; + u_int flags; - u_int divisor; - bool_t failures[10]; - int fn; - device_t idev; - u_char mcr_image; - int result; - u_int flags = device_get_flags(dev); - - com = (struct com_s *)device_get_softc(dev); - while (sio_inited != 2) if (atomic_cmpset_int(&sio_inited, 0, 1)) { mtx_init(&sio_lock, sio_driver_name, NULL, @@ -418,6 +377,8 @@ atomic_store_rel_int(&sio_inited, 2); } + com = (struct com_s *)device_get_softc(dev); + /* Check if we're probing the console. */ if (com->bst == sio_console.bst && com->bsh == sio_console.bsh) { com = &sio_console; @@ -425,239 +386,32 @@ return (0); } + flags = device_get_flags(dev); + if (COM_LLCONSOLE(flags)) { device_printf(dev, "reserved for low-level i/o\n"); return (ENXIO); } + /* Perform rudimentary sanity checking. */ + if (sioprobe1(com)) + return (ENXIO); + if (com->rclk == 0) com->rclk = DEFAULT_RCLK; - /* - * If the device is on a multiport card and has an AST/4 - * compatible interrupt control register, initialize this - * register and prepare to leave MCR_IENABLE clear in the mcr. - * Otherwise, prepare to set MCR_IENABLE in the mcr. - * Point idev to the device struct giving the correct id_irq. - * This is the struct for the master device if there is one. - */ - idev = dev; - mcr_image = MCR_IENABLE; -#ifdef COM_MULTIPORT - if (COM_ISMULTIPORT(flags)) { - idev = devclass_get_device(sio_devclass, COM_MPMASTER(flags)); - if (idev == NULL) { - device_printf(dev, "master device %d not configured\n", - COM_MPMASTER(flags)); - idev = dev; - } - if (!COM_NOTAST4(flags)) { - struct com_s icom; - - icom = (struct com_s *) device_get_softc(idev); - if (icom != NULL) { - if (bus_get_resource(idev, SYS_RES_IRQ, 0, - NULL, NULL) == 0) - sio_setreg(icom, com_scr, 0x80); - else - sio_setreg(icom, com_scr, 0); - } - mcr_image = 0; - } - } -#endif /* COM_MULTIPORT */ - - if (bus_get_resource(idev, SYS_RES_IRQ, 0, NULL, NULL) != 0) - mcr_image = 0; - - bzero(failures, sizeof failures); - - /* - * We don't want to get actual interrupts, just masked ones. - * Interrupts from this line should already be masked in the ICU, - * but mask them in the processor as well in case there are some - * (misconfigured) shared interrupts. - */ - mtx_lock_spin(&sio_lock); -/* EXTRA DELAY? */ - - /* - * Initialize the speed and the word size and wait long enough to - * drain the maximum of 16 bytes of junk in device output queues. - * The speed is undefined after a master reset and must be set - * before relying on anything related to output. There may be - * junk after a (very fast) soft reboot and (apparently) after - * master reset. - * XXX what about the UART bug avoided by waiting in comparam()? - * We don't want to to wait long enough to drain at 2 bps. - */ - sio_setreg(com, com_lcr, LCR_DLAB | LCR_8BITS); - divisor = siodivisor(com->rclk, SIO_TEST_SPEED); - sio_setreg(com, com_dlbl, divisor & 0xff); - sio_setreg(com, com_dlbh, divisor >> 8); - sio_setreg(com, com_lcr, LCR_8BITS); - DELAY((16 + 1) * 1000000 / (SIO_TEST_SPEED / 10)); - - /* - * Enable the interrupt gate and disable device interupts. This - * should leave the device driving the interrupt line low and - * guarantee an edge trigger if an interrupt can be generated. - */ -/* EXTRA DELAY? */ - sio_setreg(com, com_mcr, mcr_image); sio_setreg(com, com_ier, 0); - DELAY(1000); /* XXX */ + /* XXX barrier */ - /* - * Attempt to set loopback mode so that we can send a null byte - * without annoying any external device. - */ -/* EXTRA DELAY? */ - sio_setreg(com, com_mcr, mcr_image | MCR_LOOPBACK); - - /* - * Attempt to generate an output interrupt. On 8250's, setting - * IER_ETXRDY generates an interrupt independent of the current - * setting and independent of whether the THR is empty. On 16450's, - * setting IER_ETXRDY generates an interrupt independent of the - * current setting. On 16550A's, setting IER_ETXRDY only - * generates an interrupt when IER_ETXRDY is not already set. - */ - sio_setreg(com, com_ier, IER_ETXRDY); - - /* - * On some 16x50 incompatibles, setting IER_ETXRDY doesn't generate - * an interrupt. They'd better generate one for actually doing - * output. Loopback may be broken on the same incompatibles but - * it's unlikely to do more than allow the null byte out. - */ - sio_setreg(com, com_data, 0); - DELAY((1 + 2) * 1000000 / (SIO_TEST_SPEED / 10)); - - /* - * Turn off loopback mode so that the interrupt gate works again - * (MCR_IENABLE was hidden). This should leave the device driving - * an interrupt line high. It doesn't matter if the interrupt - * line oscillates while we are not looking at it, since interrupts - * are disabled. - */ -/* EXTRA DELAY? */ - sio_setreg(com, com_mcr, mcr_image); - - /* - * It seems my Xircom CBEM56G Cardbus modem wants to be reset - * to 8 bits *again*, or else probe test 0 will fail. - * gwk@sgi.com, 4/19/2001 - */ - sio_setreg(com, com_lcr, LCR_8BITS); - - /* - * Some pcmcia cards have the "TXRDY bug", so we check everyone - * for IIR_TXRDY implementation ( Palido 321s, DC-1S... ) - */ - for (fn = 0; fn < 2; fn ++) { - DELAY(10000); - failures[6] = sio_getreg(com, com_iir); - } - /* Check IIR_TXRDY clear ? */ - result = 0; - if (failures[6] & IIR_TXRDY) { - /* No, Double check with clearing IER */ - sio_setreg(com, com_ier, 0); - if (sio_getreg(com, com_iir) & IIR_NOPEND) { - /* Ok. We discovered TXRDY bug! */ - SET_FLAG(dev, COM_C_IIR_TXRDYBUG); - } else { - /* Unknown, Just omit this chip.. XXX */ - result = ENXIO; - sio_setreg(com, com_mcr, 0); - } - } else { - /* OK. this is well-known guys */ - CLR_FLAG(dev, COM_C_IIR_TXRDYBUG); - } - sio_setreg(com, com_ier, 0); - sio_setreg(com, com_lcr, LCR_8BITS); - mtx_unlock_spin(&sio_lock); - return (result); + return (0); } -#ifdef COM_ESP -static int -espattach(com, esp_port) - 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 (rman_get_start(com->ioportres) == 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 */ - int sioattach(device_t dev) { struct com_s *com; -#ifdef COM_ESP - Port_t *espp; -#endif - int minorbase; - int unit; + int minorbase, ret, rid, unit; u_int flags; - int ret; com = device_get_softc(dev); flags = device_get_flags(dev); @@ -666,23 +420,25 @@ if (unit >= sio_numunits) sio_numunits = unit + 1; - if (com->consdev) + /* + * Preset the UART to something reasonable. Only do this when the + * UART is not used as the console. We assume the console works + * and whatever the setting, it cannot be unreasonable. + */ + if (com->consdev == NULL) { + sio_setreg(com, com_lcr, LCR_8BITS | LCR_DLAB); + /* XXX barrier */ + com->reg_dl = siodivisor(com->rclk, comdefaultrate); + sio_setdreg(com, com_dl, com->reg_dl); + /* XXX barrier */ + sio_setreg(com, com_lcr, LCR_8BITS); + /* XXX barrier */ + sio_setreg(com, com_mcr, MCR_IENABLE); + /* XXX barrier */ + } else com->consdev->cn_dev = makedev(CDEV_MAJOR, unit); - /* - * sioprobe() has initialized the device registers as follows: - * o cfcr = LCR_8BITS. - * It is most important that LCR_DLAB is off, so that the - * data port is not hidden when we enable interrupts. - * o ier = 0. - * Interrupts are only enabled when the line is open. - * o mcr = MCR_IENABLE, or 0 if the port has AST/4 compatible - * interrupt control register or the config specifies no irq. - * Keeping MCR_DTR and MCR_RTS off might stop the external - * device from sending before we are ready. - */ com->unit = unit; - com->cfcr_image = LCR_8BITS; com->dtr_wait = 3 * hz; com->loses_outints = COM_LOSESOUTINTS(flags) != 0; com->no_irq = bus_get_resource(dev, SYS_RES_IRQ, 0, NULL, NULL) != 0; @@ -690,7 +446,8 @@ com->obufs[0].l_head = com->obuf1; com->obufs[1].l_head = com->obuf2; - com->mcr_image = sio_getreg(com, com_mcr); + com->reg_lcr = sio_getreg(com, com_lcr); + com->reg_mcr = sio_getreg(com, com_mcr); /* * We don't use all the flags from <sys/ttydefaults.h> since they @@ -724,113 +481,74 @@ com->it_out = com->it_in; /* attempt to determine UART type */ - printf("sio%d: type", unit); + device_printf(dev, "type "); - if (!COM_ISMULTIPORT(flags) && - !COM_IIR_TXRDYBUG(flags) && !COM_NOSCR(flags)) { + if (!COM_IIR_TXRDYBUG(flags) && !COM_NOSCR(flags)) { u_char scr; u_char scr1; u_char scr2; scr = sio_getreg(com, com_scr); + /* XXX barrier */ sio_setreg(com, com_scr, 0xa5); + /* XXX barrier */ scr1 = sio_getreg(com, com_scr); + /* XXX barrier */ sio_setreg(com, com_scr, 0x5a); + /* XXX barrier */ scr2 = sio_getreg(com, com_scr); + /* XXX barrier */ sio_setreg(com, com_scr, scr); + /* XXX barrier */ if (scr1 != 0xa5 || scr2 != 0x5a) { - printf(" 8250 or not responding"); + printf("8250"); goto determined_type; } } + sio_setreg(com, com_fcr, FCR_ENABLE | FCR_RX_HIGH); + /* XXX barrier with SYNC semantics */ DELAY(100); + com->st16650a = 0; switch (sio_getreg(com, com_iir) & IIR_FIFO_MASK) { case FCR_RX_LOW: - printf(" 16450"); + printf("16450"); break; case FCR_RX_MEDL: - printf(" 16450?"); + printf("16450?"); break; case FCR_RX_MEDH: - printf(" 16550?"); + printf("16550?"); break; case FCR_RX_HIGH: if (COM_NOFIFO(flags)) { - printf(" 16550A fifo disabled"); + printf("16550A fifo disabled"); } else { com->hasfifo = TRUE; if (COM_ST16650A(flags)) { com->st16650a = 1; com->tx_fifo_size = 32; - printf(" ST16650A"); + printf("ST16650A"); } else { com->tx_fifo_size = COM_FIFOSIZE(flags); - printf(" 16550A"); + printf("16550A"); } } -#ifdef COM_ESP - for (espp = likely_esp_ports; *espp != 0; espp++) - if (espattach(com, *espp)) { - com->tx_fifo_size = 1024; - break; - } -#endif if (!com->st16650a) { if (!com->tx_fifo_size) com->tx_fifo_size = 16; else - printf(" lookalike with %d bytes FIFO", + printf("lookalike with %d bytes FIFO", com->tx_fifo_size); } break; } -#ifdef COM_ESP - if (com->esp) { - /* - * Set 16550 compatibility mode. - * We don't use the ESP_MODE_SCALE bit to increase the - * fifo trigger levels because we can't handle large - * bursts of input. - * XXX flow control should be set in comparam(), not here. - */ - outb(com->esp_port + ESP_CMD1, ESP_SETMODE); - outb(com->esp_port + ESP_CMD2, 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 */ sio_setreg(com, com_fcr, 0); determined_type: ; -#ifdef COM_MULTIPORT - if (COM_ISMULTIPORT(flags)) { - device_t masterdev; - - com->multiport = TRUE; - printf(" (multiport"); - if (unit == COM_MPMASTER(flags)) - printf(" master"); - printf(")"); - masterdev = devclass_get_device(sio_devclass, - COM_MPMASTER(flags)); - com->no_irq = (masterdev == NULL || bus_get_resource(masterdev, - SYS_RES_IRQ, 0, NULL, NULL) != 0); - } -#endif /* COM_MULTIPORT */ if (com->consdev != NULL) printf(", console"); if (COM_IIR_TXRDYBUG(flags)) @@ -862,6 +580,9 @@ com->pps.ppscap = PPS_CAPTUREASSERT | PPS_CAPTURECLEAR; pps_init(&com->pps); + rid = 0; + com->irqres = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0ul, ~0ul, 1, + RF_ACTIVE); if (com->irqres) { ret = BUS_SETUP_INTR(device_get_parent(dev), dev, com->irqres, INTR_TYPE_TTY | INTR_FAST, @@ -1130,7 +851,7 @@ com->do_timestamp = FALSE; com->do_dcd_timestamp = FALSE; com->pps.ppsparam.mode = 0; - sio_setreg(com, com_lcr, com->cfcr_image &= ~LCR_SBREAK); + sio_setreg(com, com_lcr, com->reg_lcr &= ~LCR_SBREAK); tp = com->tp; #if defined(DDB) && (defined(BREAK_TO_DEBUGGER) || \ @@ -1356,9 +1077,9 @@ * so enable RTS if it is now disabled and there is room in the * high-level buffer. */ - if ((com->state & CS_RTS_IFLOW) && !(com->mcr_image & MCR_RTS) && + if ((com->state & CS_RTS_IFLOW) && !(com->reg_mcr & MCR_RTS) && !(tp->t_state & TS_TBLOCK)) - sio_setreg(com, com_mcr, com->mcr_image |= MCR_RTS); + sio_setreg(com, com_mcr, com->reg_mcr |= MCR_RTS); } static void @@ -1367,44 +1088,11 @@ { struct com_s *com; -#ifndef COM_MULTIPORT com = (struct com_s *)arg; mtx_lock_spin(&sio_lock); siointr1(com); mtx_unlock_spin(&sio_lock); -#else /* COM_MULTIPORT */ - bool_t possibly_more_intrs; - int unit; - - /* - * Loop until there is no activity on any port. This is necessary - * to get an interrupt edge more than to avoid another interrupt. - * If the IRQ signal is just an OR of the IRQ signals from several - * devices, then the edge from one may be lost because another is - * on. - */ - mtx_lock_spin(&sio_lock); - do { - possibly_more_intrs = FALSE; - for (unit = 0; unit < sio_numunits; ++unit) { - com = com_addr(unit); - /* - * XXX COM_LOCK(); - * would it work here, or be counter-productive? - */ - if (com != NULL - && !com->gone - && (sio_getreg(com, com_iir) & IIR_IMASK) - != IIR_NOPEND) { - siointr1(com); - possibly_more_intrs = TRUE; - } - /* XXX COM_UNLOCK(); */ - } - } while (possibly_more_intrs); - mtx_unlock_spin(&sio_lock); -#endif /* COM_MULTIPORT */ } static struct timespec siots[8192]; @@ -1556,10 +1244,10 @@ ioptr[0] = recv_data; ioptr[com->ierroff] = line_status; com->iptr = ++ioptr; - if (ioptr == com->ihighwater - && com->state & CS_RTS_IFLOW) + if (ioptr == com->ihighwater && + com->state & CS_RTS_IFLOW) sio_setreg(com, com_mcr, - com->mcr_image &= ~MCR_RTS); + com->reg_mcr &= ~MCR_RTS); if (line_status & LSR_OE) CE_RECORD(com, CE_OVERRUN); } @@ -1658,9 +1346,7 @@ } /* finished? */ -#ifndef COM_MULTIPORT if ((sio_getreg(com, com_iir) & IIR_IMASK) == IIR_NOPEND) -#endif /* COM_MULTIPORT */ return; } } @@ -1764,10 +1450,10 @@ } switch (cmd) { case TIOCSBRK: - sio_setreg(com, com_lcr, com->cfcr_image |= LCR_SBREAK); + sio_setreg(com, com_lcr, com->reg_lcr |= LCR_SBREAK); break; case TIOCCBRK: - sio_setreg(com, com_lcr, com->cfcr_image &= ~LCR_SBREAK); + sio_setreg(com, com_lcr, com->reg_lcr &= ~LCR_SBREAK); break; case TIOCSDTR: (void)commctl(com, TIOCM_DTR, DMBIS); @@ -1974,15 +1660,6 @@ com->reg_fcr = com->unit == siotsunit ? 0 : t->c_ospeed <= 4800 ? FCR_ENABLE : FCR_ENABLE | FCR_RX_MEDH; -#ifdef COM_ESP - /* - * The Hayes ESP card needs the fifo DMA mode bit set - * in compatibility mode. If not, it will interrupt - * for each character received. - */ - if (com->esp) - com->reg_fcr |= FCR_DMA_MODE; -#endif sio_setreg(com, com_fcr, com->reg_fcr); } @@ -2009,7 +1686,7 @@ sio_setreg(com, com_dlbh, dlbh); } - sio_setreg(com, com_lcr, com->cfcr_image = cfcr); + sio_setreg(com, com_lcr, com->reg_lcr = cfcr); if (!(tp->t_state & TS_TTSTOP)) com->state |= CS_TTGO; @@ -2033,7 +1710,7 @@ * CS_RTS_IFLOW just changed from on to off. Force MCR_RTS * on here, since comstart() won't do it later. */ - sio_setreg(com, com_mcr, com->mcr_image |= MCR_RTS); + sio_setreg(com, com_mcr, com->reg_mcr |= MCR_RTS); if (com->st16650a) { sio_setreg(com, com_lcr, 0xbf); sio_setreg(com, com_fcr, @@ -2066,7 +1743,7 @@ } } - sio_setreg(com, com_lcr, com->cfcr_image); + sio_setreg(com, com_lcr, com->reg_lcr); /* XXX shouldn't call functions while intrs are disabled. */ disc_optim(tp, t, com); @@ -2181,12 +1858,12 @@ else com->state |= CS_TTGO; if (tp->t_state & TS_TBLOCK) { - if (com->mcr_image & MCR_RTS && com->state & CS_RTS_IFLOW) - sio_setreg(com, com_mcr, com->mcr_image &= ~MCR_RTS); + if (com->reg_mcr & MCR_RTS && com->state & CS_RTS_IFLOW) + sio_setreg(com, com_mcr, com->reg_mcr &= ~MCR_RTS); } else { - if (!(com->mcr_image & MCR_RTS) && com->iptr < com->ihighwater + if (!(com->reg_mcr & MCR_RTS) && com->iptr < com->ihighwater && com->state & CS_RTS_IFLOW) - sio_setreg(com, com_mcr, com->mcr_image |= MCR_RTS); + sio_setreg(com, com_mcr, com->reg_mcr |= MCR_RTS); } mtx_unlock_spin(&sio_lock); if (tp->t_state & (TS_TIMEOUT | TS_TTSTOP)) { @@ -2261,10 +1938,6 @@ mtx_lock_spin(&sio_lock); if (rw & FWRITE) { if (com->hasfifo) -#ifdef COM_ESP - /* XXX avoid h/w bug. */ - if (!com->esp) -#endif sio_setreg(com, com_fcr, FCR_XMT_RST | com->reg_fcr); com->obufs[0].l_queued = FALSE; @@ -2276,10 +1949,6 @@ } if (rw & FREAD) { if (com->hasfifo) -#ifdef COM_ESP - /* XXX avoid h/w bug. */ - if (!com->esp) -#endif sio_setreg(com, com_fcr, FCR_RCV_RST | com->reg_fcr); com_events -= (com->iptr - com->ibuf); @@ -2300,7 +1969,7 @@ if (how == DMGET) { bits = TIOCM_LE; /* XXX - always enabled while open */ - mcr = com->mcr_image; + mcr = com->reg_mcr; if (mcr & MCR_DTR) bits |= TIOCM_DTR; if (mcr & MCR_RTS) @@ -2332,13 +2001,13 @@ switch (how) { case DMSET: sio_setreg(com, com_mcr, - com->mcr_image = mcr | (com->mcr_image & MCR_IENABLE)); + com->reg_mcr = mcr | (com->reg_mcr & MCR_IENABLE)); break; case DMBIS: - sio_setreg(com, com_mcr, com->mcr_image |= mcr); + sio_setreg(com, com_mcr, com->reg_mcr |= mcr); break; case DMBIC: - sio_setreg(com, com_mcr, com->mcr_image &= ~mcr); + sio_setreg(com, com_mcr, com->reg_mcr &= ~mcr); break; } mtx_unlock_spin(&sio_lock); ==== //depot/projects/ia64/sys/dev/sio/siovar.h#10 (text+ko) ==== @@ -83,23 +83,17 @@ u_int regshft; /* Interleaved multi-port. */ u_short reg_dl; /* Copy of DL. */ u_char reg_fcr; /* Copy of FCR. */ + u_char reg_lcr; /* Copy of LCR. */ + u_char reg_mcr; /* Copy of MCR. */ /* Old SIO fields. Need auditing. */ u_int flags; /* Copy isa device flags */ 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 extra_state; /* more flag bits, separate for order trick */ 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 - bool_t multiport; /* is this unit part of a multiport device? */ -#endif /* COM_MULTIPORT */ bool_t no_irq; /* nonzero if irq is not attached */ bool_t gone; /* hardware disappeared */ bool_t poll; /* nonzero if polling is required */ @@ -129,10 +123,6 @@ struct lbq obufq; /* head of queue of output buffers */ struct lbq obufs[2]; /* output buffers */ -#ifdef COM_ESP - Port_t esp_port; -#endif - struct tty *tp; /* cross reference */ /* Initial state. */ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200212240130.gBO1U90C056209>
