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