From: kettenis Date: Tue, 11 Apr 2017 15:16:14 +0000 (+0000) Subject: Recognize break conditions and enter ddb if ddb.console is set. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=c8a314c846bf3912451e92abc63dd16c78f4ee99;p=openbsd Recognize break conditions and enter ddb if ddb.console is set. ok visa@, deraadt@ --- 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 @@ -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 @@ -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)