The patch introduces the alternative configuration of the log buffer for
authorYuri Tikhonov <yur@pollux.denx.de>
Wed, 6 Feb 2008 17:48:36 +0000 (18:48 +0100)
committerWolfgang Denk <wd@denx.de>
Tue, 18 Mar 2008 20:59:24 +0000 (21:59 +0100)
the lwmon5 board: the storage for the log-buffer itself is OCM(on-chip memory),
the log-buffer header is moved to six GPT registers (PPC440EPX_GPT0_COMP1, ...,
PPC440EPX_GPT0_COMP5).

 To enable this, alternative, configuration the U-Boot board configuration
file for lwmon5 includes the definitions of alternative addresses for header
(CONFIG_ALT_LH_ADDR) and buffer (CONFIG_ALT_LB_ADDR).

 The Linux shall be configured with the CONFIG_ALT_LB_LOCATION option set,
and has the BOARD_ALT_LH_ADDR and BOARD_ALT_LB_ADDR constants defined in the
lwmon5 board-specific header (arch/ppc/platforms/4xx/lwmon5.h).

Signed-off-by: Yuri Tikhonov <yur@emcraft.com>
common/cmd_bootm.c
common/cmd_log.c
include/configs/lwmon5.h
include/ppc440.h
lib_ppc/board.c

index 9546729294870360d418068c4e49dc42134255a1..9deb78190365ee34a59237c726518e3f0128b3f7 100644 (file)
@@ -545,11 +545,15 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
        }
 
 #ifdef CONFIG_LOGBUFFER
+#ifndef CONFIG_ALT_LB_ADDR
        kbd=gd->bd;
        /* Prevent initrd from overwriting logbuffer */
        if (initrd_high < (kbd->bi_memsize-LOGBUFF_LEN-LOGBUFF_OVERHEAD))
                initrd_high = kbd->bi_memsize-LOGBUFF_LEN-LOGBUFF_OVERHEAD;
        debug ("## Logbuffer at 0x%08lX ", kbd->bi_memsize-LOGBUFF_LEN);
+#else
+       debug ("## Logbuffer at 0x%08lX ", CONFIG_ALT_LB_ADDR);
+#endif
 #endif
 
        /*
index e593dbedd374c74fe2d5b61f3dbeaba189b56151..34b36ff1dd8d31ff99781ef2ae52e5b7c95ef7ec 100644 (file)
@@ -59,14 +59,25 @@ static char buf[1024];
 static unsigned console_loglevel = 3;
 static unsigned default_message_loglevel = 4;
 static unsigned log_version = 1;
+#ifdef CONFIG_ALT_LB_ADDR
+static volatile logbuff_t *log;
+#else
 static logbuff_t *log;
+#endif
+static char *lbuf;
 
 void logbuff_init_ptrs (void)
 {
        unsigned long tag, post_word;
        char *s;
 
+#ifdef CONFIG_ALT_LB_ADDR
+       log = (logbuff_t *)CONFIG_ALT_LH_ADDR;
+       lbuf = (char *)CONFIG_ALT_LB_ADDR;
+#else
        log = (logbuff_t *)(gd->bd->bi_memsize-LOGBUFF_LEN) - 1;
+       lbuf = log->buf;
+#endif
 
        /* Set up log version */
        if ((s = getenv ("logversion")) != NULL)
@@ -101,11 +112,26 @@ void logbuff_init_ptrs (void)
 
 void logbuff_reset (void)
 {
+#ifndef CONFIG_ALT_LB_ADDR
        memset (log, 0, sizeof (logbuff_t));
-       if (log_version == 2)
+#endif
+       if (log_version == 2) {
                log->v2.tag = LOGBUFF_MAGIC;
-       else
+#ifdef CONFIG_ALT_LB_ADDR
+               log->v2.start = 0;
+               log->v2.con = 0;
+               log->v2.end = 0;
+               log->v2.chars = 0;
+#endif
+       } else {
                log->v1.tag = LOGBUFF_MAGIC;
+#ifdef CONFIG_ALT_LB_ADDR
+               log->v1.dummy = 0;
+               log->v1.start = 0;
+               log->v1.size = 0;
+               log->v1.chars = 0;
+#endif
+       }
 }
 
 int drv_logbuff_init (void)
