[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH] xen/arm: Add Kconfig option for CONFIG_EARLY_PRINTK



Support for a very early console has existed for ARM for quite some
time.  Previously EARLY_PRINTK had to be passed in as a Make variable,
instead of as a configuration option.  Create the option to allow
selecting via .config.

Signed-off-by: Elliott Mitchell <ehem+xen@xxxxxxxxxxxx>

---
This is mostly RFC due to insufficient testing.  I am hopeful this
successfully changes things to have the Kconfig CONFIG_EARLY_PRINTK
option replace the environment/Make variable EARLY_PRINTK.

---
 xen/arch/arm/Kconfig        | 12 ++++++++++++
 xen/arch/arm/Makefile       |  2 +-
 xen/arch/arm/Rules.mk       | 34 +++++++++++++++-------------------
 xen/arch/arm/arm32/Makefile |  2 +-
 xen/arch/arm/arm64/Makefile |  2 +-
 5 files changed, 30 insertions(+), 22 deletions(-)

diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 0ef8a99ad9..a176d42a0c 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -241,3 +241,15 @@ source "arch/arm/platforms/Kconfig"
 source "common/Kconfig"
 
 source "drivers/Kconfig"
+
+if DEBUG || EXPERT
+
+config EARLY_PRINTK
+       string "Enable early hard-coded console for printk"
+       help
+          Setup a serial device early during boot for logging message.  Used
+         for very early bring-up.
+
+         See docs/misc/arm/early-printk.txt
+
+endif
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 70f532e42a..0bf975b44d 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -16,7 +16,7 @@ obj-y += device.o
 obj-y += domain.o
 obj-y += domain_build.init.o
 obj-y += domctl.o
-obj-$(EARLY_PRINTK) += early_printk.o
+obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
 obj-y += gic.o
 obj-y += gic-v2.o
 obj-$(CONFIG_GICV3) += gic-v3.o
diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk
index 3d9a0ed357..4aef62cc9c 100644
--- a/xen/arch/arm/Rules.mk
+++ b/xen/arch/arm/Rules.mk
@@ -22,12 +22,15 @@ ifneq ($(call cc-option,$(CC),-fvisibility=hidden,n),n)
 CFLAGS += -DGCC_HAS_VISIBILITY_ATTRIBUTE
 endif
 
-EARLY_PRINTK := n
-
-ifeq ($(CONFIG_DEBUG),y)
+ifneq ($(CONFIG_EARLY_PRINTK),)
 
 # See docs/misc/arm/early-printk.txt for syntax
 
+ifneq ($(CONFIG_DEBUG),y)
+# Early printk is dependant on a debug build.
+$(error CONFIG_EARLY_PRINTK enabled for non-debug build)
+endif
+
 EARLY_PRINTK_brcm           := 8250,0xF040AB00,2
 EARLY_PRINTK_dra7           := 8250,0x4806A000,2
 EARLY_PRINTK_fastmodel      := pl011,0x1c090000,115200
@@ -54,6 +57,10 @@ else
 EARLY_PRINTK_CFG := $(subst $(comma), ,$(CONFIG_EARLY_PRINTK))
 endif
 
+ifeq ($(EARLY_PRINTK_CFG),)
+$(error Unknown CONFIG_EARLY_PRINTK setting)
+endif
+
 # Extract configuration from string
 EARLY_PRINTK_INC := $(word 1,$(EARLY_PRINTK_CFG))
 EARLY_UART_BASE_ADDRESS := $(word 2,$(EARLY_PRINTK_CFG))
@@ -76,22 +83,11 @@ CFLAGS-y += -DEARLY_PRINTK_VERSION_NONE
 endif
 endif
 
-ifneq ($(EARLY_PRINTK_INC),)
-EARLY_PRINTK := y
-endif
-
-CFLAGS-$(EARLY_PRINTK) += -DCONFIG_EARLY_PRINTK
+CFLAGS-y += -DCONFIG_EARLY_PRINTK
 CFLAGS-$(EARLY_PRINTK_INIT_UART) += -DEARLY_PRINTK_INIT_UART
-CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK_INC=\"debug-$(EARLY_PRINTK_INC).inc\"
-CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK_BAUD=$(EARLY_PRINTK_BAUD)
-CFLAGS-$(EARLY_PRINTK) += -DEARLY_UART_BASE_ADDRESS=$(EARLY_UART_BASE_ADDRESS)
-CFLAGS-$(EARLY_PRINTK) += -DEARLY_UART_REG_SHIFT=$(EARLY_UART_REG_SHIFT)
-
-else # !CONFIG_DEBUG
-
-ifneq ($(CONFIG_EARLY_PRINTK),)
-# Early printk is dependant on a debug build.
-$(error CONFIG_EARLY_PRINTK enabled for non-debug build)
-endif
+CFLAGS-y += -DEARLY_PRINTK_INC=\"debug-$(EARLY_PRINTK_INC).inc\"
+CFLAGS-y += -DEARLY_PRINTK_BAUD=$(EARLY_PRINTK_BAUD)
+CFLAGS-y += -DEARLY_UART_BASE_ADDRESS=$(EARLY_UART_BASE_ADDRESS)
+CFLAGS-y += -DEARLY_UART_REG_SHIFT=$(EARLY_UART_REG_SHIFT)
 
 endif
diff --git a/xen/arch/arm/arm32/Makefile b/xen/arch/arm/arm32/Makefile
index 0ac254f347..13eeefae13 100644
--- a/xen/arch/arm/arm32/Makefile
+++ b/xen/arch/arm/arm32/Makefile
@@ -1,6 +1,6 @@
 subdir-y += lib
 
-obj-$(EARLY_PRINTK) += debug.o
+obj-$(CONFIG_EARLY_PRINTK) += debug.o
 obj-y += domctl.o
 obj-y += domain.o
 obj-y += entry.o
diff --git a/xen/arch/arm/arm64/Makefile b/xen/arch/arm/arm64/Makefile
index c4f3a28a0d..86572014d0 100644
--- a/xen/arch/arm/arm64/Makefile
+++ b/xen/arch/arm/arm64/Makefile
@@ -2,7 +2,7 @@ subdir-y += lib
 
 obj-y += cache.o
 obj-$(CONFIG_HARDEN_BRANCH_PREDICTOR) += bpi.o
-obj-$(EARLY_PRINTK) += debug.o
+obj-$(CONFIG_EARLY_PRINTK) += debug.o
 obj-y += domctl.o
 obj-y += domain.o
 obj-y += entry.o
-- 
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |         ehem+sigmsg@xxxxxxx  PGP 87145445         |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.