xref: /openbmc/linux/arch/sh/boot/romimage/head.S (revision 81de3bf3)
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 *  linux/arch/sh/boot/romimage/head.S
4 *
5 * Board specific setup code, executed before zImage loader
6 */
7
8.text
9	#include <asm/page.h>
10
11	.global	romstart
12romstart:
13	/* include board specific setup code */
14#include <mach/romimage.h>
15
16#ifdef CONFIG_ROMIMAGE_MMCIF
17	/* load the romImage to above the empty zero page */
18	mov.l	empty_zero_page_dst, r4
19	mov.l	empty_zero_page_dst_adj, r5
20	add	r5, r4
21	mov.l	bytes_to_load, r5
22	mov.l	loader_function, r7
23	jsr	@r7
24	 mov	r4, r15
25
26	mov.l	empty_zero_page_dst, r4
27	mov.l	empty_zero_page_dst_adj, r5
28	add	r5, r4
29	mov.l	loaded_code_offs, r5
30	add	r5, r4
31	jmp	@r4
32	 nop
33
34	.balign 4
35empty_zero_page_dst_adj:
36	.long	PAGE_SIZE
37bytes_to_load:
38	.long	end_data - romstart
39loader_function:
40	.long	mmcif_loader
41loaded_code_offs:
42	.long	loaded_code - romstart
43loaded_code:
44#endif /* CONFIG_ROMIMAGE_MMCIF */
45
46	/* copy the empty_zero_page contents to where vmlinux expects it */
47	mova	extra_data_pos, r0
48	mov.l	extra_data_size, r1
49	add	r1, r0
50	mov.l	empty_zero_page_dst, r1
51	mov	#(PAGE_SHIFT - 4), r4
52	mov	#1, r3
53	shld	r4, r3 /* r3 = PAGE_SIZE / 16 */
54
551:
56	mov.l	@r0, r4
57	mov.l	@(4, r0), r5
58	mov.l	@(8, r0), r6
59	mov.l	@(12, r0), r7
60	add	#16,r0
61	mov.l	r4, @r1
62	mov.l	r5, @(4, r1)
63	mov.l	r6, @(8, r1)
64	mov.l	r7, @(12, r1)
65	dt	r3
66	add	#16,r1
67	bf	1b
68
69	/* jump to the zImage entry point located after the zero page data */
70	mov	#PAGE_SHIFT, r4
71	mov	#1, r1
72	shld	r4, r1
73	mova	extra_data_pos, r0
74	add	r1, r0
75	mov.l	extra_data_size, r1
76	add	r1, r0
77	jmp	@r0
78	 nop
79
80	.align 2
81empty_zero_page_dst:
82	.long	_text
83extra_data_pos:
84extra_data_size:
85	.long	zero_page_pos - extra_data_pos
86