Change console code to use cninit() and null console. Add serial console
check.
This commit is contained in:
parent
2b3e81f067
commit
d65b10404c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: console.c,v 1.5 2003/09/12 14:59:11 tsutsui Exp $ */
|
||||
/* $NetBSD: console.c,v 1.6 2003/10/17 18:20:10 cdi Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 Soren S. Jorvang. All rights reserved.
|
||||
|
@ -26,7 +26,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: console.c,v 1.5 2003/09/12 14:59:11 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: console.c,v 1.6 2003/10/17 18:20:10 cdi Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/user.h>
|
||||
|
@ -40,21 +40,62 @@ __KERNEL_RCSID(0, "$NetBSD: console.c,v 1.5 2003/09/12 14:59:11 tsutsui Exp $");
|
|||
#include <sys/termios.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/nvram.h>
|
||||
|
||||
#include <dev/cons.h>
|
||||
|
||||
#include <dev/ic/comreg.h>
|
||||
#include <dev/ic/comvar.h>
|
||||
|
||||
#include "com.h"
|
||||
#include "nullcons.h"
|
||||
|
||||
dev_type_cnprobe(comcnprobe);
|
||||
dev_type_cninit(comcninit);
|
||||
|
||||
int console_present = 0; /* Do we have a console? */
|
||||
|
||||
struct consdev constab[] = {
|
||||
#if NCOM > 0
|
||||
{ comcnprobe, comcninit, },
|
||||
#endif
|
||||
#if NNULLCONS > 0
|
||||
{ nullcnprobe, nullcninit },
|
||||
#endif
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
#if NCOM > 0
|
||||
#define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */
|
||||
|
||||
void
|
||||
comcnprobe(cn)
|
||||
struct consdev *cn;
|
||||
{
|
||||
|
||||
/*
|
||||
* Linux code has a comment that serial console must be probed
|
||||
* early, otherwise the value which allows to detect serial port
|
||||
* could be overwritten. Okay, probe here and record the result
|
||||
* for the future use.
|
||||
*/
|
||||
console_present = *(volatile u_int32_t *)MIPS_PHYS_TO_KSEG1(0x0020001c);
|
||||
cn->cn_pri = (console_present != 0) ? CN_NORMAL : CN_DEAD;
|
||||
}
|
||||
|
||||
void
|
||||
comcninit(cn)
|
||||
struct consdev *cn;
|
||||
{
|
||||
|
||||
comcnattach(0, 0x1c800000, 115200, COM_FREQ * 10, COM_TYPE_NORMAL,
|
||||
CONMODE);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
consinit()
|
||||
{
|
||||
/* XXX Check NVRAM to see if we should enable the console at all. */
|
||||
|
||||
comcnattach(0, 0x1c800000, 115200, COM_FREQ * 10, COM_TYPE_NORMAL,
|
||||
CONMODE);
|
||||
|
||||
return;
|
||||
cninit();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: GENERIC,v 1.48 2003/10/14 16:16:04 tsutsui Exp $
|
||||
# $NetBSD: GENERIC,v 1.49 2003/10/17 18:20:10 cdi Exp $
|
||||
#
|
||||
# GENERIC machine description file
|
||||
#
|
||||
|
@ -22,7 +22,7 @@ include "arch/cobalt/conf/std.cobalt"
|
|||
|
||||
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "GENERIC-$Revision: 1.48 $"
|
||||
#ident "GENERIC-$Revision: 1.49 $"
|
||||
|
||||
maxusers 32
|
||||
|
||||
|
@ -312,6 +312,7 @@ pseudo-device pty # pseudo-terminals
|
|||
pseudo-device rnd # /dev/random & kernel generator
|
||||
#options RND_COM # use "com" randomness (BROKEN)
|
||||
pseudo-device clockctl # user control of clock subsystem
|
||||
pseudo-device nullcons # no-op console
|
||||
|
||||
# A pseudo device needed for Coda # also needs CODA (above)
|
||||
#pseudo-device vcoda 4 # coda minicache <-> venus comm.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: files.cobalt,v 1.18 2003/10/08 17:29:59 bouyer Exp $
|
||||
# $NetBSD: files.cobalt,v 1.19 2003/10/17 18:20:10 cdi Exp $
|
||||
|
||||
maxpartitions 16
|
||||
|
||||
|
@ -35,6 +35,7 @@ file arch/mips/mips/softintr.c
|
|||
file dev/md_root.c memory_disk_hooks
|
||||
|
||||
file dev/cons.c
|
||||
file dev/cninit.c
|
||||
|
||||
include "dev/i2o/files.i2o"
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: com_mainbus.c,v 1.7 2003/09/12 17:55:50 tsutsui Exp $ */
|
||||
/* $NetBSD: com_mainbus.c,v 1.8 2003/10/17 18:20:10 cdi Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 Soren S. Jorvang. All rights reserved.
|
||||
|
@ -26,7 +26,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: com_mainbus.c,v 1.7 2003/09/12 17:55:50 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: com_mainbus.c,v 1.8 2003/10/17 18:20:10 cdi Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -46,11 +46,14 @@ __KERNEL_RCSID(0, "$NetBSD: com_mainbus.c,v 1.7 2003/09/12 17:55:50 tsutsui Exp
|
|||
#include <machine/autoconf.h>
|
||||
#include <machine/intr.h>
|
||||
#include <machine/bus.h>
|
||||
#include <machine/nvram.h>
|
||||
|
||||
#include <dev/ic/comreg.h>
|
||||
#include <dev/ic/comvar.h>
|
||||
|
||||
|
||||
extern int console_present;
|
||||
|
||||
struct com_mainbus_softc {
|
||||
struct com_softc sc_com;
|
||||
void *sc_ih;
|
||||
|
@ -68,9 +71,8 @@ com_mainbus_probe(parent, match, aux)
|
|||
struct cfdata *match;
|
||||
void *aux;
|
||||
{
|
||||
/* XXX probe */
|
||||
|
||||
return 1;
|
||||
return (console_present != 0);
|
||||
}
|
||||
|
||||
struct com_softc *com0; /* XXX */
|
||||
|
|
Loading…
Reference in New Issue