summaryrefslogtreecommitdiff
path: root/firmware/fw_payload.S
blob: 7cbd57b421b2590743de6de1a36ccf2f79e09273 (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
/*
 * Copyright (c) 2018 Western Digital Corporation or its affiliates.
 *
 * Authors:
 *   Anup Patel <anup.patel@wdc.com>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include "fw_base.S"

	.align 3
	.section .entry, "ax", %progbits
	.global fw_prev_arg1
fw_prev_arg1:
	/* We return previous arg1 in 'a0' */
#ifdef FW_PAYLOAD_FDT_PATH
	la	a0, fdt_bin
#else
	add	a0, zero, zero
#endif
	ret

	.align 3
	.section .entry, "ax", %progbits
	.global fw_next_arg1
fw_next_arg1:
	/* We return next arg1 in 'a0' */
#ifdef FW_PAYLOAD_FDT_ADDR
	li	a0, FW_PAYLOAD_FDT_ADDR
#else
	add	a0, zero, zero
#endif
	ret

	.align 3
	.section .entry, "ax", %progbits
	.global fw_next_addr
fw_next_addr:
	/* We return next address in 'a0' */
	la	a0, payload_bin
	ret

#define	str(s)		#s
#define	stringify(s)	str(s)

#ifdef FW_PAYLOAD_FDT_PATH
	.align 3
	.section .text, "ax", %progbits
	.globl fdt_bin
fdt_bin:
	.incbin	stringify(FW_PAYLOAD_FDT_PATH)
#endif

	.section .payload, "ax", %progbits
	.globl payload_bin
payload_bin:
#ifndef FW_PAYLOAD_PATH
	wfi
	j	payload_bin
#else
	.incbin	stringify(FW_PAYLOAD_PATH)
#endif