Pull altix-mmr into release branch
[pandora-kernel.git] / arch / m68knommu / platform / 68328 / head-de2.S
1 #include <linux/config.h>
2
3 #if defined(CONFIG_RAM32MB)
4 #define MEM_END 0x02000000      /* Memory size 32Mb */
5 #elif defined(CONFIG_RAM16MB)
6 #define MEM_END 0x01000000      /* Memory size 16Mb */
7 #else
8 #define MEM_END 0x00800000      /* Memory size 8Mb */
9 #endif
10
11 #undef CRT_DEBUG
12
13 .macro  PUTC CHAR
14 #ifdef CRT_DEBUG
15         moveq   #\CHAR, %d7
16         jsr     putc
17 #endif
18 .endm
19
20         .global _start
21         .global _rambase
22         .global _ramvec
23         .global _ramstart
24         .global _ramend
25         
26         .data
27
28 /*
29  *      Set up the usable of RAM stuff
30  */
31 _rambase:
32         .long   0
33 _ramvec:
34         .long   0
35 _ramstart:
36         .long   0
37 _ramend:
38         .long   0
39
40         .text
41
42 _start:
43
44 /*
45  * Setup initial stack
46  */
47         /* disable all interrupts */
48         movew   #0x2700, %sr
49         movel   #-1, 0xfffff304
50         movel   #MEM_END-4, %sp
51
52         PUTC    '\r'
53         PUTC    '\n'
54         PUTC    'A'
55         PUTC    'B'
56
57 /*
58  *      Determine end of RAM
59  */
60
61         movel   #MEM_END, %a0
62         movel   %a0, _ramend
63
64         PUTC    'C'
65
66 /*
67  *      Move ROM filesystem above bss :-)
68  */
69
70         moveal  #_sbss, %a0                     /* romfs at the start of bss */
71         moveal  #_ebss, %a1                     /* Set up destination  */
72         movel   %a0, %a2                        /* Copy of bss start */
73
74         movel   8(%a0), %d1                     /* Get size of ROMFS */
75         addql   #8, %d1                         /* Allow for rounding */
76         andl    #0xfffffffc, %d1        /* Whole words */
77
78         addl    %d1, %a0                        /* Copy from end */
79         addl    %d1, %a1                        /* Copy from end */
80         movel   %a1, _ramstart          /* Set start of ram */
81
82 1:
83         movel   -(%a0), %d0                     /* Copy dword */
84         movel   %d0, -(%a1)
85         cmpl    %a0, %a2                        /* Check if at end */
86         bne     1b
87
88         PUTC    'D'
89
90 /*
91  * Initialize BSS segment to 0
92  */
93
94         lea     _sbss, %a0
95         lea     _ebss, %a1
96
97         /* Copy 0 to %a0 until %a0 == %a1 */
98 2:      cmpal   %a0, %a1
99         beq     1f
100         clrl    (%a0)+
101         bra     2b
102 1:
103
104         PUTC    'E'
105
106 /*
107  * Load the current task pointer and stack
108  */
109
110         lea     init_thread_union, %a0
111         lea     0x2000(%a0), %sp
112
113         PUTC    'F'
114         PUTC    '\r'
115         PUTC    '\n'
116
117 /*
118  * Go
119  */
120
121         jmp     start_kernel
122
123 /*
124  * Local functions
125  */
126  
127 #ifdef CRT_DEBUG
128 putc:
129         moveb   %d7, 0xfffff907
130 1:
131         movew   0xfffff906, %d7
132         andw    #0x2000, %d7
133         beq     1b
134         rts
135 #endif