Skip to contentSkip to conversation

serial_core: add pci uart early console support

PATCH Superseded Bin Gao 2 participants 4 messages May 20, 2015 – May 22, 2015

Subsystems (3)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Bin Gao

author
#0 lore raw

PATCH v4 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                 |   1 +
 drivers/pci/Kconfig              |  11 +++
 drivers/tty/serial/earlycon.c    |   9 +++
 drivers/tty/serial/serial_core.c | 145 ++++++++++++++++++++++++++++++++++++++-
 4 files changed, 164 insertions(+), 2 deletions(-)
arch/x86/Kconfig +1 -0
index 226d569..bdedd61 100644
@@ -143,6 +143,7 @@ config X86
 	select ACPI_LEGACY_TABLES_LOOKUP if ACPI
 	select X86_FEATURE_NAMES if PROC_FS
 	select SRCU
+	select PCI_EARLY if PCI
 
 config INSTRUCTION_DECODER
 	def_bool y
drivers/pci/Kconfig +11 -0
index 7a8f1c5..4f0f055 100644
@@ -114,4 +114,15 @@ config PCI_LABEL
 	def_bool y if (DMI || ACPI)
 	select NLS
 
+config PCI_EARLY
+	bool "Early PCI access"
+	depends on PCI
+	default n
+	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 should enable this option which is required  by
+	  arch independent codes, e.g. uart8250 pci early console driver.
+
 source "drivers/pci/host/Kconfig"
drivers/tty/serial/earlycon.c +9 -0
index 6dc471e..63ae60e 100644
@@ -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
#1 lore raw
Quoted 8 lines · Bin Gao

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

Quoted 7 lines
---
 arch/x86/Kconfig                 |   1 +
 drivers/pci/Kconfig              |  11 +++
 drivers/tty/serial/earlycon.c    |   9 +++
 drivers/tty/serial/serial_core.c | 145 ++++++++++++++++++++++++++++++++++++++-
 4 files changed, 164 insertions(+), 2 deletions(-)

What changed in this version?

You can't just put "v4" without giving us some hint as to the differences here, sorry.

author
#2 lore raw
Quoted 4 lines · Greg Kroah-Hartman

What changed in this version?

You can't just put "v4" without giving us some hint as to the differences here, sorry.

I just resent [PATCH v4 1/2] with "Changes in v4" added. There is no change for patch 2/2 since the first version, so I didn't resend [PATCH v4 2/2].

Thanks,
Bin

#3 lore raw
Quoted 9 lines · Bin Gao
Quoted 4 lines · Greg Kroah-Hartman

What changed in this version?

You can't just put "v4" without giving us some hint as to the differences here, sorry.

I just resent [PATCH v4 1/2] with "Changes in v4" added. There is no change for patch 2/2 since the first version, so I didn't resend [PATCH v4 2/2].

Please do otherwise I'm apt to get very confused and just not want to apply any of these...