Recognize break conditions and enter ddb if ddb.console is set.
authorkettenis <kettenis@openbsd.org>
Tue, 11 Apr 2017 15:16:14 +0000 (15:16 +0000)
committerkettenis <kettenis@openbsd.org>
Tue, 11 Apr 2017 15:16:14 +0000 (15:16 +0000)
ok visa@, deraadt@

sys/arch/arm64/dev/pluart.c
sys/arch/armv7/dev/pluart.c

index 18bcd97..3d46870 100644 (file)
@@ -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)
index 8aa41ad..5374438 100644 (file)
@@ -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)