aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m32r/boot
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/m32r/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/m32r/boot')
-rw-r--r--arch/m32r/boot/Makefile19
-rw-r--r--arch/m32r/boot/compressed/Makefile42
-rw-r--r--arch/m32r/boot/compressed/boot.h59
-rw-r--r--arch/m32r/boot/compressed/head.S172
-rw-r--r--arch/m32r/boot/compressed/install.sh57
-rw-r--r--arch/m32r/boot/compressed/m32r_sio.c68
-rw-r--r--arch/m32r/boot/compressed/misc.c210
-rw-r--r--arch/m32r/boot/compressed/vmlinux.lds.S31
-rw-r--r--arch/m32r/boot/compressed/vmlinux.scr9
-rw-r--r--arch/m32r/boot/setup.S167
10 files changed, 834 insertions, 0 deletions
diff --git a/arch/m32r/boot/Makefile b/arch/m32r/boot/Makefile
new file mode 100644
index 000000000000..af2cef475d98
--- /dev/null
+++ b/arch/m32r/boot/Makefile
@@ -0,0 +1,19 @@
1#
2# arch/m32r/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
8targets := zImage
9subdir- := compressed
10
11obj-y := setup.o
12
13$(obj)/zImage: $(obj)/compressed/vmlinux FORCE
14 $(call if_changed,objcopy)
15 @echo 'Kernel: $@ is ready'
16
17$(obj)/compressed/vmlinux: FORCE
18 $(Q)$(MAKE) $(build)=$(obj)/compressed $@
19
diff --git a/arch/m32r/boot/compressed/Makefile b/arch/m32r/boot/compressed/Makefile
new file mode 100644
index 000000000000..d908e1d3c07f
--- /dev/null
+++ b/arch/m32r/boot/compressed/Makefile
@@ -0,0 +1,42 @@
1#
2# linux/arch/sh/boot/compressed/Makefile
3#
4# create a compressed vmlinux image from the original vmlinux
5#
6
7targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o \
8 piggy.o vmlinux.lds
9EXTRA_AFLAGS := -traditional
10
11OBJECTS = $(obj)/head.o $(obj)/misc.o
12
13#
14# IMAGE_OFFSET is the load offset of the compression loader
15#
16#IMAGE_OFFSET := $(shell printf "0x%08x" $$[$(CONFIG_MEMORY_START)+0x2000])
17#IMAGE_OFFSET := $(shell printf "0x%08x" $$[$(CONFIG_MEMORY_START)+0x00400000])
18
19LDFLAGS_vmlinux := -T
20
21$(obj)/vmlinux: $(obj)/vmlinux.lds $(OBJECTS) $(obj)/piggy.o FORCE
22 $(call if_changed,ld)
23 @:
24
25$(obj)/vmlinux.bin: vmlinux FORCE
26 $(call if_changed,objcopy)
27
28$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
29 $(call if_changed,gzip)
30
31CFLAGS_misc.o += -fpic
32
33ifdef CONFIG_MMU
34LDFLAGS_piggy.o := -r --format binary --oformat elf32-m32r-linux -T
35else
36LDFLAGS_piggy.o := -r --format binary --oformat elf32-m32r -T
37endif
38
39OBJCOPYFLAGS += -R .empty_zero_page
40
41$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE
42 $(call if_changed,ld)
diff --git a/arch/m32r/boot/compressed/boot.h b/arch/m32r/boot/compressed/boot.h
new file mode 100644
index 000000000000..9272e38d1104
--- /dev/null
+++ b/arch/m32r/boot/compressed/boot.h
@@ -0,0 +1,59 @@
1/*
2 * 1. load vmlinuz
3 *
4 * CONFIG_MEMORY_START +-----------------------+
5 * | vmlinuz |
6 * +-----------------------+
7 * 2. decompressed
8 *
9 * CONFIG_MEMORY_START +-----------------------+
10 * | vmlinuz |
11 * +-----------------------+
12 * | |
13 * BOOT_RELOC_ADDR +-----------------------+
14 * | |
15 * KERNEL_DECOMPRESS_ADDR +-----------------------+
16 * | vmlinux |
17 * +-----------------------+
18 *
19 * 3. relocate copy & jump code
20 *
21 * CONFIG_MEMORY_START +-----------------------+
22 * | vmlinuz |
23 * +-----------------------+
24 * | |
25 * BOOT_RELOC_ADDR +-----------------------+
26 * | boot(copy&jump) |
27 * KERNEL_DECOMPRESS_ADDR +-----------------------+
28 * | vmlinux |
29 * +-----------------------+
30 *
31 * 4. relocate decompressed kernel
32 *
33 * CONFIG_MEMORY_START +-----------------------+
34 * | vmlinux |
35 * +-----------------------+
36 * | |
37 * BOOT_RELOC_ADDR +-----------------------+
38 * | boot(copy&jump) |
39 * KERNEL_DECOMPRESS_ADDR +-----------------------+
40 * | |
41 * +-----------------------+
42 *
43 */
44#ifdef __ASSEMBLY__
45#define __val(x) x
46#else
47#define __val(x) (x)
48#endif
49
50#define DECOMPRESS_OFFSET_BASE __val(0x00900000)
51#define BOOT_RELOC_SIZE __val(0x00001000)
52
53#define KERNEL_EXEC_ADDR __val(CONFIG_MEMORY_START)
54#define KERNEL_DECOMPRESS_ADDR __val(CONFIG_MEMORY_START + \
55 DECOMPRESS_OFFSET_BASE + BOOT_RELOC_SIZE)
56#define KERNEL_ENTRY __val(CONFIG_MEMORY_START + 0x1000)
57
58#define BOOT_EXEC_ADDR __val(CONFIG_MEMORY_START)
59#define BOOT_RELOC_ADDR __val(CONFIG_MEMORY_START + DECOMPRESS_OFFSET_BASE)
diff --git a/arch/m32r/boot/compressed/head.S b/arch/m32r/boot/compressed/head.S
new file mode 100644
index 000000000000..07cfd6ad1ae4
--- /dev/null
+++ b/arch/m32r/boot/compressed/head.S
@@ -0,0 +1,172 @@
1/*
2 * linux/arch/m32r/boot/compressed/head.S
3 *
4 * Copyright (c) 2001-2003 Hiroyuki Kondo, Hirokazu Takata,
5 * Hitoshi Yamamoto, Takeo Takahashi
6 * Copyright (c) 2004 Hirokazu Takata
7 */
8
9 .text
10#include <linux/config.h>
11#include <linux/linkage.h>
12#include <asm/addrspace.h>
13#include <asm/page.h>
14#include <asm/assembler.h>
15
16 /*
17 * This code can be loaded anywhere, as long as output will not
18 * overlap it.
19 *
20 * NOTE: This head.S should *NOT* be compiled with -fpic.
21 *
22 */
23
24 .global startup
25 .global __bss_start, _ebss, end, zimage_data, zimage_len
26 __ALIGN
27startup:
28 ldi r0, #0x0000 /* SPI, disable EI */
29 mvtc r0, psw
30
31 ldi r12, #-8
32 bl 1f
33 .fillinsn
341:
35 seth r1, #high(CONFIG_MEMORY_START + 0x00400000) /* Start address */
36 add r12, r14 /* Real address */
37 sub r12, r1 /* difference */
38
39 .global got_len
40 seth r3, #high(_GLOBAL_OFFSET_TABLE_+8)
41 or3 r3, r3, #low(_GLOBAL_OFFSET_TABLE_+12)
42 add r3, r14
43
44 /* Update the contents of global offset table */
45 ldi r1, #low(got_len)
46 srli r1, #2
47 beqz r1, 2f
48 .fillinsn
491:
50 ld r2, @r3
51 add r2, r12
52 st r2, @r3
53 addi r3, #4
54 addi r1, #-1
55 bnez r1, 1b
56 .fillinsn
572:
58 /* XXX: resolve plt */
59
60/*
61 * Clear BSS first so that there are no surprises...
62 */
63#ifdef CONFIG_ISA_DUAL_ISSUE
64 seth r2, #high(__bss_start)
65 or3 r2, r2, #low(__bss_start)
66 add r2, r12
67 seth r3, #high(_ebss)
68 or3 r3, r3, #low(_ebss)
69 add r3, r12
70 sub r3, r2
71
72 ; R4 = BSS size in longwords (rounded down)
73 mv r4, r3 || ldi r1, #0
74 srli r4, #4 || addi r2, #-4
75 beqz r4, .Lendloop1
76.Lloop1:
77#ifndef CONFIG_CHIP_M32310
78 ; Touch memory for the no-write-allocating cache.
79 ld r0, @(4,r2)
80#endif
81 st r1, @+r2 || addi r4, #-1
82 st r1, @+r2
83 st r1, @+r2
84 st r1, @+r2 || cmpeq r1, r4 ; R4 = 0?
85 bnc .Lloop1
86.Lendloop1:
87 and3 r4, r3, #15
88 addi r2, #4
89 beqz r4, .Lendloop2
90.Lloop2:
91 stb r1, @r2 || addi r4, #-1
92 addi r2, #1
93 bnez r4, .Lloop2
94.Lendloop2:
95
96#else /* not CONFIG_ISA_DUAL_ISSUE */
97 seth r2, #high(__bss_start)
98 or3 r2, r2, #low(__bss_start)
99 add r2, r12
100 seth r3, #high(_ebss)
101 or3 r3, r3, #low(_ebss)
102 add r3, r12
103 sub r3, r2
104 mv r4, r3
105 srli r4, #2 ; R4 = BSS size in longwords (rounded down)
106 ldi r1, #0 ; clear R1 for longwords store
107 addi r2, #-4 ; account for pre-inc store
108 beqz r4, .Lendloop1 ; any more to go?
109.Lloop1:
110 st r1, @+r2 ; yep, zero out another longword
111 addi r4, #-1 ; decrement count
112 bnez r4, .Lloop1 ; go do some more
113.Lendloop1:
114
115#endif /* not CONFIG_ISA_DUAL_ISSUE */
116
117 seth r1, #high(end)
118 or3 r1, r1, #low(end)
119 add r1, r12
120 mv sp, r1
121
122/*
123 * decompress the kernel
124 */
125 mv r0, sp
126 srli r0, 31 /* MMU is ON or OFF */
127 seth r1, #high(zimage_data)
128 or3 r1, r1, #low(zimage_data)
129 add r1, r12
130 seth r2, #high(zimage_len)
131 or3 r2, r2, #low(zimage_len)
132 mv r3, sp
133
134 bl decompress_kernel
135
136#if defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_VDEC2)
137 /* Cache flush */
138 ldi r0, -1
139 ldi r1, 0xd0 ; invalidate i-cache, copy back d-cache
140 stb r1, @r0
141#elif defined(CONFIG_CHIP_M32102)
142 /* Cache flush */
143 ldi r0, -2
144 ldi r1, 0x0100 ; invalidate
145 stb r1, @r0
146#else
147#error "put your cache flush function, please"
148#endif
149
150 mv r0, sp
151 srli r0, 31 /* MMU is ON or OFF */
152 slli r0, 31
153 or3 r0, r0, #0x2000
154 seth r1, #high(CONFIG_MEMORY_START)
155 or r0, r1
156 jmp r0
157
158 .balign 512
159fake_headers_as_bzImage:
160 .short 0
161 .ascii "HdrS"
162 .short 0x0202
163 .short 0
164 .short 0
165 .byte 0x00, 0x10
166 .short 0
167 .byte 0
168 .byte 1
169 .byte 0x00, 0x80
170 .long 0
171 .long 0
172
diff --git a/arch/m32r/boot/compressed/install.sh b/arch/m32r/boot/compressed/install.sh
new file mode 100644
index 000000000000..6d72e9e72697
--- /dev/null
+++ b/arch/m32r/boot/compressed/install.sh
@@ -0,0 +1,57 @@
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# Adapted from code in arch/sh/boot/install.sh by Takeo Takahashi
15#
16# "make install" script for sh architecture
17#
18# Arguments:
19# $1 - kernel version
20# $2 - kernel image file
21# $3 - kernel map file
22# $4 - default install path (blank if root directory)
23#
24
25# User may have a custom install script
26
27if [ -x /sbin/installkernel ]; then
28 exec /sbin/installkernel "$@"
29fi
30
31if [ "$2" = "zImage" ]; then
32# Compressed install
33 echo "Installing compressed kernel"
34 if [ -f $4/vmlinuz-$1 ]; then
35 mv $4/vmlinuz-$1 $4/vmlinuz.old
36 fi
37
38 if [ -f $4/System.map-$1 ]; then
39 mv $4/System.map-$1 $4/System.old
40 fi
41
42 cat $2 > $4/vmlinuz-$1
43 cp $3 $4/System.map-$1
44else
45# Normal install
46 echo "Installing normal kernel"
47 if [ -f $4/vmlinux-$1 ]; then
48 mv $4/vmlinux-$1 $4/vmlinux.old
49 fi
50
51 if [ -f $4/System.map ]; then
52 mv $4/System.map $4/System.old
53 fi
54
55 cat $2 > $4/vmlinux-$1
56 cp $3 $4/System.map
57fi
diff --git a/arch/m32r/boot/compressed/m32r_sio.c b/arch/m32r/boot/compressed/m32r_sio.c
new file mode 100644
index 000000000000..bad5475eff90
--- /dev/null
+++ b/arch/m32r/boot/compressed/m32r_sio.c
@@ -0,0 +1,68 @@
1/*
2 * arch/m32r/boot/compressed/m32r_sio.c
3 *
4 * 2003-02-12: Takeo Takahashi
5 *
6 */
7
8#include <linux/config.h>
9
10static void putc(char c);
11
12static int puts(const char *s)
13{
14 char c;
15 while ((c = *s++)) putc(c);
16 return 0;
17}
18
19#if defined(CONFIG_PLAT_M32700UT_Alpha) || defined(CONFIG_PLAT_M32700UT)
20#include <asm/m32r.h>
21#include <asm/io.h>
22
23#define USE_FPGA_MAP 0
24
25#if USE_FPGA_MAP
26/*
27 * fpga configuration program uses MMU, and define map as same as
28 * M32104 uT-Engine board.
29 */
30#define BOOT_SIO0STS (volatile unsigned short *)(0x02c00000 + 0x20006)
31#define BOOT_SIO0TXB (volatile unsigned short *)(0x02c00000 + 0x2000c)
32#else
33#undef PLD_BASE
34#define PLD_BASE 0xa4c00000
35#define BOOT_SIO0STS PLD_ESIO0STS
36#define BOOT_SIO0TXB PLD_ESIO0TXB
37#endif
38
39static void putc(char c)
40{
41
42 while ((*BOOT_SIO0STS & 0x3) != 0x3) ;
43 if (c == '\n') {
44 *BOOT_SIO0TXB = '\r';
45 while ((*BOOT_SIO0STS & 0x3) != 0x3) ;
46 }
47 *BOOT_SIO0TXB = c;
48}
49#else /* defined(CONFIG_PLAT_M32700UT_Alpha) || defined(CONFIG_PLAT_M32700UT) */
50#ifdef CONFIG_MMU
51#define SIO0STS (volatile unsigned short *)(0xa0efd000 + 14)
52#define SIO0TXB (volatile unsigned short *)(0xa0efd000 + 30)
53#else
54#define SIO0STS (volatile unsigned short *)(0x00efd000 + 14)
55#define SIO0TXB (volatile unsigned short *)(0x00efd000 + 30)
56#endif
57
58static void putc(char c)
59{
60
61 while ((*SIO0STS & 0x1) == 0) ;
62 if (c == '\n') {
63 *SIO0TXB = '\r';
64 while ((*SIO0STS & 0x1) == 0) ;
65 }
66 *SIO0TXB = c;
67}
68#endif
diff --git a/arch/m32r/boot/compressed/misc.c b/arch/m32r/boot/compressed/misc.c
new file mode 100644
index 000000000000..70fa799005c3
--- /dev/null
+++ b/arch/m32r/boot/compressed/misc.c
@@ -0,0 +1,210 @@
1/*
2 * arch/m32r/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 SH by Stuart Menefy, Aug 1999
10 *
11 * 2003-02-12: Support M32R by Takeo Takahashi
12 * This is based on arch/sh/boot/compressed/misc.c.
13 */
14
15#include <linux/config.h>
16#include <linux/string.h>
17
18/*
19 * gzip declarations
20 */
21
22#define OF(args) args
23#define STATIC static
24
25#undef memset
26#undef memcpy
27#define memzero(s, n) memset ((s), 0, (n))
28
29typedef unsigned char uch;
30typedef unsigned short ush;
31typedef unsigned long ulg;
32
33#define WSIZE 0x8000 /* Window size must be at least 32k, */
34 /* and a power of two */
35
36static uch *inbuf; /* input buffer */
37static uch window[WSIZE]; /* Sliding window buffer */
38
39static unsigned insize = 0; /* valid bytes in inbuf */
40static unsigned inptr = 0; /* index of next byte to be processed in inbuf */
41static unsigned outcnt = 0; /* bytes in output buffer */
42
43/* gzip flag byte */
44#define ASCII_FLAG 0x01 /* bit 0 set: file probably ASCII text */
45#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
46#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
47#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
48#define COMMENT 0x10 /* bit 4 set: file comment present */
49#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */
50#define RESERVED 0xC0 /* bit 6,7: reserved */
51
52#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf())
53
54/* Diagnostic functions */
55#ifdef DEBUG
56# define Assert(cond,msg) {if(!(cond)) error(msg);}
57# define Trace(x) fprintf x
58# define Tracev(x) {if (verbose) fprintf x ;}
59# define Tracevv(x) {if (verbose>1) fprintf x ;}
60# define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
61# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
62#else
63# define Assert(cond,msg)
64# define Trace(x)
65# define Tracev(x)
66# define Tracevv(x)
67# define Tracec(c,x)
68# define Tracecv(c,x)
69#endif
70
71static int fill_inbuf(void);
72static void flush_window(void);
73static void error(char *m);
74static void gzip_mark(void **);
75static void gzip_release(void **);
76
77static unsigned char *input_data;
78static int input_len;
79
80static long bytes_out = 0;
81static uch *output_data;
82static unsigned long output_ptr = 0;
83
84#include "m32r_sio.c"
85
86static void *malloc(int size);
87static void free(void *where);
88
89static unsigned long free_mem_ptr;
90static unsigned long free_mem_end_ptr;
91
92#define HEAP_SIZE 0x10000
93
94#include "../../../../lib/inflate.c"
95
96static void *malloc(int size)
97{
98 void *p;
99
100 if (size <0) error("Malloc error");
101 if (free_mem_ptr == 0) error("Memory error");
102
103 free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
104
105 p = (void *)free_mem_ptr;
106 free_mem_ptr += size;
107
108 if (free_mem_ptr >= free_mem_end_ptr)
109 error("Out of memory");
110
111 return p;
112}
113
114static void free(void *where)
115{ /* Don't care */
116}
117
118static void gzip_mark(void **ptr)
119{
120 *ptr = (void *) free_mem_ptr;
121}
122
123static void gzip_release(void **ptr)
124{
125 free_mem_ptr = (long) *ptr;
126}
127
128void* memset(void* s, int c, size_t n)
129{
130 int i;
131 char *ss = (char*)s;
132
133 for (i=0;i<n;i++) ss[i] = c;
134 return s;
135}
136
137void* memcpy(void* __dest, __const void* __src,
138 size_t __n)
139{
140 int i;
141 char *d = (char *)__dest, *s = (char *)__src;
142
143 for (i=0;i<__n;i++) d[i] = s[i];
144 return __dest;
145}
146
147/* ===========================================================================
148 * Fill the input buffer. This is called only when the buffer is empty
149 * and at least one byte is really needed.
150 */
151static int fill_inbuf(void)
152{
153 if (insize != 0) {
154 error("ran out of input data");
155 }
156
157 inbuf = input_data;
158 insize = input_len;
159 inptr = 1;
160 return inbuf[0];
161}
162
163/* ===========================================================================
164 * Write the output window window[0..outcnt-1] and update crc and bytes_out.
165 * (Used for the decompressed data only.)
166 */
167static void flush_window(void)
168{
169 ulg c = crc; /* temporary variable */
170 unsigned n;
171 uch *in, *out, ch;
172
173 in = window;
174 out = &output_data[output_ptr];
175 for (n = 0; n < outcnt; n++) {
176 ch = *out++ = *in++;
177 c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
178 }
179 crc = c;
180 bytes_out += (ulg)outcnt;
181 output_ptr += (ulg)outcnt;
182 outcnt = 0;
183}
184
185static void error(char *x)
186{
187 puts("\n\n");
188 puts(x);
189 puts("\n\n -- System halted");
190
191 while(1); /* Halt */
192}
193
194/* return decompressed size */
195void
196decompress_kernel(int mmu_on, unsigned char *zimage_data,
197 unsigned int zimage_len, unsigned long heap)
198{
199 output_data = (unsigned char *)CONFIG_MEMORY_START + 0x2000
200 + (mmu_on ? 0x80000000 : 0);
201 free_mem_ptr = heap;
202 free_mem_end_ptr = free_mem_ptr + HEAP_SIZE;
203 input_data = zimage_data;
204 input_len = zimage_len;
205
206 makecrc();
207 puts("Uncompressing Linux... ");
208 gunzip();
209 puts("Ok, booting the kernel.\n");
210}
diff --git a/arch/m32r/boot/compressed/vmlinux.lds.S b/arch/m32r/boot/compressed/vmlinux.lds.S
new file mode 100644
index 000000000000..a18431759633
--- /dev/null
+++ b/arch/m32r/boot/compressed/vmlinux.lds.S
@@ -0,0 +1,31 @@
1#include <linux/config.h>
2
3OUTPUT_ARCH(m32r)
4ENTRY(startup)
5SECTIONS
6{
7 . = CONFIG_MEMORY_START + 0x00400000;
8
9 _text = .;
10 .text : { *(.text) } = 0
11 .rodata : { *(.rodata) *(.rodata.*) }
12 _etext = .;
13
14 . = ALIGN(32 / 8);
15 .data : { *(.data) }
16 . = ALIGN(32 / 8);
17 _got = .;
18 .got : { *(.got) _egot = .; *(.got.*) }
19 _edata = .;
20
21 . = ALIGN(32 / 8);
22 __bss_start = .;
23 .bss : { *(.bss) *(.sbss) }
24 . = ALIGN(32 / 8);
25 _ebss = .;
26 . = ALIGN(4096);
27 . += 4096;
28 end = . ;
29
30 got_len = (_egot - _got);
31}
diff --git a/arch/m32r/boot/compressed/vmlinux.scr b/arch/m32r/boot/compressed/vmlinux.scr
new file mode 100644
index 000000000000..924c7992c55b
--- /dev/null
+++ b/arch/m32r/boot/compressed/vmlinux.scr
@@ -0,0 +1,9 @@
1SECTIONS
2{
3 .data : {
4 zimage_data = .;
5 *(.data)
6 zimage_data_end = .;
7 }
8 zimage_len = zimage_data_end - zimage_data;
9}
diff --git a/arch/m32r/boot/setup.S b/arch/m32r/boot/setup.S
new file mode 100644
index 000000000000..5d256434b4ad
--- /dev/null
+++ b/arch/m32r/boot/setup.S
@@ -0,0 +1,167 @@
1/*
2 * linux/arch/m32r/boot/setup.S -- A setup code.
3 *
4 * Copyright (C) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata,
5 * and Hitoshi Yamamoto
6 *
7 */
8/* $Id$ */
9
10#include <linux/linkage.h>
11#include <asm/segment.h>
12#include <asm/page.h>
13#include <asm/pgtable.h>
14
15#include <linux/config.h>
16#include <asm/assembler.h>
17#include <asm/mmu_context.h>
18#include <asm/m32r.h>
19
20/*
21 * References to members of the boot_cpu_data structure.
22 */
23
24#define CPU_PARAMS boot_cpu_data
25#define M32R_MCICAR 0xfffffff0
26#define M32R_MCDCAR 0xfffffff4
27#define M32R_MCCR 0xfffffffc
28#define M32R_BSCR0 0xffffffd2
29
30;BSEL
31#define BSEL0CR0 0x00ef5000
32#define BSEL0CR1 0x00ef5004
33#define BSEL1CR0 0x00ef5100
34#define BSEL1CR1 0x00ef5104
35#define BSEL0CR0_VAL 0x00000000
36#define BSEL0CR1_VAL 0x01200100
37#define BSEL1CR0_VAL 0x01018000
38#define BSEL1CR1_VAL 0x00200001
39
40;SDRAMC
41#define SDRAMC_SDRF0 0x00ef6000
42#define SDRAMC_SDRF1 0x00ef6004
43#define SDRAMC_SDIR0 0x00ef6008
44#define SDRAMC_SDIR1 0x00ef600c
45#define SDRAMC_SD0ADR 0x00ef6020
46#define SDRAMC_SD0ER 0x00ef6024
47#define SDRAMC_SD0TR 0x00ef6028
48#define SDRAMC_SD0MOD 0x00ef602c
49#define SDRAMC_SD1ADR 0x00ef6040
50#define SDRAMC_SD1ER 0x00ef6044
51#define SDRAMC_SD1TR 0x00ef6048
52#define SDRAMC_SD1MOD 0x00ef604c
53#define SDRAM0 0x18000000
54#define SDRAM1 0x1c000000
55
56/*------------------------------------------------------------------------
57 * start up
58 */
59
60/*------------------------------------------------------------------------
61 * Kernel entry
62 */
63 .section .boot, "ax"
64ENTRY(boot)
65
66/* Set cache mode */
67#if defined(CONFIG_CHIP_XNUX2)
68 ldi r0, #-2 ;LDIMM (r0, M32R_MCCR)
69 ldi r1, #0x0101 ; cache on (with invalidation)
70; ldi r1, #0x00 ; cache off
71 sth r1, @r0
72#elif defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_VDEC2) \
73 || defined(CONFIG_CHIP_OPSP)
74 ldi r0, #-4 ;LDIMM (r0, M32R_MCCR)
75 ldi r1, #0x73 ; cache on (with invalidation)
76; ldi r1, #0x00 ; cache off
77 st r1, @r0
78#elif defined(CONFIG_CHIP_M32102)
79 ldi r0, #-4 ;LDIMM (r0, M32R_MCCR)
80 ldi r1, #0x101 ; cache on (with invalidation)
81; ldi r1, #0x00 ; cache off
82 st r1, @r0
83#else
84#error unknown chip configuration
85#endif
86
87#ifdef CONFIG_SMP
88 ;; if not BSP (CPU#0) goto AP_loop
89 seth r5, #shigh(M32R_CPUID_PORTL)
90 ld r5, @(low(M32R_CPUID_PORTL), r5)
91 bnez r5, AP_loop
92#if !defined(CONFIG_PLAT_USRV)
93 ;; boot AP
94 ld24 r5, #0xeff2f8 ; IPICR7
95 ldi r6, #0x2 ; IPI to CPU1
96 st r6, @r5
97#endif
98#endif
99
100/*
101 * Now, Jump to stext
102 * if with MMU, TLB on.
103 * if with no MMU, only jump.
104 */
105 .global eit_vector
106mmu_on:
107 LDIMM (r13, stext)
108#ifdef CONFIG_MMU
109 bl init_tlb
110 LDIMM (r2, eit_vector) ; set EVB(cr5)
111 mvtc r2, cr5
112 seth r0, #high(MMU_REG_BASE) ; Set MMU_REG_BASE higher
113 or3 r0, r0, #low(MMU_REG_BASE) ; Set MMU_REG_BASE lower
114 ldi r1, #0x01
115 st r1, @(MATM_offset,r0) ; Set MATM (T bit ON)
116 ld r0, @(MATM_offset,r0) ; Check
117#else
118 seth r0,#high(M32R_MCDCAR)
119 or3 r0,r0,#low(M32R_MCDCAR)
120 ld24 r1,#0x8080
121 st r1,@r0
122#endif /* CONFIG_MMU */
123 jmp r13
124 nop
125 nop
126
127#ifdef CONFIG_SMP
128/*
129 * AP wait loop
130 */
131ENTRY(AP_loop)
132 ;; disable interrupt
133 clrpsw #0x40
134 ;; reset EVB
135 LDIMM (r4, _AP_RE)
136 seth r5, #high(__PAGE_OFFSET)
137 or3 r5, r5, #low(__PAGE_OFFSET)
138 not r5, r5
139 and r4, r5
140 mvtc r4, cr5
141 ;; disable maskable interrupt
142 seth r4, #high(M32R_ICU_IMASK_PORTL)
143 or3 r4, r4, #low(M32R_ICU_IMASK_PORTL)
144 ldi r5, #0
145 st r5, @r4
146 ld r5, @r4
147 ;; enable only IPI
148 setpsw #0x40
149 ;; LOOOOOOOOOOOOOOP!!!
150 .fillinsn
1512:
152 nop
153 nop
154 bra 2b
155 nop
156 nop
157
158#ifdef CONFIG_CHIP_M32700_TS1
159 .global dcache_dummy
160 .balign 16, 0
161dcache_dummy:
162 .byte 16
163#endif /* CONFIG_CHIP_M32700_TS1 */
164#endif /* CONFIG_SMP */
165
166 .end
167