From 2b237b40581f53f84d9cd974e9b2356a3cddf9d7 Mon Sep 17 00:00:00 2001 From: Bill Paul Date: Fri, 20 Jan 1995 07:34:18 +0000 Subject: Submitted by: Bill Paul (wpaul@ctr.columbia.edu) Obtained from: sio.c and sioreg.c changed to allow autodetecting the RB_SERIAL flag passed by the boot blocks so that the kernel can switch to 'serial console' mode automagically. 'options COMCONSOLE' can still be specified to force the kernel to always use the serial port as a console. CONUNIT and CONADDR can also be specified in the kernel config file if the user wants to shift the console to a different port. --- sys/dev/sio/sio.c | 28 +++++++++++++++++----------- sys/dev/sio/sioreg.h | 11 +++++++++-- 2 files changed, 26 insertions(+), 13 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 853c773713112..60fd3574524f5 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.63 1995/01/05 00:00:37 ache Exp $ + * $Id: sio.c,v 1.64 1995/01/06 15:03:41 bde Exp $ */ #include "sio.h" @@ -44,6 +44,7 @@ */ #include #include +#include #include #define TTYDEFCHARS /* XXX TK2.0 */ #include @@ -298,10 +299,12 @@ struct isa_driver siodriver = { }; #ifdef COMCONSOLE -static int comconsole = COMCONSOLE; +#define COMCONSOLE 1 #else -static int comconsole = -1; +#define COMCONSOLE 0 #endif + +static int comconsole = CONUNIT; static speed_t comdefaultrate = TTYDEF_SPEED; static u_int com_events; /* input chars + weighted output completions */ static int commajor; @@ -609,7 +612,7 @@ sioattach(isdp) com->it_in.c_oflag = 0; com->it_in.c_cflag = TTYDEF_CFLAG; com->it_in.c_lflag = 0; - if (unit == comconsole) { + if (unit == comconsole && ((boothowto & RB_SERIAL) || COMCONSOLE)) { com->it_in.c_iflag = TTYDEF_IFLAG; com->it_in.c_oflag = TTYDEF_OFLAG; com->it_in.c_cflag = TTYDEF_CFLAG | CLOCAL; @@ -692,7 +695,8 @@ determined_type: ; #ifdef KGDB if (kgdb_dev == makedev(commajor, unit)) { - if (unit == comconsole) + if (unit == comconsole && ((boothowto & RB_SERIAL) + || COMCONSOLE)) kgdb_dev = -1; /* can't debug over console port */ else { int divisor; @@ -1003,7 +1007,8 @@ siowrite(dev, uio, flag) * is not the console. In that situation we don't need/want the X * server taking over the console. */ - if (constty && unit == comconsole) + if (constty && unit == comconsole && ((boothowto & RB_SERIAL) + || COMCONSOLE)) constty = NULL; return ((*linesw[tp->t_line].l_write)(tp, uio, flag)); } @@ -2039,11 +2044,12 @@ siocnprobe(cp) /* initialize required fields */ cp->cn_dev = makedev(commajor, unit); -#ifdef COMCONSOLE - cp->cn_pri = CN_REMOTE; /* Force a serial port console */ -#else - cp->cn_pri = CN_NORMAL; -#endif + + if (boothowto & RB_SERIAL || COMCONSOLE) + cp->cn_pri = CN_REMOTE; /* Force a serial port console */ + else + cp->cn_pri = CN_NORMAL; + } void diff --git a/sys/dev/sio/sioreg.h b/sys/dev/sio/sioreg.h index 4b0f1b6fa5de7..d43bcdf02ee94 100644 --- a/sys/dev/sio/sioreg.h +++ b/sys/dev/sio/sioreg.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)comreg.h 7.2 (Berkeley) 5/9/91 - * $Id$ + * $Id: sioreg.h,v 1.2 1993/10/16 19:17:18 rgrimes Exp $ */ @@ -109,6 +109,13 @@ /* * WARNING: Serial console is assumed to be at COM1 address * and CONUNIT must be 0. + * + * Well, maybe not... */ -#define CONADDR (0x3f8) +#ifndef CONADDR +#define CONADDR (0x3F8) +#endif + +#ifndef CONUNIT #define CONUNIT (0) +#endif -- cgit v1.3