Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 1 | /* |
Michal Simek | 2a47faa | 2023-04-14 08:43:51 +0200 | [diff] [blame] | 2 | * Copyright (c) 2013-2020, Arm Limited and Contributors. All rights reserved. |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <asm_macros.S> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 8 | #include <drivers/arm/gicv2.h> |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 9 | #include <platform_def.h> |
| 10 | |
| 11 | .globl plat_secondary_cold_boot_setup |
| 12 | .globl plat_is_my_cpu_primary |
Antonio Nino Diaz | ea3c4de | 2018-10-17 16:46:41 +0100 | [diff] [blame] | 13 | .globl zynqmp_calc_core_pos |
| 14 | .globl plat_my_core_pos |
Antonio Nino Diaz | ea3c4de | 2018-10-17 16:46:41 +0100 | [diff] [blame] | 15 | .globl platform_mem_init |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 16 | |
| 17 | /* ----------------------------------------------------- |
| 18 | * void plat_secondary_cold_boot_setup (void); |
| 19 | * |
| 20 | * This function performs any platform specific actions |
| 21 | * needed for a secondary cpu after a cold reset e.g |
| 22 | * mark the cpu's presence, mechanism to place it in a |
| 23 | * holding pen etc. |
| 24 | * TODO: Should we read the PSYS register to make sure |
| 25 | * that the request has gone through. |
| 26 | * ----------------------------------------------------- |
| 27 | */ |
| 28 | func plat_secondary_cold_boot_setup |
| 29 | mrs x0, mpidr_el1 |
| 30 | |
| 31 | /* Deactivate the gic cpu interface */ |
| 32 | ldr x1, =BASE_GICC_BASE |
| 33 | mov w0, #(IRQ_BYP_DIS_GRP1 | FIQ_BYP_DIS_GRP1) |
| 34 | orr w0, w0, #(IRQ_BYP_DIS_GRP0 | FIQ_BYP_DIS_GRP0) |
| 35 | str w0, [x1, #GICC_CTLR] |
| 36 | |
| 37 | /* |
| 38 | * There is no sane reason to come out of this wfi. This |
| 39 | * cpu will be powered on and reset by the cpu_on pm api |
| 40 | */ |
| 41 | dsb sy |
| 42 | 1: |
Jeenu Viswambharan | 68aef10 | 2016-11-30 15:21:11 +0000 | [diff] [blame] | 43 | no_ret plat_panic_handler |
Soren Brinkmann | 76fcae3 | 2016-03-06 20:16:27 -0800 | [diff] [blame] | 44 | endfunc plat_secondary_cold_boot_setup |
| 45 | |
| 46 | func plat_is_my_cpu_primary |
| 47 | mov x9, x30 |
| 48 | bl plat_my_core_pos |
| 49 | cmp x0, #ZYNQMP_PRIMARY_CPU |
| 50 | cset x0, eq |
| 51 | ret x9 |
| 52 | endfunc plat_is_my_cpu_primary |
Antonio Nino Diaz | ea3c4de | 2018-10-17 16:46:41 +0100 | [diff] [blame] | 53 | |
| 54 | /* ----------------------------------------------------- |
| 55 | * unsigned int plat_my_core_pos(void) |
| 56 | * This function uses the zynqmp_calc_core_pos() |
| 57 | * definition to get the index of the calling CPU. |
| 58 | * ----------------------------------------------------- |
| 59 | */ |
| 60 | func plat_my_core_pos |
| 61 | mrs x0, mpidr_el1 |
| 62 | b zynqmp_calc_core_pos |
| 63 | endfunc plat_my_core_pos |
| 64 | |
| 65 | /* ----------------------------------------------------- |
| 66 | * unsigned int zynqmp_calc_core_pos(u_register_t mpidr) |
| 67 | * Helper function to calculate the core position. |
| 68 | * With this function: CorePos = (ClusterId * 4) + |
| 69 | * CoreId |
| 70 | * ----------------------------------------------------- |
| 71 | */ |
| 72 | func zynqmp_calc_core_pos |
| 73 | and x1, x0, #MPIDR_CPU_MASK |
| 74 | and x0, x0, #MPIDR_CLUSTER_MASK |
| 75 | add x0, x1, x0, LSR #6 |
| 76 | ret |
| 77 | endfunc zynqmp_calc_core_pos |
| 78 | |
Antonio Nino Diaz | ea3c4de | 2018-10-17 16:46:41 +0100 | [diff] [blame] | 79 | /* --------------------------------------------------------------------- |
| 80 | * We don't need to carry out any memory initialization on ARM |
| 81 | * platforms. The Secure RAM is accessible straight away. |
| 82 | * --------------------------------------------------------------------- |
| 83 | */ |
| 84 | func platform_mem_init |
| 85 | ret |
| 86 | endfunc platform_mem_init |