From a790ff195ce6ffba2fa1b199f6c466ffb23aa49b Mon Sep 17 00:00:00 2001 From: christos Date: Wed, 21 Dec 2005 18:55:33 +0000 Subject: [PATCH] PR/32086: Garrett D'Amore: Use the YAMON environment for console speed selection, rather than a hard-coded speed. --- sys/arch/evbmips/alchemy/machdep.c | 28 ++++++++++++++++++++++------ sys/arch/evbmips/conf/PB1000 | 6 +++--- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/sys/arch/evbmips/alchemy/machdep.c b/sys/arch/evbmips/alchemy/machdep.c index 0d16edee72e7..34dc9337698c 100644 --- a/sys/arch/evbmips/alchemy/machdep.c +++ b/sys/arch/evbmips/alchemy/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.19 2005/12/11 12:17:11 christos Exp $ */ +/* $NetBSD: machdep.c,v 1.20 2005/12/21 18:55:33 christos Exp $ */ /* * Copyright (c) 1992, 1993 @@ -77,7 +77,7 @@ */ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.19 2005/12/11 12:17:11 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.20 2005/12/21 18:55:33 christos Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -124,10 +124,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.19 2005/12/11 12:17:11 christos Exp $" #if NAUCOM > 0 #include -#ifndef CONSPEED -#define CONSPEED TTYDEF_SPEED -#endif -int aucomcnrate = CONSPEED; +int aucomcnrate = 0; #endif /* NAUCOM > 0 */ #include "ohci.h" @@ -222,6 +219,25 @@ mach_init(int argc, char **argv, yamon_env_var *envp, u_long memsize) * Bring up the console. */ #if NAUCOM > 0 +#ifdef CONSPEED + if (aucomcnrate == 0) + aucomcnrate = CONSPEED; +#else /* !CONSPEED */ + /* + * Learn default console speed. We use the YAMON environment, + * though we could probably also figure it out by checking the + * aucom registers directly. + */ + if ((aucomcnrate == 0) && ((cp = yamon_getenv("modetty0")) != NULL)) + aucomcnrate = strtoul(cp, NULL, 0); + + if (aucomcnrate == 0) { + panic("pb1000: The `modetty0' YAMON variable not set. " + "Either set it to the speed of the console and try again, " + or build a kernel with the `CONSPEED' option."); + } +#endif /* CONSPEED */ + /* * Delay to allow firmware putchars to complete. * FIFO depth * character time. diff --git a/sys/arch/evbmips/conf/PB1000 b/sys/arch/evbmips/conf/PB1000 index ae75452d1eb6..59948144104a 100644 --- a/sys/arch/evbmips/conf/PB1000 +++ b/sys/arch/evbmips/conf/PB1000 @@ -1,18 +1,18 @@ -# $NetBSD: PB1000,v 1.28 2005/12/20 21:06:42 tron Exp $ +# $NetBSD: PB1000,v 1.29 2005/12/21 18:55:33 christos Exp $ # # Kernel config for the Alchemy Semiconductor (AMD) PB1000, PB1500, # DBAu1000 and DBAu1500 evaluation boards. include "arch/evbmips/conf/std.pb1000" -#ident "PB1000-$Revision: 1.28 $" +#ident "PB1000-$Revision: 1.29 $" maxusers 32 options MIPS32 options NOFPU # No FPU options SOFTFLOAT # emulate FPU insn -options CONSPEED=115200 # YAMON default +#options CONSPEED=115200 # YAMON default options HZ=512 # for profiling #options LOCKDEBUG