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
9#include <lib/xlat_tables/xlat_tables_defs.h>
10
11MEMORY {
12    SRAM (rwx): ORIGIN = SRAM_BASE, LENGTH = SRAM_SIZE
13    PMUSRAM (rwx): ORIGIN = PMUSRAM_BASE, LENGTH = PMUSRAM_RSIZE
14}
15
16SECTIONS
17{
18	. = SRAM_BASE;
19	ASSERT(. == ALIGN(PAGE_SIZE),
20		"SRAM_BASE address is not aligned on a page boundary.")
21
22	/*
23	 * The SRAM space allocation for RK3399
24	 * ----------------
25	 * | m0 code bin
26	 * ----------------
27	 * | sram text
28	 * ----------------
29	 * | sram data
30	 * ----------------
31	 */
32	.incbin_sram : ALIGN(PAGE_SIZE) {
33		__sram_incbin_start = .;
34		*(.sram.incbin)
35		 __sram_incbin_real_end = .;
36		. = ALIGN(PAGE_SIZE);
37		__sram_incbin_end = .;
38	} >SRAM
39	ASSERT((__sram_incbin_real_end - __sram_incbin_start) <=
40		SRAM_BIN_LIMIT, ".incbin_sram has exceeded its limit")
41
42	.text_sram : ALIGN(PAGE_SIZE) {
43		__bl31_sram_text_start = .;
44		*(.sram.text)
45		*(.sram.rodata)
46		__bl31_sram_text_real_end = .;
47		. = ALIGN(PAGE_SIZE);
48		__bl31_sram_text_end = .;
49	} >SRAM
50	ASSERT((__bl31_sram_text_real_end - __bl31_sram_text_start) <=
51		SRAM_TEXT_LIMIT, ".text_sram has exceeded its limit")
52
53	.data_sram : ALIGN(PAGE_SIZE) {
54		__bl31_sram_data_start = .;
55		*(.sram.data)
56		__bl31_sram_data_real_end = .;
57		. = ALIGN(PAGE_SIZE);
58		__bl31_sram_data_end = .;
59	} >SRAM
60	ASSERT((__bl31_sram_data_real_end - __bl31_sram_data_start) <=
61		SRAM_DATA_LIMIT, ".data_sram has exceeded its limit")
62
63	.stack_sram : ALIGN(PAGE_SIZE) {
64		__bl31_sram_stack_start = .;
65		. += PAGE_SIZE;
66		__bl31_sram_stack_end = .;
67	} >SRAM
68
69	. = PMUSRAM_BASE;
70
71	/*
72	 * pmu_cpuson_entrypoint request address
73	 * align 64K when resume, so put it in the
74	 * start of pmusram
75	 */
76	.pmusram : {
77		ASSERT(. == ALIGN(64 * 1024),
78			".pmusram.entry request 64K aligned.");
79		*(.pmusram.entry)
80
81		__bl31_pmusram_text_start = .;
82		*(.pmusram.text)
83		*(.pmusram.rodata)
84		__bl31_pmusram_text_end = .;
85
86		/* M0 start address request 4K align */
87		. = ALIGN(4096);
88		__pmusram_incbin_start = .;
89		*(.pmusram.incbin)
90		__pmusram_incbin_end = .;
91
92		__bl31_pmusram_data_start = .;
93		*(.pmusram.data)
94		__bl31_pmusram_data_end = .;
95	} >PMUSRAM
96}
97
98#endif /* ROCKCHIP_PLAT_LD_S */
99