lkml.org 
[lkml]   [2005]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: uart_match_port() question
Date
On Saturday 26 November 2005 5:21 pm, Benjamin Herrenschmidt wrote:
> The reason is a bit complicated, but basically, we have some arch code
> that builds a list of available serial ports very early and registers that
> as a platform device. It also detects which one is the default firmware port
> and what speed it's been configured for and builds a proper config line to
> pass to add_preferred_console() so we get the default serial console setup
> properly automatically.
>
> This list includes however ports that are on PCI devices on some recent
> machines. Thus, we need to make sure that, when 8250_pci.c kicks in, it
> property detects that those platform ports are the same it's discovered
> and thus properly re-uses the same port & minor.

[Sorry for the late response, I haven't been keeping up on lkml lately.]

ia64 has basically the same situation. I decided it was a mistake to
have the arch code register serial ports early, because we only learn
about a few of the ports early, and the firmware console configuration
determines which ones we learn about.

The consequence is that changing the firmware configuration changes the
serial device names, which I thought was a bad thing.

I finally settled on this scheme:
- discover default firmware port (pcdp.c)
- set it up as an "early uart" which has no ttyS name
and runs in polled mode (early_serial_console_init())
- register it as a console
- let 8250_{pci,pnp,etc} discover all the ports and
figure out minor numbers (i.e., ttyS names)
- locate the port that matches the default firmware port,
switch console to it, and unregister the "early uart"
(early_uart_console_switch())

This all should work for any arch, though I've only really tried it on
ia64. Of course, the pcdp.c part would have to be replaced. You can
try it out without the firmware support using the "console=uart"
argument:

console= [KNL] Output console device and options.
...
uart,io,<addr>[,options]
uart,mmio,<addr>[,options]
Start an early, polled-mode console on the 8250/16550
UART at the specified I/O port or MMIO address,
switching to the matching ttyS device later. The
options are the same as for ttyS, above.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-12-07 23:17    [W:0.102 / U:1.816 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site