blob: cbe27c3b5daaeae9f90598ca2bb7dbee4016574b [file] [log] [blame]
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +01001/*
Vishnu Banavath2b651ea2022-01-19 18:43:12 +00002 * Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <arch.h>
8#include <asm_macros.S>
9#include <platform_def.h>
10
11 .globl plat_secondary_cold_boot_setup
12 .globl plat_get_my_entrypoint
13 .globl plat_is_my_cpu_primary
14 .globl plat_arm_calc_core_pos
15
16 /* --------------------------------------------------------------------
17 * void plat_secondary_cold_boot_setup (void);
18 *
19 * For AArch32, cold-booting secondary CPUs is not yet
20 * implemented and they panic.
21 * --------------------------------------------------------------------
22 */
23func plat_secondary_cold_boot_setup
24cb_panic:
25 b cb_panic
26endfunc plat_secondary_cold_boot_setup
27
28 /* ---------------------------------------------------------------------
29 * unsigned long plat_get_my_entrypoint (void);
30 *
31 * Main job of this routine is to distinguish between a cold and warm
Vishnu Banavath2b651ea2022-01-19 18:43:12 +000032 * boot. On corstone1000, this information can be queried from the power
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +010033 * controller. The Power Control SYS Status Register (PSYSR) indicates
34 * the wake-up reason for the CPU.
35 *
36 * For a cold boot, return 0.
37 * For a warm boot, Not yet supported.
38 *
39 * TODO: PSYSR is a common register and should be
40 * accessed using locks. Since it is not possible
41 * to use locks immediately after a cold reset
42 * we are relying on the fact that after a cold
43 * reset all cpus will read the same WK field
44 * ---------------------------------------------------------------------
45 */
46func plat_get_my_entrypoint
47 /* TODO support warm boot */
48 /* Cold reset */
49 mov x0, #0
50 ret
51endfunc plat_get_my_entrypoint
52
53 /* -----------------------------------------------------
54 * unsigned int plat_is_my_cpu_primary (void);
55 *
56 * Find out whether the current CPU is the primary
57 * CPU.
58 * -----------------------------------------------------
59 */
60func plat_is_my_cpu_primary
61 mrs x0, mpidr_el1
62 mov_imm x1, MPIDR_AFFINITY_MASK
63 and x0, x0, x1
Vishnu Banavath2b651ea2022-01-19 18:43:12 +000064 cmp x0, #CORSTONE1000_PRIMARY_CPU
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +010065 cset w0, eq
66 ret
67endfunc plat_is_my_cpu_primary