[PATCH] Remove hosthw.h from rio (unused file)
[wrt350n-kernel.git] / arch / mips / dec / boot / decstation.c
blob56fd4277555e6064f63c629f4557c32424ec8f4d
1 /*
2 * arch/mips/dec/decstation.c
3 */
5 #define RELOC
6 #define INITRD
7 #define DEBUG_BOOT
9 /*
10 * Magic number indicating REX PROM available on DECSTATION.
12 #define REX_PROM_MAGIC 0x30464354
14 #define REX_PROM_CLEARCACHE 0x7c/4
15 #define REX_PROM_PRINTF 0x30/4
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)
21 #define PARAM (k_start + 0x2000)
23 #define LOADER_TYPE (*(unsigned char *) (PARAM+0x210))
24 #define INITRD_START (*(unsigned long *) (PARAM+0x218))
25 #define INITRD_SIZE (*(unsigned long *) (PARAM+0x21c))
27 extern int _ftext, _end; /* begin and end of kernel image */
28 extern void kernel_entry(int, char **, unsigned long, int *);
30 void * memcpy(void * dest, const void *src, unsigned int count)
32 unsigned long *tmp = (unsigned long *) dest, *s = (unsigned long *) src;
34 count >>= 2;
35 while (count--)
36 *tmp++ = *s++;
38 return dest;
41 void dec_entry(int argc, char **argv,
42 unsigned long magic, int *prom_vec)
44 void (*rex_clear_cache)(void);
45 int (*prom_printf)(char *, ...);
46 unsigned long k_start, len;
49 * The DS5100 leaves cpu with BEV enabled, clear it.
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");
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;
64 prom_printf("Launching kernel...\n");
65 #endif
67 k_start = (unsigned long) (&kernel_entry) & 0xffff0000;
69 #ifdef RELOC
71 * Now copy kernel image to its destination.
73 len = ((unsigned long) (&_end) - k_start);
74 memcpy((void *)k_start, &_ftext, len);
75 #endif
77 if (magic == REX_PROM_MAGIC) {
78 rex_clear_cache = (void (*)(void)) * (prom_vec + REX_PROM_CLEARCACHE);
79 rex_clear_cache();
82 kernel_entry(argc, argv, magic, prom_vec);