Skip to contentSkip to conversation

ppc32: Allow for bigger compressed kernels

PATCH In review Tom Rini 4 participants 7 messages Nov 3, 2005 – Nov 5, 2005

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 ppc32: Allow for bigger compressed kernels

The ppc (not ppc64) boot loader (zimage wrapper) has a hard coded limit of 4 MB on the size of an uncompressed kernel it can boot. The boot loader has been changed to dynamically determine the largest possible kernel and support it. Relocating the boot loader to a higher address (currently located at 8 MB) will provide additional room.

arch/ppc/boot/simple/misc.c +53 -31
@@ -7,10 +7,10 @@
  * your serial console.  If a machine meets these requirements, it can quite
  * likely use this code during boot.
  *
- * Author: Matt Porter <[email protected]>
+ * Author: Tom Rini <[email protected]>
  * Derived from arch/ppc/boot/prep/misc.c
  *
- * 2001 (c) MontaVista, Software, Inc.  This file is licensed under
+ * 2001-2005 (c) MontaVista, Software, Inc.  This file is licensed under
  * the terms of the GNU General Public License version 2.  This program
  * is licensed "as is" without any warranty of any kind, whether express
  * or implied.
@@ -56,6 +56,11 @@
 #define INTERACTIVE_CONSOLE	1
 #endif
 
+#define	ONE_MB		(1 << 20)
+#define	MAX_BI_RECS	(8 * 1024)
+#define	MAX_AVAIL_MEM	(4 * ONE_MB)
+#define	RAM_RESERVE	(4 * ONE_MB)
+
 char *avail_ram;
 char *end_avail;
 char *zimage_start;
