Add Broadcom's code for bcm63xx support
[project/bcm63xx/atf.git] / plat / bcm / aarch64 / plat_helpers.S
1 /*
2 * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7 #include <arch.h>
8 #include <asm_macros.S>
9 #include <assert_macros.S>
10 #include <platform_def.h>
11
12 .globl plat_my_core_pos
13 .globl plat_get_my_entrypoint
14 .globl platform_mem_init
15 .globl plat_bcm_calc_core_pos
16 .globl plat_crash_console_init
17 .globl plat_crash_console_putc
18 .globl plat_secondary_cold_boot_setup
19 .globl plat_get_my_entrypoint
20 .globl plat_is_my_cpu_primary
21 .globl plat_crash_console_flush
22
23
24 func console_core_init
25 ret
26 endfunc console_core_init
27
28 func console_core_putc
29 ret
30 endfunc console_core_putc
31
32 func plat_crash_console_flush
33 ret
34 endfunc plat_crash_console_flush
35
36
37 func plat_my_core_pos
38 mrs x0, mpidr_el1
39 b plat_bcm_calc_core_pos
40 endfunc plat_my_core_pos
41
42 /*
43 * unsigned int plat_bcm_calc_core_pos(u_register_t mpidr);
44 * With this function: CorePos = (ClusterId * 4) + CoreId
45 */
46 func plat_bcm_calc_core_pos
47 and x1, x0, #MPIDR_CPU_MASK
48 and x0, x0, #MPIDR_CLUSTER_MASK
49 add x0, x1, x0, LSR #6
50 ret
51 endfunc plat_bcm_calc_core_pos
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 */
60 func plat_is_my_cpu_primary
61 mrs x0, mpidr_el1
62 and x0, x0, #(MPIDR_CLUSTER_MASK | MPIDR_CPU_MASK)
63 cmp x0, #BRCM_PRIMARY_CPU
64 cset w0, eq
65 ret
66 endfunc plat_is_my_cpu_primary
67
68 /* -----------------------------------------------------
69 * void plat_secondary_cold_boot_setup (void);
70 *
71 * This function performs any platform specific actions
72 * needed for a secondary cpu after a cold reset e.g
73 * mark the cpu's presence, mechanism to place it in a
74 * holding pen etc.
75 * -----------------------------------------------------
76 */
77 func plat_secondary_cold_boot_setup
78 ret
79 endfunc plat_secondary_cold_boot_setup
80
81 func plat_get_my_entrypoint
82 /* TODO support warm boot */
83 mov x0, #0
84 ret
85 endfunc plat_get_my_entrypoint
86
87 func platform_mem_init
88 ret
89 endfunc platform_mem_init
90
91 /* ---------------------------------------------
92 * int plat_crash_console_init(void)
93 * Function to initialize the crash console
94 * without a C Runtime to print crash report.
95 * Clobber list : x0, x1, x2
96 * ---------------------------------------------
97 */
98 func plat_crash_console_init
99 mov_imm x0, PLAT_BCM_CRASH_UART_BASE
100 mov_imm x1, PLAT_BCM_CRASH_UART_CLK_IN_HZ
101 mov_imm x2, PLAT_BCM_CONSOLE_BAUDRATE
102 b console_core_init
103 endfunc plat_crash_console_init
104
105 /* ---------------------------------------------
106 * int plat_crash_console_putc(int c)
107 * Function to print a character on the crash
108 * console without a C Runtime.
109 * Clobber list : x1, x2
110 * ---------------------------------------------
111 */
112 func plat_crash_console_putc
113 mov_imm x1, PLAT_BCM_CRASH_UART_BASE
114 b console_core_putc
115 endfunc plat_crash_console_putc
116
117