serial_core: add pci uart early console support
PATCH v2 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
--- drivers/tty/serial/earlycon.c | 6 ++ drivers/tty/serial/serial_core.c | 140 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 144 insertions(+), 2 deletions(-)
drivers/tty/serial/earlycon.c +6 -0
@@ -196,7 +196,13 @@ static int __init param_setup_earlycon(char *buf) }return err; } + +/* x86 uses "earlyprintk=xxx", so we keep the compatibility here */ +#ifdef CONFIG_X86 +early_param ("earlyprintk" , param_setup_earlycon); +#else early_param ("earlycon" , param_setup_earlycon); +#endif int __init of_setup_earlycon (unsigned long addr,int (*setup)(struct earlycon_device *,const char *))
drivers/tty/serial/serial_core.c +138 -2
181 lines not on this page · raw message
Signature · 1 line
1.9.1
drivers/tty/serial/earlycon.c static int __init param_setup_earlycon(char *buf) · line 205
Quoted 6 lines
drivers/tty/serial/earlycon.c +5
-0+/* x86 uses "earlyprintk=xxx", so we keep the compatibility here */ +#ifdef CONFIG_X86 +early_param ("earlyprintk" , param_setup_earlycon); +#else early_param ("earlycon" , param_setup_earlycon); +#endif
Is there any reason for not just allowing both ? That way you don't need an ifdef and the same command line (either) works everywhere ?
Quoted 10 lines
int
__initof_setup_earlycon(unsigned long addr,drivers/tty/serial/earlycon.c +0
-0int (*setup)(struct earlycon_device *, const char *))drivers/tty/serial/serial_core.c +0
-0@@ -34,10 +34,16 @@#include <linux/serial_core.h> #include <linux/delay.h>
drivers/tty/serial/serial_core.c line 45
Quoted 10 lines
drivers/tty/serial/serial_core.c +5
-0#include <linux/mutex.h> +#include <linux/pci_regs.h> #include <asm/irq.h> #include <asm/uaccess.h> +/* Only x86 has early pci access APIs */ +#if defined(CONFIG_PCI ) && defined(CONFIG_X86 ) +#include <asm/pci-direct.h> +#endif
We should probably make that a define or Kconfig value so that any other port wanting early PCI console can add the needed direct functions without the defines here getting longer and longer
It would then be a single
#if defined(CONFIG_EARLY_PCI)
that could be put anywhere
Quoted 3 lines
drivers/tty/serial/serial_core.c +3
-0+static int parse_pci_options (char *options,unsigned long *phys) +{ +u8 bus, dev, func;
...
drivers/tty/serial/serial_core.c uart_get_console(struct uart_port *ports, int nr, struct console *co) · line 1906
Quoted 4 lines
drivers/tty/serial/serial_core.c +4
-0+failed: +pr_err ("Invalid earlycon pci parameters\n" ); +return -EINVAL ; +}
#else
static int parse_pci_options(char *options, unsigned long *phys)
{
pr_err("earlycon pci not available\n");
return -EINVAL;
}drivers/tty/serial/serial_core.c
Quoted 2 lines
drivers/tty/serial/serial_core.c +2
-0+#endif +
The all the ifdef mess below goes away
Alan