@@ -97,7 +102,8 @@ decompress_kernel(unsigned long load_add
 #endif
 	char *cp;
 	struct bi_record *rec;
-	unsigned long initrd_loc = 0, TotalMemory = 0;
+	unsigned long initrd_loc, TotalMemory;
+	unsigned long max_kernel, top_free;
 
 #if defined(CONFIG_SERIAL_8250_CONSOLE) || defined(CONFIG_SERIAL_MPSC_CONSOLE)
 	com_port = serial_init(0, NULL);
@@ -119,9 +125,6 @@ decompress_kernel(unsigned long load_add
 	 */
 	TotalMemory = get_mem_size();
 
-	/* assume the chunk below 8M is free */
-	end_avail = (char *)0x00800000;
-
 	/*
 	 * Reveal where we were loaded at and where we
 	 * were relocated to.
@@ -153,7 +156,6 @@ decompress_kernel(unsigned long load_add
 	 * The zImage and initrd will be between start and _end, so they've
 	 * already been moved once.  We're good to go now. -- Tom
 	 */
-	avail_ram = (char *)PAGE_ALIGN((unsigned long)_end);
 	puts("zimage at:     "); puthex((unsigned long)zimage_start);
 	puts(" "); puthex((unsigned long)(zimage_size+zimage_start));
 	puts("\n");
@@ -164,11 +166,51 @@ decompress_kernel(unsigned long load_add
 		puts(" "); puthex((unsigned long)(&__ramdisk_end));puts("\n");
 	}
 
-	avail_ram = (char *)0x00400000;
-	end_avail = (char *)0x00800000;
+	/*
+	 * If there is sufficent memory move the available RAM area after
+	 * the zImage (but stay away from the top of RAM). Otherwise fudge
+	 * it to fit in below the zImage as it did in the past.
+	 */
+
+	top_free = _ALIGN((unsigned long)(_end) + ONE_MB - 1, ONE_MB);
+
+	if ((TotalMemory != 0) &&
+		((top_free + MAX_AVAIL_MEM + RAM_RESERVE) < TotalMemory)) {
+		avail_ram = (char *) top_free;
+
+		/*
+		 * We're linked in the middle of RAM and the kernel starts
+		 * at zero. This means that the kernel must fit between
+		 * zero and our starting address. Figure out the highest
+		 * address below this that will allow a complete
+		 * uncompressed kernel and bi_recs to fit - the maximum
+		 * kernel size.
+		 */
+
+		max_kernel = (unsigned long) &start;
+
+		while (1) {
+			avail_ram = (char *) bootinfo_addr(max_kernel);
+
+			if ((avail_ram + MAX_BI_RECS) < ((char *) &start))
+				break;
+
+			max_kernel -= MAX_BI_RECS;
+		}
+	}
+	else {
+		max_kernel = ((unsigned long) &start) - MAX_AVAIL_MEM;
+		avail_ram = max_kernel;
+	}
+
+	end_avail = avail_ram + MAX_AVAIL_MEM;
+
 	puts("avail ram:     "); puthex((unsigned long)avail_ram); puts(" ");
 	puthex((unsigned long)end_avail); puts("\n");
 
+	/* Document the limitation */
+	puts("max kernel:    "); puthex(max_kernel); puts("\n");
+
 	if (keyb_present)
 		CRT_tstc();  /* Forces keyboard to be initialized */
 #ifdef CONFIG_GEMINI
@@ -222,32 +264,12 @@ decompress_kernel(unsigned long load_add
 	puts("\n");
 
 	puts("Uncompressing Linux...");
-	gunzip(NULL, 0x400000, zimage_start, &zimage_size);
+	gunzip(NULL, max_kernel, zimage_start, &zimage_size);
 	puts("done.\n");
 
 	/* get the bi_rec address */
 	rec = bootinfo_addr(zimage_size);
 
-	/* We need to make sure that the initrd and bi_recs do not
-	 * overlap. */
-	if ( initrd_size ) {
-		unsigned long rec_loc = (unsigned long) rec;
-		initrd_loc = (unsigned long)(&__ramdisk_begin);
-		/* If the bi_recs are in the middle of the current
-		 * initrd, move the initrd to the next MB
-		 * boundary. */
-		if ((rec_loc > initrd_loc) &&
-				((initrd_loc + initrd_size) > rec_loc)) {
-			initrd_loc = _ALIGN((unsigned long)(zimage_size)
-					+ (2 << 20) - 1, (2 << 20));
-		 	memmove((void *)initrd_loc, &__ramdisk_begin,
-				 initrd_size);
-	         	puts("initrd moved:  "); puthex(initrd_loc);
-		 	puts(" "); puthex(initrd_loc + initrd_size);
-		 	puts("\n");
-		}
-	}
-
 	bootinfo_init(rec);
 	if ( TotalMemory )
 		bootinfo_append(BI_MEMSIZE, sizeof(int), (void*)&TotalMemory);
@@ -258,7 +280,7 @@ decompress_kernel(unsigned long load_add
 	if (initrd_size) {
 		unsigned long initrd[2];
 
-		initrd[0] = initrd_loc;
+		initrd[0] = (unsigned long)(&__ramdisk_begin);
 		initrd[1] = initrd_size;
 
 		bootinfo_append(BI_INITRD, sizeof(initrd), &initrd);
Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#1 lore raw

arch/ppc/boot/simple/misc.c line 11

Quoted 9 lines · Tom Rini
arch/ppc/boot/simple/misc.c +1 -1
@@ -7,10 +7,10 @@
  * your serial console.  If a machine meets these requirements, it can quite
  * likely use this code during boot.
  *
- * Author: Matt Porter <[email protected]>
+ * Author: Tom Rini <[email protected]>
  * Derived from arch/ppc/boot/prep/misc.c

I understand adding authors to a file when code is added, but why should author credit be removed?

-Olof

author
#2 lore raw
Quoted 14 lines · Olof Johansson

arch/ppc/boot/simple/misc.c line 11

Quoted 9 lines · Tom Rini
arch/ppc/boot/simple/misc.c +1 -1
@@ -7,10 +7,10 @@
  * your serial console.  If a machine meets these requirements, it can quite
  * likely use this code during boot.
  *
- * Author: Matt Porter <[email protected]>
+ * Author: Tom Rini <[email protected]>
  * Derived from arch/ppc/boot/prep/misc.c

I understand adding authors to a file when code is added, but why should author credit be removed?

It wasn't Matt's code really. I know he did the 44x EMAC fixes, but other than that it was my code, heavily cribbed from all of the old per-board bootwrappers, that were cribbed from the prep one.

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#3 lore raw
Quoted 16 lines · Tom Rini
Quoted 14 lines · Olof Johansson

arch/ppc/boot/simple/misc.c line 11

Quoted 9 lines · Tom Rini
arch/ppc/boot/simple/misc.c +1 -1
@@ -7,10 +7,10 @@
  * your serial console.  If a machine meets these requirements, it can quite
  * likely use this code during boot.
  *
- * Author: Matt Porter <[email protected]>
+ * Author: Tom Rini <[email protected]>
  * Derived from arch/ppc/boot/prep/misc.c

I understand adding authors to a file when code is added, but why should author credit be removed?

Quoted 3 lines

It wasn't Matt's code really. I know he did the 44x EMAC fixes, but other than that it was my code, heavily cribbed from all of the old per-board bootwrappers, that were cribbed from the prep one.

Yes, I think what happened was that when you rewrote the arch/ppc/boot/ stuff, you started with the a version of the file I had written for one of my platforms which is where my name came to stick in there. The details are hazy in my memory as to how I came to be the "sole author" of this code. :) In any case, I think having you attributed as the author of this stuff is appropriate and I can be removed.

-Matt

#4 lore raw
In reply to Tom Rini
Quoted 7 lines · Tom Rini

The ppc (not ppc64) boot loader (zimage wrapper) has a hard coded limit of 4 MB on the size of an uncompressed kernel it can boot. The boot loader has been changed to dynamically determine the largest possible kernel and support it. Relocating the boot loader to a higher address (currently located at 8 MB) will provide additional room.

I'm getting an unpleasant reject here from Matt's ppc32-cleanup-amcc-ppc40x-eval-boards-to-support-u-boot.patch. In decompress_kernel he has added this ifdef:

@@ -164,7 +172,9 @@ decompress_kernel(unsigned long load_add
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");

Which would appear to leave avail_ram at zero on CONFIG_40x. There's no mention in the changelog that this was the intent, so I dunno what's going on.

But your change does appear to conflict in intent with Matt's patch (below), so... help!

Quoted 147 lines
arch/ppc/boot/simple/misc.c +52 -30
@@ -7,10 +7,10 @@
  * your serial console.  If a machine meets these requirements, it can quite
  * likely use this code during boot.
  *
- * Author: Matt Porter <[email protected]>
+ * Author: Tom Rini <[email protected]>
  * Derived from arch/ppc/boot/prep/misc.c
  *
- * 2001 (c) MontaVista, Software, Inc.  This file is licensed under
+ * 2001-2005 (c) MontaVista, Software, Inc.  This file is licensed under
  * the terms of the GNU General Public License version 2.  This program
  * is licensed "as is" without any warranty of any kind, whether express
  * or implied.
@@ -56,6 +56,11 @@
 #define INTERACTIVE_CONSOLE	1
 #endif
 
+#define	ONE_MB		(1 << 20)
+#define	MAX_BI_RECS	(8 * 1024)
+#define	MAX_AVAIL_MEM	(4 * ONE_MB)
+#define	RAM_RESERVE	(4 * ONE_MB)
+
 char *avail_ram;
 char *end_avail;
 char *zimage_start;
@@ -97,7 +102,8 @@ decompress_kernel(unsigned long load_add
 #endif
 	char *cp;
 	struct bi_record *rec;
-	unsigned long initrd_loc = 0, TotalMemory = 0;
+	unsigned long initrd_loc, TotalMemory;
+	unsigned long max_kernel, top_free;
 
 #if defined(CONFIG_SERIAL_8250_CONSOLE) || defined(CONFIG_SERIAL_MPSC_CONSOLE)
 	com_port = serial_init(0, NULL);
@@ -119,9 +125,6 @@ decompress_kernel(unsigned long load_add
 	 */
 	TotalMemory = get_mem_size();
 
-	/* assume the chunk below 8M is free */
-	end_avail = (char *)0x00800000;
-
 	/*
 	 * Reveal where we were loaded at and where we
 	 * were relocated to.
@@ -153,7 +156,6 @@ decompress_kernel(unsigned long load_add
 	 * The zImage and initrd will be between start and _end, so they've
 	 * already been moved once.  We're good to go now. -- Tom
 	 */
-	avail_ram = (char *)PAGE_ALIGN((unsigned long)_end);
 	puts("zimage at:     "); puthex((unsigned long)zimage_start);
 	puts(" "); puthex((unsigned long)(zimage_size+zimage_start));
 	puts("\n");
@@ -164,11 +166,51 @@ decompress_kernel(unsigned long load_add
 		puts(" "); puthex((unsigned long)(&__ramdisk_end));puts("\n");
 	}
 
-	avail_ram = (char *)0x00400000;
-	end_avail = (char *)0x00800000;
+	/*
+	 * If there is sufficent memory move the available RAM area after
+	 * the zImage (but stay away from the top of RAM). Otherwise fudge
+	 * it to fit in below the zImage as it did in the past.
+	 */
+
+	top_free = _ALIGN((unsigned long)(_end) + ONE_MB - 1, ONE_MB);
+
+	if ((TotalMemory != 0) &&
+		((top_free + MAX_AVAIL_MEM + RAM_RESERVE) < TotalMemory)) {
+		avail_ram = (char *) top_free;
+
+		/*
+		 * We're linked in the middle of RAM and the kernel starts
+		 * at zero. This means that the kernel must fit between
+		 * zero and our starting address. Figure out the highest
+		 * address below this that will allow a complete
+		 * uncompressed kernel and bi_recs to fit - the maximum
+		 * kernel size.
+		 */
+
+		max_kernel = (unsigned long) &start;
+
+		while (1) {
+			avail_ram = (char *) bootinfo_addr(max_kernel);
+
+			if ((avail_ram + MAX_BI_RECS) < ((char *) &start))
+				break;
+
+			max_kernel -= MAX_BI_RECS;
+		}
+	}
+	else {
+		max_kernel = ((unsigned long) &start) - MAX_AVAIL_MEM;
+		avail_ram = max_kernel;
+	}
+
+	end_avail = avail_ram + MAX_AVAIL_MEM;
+
 	puts("avail ram:     "); puthex((unsigned long)avail_ram); puts(" ");
 	puthex((unsigned long)end_avail); puts("\n");
 
+	/* Document the limitation */
+	puts("max kernel:    "); puthex(max_kernel); puts("\n");
+
 	if (keyb_present)
 		CRT_tstc();  /* Forces keyboard to be initialized */
 #ifdef CONFIG_GEMINI
@@ -222,32 +264,12 @@ decompress_kernel(unsigned long load_add
 	puts("\n");
 
 	puts("Uncompressing Linux...");
-	gunzip(NULL, 0x400000, zimage_start, &zimage_size);
+	gunzip(NULL, max_kernel, zimage_start, &zimage_size);
 	puts("done.\n");
 
 	/* get the bi_rec address */
 	rec = bootinfo_addr(zimage_size);
 
-	/* We need to make sure that the initrd and bi_recs do not
-	 * overlap. */
-	if ( initrd_size ) {
-		unsigned long rec_loc = (unsigned long) rec;
-		initrd_loc = (unsigned long)(&__ramdisk_begin);
-		/* If the bi_recs are in the middle of the current
-		 * initrd, move the initrd to the next MB
-		 * boundary. */
-		if ((rec_loc > initrd_loc) &&
-				((initrd_loc + initrd_size) > rec_loc)) {
-			initrd_loc = _ALIGN((unsigned long)(zimage_size)
-					+ (2 << 20) - 1, (2 << 20));
-		 	memmove((void *)initrd_loc, &__ramdisk_begin,
-				 initrd_size);
-	         	puts("initrd moved:  "); puthex(initrd_loc);
-		 	puts(" "); puthex(initrd_loc + initrd_size);
-		 	puts("\n");
-		}
-	}
-
 	bootinfo_init(rec);
 	if ( TotalMemory )
 		bootinfo_append(BI_MEMSIZE, sizeof(int), (void*)&TotalMemory);

arch/ppc/boot/simple/misc.c decompress_kernel(unsigned long load_add · line 286

Quoted 8 lines
arch/ppc/boot/simple/misc.c +1 -1
@@ -258,7 +280,7 @@ decompress_kernel(unsigned long load_add
 	if (initrd_size) {
 		unsigned long initrd[2];
 
-		initrd[0] = initrd_loc;
+		initrd[0] = (unsigned long)(&__ramdisk_begin);
 		initrd[1] = initrd_size;
 
 		bootinfo_append(BI_INITRD, sizeof(initrd), &initrd);

From: Matt Porter <[email protected]>

Cleanup PPC40x eval boards (bubinga, walnut and sycamore) to support U-Boot as bootloader. The OpenBIOS bd_info struct is not used in the kernel anymore (only U-Boot now).

uImage (U-Boot) tested on walnut, sycamore and bubinga zImage (OpenBIOS) tested on sycamore, bubinga and ebony

---

 arch/ppc/boot/simple/Makefile     |   21 +++++++
 arch/ppc/boot/simple/misc.c       |   16 ++++-
 arch/ppc/boot/simple/openbios.c   |  106 +++++++++++++++++++++++++++++++++++---
 arch/ppc/platforms/4xx/Kconfig    |    2 
 arch/ppc/platforms/4xx/bubinga.c  |    2 
 arch/ppc/platforms/4xx/bubinga.h  |   64 +++++++++-------------
 arch/ppc/platforms/4xx/ebony.h    |    4 -
 arch/ppc/platforms/4xx/sycamore.c |    7 --
 arch/ppc/platforms/4xx/sycamore.h |   67 +++++++++---------------
 arch/ppc/platforms/4xx/walnut.c   |    2 
 arch/ppc/platforms/4xx/walnut.h   |   67 ++++++++----------------
 include/asm-ppc/ibm_ocp.h         |   19 +++++-
 include/asm-ppc/ppcboot.h         |    6 +-
 13 files changed, 237 insertions(+), 146 deletions(-)
arch/ppc/boot/simple/Makefile renamed from arch/ppc/boot/simple/Makefile~ppc32-cleanup-amcc-ppc40x-eval-boards-to-support-u-boot +20 -1
diff -puN arch/ppc/boot/simple/Makefile~ppc32-cleanup-amcc-ppc40x-eval-boards-to-support-u-boot arch/ppc/boot/simple/Makefile
@@ -67,6 +67,12 @@ zimageinitrd-$(CONFIG_BAMBOO)		:= zImage
   entrypoint-$(CONFIG_BAMBOO)		:= 0x01000000
      extra.o-$(CONFIG_BAMBOO)		:= pibs.o
 
+      zimage-$(CONFIG_BUBINGA)		:= zImage-TREE
+zimageinitrd-$(CONFIG_BUBINGA)		:= zImage.initrd-TREE
+         end-$(CONFIG_BUBINGA)		:= bubinga
+  entrypoint-$(CONFIG_BUBINGA)		:= 0x01000000
+     extra.o-$(CONFIG_BUBINGA)		:= openbios.o
+
       zimage-$(CONFIG_EBONY)		:= zImage-TREE
 zimageinitrd-$(CONFIG_EBONY)		:= zImage.initrd-TREE
          end-$(CONFIG_EBONY)		:= ebony
@@ -91,6 +97,18 @@ zimageinitrd-$(CONFIG_OCOTEA)		:= zImage
   entrypoint-$(CONFIG_OCOTEA)		:= 0x01000000
      extra.o-$(CONFIG_OCOTEA)		:= pibs.o
 
+      zimage-$(CONFIG_SYCAMORE)		:= zImage-TREE
+zimageinitrd-$(CONFIG_SYCAMORE)		:= zImage.initrd-TREE
+         end-$(CONFIG_SYCAMORE)		:= sycamore
+  entrypoint-$(CONFIG_SYCAMORE)		:= 0x01000000
+     extra.o-$(CONFIG_SYCAMORE)		:= openbios.o
+
+      zimage-$(CONFIG_WALNUT)		:= zImage-TREE
+zimageinitrd-$(CONFIG_WALNUT)		:= zImage.initrd-TREE
+         end-$(CONFIG_WALNUT)		:= walnut
+  entrypoint-$(CONFIG_WALNUT)		:= 0x01000000
+     extra.o-$(CONFIG_WALNUT)		:= openbios.o
+
      extra.o-$(CONFIG_EV64260)		:= misc-ev64260.o
          end-$(CONFIG_EV64260)		:= ev64260
    cacheflag-$(CONFIG_EV64260)		:= -include $(clear_L2_L3)
@@ -168,7 +186,8 @@ OBJCOPY_ARGS			:= -O elf32-powerpc
 
 # head.o and relocate.o must be at the start.
 boot-y				:= head.o relocate.o $(extra.o-y) $(misc-y)
-boot-$(CONFIG_40x)		+= embed_config.o
+boot-$(CONFIG_REDWOOD_5)	+= embed_config.o
+boot-$(CONFIG_REDWOOD_6)	+= embed_config.o
 boot-$(CONFIG_8xx)		+= embed_config.o
 boot-$(CONFIG_8260)		+= embed_config.o
 boot-$(CONFIG_BSEIP)		+= iic.o
arch/ppc/boot/simple/misc.c renamed from arch/ppc/boot/simple/misc.c~ppc32-cleanup-amcc-ppc40x-eval-boards-to-support-u-boot +13 -3
diff -puN arch/ppc/boot/simple/misc.c~ppc32-cleanup-amcc-ppc40x-eval-boards-to-support-u-boot arch/ppc/boot/simple/misc.c
@@ -23,7 +23,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 +88,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 +111,13 @@ decompress_kernel(unsigned long load_add
 	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 +172,9 @@ decompress_kernel(unsigned long load_add
 		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");
arch/ppc/boot/simple/openbios.c renamed from arch/ppc/boot/simple/openbios.c~ppc32-cleanup-amcc-ppc40x-eval-boards-to-support-u-boot +100 -6

134 lines not on this page · raw message

arch/ppc/platforms/4xx/bubinga.c renamed from arch/ppc/platforms/4xx/bubinga.c~ppc32-cleanup-amcc-ppc40x-eval-boards-to-support-u-boot +1 -1
diff -puN arch/ppc/platforms/4xx/bubinga.c~ppc32-cleanup-amcc-ppc40x-eval-boards-to-support-u-boot arch/ppc/platforms/4xx/bubinga.c
@@ -89,7 +89,7 @@ bubinga_early_serial_map(void)
           * by 16.
           */
 	uart_div = (mfdcr(DCRN_CPC0_UCR_BASE) & DCRN_CPC0_UCR_U0DIV);
-	uart_clock = __res.bi_pllouta_freq / uart_div;
+	uart_clock = __res.bi_procfreq / uart_div;
 
 	/* Setup serial port access */
 	memset(&port, 0, sizeof(port));
arch/ppc/platforms/4xx/bubinga.h renamed from arch/ppc/platforms/4xx/bubinga.h~ppc32-cleanup-amcc-ppc40x-eval-boards-to-support-u-boot +26 -38

90 lines not on this page · raw message

arch/ppc/platforms/4xx/ebony.h renamed from arch/ppc/platforms/4xx/ebony.h~ppc32-cleanup-amcc-ppc40x-eval-boards-to-support-u-boot +2 -2
diff -puN arch/ppc/platforms/4xx/ebony.h~ppc32-cleanup-amcc-ppc40x-eval-boards-to-support-u-boot arch/ppc/platforms/4xx/ebony.h
@@ -24,8 +24,8 @@
 #define PPC44x_EMAC0_MR0	0xE0000800
 
 /* Where to find the MAC info */
-#define EBONY_OPENBIOS_MAC_BASE   0xfffffe0c
-#define EBONY_OPENBIOS_MAC_OFFSET 0x0c
+#define OPENBIOS_MAC_BASE	0xfffffe0c
+#define OPENBIOS_MAC_OFFSET	0x0c
 
 /* Default clock rates for Rev. B and Rev. C silicon */
 #define EBONY_440GP_RB_SYSCLK	33000000
arch/ppc/platforms/4xx/Kconfig renamed from arch/ppc/platforms/4xx/Kconfig~ppc32-cleanup-amcc-ppc40x-eval-boards-to-support-u-boot +1 -1
diff -puN arch/ppc/platforms/4xx/Kconfig~ppc32-cleanup-amcc-ppc40x-eval-boards-to-support-u-boot arch/ppc/platforms/4xx/Kconfig
@@ -225,7 +225,7 @@ config EMBEDDEDBOOT
 
 config IBM_OPENBIOS
 	bool
-	depends on ASH || BUBINGA || REDWOOD_5 || REDWOOD_6 || SYCAMORE || WALNUT
+	depends on ASH || REDWOOD_5 || REDWOOD_6
 	default y
 
 config PPC4xx_DMA
arch/ppc/platforms/4xx/sycamore.c renamed from arch/ppc/platforms/4xx/sycamore.c~ppc32-cleanup-amcc-ppc40x-eval-boards-to-support-u-boot +2 -5
diff -puN arch/ppc/platforms/4xx/sycamore.c~ppc32-cleanup-amcc-ppc40x-eval-boards-to-support-u-boot arch/ppc/platforms/4xx/sycamore.c
@@ -88,9 +88,6 @@ ppc405_map_irq(struct pci_dev *dev, unsi
 void __init
 sycamore_setup_arch(void)
 {
-#define SYCAMORE_PS2_BASE	0xF0100000
-#define SYCAMORE_FPGA_BASE	0xF0300000
-
 	void *fpga_brdc;
 	unsigned char fpga_brdc_data;
 	void *fpga_enable;
@@ -100,7 +97,7 @@ sycamore_setup_arch(void)
 
 	ppc4xx_setup_arch();
 
-	ibm_ocp_set_emac(0, 1);
+	ibm_ocp_set_emac(0, 0);
 
 	kb_data = ioremap(SYCAMORE_PS2_BASE, 8);
 	if (!kb_data) {
@@ -111,7 +108,7 @@ sycamore_setup_arch(void)
 
 	kb_cs = kb_data + 1;
 
-	fpga_status = ioremap(SYCAMORE_FPGA_BASE, 8);
+	fpga_status = ioremap(PPC40x_FPGA_BASE, 8);
 	if (!fpga_status) {
 		printk(KERN_CRIT
 		       "sycamore_setup_arch() fpga_status ioremap failed\n");
arch/ppc/platforms/4xx/sycamore.h renamed from arch/ppc/platforms/4xx/sycamore.h~ppc32-cleanup-amcc-ppc40x-eval-boards-to-support-u-boot +26 -41

93 lines not on this page · raw message

arch/ppc/platforms/4xx/walnut.c renamed from arch/ppc/platforms/4xx/walnut.c~ppc32-cleanup-amcc-ppc40x-eval-boards-to-support-u-boot +1 -1
diff -puN arch/ppc/platforms/4xx/walnut.c~ppc32-cleanup-amcc-ppc40x-eval-boards-to-support-u-boot arch/ppc/platforms/4xx/walnut.c
@@ -90,7 +90,7 @@ walnut_setup_arch(void)
 
 	kb_cs = kb_data + 1;
 
-	fpga_status = ioremap(WALNUT_FPGA_BASE, 8);
+	fpga_status = ioremap(PPC40x_FPGA_BASE, 8);
 	if (!fpga_status) {
 		printk(KERN_CRIT
 		       "walnut_setup_arch() fpga_status ioremap failed\n");
arch/ppc/platforms/4xx/walnut.h renamed from arch/ppc/platforms/4xx/walnut.h~ppc32-cleanup-amcc-ppc40x-eval-boards-to-support-u-boot +25 -42

97 lines not on this page · raw message

include/asm-ppc/ibm_ocp.h renamed from include/asm-ppc/ibm_ocp.h~ppc32-cleanup-amcc-ppc40x-eval-boards-to-support-u-boot +16 -3
diff -puN include/asm-ppc/ibm_ocp.h~ppc32-cleanup-amcc-ppc40x-eval-boards-to-support-u-boot include/asm-ppc/ibm_ocp.h
@@ -131,9 +131,22 @@ static inline void ibm_ocp_set_emac(int 
 	/* Copy MAC addresses to EMAC additions */
 	for (i=start; i<=end; i++) {
 		def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, i);
-		memcpy(((struct ocp_func_emac_data *)def->additions)->mac_addr,
-				&__res.bi_enetaddr[i],
-				6);
+		if (i == 0)
+			memcpy(((struct ocp_func_emac_data *)def->additions)->mac_addr,
+			       __res.bi_enetaddr, 6);
+#if defined(CONFIG_405EP) || defined(CONFIG_44x)
+		else if (i == 1)
+			memcpy(((struct ocp_func_emac_data *)def->additions)->mac_addr,
+			       __res.bi_enet1addr, 6);
+#endif
+#if defined(CONFIG_440GX)
+		else if (i == 2)
+			memcpy(((struct ocp_func_emac_data *)def->additions)->mac_addr,
+			       __res.bi_enet2addr, 6);
+		else if (i == 3)
+			memcpy(((struct ocp_func_emac_data *)def->additions)->mac_addr,
+			       __res.bi_enet3addr, 6);
+#endif
 	}
 }
 #endif
include/asm-ppc/ppcboot.h renamed from include/asm-ppc/ppcboot.h~ppc32-cleanup-amcc-ppc40x-eval-boards-to-support-u-boot +4 -2
diff -puN include/asm-ppc/ppcboot.h~ppc32-cleanup-amcc-ppc40x-eval-boards-to-support-u-boot include/asm-ppc/ppcboot.h
@@ -73,8 +73,8 @@ typedef struct bd_info {
 #if defined(CONFIG_HYMOD)
 	hymod_conf_t	bi_hymod_conf;	/* hymod configuration information */
 #endif
-#if defined(CONFIG_EVB64260) || defined(CONFIG_44x) || defined(CONFIG_85xx) ||\
-	defined(CONFIG_83xx)
+#if defined(CONFIG_EVB64260) || defined(CONFIG_405EP) || defined(CONFIG_44x) || \
+	defined(CONFIG_85xx) ||	defined(CONFIG_83xx)
 	/* second onboard ethernet port */
 	unsigned char	bi_enet1addr[6];
 #endif
@@ -96,5 +96,7 @@ typedef struct bd_info {
 #endif
 } bd_t;
 
+#define bi_tbfreq	bi_intfreq
+
 #endif /* __ASSEMBLY__ */
 #endif	/* __ASM_PPCBOOT_H__ */

_

author
#5 lore raw
Quoted 25 lines · Andrew Morton
Quoted 7 lines · Tom Rini

The ppc (not ppc64) boot loader (zimage wrapper) has a hard coded limit of 4 MB on the size of an uncompressed kernel it can boot. The boot loader has been changed to dynamically determine the largest possible kernel and support it. Relocating the boot loader to a higher address (currently located at 8 MB) will provide additional room.

I'm getting an unpleasant reject here from Matt's ppc32-cleanup-amcc-ppc40x-eval-boards-to-support-u-boot.patch. In decompress_kernel he has added this ifdef:

arch/ppc/boot/simple/misc.c renamed from arch/ppc/boot/simple/misc.c~ppc32-cleanup-amcc-ppc40x-eval-boards-to-support-u-boot +2 -0
@@ -164,7 +172,9 @@ decompress_kernel(unsigned long load_add
 		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");
Quoted 3 lines

Which would appear to leave avail_ram at zero on CONFIG_40x. There's no mention in the changelog that this was the intent, so I dunno what's going on.

It's very confusing code, I'll agree, and it's not helped by a long-missing cleanup. Going back to
http://linux.bkbits.net:8080/linux-2.6/diffs/arch/ppc/boot/simple/[email protected]?nav=index.html|src/|src/arch/ppc/boot/simple/|hist/arch/ppc/boot/simple/misc.c
we got to the point of doing:
avail_ram = good aligned end of images value;
... do nothing to or with avail_ram ...
avail_ram = 4MB;

What Mark's patch does is get us to use and aligned value again. So if I read everything right we should just be able to drop that hunk of Matt's patch as we really won't be overwriting anyones image. If you throw out an interm tree somewhere hopefully Matt can do a quick boot test on some 4xx board (I unfortunaly don't have one).

Signature · 2 lines
Tom Rini
http://gate.crashing.org/~trini/
#6 lore raw
Quoted 4 lines · Tom Rini

If you
throw out an interm tree somewhere hopefully Matt can do a quick boot test on some 4xx board (I unfortunaly don't have one).

OK. I hope to have -mm1 out this weekend. An interim tree at present probably won't even vaguely compile. Sigh.