aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/dec/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/mips/dec/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/mips/dec/boot')
-rw-r--r--arch/mips/dec/boot/Makefile12
-rw-r--r--arch/mips/dec/boot/decstation.c83
-rw-r--r--arch/mips/dec/boot/ld.ecoff43
3 files changed, 138 insertions, 0 deletions
diff --git a/arch/mips/dec/boot/Makefile b/arch/mips/dec/boot/Makefile
new file mode 100644
index 000000000000..bcea41698ef5
--- /dev/null
+++ b/arch/mips/dec/boot/Makefile
@@ -0,0 +1,12 @@
1#
2# Makefile for the DECstation family specific parts of the kernel
3#
4
5netboot: all
6 $(LD) -N -G 0 -T ld.ecoff ../../boot/zImage \
7 dec_boot.o ramdisk.img -o nbImage
8
9obj-y := decstation.o
10
11clean:
12 rm -f nbImage
diff --git a/arch/mips/dec/boot/decstation.c b/arch/mips/dec/boot/decstation.c
new file mode 100644
index 000000000000..56fd4277555e
--- /dev/null
+++ b/arch/mips/dec/boot/decstation.c
@@ -0,0 +1,83 @@
1/*
2 * arch/mips/dec/decstation.c
3 */
4
5#define RELOC
6#define INITRD
7#define DEBUG_BOOT
8
9/*
10 * Magic number indicating REX PROM available on DECSTATION.
11 */
12#define REX_PROM_MAGIC 0x30464354
13
14#define REX_PROM_CLEARCACHE 0x7c/4
15#define REX_PROM_PRINTF 0x30/4
16
17#define VEC_RESET 0xBFC00000 /* Prom base address */
18#define PMAX_PROM_ENTRY(x) (VEC_RESET+((x)*8)) /* Prom jump table */
19#define PMAX_PROM_PRINTF PMAX_PROM_ENTRY(17)
20
21#define PARAM (k_start + 0x2000)
22
23#define LOADER_TYPE (*(unsigned char *) (PARAM+0x210))
24#define INITRD_START (*(unsigned long *) (PARAM+0x218))
25#define INITRD_SIZE (*(unsigned long *) (PARAM+0x21c))
26
27extern int _ftext, _end; /* begin and end of kernel image */
28extern void kernel_entry(int, char **, unsigned long, int *);
29
30void * memcpy(void * dest, const void *src, unsigned int count)
31{
32 unsigned long *tmp = (unsigned long *) dest, *s = (unsigned long *) src;
33
34 count >>= 2;
35 while (count--)
36 *tmp++ = *s++;
37
38 return dest;
39}
40
41void dec_entry(int argc, char **argv,
42 unsigned long magic, int *prom_vec)
43{
44 void (*rex_clear_cache)(void);
45 int (*prom_printf)(char *, ...);
46 unsigned long k_start, len;
47
48 /*
49 * The DS5100 leaves cpu with BEV enabled, clear it.
50 */
51 asm( "lui\t$8,0x3000\n\t"
52 "mtc0\t$8,$12\n\t"
53 ".section\t.sdata\n\t"
54 ".section\t.sbss\n\t"
55 ".section\t.text"
56 : : : "$8");
57
58#ifdef DEBUG_BOOT
59 if (magic == REX_PROM_MAGIC) {
60 prom_printf = (int (*)(char *, ...)) *(prom_vec + REX_PROM_PRINTF);
61 } else {
62 prom_printf = (int (*)(char *, ...)) PMAX_PROM_PRINTF;
63 }
64 prom_printf("Launching kernel...\n");
65#endif
66
67 k_start = (unsigned long) (&kernel_entry) & 0xffff0000;
68
69#ifdef RELOC
70 /*
71 * Now copy kernel image to its destination.
72 */
73 len = ((unsigned long) (&_end) - k_start);
74 memcpy((void *)k_start, &_ftext, len);
75#endif
76
77 if (magic == REX_PROM_MAGIC) {
78 rex_clear_cache = (void (*)(void)) * (prom_vec + REX_PROM_CLEARCACHE);
79 rex_clear_cache();
80 }
81
82 kernel_entry(argc, argv, magic, prom_vec);
83}
diff --git a/arch/mips/dec/boot/ld.ecoff b/arch/mips/dec/boot/ld.ecoff
new file mode 100644
index 000000000000..aaa633dfb5f7
--- /dev/null
+++ b/arch/mips/dec/boot/ld.ecoff
@@ -0,0 +1,43 @@
1OUTPUT_FORMAT("ecoff-littlemips")
2OUTPUT_ARCH(mips)
3ENTRY(dec_entry)
4SECTIONS
5{
6 . = 0x80200000;
7
8 .text :
9 {
10 _ftext = .;
11 *(.text)
12 *(.fixup)
13 }
14 .rdata :
15 {
16 *(.rodata .rodata.* .rdata)
17 }
18 .data :
19 {
20 . = ALIGN(0x1000);
21 ramdisk.img (.data)
22 *(.data)
23 }
24 .sdata :
25 {
26 *(.sdata)
27 }
28 _gp = .;
29 .sbss :
30 {
31 *(.sbss)
32 *(.scommon)
33 }
34 .bss :
35 {
36 *(.dynbss)
37 *(.bss)
38 *(COMMON)
39 }
40 /DISCARD/ : {
41 *(.reginfo .mdebug .note)
42 }
43}