Received: by oss.sgi.com id ; Sun, 16 Jan 2000 19:49:54 -0800 Received: from pneumatic-tube.sgi.com ([204.94.214.22]:41515 "EHLO pneumatic-tube.sgi.com") by oss.sgi.com with ESMTP id ; Sun, 16 Jan 2000 19:49:34 -0800 Received: from cthulhu.engr.sgi.com (gate3-relay.engr.sgi.com [130.62.1.234]) by pneumatic-tube.sgi.com (980327.SGI.8.8.8-aspam/980310.SGI-aspam) via ESMTP id TAA06744; Sun, 16 Jan 2000 19:53:37 -0800 (PST) mail_from (owner-linux@cthulhu.engr.sgi.com) Received: (from majordomo-owner@localhost) by cthulhu.engr.sgi.com (980427.SGI.8.8.8/970903.SGI.AUTOCF) id TAA37479 for linux-list; Sun, 16 Jan 2000 19:39:56 -0800 (PST) mail_from (owner-linux@relay.engr.sgi.com) Received: from sgi.com (sgi.engr.sgi.com [192.26.80.37]) by cthulhu.engr.sgi.com (980427.SGI.8.8.8/970903.SGI.AUTOCF) via ESMTP id TAA78118 for ; Sun, 16 Jan 2000 19:39:51 -0800 (PST) mail_from (jharrell@ti.com) Received: from jester.ti.com (jester.ti.com [192.94.94.1]) by sgi.com (980327.SGI.8.8.8-aspam/980304.SGI-aspam: SGI does not authorize the use of its proprietary systems or networks for unsolicited or bulk email from the Internet.) via ESMTP id TAA05447 for ; Sun, 16 Jan 2000 19:39:50 -0800 (PST) mail_from (jharrell@ti.com) Received: from dlep8.itg.ti.com ([157.170.134.88]) by jester.ti.com (8.9.3/8.9.3) with ESMTP id VAA28914; Sun, 16 Jan 2000 21:38:58 -0600 (CST) Received: from dlep8.itg.ti.com (localhost [127.0.0.1]) by dlep8.itg.ti.com (8.9.3/8.9.3) with ESMTP id VAA19931; Sun, 16 Jan 2000 21:39:12 -0600 (CST) Received: from dlep4.itg.ti.com (dlep4.itg.ti.com [157.170.188.63]) by dlep8.itg.ti.com (8.9.3/8.9.3) with ESMTP id VAA19925; Sun, 16 Jan 2000 21:39:12 -0600 (CST) Received: from ti.com (IDENT:jharrell@pcp97780pcs.sc.ti.com [158.218.100.100]) by dlep4.itg.ti.com (8.9.3/8.9.3) with ESMTP id VAA10635; Sun, 16 Jan 2000 21:39:34 -0600 (CST) Message-ID: <38828F72.F0FA585@ti.com> Date: Sun, 16 Jan 2000 20:41:38 -0700 From: Jeff Harrell X-Mailer: Mozilla 4.61 [en] (X11; U; Linux 2.2.12-20 i686) X-Accept-Language: en MIME-Version: 1.0 To: Conrad Parker CC: linux@cthulhu.engr.sgi.com Subject: Re: question concerning serial console setup References: <386A5F9B.50B4AFEF@ti.com> <19991230114736.C18261@cse.unsw.edu.au> Content-Type: multipart/alternative; boundary="------------BF0E0AD9983241233F42A942" Sender: owner-linuxmips@oss.sgi.com Precedence: bulk Return-Path: X-Orcpt: rfc822;linuxmips-outgoing --------------BF0E0AD9983241233F42A942 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Conrad Parker wrote: > On Wed, Dec 29, 1999 at 12:23:07PM -0700, Jeff Harrell wrote: > > I wonder if anybody might have some information concerning the setup of > > a serial console device > > on the MIPS/Linux platform. I have been looking at the sgi (indy) > > source code to determine how to > > setup a serial console device. The file arch/mips/sgi/kernel/setup.c > > contains a call to "console_setup" > > passing the parameters "ttys0" and NULL. I have had some trouble > > locating the routine that this is > > actually calling (file, directory?). It looks like there is a version > > in printk.c and in one of the char drivers (serial167.c). > > These do not seem like the correct routines. > > the version in serial167.c is commented out and looks like it was once > there only as a placeholder. > > console_setup() in printk.c is the correct one, but it doesn't do everything > you want. It simply determines which of the possible consoles is the system > ("preferred") console. Normally this is called via parse_options in > init/main.c so you can set it on booting by passing the kernel parameter > console=blah, but it can be called any time before the kernel calls > console_init() (which it does immediately after calling parse_options, in > order to get the console up asap). If you've configured the kernel to run a > serial console, console_init() (which is in drivers/char/tty_io.c) will call > serial_console_init(). > Hmmm....strange I tried to use console_setup in the same way that setup.c called it in ../arch/mips/sgi/kernel/setup.c and ran into linker problems. It looks like setup_console is defined statically (sp?) in printk.c. Here is how it is called in setup.c: #if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_PROM_CONSOLE) extern void console_setup(char *, int *); #endif ... .... #ifdef CONFIG_SERIAL_CONSOLE /* ARCS console environment variable is set to "g?" for * graphics console, it is set to "d" for the first serial * line and "d2" for the second serial line. */ ctype = prom_getenv("console"); if(*ctype == 'd') { if(*(ctype+1)=='2') console_setup ("ttyS1", NULL); else console_setup ("ttyS0", NULL); } Here is how it looks in printk.c: static int __init console_setup(char *str) { ..... I guess I am seeing the error that I would expect to see, i.e., the linker gives me an undefined reference. Any ideas how this worked in the sgi code? > > For the SGI/MIPS, (the code you're looking at in > arch/mips/sgi/kernel/setup.c) the choice of serial console can be > determined by querying the prom settings, so rather than forcing this to be > a boot parameter the correct console is set up at runtime. (If I'm not > mistaken, this can still be overriden by passing a kernel parameter, as > this bit of setup is called way before init/main.c calls parse_options()). > However, you don't need to call console_setup() in your platform setup > routine -- it's only done here for convenience. Unfortunately I am working on an embedded platform, only using this code as a starting point for our design. If possible I would like to initialize the console w/o the use of command line parameters. Any insight that you can provide would be greatly appreciated. Thanks, Jeff -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Jeff Harrell Work: (801) 619-6104 Broadband Access group/TI jharrell@ti.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --------------BF0E0AD9983241233F42A942 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Conrad Parker wrote:
On Wed, Dec 29, 1999 at 12:23:07PM -0700, Jeff Harrell wrote:
> I wonder if anybody might have some information concerning the setup of
> a serial console device
> on the MIPS/Linux platform.  I have been looking at the sgi (indy)
> source code to determine how to
> setup a serial console device.  The file arch/mips/sgi/kernel/setup.c
> contains a call to "console_setup"
> passing the parameters "ttys0" and NULL.  I have had some trouble
> locating the routine that this is
> actually calling (file, directory?).  It looks like there is a version
> in printk.c and in one of  the char drivers (serial167.c).
> These do not seem like the correct routines.

