From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peng Fan Date: Thu, 15 Oct 2020 06:50:41 +0000 Subject: [PATCH 4/4] serial: serial_xen: add DEBUG_UART support In-Reply-To: <20201015042516.41197-5-takahiro.akashi@linaro.org> References: <20201015042516.41197-1-takahiro.akashi@linaro.org> <20201015042516.41197-5-takahiro.akashi@linaro.org> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de > Subject: [PATCH 4/4] serial: serial_xen: add DEBUG_UART support > > By using a hypervisor call, we can implement DEBUG_UART on xen. > This will allow us to see messages even earlier than serial_init(). > > Signed-off-by: AKASHI Takahiro > --- > drivers/serial/Kconfig | 14 +++++++++++--- > drivers/serial/serial_xen.c | 20 ++++++++++++++++++++ > 2 files changed, 31 insertions(+), 3 deletions(-) > > diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index > e344677f91f6..536cf0641773 100644 > --- a/drivers/serial/Kconfig > +++ b/drivers/serial/Kconfig > @@ -401,11 +401,19 @@ config DEBUG_UART_MTK > driver will be available until the real driver model serial is > running. > > +config DEBUG_UART_XEN > + bool "XEN Hypervisor Console" > + depends on XEN_SERIAL > + help > + Select this to enable a debug UART using the serial_xen driver. You > + will not have to provide any parameters to make this work. The driver > + will be available until the real driver-model serial is running. Please add one more line that it needs XEN debug enabled. without xen debug, you will not able to see any outputs. Regards, Peng. > + > endchoice > > config DEBUG_UART_BASE > hex "Base address of UART" > - depends on DEBUG_UART > + depends on DEBUG_UART && !DEBUG_UART_XEN > default 0 if DEBUG_UART_SANDBOX > help > This is the base address of your UART for memory-mapped UARTs. > @@ -415,7 +423,7 @@ config DEBUG_UART_BASE > > config DEBUG_UART_CLOCK > int "UART input clock" > - depends on DEBUG_UART > + depends on DEBUG_UART && !DEBUG_UART_XEN > default 0 if DEBUG_UART_SANDBOX > help > The UART input clock determines the speed of the internal UART @@ > -427,7 +435,7 @@ config DEBUG_UART_CLOCK > > config DEBUG_UART_SHIFT > int "UART register shift" > - depends on DEBUG_UART > + depends on DEBUG_UART && !DEBUG_UART_XEN > default 0 if DEBUG_UART > help > Some UARTs (notably ns16550) support different register layouts diff > --git a/drivers/serial/serial_xen.c b/drivers/serial/serial_xen.c index > ed191829f059..34c90ece40fc 100644 > --- a/drivers/serial/serial_xen.c > +++ b/drivers/serial/serial_xen.c > @@ -5,6 +5,7 @@ > */ > #include > #include > +#include > #include > #include > #include > @@ -15,11 +16,14 @@ > #include > > #include > +#include > #include > #include > #include > #include > > +#include > + > DECLARE_GLOBAL_DATA_PTR; > > u32 console_evtchn; > @@ -178,3 +182,19 @@ U_BOOT_DRIVER(serial_xen) = { > .flags = DM_FLAG_PRE_RELOC, > }; > > +#if defined(CONFIG_DEBUG_UART_XEN) > +static inline void _debug_uart_init(void) {} > + > +static inline void _debug_uart_putc(int c) { #if CONFIG_IS_ENABLED(ARM) > + xen_debug_putc(c); > +#else > + /* the type cast should work on LE only */ > + HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch); #endif } > + > +DEBUG_UART_FUNCS > + > +#endif > -- > 2.28.0