serial_core: add pci uart early console support
Subsystems (2)
PATCH v3 1/2 serial_core: add pci uart early console support
On some Intel Atom SoCs, the legacy IO port UART(0x3F8) is not available. Instead, a 8250 compatible PCI uart can be used as early console. This patch adds pci support to the 8250 early console driver uart8250. For example, to enable pci uart(00:21.3) as early console on these platforms, append the following line to the kernel command line (assume baud rate is 115200):
earlyprintk=uart8250,pci32,0:24.2,115200n8
--- arch/x86/Kconfig | 11 +++ drivers/tty/serial/earlycon.c | 9 +++ drivers/tty/serial/serial_core.c | 145 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 163 insertions(+), 2 deletions(-)
arch/x86/Kconfig +11 -0
@@ -2228,6 +2228,8 @@ config PCI your box. Other bus systems are ISA, EISA, MicroChannel (MCA) or VESA. If you have PCI, say Y, otherwise N. + select HAVE_EARLY_PCI + choice prompt "PCI access mode" depends on X86_32 && PCI
@@ -2265,6 +2267,15 @@ config PCI_GOANY endchoice +config HAVE_EARLY_PCI + def_bool y + help + This option indicates that a group of APIs are available (in + asm/pci-direct.h) so the kernel can access pci config registers + before the PCI subsystem is initialized. Any arch that supports + early pci APIs must enable this option which is required by arch + independent codes, e.g. uart8250 pci early console driver. + config PCI_BIOS def_bool y depends on X86_32 && PCI && (PCI_GOBIOS || PCI_GOANY)
drivers/tty/serial/earlycon.c +9 -0
@@ -193,6 +193,15 @@ static int __init param_setup_earlycon(char *buf) }early_param ("earlycon" , param_setup_earlycon); +/* x86 uses "earlyprintk=xxx", so we keep the compatibility here */ +#ifdef CONFIG_X86 +static int __init param_setup_earlycon_x86 (char *buf) +{ +return param_setup_earlycon (buf); +} +early_param ("earlyprintk" , param_setup_earlycon_x86); +#endif +int __init of_setup_earlycon (unsigned long addr,int (*setup)(struct earlycon_device *,const char *)) {
drivers/tty/serial/serial_core.c +143 -2
186 lines not on this page · raw message
Signature · 1 line
1.9.1
arch/x86/Kconfig config PCI · line 2232
Quoted 8 lines · Bin Gao
arch/x86/Kconfig +2
-0@@ -2228,6 +2228,8 @@ config PCI your box. Other bus systems are ISA, EISA, MicroChannel (MCA) or VESA. If you have PCI, say Y, otherwise N. + select HAVE_EARLY_PCI +
It's legal to have options after the help text of a Kconfig entry. It's also very uncommon to do that. Please put this select statement before the line reading "---help---" of the PCI entry.
arch/x86/Kconfig config PCI_GOANY · line 2271
Quoted 2 lines
arch/x86/Kconfig +2
-0+config HAVE_EARLY_PCI + def_bool y
You probably want just
bool
here. Because this symbol has no further dependencies, which means HAVE_EARLY_PCI will now always be set to 'y'. That, in turn, makes the select you added above pointless.
arch/x86/Kconfig config PCI_GOANY · line 2275
Quoted 4 lines
arch/x86/Kconfig +4
-0+ help + This option indicates that a group of APIs are available (in + asm/pci-direct.h) so the kernel can access pci config registers + before the PCI subsystem is initialized. Any arch that supports
Is this expected to be used outside of X86?
arch/x86/Kconfig config PCI_GOANY · line 2278
Quoted 3 lines
arch/x86/Kconfig +3
-0+ early pci APIs must enable this option which is required by arch + independent codes, e.g. uart8250 pci early console driver. +
Thanks,
Paul Bolle
Quoted 7 lines · Paul Bolle
Quoted 6 lines · Bin Gao
arch/x86/Kconfig +0
-0@@ -2228,6 +2228,8 @@ config PCI your box. Other bus systems are ISA, EISA, MicroChannel (MCA) or VESA. If you have PCI, say Y, otherwise N.
Quoted 7 lines
arch/x86/Kconfig config PCI · line 2232
Quoted 2 lines
arch/x86/Kconfig +2
-0+ select HAVE_EARLY_PCI +It's legal to have options after the help text of a
Kconfigentry. It's also very uncommon to do that. Please put this select statement before the line reading "---help---" of the PCI entry.
Will fix this in next patch set.
Quoted 10 lines
arch/x86/Kconfig config PCI_GOANY · line 2271
Quoted 2 lines
arch/x86/Kconfig +2
-0+config HAVE_EARLY_PCI + def_bool yYou probably want just
boolhere. Because this symbol has no further dependencies, which means
HAVE_EARLY_PCIwill now always be set to 'y'. That, in turn, makes the select you added above pointless.
Yes, you're right. bool is better.
Quoted 6 lines
arch/x86/Kconfig config PCI_GOANY · line 2275
Quoted 4 lines
arch/x86/Kconfig +4
-0+ help + This option indicates that a group of APIs are available (in + asm/pci-direct.h) so the kernel can access pci config registers + before the PCI subsystem is initialized. Any arch that supportsIs this expected to be used outside of X86?
Yes, drivers/tty/serial/serial_core.c is going to use it.
Quoted 3 lines · Bin Gao
Quoted 1 line · Paul Bolle
Is this expected to be used outside of X86?
Yes,
drivers/tty/serial/serial_core.cis going to use it.
What I should have asked is: do you expect architectures other than X86 to set HAVE_EARLY_PCI? Because then you should put that Kconfig entry in a file reachable by all architectures. Say, in init/Kconfig or in drivers/tty/serial/Kconfig.
(You can also have an entry for HAVE_EARLY_PCI for each arch that needs it, but that would be a bit silly.)
Thanks,
Paul Bolle
Quoted 8 lines · Paul Bolle
What I should have asked is: do you expect architectures other than X86 to set
HAVE_EARLY_PCI? Because then you should put thatKconfigentry in a file reachable by all architectures. Say, in init/Kconfig or indrivers/tty/serial/Kconfig.(You can also have an entry for
HAVE_EARLY_PCIfor each arch that needs it, but that would be a bit silly.)
The HAVE_EARLY_PCI entry should be actually in generic PCI layer, i.e. drivers/pci, because it's a PCI feature but only some archs (currently only x86) support it.
Then an arch with this feature could announce it in arch/<arch>/Kconfig by:
select HAVE_EARLY_PCI if PCI
Quoted 5 lines · Bin Gao
The
HAVE_EARLY_PCIentry should be actually in generic PCI layer, i.e.drivers/pci, because it's a PCI feature but only some archs (currently only x86) support it.
Then an arch with this feature could announce it in arch/<arch>/Kconfig by:
selectHAVE_EARLY_PCIif PCI
That makes more sense. So v4 will put HAVE_EARLY_PCI in a Kconfig under drivers/pci/?
Thanks,
Paul Bolle
Quoted 3 lines · Paul Bolle
That makes more sense. So v4 will put
HAVE_EARLY_PCIin aKconfigunderdrivers/pci/?
Yes.