]> www.infradead.org Git - users/rw/ppcboot.git/commitdiff
* Fixed problems with initrd_high when handling multifile images
authorwdenk <wdenk>
Sun, 3 Jun 2001 21:57:31 +0000 (21:57 +0000)
committerwdenk <wdenk>
Sun, 3 Jun 2001 21:57:31 +0000 (21:57 +0000)
* Patch for SBC8260 configuration
  by Jon Diekema: 02 Jun 2001
  - Removing CFG_SBC_S2 that isn't used
  - Improving the MODCK_H & MODCLK[1-3] table.

CHANGELOG
common/bedbug.c
common/cmd_bootm.c
include/bedbug/bedbug.h
include/bedbug/ppc.h
include/bedbug/regs.h
include/bedbug/tables.h
include/config_sbc8260.h
include/version.h

index 5403252d8597a6a8ee6fd59afe125f35a8fbf685..e4ccf0f4e443b64c08f065d03035b7a8407f3562 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -56,6 +56,8 @@ To do:
 Modifications for 1.0.0:
 ======================================================================
 
+* Fixed problems with initrd_high when handling multifile images
+
 * Added bedbug (http://www.mindspring.com/~wlp/bedbug.html) embedded
   disasssembler/debugger/...
   Patch by Bill Pitts: 08 May 2001
@@ -65,6 +67,11 @@ Modifications for 1.0.0:
 * Patch for ERIC configuration and embedded flash environment
   by Swen Anderson: 30 May 2001
 
+* Patch for SBC8260 configuration
+  by Jon Diekema: 02 Jun 2001
+  - Removing CFG_SBC_S2 that isn't used
+  - Improving the MODCK_H & MODCLK[1-3] table.
+
 ======================================================================
 Modifications for 0.9.3:
 ======================================================================
index 1158a08f2814f8d039f320940ef72af03a45f3fd..25acb949338b671e2cec32afcc030a79d7a350e6 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: bedbug.c,v 1.1 2001/05/31 22:12:25 wd Exp $ */
+/* $Id$ */
 
 #include <ppcboot.h>
 #include <linux/ctype.h>
index d2afcaa9254caf937268799bb9c87db91b26216b..d9e971710b2e5629ffdb82806cc0d81518ff0510 100644 (file)
@@ -55,7 +55,6 @@ static void print_type (image_header_t *hdr);
 typedef void boot_os_Fcn (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[],
                          ulong      addr,      /* of image to boot */
                          ulong     *len_ptr,   /* multi-file image length table */
-                         ulong      data,      /* points to first image */
                          int        verify);   /* getenv("verify")[0] != 'n' */
 
 static boot_os_Fcn do_bootm_linux;
@@ -222,11 +221,11 @@ void do_bootm (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
        default:                        /* handled by (original) Linux case */
        case IH_OS_LINUX:
            do_bootm_linux  (cmdtp, bd, flag, argc, argv,
-                            addr, len_ptr, data, verify);
+                            addr, len_ptr, verify);
            break;
        case IH_OS_NETBSD:
            do_bootm_netbsd (cmdtp, bd, flag, argc, argv,
-                            addr, len_ptr, data, verify);
+                            addr, len_ptr, verify);
            break;
        }
 
