[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 6/7] arm: add early_printk()
From: David Vrabel <david.vrabel@xxxxxxxxxx> Add early_printk() which can be used before setup_pagetables(). This will be used when doing the early parsing of the DTB. Signed-off-by: David Vrabel <david.vrabel@xxxxxxxxxx> --- xen/arch/arm/Makefile | 1 + xen/arch/arm/early_printk.c | 72 ++++++++++++++++++++++++++++++++++++ xen/include/asm-arm/early_printk.h | 27 +++++++++++++ 3 files changed, 100 insertions(+), 0 deletions(-) create mode 100644 xen/arch/arm/early_printk.c create mode 100644 xen/include/asm-arm/early_printk.h diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index ac346a5..4794cfc 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -2,6 +2,7 @@ subdir-y += lib obj-y += dtb.o obj-y += dummy.o +obj-y += early_printk.o obj-y += entry.o obj-y += domain.o obj-y += domain_build.o diff --git a/xen/arch/arm/early_printk.c b/xen/arch/arm/early_printk.c new file mode 100644 index 0000000..1d9787b --- /dev/null +++ b/xen/arch/arm/early_printk.c @@ -0,0 +1,72 @@ +/* + * printk() for use before the final page tables are setup. + * + * Copyright (C) 2012 Citrix Systems, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include <xen/config.h> +#include <xen/init.h> +#include <xen/lib.h> +#include <xen/stdarg.h> +#include <xen/string.h> +#include <asm/early_printk.h> + +#ifdef EARLY_UART_ADDRESS + +static void __init early_putch(char c) +{ + volatile uint32_t *r; + + r = (uint32_t *)((EARLY_UART_ADDRESS & 0x001fffff) + + XEN_VIRT_START + (1 << 21)); + + /* FIXME: assuming a PL011 UART. */ + while(*(r + 0x6) & 0x8) + ; + *r = c; +} + +static void __init early_puts(const char *s) +{ + while (*s != '\0') { + if (*s == '\n') + early_putch('\r'); + early_putch(*s); + s++; + } +} + +static void __init early_vprintk(const char *fmt, va_list args) +{ + char buf[80]; + + vsnprintf(buf, sizeof(buf), fmt, args); + early_puts(buf); +} + +void __init early_printk(const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + early_vprintk(fmt, args); + va_end(args); +} + +void __attribute__((noreturn)) __init +early_panic(const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + early_vprintk(fmt, args); + va_end(args); + + while(1); +} + +#endif /* #ifdef EARLY_UART_ADDRESS */ diff --git a/xen/include/asm-arm/early_printk.h b/xen/include/asm-arm/early_printk.h new file mode 100644 index 0000000..f45f21e --- /dev/null +++ b/xen/include/asm-arm/early_printk.h @@ -0,0 +1,27 @@ +/* + * printk() for use before the final page tables are setup. + * + * Copyright (C) 2012 Citrix Systems, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#ifndef __ARM_EARLY_PRINTK_H__ +#define __ARM_EARLY_PRINTK_H__ + +#include <xen/config.h> + +#ifdef EARLY_UART_ADDRESS + +void early_printk(const char *fmt, ...); +void early_panic(const char *fmt, ...); + +#else + +static inline void early_printk(const char *fmt, ...) {} +static inline void early_panic(const char *fmt, ...) {} + +#endif + +#endif -- 1.7.2.5 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |