arm/early-printk: Improve reusability and add Calxeda support
v2 cover arm/early-printk: Improve reusability and add Calxeda support
The current early-printk support for ARM is rather hard-coded, making it hard to add machines or tweak settings.
This series slightly moves some code to gather UART settings in xen/arch/arm/Rules.mk instead of the actual .c files. Also it allows two different machines with different settings to share the same driver, which the last patch exploits to add support the Calxeda Midway hardware.
This haven't been extensively tested, but I looked at the generated assembly and did some quick checks on Versatile Express.
Changes from v1:
- add documentation
- add extra support for ARM Fastmodel software emulators
Andre Przywara (5):
arm/early-printk: calculate baud rate divisor from user provided
value
arm/early-printk: allow skipping of UART init arm/early-printk: move UART base address to Rules.mk arm/early-printk: add support for ARM Fastmodel arm/early-printk: add Calxeda Midway UART support
docs/misc/arm/early-printk.txt | 9 +++++++++ xen/arch/arm/Rules.mk | 20 +++++++++++++++++++- xen/arch/arm/arm32/debug-exynos4210.inc | 6 ++---- xen/arch/arm/arm32/debug-pl011.inc | 6 ++---- xen/arch/arm/arm32/head.S | 2 ++ xen/arch/arm/arm64/debug-pl011.inc | 6 ++---- xen/arch/arm/arm64/head.S | 2 ++ 7 files changed, 38 insertions(+), 13 deletions(-)
Signature · 1 line
1.7.12.1
PATCH v2 1/5 arm/early-printk: calculate baud rate divisor from user provided value
For early-printk the used baud rate was hardcoded in the code, using precalculated divisor values.
Let the calculation of these values be done by the preprocessor and use a human readable value in xen/arch/arm/Rules.mk to drive this.
--- docs/misc/arm/early-printk.txt | 3 +++ xen/arch/arm/Rules.mk | 3 +++ xen/arch/arm/arm32/debug-exynos4210.inc | 4 ++-- xen/arch/arm/arm32/debug-pl011.inc | 4 ++-- xen/arch/arm/arm64/debug-pl011.inc | 4 ++-- 5 files changed, 12 insertions(+), 6 deletions(-)
docs/misc/arm/early-printk.txt +3 -0
@@ -12,4 +12,7 @@ where mach is the name of the machine: - vexpress: printk with pl011 for versatile express - exynos5250: printk with the second UART +The baud rate is hardcoded in xen/arch/arm/Rules.mk, +see there when adding support for new machines. + By default early printk is disabled.
xen/arch/arm/Rules.mk +3 -0
@@ -45,9 +45,11 @@ ifeq ($(debug),y) # TODO handle UART base address from make command line ifeq ($(CONFIG_EARLY_PRINTK), vexpress) EARLY_PRINTK_INC := pl011 +EARLY_PRINTK_BAUD := 38400 endif ifeq ($(CONFIG_EARLY_PRINTK), exynos5250) EARLY_PRINTK_INC := exynos4210 +EARLY_PRINTK_BAUD := 115200 endif ifneq ($(EARLY_PRINTK_INC),)
@@ -56,4 +58,5 @@ endif CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK_INC=\"debug-$(EARLY_PRINTK_INC).inc\" +CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK_BAUD=$(EARLY_PRINTK_BAUD) endif
xen/arch/arm/arm32/debug-exynos4210.inc +2 -2
@@ -38,9 +38,9 @@ orr \rd, \rd, #(0x7<<8) str \rd, [\rc, #0x558] - mov \rc, #4 + mov \rc, #(100000000 / EARLY_PRINTK_BAUD % 16) str \rc, [\rb, #UFRACVAL] /* -> UFRACVAL (Baud divisor fraction) */ - mov \rc, #53 + mov \rc, #(100000000 / EARLY_PRINTK_BAUD / 16 - 1) str \rc, [\rb, #UBRDIV] /* -> UBRDIV (Baud divisor integer) */ mov \rc, #3 /* 8n1 */ str \rc, [\rb, #ULCON] /* -> (Line control) */
xen/arch/arm/arm32/debug-pl011.inc +2 -2
@@ -23,9 +23,9 @@ * rc: scratch register 1 * rd: scratch register 2 (unused here) */ .macro early_uart_init rb, rc, rd - mov \rc, #0x0 + mov \rc, #(7372800 / EARLY_PRINTK_BAUD % 16) str \rc, [\rb, #0x28] /* -> UARTFBRD (Baud divisor fraction) */ - mov \rc, #0x4 /* 7.3728MHz / 0x4 == 16 * 115200 */ + mov \rc, #(7372800 / EARLY_PRINTK_BAUD / 16) str \rc, [\rb, #0x24] /* -> UARTIBRD (Baud divisor integer) */ mov \rc, #0x60 /* 8n1 */ str \rc, [\rb, #0x2C] /* -> UARTLCR_H (Line control) */
xen/arch/arm/arm64/debug-pl011.inc +2 -2
@@ -24,9 +24,9 @@ * xb: register which containts the UART base address * c: scratch register number */ .macro early_uart_init xb, c - mov x\c, #0x0 + mov x\c, #(7372800 / EARLY_PRINTK_BAUD % 16) strh w\c, [\xb, #0x28] /* -> UARTFBRD (Baud divisor fraction) */ - mov x\c, #0x4 /* 7.3728MHz / 0x4 == 16 * 115200 */ + mov x\c, #(7372800 / EARLY_PRINTK_BAUD / 16) strh w\c, [\xb, #0x24] /* -> UARTIBRD (Baud divisor integer) */ mov x\c, #0x60 /* 8n1 */ str w\c, [\xb, #0x2C] /* -> UARTLCR_H (Line control) */
Signature · 1 line
1.7.12.1
Re: [PATCH v2 1/5] arm/early-printk: calculate baud rate divisor from user provided value
Quoted 6 lines · Andre Przywara
For early-printk the used baud rate was hardcoded in the code, using precalculated divisor values.
Let the calculation of these values be done by the preprocessor and use a human readable value inxen/arch/arm/Rules.mkto drive this.Signed-off-by Andre Przywara <[email protected]>
Quoted 90 lines
--- docs/misc/arm/early-printk.txt | 3 +++ xen/arch/arm/Rules.mk | 3 +++ xen/arch/arm/arm32/debug-exynos4210.inc | 4 ++-- xen/arch/arm/arm32/debug-pl011.inc | 4 ++-- xen/arch/arm/arm64/debug-pl011.inc | 4 ++-- 5 files changed, 12 insertions(+), 6 deletions(-)docs/misc/arm/early-printk.txt +3
-0@@ -12,4 +12,7 @@ where mach is the name of the machine: - vexpress: printk with pl011 for versatile express - exynos5250: printk with the second UART +The baud rate is hardcoded in xen/arch/arm/Rules.mk, +see there when adding support for new machines. + By default early printk is disabled.xen/arch/arm/Rules.mk +3
-0@@ -45,9 +45,11 @@ ifeq ($(debug),y) # TODO handle UART base address from make command line ifeq ($(CONFIG_EARLY_PRINTK), vexpress) EARLY_PRINTK_INC := pl011 +EARLY_PRINTK_BAUD := 38400 endif ifeq ($(CONFIG_EARLY_PRINTK), exynos5250) EARLY_PRINTK_INC := exynos4210 +EARLY_PRINTK_BAUD := 115200 endif ifneq ($(EARLY_PRINTK_INC),)@@ -56,4 +58,5 @@ endif CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK_INC=\"debug-$(EARLY_PRINTK_INC).inc\" +CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK_BAUD=$(EARLY_PRINTK_BAUD) endifxen/arch/arm/arm32/debug-exynos4210.inc +2
-2@@ -38,9 +38,9 @@ orr \rd, \rd, #(0x7<<8) str \rd, [\rc, #0x558] - mov \rc, #4 + mov \rc, #(100000000 / EARLY_PRINTK_BAUD % 16) str \rc, [\rb, #UFRACVAL] /* -> UFRACVAL (Baud divisor fraction) */ - mov \rc, #53 + mov \rc, #(100000000 / EARLY_PRINTK_BAUD / 16 - 1) str \rc, [\rb, #UBRDIV] /* -> UBRDIV (Baud divisor integer) */ mov \rc, #3 /* 8n1 */ str \rc, [\rb, #ULCON] /* -> (Line control) */xen/arch/arm/arm32/debug-pl011.inc +2
-2@@ -23,9 +23,9 @@ * rc: scratch register 1 * rd: scratch register 2 (unused here) */ .macro early_uart_init rb, rc, rd - mov \rc, #0x0 + mov \rc, #(7372800 / EARLY_PRINTK_BAUD % 16) str \rc, [\rb, #0x28] /* -> UARTFBRD (Baud divisor fraction) */ - mov \rc, #0x4 /* 7.3728MHz / 0x4 == 16 * 115200 */ + mov \rc, #(7372800 / EARLY_PRINTK_BAUD / 16) str \rc, [\rb, #0x24] /* -> UARTIBRD (Baud divisor integer) */ mov \rc, #0x60 /* 8n1 */ str \rc, [\rb, #0x2C] /* -> UARTLCR_H (Line control) */xen/arch/arm/arm64/debug-pl011.inc +2
-2@@ -24,9 +24,9 @@ * xb: register which containts the UART base address * c: scratch register number */ .macro early_uart_init xb, c - mov x\c, #0x0 + mov x\c, #(7372800 / EARLY_PRINTK_BAUD % 16) strh w\c, [\xb, #0x28] /* -> UARTFBRD (Baud divisor fraction) */ - mov x\c, #0x4 /* 7.3728MHz / 0x4 == 16 * 115200 */ + mov x\c, #(7372800 / EARLY_PRINTK_BAUD / 16) strh w\c, [\xb, #0x24] /* -> UARTIBRD (Baud divisor integer) */ mov x\c, #0x60 /* 8n1 */ str w\c, [\xb, #0x2C] /* -> UARTLCR_H (Line control) */
PATCH v2 2/5 arm/early-printk: allow skipping of UART init
In reply to Andre PrzywaraWhile it seems obvious to initialize the UART before using it, chances are that some firmware code or the bootloader already did this. So it may actually be a good idea to skip the initialization, in fact this fixes early printk on my TC2 Versatile Express.
So provide an option in xen/arch/arm/Rules.mk to only initialize the UART when needed.
--- docs/misc/arm/early-printk.txt | 4 ++++ xen/arch/arm/Rules.mk | 2 ++ xen/arch/arm/arm32/head.S | 2 ++ xen/arch/arm/arm64/head.S | 2 ++ 4 files changed, 10 insertions(+)
docs/misc/arm/early-printk.txt +4 -0
@@ -14,5 +14,9 @@ where mach is the name of the machine: The baud rate is hardcoded in xen/arch/arm/Rules.mk, see there when adding support for new machines. +If not explicitly requested with "EARLY_PRINTK_INIT_UART := y" in Rules.mk, +the code will not try to initialize the UART, so that bootloader or +firmware settings can be used for maximum compatibility. The baud rate +parameter is ignored in this case. By default early printk is disabled.
xen/arch/arm/Rules.mk +2 -0
@@ -49,6 +49,7 @@ EARLY_PRINTK_BAUD := 38400 endif ifeq ($(CONFIG_EARLY_PRINTK), exynos5250) EARLY_PRINTK_INC := exynos4210 +EARLY_PRINTK_INIT_UART := y EARLY_PRINTK_BAUD := 115200 endif
@@ -57,6 +58,7 @@ EARLY_PRINTK := y endif CFLAGS-$(EARLY_PRINTK) += -DEARLY_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) endif
xen/arch/arm/arm32/head.S +2 -0
@@ -369,7 +369,9 @@ fail: PRINT("- Boot failed -\r\n") * r11: Early UART base address * Clobbers r0-r2 */ init_uart: +#ifdef EARLY_PRINTK_INIT_UART early_uart_init r11, r1, r2 +#endif adr r0, 1f b puts /* Jump to puts */ 1: .asciz "- UART enabled -\r\n"
xen/arch/arm/arm64/head.S +2 -0
@@ -116,7 +116,9 @@ boot_cpu: #ifdef EARLY_PRINTK ldr x23, =EARLY_UART_BASE_ADDRESS /* x23 := UART base address */ cbnz x22, 1f +#ifdef EARLY_PRINTK_INIT_UART bl init_uart /* CPU 0 sets up the UART too */ +#endif 1: PRINT("- CPU ") mov x0, x22 bl putn
Signature · 1 line
1.7.12.1
Re: [PATCH v2 2/5] arm/early-printk: allow skipping of UART init
Quoted 8 lines · Andre Przywara
While it seems obvious to initialize the UART before using it, chances are that some firmware code or the bootloader already did this. So it may actually be a good idea to skip the initialization, in fact this fixes early printk on my TC2 Versatile Express.
So provide an option inxen/arch/arm/Rules.mkto only initialize the UART when needed.Signed-off-by Andre Przywara <[email protected]>
Quoted 69 lines
--- docs/misc/arm/early-printk.txt | 4 ++++ xen/arch/arm/Rules.mk | 2 ++ xen/arch/arm/arm32/head.S | 2 ++ xen/arch/arm/arm64/head.S | 2 ++ 4 files changed, 10 insertions(+)docs/misc/arm/early-printk.txt +4
-0@@ -14,5 +14,9 @@ where mach is the name of the machine: The baud rate is hardcoded in xen/arch/arm/Rules.mk, see there when adding support for new machines. +If not explicitly requested with "EARLY_PRINTK_INIT_UART := y" in Rules.mk, +the code will not try to initialize the UART, so that bootloader or +firmware settings can be used for maximum compatibility. The baud rate +parameter is ignored in this case. By default early printk is disabled.xen/arch/arm/Rules.mk +2
-0@@ -49,6 +49,7 @@ EARLY_PRINTK_BAUD := 38400 endif ifeq ($(CONFIG_EARLY_PRINTK), exynos5250) EARLY_PRINTK_INC := exynos4210 +EARLY_PRINTK_INIT_UART := y EARLY_PRINTK_BAUD := 115200 endif@@ -57,6 +58,7 @@ EARLY_PRINTK := y endif CFLAGS-$(EARLY_PRINTK) += -DEARLY_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) endifxen/arch/arm/arm32/head.S +2
-0@@ -369,7 +369,9 @@ fail: PRINT("- Boot failed -\r\n") * r11: Early UART base address * Clobbers r0-r2 */ init_uart: +#ifdef EARLY_PRINTK_INIT_UART early_uart_init r11, r1, r2 +#endif adr r0, 1f b puts /* Jump to puts */ 1: .asciz "- UART enabled -\r\n"xen/arch/arm/arm64/head.S +2
-0@@ -116,7 +116,9 @@ boot_cpu: #ifdef EARLY_PRINTK ldr x23, =EARLY_UART_BASE_ADDRESS /* x23 := UART base address */ cbnz x22, 1f +#ifdef EARLY_PRINTK_INIT_UART bl init_uart /* CPU 0 sets up the UART too */ +#endif 1: PRINT("- CPU ") mov x0, x22 bl putn
PATCH v2 3/5 arm/early-printk: move UART base address to Rules.mk
In reply to Andre PrzywaraThe UART memory mapped base address is currently hardcoded in the early-printk UART driver, which denies the driver to be used by two machines with a different mapping.
Move this definition out to xen/arch/arm/Rules.mk, allowing easier user access and later sharing of the driver.
--- docs/misc/arm/early-printk.txt | 2 +- xen/arch/arm/Rules.mk | 4 +++- xen/arch/arm/arm32/debug-exynos4210.inc | 2 -- xen/arch/arm/arm32/debug-pl011.inc | 2 -- xen/arch/arm/arm64/debug-pl011.inc | 2 -- 5 files changed, 4 insertions(+), 8 deletions(-)
docs/misc/arm/early-printk.txt +1 -1
@@ -12,7 +12,7 @@ where mach is the name of the machine: - vexpress: printk with pl011 for versatile express - exynos5250: printk with the second UART -The baud rate is hardcoded in xen/arch/arm/Rules.mk, +The base address and baud rate is hardcoded in xen/arch/arm/Rules.mk, see there when adding support for new machines. If not explicitly requested with "EARLY_PRINTK_INIT_UART := y" in Rules.mk, the code will not try to initialize the UART, so that bootloader or
xen/arch/arm/Rules.mk +3 -1
@@ -42,15 +42,16 @@ EARLY_PRINTK := n ifeq ($(debug),y) # Early printk for versatile express -# TODO handle UART base address from make command line ifeq ($(CONFIG_EARLY_PRINTK), vexpress) EARLY_PRINTK_INC := pl011 EARLY_PRINTK_BAUD := 38400 +EARLY_UART_BASE_ADDRESS := 0x1c090000 endif ifeq ($(CONFIG_EARLY_PRINTK), exynos5250) EARLY_PRINTK_INC := exynos4210 EARLY_PRINTK_INIT_UART := y EARLY_PRINTK_BAUD := 115200 +EARLY_UART_BASE_ADDRESS := 0x12c20000 endif ifneq ($(EARLY_PRINTK_INC),)
@@ -61,4 +62,5 @@ CFLAGS-$(EARLY_PRINTK) += -DEARLY_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) endif
xen/arch/arm/arm32/debug-exynos4210.inc +0 -2
@@ -18,8 +18,6 @@ #include <asm/exynos4210-uart.h> -#define EARLY_UART_BASE_ADDRESS 0x12c20000 - /* Exynos 5 UART initialization * rb: register which contains the UART base address * rc: scratch register 1
xen/arch/arm/arm32/debug-pl011.inc +0 -2
@@ -16,8 +16,6 @@ * GNU General Public License for more details. */ -#define EARLY_UART_BASE_ADDRESS 0x1c090000 - /* PL011 UART initialization * rb: register which contains the UART base address * rc: scratch register 1
xen/arch/arm/arm64/debug-pl011.inc +0 -2
@@ -18,8 +18,6 @@ #include <asm/asm_defns.h> -#define EARLY_UART_BASE_ADDRESS 0x1c090000 - /* PL011 UART initialization * xb: register which containts the UART base address * c: scratch register number */
Signature · 1 line
1.7.12.1
Re: [PATCH v2 3/5] arm/early-printk: move UART base address to Rules.mk
Quoted 7 lines · Andre Przywara
The UART memory mapped base address is currently hardcoded in the early-printk UART driver, which denies the driver to be used by two machines with a different mapping.
Move this definition out toxen/arch/arm/Rules.mk, allowing easier user access and later sharing of the driver.Signed-off-by Andre Przywara <[email protected]>
Quoted 88 lines
--- docs/misc/arm/early-printk.txt | 2 +- xen/arch/arm/Rules.mk | 4 +++- xen/arch/arm/arm32/debug-exynos4210.inc | 2 -- xen/arch/arm/arm32/debug-pl011.inc | 2 -- xen/arch/arm/arm64/debug-pl011.inc | 2 -- 5 files changed, 4 insertions(+), 8 deletions(-)docs/misc/arm/early-printk.txt +1
-1@@ -12,7 +12,7 @@ where mach is the name of the machine: - vexpress: printk with pl011 for versatile express - exynos5250: printk with the second UART -The baud rate is hardcoded in xen/arch/arm/Rules.mk, +The base address and baud rate is hardcoded in xen/arch/arm/Rules.mk, see there when adding support for new machines. If not explicitly requested with "EARLY_PRINTK_INIT_UART := y" in Rules.mk, the code will not try to initialize the UART, so that bootloader orxen/arch/arm/Rules.mk +3
-1@@ -42,15 +42,16 @@ EARLY_PRINTK := n ifeq ($(debug),y) # Early printk for versatile express -# TODO handle UART base address from make command line ifeq ($(CONFIG_EARLY_PRINTK), vexpress) EARLY_PRINTK_INC := pl011 EARLY_PRINTK_BAUD := 38400 +EARLY_UART_BASE_ADDRESS := 0x1c090000 endif ifeq ($(CONFIG_EARLY_PRINTK), exynos5250) EARLY_PRINTK_INC := exynos4210 EARLY_PRINTK_INIT_UART := y EARLY_PRINTK_BAUD := 115200 +EARLY_UART_BASE_ADDRESS := 0x12c20000 endif ifneq ($(EARLY_PRINTK_INC),)@@ -61,4 +62,5 @@ CFLAGS-$(EARLY_PRINTK) += -DEARLY_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) endifxen/arch/arm/arm32/debug-exynos4210.inc +0
-2@@ -18,8 +18,6 @@ #include <asm/exynos4210-uart.h> -#define EARLY_UART_BASE_ADDRESS 0x12c20000 - /* Exynos 5 UART initialization * rb: register which contains the UART base address * rc: scratch register 1xen/arch/arm/arm32/debug-pl011.inc +0
-2@@ -16,8 +16,6 @@ * GNU General Public License for more details. */ -#define EARLY_UART_BASE_ADDRESS 0x1c090000 - /* PL011 UART initialization * rb: register which contains the UART base address * rc: scratch register 1xen/arch/arm/arm64/debug-pl011.inc +0
-2@@ -18,8 +18,6 @@ #include <asm/asm_defns.h> -#define EARLY_UART_BASE_ADDRESS 0x1c090000 - /* PL011 UART initialization * xb: register which containts the UART base address * c: scratch register number */
PATCH v2 4/5 arm/early-printk: add support for ARM Fastmodel
In reply to Andre PrzywaraThough the ARM Fastmodel software emulator mimics a Versatile Express board, the boot process is different compared to the real hardware, so the early printk differs slightly. Create a new early-printk target to model this correctly.
--- docs/misc/arm/early-printk.txt | 1 + xen/arch/arm/Rules.mk | 6 ++++++ 2 files changed, 7 insertions(+)
docs/misc/arm/early-printk.txt +1 -0
@@ -11,6 +11,7 @@ CONFIG_EARLY_PRINTK=mach where mach is the name of the machine: - vexpress: printk with pl011 for versatile express - exynos5250: printk with the second UART + - fastmodel: printk on ARM Fastmodel software emulators The base address and baud rate is hardcoded in xen/arch/arm/Rules.mk, see there when adding support for new machines.
xen/arch/arm/Rules.mk +6 -0
@@ -47,6 +47,12 @@ EARLY_PRINTK_INC := pl011 EARLY_PRINTK_BAUD := 38400 EARLY_UART_BASE_ADDRESS := 0x1c090000 endif +ifeq ($(CONFIG_EARLY_PRINTK), fastmodel) +EARLY_PRINTK_INC := pl011 +EARLY_PRINTK_INIT_UART := y +EARLY_PRINTK_BAUD := 115200 +EARLY_UART_BASE_ADDRESS := 0x1c090000 +endif ifeq ($(CONFIG_EARLY_PRINTK), exynos5250) EARLY_PRINTK_INC := exynos4210 EARLY_PRINTK_INIT_UART := y
Signature · 1 line
1.7.12.1
Re: [PATCH v2 4/5] arm/early-printk: add support for ARM Fastmodel
Quoted 6 lines · Andre Przywara
Though the ARM Fastmodel software emulator mimics a Versatile Express board, the boot process is different compared to the real hardware, so the early printk differs slightly. Create a new early-printk target to model this correctly.
Signed-off-by Andre Przywara <[email protected]>
Quoted 34 lines
--- docs/misc/arm/early-printk.txt | 1 + xen/arch/arm/Rules.mk | 6 ++++++ 2 files changed, 7 insertions(+)docs/misc/arm/early-printk.txt +1
-0@@ -11,6 +11,7 @@ CONFIG_EARLY_PRINTK=mach where mach is the name of the machine: - vexpress: printk with pl011 for versatile express - exynos5250: printk with the second UART + - fastmodel: printk on ARM Fastmodel software emulators The base address and baud rate is hardcoded in xen/arch/arm/Rules.mk, see there when adding support for new machines.xen/arch/arm/Rules.mk +6
-0@@ -47,6 +47,12 @@ EARLY_PRINTK_INC := pl011 EARLY_PRINTK_BAUD := 38400 EARLY_UART_BASE_ADDRESS := 0x1c090000 endif +ifeq ($(CONFIG_EARLY_PRINTK), fastmodel) +EARLY_PRINTK_INC := pl011 +EARLY_PRINTK_INIT_UART := y +EARLY_PRINTK_BAUD := 115200 +EARLY_UART_BASE_ADDRESS := 0x1c090000 +endif ifeq ($(CONFIG_EARLY_PRINTK), exynos5250) EARLY_PRINTK_INC := exynos4210 EARLY_PRINTK_INIT_UART := y
PATCH v2 5/5 arm/early-printk: add Calxeda Midway UART support
In reply to Andre PrzywaraWith the help of the previous patches add a stanza to xen/arch/arm/Rules.mk to specify the UART configuration of the Calxeda Midway machine.
The information has been taken from the Linux kernel's .dts file. This can be enabled by adding "CONFIG_EARLY_PRINTK=midway" to Config.mk.
--- docs/misc/arm/early-printk.txt | 1 + xen/arch/arm/Rules.mk | 5 +++++ 2 files changed, 6 insertions(+)
docs/misc/arm/early-printk.txt +1 -0
@@ -11,6 +11,7 @@ CONFIG_EARLY_PRINTK=mach where mach is the name of the machine: - vexpress: printk with pl011 for versatile express - exynos5250: printk with the second UART + - midway: printk with the pl011 on Calxeda Midway processors - fastmodel: printk on ARM Fastmodel software emulators The base address and baud rate is hardcoded in xen/arch/arm/Rules.mk,
xen/arch/arm/Rules.mk +5 -0
@@ -59,6 +59,11 @@ EARLY_PRINTK_INIT_UART := y EARLY_PRINTK_BAUD := 115200 EARLY_UART_BASE_ADDRESS := 0x12c20000 endif +ifeq ($(CONFIG_EARLY_PRINTK), midway) +EARLY_PRINTK_INC := pl011 +EARLY_PRINTK_BAUD := 115200 +EARLY_UART_BASE_ADDRESS := 0xfff36000 +endif ifneq ($(EARLY_PRINTK_INC),) EARLY_PRINTK := y
Signature · 1 line
1.7.12.1
Re: [PATCH v2 5/5] arm/early-printk: add Calxeda Midway UART support
Quoted 8 lines · Andre Przywara
With the help of the previous patches add a stanza to
xen/arch/arm/Rules.mkto specify the UART configuration of the Calxeda Midway machine.
The information has been taken from the Linux kernel's .dts file. This can be enabled by adding "CONFIG_EARLY_PRINTK=midway" to Config.mk.Signed-off-by Andre Przywara <[email protected]>
Quoted 33 lines
--- docs/misc/arm/early-printk.txt | 1 + xen/arch/arm/Rules.mk | 5 +++++ 2 files changed, 6 insertions(+)docs/misc/arm/early-printk.txt +1
-0@@ -11,6 +11,7 @@ CONFIG_EARLY_PRINTK=mach where mach is the name of the machine: - vexpress: printk with pl011 for versatile express - exynos5250: printk with the second UART + - midway: printk with the pl011 on Calxeda Midway processors - fastmodel: printk on ARM Fastmodel software emulators The base address and baud rate is hardcoded in xen/arch/arm/Rules.mk,xen/arch/arm/Rules.mk +5
-0@@ -59,6 +59,11 @@ EARLY_PRINTK_INIT_UART := y EARLY_PRINTK_BAUD := 115200 EARLY_UART_BASE_ADDRESS := 0x12c20000 endif +ifeq ($(CONFIG_EARLY_PRINTK), midway) +EARLY_PRINTK_INC := pl011 +EARLY_PRINTK_BAUD := 115200 +EARLY_UART_BASE_ADDRESS := 0xfff36000 +endif ifneq ($(EARLY_PRINTK_INC),) EARLY_PRINTK := y
Quoted 8 lines · Andre Przywara
The current early-printk support for ARM is rather hard-coded, making it hard to add machines or tweak settings.
This series slightly moves some code to gather UART settings inxen/arch/arm/Rules.mkinstead of the actual .c files. Also it allows two different machines with different settings to share the same driver, which the last patch exploits to add support the Calxeda Midway hardware.
Quoted 4 lines
This haven't been extensively tested, but I looked at the generated assembly and did some quick checks on Versatile Express.
Signed-off-by Andre Przywara <[email protected]>
All Acked + applied, thanks.
I did wonder vaguely about:
pulling the per board configs out of Rules.mk into earlyprintk-<board>.mk and doing:
ifneq($(CONFIG_EARLY_PRINTK),)
include earlyprintk-$(CONFIG_EARLY_PRINTK).mk
endifand
using the presence or absence of EARLY_PRINTK_BAUD instead of using a separate EARLY_PRINTK_INIT_UART.
Neither of which affect the correctness of this series though.
Quoted 9 lines · Ian Campbell
Quoted 8 lines · Andre Przywara
The current early-printk support for ARM is rather hard-coded, making it hard to add machines or tweak settings.
This series slightly moves some code to gather UART settings inxen/arch/arm/Rules.mkinstead of the actual .c files. Also it allows two different machines with different settings to share the same driver, which the last patch exploits to add support the Calxeda Midway hardware.
Quoted 6 lines
Quoted 4 lines
This haven't been extensively tested, but I looked at the generated assembly and did some quick checks on Versatile Express.
Signed-off-by Andre Przywara <[email protected]>All Acked + applied, thanks.
Thanks!
Quoted 7 lines
I did wonder vaguely about:
pulling the per board configs out of Rules.mk into earlyprintk-<board>.mk and doing:
ifneq($(CONFIG_EARLY_PRINTK),) include earlyprintk-$(CONFIG_EARLY_PRINTK).mk endif
Yeah, I also found it being in kind of the wrong place.
Just wasn't sure if early_printk justifies <n> extra files to be created. What about moving all the boards definitions into one file and including this? This keeps Rules.mk clean and avoids too much clutter.
Quoted 4 lines
and
using the presence or absence of
EARLY_PRINTK_BAUDinstead of using a separateEARLY_PRINTK_INIT_UART.
I was also wondering about this redundancy, this seems to be a nice solution for this. Thanks, will make a patch.
Regards,
Andre.
Quoted 27 lines · Andre Przywara
Quoted 9 lines · Ian Campbell
Quoted 8 lines · Andre Przywara
The current early-printk support for ARM is rather hard-coded, making it hard to add machines or tweak settings.
This series slightly moves some code to gather UART settings inxen/arch/arm/Rules.mkinstead of the actual .c files. Also it allows two different machines with different settings to share the same driver, which the last patch exploits to add support the Calxeda Midway hardware.Quoted 6 lines
Quoted 4 lines
This haven't been extensively tested, but I looked at the generated assembly and did some quick checks on Versatile Express.
Signed-off-by Andre Przywara <[email protected]>All Acked + applied, thanks.
Thanks!
Quoted 7 lines
I did wonder vaguely about:
pulling the per board configs out of Rules.mk into earlyprintk-<board>.mk and doing:
ifneq($(CONFIG_EARLY_PRINTK),) include earlyprintk-$(CONFIG_EARLY_PRINTK).mk endif
Quoted 4 lines
Yeah, I also found it being in kind of the wrong place.
Just wasn't sure ifearly_printkjustifies <n> extra files to be created. What about moving all the boards definitions into one file and including this? This keeps Rules.mk clean and avoids too much clutter.
That sounds reasonable.
Quoted 8 lines
Quoted 5 lines
and
using the presence or absence of
EARLY_PRINTK_BAUDinstead of using a separateEARLY_PRINTK_INIT_UART.I was also wondering about this redundancy, this seems to be a nice solution for this. Thanks, will make a patch.
Cheers!
Lets hope we don't have to implement 9n1 vs 7n0 and stuff too, things other than 8n1 are pretty uncommon now though I think...
Ian.