1/*
2 * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6#ifndef __ROCKCHIP_PLAT_LD_S__
7#define __ROCKCHIP_PLAT_LD_S__
8
9MEMORY {
10    SRAM (rwx): ORIGIN = SRAM_BASE, LENGTH = SRAM_SIZE
11    PMUSRAM (rwx): ORIGIN = PMUSRAM_BASE, LENGTH = PMUSRAM_RSIZE
12}
13
14SECTIONS
15{
16	. = SRAM_BASE;
17	ASSERT(. == ALIGN(4096),
18		"SRAM_BASE address is not aligned on a page boundary.")
19
20	/*
21	 * The SRAM space allocation for RK3399
22	 * ----------------
23	 * | m0 code bin
24	 * ----------------
25	 * | sram text
26	 * ----------------
27	 * | sram data
28	 * ----------------
29	 */
30	.incbin_sram : ALIGN(4096) {
31		__sram_incbin_start = .;
32		*(.sram.incbin)
33		 __sram_incbin_real_end = .;
34		. = ALIGN(4096);
35		__sram_incbin_end = .;
36	} >SRAM
37	ASSERT((__sram_incbin_real_end - __sram_incbin_start) <=
38		SRAM_BIN_LIMIT, ".incbin_sram has exceeded its limit")
39
40	.text_sram : ALIGN(4096) {
41		__bl31_sram_text_start = .;
42		*(.sram.text)
43		*(.sram.rodata)
44		__bl31_sram_text_real_end = .;
45		. = ALIGN(4096);
46		__bl31_sram_text_end = .;
47	} >SRAM
48	ASSERT((__bl31_sram_text_real_end - __bl31_sram_text_start) <=
49		SRAM_TEXT_LIMIT, ".text_sram has exceeded its limit")
50
51	.data_sram : ALIGN(4096) {
52		__bl31_sram_data_start = .;
53		*(.sram.data)
54		__bl31_sram_data_real_end = .;
55		. = ALIGN(4096);
56		__bl31_sram_data_end = .;
57	} >SRAM
58	ASSERT((__bl31_sram_data_real_end - __bl31_sram_data_start) <=
59		SRAM_DATA_LIMIT, ".data_sram has exceeded its limit")
60
61	.stack_sram : ALIGN(4096) {
62		__bl31_sram_stack_start = .;
63		. += 4096;
64		__bl31_sram_stack_end = .;
65	} >SRAM
66
67	. = PMUSRAM_BASE;
68
69	/*
70	 * pmu_cpuson_entrypoint request address
71	 * align 64K when resume, so put it in the
72	 * start of pmusram
73	 */
74	.pmusram : {
75		ASSERT(. == ALIGN(64 * 1024),
76			".pmusram.entry request 64K aligned.");
77		*(.pmusram.entry)
78		__bl31_pmusram_text_start = .;
79		*(.pmusram.text)
80		*(.pmusram.rodata)
81		__bl31_pmusram_text_end = .;
82		__bl31_pmusram_data_start = .;
83		*(.pmusram.data)
84		__bl31_pmusram_data_end = .;
85
86	} >PMUSRAM
87}
88
89#endif /* __ROCKCHIP_PLAT_LD_S__ */
90