Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / arch / ppc / boot / simple / misc.c
index ab0f990..3d78571 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * arch/ppc/simple/misc.c
- *
  * Misc. bootloader code for many machines.  This assumes you have are using
  * a 6xx/7xx/74xx CPU in your machine.  This assumes the chunk of memory
  * below 8MB is free.  Finally, it assumes you have a NS16550-style uart for
@@ -23,7 +21,7 @@
 #include <asm/page.h>
 #include <asm/mmu.h>
 #include <asm/bootinfo.h>
-#ifdef CONFIG_44x
+#ifdef CONFIG_4xx
 #include <asm/ibm4xx.h>
 #endif
 #include <asm/reg.h>
@@ -88,6 +86,14 @@ get_mem_size(void)
        return 0;
 }
 
+#if defined(CONFIG_40x)
+#define PPC4xx_EMAC0_MR0       EMAC0_BASE
+#endif
+
+#if defined(CONFIG_44x) && defined(PPC44x_EMAC0_MR0)
+#define PPC4xx_EMAC0_MR0       PPC44x_EMAC0_MR0
+#endif
+
 struct bi_record *
 decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum)
 {
@@ -103,13 +109,13 @@ decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum)
        com_port = serial_init(0, NULL);
 #endif
 
-#if defined(CONFIG_44x) && defined(PPC44x_EMAC0_MR0)
+#if defined(PPC4xx_EMAC0_MR0)
        /* Reset MAL */
        mtdcr(DCRN_MALCR(DCRN_MAL_BASE), MALCR_MMSR);
        /* Wait for reset */
        while (mfdcr(DCRN_MALCR(DCRN_MAL_BASE)) & MALCR_MMSR) {};
        /* Reset EMAC */
-       *(volatile unsigned long *)PPC44x_EMAC0_MR0 = 0x20000000;
+       *(volatile unsigned long *)PPC4xx_EMAC0_MR0 = 0x20000000;
        __asm__ __volatile__("eieio");
 #endif
 
@@ -164,7 +170,9 @@ decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum)
                puts(" "); puthex((unsigned long)(&__ramdisk_end));puts("\n");
        }
 
+#ifndef CONFIG_40x /* don't overwrite the 40x image located at 0x00400000! */
        avail_ram = (char *)0x00400000;
+#endif
        end_avail = (char *)0x00800000;
        puts("avail ram:     "); puthex((unsigned long)avail_ram); puts(" ");
        puthex((unsigned long)end_avail); puts("\n");
@@ -222,7 +230,7 @@ decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum)
        puts("\n");
 
        puts("Uncompressing Linux...");
-       gunzip(0x0, 0x400000, zimage_start, &zimage_size);
+       gunzip(NULL, 0x400000, zimage_start, &zimage_size);
        puts("done.\n");
 
        /* get the bi_rec address */