@@ -188,7 +214,7 @@ int do_log (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                                size = log->v1.size;
                        }
                        for (i=0; i < (size&LOGBUFF_MASK); i++) {
-                               s = (char *)log->buf+((start+i)&LOGBUFF_MASK);
+                               s = lbuf+((start+i)&LOGBUFF_MASK);
                                putc (*s);
                        }
                        return 0;
@@ -196,7 +222,7 @@ int do_log (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                        logbuff_reset ();
                        return 0;
                } else if (strcmp(argv[1],"info") == 0) {
-                       printf ("Logbuffer   at  %08lx\n", (unsigned long)log->buf);
+                       printf ("Logbuffer   at  %08lx\n", (unsigned long)lbuf);
                        if (log_version == 2) {
                                printf ("log_start    =  %08lx\n", log->v2.start);
                                printf ("log_end      =  %08lx\n", log->v2.end);
@@ -257,14 +283,14 @@ static int logbuff_printk(const char *line)
                line_feed = 0;
                for (; p < buf_end; p++) {
                        if (log_version == 2) {
-                               log->buf[log->v2.end & LOGBUFF_MASK] = *p;
+                               lbuf[log->v2.end & LOGBUFF_MASK] = *p;
                                log->v2.end++;
                                if (log->v2.end - log->v2.start > LOGBUFF_LEN)
                                        log->v2.start++;
                                log->v2.chars++;
                        }
                        else {
-                               log->buf[(log->v1.start + log->v1.size) &
+                               lbuf[(log->v1.start + log->v1.size) &
                                         LOGBUFF_MASK] = *p;
                                if (log->v1.size < LOGBUFF_LEN)
                                        log->v1.size++;
index e179e4f006c4cc702df95a8fda425d9245abd38a..ced7ba6f05cf3bf05e3fb09d09685811ba562068 100644 (file)
 
 #define CFG_POST_CACHE_ADDR    0x7fff0000 /* free virtual address      */
 #define CONFIG_LOGBUFFER
+#define CONFIG_ALT_LH_ADDR     (CFG_PERIPHERAL_BASE + GPT0_COMP1)
+#define CONFIG_ALT_LB_ADDR     (CFG_OCM_BASE)
 #define CFG_CONSOLE_IS_IN_ENV /* Otherwise it catches logbuffer as output */
 
 /*-----------------------------------------------------------------------
index 6e3b68d675c879321a93c81908e1a28f7367cc2b..10517cbb6509e3fd9dd6e3500e79566ea5dde4ba 100644 (file)
 #define GPT0_COMP5                     0x00000094
 #define GPT0_COMP4                     0x00000090
 #define GPT0_COMP3                     0x0000008C
+#define GPT0_COMP2                     0x00000088
+#define GPT0_COMP1                     0x00000084
 
 #if defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
 #define SDR0_USB2D0CR                 0x0320
index fbf1c5d25ab7de8db01058d66bcdf91771e42e1d..ee0213e1acac8748330015fac23f659d6191e9b4 100644 (file)
@@ -436,10 +436,12 @@ void board_init_f (ulong bootflag)
        addr = CFG_SDRAM_BASE + get_effective_memsize();
 
 #ifdef CONFIG_LOGBUFFER
+#ifndef CONFIG_ALT_LB_ADDR
        /* reserve kernel log buffer */
        addr -= (LOGBUFF_RESERVE);
        debug ("Reserving %dk for kernel logbuffer at %08lx\n", LOGBUFF_LEN, addr);
 #endif
+#endif
 
 #ifdef CONFIG_PRAM
        /*
@@ -1126,8 +1128,10 @@ void board_init_r (gd_t *id, ulong dest_addr)
                pram=0;
 #endif
 #ifdef CONFIG_LOGBUFFER
+#ifndef CONFIG_ALT_LB_ADDR
                /* Also take the logbuffer into account (pram is in kB) */
                pram += (LOGBUFF_LEN+LOGBUFF_OVERHEAD)/1024;
+#endif
 #endif
                sprintf ((char *)memsz, "%ldk", (bd->bi_memsize / 1024) - pram);
                setenv ("mem", (char *)memsz);