Index | Thread | Search

From:
Jonathan Gray <jsg@jsg.id.au>
Subject:
Re: exuart(4): Recognize a BREAK
To:
Mark Kettenis <mark.kettenis@xs4all.nl>
Cc:
tech@openbsd.org
Date:
Thu, 3 Jul 2025 20:26:03 +1000

Download raw body.

Thread
On Thu, Jul 03, 2025 at 12:19:42AM +0200, Mark Kettenis wrote:
> Diff below makes the Apple variant of exuart(4) recognize a BREAK and
> enter DDB if the ddb.console sysctl is set.
> 
> The Central Scrutinizer sends a BREAK to the machine when you type: ^_ ^@
> 
> ok?

ok jsg@

> 
> 
> Index: dev/fdt/exuart.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/fdt/exuart.c,v
> diff -u -p -r1.12 exuart.c
> --- dev/fdt/exuart.c	23 Jul 2023 11:16:36 -0000	1.12
> +++ dev/fdt/exuart.c	2 Jul 2025 22:17:13 -0000
> @@ -209,6 +209,7 @@ exuart_attach(struct device *parent, str
>  		cn_tab->cn_dev = makedev(maj, sc->sc_dev.dv_unit);
>  
>  		printf(": console");
> +		SET(sc->sc_hwflags, COM_HW_CONSOLE);
>  	}
>  
>  	printf("\n");
> @@ -385,12 +386,22 @@ exuart_s5l_intr(void *arg)
>  	struct exuart_softc *sc = arg;
>  	bus_space_tag_t iot = sc->sc_iot;
>  	bus_space_handle_t ioh = sc->sc_ioh;
> -	u_int32_t utrstat;
> +	u_int32_t utrstat, uerstat;
>  
>  	utrstat = bus_space_read_4(iot, ioh, EXUART_UTRSTAT);
> +	uerstat = bus_space_read_4(iot, ioh, EXUART_UERSTAT);
>  
>  	if (sc->sc_tty == NULL)
>  		return (0);
> +
> +#ifdef DDB
> +	if (uerstat & EXUART_UERSTAT_BREAK) {
> +		if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE)) {
> +			if (db_console)
> +				db_enter();
> +		}
> +	}
> +#endif
>  
>  	if (utrstat & (EXUART_S5L_UTRSTAT_RXTHRESH |
>  	    EXUART_S5L_UTRSTAT_RX_TIMEOUT))
> 
>