@@ -240,7 +239,6 @@ static void
 do_bootm_linux (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[],
                ulong           addr,
                ulong          *len_ptr,
-               ulong           data,
                int             verify)
 {
        ulong   sp;
@@ -248,6 +246,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[],
        ulong   initrd_start, initrd_end;
        ulong   cmd_start, cmd_end;
        ulong   initrd_high;
+       ulong   data;
        char    *cmdline;
        char    *s;
        bd_t    *kbd;
@@ -275,11 +274,17 @@ do_bootm_linux (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[],
 
        asm( "mr %0,1": "=r"(sp) : );
 
-       sp -= 1024;             /* just to be sure */
+#ifdef DEBUG
+       printf ("## Current stack ends at 0x%08lX ", sp);
+#endif
+       sp -= 2048;             /* just to be sure */
        if (sp > CFG_BOOTMAPSZ)
                sp = CFG_BOOTMAPSZ;
        sp &= ~0xF;
 
+#ifdef DEBUG
+       printf ("=> set upper limit to 0x%08lX\n", sp);
+#endif
        cmdline = (char *)((sp - CFG_BARGSIZE) & ~0xF);
        kbd = (bd_t *)(((ulong)cmdline - sizeof(bd_t)) & ~0xF);
 
@@ -291,6 +296,10 @@ do_bootm_linux (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[],
        cmd_start    = (ulong)&cmdline[0];
        cmd_end      = cmd_start + strlen(cmdline);
 
+#ifdef DEBUG
+       printf ("## cmdline at 0x%08lX ... 0x%08lX\n", cmd_start, cmd_end);
+#endif
+
        *kbd = *bd;
 
        kernel = (void (*)(bd_t *, ulong, ulong, ulong, ulong))hdr->ih_ep;
@@ -374,7 +383,47 @@ do_bootm_linux (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[],
                        do_reset (cmdtp, bd, flag, argc, argv);
                }
 
-               initrd_start  = (ulong)kbd - hdr->ih_size;
+               /*
+                * Now check if we have a multifile image
+                */
+       } else if ((hdr->ih_type==IH_TYPE_MULTI) && (len_ptr[1])) {
+               u_long tail    = len_ptr[0] % 4;
+               int i;
+
+#ifdef CONFIG_HERMES
+               hermes_set_led (13);
+#endif
+               /* skip kernel length and terminator */
+               data = (ulong)(&len_ptr[2]);
+               /* skip any additional image length fields */
+               for (i=1; len_ptr[i]; ++i)
+                       data += 4;
+               /* add kernel length, and align */
+               data += len_ptr[0];
+               if (tail) {
+                       data += 4 - tail;
+               }
+
+               len   = len_ptr[1];
+
+       } else {
+               /*
+                * no initrd image
+                */
+#ifdef CONFIG_HERMES
+               hermes_set_led (14);
+#endif
+               data = 0;
+       }
+
+#ifdef DEBUG
+       if (!data) {
+               printf ("No initrd\n");
+       }
+#endif
+
+       if (data) {
+               initrd_start  = (ulong)kbd - len;
                initrd_start &= ~(4096 - 1);    /* align on page */
 
                if (initrd_high) {
@@ -391,7 +440,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[],
                         * above for command line args and board info.
                         */
                        asm( "mr %0,1": "=r"(nsp) : );
-                       nsp -= 1024;            /* just to be sure */
+                       nsp -= 2048;            /* just to be sure */
                        nsp &= ~0xF;
                        if (nsp > initrd_high)  /* limit as specified */
                                nsp = initrd_high;
@@ -403,40 +452,17 @@ do_bootm_linux (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[],
 #ifdef CONFIG_HERMES
                hermes_set_led (12);
 #endif
-
+#ifdef DEBUG
+               printf ("## initrd at 0x%08lX ... 0x%08lX (len=%ld=0x%lX)\n",
+                       data, data + len - 1, len, len);
+#endif
                initrd_end    = initrd_start + hdr->ih_size;
                printf ("   Loading Ramdisk to %08lx, end %08lx ... ",
                        initrd_start, initrd_end);
-               memcpy ((void *)initrd_start,
-                       (void *)(addr + sizeof(image_header_t)),
-                       hdr->ih_size );
-               printf ("OK\n");
-       } else if ((hdr->ih_type==IH_TYPE_MULTI) && (len_ptr[1])) {
-               u_long i_start = data + len_ptr[0];
-               u_long tail    = len_ptr[0] % 4;
-
-#ifdef CONFIG_HERMES
-               hermes_set_led (13);
-#endif
-               if (tail) {
-                       i_start += 4 - tail;
-               }
-
-               initrd_start = (ulong)kbd - len_ptr[1];
-               initrd_start &= ~(4096 - 1);    /* align on page */
-               initrd_end    = initrd_start + len_ptr[1];
-               printf ("   Loading Ramdisk to %08lx ... ", initrd_start);
-               memcpy ((void *)initrd_start, (void *)i_start, len_ptr[1]);
+               memmove ((void *)initrd_start, (void *)data, len);
                printf ("OK\n");
        } else {
-               /*
-                * no initrd image
-                */
-#ifdef CONFIG_HERMES
-               hermes_set_led (14);
-#endif
-               initrd_start = 0;
-               initrd_end   = 0;
+               initrd_end = 0;
        }
 
 #ifdef DEBUG
@@ -462,7 +488,6 @@ static void
 do_bootm_netbsd (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[],
                ulong           addr,
                ulong          *len_ptr,
-               ulong           data,
                int             verify)
 {
        image_header_t *hdr = &header;
index 10c4102978e06b7c4877af7a0ee6ba938d450e5e..4e1125523b415b3f5c9103976b73dff4fbc215d0 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: bedbug.h,v 1.1 2001/05/31 22:12:27 wd Exp $ */
+/* $Id$ */
 
 #ifndef _BEDBUG_H
 #define _BEDBUG_H
index 29fa840c646038c9076e45fe74c1aa4a3a2cc502..e386b2bdfce9291853ef67f449958032a22b7093 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: ppc.h,v 1.1 2001/05/31 22:12:27 wd Exp $ */
+/* $Id$ */
 
 #ifndef _PPC_H
 #define _PPC_H
index 93c7e0cf2b9a4e409fea8e1e4e104ce3eaddda8e..578a0764d24e089691e799f9a02bc2f76a28a955 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: regs.h,v 1.1 2001/05/31 22:12:27 wd Exp $ */
+/* $Id$ */
 
 #ifndef _REGS_H
 #define _REGS_H
index f04c6c80259c73a9e0960ff7d2939c9cac8555cc..9a62bdefefa433603f71689fc0300aafe207aa4f 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: tables.h,v 1.1 2001/05/31 22:12:27 wd Exp $ */
+/* $Id$ */
 
 #ifndef TABLES_H
 #define TABLES_H
index 2607da9c390d2820959a9319d3e0079ccf182c88..7b1f3e73247437f284d7346c7521f851910bffd4 100644 (file)
 /* What is the oscillator's (UX2) frequency in Hz? */
 #define CONFIG_8260_CLKIN  (33 * 1000 * 1000)
 
-/* How is switch S2 set? We really only want the MODCK[1-3] bits, so
- * only the 3 least significant bits are important.
-*/
-#define CFG_SBC_S2  0x02
-
-/* What should MODCK_H be? It is dependent on the oscillator
+/*-----------------------------------------------------------------------
+ * MODCK_H & MODCLK[1-3] - Ref: Section 9.2 in MPC8206 User Manual
+ *-----------------------------------------------------------------------
+ * What should MODCK_H be? It is dependent on the oscillator
  * frequency, MODCK[1-3], and desired CPM and core frequencies.
- * Some example values (all frequencies are in MHz):
+ * Here are some example values (all frequencies are in MHz):
  *
- * MODCK_H   MODCK[1-3]  Osc    CPM    Core
- * 0x2       0x2         33     133    133
- * 0x2       0x4         33     133    200
- * 0x5       0x5         66     133    133
- * 0x5       0x7         66     133    200
+ * MODCK_H   MODCK[1-3]  Osc    CPM    Core  S2-6   S2-7   S2-8
+ * -------   ----------  ---    ---    ----  -----  -----  -----
+ * 0x2       0x2         33     133    133   Close  Open   Close
+ * 0x2       0x3         33     133    166   Close  Open   Open
+ * 0x2       0x4         33     133    200   Open   Close  Close
+ * 0x2       0x5         33     133    233   Open   Close  Open
+ * 0x2       0x6         33     133    266   Open   Open   Close
+ *
+ * 0x5       0x5         66     133    133   Open   Close  Open
+ * 0x5       0x6         66     133    166   Open   Open   Close
+ * 0x5       0x7         66     133    200   Open   Open   Open
+ * 0x6       0x0         66     133    233   Close  Close  Close
+ * 0x6       0x1         66     133    266   Close  Close  Open
+ * 0x6       0x2         66     133    300   Close  Open   Close
  */
 #define CFG_SBC_MODCK_H 0x02
 
 #define BOOTFLAG_WARM   0x02    /* Software reboot                   */
 
 #endif  /* __CONFIG_H */
-
-
index 1f74ebe539f4233200369ee8e5d8e8687a6d9e73..db32ad3b6bc33bdd23409c7fe0af3c58a59676ee 100644 (file)
@@ -24,6 +24,6 @@
 #ifndef        __VERSION_H__
 #define        __VERSION_H__
 
-#define        PPCBOOT_VERSION "PPCBoot 1.0.0-pre1"
+#define        PPCBOOT_VERSION "PPCBoot 1.0.0-pre2"
 
 #endif /* __VERSION_H__ */