1
2
3
4
5
6
7
8#include <asm-offsets.h>
9#include <config.h>
10#include "version.h"
11#include <asm/cache.h>
12
13#ifndef CONFIG_IDENT_STRING
14#define CONFIG_IDENT_STRING ""
15#endif
16
17#define _START _start
18#define _FAULT _fault
19
20#define SAVE_ALL \
21 move.w
22 subl
23 moveml %d0-%d7/%a0-%a6,%sp@;
24
25#define RESTORE_ALL \
26 moveml %sp@,%d0-%d7/%a0-%a6; \
27 addl
28 rte;
29
30
31#define ASM_DRAMINIT (asm_dram_init - CONFIG_SYS_TEXT_BASE + CONFIG_SYS_INIT_RAM_ADDR)
32#define ASM_SBF_IMG_HDR (asm_sbf_img_hdr - CONFIG_SYS_TEXT_BASE + CONFIG_SYS_INIT_RAM_ADDR)
33#endif
34
35.text
36
37
38
39
40_vectors:
41
42
43INITSP: .long 0
44INITPC: .long ASM_DRAMINIT
45#else
46INITSP: .long 0
47INITPC: .long _START
48#endif
49
50vector02: .long _FAULT
51vector03: .long _FAULT
52vector04: .long _FAULT
53vector05: .long _FAULT
54vector06: .long _FAULT
55vector07: .long _FAULT
56vector08: .long _FAULT
57vector09: .long _FAULT
58vector0A: .long _FAULT
59vector0B: .long _FAULT
60vector0C: .long _FAULT
61vector0D: .long _FAULT
62vector0E: .long _FAULT
63vector0F: .long _FAULT
64
65
66vector10_17:
67.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
68
69vector18: .long _FAULT
70vector19: .long _FAULT
71vector1A: .long _FAULT
72vector1B: .long _FAULT
73vector1C: .long _FAULT
74vector1D: .long _FAULT
75vector1E: .long _FAULT
76vector1F: .long _FAULT
77
78
79
80vector20_2F:
81.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
82.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
83
84
85vector30_3F:
86.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
87.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
88
89vector64_127:
90.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
91.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
92.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
93.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
94.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
95.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
96.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
97.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
98
99vector128_191:
100.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
101.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
102.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
103.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
104.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
105.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
106.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
107.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
108
109vector192_255:
110.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
111.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
112.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
113.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
114.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
115.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
116.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
117.long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
118#endif
119
120
121
122asm_sbf_img_hdr:
123 .long 0x00000000
124 .long 0x00020000
125 .long CONFIG_SYS_TEXT_BASE
126
127asm_dram_init:
128 move.l
129 movec %d0, %RAMBAR1
130 move.l
131 clr.l %sp@-
132
133
134 move.l
135 move.l
136 move.l
137 move.l
138 move.l
139 move.l
140
141
142
143
144
145
146 move.l
147 move.b
148 nop
149
150
151 move.l
152 move.l
153
154
155 move.l
156 move.l
157#ifdef CONFIG_SYS_SDRAM_BASE1
158 lsr.l
159#endif
160
161dramsz_loop:
162 lsr.l
163 add.l
164 cmp.l
165 bne dramsz_loop
166
167
168 move.l
169 or.l %d1, (%a1)
170#ifdef CONFIG_SYS_SDRAM_BASE1
171 move.l
172 or.l %d1, (%a2)
173#endif
174 nop
175
176
177 move.l
178 move.l
179 nop
180 move.l
181 move.l
182 nop
183
184 move.l
185 move.l
186
187
188 move.l
189 nop
190
191
192 move.l
193 nop
194 move.l
195 nop
196
197 move.l
198wait1000:
199 nop
200 subq.l
201 bne wait1000
202
203
204 move.l
205 nop
206
207
208 move.l
209 nop
210 move.l %d0, (%a2)
211 move.l %d0, (%a2)
212 nop
213
214 move.l
215 and.l
216 or.l
217 move.l %d0, (%a2)
218 nop
219
220
221
222
223
224
225
226
227
228
229
230 move.l
231 move.b
232 move.b %d0, (%a0)
233
234
235#ifdef CONFIG_SYS_DSPI_CS0
236 move.b (%a0), %d0
237 or.l
238 move.b %d0, (%a0)
239#endif
240#ifdef CONFIG_SYS_DSPI_CS2
241 move.l
242 move.b (%a0), %d0
243 or.l
244 move.b %d0, (%a0)
245#endif
246 nop
247
248
249 move.l
250 move.l
251
252 move.l
253 move.l
254
255 move.l
256 move.l
257
258 move.l
259 move.l (%a1)+, %d5
260 move.l (%a1), %a4
261
262 move.l
263 move.l
264
265 move.l
266
267
268 move.l
269 jsr asm_dspi_wr_status
270 jsr asm_dspi_rd_status
271
272 move.l
273 jsr asm_dspi_wr_status
274 jsr asm_dspi_rd_status
275
276 move.l
277 jsr asm_dspi_wr_status
278 jsr asm_dspi_rd_status
279
280 move.l
281 jsr asm_dspi_wr_status
282 jsr asm_dspi_rd_status
283
284 move.l
285 jsr asm_dspi_wr_status
286 jsr asm_dspi_rd_status
287
288
289asm_dspi_rd_loop1:
290 move.l
291 jsr asm_dspi_wr_status
292 jsr asm_dspi_rd_status
293
294 move.b %d1, (%a0)
295
296 add.l
297 sub.l
298 bne asm_dspi_rd_loop1
299
300
301asm_dspi_rd_loop2:
302 move.l
303 jsr asm_dspi_wr_status
304 jsr asm_dspi_rd_status
305
306 move.b %d1, (%a4)
307
308 add.l
309 sub.l
310 bne asm_dspi_rd_loop2
311
312 move.l
313 jsr asm_dspi_wr_status
314 jsr asm_dspi_rd_status
315
316
317 move.l
318 move.l %a0, (%a1)
319 jmp (%a0)
320
321asm_dspi_wr_status:
322 move.l (%a1), %d0
323 and.l
324 cmp.l
325 bgt asm_dspi_wr_status
326
327 move.l %d2, (%a2)
328 rts
329
330asm_dspi_rd_status:
331 move.l (%a1), %d0
332 and.l
333 lsr.l
334 cmp.l
335 beq asm_dspi_rd_status
336
337 move.b (%a3), %d1
338 rts
339#endif
340
341 .text
342 . = 0x400
343 .globl _start
344_start:
345 nop
346 nop
347 move.w
348
349
350
351 move.l
352 movec %d0, %VBR
353#else
354 move.l
355 movec %d0, %VBR
356
357 move.l
358 movec %d0, %RAMBAR1
359#endif
360
361
362 move.l
363 movec %d0, %CACR
364 move.l
365 movec %d0, %ACR0
366 movec %d0, %ACR1
367
368
369 move.l
370 move.l
371 move.l
372 move.l %d0, (%a1)
373 move.l %d0, (%a2)
374
375
376
377 move.l
378 clr.l %sp@-
379
380 move.l
381
382 bsr cpu_init_f
383 bsr board_init_f
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400 .globl relocate_code
401relocate_code:
402 link.w %a6,
403 move.l 8(%a6), %sp
404
405 move.l 12(%a6), %d0
406 move.l 16(%a6), %a0
407
408 move.l
409 move.l
410 move.l %a0, %a3
411
412
4131:
414 move.l (%a1)+, (%a3)+
415 cmp.l %a1,%a2
416 bgt.s 1b
417
418
419
420
421
422 move.l %a0, %a1
423 add.l
424 jmp (%a1)
425
426in_ram:
427
428clear_bss:
429
430
431
432 move.l %a0, %a1
433 add.l
434 move.l %a0, %d1
435 add.l
4366:
437 clr.l (%a1)+
438 cmp.l %a1,%d1
439 bgt.s 6b
440
441
442
443
444 move.l %a0, %a1
445 add.l
446 move.l %a1,%a5
447
448 move.l %a0, %a2
449 add.l
450
4517:
452 move.l (%a1),%d1
453 sub.l
454 add.l %a0,%d1
455 move.l %d1,(%a1)+
456 cmp.l %a2, %a1
457 bne 7b
458
459
460 move.l %a0, %a1
461 add.l
462
463
464 move.l %a0,-(%sp)
465 move.l %d0,-(%sp)
466 jsr (%a1)
467
468
469
470 .globl _fault
471_fault:
472 bra _fault
473 .globl _exc_handler
474
475_exc_handler:
476 SAVE_ALL
477 movel %sp,%sp@-
478 bsr exc_handler
479 addql
480 RESTORE_ALL
481
482 .globl _int_handler
483_int_handler:
484 SAVE_ALL
485 movel %sp,%sp@-
486 bsr int_handler
487 addql
488 RESTORE_ALL
489
490
491
492 .globl version_string
493version_string:
494 .ascii U_BOOT_VERSION_STRING, "\0"
495 .align 4
496