From owner-freebsd-current@FreeBSD.ORG Sun Jan 4 22:38:11 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 493EF16A4CE for ; Sun, 4 Jan 2004 22:38:11 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 152A543D1D for ; Sun, 4 Jan 2004 22:38:09 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3p2/8.8.7) with ESMTP id RAA18673; Mon, 5 Jan 2004 17:37:53 +1100 Date: Mon, 5 Jan 2004 17:37:52 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Nate Lawson In-Reply-To: <20040104150929.Y19715@root.org> Message-ID: <20040105170917.S3928@gamplex.bde.org> References: <20040103184934.V16815@root.org> <20040103.201530.04738741.imp@bsdimp.com> <20040104150929.Y19715@root.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: current@freebsd.org Subject: Re: Serial console only works after reboot? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jan 2004 06:38:11 -0000 On Sun, 4 Jan 2004, Nate Lawson wrote: > On Sun, 4 Jan 2004, M. Warner Losh wrote: > > In message: <20040103233044.N17367@root.org> > > Nate Lawson writes: > > : On Sat, 3 Jan 2004, M. Warner Losh wrote: > > : > In message: <20040103184934.V16815@root.org> > > : > Nate Lawson writes: > > : > : I have a laptop (IBM T23) and use sio0 as my console/gdb port. One thing > > : > : I noticed is if I power up the laptop and boot -h, I get garbage out the > > : > : serial port. However, if I boot fully and then just warm reboot, the > > : > : serial console works fine. I'm only using 9600 bps. Ideas? > > : > > > : > weird. Is the garbage data at some different rate? > > : > > : Nope, checked everything from 1200 up to 38400, different garbage but > > : always garbage. This is with -current as of 2003/12/30, no patches. > > > > Try 115200. > > That works. Is this with just changing the external tty to 115200 and no config changes? > Now the question is "why". Note that I have no "options > CONSPEED" so according to /sys/dev/sio/sioreg.h, it should default to 9600 > and indeed does, after a reboot. But not on a cold startup. As mentioned in other replies, CONSPEED is irrelevant for serial consoles in many cases. The speed is normally determined by BOOT_COMCONSOLE_SPEED (or its default of 9600). Exceptions: - the kernel console may be a serial one even if the boot blocks don't use or set a serial console. This happens when there is no other preferred console, or if you switch to a serial console using "sysctl kern.console=...". Then CONSPEED (or its default of 9600) is used initially. - the initial setting of the console speed may be changed using "sysctl machdep.conspeed". - if the "serial console" is actually just a gdb port, then it won't be affected by BOOT_COMCONSOLE_SPEED. Then GDBSPEED (or its default of CONSPEED) is used initially. - the initial setting of the gdb speed may be changed using "sysctl machdep.gdbspeed". This sysctl is sloppier than the one for consoles -- it is just a SYSCTL_INT() and doesn't adjust any associated state (mainly speeds for other uses of the port). - if the serial console is also the gdb port, then the gdb speed is used for gdb and the console speed is used for console i/o. There is also a speed for the high-level tty. Speed setting is mostly dynamic (the speed normally set for the high-level tty and switched on every character for console and gdb i/o), so garbled output may result even for the speed that matches the external device if the 3 speed settings are not all the same. Console i/o usually works in this case though. Add some printfs to see which of the speed settings are different, and fix whatever sets an inconsistent one. Bruce