2 * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
4 * SPDX-License-Identifier: BSD-3-Clause
7 #include <asm_macros.S>
8 #include <drivers/arm/gicv2.h>
9 #include <platform_def.h>
11 .globl plat_secondary_cold_boot_setup
12 .globl plat_is_my_cpu_primary
13 .globl zynqmp_calc_core_pos
14 .globl plat_my_core_pos
15 .globl plat_crash_console_init
16 .globl plat_crash_console_putc
17 .globl plat_crash_console_flush
18 .globl platform_mem_init
20 /* -----------------------------------------------------
21 * void plat_secondary_cold_boot_setup (void);
23 * This function performs any platform specific actions
24 * needed for a secondary cpu after a cold reset e.g
25 * mark the cpu's presence, mechanism to place it in a
27 * TODO: Should we read the PSYS register to make sure
28 * that the request has gone through.
29 * -----------------------------------------------------
31 func plat_secondary_cold_boot_setup
34 /* Deactivate the gic cpu interface */
35 ldr x1, =BASE_GICC_BASE
36 mov w0, #(IRQ_BYP_DIS_GRP1 | FIQ_BYP_DIS_GRP1)
37 orr w0, w0, #(IRQ_BYP_DIS_GRP0 | FIQ_BYP_DIS_GRP0)
38 str w0, [x1, #GICC_CTLR]
41 * There is no sane reason to come out of this wfi. This
42 * cpu will be powered on and reset by the cpu_on pm api
46 no_ret plat_panic_handler
47 endfunc plat_secondary_cold_boot_setup
49 func plat_is_my_cpu_primary
52 cmp x0, #ZYNQMP_PRIMARY_CPU
55 endfunc plat_is_my_cpu_primary
57 /* -----------------------------------------------------
58 * unsigned int plat_my_core_pos(void)
59 * This function uses the zynqmp_calc_core_pos()
60 * definition to get the index of the calling CPU.
61 * -----------------------------------------------------
65 b zynqmp_calc_core_pos
66 endfunc plat_my_core_pos
68 /* -----------------------------------------------------
69 * unsigned int zynqmp_calc_core_pos(u_register_t mpidr)
70 * Helper function to calculate the core position.
71 * With this function: CorePos = (ClusterId * 4) +
73 * -----------------------------------------------------
75 func zynqmp_calc_core_pos
76 and x1, x0, #MPIDR_CPU_MASK
77 and x0, x0, #MPIDR_CLUSTER_MASK
78 add x0, x1, x0, LSR #6
80 endfunc zynqmp_calc_core_pos
82 /* ---------------------------------------------
83 * int plat_crash_console_init(void)
84 * Function to initialize the crash console
85 * without a C Runtime to print crash report.
86 * Clobber list : x0 - x4
87 * ---------------------------------------------
89 func plat_crash_console_init
90 mov_imm x0, ZYNQMP_CRASH_UART_BASE
91 mov_imm x1, ZYNQMP_CRASH_UART_CLK_IN_HZ
92 mov_imm x2, ZYNQMP_UART_BAUDRATE
94 endfunc plat_crash_console_init
96 /* ---------------------------------------------
97 * int plat_crash_console_putc(int c)
98 * Function to print a character on the crash
99 * console without a C Runtime.
100 * Clobber list : x1, x2
101 * ---------------------------------------------
103 func plat_crash_console_putc
104 mov_imm x1, ZYNQMP_CRASH_UART_BASE
106 endfunc plat_crash_console_putc
108 /* ---------------------------------------------
109 * int plat_crash_console_flush()
110 * Function to force a write of all buffered
111 * data that hasn't been output.
112 * Out : return -1 on error else return 0.
114 * ---------------------------------------------
116 func plat_crash_console_flush
117 mov_imm x0, ZYNQMP_CRASH_UART_BASE
119 endfunc plat_crash_console_flush
121 /* ---------------------------------------------------------------------
122 * We don't need to carry out any memory initialization on ARM
123 * platforms. The Secure RAM is accessible straight away.
124 * ---------------------------------------------------------------------
126 func platform_mem_init
128 endfunc platform_mem_init