aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris/arch-v10
diff options
context:
space:
mode:
Diffstat (limited to 'arch/cris/arch-v10')
-rw-r--r--arch/cris/arch-v10/boot/.gitignore2
-rw-r--r--arch/cris/arch-v10/boot/Makefile20
-rw-r--r--arch/cris/arch-v10/boot/compressed/Makefile27
-rw-r--r--arch/cris/arch-v10/boot/compressed/README25
-rw-r--r--arch/cris/arch-v10/boot/compressed/decompress.lds30
-rw-r--r--arch/cris/arch-v10/boot/compressed/head.S126
-rw-r--r--arch/cris/arch-v10/boot/compressed/misc.c246
-rw-r--r--arch/cris/arch-v10/boot/rescue/Makefile35
-rw-r--r--arch/cris/arch-v10/boot/rescue/head.S360
-rw-r--r--arch/cris/arch-v10/boot/rescue/kimagerescue.S143
-rw-r--r--arch/cris/arch-v10/boot/rescue/rescue.lds20
-rw-r--r--arch/cris/arch-v10/boot/rescue/testrescue.S24
-rw-r--r--arch/cris/arch-v10/boot/tools/build.c287
-rw-r--r--arch/cris/arch-v10/kernel/entry.S14
14 files changed, 11 insertions, 1348 deletions
diff --git a/arch/cris/arch-v10/boot/.gitignore b/arch/cris/arch-v10/boot/.gitignore
deleted file mode 100644
index 171a0853caf..00000000000
--- a/arch/cris/arch-v10/boot/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
1Image
2zImage
diff --git a/arch/cris/arch-v10/boot/Makefile b/arch/cris/arch-v10/boot/Makefile
deleted file mode 100644
index 21720301443..00000000000
--- a/arch/cris/arch-v10/boot/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
1#
2# arch/cris/arch-v10/boot/Makefile
3#
4
5OBJCOPYFLAGS = -O binary --remove-section=.bss
6
7subdir- := compressed rescue
8targets := Image
9
10$(obj)/Image: vmlinux FORCE
11 $(call if_changed,objcopy)
12 @echo ' Kernel: $@ is ready'
13
14$(obj)/compressed/vmlinux: $(obj)/Image FORCE
15 $(Q)$(MAKE) $(build)=$(obj)/compressed $@
16 $(Q)$(MAKE) $(build)=$(obj)/rescue $(obj)/rescue/rescue.bin
17
18$(obj)/zImage: $(obj)/compressed/vmlinux
19 @cp $< $@
20 @echo ' Kernel: $@ is ready'
diff --git a/arch/cris/arch-v10/boot/compressed/Makefile b/arch/cris/arch-v10/boot/compressed/Makefile
deleted file mode 100644
index 6fe0ffaf3be..00000000000
--- a/arch/cris/arch-v10/boot/compressed/Makefile
+++ /dev/null
@@ -1,27 +0,0 @@
1#
2# arch/cris/arch-v10/boot/compressed/Makefile
3#
4
5asflags-y += $(LINUXINCLUDE)
6ccflags-y += -O2 $(LINUXINCLUDE)
7ldflags-y += -T $(srctree)/$(src)/decompress.lds
8OBJECTS = $(obj)/head.o $(obj)/misc.o
9OBJCOPYFLAGS = -O binary --remove-section=.bss
10
11quiet_cmd_image = BUILD $@
12cmd_image = cat $(obj)/decompress.bin $(obj)/piggy.gz > $@
13
14targets := vmlinux piggy.gz decompress.o decompress.bin
15
16$(obj)/decompress.o: $(OBJECTS) FORCE
17 $(call if_changed,ld)
18
19$(obj)/decompress.bin: $(obj)/decompress.o FORCE
20 $(call if_changed,objcopy)
21
22$(obj)/vmlinux: $(obj)/piggy.gz $(obj)/decompress.bin FORCE
23 $(call if_changed,image)
24
25$(obj)/piggy.gz: $(obj)/../Image FORCE
26 $(call if_changed,gzip)
27
diff --git a/arch/cris/arch-v10/boot/compressed/README b/arch/cris/arch-v10/boot/compressed/README
deleted file mode 100644
index 48b3db9924b..00000000000
--- a/arch/cris/arch-v10/boot/compressed/README
+++ /dev/null
@@ -1,25 +0,0 @@
1Creation of the self-extracting compressed kernel image (vmlinuz)
2-----------------------------------------------------------------
3$Id: README,v 1.1 2001/12/17 13:59:27 bjornw Exp $
4
5This can be slightly confusing because it's a process with many steps.
6
7The kernel object built by the arch/etrax100/Makefile, vmlinux, is split
8by that makefile into text and data binary files, vmlinux.text and
9vmlinux.data.
10
11Those files together with a ROM filesystem can be catted together and
12burned into a flash or executed directly at the DRAM origin.
13
14They can also be catted together and compressed with gzip, which is what
15happens in this makefile. Together they make up piggy.img.
16
17The decompressor is built into the file decompress.o. It is turned into
18the binary file decompress.bin, which is catted together with piggy.img
19into the file vmlinuz. It can be executed in an arbitrary place in flash.
20
21Be careful - it assumes some things about free locations in DRAM. It
22assumes the DRAM starts at 0x40000000 and that it is at least 8 MB,
23so it puts its code at 0x40700000, and initial stack at 0x40800000.
24
25-Bjorn
diff --git a/arch/cris/arch-v10/boot/compressed/decompress.lds b/arch/cris/arch-v10/boot/compressed/decompress.lds
deleted file mode 100644
index e80f4594d54..00000000000
--- a/arch/cris/arch-v10/boot/compressed/decompress.lds
+++ /dev/null
@@ -1,30 +0,0 @@
1/* OUTPUT_FORMAT(elf32-us-cris) */
2OUTPUT_FORMAT(elf32-cris)
3
4MEMORY
5 {
6 dram : ORIGIN = 0x40700000,
7 LENGTH = 0x00100000
8 }
9
10SECTIONS
11{
12 .text :
13 {
14 _stext = . ;
15 *(.text)
16 *(.rodata)
17 *(.rodata.*)
18 _etext = . ;
19 } > dram
20 .data :
21 {
22 *(.data)
23 _edata = . ;
24 } > dram
25 .bss :
26 {
27 *(.bss)
28 _end = ALIGN( 0x10 ) ;
29 } > dram
30}
diff --git a/arch/cris/arch-v10/boot/compressed/head.S b/arch/cris/arch-v10/boot/compressed/head.S
deleted file mode 100644
index 0bb4dcc2925..00000000000
--- a/arch/cris/arch-v10/boot/compressed/head.S
+++ /dev/null
@@ -1,126 +0,0 @@
1/*
2 * arch/cris/boot/compressed/head.S
3 *
4 * Copyright (C) 1999, 2001 Axis Communications AB
5 *
6 * Code that sets up the DRAM registers, calls the
7 * decompressor to unpack the piggybacked kernel, and jumps.
8 *
9 */
10
11#define ASSEMBLER_MACROS_ONLY
12#include <arch/sv_addr_ag.h>
13
14#define RAM_INIT_MAGIC 0x56902387
15#define COMMAND_LINE_MAGIC 0x87109563
16
17 ;; Exported symbols
18
19 .globl input_data
20
21
22 .text
23
24 nop
25 di
26
27;; We need to initialze DRAM registers before we start using the DRAM
28
29 cmp.d RAM_INIT_MAGIC, $r8 ; Already initialized?
30 beq dram_init_finished
31 nop
32
33#include "../../lib/dram_init.S"
34
35dram_init_finished:
36
37 ;; Initiate the PA and PB ports
38
39 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r0
40 move.b $r0, [R_PORT_PA_DATA]
41
42 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR, $r0
43 move.b $r0, [R_PORT_PA_DIR]
44
45 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, $r0
46 move.b $r0, [R_PORT_PB_DATA]
47
48 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR, $r0
49 move.b $r0, [R_PORT_PB_DIR]
50
51 ;; Setup the stack to a suitably high address.
52 ;; We assume 8 MB is the minimum DRAM in an eLinux
53 ;; product and put the sp at the top for now.
54
55 move.d 0x40800000, $sp
56
57 ;; Figure out where the compressed piggyback image is
58 ;; in the flash (since we wont try to copy it to DRAM
59 ;; before unpacking). It is at _edata, but in flash.
60 ;; Use (_edata - basse) as offset to the current PC.
61
62basse: move.d $pc, $r5
63 and.d 0x7fffffff, $r5 ; strip any non-cache bit
64 subq 2, $r5 ; compensate for the move.d $pc instr
65 move.d $r5, $r0 ; save for later - flash address of 'basse'
66 add.d _edata, $r5
67 sub.d basse, $r5 ; $r5 = flash address of '_edata'
68
69 ;; Copy text+data to DRAM
70
71 move.d basse, $r1 ; destination
72 move.d _edata, $r2 ; end destination
731: move.w [$r0+], $r3
74 move.w $r3, [$r1+]
75 cmp.d $r2, $r1
76 bcs 1b
77 nop
78
79 move.d $r5, [input_data] ; for the decompressor
80
81
82 ;; Clear the decompressors BSS (between _edata and _end)
83
84 moveq 0, $r0
85 move.d _edata, $r1
86 move.d _end, $r2
871: move.w $r0, [$r1+]
88 cmp.d $r2, $r1
89 bcs 1b
90 nop
91
92 ;; Save command line magic and address.
93 move.d _cmd_line_magic, $r12
94 move.d $r10, [$r12]
95 move.d _cmd_line_addr, $r12
96 move.d $r11, [$r12]
97
98 ;; Do the decompression and save compressed size in inptr
99
100 jsr decompress_kernel
101
102 ;; Put start address of root partition in $r9 so the kernel can use it
103 ;; when mounting from flash
104
105 move.d [input_data], $r9 ; flash address of compressed kernel
106 add.d [inptr], $r9 ; size of compressed kernel
107
108 ;; Restore command line magic and address.
109 move.d _cmd_line_magic, $r10
110 move.d [$r10], $r10
111 move.d _cmd_line_addr, $r11
112 move.d [$r11], $r11
113
114 ;; Enter the decompressed kernel
115 move.d RAM_INIT_MAGIC, $r8 ; Tell kernel that DRAM is initialized
116 jump 0x40004000 ; kernel is linked to this address
117
118 .data
119
120input_data:
121 .dword 0 ; used by the decompressor
122_cmd_line_magic:
123 .dword 0
124_cmd_line_addr:
125 .dword 0
126#include "../../lib/hw_settings.S"
diff --git a/arch/cris/arch-v10/boot/compressed/misc.c b/arch/cris/arch-v10/boot/compressed/misc.c
deleted file mode 100644
index a4db1507d3b..00000000000
--- a/arch/cris/arch-v10/boot/compressed/misc.c
+++ /dev/null
@@ -1,246 +0,0 @@
1/*
2 * 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 * puts by Nick Holloway 1993, better puts by Martin Mares 1995
9 * adaptation for Linux/CRIS Axis Communications AB, 1999
10 *
11 */
12
13/* where the piggybacked kernel image expects itself to live.
14 * it is the same address we use when we network load an uncompressed
15 * image into DRAM, and it is the address the kernel is linked to live
16 * at by vmlinux.lds.S
17 */
18
19#define KERNEL_LOAD_ADR 0x40004000
20
21
22#include <linux/types.h>
23#include <arch/svinto.h>
24
25/*
26 * gzip declarations
27 */
28
29#define OF(args) args
30#define STATIC static
31
32void *memset(void *s, int c, size_t n);
33void *memcpy(void *__dest, __const void *__src, size_t __n);
34
35#define memzero(s, n) memset((s), 0, (n))
36
37typedef unsigned char uch;
38typedef unsigned short ush;
39typedef unsigned long ulg;
40
41#define WSIZE 0x8000 /* Window size must be at least 32k, */
42 /* and a power of two */
43
44static uch *inbuf; /* input buffer */
45static uch window[WSIZE]; /* Sliding window buffer */
46
47unsigned inptr = 0; /* index of next byte to be processed in inbuf
48 * After decompression it will contain the
49 * compressed size, and head.S will read it.
50 */
51
52static unsigned outcnt = 0; /* bytes in output buffer */
53
54/* gzip flag byte */
55#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
56#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
57#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
58#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
59#define COMMENT 0x10 /* bit 4 set: file comment present */
60#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */
61#define RESERVED 0xC0 /* bit 6,7: reserved */
62
63#define get_byte() (inbuf[inptr++])
64
65/* Diagnostic functions */
66#ifdef DEBUG
67# define Assert(cond, msg) do { \
68 if (!(cond)) \
69 error(msg); \
70 } while (0)
71# define Trace(x) fprintf x
72# define Tracev(x) do { \
73 if (verbose) \
74 fprintf x; \
75 } while (0)
76# define Tracevv(x) do { \
77 if (verbose > 1) \
78 fprintf x; \
79 } while (0)
80# define Tracec(c, x) do { \
81 if (verbose && (c)) \
82 fprintf x; \
83 } while (0)
84# define Tracecv(c, x) do { \
85 if (verbose > 1 && (c)) \
86 fprintf x; \
87 } while (0)
88#else
89# define Assert(cond, msg)
90# define Trace(x)
91# define Tracev(x)
92# define Tracevv(x)
93# define Tracec(c, x)
94# define Tracecv(c, x)
95#endif
96
97static void flush_window(void);
98static void error(char *m);
99
100extern char *input_data; /* lives in head.S */
101
102static long bytes_out = 0;
103static uch *output_data;
104static unsigned long output_ptr = 0;
105static void puts(const char *);
106
107/* the "heap" is put directly after the BSS ends, at end */
108
109extern int _end;
110static long free_mem_ptr = (long)&_end;
111static long free_mem_end_ptr;
112
113#include "../../../../../lib/inflate.c"
114
115/* decompressor info and error messages to serial console */
116
117static void
118puts(const char *s)
119{
120#ifndef CONFIG_ETRAX_DEBUG_PORT_NULL
121 while (*s) {
122#ifdef CONFIG_ETRAX_DEBUG_PORT0
123 while (!(*R_SERIAL0_STATUS & (1 << 5))) ;
124 *R_SERIAL0_TR_DATA = *s++;
125#endif
126#ifdef CONFIG_ETRAX_DEBUG_PORT1
127 while (!(*R_SERIAL1_STATUS & (1 << 5))) ;
128 *R_SERIAL1_TR_DATA = *s++;
129#endif
130#ifdef CONFIG_ETRAX_DEBUG_PORT2
131 while (!(*R_SERIAL2_STATUS & (1 << 5))) ;
132 *R_SERIAL2_TR_DATA = *s++;
133#endif
134#ifdef CONFIG_ETRAX_DEBUG_PORT3
135 while (!(*R_SERIAL3_STATUS & (1 << 5))) ;
136 *R_SERIAL3_TR_DATA = *s++;
137#endif
138 }
139#endif
140}
141
142void *memset(void *s, int c, size_t n)
143{
144 int i;
145 char *ss = (char *)s;
146
147 for (i = 0; i < n; i++)
148 ss[i] = c;
149
150 return s;
151}
152
153void *memcpy(void *__dest, __const void *__src, size_t __n)
154{
155 int i;
156 char *d = (char *)__dest, *s = (char *)__src;
157
158 for (i = 0; i < __n; i++)
159 d[i] = s[i];
160
161 return __dest;
162}
163
164/* ===========================================================================
165 * Write the output window window[0..outcnt-1] and update crc and bytes_out.
166 * (Used for the decompressed data only.)
167 */
168
169static void flush_window(void)
170{
171 ulg c = crc; /* temporary variable */
172 unsigned n;
173 uch *in, *out, ch;
174
175 in = window;
176 out = &output_data[output_ptr];
177 for (n = 0; n < outcnt; n++) {
178 ch = *out = *in;
179 out++;
180 in++;
181 c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
182 }
183 crc = c;
184 bytes_out += (ulg)outcnt;
185 output_ptr += (ulg)outcnt;
186 outcnt = 0;
187}
188
189static void error(char *x)
190{
191 puts("\n\n");
192 puts(x);
193 puts("\n\n -- System halted\n");
194
195 while (1); /* Halt */
196}
197
198void setup_normal_output_buffer(void)
199{
200 output_data = (char *)KERNEL_LOAD_ADR;
201}
202
203void decompress_kernel(void)
204{
205 char revision;
206
207 /* input_data is set in head.S */
208 inbuf = input_data;
209
210#ifdef CONFIG_ETRAX_DEBUG_PORT0
211 *R_SERIAL0_XOFF = 0;
212 *R_SERIAL0_BAUD = 0x99;
213 *R_SERIAL0_TR_CTRL = 0x40;
214#endif
215#ifdef CONFIG_ETRAX_DEBUG_PORT1
216 *R_SERIAL1_XOFF = 0;
217 *R_SERIAL1_BAUD = 0x99;
218 *R_SERIAL1_TR_CTRL = 0x40;
219#endif
220#ifdef CONFIG_ETRAX_DEBUG_PORT2
221 *R_GEN_CONFIG = 0x08;
222 *R_SERIAL2_XOFF = 0;
223 *R_SERIAL2_BAUD = 0x99;
224 *R_SERIAL2_TR_CTRL = 0x40;
225#endif
226#ifdef CONFIG_ETRAX_DEBUG_PORT3
227 *R_GEN_CONFIG = 0x100;
228 *R_SERIAL3_XOFF = 0;
229 *R_SERIAL3_BAUD = 0x99;
230 *R_SERIAL3_TR_CTRL = 0x40;
231#endif
232
233 setup_normal_output_buffer();
234
235 makecrc();
236
237 __asm__ volatile ("move $vr,%0" : "=rm" (revision));
238 if (revision < 10) {
239 puts("You need an ETRAX 100LX to run linux 2.6\n");
240 while (1);
241 }
242
243 puts("Uncompressing Linux...\n");
244 gunzip();
245 puts("Done. Now booting the kernel.\n");
246}
diff --git a/arch/cris/arch-v10/boot/rescue/Makefile b/arch/cris/arch-v10/boot/rescue/Makefile
deleted file mode 100644
index 82ab59b968e..00000000000
--- a/arch/cris/arch-v10/boot/rescue/Makefile
+++ /dev/null
@@ -1,35 +0,0 @@
1#
2# Makefile for rescue (bootstrap) code
3#
4
5ccflags-y += -O2 $(LINUXINCLUDE)
6asflags-y += $(LINUXINCLUDE)
7ldflags-y += -T $(srctree)/$(src)/rescue.lds
8OBJCOPYFLAGS = -O binary --remove-section=.bss
9obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o
10OBJECT := $(obj)/head.o
11
12targets := rescue.o rescue.bin
13
14$(obj)/rescue.o: $(OBJECT) FORCE
15 $(call if_changed,ld)
16
17$(obj)/rescue.bin: $(obj)/rescue.o FORCE
18 $(call if_changed,objcopy)
19 cp -p $(obj)/rescue.bin $(objtree)
20
21$(obj)/testrescue.bin: $(obj)/testrescue.o
22 $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/testrescue.o tr.bin
23# Pad it to 784 bytes
24 dd if=/dev/zero of=tmp2423 bs=1 count=784
25 cat tr.bin tmp2423 >testrescue_tmp.bin
26 dd if=testrescue_tmp.bin of=$(obj)/testrescue.bin bs=1 count=784
27 rm tr.bin tmp2423 testrescue_tmp.bin
28
29$(obj)/kimagerescue.bin: $(obj)/kimagerescue.o
30 $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/kimagerescue.o ktr.bin
31# Pad it to 784 bytes, that's what the rescue loader expects
32 dd if=/dev/zero of=tmp2423 bs=1 count=784
33 cat ktr.bin tmp2423 >kimagerescue_tmp.bin
34 dd if=kimagerescue_tmp.bin of=$(obj)/kimagerescue.bin bs=1 count=784
35 rm ktr.bin tmp2423 kimagerescue_tmp.bin
diff --git a/arch/cris/arch-v10/boot/rescue/head.S b/arch/cris/arch-v10/boot/rescue/head.S
deleted file mode 100644
index fb503d1eeea..00000000000
--- a/arch/cris/arch-v10/boot/rescue/head.S
+++ /dev/null
@@ -1,360 +0,0 @@
1/*
2 * Rescue code, made to reside at the beginning of the
3 * flash-memory. when it starts, it checks a partition
4 * table at the first sector after the rescue sector.
5 * the partition table was generated by the product builder
6 * script and contains offsets, lengths, types and checksums
7 * for each partition that this code should check.
8 *
9 * If any of the checksums fail, we assume the flash is so
10 * corrupt that we cant use it to boot into the ftp flash
11 * loader, and instead we initialize the serial port to
12 * receive a flash-loader and new flash image. we dont include
13 * any flash code here, but just accept a certain amount of
14 * bytes from the serial port and jump into it. the downloaded
15 * code is put in the cache.
16 *
17 * The partitiontable is designed so that it is transparent to
18 * code execution - it has a relative branch opcode in the
19 * beginning that jumps over it. each entry contains extra
20 * data so we can add stuff later.
21 *
22 * Partition table format:
23 *
24 * Code transparency:
25 *
26 * 2 bytes [opcode 'nop']
27 * 2 bytes [opcode 'di']
28 * 4 bytes [opcode 'ba <offset>', 8-bit or 16-bit version]
29 * 2 bytes [opcode 'nop', delay slot]
30 *
31 * Table validation (at +10):
32 *
33 * 2 bytes [magic/version word for partitiontable - 0xef, 0xbe]
34 * 2 bytes [length of all entries plus the end marker]
35 * 4 bytes [checksum for the partitiontable itself]
36 *
37 * Entries, each with the following format, last has offset -1:
38 *
39 * 4 bytes [offset in bytes, from start of flash]
40 * 4 bytes [length in bytes of partition]
41 * 4 bytes [checksum, simple longword sum]
42 * 2 bytes [partition type]
43 * 2 bytes [flags, only bit 0 used, ro/rw = 1/0]
44 * 16 bytes [reserved for future use]
45 *
46 * End marker
47 *
48 * 4 bytes [-1]
49 *
50 * 10 bytes [0, padding]
51 *
52 * Bit 0 in flags signifies RW or RO. The rescue code only bothers
53 * to check the checksum for RO partitions, since the others will
54 * change their data without updating the checksums. A 1 in bit 0
55 * means RO, 0 means RW. That way, it is possible to set a partition
56 * in RO mode initially, and later mark it as RW, since you can always
57 * write 0's to the flash.
58 *
59 * During the wait for serial input, the status LED will flash so the
60 * user knows something went wrong.
61 *
62 * Copyright (C) 1999-2007 Axis Communications AB
63 */
64
65#ifdef CONFIG_ETRAX_AXISFLASHMAP
66
67#define ASSEMBLER_MACROS_ONLY
68#include <arch/sv_addr_ag.h>
69
70 ;; The partitiontable is looked for at the first sector after the boot
71 ;; sector. Sector size is 65536 bytes in all flashes we use.
72
73#define PTABLE_START CONFIG_ETRAX_PTABLE_SECTOR
74#define PTABLE_MAGIC 0xbeef
75
76 ;; The normal Etrax100 on-chip boot ROM does serial boot at 0x380000f0.
77 ;; That is not where we put our downloaded serial boot-code.
78 ;; The length is enough for downloading code that loads the rest
79 ;; of itself (after having setup the DRAM etc).
80 ;; It is the same length as the on-chip ROM loads, so the same
81 ;; host loader can be used to load a rescued product as well as
82 ;; one booted through the Etrax serial boot code.
83
84#define CODE_START 0x40000000
85#define CODE_LENGTH 784
86
87#ifdef CONFIG_ETRAX_RESCUE_SER0
88#define SERXOFF R_SERIAL0_XOFF
89#define SERBAUD R_SERIAL0_BAUD
90#define SERRECC R_SERIAL0_REC_CTRL
91#define SERRDAT R_SERIAL0_REC_DATA
92#define SERSTAT R_SERIAL0_STATUS
93#endif
94#ifdef CONFIG_ETRAX_RESCUE_SER1
95#define SERXOFF R_SERIAL1_XOFF
96#define SERBAUD R_SERIAL1_BAUD
97#define SERRECC R_SERIAL1_REC_CTRL
98#define SERRDAT R_SERIAL1_REC_DATA
99#define SERSTAT R_SERIAL1_STATUS
100#endif
101#ifdef CONFIG_ETRAX_RESCUE_SER2
102#define SERXOFF R_SERIAL2_XOFF
103#define SERBAUD R_SERIAL2_BAUD
104#define SERRECC R_SERIAL2_REC_CTRL
105#define SERRDAT R_SERIAL2_REC_DATA
106#define SERSTAT R_SERIAL2_STATUS
107#endif
108#ifdef CONFIG_ETRAX_RESCUE_SER3
109#define SERXOFF R_SERIAL3_XOFF
110#define SERBAUD R_SERIAL3_BAUD
111#define SERRECC R_SERIAL3_REC_CTRL
112#define SERRDAT R_SERIAL3_REC_DATA
113#define SERSTAT R_SERIAL3_STATUS
114#endif
115
116#define NOP_DI 0xf025050f
117#define RAM_INIT_MAGIC 0x56902387
118
119 .text
120
121 ;; This is the entry point of the rescue code
122 ;; 0x80000000 if loaded in flash (as it should be)
123 ;; Since etrax actually starts at address 2 when booting from flash, we
124 ;; put a nop (2 bytes) here first so we dont accidentally skip the di
125
126 nop
127 di
128
129 jump in_cache ; enter cached area instead
130in_cache:
131
132
133 ;; First put a jump test to give a possibility of upgrading the
134 ;; rescue code without erasing/reflashing the sector.
135 ;; We put a longword of -1 here and if it is not -1, we jump using
136 ;; the value as jump target. Since we can always change 1's to 0's
137 ;; without erasing the sector, it is possible to add new
138 ;; code after this and altering the jumptarget in an upgrade.
139
140jtcd: move.d [jumptarget], $r0
141 cmp.d 0xffffffff, $r0
142 beq no_newjump
143 nop
144
145 jump [$r0]
146
147jumptarget:
148 .dword 0xffffffff ; can be overwritten later to insert new code
149
150no_newjump:
151#ifdef CONFIG_ETRAX_ETHERNET
152 ;; Start MII clock to make sure it is running when tranceiver is reset
153 move.d 0x3, $r0 ; enable = on, phy = mii_clk
154 move.d $r0, [R_NETWORK_GEN_CONFIG]
155#endif
156
157 ;; We need to setup the bus registers before we start using the DRAM
158#include "../../lib/dram_init.S"
159
160 ;; we now should go through the checksum-table and check the listed
161 ;; partitions for errors.
162
163 move.d PTABLE_START, $r3
164 move.d [$r3], $r0
165 cmp.d NOP_DI, $r0 ; make sure the nop/di is there...
166 bne do_rescue
167 nop
168
169 ;; skip the code transparency block (10 bytes).
170
171 addq 10, $r3
172
173 ;; check for correct magic
174
175 move.w [$r3+], $r0
176 cmp.w PTABLE_MAGIC, $r0
177 bne do_rescue ; didn't recognize - trig rescue
178 nop
179
180 ;; check for correct ptable checksum
181
182 movu.w [$r3+], $r2 ; ptable length
183 move.d $r2, $r8 ; save for later, length of total ptable
184 addq 28, $r8 ; account for the rest
185 move.d [$r3+], $r4 ; ptable checksum
186 move.d $r3, $r1
187 jsr checksum ; r1 source, r2 length, returns in r0
188
189 cmp.d $r0, $r4
190 bne do_rescue ; didn't match - trig rescue
191 nop
192
193 ;; ptable is ok. validate each entry.
194
195 moveq -1, $r7
196
197ploop: move.d [$r3+], $r1 ; partition offset (from ptable start)
198 bne notfirst ; check if it is the partition containing ptable
199 nop ; yes..
200 move.d $r8, $r1 ; for its checksum check, skip the ptable
201 move.d [$r3+], $r2 ; partition length
202 sub.d $r8, $r2 ; minus the ptable length
203 ba bosse
204 nop
205notfirst:
206 cmp.d -1, $r1 ; the end of the ptable ?
207 beq flash_ok ; if so, the flash is validated
208 move.d [$r3+], $r2 ; partition length
209bosse: move.d [$r3+], $r5 ; checksum
210 move.d [$r3+], $r4 ; type and flags
211 addq 16, $r3 ; skip the reserved bytes
212 btstq 16, $r4 ; check ro flag
213 bpl ploop ; rw partition, skip validation
214 nop
215 btstq 17, $r4 ; check bootable flag
216 bpl 1f
217 nop
218 move.d $r1, $r7 ; remember boot partition offset
2191:
220 add.d PTABLE_START, $r1
221
222 jsr checksum ; checksum the partition
223
224 cmp.d $r0, $r5
225 beq ploop ; checksums matched, go to next entry
226 nop
227
228 ;; otherwise fall through to the rescue code.
229
230do_rescue:
231 ;; setup port PA and PB default initial directions and data
232 ;; (so we can flash LEDs, and so that DTR and others are set)
233
234 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR, $r0
235 move.b $r0, [R_PORT_PA_DIR]
236 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r0
237 move.b $r0, [R_PORT_PA_DATA]
238
239 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR, $r0
240 move.b $r0, [R_PORT_PB_DIR]
241 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, $r0
242 move.b $r0, [R_PORT_PB_DATA]
243
244 ;; setup the serial port at 115200 baud
245
246 moveq 0, $r0
247 move.d $r0, [SERXOFF]
248
249 move.b 0x99, $r0
250 move.b $r0, [SERBAUD] ; 115.2kbaud for both transmit and receive
251
252 move.b 0x40, $r0 ; rec enable
253 move.b $r0, [SERRECC]
254
255 moveq 0, $r1 ; "timer" to clock out a LED red flash
256 move.d CODE_START, $r3 ; destination counter
257 movu.w CODE_LENGTH, $r4; length
258
259wait_ser:
260 addq 1, $r1
261#ifndef CONFIG_ETRAX_NO_LEDS
262#ifdef CONFIG_ETRAX_PA_LEDS
263 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r2
264#endif
265#ifdef CONFIG_ETRAX_PB_LEDS
266 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, $r2
267#endif
268 move.d (1 << CONFIG_ETRAX_LED1R) | (1 << CONFIG_ETRAX_LED2R), $r0
269 btstq 16, $r1
270 bpl 1f
271 nop
272 or.d $r0, $r2 ; set bit
273 ba 2f
274 nop
2751: not $r0 ; clear bit
276 and.d $r0, $r2
2772:
278#ifdef CONFIG_ETRAX_PA_LEDS
279 move.b $r2, [R_PORT_PA_DATA]
280#endif
281#ifdef CONFIG_ETRAX_PB_LEDS
282 move.b $r2, [R_PORT_PB_DATA]
283#endif
284#ifdef CONFIG_ETRAX_90000000_LEDS
285 move.b $r2, [0x90000000]
286#endif
287#endif
288
289 ;; check if we got something on the serial port
290
291 move.b [SERSTAT], $r0
292 btstq 0, $r0 ; data_avail
293 bpl wait_ser
294 nop
295
296 ;; got something - copy the byte and loop
297
298 move.b [SERRDAT], $r0
299 move.b $r0, [$r3+]
300
301 subq 1, $r4 ; decrease length
302 bne wait_ser
303 nop
304
305 ;; jump into downloaded code
306
307 move.d RAM_INIT_MAGIC, $r8 ; Tell next product that DRAM is
308 ; initialized
309 jump CODE_START
310
311flash_ok:
312 ;; check r7, which contains either -1 or the partition to boot from
313
314 cmp.d -1, $r7
315 bne 1f
316 nop
317 move.d PTABLE_START, $r7; otherwise use the ptable start
3181:
319 move.d RAM_INIT_MAGIC, $r8 ; Tell next product that DRAM is
320 ; initialized
321 jump $r7 ; boot!
322
323
324 ;; Helper subroutines
325
326 ;; Will checksum by simple addition
327 ;; r1 - source
328 ;; r2 - length in bytes
329 ;; result will be in r0
330checksum:
331 moveq 0, $r0
332 moveq CONFIG_ETRAX_FLASH1_SIZE, $r6
333
334 ;; If the first physical flash memory is exceeded wrap to the
335 ;; second one
336 btstq 26, $r1 ; Are we addressing first flash?
337 bpl 1f
338 nop
339 clear.d $r6
340
3411: test.d $r6 ; 0 = no wrapping
342 beq 2f
343 nop
344 lslq 20, $r6 ; Convert MB to bytes
345 sub.d $r1, $r6
346
3472: addu.b [$r1+], $r0
348 subq 1, $r6 ; Flash memory left
349 beq 3f
350 subq 1, $r2 ; Length left
351 bne 2b
352 nop
353 ret
354 nop
355
3563: move.d MEM_CSE1_START, $r1 ; wrap to second flash
357 ba 2b
358 nop
359
360#endif
diff --git a/arch/cris/arch-v10/boot/rescue/kimagerescue.S b/arch/cris/arch-v10/boot/rescue/kimagerescue.S
deleted file mode 100644
index 6f7b3e61260..00000000000
--- a/arch/cris/arch-v10/boot/rescue/kimagerescue.S
+++ /dev/null
@@ -1,143 +0,0 @@
1/*
2 * Rescue code to be prepended on a kimage and copied to the
3 * rescue serial port.
4 * This is called from the rescue code, it will copy received data to
5 * 4004000 and after a timeout jump to it.
6 */
7
8#define ASSEMBLER_MACROS_ONLY
9#include <arch/sv_addr_ag.h>
10
11#define CODE_START 0x40004000
12#define CODE_LENGTH 784
13#define TIMEOUT_VALUE 1000
14
15
16#ifdef CONFIG_ETRAX_RESCUE_SER0
17#define SERXOFF R_SERIAL0_XOFF
18#define SERBAUD R_SERIAL0_BAUD
19#define SERRECC R_SERIAL0_REC_CTRL
20#define SERRDAT R_SERIAL0_REC_DATA
21#define SERSTAT R_SERIAL0_STATUS
22#endif
23#ifdef CONFIG_ETRAX_RESCUE_SER1
24#define SERXOFF R_SERIAL1_XOFF
25#define SERBAUD R_SERIAL1_BAUD
26#define SERRECC R_SERIAL1_REC_CTRL
27#define SERRDAT R_SERIAL1_REC_DATA
28#define SERSTAT R_SERIAL1_STATUS
29#endif
30#ifdef CONFIG_ETRAX_RESCUE_SER2
31#define SERXOFF R_SERIAL2_XOFF
32#define SERBAUD R_SERIAL2_BAUD
33#define SERRECC R_SERIAL2_REC_CTRL
34#define SERRDAT R_SERIAL2_REC_DATA
35#define SERSTAT R_SERIAL2_STATUS
36#endif
37#ifdef CONFIG_ETRAX_RESCUE_SER3
38#define SERXOFF R_SERIAL3_XOFF
39#define SERBAUD R_SERIAL3_BAUD
40#define SERRECC R_SERIAL3_REC_CTRL
41#define SERRDAT R_SERIAL3_REC_DATA
42#define SERSTAT R_SERIAL3_STATUS
43#endif
44
45 .text
46 ;; This is the entry point of the rescue code
47 ;; 0x80000000 if loaded in flash (as it should be)
48 ;; since etrax actually starts at address 2 when booting from flash, we
49 ;; put a nop (2 bytes) here first so we dont accidentally skip the di
50
51 nop
52 di
53#ifndef CONFIG_SVINTO_SIM
54 ;; setup port PA and PB default initial directions and data
55 ;; (so we can flash LEDs, and so that DTR and others are set)
56
57 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR, $r0
58 move.b $r0, [R_PORT_PA_DIR]
59 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r0
60 move.b $r0, [R_PORT_PA_DATA]
61
62 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR, $r0
63 move.b $r0, [R_PORT_PB_DIR]
64 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, $r0
65 move.b $r0, [R_PORT_PB_DATA]
66
67 ;; We need to setup the bus registers before we start using the DRAM
68#include "../../lib/dram_init.S"
69
70#endif
71 ;; Setup the stack to a suitably high address.
72 ;; We assume 8 MB is the minimum DRAM in an eLinux
73 ;; product and put the sp at the top for now.
74
75 move.d 0x40800000, $sp
76
77 ;; setup the serial port at 115200 baud
78
79 moveq 0, $r0
80 move.d $r0, [SERXOFF]
81
82 move.b 0x99, $r0
83 move.b $r0, [SERBAUD] ; 115.2kbaud for both transmit
84 ; and receive
85
86 move.b 0x40, $r0 ; rec enable
87 move.b $r0, [SERRECC]
88
89
90 moveq 0, $r1 ; "timer" to clock out a LED red flash
91 move.d CODE_START, $r3 ; destination counter
92 move.d CODE_LENGTH, $r4 ; length
93 move.d TIMEOUT_VALUE, $r5 ; "timeout" until jump
94
95wait_ser:
96 addq 1, $r1
97 subq 1, $r5 ; decrease timeout
98 beq jump_start ; timed out
99 nop
100#ifndef CONFIG_ETRAX_NO_LEDS
101#ifdef CONFIG_ETRAX_PA_LEDS
102 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r2
103#endif
104#ifdef CONFIG_ETRAX_PB_LEDS
105 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, $r2
106#endif
107 move.d (1 << CONFIG_ETRAX_LED1R) | (1 << CONFIG_ETRAX_LED2R), $r0
108 btstq 16, $r1
109 bpl 1f
110 nop
111 or.d $r0, $r2 ; set bit
112 ba 2f
113 nop
1141: not $r0 ; clear bit
115 and.d $r0, $r2
1162:
117#ifdef CONFIG_ETRAX_PA_LEDS
118 move.b $r2, [R_PORT_PA_DATA]
119#endif
120#ifdef CONFIG_ETRAX_PB_LEDS
121 move.b $r2, [R_PORT_PB_DATA]
122#endif
123#endif
124
125 ;; check if we got something on the serial port
126
127 move.b [SERSTAT], $r0
128 btstq 0, $r0 ; data_avail
129 bpl wait_ser
130 nop
131
132 ;; got something - copy the byte and loop
133
134 move.b [SERRDAT], $r0
135 move.b $r0, [$r3+]
136 move.d TIMEOUT_VALUE, $r5 ; reset "timeout"
137 subq 1, $r4 ; decrease length
138 bne wait_ser
139 nop
140jump_start:
141 ;; jump into downloaded code
142
143 jump CODE_START
diff --git a/arch/cris/arch-v10/boot/rescue/rescue.lds b/arch/cris/arch-v10/boot/rescue/rescue.lds
deleted file mode 100644
index 0b52a9490db..00000000000
--- a/arch/cris/arch-v10/boot/rescue/rescue.lds
+++ /dev/null
@@ -1,20 +0,0 @@
1MEMORY
2 {
3 flash : ORIGIN = 0x00000000,
4 LENGTH = 0x00100000
5 }
6
7SECTIONS
8{
9 .text :
10 {
11 stext = . ;
12 *(.text)
13 etext = . ;
14 } > flash
15 .data :
16 {
17 *(.data)
18 edata = . ;
19 } > flash
20}
diff --git a/arch/cris/arch-v10/boot/rescue/testrescue.S b/arch/cris/arch-v10/boot/rescue/testrescue.S
deleted file mode 100644
index fc7ec674eca..00000000000
--- a/arch/cris/arch-v10/boot/rescue/testrescue.S
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * Simple testcode to download by the rescue block.
3 * Just lights some LEDs to show it was downloaded correctly.
4 *
5 * Copyright (C) 1999 Axis Communications AB
6 */
7
8#define ASSEMBLER_MACROS_ONLY
9#include <arch/sv_addr_ag.h>
10
11 .text
12
13 nop
14 nop
15 moveq -1, $r2
16 move.b $r2, [R_PORT_PA_DIR]
17 moveq 0, $r2
18 move.b $r2, [R_PORT_PA_DATA]
19
20endless:
21 nop
22 ba endless
23 nop
24
diff --git a/arch/cris/arch-v10/boot/tools/build.c b/arch/cris/arch-v10/boot/tools/build.c
deleted file mode 100644
index c8adef36416..00000000000
--- a/arch/cris/arch-v10/boot/tools/build.c
+++ /dev/null
@@ -1,287 +0,0 @@
1/*
2 * linux/tools/build.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 */
6
7/*
8 * This file builds a disk-image from three different files:
9 *
10 * - bootsect: exactly 512 bytes of 8086 machine code, loads the rest
11 * - setup: 8086 machine code, sets up system parm
12 * - system: 80386 code for actual system
13 *
14 * It does some checking that all files are of the correct type, and
15 * just writes the result to stdout, removing headers and padding to
16 * the right amount. It also writes some system data to stderr.
17 */
18
19/*
20 * Changes by tytso to allow root device specification
21 * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996
22 * Cross compiling fixes by Gertjan van Wingerde, July 1996
23 */
24
25#include <stdio.h> /* fprintf */
26#include <string.h>
27#include <stdlib.h> /* contains exit */
28#include <sys/types.h> /* unistd.h needs this */
29#include <sys/stat.h>
30#include <sys/sysmacros.h>
31#include <unistd.h> /* contains read/write */
32#include <fcntl.h>
33#include <errno.h>
34
35#define MINIX_HEADER 32
36
37#define N_MAGIC_OFFSET 1024
38#ifndef __BFD__
39static int GCC_HEADER = sizeof(struct exec);
40#endif
41
42#ifdef __BIG_KERNEL__
43#define SYS_SIZE 0xffff
44#else
45#define SYS_SIZE DEF_SYSSIZE
46#endif
47
48#define DEFAULT_MAJOR_ROOT 0
49#define DEFAULT_MINOR_ROOT 0
50
51/* max nr of sectors of setup: don't change unless you also change
52 * bootsect etc */
53#define SETUP_SECTS 4
54
55#define STRINGIFY(x) #x
56
57typedef union {
58 int i;
59 long l;
60 short s[2];
61 char b[4];
62} conv;
63
64long intel_long(long l)
65{
66 conv t;
67
68 t.b[0] = l & 0xff; l >>= 8;
69 t.b[1] = l & 0xff; l >>= 8;
70 t.b[2] = l & 0xff; l >>= 8;
71 t.b[3] = l & 0xff; l >>= 8;
72 return t.l;
73}
74
75int intel_int(int i)
76{
77 conv t;
78
79 t.b[0] = i & 0xff; i >>= 8;
80 t.b[1] = i & 0xff; i >>= 8;
81 t.b[2] = i & 0xff; i >>= 8;
82 t.b[3] = i & 0xff; i >>= 8;
83 return t.i;
84}
85
86short intel_short(short l)
87{
88 conv t;
89
90 t.b[0] = l & 0xff; l >>= 8;
91 t.b[1] = l & 0xff; l >>= 8;
92 return t.s[0];
93}
94
95void die(const char * str)
96{
97 fprintf(stderr,"%s\n",str);
98 exit(1);
99}
100
101void usage(void)
102{
103 die("Usage: build bootsect setup system [rootdev] [> image]");
104}
105
106int main(int argc, char ** argv)
107{
108 int i,c,id,sz,tmp_int;
109 unsigned long sys_size, tmp_long;
110 char buf[1024];
111#ifndef __BFD__
112 struct exec *ex = (struct exec *)buf;
113#endif
114 char major_root, minor_root;
115 struct stat sb;
116 unsigned char setup_sectors;
117
118 if ((argc < 4) || (argc > 5))
119 usage();
120 if (argc > 4) {
121 if (!strcmp(argv[4], "CURRENT")) {
122 if (stat("/", &sb)) {
123 perror("/");
124 die("Couldn't stat /");
125 }
126 major_root = major(sb.st_dev);
127 minor_root = minor(sb.st_dev);
128 } else if (strcmp(argv[4], "FLOPPY")) {
129 if (stat(argv[4], &sb)) {
130 perror(argv[4]);
131 die("Couldn't stat root device.");
132 }
133 major_root = major(sb.st_rdev);
134 minor_root = minor(sb.st_rdev);
135 } else {
136 major_root = 0;
137 minor_root = 0;
138 }
139 } else {
140 major_root = DEFAULT_MAJOR_ROOT;
141 minor_root = DEFAULT_MINOR_ROOT;
142 }
143 fprintf(stderr, "Root device is (%d, %d)\n", major_root, minor_root);
144 for (i=0;i<sizeof buf; i++) buf[i]=0;
145 if ((id=open(argv[1],O_RDONLY,0))<0)
146 die("Unable to open 'boot'");
147 if (read(id,buf,MINIX_HEADER) != MINIX_HEADER)
148 die("Unable to read header of 'boot'");
149 if (((long *) buf)[0]!=intel_long(0x04100301))
150 die("Non-Minix header of 'boot'");
151 if (((long *) buf)[1]!=intel_long(MINIX_HEADER))
152 die("Non-Minix header of 'boot'");
153 if (((long *) buf)[3] != 0)
154 die("Illegal data segment in 'boot'");
155 if (((long *) buf)[4] != 0)
156 die("Illegal bss in 'boot'");
157 if (((long *) buf)[5] != 0)
158 die("Non-Minix header of 'boot'");
159 if (((long *) buf)[7] != 0)
160 die("Illegal symbol table in 'boot'");
161 i=read(id,buf,sizeof buf);
162 fprintf(stderr,"Boot sector %d bytes.\n",i);
163 if (i != 512)
164 die("Boot block must be exactly 512 bytes");
165 if ((*(unsigned short *)(buf+510)) != (unsigned short)intel_short(0xAA55))
166 die("Boot block hasn't got boot flag (0xAA55)");
167 buf[508] = (char) minor_root;
168 buf[509] = (char) major_root;
169 i=write(1,buf,512);
170 if (i!=512)
171 die("Write call failed");
172 close (id);
173
174 if ((id=open(argv[2],O_RDONLY,0))<0)
175 die("Unable to open 'setup'");
176 if (read(id,buf,MINIX_HEADER) != MINIX_HEADER)
177 die("Unable to read header of 'setup'");
178 if (((long *) buf)[0]!=intel_long(0x04100301))
179 die("Non-Minix header of 'setup'");
180 if (((long *) buf)[1]!=intel_long(MINIX_HEADER))
181 die("Non-Minix header of 'setup'");
182 if (((long *) buf)[3] != 0)
183 die("Illegal data segment in 'setup'");
184 if (((long *) buf)[4] != 0)
185 die("Illegal bss in 'setup'");
186 if (((long *) buf)[5] != 0)
187 die("Non-Minix header of 'setup'");
188 if (((long *) buf)[7] != 0)
189 die("Illegal symbol table in 'setup'");
190 for (i=0 ; (c=read(id,buf,sizeof buf))>0 ; i+=c )
191#ifdef __BIG_KERNEL__
192 {
193 if (!i) {
194 /* Working with memcpy because of alignment constraints
195 on Sparc - Gertjan */
196 memcpy(&tmp_long, &buf[2], sizeof(long));
197 if (tmp_long != intel_long(0x53726448) )
198 die("Wrong magic in loader header of 'setup'");
199 memcpy(&tmp_int, &buf[6], sizeof(int));
200 if (tmp_int < intel_int(0x200))
201 die("Wrong version of loader header of 'setup'");
202 buf[0x11] = 1; /* LOADED_HIGH */
203 tmp_long = intel_long(0x100000);
204 memcpy(&buf[0x14], &tmp_long, sizeof(long)); /* code32_start */
205 }
206#endif
207 if (write(1,buf,c)!=c)
208 die("Write call failed");
209#ifdef __BIG_KERNEL__
210 }
211#endif
212 if (c != 0)
213 die("read-error on 'setup'");
214 close (id);
215 setup_sectors = (unsigned char)((i + 511) / 512);
216 /* for compatibility with LILO */
217 if (setup_sectors < SETUP_SECTS)
218 setup_sectors = SETUP_SECTS;
219 fprintf(stderr,"Setup is %d bytes.\n",i);
220 for (c=0 ; c<sizeof(buf) ; c++)
221 buf[c] = '\0';
222 while (i < setup_sectors * 512) {
223 c = setup_sectors * 512 - i;
224 if (c > sizeof(buf))
225 c = sizeof(buf);
226 if (write(1,buf,c) != c)
227 die("Write call failed");
228 i += c;
229 }
230
231 if ((id=open(argv[3],O_RDONLY,0))<0)
232 die("Unable to open 'system'");
233#ifndef __BFD__
234 if (read(id,buf,GCC_HEADER) != GCC_HEADER)
235 die("Unable to read header of 'system'");
236 if (N_MAGIC(*ex) == ZMAGIC) {
237 GCC_HEADER = N_MAGIC_OFFSET;
238 lseek(id, GCC_HEADER, SEEK_SET);
239 } else if (N_MAGIC(*ex) != QMAGIC)
240 die("Non-GCC header of 'system'");
241 fprintf(stderr,"System is %d kB (%d kB code, %d kB data and %d kB bss)\n",
242 (ex->a_text+ex->a_data+ex->a_bss)/1024,
243 ex->a_text /1024,
244 ex->a_data /1024,
245 ex->a_bss /1024);
246 sz = N_SYMOFF(*ex) - GCC_HEADER + 4;
247#else
248 if (fstat (id, &sb)) {
249 perror ("fstat");
250 die ("Unable to stat 'system'");
251 }
252 sz = sb.st_size;
253 fprintf (stderr, "System is %d kB\n", sz/1024);
254#endif
255 sys_size = (sz + 15) / 16;
256 if (sys_size > SYS_SIZE)
257 die("System is too big");
258 while (sz > 0) {
259 int l, n;
260
261 l = sz;
262 if (l > sizeof(buf))
263 l = sizeof(buf);
264 if ((n=read(id, buf, l)) != l) {
265 if (n == -1)
266 perror(argv[1]);
267 else
268 fprintf(stderr, "Unexpected EOF\n");
269 die("Can't read 'system'");
270 }
271 if (write(1, buf, l) != l)
272 die("Write failed");
273 sz -= l;
274 }
275 close(id);
276 if (lseek(1, 497, 0) == 497) {
277 if (write(1, &setup_sectors, 1) != 1)
278 die("Write of setup sectors failed");
279 }
280 if (lseek(1,500,0) == 500) {
281 buf[0] = (sys_size & 0xff);
282 buf[1] = ((sys_size >> 8) & 0xff);
283 if (write(1, buf, 2) != 2)
284 die("Write failed");
285 }
286 return(0);
287}
diff --git a/arch/cris/arch-v10/kernel/entry.S b/arch/cris/arch-v10/kernel/entry.S
index 72f5cd319b9..2c18d08cd91 100644
--- a/arch/cris/arch-v10/kernel/entry.S
+++ b/arch/cris/arch-v10/kernel/entry.S
@@ -536,10 +536,10 @@ multiple_interrupt:
536 movem $r13, [$sp] 536 movem $r13, [$sp]
537 push $r10 ; push orig_r10 537 push $r10 ; push orig_r10
538 clear.d [$sp=$sp-4] ; frametype == 0, normal frame 538 clear.d [$sp=$sp-4] ; frametype == 0, normal frame
539 539
540 move.d $sp, $r10 540 move.d $sp, $r10
541 jsr do_multiple_IRQ 541 jsr do_multiple_IRQ
542 542
543 jump ret_from_intr 543 jump ret_from_intr
544 544
545do_sigtrap: 545do_sigtrap:
@@ -585,7 +585,7 @@ _ugdb_handle_breakpoint:
585 pop $r0 ; Restore r0. 585 pop $r0 ; Restore r0.
586 ba do_sigtrap ; SIGTRAP the offending process. 586 ba do_sigtrap ; SIGTRAP the offending process.
587 pop $dccr ; Restore dccr in delay slot. 587 pop $dccr ; Restore dccr in delay slot.
588 588
589 .global kernel_execve 589 .global kernel_execve
590kernel_execve: 590kernel_execve:
591 move.d __NR_execve, $r9 591 move.d __NR_execve, $r9
@@ -929,6 +929,14 @@ sys_call_table:
929 .long sys_fallocate 929 .long sys_fallocate
930 .long sys_timerfd_settime /* 325 */ 930 .long sys_timerfd_settime /* 325 */
931 .long sys_timerfd_gettime 931 .long sys_timerfd_gettime
932 .long sys_signalfd4
933 .long sys_eventfd2
934 .long sys_epoll_create1
935 .long sys_dup3 /* 330 */
936 .long sys_pipe2
937 .long sys_inotify_init1
938 .long sys_preadv
939 .long sys_pwritev
932 940
933 /* 941 /*
934 * NOTE!! This doesn't have to be exact - we just have 942 * NOTE!! This doesn't have to be exact - we just have