]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - arch/mips/dec/boot/decstation.c
Linux-2.6.12-rc2
[mirror_ubuntu-artful-kernel.git] / arch / mips / dec / boot / decstation.c
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
27 extern int _ftext, _end; /* begin and end of kernel image */
28 extern void kernel_entry(int, char **, unsigned long, int *);
29
30 void * 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
41 void 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 }