diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/sh64/boot |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/sh64/boot')
-rw-r--r-- | arch/sh64/boot/Makefile | 20 | ||||
-rw-r--r-- | arch/sh64/boot/compressed/Makefile | 46 | ||||
-rw-r--r-- | arch/sh64/boot/compressed/cache.c | 39 | ||||
-rw-r--r-- | arch/sh64/boot/compressed/head.S | 164 | ||||
-rw-r--r-- | arch/sh64/boot/compressed/install.sh | 56 | ||||
-rw-r--r-- | arch/sh64/boot/compressed/misc.c | 251 | ||||
-rw-r--r-- | arch/sh64/boot/compressed/vmlinux.lds.S | 65 |
7 files changed, 641 insertions, 0 deletions
diff --git a/arch/sh64/boot/Makefile b/arch/sh64/boot/Makefile new file mode 100644 index 000000000000..fb71087b7b8a --- /dev/null +++ b/arch/sh64/boot/Makefile | |||
@@ -0,0 +1,20 @@ | |||
1 | # | ||
2 | # arch/sh64/boot/Makefile | ||
3 | # | ||
4 | # This file is subject to the terms and conditions of the GNU General Public | ||
5 | # License. See the file "COPYING" in the main directory of this archive | ||
6 | # for more details. | ||
7 | # | ||
8 | # Copyright (C) 2002 Stuart Menefy | ||
9 | # | ||
10 | |||
11 | targets := zImage | ||
12 | subdir- := compressed | ||
13 | |||
14 | $(obj)/zImage: $(obj)/compressed/vmlinux FORCE | ||
15 | $(call if_changed,objcopy) | ||
16 | @echo 'Kernel: $@ is ready' | ||
17 | |||
18 | $(obj)/compressed/vmlinux: FORCE | ||
19 | $(Q)$(MAKE) $(build)=$(obj)/compressed $@ | ||
20 | |||
diff --git a/arch/sh64/boot/compressed/Makefile b/arch/sh64/boot/compressed/Makefile new file mode 100644 index 000000000000..9cd216718856 --- /dev/null +++ b/arch/sh64/boot/compressed/Makefile | |||
@@ -0,0 +1,46 @@ | |||
1 | # | ||
2 | # linux/arch/sh64/boot/compressed/Makefile | ||
3 | # | ||
4 | # This file is subject to the terms and conditions of the GNU General Public | ||
5 | # License. See the file "COPYING" in the main directory of this archive | ||
6 | # for more details. | ||
7 | # | ||
8 | # Copyright (C) 2002 Stuart Menefy | ||
9 | # Copyright (C) 2004 Paul Mundt | ||
10 | # | ||
11 | # create a compressed vmlinux image from the original vmlinux | ||
12 | # | ||
13 | |||
14 | targets := vmlinux vmlinux.bin vmlinux.bin.gz \ | ||
15 | head.o misc.o cache.o piggy.o vmlinux.lds | ||
16 | |||
17 | EXTRA_AFLAGS := -traditional | ||
18 | |||
19 | OBJECTS := $(obj)/head.o $(obj)/misc.o $(obj)/cache.o | ||
20 | |||
21 | # | ||
22 | # ZIMAGE_OFFSET is the load offset of the compression loader | ||
23 | # (4M for the kernel plus 64K for this loader) | ||
24 | # | ||
25 | ZIMAGE_OFFSET = $(shell printf "0x%8x" $$[$(CONFIG_MEMORY_START)+0x400000+0x10000]) | ||
26 | |||
27 | LDFLAGS_vmlinux := -Ttext $(ZIMAGE_OFFSET) -e startup \ | ||
28 | -T $(obj)/../../kernel/vmlinux.lds \ | ||
29 | --no-warn-mismatch | ||
30 | |||
31 | $(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o FORCE | ||
32 | $(call if_changed,ld) | ||
33 | @: | ||
34 | |||
35 | $(obj)/vmlinux.bin: vmlinux FORCE | ||
36 | $(call if_changed,objcopy) | ||
37 | |||
38 | $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE | ||
39 | $(call if_changed,gzip) | ||
40 | |||
41 | LDFLAGS_piggy.o := -r --format binary --oformat elf32-sh64-linux -T | ||
42 | OBJCOPYFLAGS += -R .empty_zero_page | ||
43 | |||
44 | $(obj)/piggy.o: $(obj)/vmlinux.lds $(obj)/vmlinux.bin.gz FORCE | ||
45 | $(call if_changed,ld) | ||
46 | |||
diff --git a/arch/sh64/boot/compressed/cache.c b/arch/sh64/boot/compressed/cache.c new file mode 100644 index 000000000000..708707355ffa --- /dev/null +++ b/arch/sh64/boot/compressed/cache.c | |||
@@ -0,0 +1,39 @@ | |||
1 | /* | ||
2 | * arch/shmedia/boot/compressed/cache.c -- simple cache management functions | ||
3 | * | ||
4 | * Code extracted from sh-ipl+g, sh-stub.c, which has the copyright: | ||
5 | * | ||
6 | * This is originally based on an m68k software stub written by Glenn | ||
7 | * Engel at HP, but has changed quite a bit. | ||
8 | * | ||
9 | * Modifications for the SH by Ben Lee and Steve Chamberlain | ||
10 | * | ||
11 | **************************************************************************** | ||
12 | |||
13 | THIS SOFTWARE IS NOT COPYRIGHTED | ||
14 | |||
15 | HP offers the following for use in the public domain. HP makes no | ||
16 | warranty with regard to the software or it's performance and the | ||
17 | user accepts the software "AS IS" with all faults. | ||
18 | |||
19 | HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD | ||
20 | TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
21 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
22 | |||
23 | ****************************************************************************/ | ||
24 | |||
25 | #define CACHE_ENABLE 0 | ||
26 | #define CACHE_DISABLE 1 | ||
27 | |||
28 | int cache_control(unsigned int command) | ||
29 | { | ||
30 | volatile unsigned int *p = (volatile unsigned int *) 0x80000000; | ||
31 | int i; | ||
32 | |||
33 | for (i = 0; i < (32 * 1024); i += 32) { | ||
34 | (void *) *p; | ||
35 | p += (32 / sizeof (int)); | ||
36 | } | ||
37 | |||
38 | return 0; | ||
39 | } | ||
diff --git a/arch/sh64/boot/compressed/head.S b/arch/sh64/boot/compressed/head.S new file mode 100644 index 000000000000..82040b1a29cf --- /dev/null +++ b/arch/sh64/boot/compressed/head.S | |||
@@ -0,0 +1,164 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * arch/shmedia/boot/compressed/head.S | ||
7 | * | ||
8 | * Copied from | ||
9 | * arch/shmedia/kernel/head.S | ||
10 | * which carried the copyright: | ||
11 | * Copyright (C) 2000, 2001 Paolo Alberelli | ||
12 | * | ||
13 | * Modification for compressed loader: | ||
14 | * Copyright (C) 2002 Stuart Menefy (stuart.menefy@st.com) | ||
15 | */ | ||
16 | |||
17 | #include <linux/linkage.h> | ||
18 | #include <asm/registers.h> | ||
19 | #include <asm/cache.h> | ||
20 | #include <asm/mmu_context.h> | ||
21 | |||
22 | /* | ||
23 | * Fixed TLB entries to identity map the beginning of RAM | ||
24 | */ | ||
25 | #define MMUIR_TEXT_H 0x0000000000000003 | CONFIG_MEMORY_START | ||
26 | /* Enabled, Shared, ASID 0, Eff. Add. 0xA0000000 */ | ||
27 | #define MMUIR_TEXT_L 0x000000000000009a | CONFIG_MEMORY_START | ||
28 | /* 512 Mb, Cacheable (Write-back), execute, Not User, Ph. Add. */ | ||
29 | |||
30 | #define MMUDR_CACHED_H 0x0000000000000003 | CONFIG_MEMORY_START | ||
31 | /* Enabled, Shared, ASID 0, Eff. Add. 0xA0000000 */ | ||
32 | #define MMUDR_CACHED_L 0x000000000000015a | CONFIG_MEMORY_START | ||
33 | /* 512 Mb, Cacheable (Write-back), read/write, Not User, Ph. Add. */ | ||
34 | |||
35 | #define ICCR0_INIT_VAL ICCR0_ON | ICCR0_ICI /* ICE + ICI */ | ||
36 | #define ICCR1_INIT_VAL ICCR1_NOLOCK /* No locking */ | ||
37 | |||
38 | #if 1 | ||
39 | #define OCCR0_INIT_VAL OCCR0_ON | OCCR0_OCI | OCCR0_WB /* OCE + OCI + WB */ | ||
40 | #else | ||
41 | #define OCCR0_INIT_VAL OCCR0_OFF | ||
42 | #endif | ||
43 | #define OCCR1_INIT_VAL OCCR1_NOLOCK /* No locking */ | ||
44 | |||
45 | .text | ||
46 | |||
47 | .global startup | ||
48 | startup: | ||
49 | /* | ||
50 | * Prevent speculative fetch on device memory due to | ||
51 | * uninitialized target registers. | ||
52 | * This must be executed before the first branch. | ||
53 | */ | ||
54 | ptabs/u ZERO, tr0 | ||
55 | ptabs/u ZERO, tr1 | ||
56 | ptabs/u ZERO, tr2 | ||
57 | ptabs/u ZERO, tr3 | ||
58 | ptabs/u ZERO, tr4 | ||
59 | ptabs/u ZERO, tr5 | ||
60 | ptabs/u ZERO, tr6 | ||
61 | ptabs/u ZERO, tr7 | ||
62 | synci | ||
63 | |||
64 | /* | ||
65 | * Set initial TLB entries for cached and uncached regions. | ||
66 | * Note: PTA/BLINK is PIC code, PTABS/BLINK isn't ! | ||
67 | */ | ||
68 | /* Clear ITLBs */ | ||
69 | pta 1f, tr1 | ||
70 | movi ITLB_FIXED, r21 | ||
71 | movi ITLB_LAST_VAR_UNRESTRICTED+TLB_STEP, r22 | ||
72 | 1: putcfg r21, 0, ZERO /* Clear MMUIR[n].PTEH.V */ | ||
73 | addi r21, TLB_STEP, r21 | ||
74 | bne r21, r22, tr1 | ||
75 | |||
76 | /* Clear DTLBs */ | ||
77 | pta 1f, tr1 | ||
78 | movi DTLB_FIXED, r21 | ||
79 | movi DTLB_LAST_VAR_UNRESTRICTED+TLB_STEP, r22 | ||
80 | 1: putcfg r21, 0, ZERO /* Clear MMUDR[n].PTEH.V */ | ||
81 | addi r21, TLB_STEP, r21 | ||
82 | bne r21, r22, tr1 | ||
83 | |||
84 | /* Map one big (512Mb) page for ITLB */ | ||
85 | movi ITLB_FIXED, r21 | ||
86 | movi MMUIR_TEXT_L, r22 /* PTEL first */ | ||
87 | putcfg r21, 1, r22 /* Set MMUIR[0].PTEL */ | ||
88 | movi MMUIR_TEXT_H, r22 /* PTEH last */ | ||
89 | putcfg r21, 0, r22 /* Set MMUIR[0].PTEH */ | ||
90 | |||
91 | /* Map one big CACHED (512Mb) page for DTLB */ | ||
92 | movi DTLB_FIXED, r21 | ||
93 | movi MMUDR_CACHED_L, r22 /* PTEL first */ | ||
94 | putcfg r21, 1, r22 /* Set MMUDR[0].PTEL */ | ||
95 | movi MMUDR_CACHED_H, r22 /* PTEH last */ | ||
96 | putcfg r21, 0, r22 /* Set MMUDR[0].PTEH */ | ||
97 | |||
98 | /* ICache */ | ||
99 | movi ICCR_BASE, r21 | ||
100 | movi ICCR0_INIT_VAL, r22 | ||
101 | movi ICCR1_INIT_VAL, r23 | ||
102 | putcfg r21, ICCR_REG0, r22 | ||
103 | putcfg r21, ICCR_REG1, r23 | ||
104 | synci | ||
105 | |||
106 | /* OCache */ | ||
107 | movi OCCR_BASE, r21 | ||
108 | movi OCCR0_INIT_VAL, r22 | ||
109 | movi OCCR1_INIT_VAL, r23 | ||
110 | putcfg r21, OCCR_REG0, r22 | ||
111 | putcfg r21, OCCR_REG1, r23 | ||
112 | synco | ||
113 | |||
114 | /* | ||
115 | * Enable the MMU. | ||
116 | * From here-on code can be non-PIC. | ||
117 | */ | ||
118 | movi SR_HARMLESS | SR_ENABLE_MMU, r22 | ||
119 | putcon r22, SSR | ||
120 | movi 1f, r22 | ||
121 | putcon r22, SPC | ||
122 | synco | ||
123 | rte /* And now go into the hyperspace ... */ | ||
124 | 1: /* ... that's the next instruction ! */ | ||
125 | |||
126 | /* Set initial stack pointer */ | ||
127 | movi datalabel stack_start, r0 | ||
128 | ld.l r0, 0, r15 | ||
129 | |||
130 | /* | ||
131 | * Clear bss | ||
132 | */ | ||
133 | pt 1f, tr1 | ||
134 | movi datalabel __bss_start, r22 | ||
135 | movi datalabel _end, r23 | ||
136 | 1: st.l r22, 0, ZERO | ||
137 | addi r22, 4, r22 | ||
138 | bne r22, r23, tr1 | ||
139 | |||
140 | /* | ||
141 | * Decompress the kernel. | ||
142 | */ | ||
143 | pt decompress_kernel, tr0 | ||
144 | blink tr0, r18 | ||
145 | |||
146 | /* | ||
147 | * Disable the MMU. | ||
148 | */ | ||
149 | movi SR_HARMLESS, r22 | ||
150 | putcon r22, SSR | ||
151 | movi 1f, r22 | ||
152 | putcon r22, SPC | ||
153 | synco | ||
154 | rte /* And now go into the hyperspace ... */ | ||
155 | 1: /* ... that's the next instruction ! */ | ||
156 | |||
157 | /* Jump into the decompressed kernel */ | ||
158 | movi datalabel (CONFIG_MEMORY_START + 0x2000)+1, r19 | ||
159 | ptabs r19, tr0 | ||
160 | blink tr0, r18 | ||
161 | |||
162 | /* Shouldn't return here, but just in case, loop forever */ | ||
163 | pt 1f, tr0 | ||
164 | 1: blink tr0, ZERO | ||
diff --git a/arch/sh64/boot/compressed/install.sh b/arch/sh64/boot/compressed/install.sh new file mode 100644 index 000000000000..90589f0fec12 --- /dev/null +++ b/arch/sh64/boot/compressed/install.sh | |||
@@ -0,0 +1,56 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # arch/sh/boot/install.sh | ||
4 | # | ||
5 | # This file is subject to the terms and conditions of the GNU General Public | ||
6 | # License. See the file "COPYING" in the main directory of this archive | ||
7 | # for more details. | ||
8 | # | ||
9 | # Copyright (C) 1995 by Linus Torvalds | ||
10 | # | ||
11 | # Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin | ||
12 | # Adapted from code in arch/i386/boot/install.sh by Russell King | ||
13 | # Adapted from code in arch/arm/boot/install.sh by Stuart Menefy | ||
14 | # | ||
15 | # "make install" script for sh architecture | ||
16 | # | ||
17 | # Arguments: | ||
18 | # $1 - kernel version | ||
19 | # $2 - kernel image file | ||
20 | # $3 - kernel map file | ||
21 | # $4 - default install path (blank if root directory) | ||
22 | # | ||
23 | |||
24 | # User may have a custom install script | ||
25 | |||
26 | if [ -x /sbin/installkernel ]; then | ||
27 | exec /sbin/installkernel "$@" | ||
28 | fi | ||
29 | |||
30 | if [ "$2" = "zImage" ]; then | ||
31 | # Compressed install | ||
32 | echo "Installing compressed kernel" | ||
33 | if [ -f $4/vmlinuz-$1 ]; then | ||
34 | mv $4/vmlinuz-$1 $4/vmlinuz.old | ||
35 | fi | ||
36 | |||
37 | if [ -f $4/System.map-$1 ]; then | ||
38 | mv $4/System.map-$1 $4/System.old | ||
39 | fi | ||
40 | |||
41 | cat $2 > $4/vmlinuz-$1 | ||
42 | cp $3 $4/System.map-$1 | ||
43 | else | ||
44 | # Normal install | ||
45 | echo "Installing normal kernel" | ||
46 | if [ -f $4/vmlinux-$1 ]; then | ||
47 | mv $4/vmlinux-$1 $4/vmlinux.old | ||
48 | fi | ||
49 | |||
50 | if [ -f $4/System.map ]; then | ||
51 | mv $4/System.map $4/System.old | ||
52 | fi | ||
53 | |||
54 | cat $2 > $4/vmlinux-$1 | ||
55 | cp $3 $4/System.map | ||
56 | fi | ||
diff --git a/arch/sh64/boot/compressed/misc.c b/arch/sh64/boot/compressed/misc.c new file mode 100644 index 000000000000..89dbf45df3c8 --- /dev/null +++ b/arch/sh64/boot/compressed/misc.c | |||
@@ -0,0 +1,251 @@ | |||
1 | /* | ||
2 | * arch/shmedia/boot/compressed/misc.c | ||
3 | * | ||
4 | * This is a collection of several routines from gzip-1.0.3 | ||
5 | * adapted for Linux. | ||
6 | * | ||
7 | * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 | ||
8 | * | ||
9 | * Adapted for SHmedia from sh by Stuart Menefy, May 2002 | ||
10 | */ | ||
11 | |||
12 | #include <linux/config.h> | ||
13 | #include <asm/uaccess.h> | ||
14 | |||
15 | /* cache.c */ | ||
16 | #define CACHE_ENABLE 0 | ||
17 | #define CACHE_DISABLE 1 | ||
18 | int cache_control(unsigned int command); | ||
19 | |||
20 | /* | ||
21 | * gzip declarations | ||
22 | */ | ||
23 | |||
24 | #define OF(args) args | ||
25 | #define STATIC static | ||
26 | |||
27 | #undef memset | ||
28 | #undef memcpy | ||
29 | #define memzero(s, n) memset ((s), 0, (n)) | ||
30 | |||
31 | typedef unsigned char uch; | ||
32 | typedef unsigned short ush; | ||
33 | typedef unsigned long ulg; | ||
34 | |||
35 | #define WSIZE 0x8000 /* Window size must be at least 32k, */ | ||
36 | /* and a power of two */ | ||
37 | |||
38 | static uch *inbuf; /* input buffer */ | ||
39 | static uch window[WSIZE]; /* Sliding window buffer */ | ||
40 | |||
41 | static unsigned insize = 0; /* valid bytes in inbuf */ | ||
42 | static unsigned inptr = 0; /* index of next byte to be processed in inbuf */ | ||
43 | static unsigned outcnt = 0; /* bytes in output buffer */ | ||
44 | |||
45 | /* gzip flag byte */ | ||
46 | #define ASCII_FLAG 0x01 /* bit 0 set: file probably ASCII text */ | ||
47 | #define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */ | ||
48 | #define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ | ||
49 | #define ORIG_NAME 0x08 /* bit 3 set: original file name present */ | ||
50 | #define COMMENT 0x10 /* bit 4 set: file comment present */ | ||
51 | #define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ | ||
52 | #define RESERVED 0xC0 /* bit 6,7: reserved */ | ||
53 | |||
54 | #define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf()) | ||
55 | |||
56 | /* Diagnostic functions */ | ||
57 | #ifdef DEBUG | ||
58 | # define Assert(cond,msg) {if(!(cond)) error(msg);} | ||
59 | # define Trace(x) fprintf x | ||
60 | # define Tracev(x) {if (verbose) fprintf x ;} | ||
61 | # define Tracevv(x) {if (verbose>1) fprintf x ;} | ||
62 | # define Tracec(c,x) {if (verbose && (c)) fprintf x ;} | ||
63 | # define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;} | ||
64 | #else | ||
65 | # define Assert(cond,msg) | ||
66 | # define Trace(x) | ||
67 | # define Tracev(x) | ||
68 | # define Tracevv(x) | ||
69 | # define Tracec(c,x) | ||
70 | # define Tracecv(c,x) | ||
71 | #endif | ||
72 | |||
73 | static int fill_inbuf(void); | ||
74 | static void flush_window(void); | ||
75 | static void error(char *m); | ||
76 | static void gzip_mark(void **); | ||
77 | static void gzip_release(void **); | ||
78 | |||
79 | extern char input_data[]; | ||
80 | extern int input_len; | ||
81 | |||
82 | static long bytes_out = 0; | ||
83 | static uch *output_data; | ||
84 | static unsigned long output_ptr = 0; | ||
85 | |||
86 | static void *malloc(int size); | ||
87 | static void free(void *where); | ||
88 | static void error(char *m); | ||
89 | static void gzip_mark(void **); | ||
90 | static void gzip_release(void **); | ||
91 | |||
92 | static void puts(const char *); | ||
93 | |||
94 | extern int _text; /* Defined in vmlinux.lds.S */ | ||
95 | extern int _end; | ||
96 | static unsigned long free_mem_ptr; | ||
97 | static unsigned long free_mem_end_ptr; | ||
98 | |||
99 | #define HEAP_SIZE 0x10000 | ||
100 | |||
101 | #include "../../../../lib/inflate.c" | ||
102 | |||
103 | static void *malloc(int size) | ||
104 | { | ||
105 | void *p; | ||
106 | |||
107 | if (size < 0) | ||
108 | error("Malloc error\n"); | ||
109 | if (free_mem_ptr == 0) | ||
110 | error("Memory error\n"); | ||
111 | |||
112 | free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ | ||
113 | |||
114 | p = (void *) free_mem_ptr; | ||
115 | free_mem_ptr += size; | ||
116 | |||
117 | if (free_mem_ptr >= free_mem_end_ptr) | ||
118 | error("\nOut of memory\n"); | ||
119 | |||
120 | return p; | ||
121 | } | ||
122 | |||
123 | static void free(void *where) | ||
124 | { /* Don't care */ | ||
125 | } | ||
126 | |||
127 | static void gzip_mark(void **ptr) | ||
128 | { | ||
129 | *ptr = (void *) free_mem_ptr; | ||
130 | } | ||
131 | |||
132 | static void gzip_release(void **ptr) | ||
133 | { | ||
134 | free_mem_ptr = (long) *ptr; | ||
135 | } | ||
136 | |||
137 | void puts(const char *s) | ||
138 | { | ||
139 | } | ||
140 | |||
141 | void *memset(void *s, int c, size_t n) | ||
142 | { | ||
143 | int i; | ||
144 | char *ss = (char *) s; | ||
145 | |||
146 | for (i = 0; i < n; i++) | ||
147 | ss[i] = c; | ||
148 | return s; | ||
149 | } | ||
150 | |||
151 | void *memcpy(void *__dest, __const void *__src, size_t __n) | ||
152 | { | ||
153 | int i; | ||
154 | char *d = (char *) __dest, *s = (char *) __src; | ||
155 | |||
156 | for (i = 0; i < __n; i++) | ||
157 | d[i] = s[i]; | ||
158 | return __dest; | ||
159 | } | ||
160 | |||
161 | /* =========================================================================== | ||
162 | * Fill the input buffer. This is called only when the buffer is empty | ||
163 | * and at least one byte is really needed. | ||
164 | */ | ||
165 | static int fill_inbuf(void) | ||
166 | { | ||
167 | if (insize != 0) { | ||
168 | error("ran out of input data\n"); | ||
169 | } | ||
170 | |||
171 | inbuf = input_data; | ||
172 | insize = input_len; | ||
173 | inptr = 1; | ||
174 | return inbuf[0]; | ||
175 | } | ||
176 | |||
177 | /* =========================================================================== | ||
178 | * Write the output window window[0..outcnt-1] and update crc and bytes_out. | ||
179 | * (Used for the decompressed data only.) | ||
180 | */ | ||
181 | static void flush_window(void) | ||
182 | { | ||
183 | ulg c = crc; /* temporary variable */ | ||
184 | unsigned n; | ||
185 | uch *in, *out, ch; | ||
186 | |||
187 | in = window; | ||
188 | out = &output_data[output_ptr]; | ||
189 | for (n = 0; n < outcnt; n++) { | ||
190 | ch = *out++ = *in++; | ||
191 | c = crc_32_tab[((int) c ^ ch) & 0xff] ^ (c >> 8); | ||
192 | } | ||
193 | crc = c; | ||
194 | bytes_out += (ulg) outcnt; | ||
195 | output_ptr += (ulg) outcnt; | ||
196 | outcnt = 0; | ||
197 | puts("."); | ||
198 | } | ||
199 | |||
200 | static void error(char *x) | ||
201 | { | ||
202 | puts("\n\n"); | ||
203 | puts(x); | ||
204 | puts("\n\n -- System halted"); | ||
205 | |||
206 | while (1) ; /* Halt */ | ||
207 | } | ||
208 | |||
209 | #define STACK_SIZE (4096) | ||
210 | long __attribute__ ((aligned(8))) user_stack[STACK_SIZE]; | ||
211 | long *stack_start = &user_stack[STACK_SIZE]; | ||
212 | |||
213 | void decompress_kernel(void) | ||
214 | { | ||
215 | output_data = (uch *) (CONFIG_MEMORY_START + 0x2000); | ||
216 | free_mem_ptr = (unsigned long) &_end; | ||
217 | free_mem_end_ptr = free_mem_ptr + HEAP_SIZE; | ||
218 | |||
219 | makecrc(); | ||
220 | puts("Uncompressing Linux... "); | ||
221 | cache_control(CACHE_ENABLE); | ||
222 | gunzip(); | ||
223 | puts("\n"); | ||
224 | |||
225 | #if 0 | ||
226 | /* When booting from ROM may want to do something like this if the | ||
227 | * boot loader doesn't. | ||
228 | */ | ||
229 | |||
230 | /* Set up the parameters and command line */ | ||
231 | { | ||
232 | volatile unsigned int *parambase = | ||
233 | (int *) (CONFIG_MEMORY_START + 0x1000); | ||
234 | |||
235 | parambase[0] = 0x1; /* MOUNT_ROOT_RDONLY */ | ||
236 | parambase[1] = 0x0; /* RAMDISK_FLAGS */ | ||
237 | parambase[2] = 0x0200; /* ORIG_ROOT_DEV */ | ||
238 | parambase[3] = 0x0; /* LOADER_TYPE */ | ||
239 | parambase[4] = 0x0; /* INITRD_START */ | ||
240 | parambase[5] = 0x0; /* INITRD_SIZE */ | ||
241 | parambase[6] = 0; | ||
242 | |||
243 | strcpy((char *) ((int) parambase + 0x100), | ||
244 | "console=ttySC0,38400"); | ||
245 | } | ||
246 | #endif | ||
247 | |||
248 | puts("Ok, booting the kernel.\n"); | ||
249 | |||
250 | cache_control(CACHE_DISABLE); | ||
251 | } | ||
diff --git a/arch/sh64/boot/compressed/vmlinux.lds.S b/arch/sh64/boot/compressed/vmlinux.lds.S new file mode 100644 index 000000000000..15a737d9bba8 --- /dev/null +++ b/arch/sh64/boot/compressed/vmlinux.lds.S | |||
@@ -0,0 +1,65 @@ | |||
1 | /* | ||
2 | * ld script to make compressed SuperH/shmedia Linux kernel+decompression | ||
3 | * bootstrap | ||
4 | * Modified by Stuart Menefy from arch/sh/vmlinux.lds.S written by Niibe Yutaka | ||
5 | */ | ||
6 | |||
7 | #include <linux/config.h> | ||
8 | |||
9 | #ifdef CONFIG_LITTLE_ENDIAN | ||
10 | /* OUTPUT_FORMAT("elf32-sh64l-linux", "elf32-sh64l-linux", "elf32-sh64l-linux") */ | ||
11 | #define NOP 0x6ff0fff0 | ||
12 | #else | ||
13 | /* OUTPUT_FORMAT("elf32-sh64", "elf32-sh64", "elf32-sh64") */ | ||
14 | #define NOP 0xf0fff06f | ||
15 | #endif | ||
16 | |||
17 | OUTPUT_FORMAT("elf32-sh64-linux") | ||
18 | OUTPUT_ARCH(sh) | ||
19 | ENTRY(_start) | ||
20 | |||
21 | #define ALIGNED_GAP(section, align) (((ADDR(section)+SIZEOF(section)+(align)-1) & ~((align)-1))-ADDR(section)) | ||
22 | #define FOLLOWING(section, align) AT (LOADADDR(section) + ALIGNED_GAP(section,align)) | ||
23 | |||
24 | SECTIONS | ||
25 | { | ||
26 | _text = .; /* Text and read-only data */ | ||
27 | |||
28 | .text : { | ||
29 | *(.text) | ||
30 | *(.text64) | ||
31 | *(.text..SHmedia32) | ||
32 | *(.fixup) | ||
33 | *(.gnu.warning) | ||
34 | } = NOP | ||
35 | . = ALIGN(4); | ||
36 | .rodata : { *(.rodata) } | ||
37 | |||
38 | /* There is no 'real' reason for eight byte alignment, four would work | ||
39 | * as well, but gdb downloads much (*4) faster with this. | ||
40 | */ | ||
41 | . = ALIGN(8); | ||
42 | .image : { *(.image) } | ||
43 | . = ALIGN(4); | ||
44 | _etext = .; /* End of text section */ | ||
45 | |||
46 | .data : /* Data */ | ||
47 | FOLLOWING(.image, 4) | ||
48 | { | ||
49 | _data = .; | ||
50 | *(.data) | ||
51 | } | ||
52 | _data_image = LOADADDR(.data);/* Address of data section in ROM */ | ||
53 | |||
54 | _edata = .; /* End of data section */ | ||
55 | |||
56 | .stack : { stack = .; _stack = .; } | ||
57 | |||
58 | . = ALIGN(4); | ||
59 | __bss_start = .; /* BSS */ | ||
60 | .bss : { | ||
61 | *(.bss) | ||
62 | } | ||
63 | . = ALIGN(4); | ||
64 | _end = . ; | ||
65 | } | ||