1#include <arch/arm/arch_cpu.h>
2
3#include <asm_defs.h>
4
5
6	.text
7
8/*
9 * Entry points to the loader that U-Boot passes control to.
10 */
11
12/*
13 * called as standalone (raw binary)
14 * *MUST* be first symbol
15 */
16SYMBOL(_start_raw):
17/*
18 * ELF entry
19 */
20SYMBOL(_start):
21	mov	r4,#0
22	b	_start_common
23SYMBOL_END(_start_raw)
24SYMBOL_END(_start)
25
26/*
27 * called from bootm with netbsd loader compatible args
28 */
29SYMBOL(_start_netbsd):
30	mov	r4,#1
31	b	_start_common
32SYMBOL_END(_start_netbsd)
33
34
35
36SYMBOL(_start_common):
37	strb	r4,gUBootOS
38	str	r8,gUBootGlobalData
39
40	/*
41	 * Turn off interrupts and make sure we are in SVC mode
42	 */
43
44	mrs	r4, cpsr
45	bic	r4, r4, #0x1f
46	orr	r4, r4, #0xd3
47	msr	cpsr, r4
48
49	/*
50	 * Turn off MMU and data cache if necessary.
51	 * WARNING: assumes we are running with a 1-1 mapping if MMU is enabled.
52	 */
53	mrc	p15, 0, r4, c1, c0, 0
54	bic	r4, r4, #0x0000000f		     // WCAM bits
55	bic	r4, r4, #0x00000300		     // RS   bits
56	mcr	p15, 0, r4, c1, c0, 0
57	mov	r4, #0
58	mov	r4, r4
59	mov	r4, r4
60
61
62
63
64	ldrb	r4,gUBootOS
65	cmp	r4,#0
66	beq	start_raw
67	cmp	r4,#1
68	beq	start_netbsd
69	mov	pc,lr
70SYMBOL_END(_start_common)
71
72
73//XXX: doesn't seem to work
74//.data
75
76
77SYMBOL(gUBootGlobalData):
78	.long   0
79SYMBOL_END(gUBootGlobalData)
80SYMBOL(gUImage):
81	.long   0
82SYMBOL_END(gUImage)
83SYMBOL(gUBootOS):
84//XXX: bug? Using .byte makes the next asm symbol
85// to be at the same address
86//	.byte	0
87	.long   0
88SYMBOL_END(gUBootOS)
89SYMBOL(gFDT):
90	.long   0
91SYMBOL_END(gFDT)
92
93