Make serial line debugging easier to enable and use

This commit is contained in:
rvb 1998-08-13 17:41:10 +00:00
parent 9b25897ec0
commit 67390e1ee2
6 changed files with 76 additions and 14 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC,v 1.174 1998/08/12 18:32:18 mycroft Exp $
# $NetBSD: GENERIC,v 1.175 1998/08/13 17:47:56 rvb Exp $
#
# GENERIC -- everything that's currently supported
#
@ -22,10 +22,14 @@ options USER_LDT # user-settable LDT; used by WINE
# Misc. i386-specific options
options XSERVER # X server support in console drivers
options XSERVER_DDB # PF12 gets you into DDB when X is running
# This option allows you to force a serial console at the specified
# I/O address. see console(4) for details.
#options "CONSDEVNAME=\"com\""
#options "CONSDEVNAME=\"com\"",CONADDR=0x2f8,CONSPEED=57600
# you don't want the option below ON iff you are using the
# serial debugger option of the new boot strap code.
#options CONS_OVERRIDE # Always use above! independent of boot info
# The following options override the memory sizes passed in from the boot
# block. Use them *only* if the boot block is unable to determine the correct

View File

@ -1,4 +1,4 @@
# $NetBSD: files.i386,v 1.117 1998/07/31 04:39:23 thorpej Exp $
# $NetBSD: files.i386,v 1.118 1998/08/13 17:45:20 rvb Exp $
#
# new style config file for i386 architecture
#
@ -24,7 +24,7 @@ defopt USER_LDT
defopt DUMMY_NOPS
# X server support in console drivers
defopt XSERVER
defopt opt_xserver.h XSERVER XSERVER_DDB
file arch/i386/i386/autoconf.c
file arch/i386/i386/conf.c

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.12 1998/02/19 14:18:36 drochner Exp $
# $NetBSD: Makefile,v 1.13 1998/08/13 17:41:10 rvb Exp $
S= ${.CURDIR}/../../../../
@ -12,8 +12,14 @@ SRCS= main.c devopen.c conf.c
CLEANFILES+= ${BSSTART}
CPPFLAGS+= -DCOMPAT_OLDBOOT -DCOMPAT_386BSD_MBRPART
#CPPFLAGS+= -DSUPPORT_SERIAL
#CPPFLAGS+= -DDIRECT_SERIAL -DCOMCONS_KEYPRESS -DCONSPEED=38400
#Sample use of serial line debugger
#CPPFLAGS+= -DSUPPORT_SERIAL=CONSDEV_COM0KBD
# or
#CPPFLAGS+= -DSUPPORT_SERIAL=CONSDEV_AUTO
# and maybe
#CPPFLAGS+= -DDIRECT_SERIAL -DCOMCONS_KEYPRESS -DCONSPEED=57600
#CPPFLAGS+= -DPASS_BIOSGEOM
#uncomment if there are problems with memory detection
#CPPFLAGS+= -DCONSERVATIVE_MEMDETECT

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.13 1998/03/31 05:29:21 mycroft Exp $ */
/* $NetBSD: main.c,v 1.14 1998/08/13 17:41:10 rvb Exp $ */
/*
* Copyright (c) 1996, 1997
@ -223,7 +223,11 @@ main()
int currname;
char c;
#ifdef SUPPORT_SERIAL
initio(SUPPORT_SERIAL);
#else
initio(CONSDEV_PC);
#endif
gateA20();
print_banner();

View File

@ -1,4 +1,4 @@
/* $NetBSD: libi386.h,v 1.6 1997/09/17 18:04:21 drochner Exp $ */
/* $NetBSD: libi386.h,v 1.7 1998/08/13 17:41:11 rvb Exp $ */
/*
* Copyright (c) 1996
@ -64,6 +64,10 @@ void initio __P((int));
#define CONSDEV_COM1 2
#define CONSDEV_COM2 3
#define CONSDEV_COM3 4
#define CONSDEV_COM0KBD 5
#define CONSDEV_COM1KBD 6
#define CONSDEV_COM2KBD 7
#define CONSDEV_COM3KBD 8
#define CONSDEV_AUTO (-1)
int iskey __P((void));
char awaitkey __P((int, int));

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcio.c,v 1.6 1997/10/27 19:53:20 drochner Exp $ */
/* $NetBSD: pcio.c,v 1.7 1998/08/13 17:41:11 rvb Exp $ */
/*
* Copyright (c) 1996, 1997
@ -107,9 +107,11 @@ initio(dev)
* 1. successful output
* 2. optionally, keypress within 1s
*/
if(computc(' ', SERIAL_ARG)
if ( computc(':', SERIAL_ARG) &&
computc('-', SERIAL_ARG) &&
computc('(', SERIAL_ARG)
#ifdef COMCONS_KEYPRESS
&& awaitkey(1, 0)
&& awaitkey(7, 0)
#endif
)
goto ok;
@ -122,10 +124,10 @@ initio(dev)
* (status seems only useful after character output)
* 3. optionally, keypress within 1s
*/
if (!(computc(' ', SERIAL_ARG) & 0x80)
if (!(computc('@', SERIAL_ARG) & 0x80)
&& (comstatus(SERIAL_ARG) & 0x00b0)
#ifdef COMCONS_KEYPRESS
&& awaitkey(1, 0)
&& awaitkey(7, 0)
#endif
)
goto ok;
@ -143,11 +145,53 @@ ok:
if(!btinfo_console.addr) goto nocom;
cominit(SERIAL_ARG);
break;
case CONSDEV_COM0KBD:
case CONSDEV_COM1KBD:
case CONSDEV_COM2KBD:
case CONSDEV_COM3KBD:
iodev = dev - 4;
i = iodev - CONSDEV_COM0;
btinfo_console.addr = getcomaddr(i);
if(!btinfo_console.addr) goto nocom;
conputc('0' + i); /* to tell user what happens */
cominit(SERIAL_ARG);
#ifdef DIRECT_SERIAL
/* check for:
* 1. successful output
* 2. optionally, keypress within 1s
*/
if ( computc(':', SERIAL_ARG) &&
computc('-', SERIAL_ARG) &&
computc('(', SERIAL_ARG)
#ifdef COMCONS_KEYPRESS
&& awaitkey(7, 0)
#endif
)
break;
#else
/*
* serial console must have hardware handshake!
* check:
* 1. character output without error
* 2. status bits for modem ready set
* (status seems only useful after character output)
* 3. optionally, keypress within 1s
*/
if (!(computc('@', SERIAL_ARG) & 0x80)
&& (comstatus(SERIAL_ARG) & 0x00b0)
#ifdef COMCONS_KEYPRESS
&& awaitkey(7, 0)
#endif
)
break;
#endif
default:
nocom:
iodev = CONSDEV_PC;
break;
}
conputc('\015');
conputc('\n');
strncpy(btinfo_console.devname, iodev == CONSDEV_PC ? "pc" : "com", 16);
#if defined(DIRECT_SERIAL) && defined(CONSPEED)
btinfo_console.speed = CONSPEED;