the version in serial167.c is commented out and looks like it was once
there only as a placeholder.

console_setup() in printk.c is the correct one, but it doesn't do everything
you want. It simply determines which of the possible consoles is the system
("preferred") console. Normally this is called via parse_options in
init/main.c so you can set it on booting by passing the kernel parameter
console=blah, but it can be called any time before the kernel calls
console_init() (which it does immediately after calling parse_options, in
order to get the console up asap). If you've configured the kernel to run a
serial console, console_init() (which is in drivers/char/tty_io.c) will call
serial_console_init().
 

Hmmm....strange I tried to use console_setup  in the same way that  setup.c called
it in ../arch/mips/sgi/kernel/setup.c and ran into linker problems.  It looks like
setup_console is defined statically (sp?) in printk.c.

Here is how it is called in setup.c:

#if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_PROM_CONSOLE)
extern void console_setup(char *, int *);
#endif
...
....
#ifdef CONFIG_SERIAL_CONSOLE
 /* ARCS console environment variable is set to "g?" for
  * graphics console, it is set to "d" for the first serial
  * line and "d2" for the second serial line.
  */
 ctype = prom_getenv("console");
 if(*ctype == 'd') {
  if(*(ctype+1)=='2')
   console_setup ("ttyS1", NULL);
  else
   console_setup ("ttyS0", NULL);
 }


Here is how it looks in printk.c:

static int __init console_setup(char *str)
{ .....
I guess I am seeing the error that I would expect to see,  i.e.,  the linker gives me an
undefined reference.  Any ideas how this worked in the sgi code?
 
For the SGI/MIPS, (the code you're looking at in
arch/mips/sgi/kernel/setup.c) the choice of serial console can be
determined by querying the prom settings, so rather than forcing this to be
a boot parameter the correct console is set up at runtime. (If I'm not
mistaken, this can still be overriden by passing a kernel parameter, as
this bit of setup is called way before init/main.c calls parse_options()).
However, you don't need to call console_setup() in your platform setup
routine -- it's only done here for convenience.
Unfortunately I am working on an embedded platform, only using this code
as a starting point for our design.  If possible I would like to initialize the
console w/o the use of command line parameters.

Any insight that you can provide would be greatly appreciated.

Thanks,
Jeff
 

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jeff Harrell                    Work:  (801) 619-6104 
Broadband Access group/TI       
jharrell@ti.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  --------------BF0E0AD9983241233F42A942--