aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/boot/compressed/decompress.c38
1 files changed, 14 insertions, 24 deletions
diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c
index 5db43c58b1bf..5cad0faefa17 100644
--- a/arch/mips/boot/compressed/decompress.c
+++ b/arch/mips/boot/compressed/decompress.c
@@ -1,9 +1,6 @@
1/* 1/*
2 * Misc. bootloader code for many machines.
3 *
4 * Copyright 2001 MontaVista Software Inc. 2 * Copyright 2001 MontaVista Software Inc.
5 * Author: Matt Porter <mporter@mvista.com> Derived from 3 * Author: Matt Porter <mporter@mvista.com>
6 * arch/ppc/boot/prep/misc.c
7 * 4 *
8 * Copyright (C) 2009 Lemote, Inc. 5 * Copyright (C) 2009 Lemote, Inc.
9 * Author: Wu Zhangjin <wuzhangjin@gmail.com> 6 * Author: Wu Zhangjin <wuzhangjin@gmail.com>
@@ -19,12 +16,12 @@
19 16
20#include <asm/addrspace.h> 17#include <asm/addrspace.h>
21 18
22/* These two variables specify the free mem region 19/*
20 * These two variables specify the free mem region
23 * that can be used for temporary malloc area 21 * that can be used for temporary malloc area
24 */ 22 */
25unsigned long free_mem_ptr; 23unsigned long free_mem_ptr;
26unsigned long free_mem_end_ptr; 24unsigned long free_mem_end_ptr;
27char *zimage_start;
28 25
29/* The linker tells us where the image is. */ 26/* The linker tells us where the image is. */
30extern unsigned char __image_begin, __image_end; 27extern unsigned char __image_begin, __image_end;
@@ -83,38 +80,31 @@ void *memset(void *s, int c, size_t n)
83 80
84void decompress_kernel(unsigned long boot_heap_start) 81void decompress_kernel(unsigned long boot_heap_start)
85{ 82{
86 int zimage_size; 83 unsigned long zimage_start, zimage_size;
87 84
88 /* 85 zimage_start = (unsigned long)(&__image_begin);
89 * We link ourself to an arbitrary low address. When we run, we
90 * relocate outself to that address. __image_beign points to
91 * the part of the image where the zImage is. -- Tom
92 */
93 zimage_start = (char *)(unsigned long)(&__image_begin);
94 zimage_size = (unsigned long)(&__image_end) - 86 zimage_size = (unsigned long)(&__image_end) -
95 (unsigned long)(&__image_begin); 87 (unsigned long)(&__image_begin);
96 88
97 /*
98 * The zImage and initrd will be between start and _end, so they've
99 * already been moved once. We're good to go now. -- Tom
100 */
101 puts("zimage at: "); 89 puts("zimage at: ");
102 puthex((unsigned long)zimage_start); 90 puthex(zimage_start);
103 puts(" "); 91 puts(" ");
104 puthex((unsigned long)(zimage_size + zimage_start)); 92 puthex(zimage_size + zimage_start);
105 puts("\n"); 93 puts("\n");
106 94
107 /* this area are prepared for mallocing when decompressing */ 95 /* This area are prepared for mallocing when decompressing */
108 free_mem_ptr = boot_heap_start; 96 free_mem_ptr = boot_heap_start;
109 free_mem_end_ptr = boot_heap_start + BOOT_HEAP_SIZE; 97 free_mem_end_ptr = boot_heap_start + BOOT_HEAP_SIZE;
110 98
111 /* Display standard Linux/MIPS boot prompt for kernel args */ 99 /* Display standard Linux/MIPS boot prompt */
112 puts("Uncompressing Linux at load address "); 100 puts("Uncompressing Linux at load address ");
113 puthex(VMLINUX_LOAD_ADDRESS_ULL); 101 puthex(VMLINUX_LOAD_ADDRESS_ULL);
114 puts("\n"); 102 puts("\n");
103
115 /* Decompress the kernel with according algorithm */ 104 /* Decompress the kernel with according algorithm */
116 decompress(zimage_start, zimage_size, 0, 0, 105 decompress((char *)zimage_start, zimage_size, 0, 0,
117 (void *)VMLINUX_LOAD_ADDRESS_ULL, 0, error); 106 (void *)VMLINUX_LOAD_ADDRESS_ULL, 0, error);
118 /* FIXME: is there a need to flush cache here? */ 107
108 /* FIXME: should we flush cache here? */
119 puts("Now, booting the kernel...\n"); 109 puts("Now, booting the kernel...\n");
120} 110}