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

[Xen-changelog] [xen-unstable] arm: add early_printk()



# HG changeset patch
# User David Vrabel <david.vrabel@xxxxxxxxxx>
# Date 1329143089 0
# Node ID f89c9a13529a0808bab24bb88bea6448eeb09cd9
# Parent  62c701cc8715dc259a127ee42b3fa4da313e61ee
arm: add early_printk()

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>
Acked-by: Tim Deegan <tim@xxxxxxx>
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---


diff -r 62c701cc8715 -r f89c9a13529a xen/arch/arm/Makefile
--- a/xen/arch/arm/Makefile     Mon Feb 13 14:24:49 2012 +0000
+++ b/xen/arch/arm/Makefile     Mon Feb 13 14:24:49 2012 +0000
@@ -1,6 +1,7 @@
 subdir-y += lib
 
 obj-y += dummy.o
+obj-y += early_printk.o
 obj-y += entry.o
 obj-y += domain.o
 obj-y += domain_build.o
diff -r 62c701cc8715 -r f89c9a13529a xen/arch/arm/early_printk.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/arm/early_printk.c       Mon Feb 13 14:24:49 2012 +0000
@@ -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));
+
+    /* XXX: 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 -r 62c701cc8715 -r f89c9a13529a xen/include/asm-arm/early_printk.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-arm/early_printk.h        Mon Feb 13 14:24:49 2012 +0000
@@ -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

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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