summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2017-04-11 15:16:15 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2017-04-11 15:16:15 +0000
commit4ad2a24caf1563d8d36d3d0da911f817c6bde672 (patch)
tree41ecc36d496a9654ab2910a267f8cc6146b904d0
parent2c104ec6a5078e740dbdfc731d2566fce0a32cd6 (diff)
Recognize break conditions and enter ddb if ddb.console is set.
ok visa@, deraadt@
-rw-r--r--sys/arch/arm64/dev/pluart.c17
-rw-r--r--sys/arch/armv7/dev/pluart.c17
2 files changed, 28 insertions, 6 deletions
diff --git a/sys/arch/arm64/dev/pluart.c b/sys/arch/arm64/dev/pluart.c
index 18bcd9739bf..3d468709044 100644
--- a/sys/arch/arm64/dev/pluart.c
+++ b/sys/arch/arm64/dev/pluart.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pluart.c,v 1.2 2017/01/20 08:03:21 patrick Exp $ */
+/* $OpenBSD: pluart.c,v 1.3 2017/04/11 15:16:14 kettenis Exp $ */
/*
* Copyright (c) 2014 Patrick Wildt <patrick@blueri.se>
@@ -256,6 +256,7 @@ pluartattach(struct device *parent, struct device *self, void *aux)
cn_tab->cn_dev = makedev(maj, sc->sc_dev.dv_unit);
printf(": console");
+ SET(sc->sc_hwflags, COM_HW_CONSOLE);
}
timeout_set(&sc->sc_diag_tmo, pluart_diag, sc);
@@ -304,8 +305,18 @@ pluart_intr(void *arg)
p = sc->sc_ibufp;
- while(ISSET(bus_space_read_4(iot, ioh, UART_FR), UART_FR_RXFF)) {
- c = bus_space_read_1(iot, ioh, UART_DR);
+ while (ISSET(bus_space_read_4(iot, ioh, UART_FR), UART_FR_RXFF)) {
+ c = bus_space_read_2(iot, ioh, UART_DR);
+ if (c & UART_DR_BE) {
+#ifdef DDB
+ if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE)) {
+ if (db_console)
+ Debugger();
+ continue;
+ }
+#endif
+ c = 0;
+ }
if (p >= sc->sc_ibufend) {
sc->sc_floods++;
if (sc->sc_errors++ == 0)
diff --git a/sys/arch/armv7/dev/pluart.c b/sys/arch/armv7/dev/pluart.c
index 8aa41addfe2..5374438c2c6 100644
--- a/sys/arch/armv7/dev/pluart.c
+++ b/sys/arch/armv7/dev/pluart.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pluart.c,v 1.1 2016/08/31 16:19:40 jsg Exp $ */
+/* $OpenBSD: pluart.c,v 1.2 2017/04/11 15:16:14 kettenis Exp $ */
/*
* Copyright (c) 2014 Patrick Wildt <patrick@blueri.se>
@@ -260,6 +260,7 @@ pluartattach(struct device *parent, struct device *self, void *aux)
cn_tab->cn_dev = makedev(maj, sc->sc_dev.dv_unit);
printf(": console");
+ SET(sc->sc_hwflags, COM_HW_CONSOLE);
}
timeout_set(&sc->sc_diag_tmo, pluart_diag, sc);
@@ -308,8 +309,18 @@ pluart_intr(void *arg)
p = sc->sc_ibufp;
- while(ISSET(bus_space_read_4(iot, ioh, UART_FR), UART_FR_RXFF)) {
- c = bus_space_read_1(iot, ioh, UART_DR);
+ while (ISSET(bus_space_read_4(iot, ioh, UART_FR), UART_FR_RXFF)) {
+ c = bus_space_read_2(iot, ioh, UART_DR);
+ if (c & UART_DR_BE) {
+#ifdef DDB
+ if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE)) {
+ if (db_console)
+ Debugger();
+ continue;
+ }
+#endif
+ c = 0;
+ }
if (p >= sc->sc_ibufend) {
sc->sc_floods++;
if (sc->sc_errors++ == 0)