]>
Commit | Line | Data |
---|---|---|
1da177e4 | 1 | /* |
f30c2269 | 2 | * arch/mips/dec/boot/decstation.c |
1da177e4 | 3 | */ |
9c1f1257 | 4 | #include <asm/sections.h> |
1da177e4 LT |
5 | |
6 | #define RELOC | |
7 | #define INITRD | |
8 | #define DEBUG_BOOT | |
9 | ||
10 | /* | |
11 | * Magic number indicating REX PROM available on DECSTATION. | |
12 | */ | |
13 | #define REX_PROM_MAGIC 0x30464354 | |
14 | ||
15 | #define REX_PROM_CLEARCACHE 0x7c/4 | |
16 | #define REX_PROM_PRINTF 0x30/4 | |
17 | ||
18 | #define VEC_RESET 0xBFC00000 /* Prom base address */ | |
19 | #define PMAX_PROM_ENTRY(x) (VEC_RESET+((x)*8)) /* Prom jump table */ | |
20 | #define PMAX_PROM_PRINTF PMAX_PROM_ENTRY(17) | |
21 | ||
22 | #define PARAM (k_start + 0x2000) | |
23 | ||
24 | #define LOADER_TYPE (*(unsigned char *) (PARAM+0x210)) | |
25 | #define INITRD_START (*(unsigned long *) (PARAM+0x218)) | |
26 | #define INITRD_SIZE (*(unsigned long *) (PARAM+0x21c)) | |
27 | ||
9c1f1257 | 28 | extern int _ftext; /* begin and end of kernel image */ |
1da177e4 LT |
29 | extern void kernel_entry(int, char **, unsigned long, int *); |
30 | ||
31 | void * memcpy(void * dest, const void *src, unsigned int count) | |
32 | { | |
33 | unsigned long *tmp = (unsigned long *) dest, *s = (unsigned long *) src; | |
34 | ||
35 | count >>= 2; | |
36 | while (count--) | |
37 | *tmp++ = *s++; | |
38 | ||
39 | return dest; | |
40 | } | |
41 | ||
42 | void dec_entry(int argc, char **argv, | |
43 | unsigned long magic, int *prom_vec) | |
44 | { | |
45 | void (*rex_clear_cache)(void); | |
46 | int (*prom_printf)(char *, ...); | |
47 | unsigned long k_start, len; | |
48 | ||
49 | /* | |
50 | * The DS5100 leaves cpu with BEV enabled, clear it. | |
51 | */ | |
52 | asm( "lui\t$8,0x3000\n\t" | |
53 | "mtc0\t$8,$12\n\t" | |
54 | ".section\t.sdata\n\t" | |
55 | ".section\t.sbss\n\t" | |
56 | ".section\t.text" | |
57 | : : : "$8"); | |
58 | ||
59 | #ifdef DEBUG_BOOT | |
60 | if (magic == REX_PROM_MAGIC) { | |
61 | prom_printf = (int (*)(char *, ...)) *(prom_vec + REX_PROM_PRINTF); | |
62 | } else { | |
63 | prom_printf = (int (*)(char *, ...)) PMAX_PROM_PRINTF; | |
64 | } | |
65 | prom_printf("Launching kernel...\n"); | |
66 | #endif | |
67 | ||
68 | k_start = (unsigned long) (&kernel_entry) & 0xffff0000; | |
69 | ||
70 | #ifdef RELOC | |
71 | /* | |
72 | * Now copy kernel image to its destination. | |
73 | */ | |
74 | len = ((unsigned long) (&_end) - k_start); | |
75 | memcpy((void *)k_start, &_ftext, len); | |
76 | #endif | |
77 | ||
78 | if (magic == REX_PROM_MAGIC) { | |
79 | rex_clear_cache = (void (*)(void)) * (prom_vec + REX_PROM_CLEARCACHE); | |
80 | rex_clear_cache(); | |
81 | } | |
82 | ||
83 | kernel_entry(argc, argv, magic, prom_vec); | |
84 | } |