summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mvebu/include/mach/barebox-arm-head.h
blob: 12f8cfc5a029ab36df93a7135a758468eefd45ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/* SPDX-License-Identifier: GPL-2.0-only */

#include <linux/stringify.h>
#include <mach/common.h>

static inline void __barebox_arm_head(void)
{
	__asm__ __volatile__ (
#ifdef CONFIG_CPU_32
#ifdef CONFIG_THUMB2_BAREBOX
		".arm\n"
		"adr r9, 1f + 1\n"
		"bx r9\n"
		".thumb\n"
		"1:\n"
		"bl 2f\n"
		".rept 10\n"
		"1: b 1b\n"
		".endr\n"
#else
		"b 2f\n"
		"1: b 1b\n"
		"1: b 1b\n"
		"1: b 1b\n"
		"1: b 1b\n"
		"1: b 1b\n"
		"1: b 1b\n"
		"1: b 1b\n"
#endif
#else
		"b 2f\n"
		"nop\n"
		"nop\n"
		"nop\n"
		"nop\n"
		"nop\n"
#endif
		".asciz \"barebox\"\n"
#ifdef CONFIG_CPU_32
		".word _text\n"				/* text base. If copied there,
							 * barebox can skip relocation
							 */
#else
		".word 0xffffffff\n"
#endif
		".word _barebox_image_size\n"		/* image size to copy */

		/*
		 * The following entry (at offset 0x30) is the only intended
		 * difference to the original arm __barebox_arm_head. This value
		 * holds the address of the internal register window when the
		 * image is started. If the window is not at the reset default
		 * position any more the caller can pass the actual value here.
		 */
		".word " __stringify(MVEBU_BOOTUP_INT_REG_BASE) "\n"
		".rept 7\n"
		".word 0x55555555\n"
		".endr\n"
		"2:\n"
#ifdef CONFIG_PBL_BREAK
#ifdef CONFIG_CPU_V8
		"brk #17\n"
#else
		"bkpt #17\n"
#endif
		"nop\n"
#else
		"nop\n"
		"nop\n"
#endif
	);
}
static inline void barebox_arm_head(void)
{
	__barebox_arm_head();
	__asm__ __volatile__ (
		"b barebox_arm_reset_vector\n"
	);
}