Make the speed used by gdb over serial settable in the kernel configuration.

This facilitates the use in circumstances where you are using a serial
console as well. GDB doesn't support anything higher than 9600 baud (19k2
if you are lucky), but the console does.
This commit is contained in:
n_hibma 2002-06-18 21:30:37 +00:00
parent 881107f895
commit 90312e83bd
8 changed files with 108 additions and 55 deletions

View File

@ -69,10 +69,12 @@ COMPAT_43 opt_compat.h
COMPAT_SUNOS opt_compat.h
COMPILING_LINT opt_global.h
CY_PCI_FASTINTR
CONSPEED opt_comconsole.h
DDB
DDB_NOKLDSYM opt_ddb.h
DDB_UNATTENDED opt_ddb.h
GDB_REMOTE_CHAT opt_ddb.h
GDBSPEED opt_ddb.h
NODEVFS opt_devfs.h
HW_WDOG
KTRACE

View File

@ -14,7 +14,6 @@ PERFMON opt_perfmon.h
POWERFAIL_NMI opt_trap.h
AUTO_EOI_1 opt_auto_eoi.h
AUTO_EOI_2 opt_auto_eoi.h
CONSPEED opt_comconsole.h
I586_PMC_GUPROF opt_i586_guprof.h
WLCACHE opt_wavelan.h
WLDEBUG opt_wavelan.h

View File

@ -15,8 +15,6 @@ PPC_DEBUG opt_ppc.h
SHOW_BUSYBUFS
PANIC_REBOOT_WAIT_TIME opt_panic.h
CONSPEED opt_comconsole.h
MAXCONS opt_syscons.h
SC_ALT_MOUSE_IMAGE opt_syscons.h
SC_DEBUG_LEVEL opt_syscons.h

View File

@ -14,7 +14,6 @@ PERFMON opt_perfmon.h
POWERFAIL_NMI opt_trap.h
AUTO_EOI_1 opt_auto_eoi.h
AUTO_EOI_2 opt_auto_eoi.h
CONSPEED opt_comconsole.h
I586_PMC_GUPROF opt_i586_guprof.h
WLCACHE opt_wavelan.h
WLDEBUG opt_wavelan.h

View File

