summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2020-04-13 20:59:09 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2020-04-13 20:59:09 +0000
commit64c4dfcd2687461fb915236cc51a3c1b48db383b (patch)
treeb8ba74c988485107bf51637014d641a7532710e2
parentb47c1eda0cacfacb85c3bed6d0c60bf241d04cf8 (diff)
Notes
-rw-r--r--sys/dev/uart/uart_bus.h1
-rw-r--r--sys/dev/uart/uart_core.c7
2 files changed, 8 insertions, 0 deletions
diff --git a/sys/dev/uart/uart_bus.h b/sys/dev/uart/uart_bus.h
index d3b22256b915..5da3cecccf85 100644
--- a/sys/dev/uart/uart_bus.h
+++ b/sys/dev/uart/uart_bus.h
@@ -111,6 +111,7 @@ struct uart_softc {
int sc_rxput;
int sc_rxget;
int sc_rxfifosz; /* Size of RX FIFO. */
+ int sc_rxoverruns;
/* Transmitter data. */
uint8_t *sc_txbuf;
diff --git a/sys/dev/uart/uart_core.c b/sys/dev/uart/uart_core.c
index d664a823f701..89201f3d9463 100644
--- a/sys/dev/uart/uart_core.c
+++ b/sys/dev/uart/uart_core.c
@@ -333,6 +333,7 @@ uart_intr_overrun(void *arg)
sc->sc_rxbuf[sc->sc_rxput] = UART_STAT_OVERRUN;
uart_sched_softih(sc, SER_INT_RXREADY);
}
+ sc->sc_rxoverruns++;
UART_FLUSH(sc, UART_FLUSH_RECEIVER);
return (0);
}
@@ -741,6 +742,12 @@ uart_bus_attach(device_t dev)
if (sc->sc_sysdev != NULL)
sc->sc_sysdev->hwmtx = sc->sc_hwmtx;
+ if (sc->sc_rxfifosz > 1)
+ SYSCTL_ADD_INT(device_get_sysctl_ctx(dev),
+ SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
+ "rx_overruns", CTLFLAG_RD, &sc->sc_rxoverruns, 0,
+ "Receive overruns");
+
return (0);
fail: