From 11fbe665c07eb2dbeb0c5963da807863fedaa4a5 Mon Sep 17 00:00:00 2001 From: Ian Dowse Date: Wed, 20 Jun 2001 16:47:23 +0000 Subject: The serial console break-to-debugger support only functioned while the console device was open. At other times, the interrupts that are used to detect the break signal or ~^B sequence were disabled, so these events would not be noticed until the next open (e.g. the next kernel printf). This was mainly a problem while there was no getty running on the console, such as during bootup or shutdown. For serial consoles with break-to-debugger support, we now enable the generation of interrupts at attach time, and we leave them enabled while the device is closed. Reviewed by: bde (I've since made chages as per his suggestions) --- sys/dev/sio/sio.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'sys/dev/sio/sio.c') diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 1bbf598d32f6..954ebd403a7f 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -1356,6 +1356,16 @@ determined_type: ; } if (ret) device_printf(dev, "could not activate interrupt\n"); +#if defined(DDB) && (defined(BREAK_TO_DEBUGGER) || \ + defined(ALT_BREAK_TO_DEBUGGER)) + /* + * Enable interrupts for early break-to-debugger support + * on the console. + */ + if (ret == 0 && unit == comconsole) + outb(siocniobase + com_ier, IER_ERXRDY | IER_ERLS | + IER_EMSC); +#endif } return (0); @@ -1597,9 +1607,19 @@ comhardclose(com) com->do_dcd_timestamp = FALSE; com->pps.ppsparam.mode = 0; sio_setreg(com, com_cfcr, com->cfcr_image &= ~CFCR_SBREAK); + tp = com->tp; + +#if defined(DDB) && (defined(BREAK_TO_DEBUGGER) || \ + defined(ALT_BREAK_TO_DEBUGGER)) + /* + * Leave interrupts enabled and don't clear DTR if this is the + * console. This allows us to detect break-to-debugger events + * while the console device is closed. + */ + if (com->unit != comconsole) +#endif { sio_setreg(com, com_ier, 0); - tp = com->tp; if (tp->t_cflag & HUPCL /* * XXX we will miss any carrier drop between here and the -- cgit v1.2.3