summaryrefslogtreecommitdiff
path: root/cpu/blackfin/os_log.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-07-09 01:15:05 -0400
committerMike Frysinger <vapier@gentoo.org>2009-07-18 21:15:50 -0400
commit909878fd3fda056d19b8b51a5cc51cb1c0b563d1 (patch)
tree8093a518e8637fe7fef3cde5e0b2850fb767bbe9 /cpu/blackfin/os_log.c
parentd39041fcadb1231430201d298c31f6be03d654f7 (diff)
downloadu-boot-imx-909878fd3fda056d19b8b51a5cc51cb1c0b563d1.zip
u-boot-imx-909878fd3fda056d19b8b51a5cc51cb1c0b563d1.tar.gz
u-boot-imx-909878fd3fda056d19b8b51a5cc51cb1c0b563d1.tar.bz2
Blackfin: add os log functions
Part of the mini Blackfin ABI with operating systems is that they can use 0x4f0-0x4f8 to pass log buffers to/from bootloaders. So add support to U-Boot for reading the log buffer. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'cpu/blackfin/os_log.c')
-rw-r--r--cpu/blackfin/os_log.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/cpu/blackfin/os_log.c b/cpu/blackfin/os_log.c
new file mode 100644
index 0000000..e1c8e29
--- /dev/null
+++ b/cpu/blackfin/os_log.c
@@ -0,0 +1,30 @@
+/*
+ * functions for handling OS log buffer
+ *
+ * Copyright (c) 2009 Analog Devices Inc.
+ *
+ * Licensed under the 2-clause BSD.
+ */
+
+#include <common.h>
+
+#define OS_LOG_MAGIC 0xDEADBEEF
+#define OS_LOG_MAGIC_ADDR ((unsigned long *)0x4f0)
+#define OS_LOG_PTR_ADDR ((char **)0x4f4)
+
+bool bfin_os_log_check(void)
+{
+ if (*OS_LOG_MAGIC_ADDR != OS_LOG_MAGIC)
+ return false;
+ *OS_LOG_MAGIC_ADDR = 0;
+ return true;
+}
+
+void bfin_os_log_dump(void)
+{
+ char *log = *OS_LOG_PTR_ADDR;
+ while (*log) {
+ puts(log);
+ log += strlen(log) + 1;
+ }
+}