* question concerning serial console setup @ 1999-12-29 19:23 Jeff Harrell 1999-12-30 0:47 ` Conrad Parker 0 siblings, 1 reply; 7+ messages in thread From: Jeff Harrell @ 1999-12-29 19:23 UTC (permalink / raw) To: linux 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. In our architecture we are using the 85C30 (SCC) driver (zs.c, zs.h), can I use the serial_console_init routines from this code to accomplish the same thing? Is serial_console setting up additional information that won't get setup elsewhere? Any help would be greatly appreciated. Thanks, Jeff -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Jeff Harrell Work: (801) 619-6104 Broadband Access group/TI jharrell@ti.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: question concerning serial console setup 1999-12-29 19:23 question concerning serial console setup Jeff Harrell @ 1999-12-30 0:47 ` Conrad Parker 2000-01-17 3:41 ` Jeff Harrell 0 siblings, 1 reply; 7+ messages in thread From: Conrad Parker @ 1999-12-30 0:47 UTC (permalink / raw) To: Jeff Harrell, linux 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(). 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. > In our architecture we are > using the 85C30 (SCC) driver > (zs.c, zs.h), can I use the serial_console_init routines from this code > to accomplish the same thing? Is > serial_console setting up additional information that won't get setup > elsewhere? Any help would be > greatly appreciated. > using zs.c and zs.h from where? (ie. your own code, or from somewhere like drivers/tc?) drivers/sgi/char/sgiserial.c also implements Z8530 support nicely. The serial console routines set up linux console functions that happen to use the serial device; a console is something that basically provides a write function, possibly a read function, and some other stuff like special key settings. So, eg. your console write function (like zs_console_write in sgiserial.c) does a few serial put_chars and so on. You need to set up a struct console with these fields (as defined in <linux/console.h>), then make a serial_console_init() function that calls register_console (defined in printk.c). It'll become the default system console if it's the first console to be registered (and nothing then calls console_setup), or if you pass the console=ttyS? parameter to the kernel. Conrad. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: question concerning serial console setup 1999-12-30 0:47 ` Conrad Parker @ 2000-01-17 3:41 ` Jeff Harrell 2000-01-17 4:06 ` Ralf Baechle 0 siblings, 1 reply; 7+ messages in thread From: Jeff Harrell @ 2000-01-17 3:41 UTC (permalink / raw) To: Conrad Parker; +Cc: linux [-- Attachment #1: Type: text/plain, Size: 3556 bytes --] 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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [-- Attachment #2: Type: text/html, Size: 4524 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: question concerning serial console setup 2000-01-17 3:41 ` Jeff Harrell @ 2000-01-17 4:06 ` Ralf Baechle 2000-01-18 1:56 ` Andrew R. Baker 0 siblings, 1 reply; 7+ messages in thread From: Ralf Baechle @ 2000-01-17 4:06 UTC (permalink / raw) To: Jeff Harrell; +Cc: Conrad Parker, linux On Sun, Jan 16, 2000 at 08:41:38PM -0700, Jeff Harrell wrote: > 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. A simple solution is to hardwire the commmand line in arch/mips/kernel/setup.c. Ralf ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: question concerning serial console setup 2000-01-17 4:06 ` Ralf Baechle @ 2000-01-18 1:56 ` Andrew R. Baker 2000-01-18 2:14 ` Ralf Baechle 0 siblings, 1 reply; 7+ messages in thread From: Andrew R. Baker @ 2000-01-18 1:56 UTC (permalink / raw) To: Ralf Baechle; +Cc: Jeff Harrell, Conrad Parker, linux On Mon, 17 Jan 2000, Ralf Baechle wrote: > On Sun, Jan 16, 2000 at 08:41:38PM -0700, Jeff Harrell wrote: > > > 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. > > A simple solution is to hardwire the commmand line in > arch/mips/kernel/setup.c. > I have some hackish code that queries the prom enviroment and edits the commandline to reflect the appropriate console. If that is worthwhile to have available I will dig up a diff. -Andrew ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: question concerning serial console setup 2000-01-18 1:56 ` Andrew R. Baker @ 2000-01-18 2:14 ` Ralf Baechle 2000-01-18 2:47 ` Andrew R. Baker 0 siblings, 1 reply; 7+ messages in thread From: Ralf Baechle @ 2000-01-18 2:14 UTC (permalink / raw) To: Andrew R. Baker; +Cc: Ralf Baechle, Jeff Harrell, Conrad Parker, linux On Mon, Jan 17, 2000 at 07:56:42PM -0600, Andrew R. Baker wrote: > > > 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. > > > > A simple solution is to hardwire the commmand line in > > arch/mips/kernel/setup.c. > > I have some hackish code that queries the prom enviroment and edits the > commandline to reflect the appropriate console. If that is worthwhile to > have available I will dig up a diff. Have you considered hacking kerne/printk.c:console_setup() instead? There is already some SPARC code there. Ralf ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: question concerning serial console setup 2000-01-18 2:14 ` Ralf Baechle @ 2000-01-18 2:47 ` Andrew R. Baker 0 siblings, 0 replies; 7+ messages in thread From: Andrew R. Baker @ 2000-01-18 2:47 UTC (permalink / raw) To: Ralf Baechle; +Cc: Jeff Harrell, Conrad Parker, linux On Tue, 18 Jan 2000, Ralf Baechle wrote: > On Mon, Jan 17, 2000 at 07:56:42PM -0600, Andrew R. Baker wrote: > > > A simple solution is to hardwire the commmand line in > > > arch/mips/kernel/setup.c. > > > > I have some hackish code that queries the prom enviroment and edits the > > commandline to reflect the appropriate console. If that is worthwhile to > > have available I will dig up a diff. > > Have you considered hacking kerne/printk.c:console_setup() instead? > There is already some SPARC code there. The code in kernel/printk.c seems to be only involved in normalizing the names of the serial ports. What I needed was to get the console enviroment setting from the prom. I don't like the idea of putting prom code into kernel/printk.c. Here is the code I used (from arch/mips/arc/cmdline.c): /* get the console enviroment variable into the command line. * But only if the console parameter wasn't entered by the user. * Is this a bad thing to do here? * -Andrew */ if(console_option == 0) { console = prom_getenv("console"); strcpy(cp, "console="); cp += strlen("console="); strcpy(cp, console); cp += strlen(console); *cp++ = ' '; } I don't like the way it messes with the passed commandline. However, we could read the value into some other variable and let kernel/printk.c pick it up from there. -Andrew ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2000-01-18 3:07 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 1999-12-29 19:23 question concerning serial console setup Jeff Harrell 1999-12-30 0:47 ` Conrad Parker 2000-01-17 3:41 ` Jeff Harrell 2000-01-17 4:06 ` Ralf Baechle 2000-01-18 1:56 ` Andrew R. Baker 2000-01-18 2:14 ` Ralf Baechle 2000-01-18 2:47 ` Andrew R. Baker
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox