I totally understand, we have the same constraints with our SDK's APIs but with major versions we drop old APIs that have been superseded.
I would have thought that the switch to DT would have been a good opportunity to clean all that up, since it requires a change in the bootloader, right?
How would that have worked with field upgrades of the kernel but
not bootloader?
Anyway, do you know of a comprehensive list of options, console=ttyS0, earlycon=uart, console=uart, stdout-path=, etc. that are tested?
Although the kernel command line parameters are documented in
Documentation/kernel-parameters.txt and the DT options are documented in
Documentation/devicetree/..., you're right; Documentation/serial-console.txt
has bit-rotted.
Some patches for that would be great.
In fact, most of the console-related documentation needs a re-org.
I would figure that if there's no list, then it is not easy to create the testcases, and thus some end up not being tested (see further below).
It gets tested, because when I break something, I hear it.
Ok, so that does not work.
Actually, the kernel crashes (by the way, the is a potential crash on probe_baud if quot is zero, I had dealt with that on my patch)
Indeed, "console=uart" will crash at a call to uart_parse_earlycon() on drivers/tty/serial/8250/8250_core.c:univ8250_console_match() due to options=NULL.
I see that a similar call to uart_parse_earlycon() in drivers/tty/serial/earlycon.c does check for options!=NULL.
You need to use the format documented in Documentation/kernel-parameters.text:
console= [KNL] Output console device and options.
uart[8250],io,<addr>[,options]
uart[8250],mmio,<addr>[,options]
uart[8250],mmio16,<addr>[,options]
uart[8250],mmio32,<addr>[,options]
uart[8250],0x<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.
MMIO inter-register address stride is either 8-bit
(mmio), 16-bit (mmio16), or 32-bit (mmio32).
If none of [io|mmio|mmio16|mmio32], <addr> is assumed
to be equivalent to 'mmio'. 'options' are specified in
the same format described for ttyS above; if unspecified,
the h/w is not re-initialized.
The iotype and the uart address are not options.
console_init()
register_console()
univ8250_console_match()
Console matching failed here: probably because the driver's not yet initialized.
Only ISA type ports/early_serial_setup() ports can load a console here
because driver probing hasn't yet happened. This is very early here.
...
kernel_init()
...
of_platform_serial_driver_init()
...
of_platform_serial_probe()
serial8250_register_8250_port()
uart_add_one_port()
register_console()
univ8250_console_match()
This is where your console will take over from earlycon.
Since options=NULL both times, I think the console is never brought up properly.
I thus used a less obvious (at first) solution:
if (!options)
return univ8250_console_setup(co, options);
however, since univ8250_console_setup() does not forces a probe, and options=NULL, it overwrites the UART config with '9600n8r'.
So, I still think we need to change serial8250_console_setup() and the "rfc patch" I had proposed is still ok for this.
Again, what about the existing installations that have a kernel command line
like "console=ttyS0" and expect 9600n81 line settings?
Ok, thanks for the explanation.
Out of curiosity:
Do you know what is the difference between "earlycon" and "console"?
earlycon= starts a boot console only
console= will start a boot console if it finds an earlycon match and then
start a regular console that "takes over" from the boot console
I mean, why would one need "earlycon" if there's already "earlyprintk"?
You need to think about this from other developers' points-of-view.
Suppose there was no earlycon, and you needed to initialize your
8250-work-alike-but-not-clone? Are you going to add RT2880 register layout
to all the various arches for earlyprintk support? Trust me, those arches are
going to be unhappy about that. Multiply that by all the serial consoles
and that's an insurmountable problem.
Whereas adding earlycon support for every arch at once is trivial.
Why does it matter if support is in arch-dependent or arch-independent code?, as long as it works, it shouldn't matter, right?
Why couldn't driver developers use the "earlyprintk" facilities?
Sure, if earlyprintk works for you, by all means, please use it.
But it strikes me that it actually doesn't work for you because earlyprintk
doesn't do console hand-off, which is what you want.
Sorry for all the questions, I'm just curious about all these facilities.
I mean, maintaining all of them requires work and is error prone (as the crash above shows), so I'd like to understand why are you guys keeping them all.
No need to apologize for questions.
Ok, what about posting that as a separate patch in case somebody else needs it, would that be ok with you?
Definitely; patches are always welcome.
Plus Greg may disagree and want to take up the patch anyway.