aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh64
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2007-11-21 02:53:37 -0500
committerPaul Mundt <lethal@linux-sh.org>2008-01-27 23:18:52 -0500
commit71373068067b01c963eed1350909de81fc6a6d04 (patch)
tree46983ab00b37896519fd4833ed69eadfe618270f /arch/sh64
parent55183e9bb2c2ce43d88eaa575c2d6d4fd6d865a3 (diff)
sh: Merge the sh64 zImage bits.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh64')
-rw-r--r--arch/sh64/boot/Makefile20
-rw-r--r--arch/sh64/boot/compressed/Makefile46
-rw-r--r--arch/sh64/boot/compressed/cache.c39
-rw-r--r--arch/sh64/boot/compressed/head.S164
-rw-r--r--arch/sh64/boot/compressed/install.sh56
-rw-r--r--arch/sh64/boot/compressed/misc.c250
-rw-r--r--arch/sh64/boot/compressed/vmlinux.lds.S64
7 files changed, 0 insertions, 639 deletions
diff --git a/arch/sh64/boot/Makefile b/arch/sh64/boot/Makefile
deleted file mode 100644
index fb71087b7b8a..000000000000
--- a/arch/sh64/boot/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
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
11targets := zImage
12subdir- := 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
deleted file mode 100644
index 9cd216718856..000000000000
--- a/arch/sh64/boot/compressed/Makefile
+++ /dev/null
@@ -1,46 +0,0 @@
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
14targets := vmlinux vmlinux.bin vmlinux.bin.gz \
15 head.o misc.o cache.o piggy.o vmlinux.lds
16
17EXTRA_AFLAGS := -traditional
18
19OBJECTS := $(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#
25ZIMAGE_OFFSET = $(shell printf "0x%8x" $$[$(CONFIG_MEMORY_START)+0x400000+0x10000])
26
27LDFLAGS_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
41LDFLAGS_piggy.o := -r --format binary --oformat elf32-sh64-linux -T
42OBJCOPYFLAGS += -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
deleted file mode 100644
index 708707355ffa..000000000000
--- a/arch/sh64/boot/compressed/cache.c
+++ /dev/null
@@ -1,39 +0,0 @@
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
28int 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
deleted file mode 100644
index 82040b1a29cf..000000000000
--- a/arch/sh64/boot/compressed/head.S
+++ /dev/null
@@ -1,164 +0,0 @@
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
48startup:
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
721: 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
801: 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 ... */
1241: /* ... 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
1361: 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 ... */
1551: /* ... 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
1641: blink tr0, ZERO
diff --git a/arch/sh64/boot/compressed/install.sh b/arch/sh64/boot/compressed/install.sh
deleted file mode 100644
index 90589f0fec12..000000000000
--- a/arch/sh64/boot/compressed/install.sh
+++ /dev/null
@@ -1,56 +0,0 @@
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
26if [ -x /sbin/installkernel ]; then
27 exec /sbin/installkernel "$@"
28fi
29
30if [ "$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
43else
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
56fi
diff --git a/arch/sh64/boot/compressed/misc.c b/arch/sh64/boot/compressed/misc.c
deleted file mode 100644
index aea00c53ce29..000000000000
--- a/arch/sh64/boot/compressed/misc.c
+++ /dev/null
@@ -1,250 +0,0 @@
1/*
2 * arch/sh64/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 <asm/uaccess.h>
13
14/* cache.c */
15#define CACHE_ENABLE 0
16#define CACHE_DISABLE 1
17int cache_control(unsigned int command);
18
19/*
20 * gzip declarations
21 */
22
23#define OF(args) args
24#define STATIC static
25
26#undef memset
27#undef memcpy
28#define memzero(s, n) memset ((s), 0, (n))
29
30typedef unsigned char uch;
31typedef unsigned short ush;
32typedef unsigned long ulg;
33
34#define WSIZE 0x8000 /* Window size must be at least 32k, */
35 /* and a power of two */
36
37static uch *inbuf; /* input buffer */
38static uch window[WSIZE]; /* Sliding window buffer */
39
40static unsigned insize = 0; /* valid bytes in inbuf */
41static unsigned inptr = 0; /* index of next byte to be processed in inbuf */
42static unsigned outcnt = 0; /* bytes in output buffer */
43
44/* gzip flag byte */
45#define ASCII_FLAG 0x01 /* bit 0 set: file probably ASCII text */
46#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
47#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
48#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
49#define COMMENT 0x10 /* bit 4 set: file comment present */
50#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */
51#define RESERVED 0xC0 /* bit 6,7: reserved */
52
53#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf())
54
55/* Diagnostic functions */
56#ifdef DEBUG
57# define Assert(cond,msg) {if(!(cond)) error(msg);}
58# define Trace(x) fprintf x
59# define Tracev(x) {if (verbose) fprintf x ;}
60# define Tracevv(x) {if (verbose>1) fprintf x ;}
61# define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
62# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
63#else
64# define Assert(cond,msg)
65# define Trace(x)
66# define Tracev(x)
67# define Tracevv(x)
68# define Tracec(c,x)
69# define Tracecv(c,x)
70#endif
71
72static int fill_inbuf(void);
73static void flush_window(void);
74static void error(char *m);
75static void gzip_mark(void **);
76static void gzip_release(void **);
77
78extern char input_data[];
79extern int input_len;
80
81static long bytes_out = 0;
82static uch *output_data;
83static unsigned long output_ptr = 0;
84
85static void *malloc(int size);
86static void free(void *where);
87static void error(char *m);
88static void gzip_mark(void **);
89static void gzip_release(void **);
90
91static void puts(const char *);
92
93extern int _text; /* Defined in vmlinux.lds.S */
94extern int _end;
95static unsigned long free_mem_ptr;
96static unsigned long free_mem_end_ptr;
97
98#define HEAP_SIZE 0x10000
99
100#include "../../../../lib/inflate.c"
101
102static void *malloc(int size)
103{
104 void *p;
105
106 if (size < 0)
107 error("Malloc error\n");
108 if (free_mem_ptr == 0)
109 error("Memory error\n");
110
111 free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
112
113 p = (void *) free_mem_ptr;
114 free_mem_ptr += size;
115
116 if (free_mem_ptr >= free_mem_end_ptr)
117 error("\nOut of memory\n");
118
119 return p;
120}
121
122static void free(void *where)
123{ /* Don't care */
124}
125
126static void gzip_mark(void **ptr)
127{
128 *ptr = (void *) free_mem_ptr;
129}
130
131static void gzip_release(void **ptr)
132{
133 free_mem_ptr = (long) *ptr;
134}
135
136void puts(const char *s)
137{
138}
139
140void *memset(void *s, int c, size_t n)
141{
142 int i;
143 char *ss = (char *) s;
144
145 for (i = 0; i < n; i++)
146 ss[i] = c;
147 return s;
148}
149
150void *memcpy(void *__dest, __const void *__src, size_t __n)
151{
152 int i;
153 char *d = (char *) __dest, *s = (char *) __src;
154
155 for (i = 0; i < __n; i++)
156 d[i] = s[i];
157 return __dest;
158}
159
160/* ===========================================================================
161 * Fill the input buffer. This is called only when the buffer is empty
162 * and at least one byte is really needed.
163 */
164static int fill_inbuf(void)
165{
166 if (insize != 0) {
167 error("ran out of input data\n");
168 }
169
170 inbuf = input_data;
171 insize = input_len;
172 inptr = 1;
173 return inbuf[0];
174}
175
176/* ===========================================================================
177 * Write the output window window[0..outcnt-1] and update crc and bytes_out.
178 * (Used for the decompressed data only.)
179 */
180static void flush_window(void)
181{
182 ulg c = crc; /* temporary variable */
183 unsigned n;
184 uch *in, *out, ch;
185
186 in = window;
187 out = &output_data[output_ptr];
188 for (n = 0; n < outcnt; n++) {
189 ch = *out++ = *in++;
190 c = crc_32_tab[((int) c ^ ch) & 0xff] ^ (c >> 8);
191 }
192 crc = c;
193 bytes_out += (ulg) outcnt;
194 output_ptr += (ulg) outcnt;
195 outcnt = 0;
196 puts(".");
197}
198
199static void error(char *x)
200{
201 puts("\n\n");
202 puts(x);
203 puts("\n\n -- System halted");
204
205 while (1) ; /* Halt */
206}
207
208#define STACK_SIZE (4096)
209long __attribute__ ((aligned(8))) user_stack[STACK_SIZE];
210long *stack_start = &user_stack[STACK_SIZE];
211
212void decompress_kernel(void)
213{
214 output_data = (uch *) (CONFIG_MEMORY_START + 0x2000);
215 free_mem_ptr = (unsigned long) &_end;
216 free_mem_end_ptr = free_mem_ptr + HEAP_SIZE;
217
218 makecrc();
219 puts("Uncompressing Linux... ");
220 cache_control(CACHE_ENABLE);
221 gunzip();
222 puts("\n");
223
224#if 0
225 /* When booting from ROM may want to do something like this if the
226 * boot loader doesn't.
227 */
228
229 /* Set up the parameters and command line */
230 {
231 volatile unsigned int *parambase =
232 (int *) (CONFIG_MEMORY_START + 0x1000);
233
234 parambase[0] = 0x1; /* MOUNT_ROOT_RDONLY */
235 parambase[1] = 0x0; /* RAMDISK_FLAGS */
236 parambase[2] = 0x0200; /* ORIG_ROOT_DEV */
237 parambase[3] = 0x0; /* LOADER_TYPE */
238 parambase[4] = 0x0; /* INITRD_START */
239 parambase[5] = 0x0; /* INITRD_SIZE */
240 parambase[6] = 0;
241
242 strcpy((char *) ((int) parambase + 0x100),
243 "console=ttySC0,38400");
244 }
245#endif
246
247 puts("Ok, booting the kernel.\n");
248
249 cache_control(CACHE_DISABLE);
250}
diff --git a/arch/sh64/boot/compressed/vmlinux.lds.S b/arch/sh64/boot/compressed/vmlinux.lds.S
deleted file mode 100644
index 59c2ef4aeda5..000000000000
--- a/arch/sh64/boot/compressed/vmlinux.lds.S
+++ /dev/null
@@ -1,64 +0,0 @@
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
8#ifdef CONFIG_LITTLE_ENDIAN
9/* OUTPUT_FORMAT("elf32-sh64l-linux", "elf32-sh64l-linux", "elf32-sh64l-linux") */
10#define NOP 0x6ff0fff0
11#else
12/* OUTPUT_FORMAT("elf32-sh64", "elf32-sh64", "elf32-sh64") */
13#define NOP 0xf0fff06f
14#endif
15
16OUTPUT_FORMAT("elf32-sh64-linux")
17OUTPUT_ARCH(sh)
18ENTRY(_start)
19
20#define ALIGNED_GAP(section, align) (((ADDR(section)+SIZEOF(section)+(align)-1) & ~((align)-1))-ADDR(section))
21#define FOLLOWING(section, align) AT (LOADADDR(section) + ALIGNED_GAP(section,align))
22
23SECTIONS
24{
25 _text = .; /* Text and read-only data */
26
27 .text : {
28 *(.text)
29 *(.text64)
30 *(.text..SHmedia32)
31 *(.fixup)
32 *(.gnu.warning)
33 } = NOP
34 . = ALIGN(4);
35 .rodata : { *(.rodata) }
36
37 /* There is no 'real' reason for eight byte alignment, four would work
38 * as well, but gdb downloads much (*4) faster with this.
39 */
40 . = ALIGN(8);
41 .image : { *(.image) }
42 . = ALIGN(4);
43 _etext = .; /* End of text section */
44
45 .data : /* Data */
46 FOLLOWING(.image, 4)
47 {
48 _data = .;
49 *(.data)
50 }
51 _data_image = LOADADDR(.data);/* Address of data section in ROM */
52
53 _edata = .; /* End of data section */
54
55 .stack : { stack = .; _stack = .; }
56
57 . = ALIGN(4);
58 __bss_start = .; /* BSS */
59 .bss : {
60 *(.bss)
61 }
62 . = ALIGN(4);
63 _end = . ;
64}