summaryrefslogtreecommitdiffstats
path: root/sys/pc98/cbus
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2011-08-26 21:46:36 +0000
committerrwatson <rwatson@FreeBSD.org>2011-08-26 21:46:36 +0000
commit3f14675cff336d6d19e9cffbd2f4d4a28beb7dca (patch)
tree2ae73feb05cbeb7e5e297fdfc6fab07cf2db82b5 /sys/pc98/cbus
parentdd0f1f95e294fe6290b1864612f81cf29a594aac (diff)
downloadFreeBSD-src-3f14675cff336d6d19e9cffbd2f4d4a28beb7dca.zip
FreeBSD-src-3f14675cff336d6d19e9cffbd2f4d4a28beb7dca.tar.gz
Attempt to make break-to-debugger and alternative break-to-debugger more
accessible: (1) Always compile in support for breaking into the debugger if options KDB is present in the kernel. (2) Disable both by default, but allow them to be enabled via tunables and sysctls debug.kdb.break_to_debugger and debug.kdb.alt_break_to_debugger. (3) options BREAK_TO_DEBUGGER and options ALT_BREAK_TO_DEBUGGER continue to behave as before -- only now instead of compiling in break-to-debugger support, they change the default values of the above sysctls to enable those features by default. Current kernel configurations should, therefore, continue to behave as expected. (4) Migrate alternative break-to-debugger state machine logic out of individual device drivers into centralised KDB code. This has a number of upsides, but also one downside: it's now tricky to release sio spin locks when entering the debugger, so we don't. However, similar logic does not exist in other device drivers, including uart. (5) dcons requires some special handling; unlike other console types, it allows overriding KDB's own debugger selection, so we need a new interface to KDB to allow that to work. GENERIC kernels in -CURRENT will now support break-to-debugger as long as appropriate boot/run-time options are set, which should improve the debuggability of BETA kernels significantly. MFC after: 3 weeks Reviewed by: kib, nwhitehorn Approved by: re (bz)
Diffstat (limited to 'sys/pc98/cbus')
-rw-r--r--sys/pc98/cbus/sio.c28
1 files changed, 5 insertions, 23 deletions
diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c
index 01747d7..bbac9d3 100644
--- a/sys/pc98/cbus/sio.c
+++ b/sys/pc98/cbus/sio.c
@@ -310,7 +310,7 @@ struct com_s {
struct pps_state pps;
int pps_bit;
-#ifdef ALT_BREAK_TO_DEBUGGER
+#ifdef KDB
int alt_brk_state;
#endif
@@ -1752,8 +1752,7 @@ determined_type: ;
}
if (ret)
device_printf(dev, "could not activate interrupt\n");
-#if defined(KDB) && (defined(BREAK_TO_DEBUGGER) || \
- defined(ALT_BREAK_TO_DEBUGGER))
+#if defined(KDB)
/*
* Enable interrupts for early break-to-debugger support
* on the console.
@@ -1896,8 +1895,7 @@ comclose(tp)
sio_setreg(com, com_cfcr, com->cfcr_image &= ~CFCR_SBREAK);
#endif
-#if defined(KDB) && (defined(BREAK_TO_DEBUGGER) || \
- defined(ALT_BREAK_TO_DEBUGGER))
+#if defined(KDB)
/*
* Leave interrupts enabled and don't clear DTR if this is the
* console. This allows us to detect break-to-debugger events
@@ -2272,7 +2270,7 @@ siointr1(com)
u_char rsa_buf_status = 0;
int rsa_tx_fifo_size = 0;
#endif /* PC98 */
-#if defined(KDB) && defined(ALT_BREAK_TO_DEBUGGER)
+#if defined(KDB)
int kdb_brk;
again:
@@ -2369,27 +2367,11 @@ more_intr:
else
recv_data = inb(com->data_port);
#ifdef KDB
-#ifdef ALT_BREAK_TO_DEBUGGER
if (com->unit == comconsole &&
(kdb_brk = kdb_alt_break(recv_data,
&com->alt_brk_state)) != 0) {
- mtx_unlock_spin(&sio_lock);
- switch (kdb_brk) {
- case KDB_REQ_DEBUGGER:
- kdb_enter(KDB_WHY_BREAK,
- "Break sequence on console");
- break;
- case KDB_REQ_PANIC:
- kdb_panic("panic on console");
- break;
- case KDB_REQ_REBOOT:
- kdb_reboot();
- break;
- }
- mtx_lock_spin(&sio_lock);
goto again;
}
-#endif /* ALT_BREAK_TO_DEBUGGER */
#endif /* KDB */
if (line_status & (LSR_BI | LSR_FE | LSR_PE)) {
/*
@@ -2405,7 +2387,7 @@ more_intr:
* Note: BI together with FE/PE means just BI.
*/
if (line_status & LSR_BI) {
-#if defined(KDB) && defined(BREAK_TO_DEBUGGER)
+#if defined(KDB)
if (com->unit == comconsole) {
kdb_enter(KDB_WHY_BREAK,
"Line break on console");
OpenPOWER on IntegriCloud