]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/powerpc/boot/main.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart
[linux-2.6-omap-h63xx.git] / arch / powerpc / boot / main.c
index 64ec93116fa6cfb2d1eb6eed1578b80b61965487..816446f0e497a64dda37c15f27ce0b6e4560a698 100644 (file)
@@ -21,8 +21,8 @@ extern void flush_cache(void *, unsigned long);
 
 
 /* Value picked to match that used by yaboot */
-#define PROG_START     0x01400000
-#define RAM_END                (512<<20) // Fixme: use OF */
+#define PROG_START     0x01400000      /* only used on 64-bit systems */
+#define RAM_END                (512<<20)       /* Fixme: use OF */
 #define        ONE_MB          0x100000
 
 extern char _start[];
@@ -152,7 +152,7 @@ static int is_elf64(void *hdr)
        elf64ph = (Elf64_Phdr *)((unsigned long)elf64 +
                                 (unsigned long)elf64->e_phoff);
        for (i = 0; i < (unsigned int)elf64->e_phnum; i++, elf64ph++)
-               if (elf64ph->p_type == PT_LOAD && elf64ph->p_offset != 0)
+               if (elf64ph->p_type == PT_LOAD)
                        break;
        if (i >= (unsigned int)elf64->e_phnum)
                return 0;
@@ -160,6 +160,17 @@ static int is_elf64(void *hdr)
        elfoffset = (unsigned long)elf64ph->p_offset;
        vmlinux.size = (unsigned long)elf64ph->p_filesz + elfoffset;
        vmlinux.memsize = (unsigned long)elf64ph->p_memsz + elfoffset;
+
+#if defined(PROG_START)
+       /*
+        * Maintain a "magic" minimum address. This keeps some older
+        * firmware platforms running.
+        */
+
+       if (claim_base < PROG_START)
+               claim_base = PROG_START;
+#endif
+
        return 1;
 }
 
@@ -182,7 +193,7 @@ static int is_elf32(void *hdr)
        elf32 = (Elf32_Ehdr *)elfheader;
        elf32ph = (Elf32_Phdr *) ((unsigned long)elf32 + elf32->e_phoff);
        for (i = 0; i < elf32->e_phnum; i++, elf32ph++)
-               if (elf32ph->p_type == PT_LOAD && elf32ph->p_offset != 0)
+               if (elf32ph->p_type == PT_LOAD)
                        break;
        if (i >= elf32->e_phnum)
                return 0;
@@ -206,12 +217,18 @@ void start(unsigned long a1, unsigned long a2, void *promptr, void *sp)
                exit();
        if (getprop(chosen_handle, "stdout", &stdout, sizeof(stdout)) != 4)
                exit();
-       stderr = stdout;
-       if (getprop(chosen_handle, "stdin", &stdin, sizeof(stdin)) != 4)
-               exit();
 
        printf("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r", _start, sp);
 
+       /*
+        * The first available claim_base must be above the end of the
+        * the loaded kernel wrapper file (_start to _end includes the
+        * initrd image if it is present) and rounded up to a nice
+        * 1 MB boundary for good measure.
+        */
+
+       claim_base = _ALIGN_UP((unsigned long)_end, ONE_MB);
+
        vmlinuz.addr = (unsigned long)_vmlinux_start;
        vmlinuz.size = (unsigned long)(_vmlinux_end - _vmlinux_start);
 
@@ -228,25 +245,6 @@ void start(unsigned long a1, unsigned long a2, void *promptr, void *sp)
                exit();
        }
 
-       /*
-        * The first available claim_base must be above the end of the
-        * the loaded kernel wrapper file (_start to _end includes the
-        * initrd image if it is present) and rounded up to a nice
-        * 1 MB boundary for good measure.
-        */
-
-       claim_base = _ALIGN_UP((unsigned long)_end, ONE_MB);
-
-#if defined(PROG_START)
-       /*
-        * Maintain a "magic" minimum address. This keeps some older
-        * firmware platforms running.
-        */
-
-       if (claim_base < PROG_START)
-               claim_base = PROG_START;
-#endif
-
        /* We need to claim the memsize plus the file offset since gzip
         * will expand the header (file offset), then the kernel, then
         * possible rubbish we don't care about. But the kernel bss must