Deleted Added
full compact
uart_dev_ns8250.c (179420) uart_dev_ns8250.c (190834)
1/*-
2 * Copyright (c) 2003 Marcel Moolenaar
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2003 Marcel Moolenaar
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/dev/uart/uart_dev_ns8250.c 179420 2008-05-30 01:57:13Z benno $");
28__FBSDID("$FreeBSD: head/sys/dev/uart/uart_dev_ns8250.c 190834 2009-04-08 00:14:06Z marcel $");
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/bus.h>
33#include <sys/conf.h>
34#include <machine/bus.h>
35
36#include <dev/uart/uart.h>

--- 8 unchanged lines hidden (view full) ---

45
46/*
47 * Clear pending interrupts. THRE is cleared by reading IIR. Data
48 * that may have been received gets lost here.
49 */
50static void
51ns8250_clrint(struct uart_bas *bas)
52{
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/bus.h>
33#include <sys/conf.h>
34#include <machine/bus.h>
35
36#include <dev/uart/uart.h>

--- 8 unchanged lines hidden (view full) ---

45
46/*
47 * Clear pending interrupts. THRE is cleared by reading IIR. Data
48 * that may have been received gets lost here.
49 */
50static void
51ns8250_clrint(struct uart_bas *bas)
52{
53 uint8_t iir;
53 uint8_t iir, lsr;
54
55 iir = uart_getreg(bas, REG_IIR);
56 while ((iir & IIR_NOPEND) == 0) {
57 iir &= IIR_IMASK;
54
55 iir = uart_getreg(bas, REG_IIR);
56 while ((iir & IIR_NOPEND) == 0) {
57 iir &= IIR_IMASK;
58 if (iir == IIR_RLS)
59 (void)uart_getreg(bas, REG_LSR);
60 else if (iir == IIR_RXRDY || iir == IIR_RXTOUT)
58 if (iir == IIR_RLS) {
59 lsr = uart_getreg(bas, REG_LSR);
60 if (lsr & (LSR_BI|LSR_FE|LSR_PE))
61 (void)uart_getreg(bas, REG_DATA);
62 } else if (iir == IIR_RXRDY || iir == IIR_RXTOUT)
61 (void)uart_getreg(bas, REG_DATA);
62 else if (iir == IIR_MLSC)
63 (void)uart_getreg(bas, REG_MSR);
64 uart_barrier(bas);
65 iir = uart_getreg(bas, REG_IIR);
66 }
67}
68

--- 513 unchanged lines hidden (view full) ---

582 iir = uart_getreg(bas, REG_IIR);
583 if (iir & IIR_NOPEND) {
584 uart_unlock(sc->sc_hwmtx);
585 return (0);
586 }
587 ipend = 0;
588 if (iir & IIR_RXRDY) {
589 lsr = uart_getreg(bas, REG_LSR);
63 (void)uart_getreg(bas, REG_DATA);
64 else if (iir == IIR_MLSC)
65 (void)uart_getreg(bas, REG_MSR);
66 uart_barrier(bas);
67 iir = uart_getreg(bas, REG_IIR);
68 }
69}
70

--- 513 unchanged lines hidden (view full) ---

584 iir = uart_getreg(bas, REG_IIR);
585 if (iir & IIR_NOPEND) {
586 uart_unlock(sc->sc_hwmtx);
587 return (0);
588 }
589 ipend = 0;
590 if (iir & IIR_RXRDY) {
591 lsr = uart_getreg(bas, REG_LSR);
590 uart_unlock(sc->sc_hwmtx);
591 if (lsr & LSR_OE)
592 ipend |= SER_INT_OVERRUN;
593 if (lsr & LSR_BI)
594 ipend |= SER_INT_BREAK;
595 if (lsr & LSR_RXRDY)
596 ipend |= SER_INT_RXREADY;
597 } else {
592 if (lsr & LSR_OE)
593 ipend |= SER_INT_OVERRUN;
594 if (lsr & LSR_BI)
595 ipend |= SER_INT_BREAK;
596 if (lsr & LSR_RXRDY)
597 ipend |= SER_INT_RXREADY;
598 } else {
598 uart_unlock(sc->sc_hwmtx);
599 if (iir & IIR_TXRDY)
600 ipend |= SER_INT_TXIDLE;
601 else
602 ipend |= SER_INT_SIGCHG;
603 }
599 if (iir & IIR_TXRDY)
600 ipend |= SER_INT_TXIDLE;
601 else
602 ipend |= SER_INT_SIGCHG;
603 }
604 if (ipend == 0)
605 ns8250_clrint(bas);
606 uart_unlock(sc->sc_hwmtx);
604 return ((sc->sc_leaving) ? 0 : ipend);
605}
606
607static int
608ns8250_bus_param(struct uart_softc *sc, int baudrate, int databits,
609 int stopbits, int parity)
610{
611 struct uart_bas *bas;

--- 245 unchanged lines hidden ---
607 return ((sc->sc_leaving) ? 0 : ipend);
608}
609
610static int
611ns8250_bus_param(struct uart_softc *sc, int baudrate, int databits,
612 int stopbits, int parity)
613{
614 struct uart_bas *bas;

--- 245 unchanged lines hidden ---