@ -332,14 +332,12 @@ int comconsole = -1;
static volatile speed_t comdefaultrate = CONSPEED;
static u_long comdefaultrclk = DEFAULT_RCLK;
SYSCTL_ULONG(_machdep, OID_AUTO, conrclk, CTLFLAG_RW, &comdefaultrclk, 0, "");
#ifdef __alpha__
static volatile speed_t gdbdefaultrate = CONSPEED;
#endif
static speed_t gdbdefaultrate = GDBSPEED;
SYSCTL_UINT(_machdep, OID_AUTO, gdbspeed, CTLFLAG_RW,
&gdbdefaultrate, GDBSPEED, "");
static u_int com_events; /* input chars + weighted output completions */
static Port_t siocniobase;
#ifndef __alpha__
static int siocnunit;
#endif
static int siocnunit = -1;
static Port_t siogdbiobase;
static int siogdbunit = -1;
static void *sio_slow_ih;
@ -3126,13 +3124,17 @@ siocncheckc(dev)
Port_t iobase;
int s;
struct siocnstate sp;
speed_t speed;
if (minor(dev) == siogdbunit)
iobase = siogdbiobase;
else
if (minor(dev) == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
iobase = siogdbiobase;
speed = gdbdefaultrate;
}
s = spltty();
siocnopen(&sp, iobase, comdefaultrate);
siocnopen(&sp, iobase, speed);
if (inb(iobase + com_lsr) & LSR_RXRDY)
c = inb(iobase + com_data);
else
@ -3151,13 +3153,17 @@ siocngetc(dev)
Port_t iobase;
int s;
struct siocnstate sp;
speed_t speed;
if (minor(dev) == siogdbunit)
iobase = siogdbiobase;
else
if (minor(dev) == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
iobase = siogdbiobase;
speed = gdbdefaultrate;
}
s = spltty();
siocnopen(&sp, iobase, comdefaultrate);
siocnopen(&sp, iobase, speed);
while (!(inb(iobase + com_lsr) & LSR_RXRDY))
;
c = inb(iobase + com_data);
@ -3175,18 +3181,22 @@ siocnputc(dev, c)
int s;
struct siocnstate sp;
Port_t iobase;
speed_t speed;
if (minor(dev) == siogdbunit)
iobase = siogdbiobase;
else
if (minor(dev) == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
iobase = siogdbiobase;
speed = gdbdefaultrate;
}
s = spltty();
need_unlock = 0;
if (sio_inited == 2 && !mtx_owned(&sio_lock)) {
mtx_lock_spin(&sio_lock);
need_unlock = 1;
}
siocnopen(&sp, iobase, comdefaultrate);
siocnopen(&sp, iobase, speed);
siocntxwait(iobase);
outb(iobase + com_data, c);
siocnclose(&sp, iobase);
@ -3201,12 +3211,20 @@ siogdbgetc()
{
int c;
Port_t iobase;
speed_t speed;
int s;
struct siocnstate sp;
iobase = siogdbiobase;
if (minor(dev) == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
iobase = siogdbiobase;
speed = gdbdefaultrate;
}
s = spltty();
siocnopen(&sp, iobase, gdbdefaultrate);
siocnopen(&sp, iobase, speed);
while (!(inb(iobase + com_lsr) & LSR_RXRDY))
;
c = inb(iobase + com_data);
@ -3219,11 +3237,21 @@ void
siogdbputc(c)
int c;
{
Port_t iobase;
speed_t speed;
int s;
struct siocnstate sp;
if (minor(dev) == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
iobase = siogdbiobase;
speed = gdbdefaultrate;
}
s = spltty();
siocnopen(&sp, siogdbiobase, gdbdefaultrate);
siocnopen(&sp, iobase, speed);
siocntxwait(siogdbiobase);
outb(siogdbiobase + com_data, c);
siocnclose(&sp, siogdbiobase);

View File

@ -123,4 +123,9 @@
#define CONSPEED 9600
#endif
/* default serial gdb speed if not set with sysctl or probed from boot */
#ifndef GDBSPEED
#define GDBSPEED CONSPEED
#endif
#define IO_COMSIZE 8 /* 8250, 16x50 com controllers */

View File

@ -430,9 +430,9 @@ int comconsole = -1;
static volatile speed_t comdefaultrate = CONSPEED;
static u_long comdefaultrclk = DEFAULT_RCLK;
SYSCTL_ULONG(_machdep, OID_AUTO, conrclk, CTLFLAG_RW, &comdefaultrclk, 0, "");
#ifdef __alpha__
static volatile speed_t gdbdefaultrate = CONSPEED;
#endif
static speed_t gdbdefaultrate = GDBSPEED;
SYSCTL_UINT(_machdep, OID_AUTO, gdbspeed, CTLFLAG_RW,
&gdbdefaultrate, GDBSPEED, "");
static u_int com_events; /* input chars + weighted output completions */
static Port_t siocniobase;
#ifndef __alpha__
@ -4359,13 +4359,17 @@ siocncheckc(dev)
Port_t iobase;
int s;
struct siocnstate sp;
speed_t speed;
if (minor(dev) == siogdbunit)
iobase = siogdbiobase;
else
if (minor(dev) == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
iobase = siogdbiobase;
speed = gdbdefaultrate;
}
s = spltty();
siocnopen(&sp, iobase, comdefaultrate);
siocnopen(&sp, iobase, speed);
if (inb(iobase + com_lsr) & LSR_RXRDY)
c = inb(iobase + com_data);
else
@ -4384,13 +4388,17 @@ siocngetc(dev)
Port_t iobase;
int s;
struct siocnstate sp;
speed_t speed;
if (minor(dev) == siogdbunit)
iobase = siogdbiobase;
else
if (minor(dev) == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
iobase = siogdbiobase;
speed = gdbdefaultrate;
}
s = spltty();
siocnopen(&sp, iobase, comdefaultrate);
siocnopen(&sp, iobase, speed);
while (!(inb(iobase + com_lsr) & LSR_RXRDY))
;
c = inb(iobase + com_data);
@ -4409,17 +4417,20 @@ siocnputc(dev, c)
struct siocnstate sp;
Port_t iobase;
if (minor(dev) == siogdbunit)
iobase = siogdbiobase;
else
if (minor(dev) == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
iobase = siogdbiobase;
speed = gdbdefaultrate;
}
s = spltty();
need_unlock = 0;
if (sio_inited == 2 && !mtx_owned(&sio_lock)) {
mtx_lock_spin(&sio_lock);
need_unlock = 1;
}
siocnopen(&sp, iobase, comdefaultrate);
siocnopen(&sp, iobase, speed);
siocntxwait(iobase);
outb(iobase + com_data, c);
siocnclose(&sp, iobase);

View File

@ -430,9 +430,9 @@ int comconsole = -1;
static volatile speed_t comdefaultrate = CONSPEED;
static u_long comdefaultrclk = DEFAULT_RCLK;
SYSCTL_ULONG(_machdep, OID_AUTO, conrclk, CTLFLAG_RW, &comdefaultrclk, 0, "");
#ifdef __alpha__
static volatile speed_t gdbdefaultrate = CONSPEED;
#endif
static speed_t gdbdefaultrate = GDBSPEED;
SYSCTL_UINT(_machdep, OID_AUTO, gdbspeed, CTLFLAG_RW,
&gdbdefaultrate, GDBSPEED, "");
static u_int com_events; /* input chars + weighted output completions */
static Port_t siocniobase;
#ifndef __alpha__
@ -4359,13 +4359,17 @@ siocncheckc(dev)
Port_t iobase;
int s;
struct siocnstate sp;
speed_t speed;
if (minor(dev) == siogdbunit)
iobase = siogdbiobase;
else
if (minor(dev) == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
iobase = siogdbiobase;
speed = gdbdefaultrate;
}
s = spltty();
siocnopen(&sp, iobase, comdefaultrate);
siocnopen(&sp, iobase, speed);
if (inb(iobase + com_lsr) & LSR_RXRDY)
c = inb(iobase + com_data);
else
@ -4384,13 +4388,17 @@ siocngetc(dev)
Port_t iobase;
int s;
struct siocnstate sp;
speed_t speed;
if (minor(dev) == siogdbunit)
iobase = siogdbiobase;
else
if (minor(dev) == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
iobase = siogdbiobase;
speed = gdbdefaultrate;
}
s = spltty();
siocnopen(&sp, iobase, comdefaultrate);
siocnopen(&sp, iobase, speed);
while (!(inb(iobase + com_lsr) & LSR_RXRDY))
;
c = inb(iobase + com_data);
@ -4409,17 +4417,20 @@ siocnputc(dev, c)
struct siocnstate sp;
Port_t iobase;
if (minor(dev) == siogdbunit)
iobase = siogdbiobase;
else
if (minor(dev) == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
iobase = siogdbiobase;
speed = gdbdefaultrate;
}
s = spltty();
need_unlock = 0;
if (sio_inited == 2 && !mtx_owned(&sio_lock)) {
mtx_lock_spin(&sio_lock);
need_unlock = 1;
}
siocnopen(&sp, iobase, comdefaultrate);
siocnopen(&sp, iobase, speed);
siocntxwait(iobase);
outb(iobase + com_data, c);
siocnclose(&sp, iobase);