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)
This commit is contained in:
Ian Dowse 2001-06-20 16:47:23 +00:00
parent 0e79fe6f0e
commit 11fbe665c0
2 changed files with 42 additions and 2 deletions

View File

@ -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

View File

@ -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