summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2004-07-10 22:29:41 +0000
committermarcel <marcel@FreeBSD.org>2004-07-10 22:29:41 +0000
commit6660e9e4c036ddedee1dea43979df8f99db432a7 (patch)
tree569c7748c22c6a063892c171ce8c938b786c180d /sys
parentd86985b3e61f5ae382d55784f7eb9dddd70555fc (diff)
downloadFreeBSD-src-6660e9e4c036ddedee1dea43979df8f99db432a7.zip
FreeBSD-src-6660e9e4c036ddedee1dea43979df8f99db432a7.tar.gz
Update for the KDB framework. Sanitize the alpha console code now that
it's in the way even more. Basicly: remove all alpha specific console support from gfb(4), sio(4) and syscons(4). Rewrite the alpha console initialization to be identical to all other platforms. In a nutshell: call cninit(). The platform specific code now only sets or clears RB_SERIAL and thus automaticly causes the right console to be selected. sio.c: o Replace the remote GDB hacks and use the GDB debug port interface instead. o Make debugging code conditional upon KDB instead of DDB. o Call kdb_alt_break() instead of db_alt_break(). o Call kdb_enter() instead of breakpoint(). o Remove the ugly compatibility of using the console as the debug port.
Diffstat (limited to 'sys')
-rw-r--r--sys/alpha/alpha/api_up1000.c42
-rw-r--r--sys/alpha/alpha/dec_1000a.c47
-rw-r--r--sys/alpha/alpha/dec_2100_a50.c45
-rw-r--r--sys/alpha/alpha/dec_2100_a500.c45
-rw-r--r--sys/alpha/alpha/dec_axppci_33.c45
-rw-r--r--sys/alpha/alpha/dec_eb164.c47
-rw-r--r--sys/alpha/alpha/dec_eb64plus.c39
-rw-r--r--sys/alpha/alpha/dec_kn20aa.c42
-rw-r--r--sys/alpha/alpha/dec_kn300.c40
-rw-r--r--sys/alpha/alpha/dec_st550.c43
-rw-r--r--sys/alpha/alpha/dec_st6600.c42
-rw-r--r--sys/alpha/conf/NOTES3
-rw-r--r--sys/conf/options.alpha4
-rw-r--r--sys/dev/gfb/gfb_pci.c34
-rw-r--r--sys/dev/sio/sio.c285
-rw-r--r--sys/dev/syscons/syscons.c76
-rw-r--r--sys/pc98/cbus/sio.c283
-rw-r--r--sys/pc98/pc98/sio.c283
18 files changed, 242 insertions, 1203 deletions
diff --git a/sys/alpha/alpha/api_up1000.c b/sys/alpha/alpha/api_up1000.c
index f21ec34..b2577b0 100644
--- a/sys/alpha/alpha/api_up1000.c
+++ b/sys/alpha/alpha/api_up1000.c
@@ -27,9 +27,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_ddb.h"
-#include "opt_dev_sc.h"
-
#include <sys/param.h>
#include <sys/reboot.h>
#include <sys/systm.h>
@@ -49,18 +46,6 @@ __FBSDID("$FreeBSD$");
#include <alpha/pci/irongatereg.h>
#include <alpha/pci/irongatevar.h>
-#ifndef NO_SIO
-#ifndef CONSPEED
-#define CONSPEED TTYDEF_SPEED
-#endif
-static int comcnrate = CONSPEED;
-extern int comconsole;
-extern int siocnattach(int, int);
-extern int siogdbattach(int, int);
-#endif
-
-extern int sccnattach(void);
-
void api_up1000_init(void);
static void api_up1000_cons_init(void);
@@ -85,40 +70,15 @@ api_up1000_cons_init()
irongate_init();
-#ifndef NO_SIO
-#ifdef DDB
- siogdbattach(0x2f8, 57600);
-#endif
-#endif
-
ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off);
switch (ctb->ctb_term_type) {
case 2:
-#ifndef NO_SIO
- /* serial console ... */
- /*
- * Delay to allow PROM putchars to complete.
- * FIFO depth * character time,
- * character time = (1000000 / (defaultrate / 10))
- */
- DELAY(160000000 / comcnrate);
- comconsole = 0;
- if (siocnattach(0x3f8, comcnrate))
- panic("can't init serial console");
-
boothowto |= RB_SERIAL;
-#endif
break;
case 3:
- /* display console ... */
- /* XXX */
-#ifdef DEV_SC
- sccnattach();
-#else
- panic("not configured to use display && keyboard console");
-#endif
+ boothowto &= ~RB_SERIAL;
break;
default:
diff --git a/sys/alpha/alpha/dec_1000a.c b/sys/alpha/alpha/dec_1000a.c
index a1d1d39..16ba0e5 100644
--- a/sys/alpha/alpha/dec_1000a.c
+++ b/sys/alpha/alpha/dec_1000a.c
@@ -74,9 +74,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_ddb.h"
-#include "opt_dev_sc.h"
-
#include <sys/param.h>
#include <sys/reboot.h>
#include <sys/systm.h>
@@ -94,18 +91,6 @@ __FBSDID("$FreeBSD$");
#include <dev/pci/pcivar.h>
-#ifndef NO_SIO
-#ifndef CONSPEED
-#define CONSPEED TTYDEF_SPEED
-#endif
-static int comcnrate = CONSPEED;
-extern int comconsole;
-extern int siocnattach(int, int);
-extern int siogdbattach(int, int);
-#endif
-
-extern int sccnattach(void);
-
void dec_1000a_init(int);
static void dec_1000a_cons_init(void);
@@ -185,45 +170,15 @@ dec_1000a_cons_init()
apecs_init();
}
-#ifndef NO_SIO
-#ifdef DDB
- siogdbattach(0x2f8, 57600);
-#endif
-#endif
-
ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off);
switch (ctb->ctb_term_type) {
case 2:
-#ifndef NO_SIO
- /* serial console ... */
- /*
- * Delay to allow PROM putchars to complete.
- * FIFO depth * character time,
- * character time = (1000000 / (defaultrate / 10)).
- */
- DELAY(160000000 / comcnrate);
-
- /*
- * Force a comconsole on com1 if the SRM has a serial
- * console.
- */
- comconsole = 0;
- if (siocnattach(0x3f8, comcnrate))
- panic("can't init serial console");
-
boothowto |= RB_SERIAL;
-#endif
break;
case 3:
- /* display console ... */
- /* XXX */
-#ifdef DEV_SC
- sccnattach();
-#else
- panic("not configured to use display && keyboard console");
-#endif
+ boothowto &= ~RB_SERIAL;
break;
default:
diff --git a/sys/alpha/alpha/dec_2100_a50.c b/sys/alpha/alpha/dec_2100_a50.c
index 79138b2..ba9e434 100644
--- a/sys/alpha/alpha/dec_2100_a50.c
+++ b/sys/alpha/alpha/dec_2100_a50.c
@@ -35,9 +35,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_ddb.h"
-#include "opt_dev_sc.h"
-
#include <sys/param.h>
#include <sys/reboot.h>
#include <sys/systm.h>
@@ -54,18 +51,6 @@ __FBSDID("$FreeBSD$");
#include <alpha/pci/apecsreg.h>
#include <alpha/pci/apecsvar.h>
-#ifndef NO_SIO
-#ifndef CONSPEED
-#define CONSPEED TTYDEF_SPEED
-#endif
-static int comcnrate = CONSPEED;
-extern int comconsole;
-extern int siocnattach(int, int);
-extern int siogdbattach(int, int);
-#endif
-
-extern int sccnattach(void);
-
void dec_2100_a50_init(void);
static void dec_2100_a50_cons_init(void);
static void dec_2100_a50_intr_map(void *);
@@ -110,43 +95,15 @@ dec_2100_a50_cons_init()
apecs_init();
-#ifndef NO_SIO
-#ifdef DDB
- siogdbattach(0x2f8, 9600);
-#endif
-#endif
-
ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off);
switch (ctb->ctb_term_type) {
case 2:
-#ifndef NO_SIO
- /* serial console ... */
- /*
- * Delay to allow PROM putchars to complete.
- * FIFO depth * character time,
- * character time = (1000000 / (defaultrate / 10)).
- */
- DELAY(160000000 / comcnrate);
- /*
- * Force a comconsole on com1 if the SRM has a serial console.
- */
- comconsole = 0;
- if (siocnattach(0x3f8, comcnrate))
- panic("can't init serial console");
-
boothowto |= RB_SERIAL;
-#endif
break;
case 3:
- /* display console ... */
- /* XXX */
-#ifdef DEV_SC
- sccnattach();
-#else
- panic("not configured to use display && keyboard console");
-#endif
+ boothowto &= ~RB_SERIAL;
break;
default:
diff --git a/sys/alpha/alpha/dec_2100_a500.c b/sys/alpha/alpha/dec_2100_a500.c
index 547d4ed..e202b2f 100644
--- a/sys/alpha/alpha/dec_2100_a500.c
+++ b/sys/alpha/alpha/dec_2100_a500.c
@@ -27,9 +27,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_ddb.h"
-#include "opt_dev_sc.h"
-
#include <sys/param.h>
#include <sys/reboot.h>
#include <sys/systm.h>
@@ -47,18 +44,6 @@ __FBSDID("$FreeBSD$");
#include <alpha/pci/t2var.h>
#include <alpha/pci/t2reg.h>
-#ifndef NO_SIO
-#ifndef CONSPEED
-#define CONSPEED TTYDEF_SPEED
-#endif
-static int comcnrate = CONSPEED;
-extern int comconsole;
-extern int siocnattach(int, int);
-extern int siogdbattach(int, int);
-#endif
-
-extern int sccnattach(void);
-
void dec_2100_a500_init(int);
static void dec_2100_a500_cons_init(void);
static void dec_2100_a500_intr_init(void);
@@ -101,43 +86,15 @@ dec_2100_a500_cons_init()
struct ctb *ctb;
t2_init();
-#ifndef NO_SIO
-#ifdef DDB
- siogdbattach(0x2f8, 9600);
-#endif
-#endif
-
ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off);
switch (ctb->ctb_term_type) {
case 2:
-#ifndef NO_SIO
- /* serial console ... */
- /*
- * Delay to allow PROM putchars to complete.
- * FIFO depth * character time,
- * character time = (1000000 / (defaultrate / 10))
- */
- DELAY(160000000 / comcnrate);
- /*
- * force a comconsole on com1 if the SRM has a serial console
- */
- comconsole = 0;
- if (siocnattach(0x3f8, comcnrate))
- panic("can't init serial console");
-
boothowto |= RB_SERIAL;
-#endif
break;
case 3:
- /* display console ... */
- /* XXX */
-#ifdef DEV_SC
- sccnattach();
-#else
- panic("not configured to use display && keyboard console");
-#endif
+ boothowto &= ~RB_SERIAL;
break;
default:
diff --git a/sys/alpha/alpha/dec_axppci_33.c b/sys/alpha/alpha/dec_axppci_33.c
index 13e04ea..476ec0f 100644
--- a/sys/alpha/alpha/dec_axppci_33.c
+++ b/sys/alpha/alpha/dec_axppci_33.c
@@ -32,9 +32,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_ddb.h"
-#include "opt_dev_sc.h"
-
#include <sys/param.h>
#include <sys/reboot.h>
#include <sys/systm.h>
@@ -51,18 +48,6 @@ __FBSDID("$FreeBSD$");
#include <dev/pci/pcivar.h>
#include <alpha/pci/lcavar.h>
-#ifndef NO_SIO
-#ifndef CONSPEED
-#define CONSPEED TTYDEF_SPEED
-#endif
-static int comcnrate = CONSPEED;
-extern int comconsole;
-extern int siocnattach(int, int);
-extern int siogdbattach(int, int);
-#endif
-
-extern int sccnattach(void);
-
void dec_axppci_33_init(void);
static void dec_axppci_33_cons_init(void);
static int dec_axppci_33_intr_route (device_t, device_t, int);
@@ -125,43 +110,15 @@ dec_axppci_33_cons_init()
lca_init();
-#ifndef NO_SIO
-#ifdef DDB
- siogdbattach(0x2f8, 9600);
-#endif
-#endif
-
ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off);
switch (ctb->ctb_term_type) {
case 2:
-#ifndef NO_SIO
- /* serial console ... */
- /*
- * Delay to allow PROM putchars to complete.
- * FIFO depth * character time,
- * character time = (1000000 / (defaultrate / 10))
- */
- DELAY(160000000 / comcnrate);
- /*
- * force a comconsole on com1 if the SRM has a serial console
- */
- comconsole = 0;
- if (siocnattach(0x3f8, comcnrate))
- panic("can't init serial console");
-
boothowto |= RB_SERIAL;
-#endif
break;
case 3:
- /* display console ... */
- /* XXX */
-#ifdef DEV_SC
- sccnattach();
-#else
- panic("not configured to use display && keyboard console");
-#endif
+ boothowto &= ~RB_SERIAL;
break;
default:
diff --git a/sys/alpha/alpha/dec_eb164.c b/sys/alpha/alpha/dec_eb164.c
index fb7e701..f3ac0e8 100644
--- a/sys/alpha/alpha/dec_eb164.c
+++ b/sys/alpha/alpha/dec_eb164.c
@@ -32,9 +32,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_ddb.h"
-#include "opt_dev_sc.h"
-
#include <sys/param.h>
#include <sys/reboot.h>
#include <sys/systm.h>
@@ -48,18 +45,6 @@ __FBSDID("$FreeBSD$");
#include <alpha/pci/ciavar.h>
-#ifndef NO_SIO
-#ifndef CONSPEED
-#define CONSPEED TTYDEF_SPEED
-#endif
-static int comcnrate = CONSPEED;
-extern int comconsole;
-extern int siocnattach(int, int);
-extern int siogdbattach(int, int);
-#endif
-
-extern int sccnattach(void);
-
void dec_eb164_init(void);
static void dec_eb164_cons_init(void);
static void eb164_intr_init(void);
@@ -98,45 +83,15 @@ dec_eb164_cons_init()
cia_init();
-#ifndef NO_SIO
-#ifdef DDB
- siogdbattach(0x2f8, 57600);
-#endif
-#endif
-
ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off);
switch (ctb->ctb_term_type) {
case 2:
-#ifndef NO_SIO
- /* serial console ... */
- /*
- * Delay to allow PROM putchars to complete.
- * FIFO depth * character time,
- * character time = (1000000 / (defaultrate / 10))
- */
- DELAY(160000000 / comcnrate);
-
- /*
- * Force a comconsole on com1 if the SRM has a serial
- * console.
- */
- comconsole = 0;
- if (siocnattach(0x3f8, comcnrate))
- panic("can't init serial console");
-
boothowto |= RB_SERIAL;
-#endif
break;
case 3:
- /* display console ... */
- /* XXX */
-#ifdef DEV_SC
- sccnattach();
-#else
- panic("not configured to use display && keyboard console");
-#endif
+ boothowto &= ~RB_SERIAL;
break;
default:
diff --git a/sys/alpha/alpha/dec_eb64plus.c b/sys/alpha/alpha/dec_eb64plus.c
index 670e2ea..36d6afc 100644
--- a/sys/alpha/alpha/dec_eb64plus.c
+++ b/sys/alpha/alpha/dec_eb64plus.c
@@ -48,9 +48,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_ddb.h"
-#include "opt_dev_sc.h"
-
#include <sys/param.h>
#include <sys/reboot.h>
#include <sys/systm.h>
@@ -68,17 +65,6 @@ __FBSDID("$FreeBSD$");
#include <alpha/pci/apecsreg.h>
#include <alpha/pci/apecsvar.h>
-#ifndef NO_SIO
-#ifndef CONSPEED
-#define CONSPEED TTYDEF_SPEED
-#endif
-static int comcnrate = CONSPEED;
-extern int comconsole;
-extern int siocnattach(int, int);
-#endif
-
-extern int sccnattach(void);
-
void dec_eb64plus_init(void);
static void dec_eb64plus_cons_init(void);
static void dec_eb64plus_intr_init(void);
@@ -132,34 +118,11 @@ dec_eb64plus_cons_init()
switch (ctb->ctb_term_type) {
case 2:
-#ifndef NO_SIO
- /* serial console ... */
- /*
- * Delay to allow PROM putchars to complete.
- * FIFO depth * character time,
- * character time = (1000000 / (defaultrate / 10))
- */
- DELAY(160000000 / comcnrate);
-
- /*
- * force a comconsole on com1 if the SRM has a serial
- * console.
- */
- comconsole = 0;
- if (siocnattach(0x3f8, comcnrate))
- panic("can't init serial console");
-
boothowto |= RB_SERIAL;
-#endif
break;
case 3:
-#ifdef DEV_SC
- /* graphics adapter console */
- sccnattach();
-#else
- panic("not configured to use display && keyboard console");
-#endif
+ boothowto &= ~RB_SERIAL;
break;
default:
diff --git a/sys/alpha/alpha/dec_kn20aa.c b/sys/alpha/alpha/dec_kn20aa.c
index de9b91b..38ec292 100644
--- a/sys/alpha/alpha/dec_kn20aa.c
+++ b/sys/alpha/alpha/dec_kn20aa.c
@@ -32,9 +32,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_ddb.h"
-#include "opt_dev_sc.h"
-
#include <sys/param.h>
#include <sys/reboot.h>
#include <sys/systm.h>
@@ -51,18 +48,6 @@ __FBSDID("$FreeBSD$");
#include <alpha/pci/ciareg.h>
#include <alpha/pci/ciavar.h>
-#ifndef NO_SIO
-#ifndef CONSPEED
-#define CONSPEED TTYDEF_SPEED
-#endif
-static int comcnrate = CONSPEED;
-extern int comconsole;
-extern int siocnattach(int, int);
-extern int siogdbattach(int, int);
-#endif
-
-extern int sccnattach(void);
-
void dec_kn20aa_init(void);
static void dec_kn20aa_cons_init(void);
static void dec_kn20aa_intr_init(void);
@@ -108,40 +93,15 @@ dec_kn20aa_cons_init()
cia_init();
-#ifndef NO_SIO
-#ifdef DDB
- siogdbattach(0x2f8, 9600);
-#endif
-#endif
-
ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off);
switch (ctb->ctb_term_type) {
case 2:
-#ifndef NO_SIO
- /* serial console ... */
- /*
- * Delay to allow PROM putchars to complete.
- * FIFO depth * character time,
- * character time = (1000000 / (defaultrate / 10))
- */
- DELAY(160000000 / comcnrate);
- comconsole = 0;
- if (siocnattach(0x3f8, comcnrate))
- panic("can't init serial console");
-
boothowto |= RB_SERIAL;
-#endif
break;
case 3:
- /* display console ... */
- /* XXX */
-#ifdef DEV_SC
- sccnattach();
-#else
- panic("not configured to use display && keyboard console");
-#endif
+ boothowto &= ~RB_SERIAL;
break;
default:
diff --git a/sys/alpha/alpha/dec_kn300.c b/sys/alpha/alpha/dec_kn300.c
index fa1f830..b4f7f3e 100644
--- a/sys/alpha/alpha/dec_kn300.c
+++ b/sys/alpha/alpha/dec_kn300.c
@@ -31,9 +31,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_ddb.h"
-#include "opt_dev_sc.h"
-
#include <sys/param.h>
#include <sys/reboot.h>
#include <sys/systm.h>
@@ -54,18 +51,6 @@ __FBSDID("$FreeBSD$");
#include <alpha/mcbus/mcbusreg.h>
#include <alpha/mcbus/mcbusvar.h>
-#ifndef NO_SIO
-#ifndef CONSPEED
-#define CONSPEED TTYDEF_SPEED
-#endif
-static int comcnrate = CONSPEED;
-extern int comconsole;
-extern int siocnattach(int, int);
-extern int siogdbattach(int, int);
-#endif
-
-extern int sccnattach(void);
-
void dec_kn300_init(void);
void dec_kn300_cons_init(void);
@@ -102,38 +87,15 @@ dec_kn300_cons_init()
mcbus_init();
-#ifndef NO_SIO
-#ifdef DDB
- siogdbattach(0x2f8, 57600);
-#endif
-#endif
-
ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off);
switch (ctb->ctb_term_type) {
case 2:
-#ifndef NO_SIO
- /* serial console ... */
- /*
- * Delay to allow PROM putchars to complete.
- * FIFO depth * character time,
- * character time = (1000000 / (defaultrate / 10))
- */
- DELAY(160000000 / comcnrate);
- comconsole = 0;
- if (siocnattach(0x3f8, comcnrate))
- panic("can't init serial console");
-
boothowto |= RB_SERIAL;
-#endif
break;
case 3:
-#ifdef DEV_SC
- sccnattach();
-#else
- panic("not configured to use display && keyboard console");
-#endif
+ boothowto &= ~RB_SERIAL;
break;
default:
diff --git a/sys/alpha/alpha/dec_st550.c b/sys/alpha/alpha/dec_st550.c
index e81e982..73af900 100644
--- a/sys/alpha/alpha/dec_st550.c
+++ b/sys/alpha/alpha/dec_st550.c
@@ -34,9 +34,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_ddb.h"
-#include "opt_dev_sc.h"
-
#include <sys/param.h>
#include <sys/reboot.h>
#include <sys/systm.h>
@@ -56,18 +53,6 @@ __FBSDID("$FreeBSD$");
#include <alpha/pci/ciareg.h>
#include <alpha/pci/ciavar.h>
-#ifndef NO_SIO
-#ifndef CONSPEED
-#define CONSPEED TTYDEF_SPEED
-#endif
-static int comcnrate = CONSPEED;
-extern int comconsole;
-extern int siocnattach(int, int);
-extern int siogdbattach(int, int);
-#endif
-
-extern int sccnattach(void);
-
void st550_init(void);
static void st550_cons_init(void);
static void st550_intr_init(void);
@@ -105,41 +90,15 @@ st550_cons_init()
cia_init();
-#ifndef NO_SIO
-#ifdef DDB
- siogdbattach(0x2f8, 57600);
-#endif
-#endif
-
ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off);
switch (ctb->ctb_term_type) {
case 2:
-#ifndef NO_SIO
- /* serial console ... */
- /* XXX */
- /*
- * Delay to allow PROM putchars to complete.
- * FIFO depth * character time,
- * character time = (1000000 / (defaultrate / 10))
- */
- DELAY(160000000 / comcnrate);
- comconsole = 0;
- if (siocnattach(0x3f8, comcnrate))
- panic("can't init serial console");
-
boothowto |= RB_SERIAL;
-#endif
break;
case 3:
- /* display console ... */
- /* XXX */
-#ifdef DEV_SC
- sccnattach();
-#else
- panic("not configured to use display && keyboard console");
-#endif
+ boothowto &= ~RB_SERIAL;
break;
default:
diff --git a/sys/alpha/alpha/dec_st6600.c b/sys/alpha/alpha/dec_st6600.c
index c940c62..2750946 100644
--- a/sys/alpha/alpha/dec_st6600.c
+++ b/sys/alpha/alpha/dec_st6600.c
@@ -27,9 +27,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_ddb.h"
-#include "opt_dev_sc.h"
-
#include <sys/param.h>
#include <sys/reboot.h>
#include <sys/systm.h>
@@ -48,18 +45,6 @@ __FBSDID("$FreeBSD$");
#include <dev/pci/pcivar.h>
#include <alpha/pci/tsunamivar.h>
-#ifndef NO_SIO
-#ifndef CONSPEED
-#define CONSPEED TTYDEF_SPEED
-#endif
-static int comcnrate = CONSPEED;
-extern int comconsole;
-extern int siocnattach(int, int);
-extern int siogdbattach(int, int);
-#endif
-
-extern int sccnattach(void);
-
void st6600_init(void);
static void st6600_cons_init(void);
static void st6600_intr_init(void);
@@ -89,40 +74,15 @@ st6600_cons_init()
tsunami_init();
-#ifndef NO_SIO
-#ifdef DDB
- siogdbattach(0x2f8, 57600);
-#endif
-#endif
-
ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off);
switch (ctb->ctb_term_type) {
case 2:
-#ifndef NO_SIO
- /* serial console ... */
- /*
- * Delay to allow PROM putchars to complete.
- * FIFO depth * character time,
- * character time = (1000000 / (defaultrate / 10))
- */
- DELAY(160000000 / comcnrate);
- comconsole = 0;
- if (siocnattach(0x3f8, comcnrate))
- panic("can't init serial console");
-
boothowto |= RB_SERIAL;
-#endif
break;
case 3:
- /* display console ... */
- /* XXX */
-#ifdef DEV_SC
- sccnattach();
-#else
- panic("not configured to use display && keyboard console");
-#endif
+ boothowto &= ~RB_SERIAL;
break;
default:
diff --git a/sys/alpha/conf/NOTES b/sys/alpha/conf/NOTES
index 55f2da4..f963934 100644
--- a/sys/alpha/conf/NOTES
+++ b/sys/alpha/conf/NOTES
@@ -40,9 +40,6 @@ options DEC_KN8AE # AlphaServer 8200/8400 (Turbolaser)
options DEC_KN300 # AlphaServer 4100 (Rawhide),
# AlphaServer 1200 (Tincup)
-# Allow building a kernel without sio(4).
-options NO_SIO
-
#####################################################################
# HARDWARE BUS CONFIGURATION
diff --git a/sys/conf/options.alpha b/sys/conf/options.alpha
index 407ce03..d1aaf8d 100644
--- a/sys/conf/options.alpha
+++ b/sys/conf/options.alpha
@@ -16,15 +16,11 @@ DEC_AXPPCI_33 opt_cpu.h
DEC_1000A opt_cpu.h
API_UP1000 opt_cpu.h
-NO_SIO opt_global.h
-
MAXMEM
PPC_PROBE_CHIPSET opt_ppc.h
PPC_DEBUG opt_ppc.h
-DEV_SC
-
VGA_ALT_SEQACCESS opt_vga.h
VGA_DEBUG opt_vga.h
VGA_NO_FONT_LOADING opt_vga.h
diff --git a/sys/dev/gfb/gfb_pci.c b/sys/dev/gfb/gfb_pci.c
index 3e22978..ba57878 100644
--- a/sys/dev/gfb/gfb_pci.c
+++ b/sys/dev/gfb/gfb_pci.c
@@ -32,9 +32,6 @@ __FBSDID("$FreeBSD$");
#include "opt_fb.h"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@@ -66,23 +63,10 @@ __FBSDID("$FreeBSD$");
#include <dev/fb/gfb.h>
#include <dev/gfb/gfb_pci.h>
-#ifdef __alpha__
-
-#include <machine/rpb.h>
-#include <machine/cpu.h>
-
-#endif /* __alpha__ */
-
#if 0
static devclass_t gfb_devclass;
#endif
-#ifdef __alpha__
-
-extern void sccnattach(void);
-
-#endif /* __alpha__ */
-
extern struct gfb_font bold8x16;
extern struct gfb_softc *gfb_device_softcs[2][16];
@@ -93,9 +77,6 @@ pcigfb_attach(device_t dev)
gfb_softc_t sc;
video_adapter_t *adp;
int unit, flags, error, rid, va_index;
-#ifdef __alpha__
- struct ctb *ctb;
-#endif /* __alpha__ */
s = splimp();
error = 0;
@@ -136,7 +117,7 @@ pcigfb_attach(device_t dev)
adp->va_mem_base = (vm_offset_t)rman_get_virtual(sc->res);
adp->va_mem_size = rman_get_end(sc->res) -
rman_get_start(sc->res);
- adp->va_io_base = 0;
+ adp->va_io_base = (vm_offset_t)sc->res; /* XXX */
adp->va_io_size = 0;
adp->va_crtc_addr = 0;
gfb_device_softcs[sc->model][unit] = sc;
@@ -191,19 +172,6 @@ pcigfb_attach(device_t dev)
gfb_device_softcs[sc->model][unit] = sc;
}
- /*
- This is a back-door for PCI devices--since FreeBSD no longer supports
- PCI configuration-space accesses during the *configure() phase for
- video adapters, we cannot identify a PCI device as the console during
- the first call to sccnattach(). There must be a second chance for PCI
- adapters to be recognized as the console, and this is it...
- */
-#ifdef __alpha__
- ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off);
- if (ctb->ctb_term_type == 3) /* Display adapter */
- sccnattach();
-#endif /* __alpha__ */
-
device_printf(dev, "Board type %s\n", sc->gfbc->name);
device_printf(dev, "%d x %d, %dbpp, %s RAMDAC\n",
sc->adp->va_info.vi_width, sc->adp->va_info.vi_height,
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c
index fe219b1..078fb0d 100644
--- a/sys/dev/sio/sio.c
+++ b/sys/dev/sio/sio.c
@@ -35,7 +35,8 @@ __FBSDID("$FreeBSD$");
#include "opt_comconsole.h"
#include "opt_compat.h"
-#include "opt_ddb.h"
+#include "opt_gdb.h"
+#include "opt_kdb.h"
#include "opt_sio.h"
/*
@@ -53,6 +54,7 @@ __FBSDID("$FreeBSD$");
#include <sys/conf.h>
#include <sys/fcntl.h>
#include <sys/interrupt.h>
+#include <sys/kdb.h>
#include <sys/kernel.h>
#include <sys/limits.h>
#include <sys/lock.h>
@@ -71,9 +73,6 @@ __FBSDID("$FreeBSD$");
#include <sys/timepps.h>
#include <sys/uio.h>
#include <sys/cons.h>
-#if DDB > 0
-#include <ddb/ddb.h>
-#endif
#include <isa/isavar.h>
@@ -352,8 +351,6 @@ SYSCTL_UINT(_machdep, OID_AUTO, gdbspeed, CTLFLAG_RW,
static u_int com_events; /* input chars + weighted output completions */
static Port_t siocniobase;
static int siocnunit = -1;
-static Port_t siogdbiobase;
-static int siogdbunit = -1;
static void *sio_slow_ih;
static void *sio_fast_ih;
static int sio_timeout;
@@ -362,6 +359,10 @@ static struct callout_handle sio_timeout_handle
= CALLOUT_HANDLE_INITIALIZER(&sio_timeout_handle);
static int sio_numunits;
+#ifdef GDB
+static Port_t siogdbiobase = 0;
+#endif
+
#ifdef COM_ESP
/* XXX configure this properly. */
/* XXX quite broken for new-bus. */
@@ -1178,7 +1179,7 @@ determined_type: ;
}
if (ret)
device_printf(dev, "could not activate interrupt\n");
-#if defined(DDB) && (defined(BREAK_TO_DEBUGGER) || \
+#if defined(KDB) && (defined(BREAK_TO_DEBUGGER) || \
defined(ALT_BREAK_TO_DEBUGGER))
/*
* Enable interrupts for early break-to-debugger support
@@ -1454,7 +1455,7 @@ comhardclose(com)
sio_setreg(com, com_cfcr, com->cfcr_image &= ~CFCR_SBREAK);
tp = com->tp;
-#if defined(DDB) && (defined(BREAK_TO_DEBUGGER) || \
+#if defined(KDB) && (defined(BREAK_TO_DEBUGGER) || \
defined(ALT_BREAK_TO_DEBUGGER))
/*
* Leave interrupts enabled and don't clear DTR if this is the
@@ -1834,13 +1835,13 @@ siointr1(com)
recv_data = 0;
else
recv_data = inb(com->data_port);
-#ifdef DDB
+#ifdef KDB
#ifdef ALT_BREAK_TO_DEBUGGER
if (com->unit == comconsole &&
- db_alt_break(recv_data, &com->alt_brk_state) != 0)
- breakpoint();
+ kdb_alt_break(recv_data, &com->alt_brk_state) != 0)
+ kdb_enter("Break sequence on console");
#endif /* ALT_BREAK_TO_DEBUGGER */
-#endif /* DDB */
+#endif /* KDB */
if (line_status & (LSR_BI | LSR_FE | LSR_PE)) {
/*
* Don't store BI if IGNBRK or FE/PE if IGNPAR.
@@ -1855,9 +1856,9 @@ siointr1(com)
* Note: BI together with FE/PE means just BI.
*/
if (line_status & LSR_BI) {
-#if defined(DDB) && defined(BREAK_TO_DEBUGGER)
+#if defined(KDB) && defined(BREAK_TO_DEBUGGER)
if (com->unit == comconsole) {
- breakpoint();
+ kdb_enter("Line break on console");
goto cont;
}
#endif
@@ -2752,35 +2753,20 @@ siocnset(struct consdev *cd, int unit)
sprintf(cd->cn_name, "ttyd%d", unit);
}
-#ifndef __alpha__
static speed_t siocngetspeed(Port_t, u_long rclk);
-#endif
static void siocnclose(struct siocnstate *sp, Port_t iobase);
static void siocnopen(struct siocnstate *sp, Port_t iobase, int speed);
static void siocntxwait(Port_t iobase);
-#ifdef __alpha__
-int siocnattach(int port, int speed);
-int siogdbattach(int port, int speed);
-int siogdbgetc(void);
-void siogdbputc(int c);
-#else
static cn_probe_t siocnprobe;
static cn_init_t siocninit;
static cn_term_t siocnterm;
-#endif
static cn_checkc_t siocncheckc;
static cn_getc_t siocngetc;
static cn_putc_t siocnputc;
-#ifndef __alpha__
CONS_DRIVER(sio, siocnprobe, siocninit, siocnterm, siocngetc, siocncheckc,
siocnputc, NULL);
-#endif
-
-#if DDB > 0
-static struct consdev gdbconsdev;
-#endif
static void
siocntxwait(iobase)
@@ -2799,8 +2785,6 @@ siocntxwait(iobase)
;
}
-#ifndef __alpha__
-
/*
* Read the serial port specified and try to figure out what speed
* it's currently running at. We're assuming the serial port has
@@ -2836,8 +2820,6 @@ siocngetspeed(iobase, rclk)
return (rclk / (16UL * divisor));
}
-#endif
-
static void
siocnopen(sp, iobase, speed)
struct siocnstate *sp;
@@ -2905,8 +2887,6 @@ siocnclose(sp, iobase)
outb(iobase + com_ier, sp->ier);
}
-#ifndef __alpha__
-
static void
siocnprobe(cp)
struct consdev *cp;
@@ -2982,40 +2962,12 @@ siocnprobe(cp)
siocniobase = iobase;
siocnunit = unit;
}
- if (COM_DEBUGGER(flags)) {
- printf("sio%d: gdb debugging port\n", unit);
+#ifdef GDB
+ if (COM_DEBUGGER(flags))
siogdbiobase = iobase;
- siogdbunit = unit;
-#if DDB > 0
- siocnset(&gdbconsdev, unit);
- gdb_arg = &gdbconsdev;
- gdb_getc = siocngetc;
- gdb_putc = siocnputc;
#endif
- }
}
}
-#ifdef __i386__
-#if DDB > 0
- /*
- * XXX Ugly Compatability.
- * If no gdb port has been specified, set it to be the console
- * as some configuration files don't specify the gdb port.
- */
- if (gdb_arg == NULL && (boothowto & RB_GDB)) {
- printf("Warning: no GDB port specified. Defaulting to sio%d.\n",
- siocnunit);
- printf("Set flag 0x80 on desired GDB port in your\n");
- printf("configuration file (currently sio only).\n");
- siogdbiobase = siocniobase;
- siogdbunit = siocnunit;
- siocnset(&gdbconsdev, siocnunit);
- gdb_arg = &gdbconsdev;
- gdb_getc = siocngetc;
- gdb_putc = siocnputc;
- }
-#endif
-#endif
}
static void
@@ -3032,103 +2984,6 @@ siocnterm(cp)
comconsole = -1;
}
-#endif
-
-#ifdef __alpha__
-
-CONS_DRIVER(sio, NULL, NULL, NULL, siocngetc, siocncheckc, siocnputc, NULL);
-
-int
-siocnattach(port, speed)
- int port;
- int speed;
-{
- int s;
- u_char cfcr;
- u_int divisor;
- struct siocnstate sp;
- int unit = 0; /* XXX random value! */
-
- siocniobase = port;
- siocnunit = unit;
- comdefaultrate = speed;
- sio_consdev.cn_pri = CN_NORMAL;
- siocnset(&sio_consdev, unit);
-
- s = spltty();
-
- /*
- * Initialize the divisor latch. We can't rely on
- * siocnopen() to do this the first time, since it
- * avoids writing to the latch if the latch appears
- * to have the correct value. Also, if we didn't
- * just read the speed from the hardware, then we
- * need to set the speed in hardware so that
- * switching it later is null.
- */
- cfcr = inb(siocniobase + com_cfcr);
- outb(siocniobase + com_cfcr, CFCR_DLAB | cfcr);
- divisor = siodivisor(comdefaultrclk, comdefaultrate);
- outb(siocniobase + com_dlbl, divisor & 0xff);
- outb(siocniobase + com_dlbh, divisor >> 8);
- outb(siocniobase + com_cfcr, cfcr);
-
- siocnopen(&sp, siocniobase, comdefaultrate);
- splx(s);
-
- cnadd(&sio_consdev);
- return (0);
-}
-
-int
-siogdbattach(port, speed)
- int port;
- int speed;
-{
- int s;
- u_char cfcr;
- u_int divisor;
- struct siocnstate sp;
- int unit = 1; /* XXX random value! */
-
- siogdbiobase = port;
- gdbdefaultrate = speed;
-
- printf("sio%d: gdb debugging port\n", unit);
- siogdbunit = unit;
-#if DDB > 0
- siocnset(&gdbconsdev, unit);
- gdb_arg = &gdbconsdev;
- gdb_getc = siocngetc;
- gdb_putc = siocnputc;
-#endif
-
- s = spltty();
-
- /*
- * Initialize the divisor latch. We can't rely on
- * siocnopen() to do this the first time, since it
- * avoids writing to the latch if the latch appears
- * to have the correct value. Also, if we didn't
- * just read the speed from the hardware, then we
- * need to set the speed in hardware so that
- * switching it later is null.
- */
- cfcr = inb(siogdbiobase + com_cfcr);
- outb(siogdbiobase + com_cfcr, CFCR_DLAB | cfcr);
- divisor = siodivisor(comdefaultrclk, gdbdefaultrate);
- outb(siogdbiobase + com_dlbl, divisor & 0xff);
- outb(siogdbiobase + com_dlbh, divisor >> 8);
- outb(siogdbiobase + com_cfcr, cfcr);
-
- siocnopen(&sp, siogdbiobase, gdbdefaultrate);
- splx(s);
-
- return (0);
-}
-
-#endif
-
static int
siocncheckc(struct consdev *cd)
{
@@ -3137,13 +2992,17 @@ siocncheckc(struct consdev *cd)
int s;
struct siocnstate sp;
speed_t speed;
-
- if (cd->cn_unit == siocnunit) {
+
+ if (cd != NULL && cd->cn_unit == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
+#ifdef GDB
iobase = siogdbiobase;
speed = gdbdefaultrate;
+#else
+ return (-1);
+#endif
}
s = spltty();
siocnopen(&sp, iobase, speed);
@@ -3165,12 +3024,16 @@ siocngetc(struct consdev *cd)
struct siocnstate sp;
speed_t speed;
- if (cd->cn_unit == siocnunit) {
+ if (cd != NULL && cd->cn_unit == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
+#ifdef GDB
iobase = siogdbiobase;
speed = gdbdefaultrate;
+#else
+ return (-1);
+#endif
}
s = spltty();
siocnopen(&sp, iobase, speed);
@@ -3191,12 +3054,16 @@ siocnputc(struct consdev *cd, int c)
Port_t iobase;
speed_t speed;
- if (cd->cn_unit == siocnunit) {
+ if (cd != NULL && cd->cn_unit == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
+#ifdef GDB
iobase = siogdbiobase;
speed = gdbdefaultrate;
+#else
+ return;
+#endif
}
s = spltty();
need_unlock = 0;
@@ -3213,56 +3080,56 @@ siocnputc(struct consdev *cd, int c)
splx(s);
}
-#ifdef __alpha__
-int
-siogdbgetc()
+/*
+ * Remote gdb(1) support.
+ */
+
+#if defined(GDB)
+
+#include <gdb/gdb.h>
+
+static gdb_probe_f siogdbprobe;
+static gdb_init_f siogdbinit;
+static gdb_term_f siogdbterm;
+static gdb_getc_f siogdbgetc;
+static gdb_checkc_f siogdbcheckc;
+static gdb_putc_f siogdbputc;
+
+GDB_DBGPORT(sio, siogdbprobe, siogdbinit, siogdbterm, siogdbcheckc,
+ siogdbgetc, siogdbputc);
+
+static int
+siogdbprobe(void)
{
- int c;
- Port_t iobase;
- speed_t speed;
- int s;
- struct siocnstate sp;
+ return ((siogdbiobase != 0) ? 0 : -1);
+}
- if (siogdbunit == siocnunit) {
- iobase = siocniobase;
- speed = comdefaultrate;
- } else {
- iobase = siogdbiobase;
- speed = gdbdefaultrate;
- }
+static void
+siogdbinit(void)
+{
+}
- s = spltty();
- siocnopen(&sp, iobase, speed);
- while (!(inb(iobase + com_lsr) & LSR_RXRDY))
- ;
- c = inb(iobase + com_data);
- siocnclose(&sp, iobase);
- splx(s);
- return (c);
+static void
+siogdbterm(void)
+{
}
-void
-siogdbputc(c)
- int c;
+static void
+siogdbputc(int c)
{
- Port_t iobase;
- speed_t speed;
- int s;
- struct siocnstate sp;
+ siocnputc(NULL, c);
+}
- if (siogdbunit == siocnunit) {
- iobase = siocniobase;
- speed = comdefaultrate;
- } else {
- iobase = siogdbiobase;
- speed = gdbdefaultrate;
- }
+static int
+siogdbcheckc(void)
+{
+ return (siocncheckc(NULL));
+}
- s = spltty();
- siocnopen(&sp, iobase, speed);
- siocntxwait(siogdbiobase);
- outb(siogdbiobase + com_data, c);
- siocnclose(&sp, siogdbiobase);
- splx(s);
+static int
+siogdbgetc(void)
+{
+ return (siocngetc(NULL));
}
+
#endif
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
index 6c1a549..2620ea7 100644
--- a/sys/dev/syscons/syscons.c
+++ b/sys/dev/syscons/syscons.c
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
#include <sys/conf.h>
#include <sys/cons.h>
#include <sys/consio.h>
+#include <sys/kdb.h>
#include <sys/eventhandler.h>
#include <sys/fbio.h>
#include <sys/kbio.h>
@@ -154,9 +155,7 @@ static int scparam(struct tty *tp, struct termios *t);
static void scstart(struct tty *tp);
static void scinit(int unit, int flags);
static scr_stat *sc_get_stat(struct cdev *devptr);
-#if !__alpha__
static void scterm(int unit, int flags);
-#endif
static void scshutdown(void *arg, int howto);
static u_int scgetc(sc_softc_t *sc, u_int flags);
#define SCGETC_CN 1
@@ -205,10 +204,6 @@ static cn_putc_t sccnputc;
static cn_dbctl_t sccndbctl;
static cn_term_t sccnterm;
-#if __alpha__
-void sccnattach(void);
-#endif
-
CONS_DRIVER(sc, sccnprobe, sccninit, sccnterm, sccngetc, sccncheckc, sccnputc,
sccndbctl);
@@ -1377,7 +1372,6 @@ scstart(struct tty *tp)
static void
sccnprobe(struct consdev *cp)
{
-#if !__alpha__
int unit;
int flags;
@@ -1395,22 +1389,11 @@ sccnprobe(struct consdev *cp)
/* initialize required fields */
sprintf(cp->cn_name, "consolectl");
-#endif /* !__alpha__ */
-
-#if __alpha__
- /*
- * alpha use sccnattach() rather than cnprobe()/cninit()/cnterm()
- * interface to install the console. Always return CN_DEAD from
- * here.
- */
- cp->cn_pri = CN_DEAD;
-#endif /* __alpha__ */
}
static void
sccninit(struct consdev *cp)
{
-#if !__alpha__
int unit;
int flags;
@@ -1419,11 +1402,6 @@ sccninit(struct consdev *cp)
sc_console_unit = unit;
sc_console = sc_get_stat(sc_get_softc(unit, SC_KERNEL_CONSOLE)->dev[0]);
sc_consptr = cp;
-#endif /* !__alpha__ */
-
-#if __alpha__
- /* SHOULDN'T REACH HERE */
-#endif /* __alpha__ */
}
static void
@@ -1434,54 +1412,16 @@ sccnterm(struct consdev *cp)
if (sc_console_unit < 0)
return; /* shouldn't happen */
-#if !__alpha__
#if 0 /* XXX */
sc_clear_screen(sc_console);
sccnupdate(sc_console);
#endif
+
scterm(sc_console_unit, SC_KERNEL_CONSOLE);
sc_console_unit = -1;
sc_console = NULL;
-#endif /* !__alpha__ */
-
-#if __alpha__
- /* do nothing XXX */
-#endif /* __alpha__ */
-}
-
-#ifdef __alpha__
-
-void
-sccnattach(void)
-{
- static struct consdev consdev;
- int unit;
- int flags;
-
- bcopy(&sc_consdev, &consdev, sizeof(sc_consdev));
- consdev.cn_pri = sc_get_cons_priority(&unit, &flags);
-
- /* a video card is always required */
- if (!scvidprobe(unit, flags, TRUE))
- consdev.cn_pri = CN_DEAD;
-
- /* alpha doesn't allow the console being without a keyboard... Why? */
- if (!sckbdprobe(unit, flags, TRUE))
- consdev.cn_pri = CN_DEAD;
-
- if (consdev.cn_pri == CN_DEAD)
- return;
-
- scinit(unit, flags | SC_KERNEL_CONSOLE);
- sc_console_unit = unit;
- sc_consptr = &consdev;
- sc_console = sc_get_stat(sc_get_softc(unit, SC_KERNEL_CONSOLE)->dev[0]);
- sprintf(consdev.cn_name, "ttyv%r", 0);
- cnadd(&consdev);
}
-#endif /* __alpha__ */
-
static void
sccnputc(struct consdev *cd, int c)
{
@@ -2846,7 +2786,6 @@ scinit(int unit, int flags)
sc->flags |= SC_INIT_DONE;
}
-#if !__alpha__
static void
scterm(int unit, int flags)
{
@@ -2902,7 +2841,6 @@ scterm(int unit, int flags)
sc->keyboard = -1;
sc->adapter = -1;
}
-#endif /* !__alpha__ */
static void
scshutdown(void *arg, int howto)
@@ -3342,15 +3280,9 @@ next_code:
break;
case DBG:
-#ifndef SC_DISABLE_DDBKEY
-#ifdef DDB
- Debugger("manual escape to debugger");
-#else
- printf("No debugger in kernel\n");
+#ifndef SC_DISABLE_KDBKEY
+ kdb_enter("manual escape to debugger");
#endif
-#else /* SC_DISABLE_DDBKEY */
- /* do nothing */
-#endif /* SC_DISABLE_DDBKEY */
break;
case PNC:
diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c
index c2f02e8..5f769ae 100644
--- a/sys/pc98/cbus/sio.c
+++ b/sys/pc98/cbus/sio.c
@@ -33,7 +33,8 @@
#include "opt_comconsole.h"
#include "opt_compat.h"
-#include "opt_ddb.h"
+#include "opt_gdb.h"
+#include "opt_kdb.h"
#include "opt_sio.h"
/*
@@ -83,6 +84,7 @@
#include <sys/conf.h>
#include <sys/fcntl.h>
#include <sys/interrupt.h>
+#include <sys/kdb.h>
#include <sys/kernel.h>
#include <sys/limits.h>
#include <sys/lock.h>
@@ -100,9 +102,6 @@
#include <sys/timepps.h>
#include <sys/uio.h>
#include <sys/cons.h>
-#if DDB > 0
-#include <ddb/ddb.h>
-#endif
#include <isa/isavar.h>
@@ -438,8 +437,6 @@ SYSCTL_UINT(_machdep, OID_AUTO, gdbspeed, CTLFLAG_RW,
static u_int com_events; /* input chars + weighted output completions */
static Port_t siocniobase;
static int siocnunit = -1;
-static Port_t siogdbiobase;
-static int siogdbunit = -1;
static void *sio_slow_ih;
static void *sio_fast_ih;
static int sio_timeout;
@@ -682,6 +679,10 @@ struct {
};
#endif /* PC98 */
+#ifdef GDB
+static Port_t siogdbiobase = 0;
+#endif
+
#ifdef COM_ESP
#ifdef PC98
@@ -1848,7 +1849,7 @@ determined_type: ;
}
if (ret)
device_printf(dev, "could not activate interrupt\n");
-#if defined(DDB) && (defined(BREAK_TO_DEBUGGER) || \
+#if defined(KDB) && (defined(BREAK_TO_DEBUGGER) || \
defined(ALT_BREAK_TO_DEBUGGER))
/*
* Enable interrupts for early break-to-debugger support
@@ -2181,7 +2182,7 @@ comhardclose(com)
#endif
tp = com->tp;
-#if defined(DDB) && (defined(BREAK_TO_DEBUGGER) || \
+#if defined(KDB) && (defined(BREAK_TO_DEBUGGER) || \
defined(ALT_BREAK_TO_DEBUGGER))
/*
* Leave interrupts enabled and don't clear DTR if this is the
@@ -2713,13 +2714,13 @@ more_intr:
recv_data = 0;
else
recv_data = inb(com->data_port);
-#ifdef DDB
+#ifdef KDB
#ifdef ALT_BREAK_TO_DEBUGGER
if (com->unit == comconsole &&
- db_alt_break(recv_data, &com->alt_brk_state) != 0)
- breakpoint();
+ kdb_alt_break(recv_data, &com->alt_brk_state) != 0)
+ kdb_enter("Break sequence on console");
#endif /* ALT_BREAK_TO_DEBUGGER */
-#endif /* DDB */
+#endif /* KDB */
if (line_status & (LSR_BI | LSR_FE | LSR_PE)) {
/*
* Don't store BI if IGNBRK or FE/PE if IGNPAR.
@@ -2734,9 +2735,9 @@ more_intr:
* Note: BI together with FE/PE means just BI.
*/
if (line_status & LSR_BI) {
-#if defined(DDB) && defined(BREAK_TO_DEBUGGER)
+#if defined(KDB) && defined(BREAK_TO_DEBUGGER)
if (com->unit == comconsole) {
- breakpoint();
+ kdb_enter("Line break on console");
goto cont;
}
#endif
@@ -3946,35 +3947,20 @@ siocnset(struct consdev *cd, int unit)
sprintf(cd->cn_name, "ttyd%d", unit);
}
-#ifndef __alpha__
static speed_t siocngetspeed(Port_t, u_long rclk);
-#endif
static void siocnclose(struct siocnstate *sp, Port_t iobase);
static void siocnopen(struct siocnstate *sp, Port_t iobase, int speed);
static void siocntxwait(Port_t iobase);
-#ifdef __alpha__
-int siocnattach(int port, int speed);
-int siogdbattach(int port, int speed);
-int siogdbgetc(void);
-void siogdbputc(int c);
-#else
static cn_probe_t siocnprobe;
static cn_init_t siocninit;
static cn_term_t siocnterm;
-#endif
static cn_checkc_t siocncheckc;
static cn_getc_t siocngetc;
static cn_putc_t siocnputc;
-#ifndef __alpha__
CONS_DRIVER(sio, siocnprobe, siocninit, siocnterm, siocngetc, siocncheckc,
siocnputc, NULL);
-#endif
-
-#if DDB > 0
-static struct consdev gdbconsdev;
-#endif
static void
siocntxwait(iobase)
@@ -3993,8 +3979,6 @@ siocntxwait(iobase)
;
}
-#ifndef __alpha__
-
/*
* Read the serial port specified and try to figure out what speed
* it's currently running at. We're assuming the serial port has
@@ -4030,8 +4014,6 @@ siocngetspeed(iobase, rclk)
return (rclk / (16UL * divisor));
}
-#endif
-
static void
siocnopen(sp, iobase, speed)
struct siocnstate *sp;
@@ -4099,8 +4081,6 @@ siocnclose(sp, iobase)
outb(iobase + com_ier, sp->ier);
}
-#ifndef __alpha__
-
static void
siocnprobe(cp)
struct consdev *cp;
@@ -4176,40 +4156,12 @@ siocnprobe(cp)
siocniobase = iobase;
siocnunit = unit;
}
- if (COM_DEBUGGER(flags)) {
- printf("sio%d: gdb debugging port\n", unit);
+#ifdef GDB
+ if (COM_DEBUGGER(flags))
siogdbiobase = iobase;
- siogdbunit = unit;
-#if DDB > 0
- siocnset(&gdbconsdev, unit);
- gdb_arg = &gdbconsdev;
- gdb_getc = siocngetc;
- gdb_putc = siocnputc;
#endif
- }
}
}
-#ifdef __i386__
-#if DDB > 0
- /*
- * XXX Ugly Compatability.
- * If no gdb port has been specified, set it to be the console
- * as some configuration files don't specify the gdb port.
- */
- if (gdb_arg == NULL && (boothowto & RB_GDB)) {
- printf("Warning: no GDB port specified. Defaulting to sio%d.\n",
- siocnunit);
- printf("Set flag 0x80 on desired GDB port in your\n");
- printf("configuration file (currently sio only).\n");
- siogdbiobase = siocniobase;
- siogdbunit = siocnunit;
- siocnset(&gdbconsdev, siocnunit);
- gdb_arg = &gdbconsdev;
- gdb_getc = siocngetc;
- gdb_putc = siocnputc;
- }
-#endif
-#endif
}
static void
@@ -4226,103 +4178,6 @@ siocnterm(cp)
comconsole = -1;
}
-#endif
-
-#ifdef __alpha__
-
-CONS_DRIVER(sio, NULL, NULL, NULL, siocngetc, siocncheckc, siocnputc, NULL);
-
-int
-siocnattach(port, speed)
- int port;
- int speed;
-{
- int s;
- u_char cfcr;
- u_int divisor;
- struct siocnstate sp;
- int unit = 0; /* XXX random value! */
-
- siocniobase = port;
- siocnunit = unit;
- comdefaultrate = speed;
- sio_consdev.cn_pri = CN_NORMAL;
- siocnset(&sio_consdev, unit);
-
- s = spltty();
-
- /*
- * Initialize the divisor latch. We can't rely on
- * siocnopen() to do this the first time, since it
- * avoids writing to the latch if the latch appears
- * to have the correct value. Also, if we didn't
- * just read the speed from the hardware, then we
- * need to set the speed in hardware so that
- * switching it later is null.
- */
- cfcr = inb(siocniobase + com_cfcr);
- outb(siocniobase + com_cfcr, CFCR_DLAB | cfcr);
- divisor = siodivisor(comdefaultrclk, comdefaultrate);
- outb(siocniobase + com_dlbl, divisor & 0xff);
- outb(siocniobase + com_dlbh, divisor >> 8);
- outb(siocniobase + com_cfcr, cfcr);
-
- siocnopen(&sp, siocniobase, comdefaultrate);
- splx(s);
-
- cnadd(&sio_consdev);
- return (0);
-}
-
-int
-siogdbattach(port, speed)
- int port;
- int speed;
-{
- int s;
- u_char cfcr;
- u_int divisor;
- struct siocnstate sp;
- int unit = 1; /* XXX random value! */
-
- siogdbiobase = port;
- gdbdefaultrate = speed;
-
- printf("sio%d: gdb debugging port\n", unit);
- siogdbunit = unit;
-#if DDB > 0
- siocnset(&gdbconsdev, unit);
- gdb_arg = &gdbconsdev;
- gdb_getc = siocngetc;
- gdb_putc = siocnputc;
-#endif
-
- s = spltty();
-
- /*
- * Initialize the divisor latch. We can't rely on
- * siocnopen() to do this the first time, since it
- * avoids writing to the latch if the latch appears
- * to have the correct value. Also, if we didn't
- * just read the speed from the hardware, then we
- * need to set the speed in hardware so that
- * switching it later is null.
- */
- cfcr = inb(siogdbiobase + com_cfcr);
- outb(siogdbiobase + com_cfcr, CFCR_DLAB | cfcr);
- divisor = siodivisor(comdefaultrclk, gdbdefaultrate);
- outb(siogdbiobase + com_dlbl, divisor & 0xff);
- outb(siogdbiobase + com_dlbh, divisor >> 8);
- outb(siogdbiobase + com_cfcr, cfcr);
-
- siocnopen(&sp, siogdbiobase, gdbdefaultrate);
- splx(s);
-
- return (0);
-}
-
-#endif
-
static int
siocncheckc(struct consdev *cd)
{
@@ -4332,12 +4187,16 @@ siocncheckc(struct consdev *cd)
struct siocnstate sp;
speed_t speed;
- if (cd->cn_unit == siocnunit) {
+ if (cd != NULL && cd->cn_unit == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
+#ifdef GDB
iobase = siogdbiobase;
speed = gdbdefaultrate;
+#else
+ return (-1);
+#endif
}
s = spltty();
siocnopen(&sp, iobase, speed);
@@ -4359,12 +4218,16 @@ siocngetc(struct consdev *cd)
struct siocnstate sp;
speed_t speed;
- if (cd->cn_unit == siocnunit) {
+ if (cd != NULL && cd->cn_unit == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
+#ifdef GDB
iobase = siogdbiobase;
speed = gdbdefaultrate;
+#else
+ return (-1);
+#endif
}
s = spltty();
siocnopen(&sp, iobase, speed);
@@ -4385,12 +4248,16 @@ siocnputc(struct consdev *cd, int c)
Port_t iobase;
speed_t speed;
- if (cd->cn_unit == siocnunit) {
+ if (cd != NULL && cd->cn_unit == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
+#ifdef GDB
iobase = siogdbiobase;
speed = gdbdefaultrate;
+#else
+ return;
+#endif
}
s = spltty();
need_unlock = 0;
@@ -4407,58 +4274,58 @@ siocnputc(struct consdev *cd, int c)
splx(s);
}
-#ifdef __alpha__
-int
-siogdbgetc()
+/*
+ * Remote gdb(1) support.
+ */
+
+#if defined(GDB)
+
+#include <gdb/gdb.h>
+
+static gdb_probe_f siogdbprobe;
+static gdb_init_f siogdbinit;
+static gdb_term_f siogdbterm;
+static gdb_getc_f siogdbgetc;
+static gdb_checkc_f siogdbcheckc;
+static gdb_putc_f siogdbputc;
+
+GDB_DBGPORT(sio, siogdbprobe, siogdbinit, siogdbterm, siogdbcheckc,
+ siogdbgetc, siogdbputc);
+
+static int
+siogdbprobe(void)
{
- int c;
- Port_t iobase;
- speed_t speed;
- int s;
- struct siocnstate sp;
+ return ((siogdbiobase != 0) ? 0 : -1);
+}
- if (siogdbunit == siocnunit) {
- iobase = siocniobase;
- speed = comdefaultrate;
- } else {
- iobase = siogdbiobase;
- speed = gdbdefaultrate;
- }
+static void
+siogdbinit(void)
+{
+}
- s = spltty();
- siocnopen(&sp, iobase, speed);
- while (!(inb(iobase + com_lsr) & LSR_RXRDY))
- ;
- c = inb(iobase + com_data);
- siocnclose(&sp, iobase);
- splx(s);
- return (c);
+static void
+siogdbterm(void)
+{
}
-void
-siogdbputc(c)
- int c;
+static void
+siogdbputc(int c)
{
- Port_t iobase;
- speed_t speed;
- int s;
- struct siocnstate sp;
+ siocnputc(NULL, c);
+}
- if (siogdbunit == siocnunit) {
- iobase = siocniobase;
- speed = comdefaultrate;
- } else {
- iobase = siogdbiobase;
- speed = gdbdefaultrate;
- }
+static int
+siogdbcheckc(void)
+{
+ return (siocncheckc(NULL));
+}
- s = spltty();
- siocnopen(&sp, iobase, speed);
- siocntxwait(siogdbiobase);
- outb(siogdbiobase + com_data, c);
- siocnclose(&sp, siogdbiobase);
- splx(s);
+static int
+siogdbgetc(void)
+{
+ return (siocngetc(NULL));
}
+
#endif
#ifdef PC98
diff --git a/sys/pc98/pc98/sio.c b/sys/pc98/pc98/sio.c
index c2f02e8..5f769ae 100644
--- a/sys/pc98/pc98/sio.c
+++ b/sys/pc98/pc98/sio.c
@@ -33,7 +33,8 @@
#include "opt_comconsole.h"
#include "opt_compat.h"
-#include "opt_ddb.h"
+#include "opt_gdb.h"
+#include "opt_kdb.h"
#include "opt_sio.h"
/*
@@ -83,6 +84,7 @@
#include <sys/conf.h>
#include <sys/fcntl.h>
#include <sys/interrupt.h>
+#include <sys/kdb.h>
#include <sys/kernel.h>
#include <sys/limits.h>
#include <sys/lock.h>
@@ -100,9 +102,6 @@
#include <sys/timepps.h>
#include <sys/uio.h>
#include <sys/cons.h>
-#if DDB > 0
-#include <ddb/ddb.h>
-#endif
#include <isa/isavar.h>
@@ -438,8 +437,6 @@ SYSCTL_UINT(_machdep, OID_AUTO, gdbspeed, CTLFLAG_RW,
static u_int com_events; /* input chars + weighted output completions */
static Port_t siocniobase;
static int siocnunit = -1;
-static Port_t siogdbiobase;
-static int siogdbunit = -1;
static void *sio_slow_ih;
static void *sio_fast_ih;
static int sio_timeout;
@@ -682,6 +679,10 @@ struct {
};
#endif /* PC98 */
+#ifdef GDB
+static Port_t siogdbiobase = 0;
+#endif
+
#ifdef COM_ESP
#ifdef PC98
@@ -1848,7 +1849,7 @@ determined_type: ;
}
if (ret)
device_printf(dev, "could not activate interrupt\n");
-#if defined(DDB) && (defined(BREAK_TO_DEBUGGER) || \
+#if defined(KDB) && (defined(BREAK_TO_DEBUGGER) || \
defined(ALT_BREAK_TO_DEBUGGER))
/*
* Enable interrupts for early break-to-debugger support
@@ -2181,7 +2182,7 @@ comhardclose(com)
#endif
tp = com->tp;
-#if defined(DDB) && (defined(BREAK_TO_DEBUGGER) || \
+#if defined(KDB) && (defined(BREAK_TO_DEBUGGER) || \
defined(ALT_BREAK_TO_DEBUGGER))
/*
* Leave interrupts enabled and don't clear DTR if this is the
@@ -2713,13 +2714,13 @@ more_intr:
recv_data = 0;
else
recv_data = inb(com->data_port);
-#ifdef DDB
+#ifdef KDB
#ifdef ALT_BREAK_TO_DEBUGGER
if (com->unit == comconsole &&
- db_alt_break(recv_data, &com->alt_brk_state) != 0)
- breakpoint();
+ kdb_alt_break(recv_data, &com->alt_brk_state) != 0)
+ kdb_enter("Break sequence on console");
#endif /* ALT_BREAK_TO_DEBUGGER */
-#endif /* DDB */
+#endif /* KDB */
if (line_status & (LSR_BI | LSR_FE | LSR_PE)) {
/*
* Don't store BI if IGNBRK or FE/PE if IGNPAR.
@@ -2734,9 +2735,9 @@ more_intr:
* Note: BI together with FE/PE means just BI.
*/
if (line_status & LSR_BI) {
-#if defined(DDB) && defined(BREAK_TO_DEBUGGER)
+#if defined(KDB) && defined(BREAK_TO_DEBUGGER)
if (com->unit == comconsole) {
- breakpoint();
+ kdb_enter("Line break on console");
goto cont;
}
#endif
@@ -3946,35 +3947,20 @@ siocnset(struct consdev *cd, int unit)
sprintf(cd->cn_name, "ttyd%d", unit);
}
-#ifndef __alpha__
static speed_t siocngetspeed(Port_t, u_long rclk);
-#endif
static void siocnclose(struct siocnstate *sp, Port_t iobase);
static void siocnopen(struct siocnstate *sp, Port_t iobase, int speed);
static void siocntxwait(Port_t iobase);
-#ifdef __alpha__
-int siocnattach(int port, int speed);
-int siogdbattach(int port, int speed);
-int siogdbgetc(void);
-void siogdbputc(int c);
-#else
static cn_probe_t siocnprobe;
static cn_init_t siocninit;
static cn_term_t siocnterm;
-#endif
static cn_checkc_t siocncheckc;
static cn_getc_t siocngetc;
static cn_putc_t siocnputc;
-#ifndef __alpha__
CONS_DRIVER(sio, siocnprobe, siocninit, siocnterm, siocngetc, siocncheckc,
siocnputc, NULL);
-#endif
-
-#if DDB > 0
-static struct consdev gdbconsdev;
-#endif
static void
siocntxwait(iobase)
@@ -3993,8 +3979,6 @@ siocntxwait(iobase)
;
}
-#ifndef __alpha__
-
/*
* Read the serial port specified and try to figure out what speed
* it's currently running at. We're assuming the serial port has
@@ -4030,8 +4014,6 @@ siocngetspeed(iobase, rclk)
return (rclk / (16UL * divisor));
}
-#endif
-
static void
siocnopen(sp, iobase, speed)
struct siocnstate *sp;
@@ -4099,8 +4081,6 @@ siocnclose(sp, iobase)
outb(iobase + com_ier, sp->ier);
}
-#ifndef __alpha__
-
static void
siocnprobe(cp)
struct consdev *cp;
@@ -4176,40 +4156,12 @@ siocnprobe(cp)
siocniobase = iobase;
siocnunit = unit;
}
- if (COM_DEBUGGER(flags)) {
- printf("sio%d: gdb debugging port\n", unit);
+#ifdef GDB
+ if (COM_DEBUGGER(flags))
siogdbiobase = iobase;
- siogdbunit = unit;
-#if DDB > 0
- siocnset(&gdbconsdev, unit);
- gdb_arg = &gdbconsdev;
- gdb_getc = siocngetc;
- gdb_putc = siocnputc;
#endif
- }
}
}
-#ifdef __i386__
-#if DDB > 0
- /*
- * XXX Ugly Compatability.
- * If no gdb port has been specified, set it to be the console
- * as some configuration files don't specify the gdb port.
- */
- if (gdb_arg == NULL && (boothowto & RB_GDB)) {
- printf("Warning: no GDB port specified. Defaulting to sio%d.\n",
- siocnunit);
- printf("Set flag 0x80 on desired GDB port in your\n");
- printf("configuration file (currently sio only).\n");
- siogdbiobase = siocniobase;
- siogdbunit = siocnunit;
- siocnset(&gdbconsdev, siocnunit);
- gdb_arg = &gdbconsdev;
- gdb_getc = siocngetc;
- gdb_putc = siocnputc;
- }
-#endif
-#endif
}
static void
@@ -4226,103 +4178,6 @@ siocnterm(cp)
comconsole = -1;
}
-#endif
-
-#ifdef __alpha__
-
-CONS_DRIVER(sio, NULL, NULL, NULL, siocngetc, siocncheckc, siocnputc, NULL);
-
-int
-siocnattach(port, speed)
- int port;
- int speed;
-{
- int s;
- u_char cfcr;
- u_int divisor;
- struct siocnstate sp;
- int unit = 0; /* XXX random value! */
-
- siocniobase = port;
- siocnunit = unit;
- comdefaultrate = speed;
- sio_consdev.cn_pri = CN_NORMAL;
- siocnset(&sio_consdev, unit);
-
- s = spltty();
-
- /*
- * Initialize the divisor latch. We can't rely on
- * siocnopen() to do this the first time, since it
- * avoids writing to the latch if the latch appears
- * to have the correct value. Also, if we didn't
- * just read the speed from the hardware, then we
- * need to set the speed in hardware so that
- * switching it later is null.
- */
- cfcr = inb(siocniobase + com_cfcr);
- outb(siocniobase + com_cfcr, CFCR_DLAB | cfcr);
- divisor = siodivisor(comdefaultrclk, comdefaultrate);
- outb(siocniobase + com_dlbl, divisor & 0xff);
- outb(siocniobase + com_dlbh, divisor >> 8);
- outb(siocniobase + com_cfcr, cfcr);
-
- siocnopen(&sp, siocniobase, comdefaultrate);
- splx(s);
-
- cnadd(&sio_consdev);
- return (0);
-}
-
-int
-siogdbattach(port, speed)
- int port;
- int speed;
-{
- int s;
- u_char cfcr;
- u_int divisor;
- struct siocnstate sp;
- int unit = 1; /* XXX random value! */
-
- siogdbiobase = port;
- gdbdefaultrate = speed;
-
- printf("sio%d: gdb debugging port\n", unit);
- siogdbunit = unit;
-#if DDB > 0
- siocnset(&gdbconsdev, unit);
- gdb_arg = &gdbconsdev;
- gdb_getc = siocngetc;
- gdb_putc = siocnputc;
-#endif
-
- s = spltty();
-
- /*
- * Initialize the divisor latch. We can't rely on
- * siocnopen() to do this the first time, since it
- * avoids writing to the latch if the latch appears
- * to have the correct value. Also, if we didn't
- * just read the speed from the hardware, then we
- * need to set the speed in hardware so that
- * switching it later is null.
- */
- cfcr = inb(siogdbiobase + com_cfcr);
- outb(siogdbiobase + com_cfcr, CFCR_DLAB | cfcr);
- divisor = siodivisor(comdefaultrclk, gdbdefaultrate);
- outb(siogdbiobase + com_dlbl, divisor & 0xff);
- outb(siogdbiobase + com_dlbh, divisor >> 8);
- outb(siogdbiobase + com_cfcr, cfcr);
-
- siocnopen(&sp, siogdbiobase, gdbdefaultrate);
- splx(s);
-
- return (0);
-}
-
-#endif
-
static int
siocncheckc(struct consdev *cd)
{
@@ -4332,12 +4187,16 @@ siocncheckc(struct consdev *cd)
struct siocnstate sp;
speed_t speed;
- if (cd->cn_unit == siocnunit) {
+ if (cd != NULL && cd->cn_unit == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
+#ifdef GDB
iobase = siogdbiobase;
speed = gdbdefaultrate;
+#else
+ return (-1);
+#endif
}
s = spltty();
siocnopen(&sp, iobase, speed);
@@ -4359,12 +4218,16 @@ siocngetc(struct consdev *cd)
struct siocnstate sp;
speed_t speed;
- if (cd->cn_unit == siocnunit) {
+ if (cd != NULL && cd->cn_unit == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
+#ifdef GDB
iobase = siogdbiobase;
speed = gdbdefaultrate;
+#else
+ return (-1);
+#endif
}
s = spltty();
siocnopen(&sp, iobase, speed);
@@ -4385,12 +4248,16 @@ siocnputc(struct consdev *cd, int c)
Port_t iobase;
speed_t speed;
- if (cd->cn_unit == siocnunit) {
+ if (cd != NULL && cd->cn_unit == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
+#ifdef GDB
iobase = siogdbiobase;
speed = gdbdefaultrate;
+#else
+ return;
+#endif
}
s = spltty();
need_unlock = 0;
@@ -4407,58 +4274,58 @@ siocnputc(struct consdev *cd, int c)
splx(s);
}
-#ifdef __alpha__
-int
-siogdbgetc()
+/*
+ * Remote gdb(1) support.
+ */
+
+#if defined(GDB)
+
+#include <gdb/gdb.h>
+
+static gdb_probe_f siogdbprobe;
+static gdb_init_f siogdbinit;
+static gdb_term_f siogdbterm;
+static gdb_getc_f siogdbgetc;
+static gdb_checkc_f siogdbcheckc;
+static gdb_putc_f siogdbputc;
+
+GDB_DBGPORT(sio, siogdbprobe, siogdbinit, siogdbterm, siogdbcheckc,
+ siogdbgetc, siogdbputc);
+
+static int
+siogdbprobe(void)
{
- int c;
- Port_t iobase;
- speed_t speed;
- int s;
- struct siocnstate sp;
+ return ((siogdbiobase != 0) ? 0 : -1);
+}
- if (siogdbunit == siocnunit) {
- iobase = siocniobase;
- speed = comdefaultrate;
- } else {
- iobase = siogdbiobase;
- speed = gdbdefaultrate;
- }
+static void
+siogdbinit(void)
+{
+}
- s = spltty();
- siocnopen(&sp, iobase, speed);
- while (!(inb(iobase + com_lsr) & LSR_RXRDY))
- ;
- c = inb(iobase + com_data);
- siocnclose(&sp, iobase);
- splx(s);
- return (c);
+static void
+siogdbterm(void)
+{
}
-void
-siogdbputc(c)
- int c;
+static void
+siogdbputc(int c)
{
- Port_t iobase;
- speed_t speed;
- int s;
- struct siocnstate sp;
+ siocnputc(NULL, c);
+}
- if (siogdbunit == siocnunit) {
- iobase = siocniobase;
- speed = comdefaultrate;
- } else {
- iobase = siogdbiobase;
- speed = gdbdefaultrate;
- }
+static int
+siogdbcheckc(void)
+{
+ return (siocncheckc(NULL));
+}
- s = spltty();
- siocnopen(&sp, iobase, speed);
- siocntxwait(siogdbiobase);
- outb(siogdbiobase + com_data, c);
- siocnclose(&sp, siogdbiobase);
- splx(s);
+static int
+siogdbgetc(void)
+{
+ return (siocngetc(NULL));
}
+
#endif
#ifdef PC98
OpenPOWER on IntegriCloud