]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Blackfin: add os log functions
authorMike Frysinger <vapier@gentoo.org>
Thu, 9 Jul 2009 05:15:05 +0000 (01:15 -0400)
committerMike Frysinger <vapier@gentoo.org>
Sun, 19 Jul 2009 01:15:50 +0000 (21:15 -0400)
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>
cpu/blackfin/Makefile
cpu/blackfin/os_log.c [new file with mode: 0644]
include/asm-blackfin/blackfin_local.h
lib_blackfin/board.c

index 1378fd12bbe9b9292ee22a250070aaf49542c3af..f6841067f3a685e55f8a7aee3d7cad2ffa04d9c1 100644 (file)
@@ -17,7 +17,7 @@ EXTRA    :=
 CEXTRA   := initcode.o
 SEXTRA   := start.o
 SOBJS    := interrupt.o cache.o
-COBJS-y  := cpu.o traps.o interrupts.o reset.o serial.o watchdog.o
+COBJS-y  := cpu.o traps.o interrupts.o os_log.o reset.o serial.o watchdog.o
 COBJS-$(CONFIG_JTAG_CONSOLE) += jtag-console.o
 
 ifeq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
diff --git a/cpu/blackfin/os_log.c b/cpu/blackfin/os_log.c
new file mode 100644 (file)
index 0000000..e1c8e29
--- /dev/null
@@ -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;
+       }
+}
index e17d8a2003b2c3cb351248a3d8bec5e108be7185..8ec79289456782c1d213e70027043dd71eb11feb 100644 (file)
@@ -61,6 +61,9 @@ extern u_long get_sclk(void);
 
 # define bfin_revid() (*pCHIPID >> 28)
 
+extern bool bfin_os_log_check(void);
+extern void bfin_os_log_dump(void);
+
 extern void blackfin_icache_flush_range(const void *, const void *);
 extern void blackfin_dcache_flush_range(const void *, const void *);
 extern void blackfin_icache_dcache_flush_range(const void *, const void *);
index 28de372b78f3305509b0fb7de9242bc6fb5b7790..b957a9d8b9a62bf8bb94b13e77207d481aed62a6 100644 (file)
@@ -384,6 +384,12 @@ void board_init_r(gd_t * id, ulong dest_addr)
                post_run(NULL, POST_RAM | post_bootmode_get(0));
 #endif
 
+       if (bfin_os_log_check()) {
+               puts("\nLog buffer from operating system:\n");
+               bfin_os_log_dump();
+               puts("\n");
+       }
+
        /* main_loop() can return to retry autoboot, if so just run it again. */
        for (;;)
                main_loop();