xref: /rk3399_ARM-atf/plat/common/aarch32/platform_helpers.S (revision 1a0a3f0622e4b569513304109d9a0d093b71228a)
1877cf3ffSSoby Mathew/*
2877cf3ffSSoby Mathew * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
3877cf3ffSSoby Mathew *
4877cf3ffSSoby Mathew * Redistribution and use in source and binary forms, with or without
5877cf3ffSSoby Mathew * modification, are permitted provided that the following conditions are met:
6877cf3ffSSoby Mathew *
7877cf3ffSSoby Mathew * Redistributions of source code must retain the above copyright notice, this
8877cf3ffSSoby Mathew * list of conditions and the following disclaimer.
9877cf3ffSSoby Mathew *
10877cf3ffSSoby Mathew * Redistributions in binary form must reproduce the above copyright notice,
11877cf3ffSSoby Mathew * this list of conditions and the following disclaimer in the documentation
12877cf3ffSSoby Mathew * and/or other materials provided with the distribution.
13877cf3ffSSoby Mathew *
14877cf3ffSSoby Mathew * Neither the name of ARM nor the names of its contributors may be used
15877cf3ffSSoby Mathew * to endorse or promote products derived from this software without specific
16877cf3ffSSoby Mathew * prior written permission.
17877cf3ffSSoby Mathew *
18877cf3ffSSoby Mathew * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19877cf3ffSSoby Mathew * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20877cf3ffSSoby Mathew * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21877cf3ffSSoby Mathew * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22877cf3ffSSoby Mathew * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23877cf3ffSSoby Mathew * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24877cf3ffSSoby Mathew * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25877cf3ffSSoby Mathew * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26877cf3ffSSoby Mathew * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27877cf3ffSSoby Mathew * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28877cf3ffSSoby Mathew * POSSIBILITY OF SUCH DAMAGE.
29877cf3ffSSoby Mathew */
30877cf3ffSSoby Mathew
31877cf3ffSSoby Mathew#include <arch.h>
32877cf3ffSSoby Mathew#include <asm_macros.S>
33877cf3ffSSoby Mathew
34877cf3ffSSoby Mathew	.weak	plat_my_core_pos
35877cf3ffSSoby Mathew	.weak	plat_reset_handler
36*1a0a3f06SYatharth Kochar	.weak	plat_disable_acp
37877cf3ffSSoby Mathew	.weak	platform_mem_init
38877cf3ffSSoby Mathew	.weak	plat_panic_handler
39877cf3ffSSoby Mathew
40877cf3ffSSoby Mathew	/* -----------------------------------------------------
41877cf3ffSSoby Mathew	 *  int plat_my_core_pos(void);
42877cf3ffSSoby Mathew	 *  With this function: CorePos	= (ClusterId * 4) +
43877cf3ffSSoby Mathew	 *				  CoreId
44877cf3ffSSoby Mathew	 * -----------------------------------------------------
45877cf3ffSSoby Mathew	 */
46877cf3ffSSoby Mathewfunc plat_my_core_pos
47877cf3ffSSoby Mathew	ldcopr	r0, MPIDR
48877cf3ffSSoby Mathew	and	r1, r0, #MPIDR_CPU_MASK
49877cf3ffSSoby Mathew	and	r0, r0, #MPIDR_CLUSTER_MASK
50877cf3ffSSoby Mathew	add	r0, r1, r0, LSR #6
51877cf3ffSSoby Mathew	bx	lr
52877cf3ffSSoby Mathewendfunc	plat_my_core_pos
53877cf3ffSSoby Mathew
54877cf3ffSSoby Mathew	/* -----------------------------------------------------
55877cf3ffSSoby Mathew	 * Placeholder function which should be redefined by
56877cf3ffSSoby Mathew	 * each platform.
57877cf3ffSSoby Mathew	 * -----------------------------------------------------
58877cf3ffSSoby Mathew	 */
59877cf3ffSSoby Mathewfunc plat_reset_handler
60877cf3ffSSoby Mathew	bx	lr
61877cf3ffSSoby Mathewendfunc plat_reset_handler
62877cf3ffSSoby Mathew
63*1a0a3f06SYatharth Kochar	/* -----------------------------------------------------
64*1a0a3f06SYatharth Kochar	 * Placeholder function which should be redefined by
65*1a0a3f06SYatharth Kochar	 * each platform.
66*1a0a3f06SYatharth Kochar	 * -----------------------------------------------------
67*1a0a3f06SYatharth Kochar	 */
68*1a0a3f06SYatharth Kocharfunc plat_disable_acp
69*1a0a3f06SYatharth Kochar	bx	lr
70*1a0a3f06SYatharth Kocharendfunc plat_disable_acp
71*1a0a3f06SYatharth Kochar
72877cf3ffSSoby Mathew	/* ---------------------------------------------------------------------
73877cf3ffSSoby Mathew	 * Placeholder function which should be redefined by
74877cf3ffSSoby Mathew	 * each platform.
75877cf3ffSSoby Mathew	 * ---------------------------------------------------------------------
76877cf3ffSSoby Mathew	 */
77877cf3ffSSoby Mathewfunc platform_mem_init
78877cf3ffSSoby Mathew	bx	lr
79877cf3ffSSoby Mathewendfunc platform_mem_init
80877cf3ffSSoby Mathew
81877cf3ffSSoby Mathew	/* -----------------------------------------------------
82877cf3ffSSoby Mathew	 * void plat_panic_handler(void) __dead2;
83877cf3ffSSoby Mathew	 * Endless loop by default.
84877cf3ffSSoby Mathew	 * -----------------------------------------------------
85877cf3ffSSoby Mathew	 */
86877cf3ffSSoby Mathewfunc plat_panic_handler
87877cf3ffSSoby Mathew	b	plat_panic_handler
88877cf3ffSSoby Mathewendfunc plat_panic_handler
89