Javier Almansa Sobrino | 1994e56 | 2020-08-20 18:48:09 +0100 | [diff] [blame] | 1 | /* |
Boyan Karatotev | 89dba82 | 2025-01-22 13:54:43 +0000 | [diff] [blame] | 2 | * Copyright (c) 2020-2025, Arm Limited. All rights reserved. |
Javier Almansa Sobrino | 1994e56 | 2020-08-20 18:48:09 +0100 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <arch.h> |
| 8 | #include <asm_macros.S> |
| 9 | #include <common/bl_common.h> |
| 10 | #include <generic.h> |
| 11 | #include <cpu_macros.S> |
| 12 | #include <plat_macros.S> |
| 13 | |
Boyan Karatotev | 89dba82 | 2025-01-22 13:54:43 +0000 | [diff] [blame] | 14 | cpu_reset_prologue generic |
| 15 | |
Javier Almansa Sobrino | 1994e56 | 2020-08-20 18:48:09 +0100 | [diff] [blame] | 16 | /* --------------------------------------------- |
| 17 | * Disable L1 data cache and unified L2 cache |
| 18 | * --------------------------------------------- |
| 19 | */ |
| 20 | func generic_disable_dcache |
| 21 | mrs x1, sctlr_el3 |
| 22 | bic x1, x1, #SCTLR_C_BIT |
| 23 | msr sctlr_el3, x1 |
| 24 | isb |
| 25 | ret |
| 26 | endfunc generic_disable_dcache |
| 27 | |
| 28 | func generic_core_pwr_dwn |
| 29 | mov x18, x30 |
| 30 | |
| 31 | /* --------------------------------------------- |
| 32 | * Turn off caches. |
| 33 | * --------------------------------------------- |
| 34 | */ |
| 35 | bl generic_disable_dcache |
| 36 | |
| 37 | /* --------------------------------------------- |
| 38 | * Flush L1 caches. |
| 39 | * --------------------------------------------- |
| 40 | */ |
| 41 | mov x0, #DCCISW |
| 42 | bl dcsw_op_level1 |
| 43 | |
| 44 | ret x18 |
| 45 | endfunc generic_core_pwr_dwn |
| 46 | |
| 47 | func generic_cluster_pwr_dwn |
| 48 | mov x18, x30 |
| 49 | |
| 50 | /* --------------------------------------------- |
| 51 | * Turn off caches. |
| 52 | * --------------------------------------------- |
| 53 | */ |
| 54 | bl generic_disable_dcache |
| 55 | |
| 56 | /* --------------------------------------------- |
| 57 | * Flush L1 caches. |
| 58 | * --------------------------------------------- |
| 59 | */ |
| 60 | mov x0, #DCCISW |
| 61 | bl dcsw_op_level1 |
| 62 | |
| 63 | /* --------------------------------------------- |
| 64 | * Disable the optional ACP. |
| 65 | * --------------------------------------------- |
| 66 | */ |
| 67 | bl plat_disable_acp |
| 68 | |
| 69 | /* --------------------------------------------- |
| 70 | * Flush L2 caches. |
| 71 | * --------------------------------------------- |
| 72 | */ |
| 73 | mov x0, #DCCISW |
| 74 | bl dcsw_op_level2 |
| 75 | |
| 76 | ret x18 |
| 77 | |
| 78 | endfunc generic_cluster_pwr_dwn |
| 79 | |
| 80 | /* --------------------------------------------- |
| 81 | * Unimplemented functions. |
| 82 | * --------------------------------------------- |
| 83 | */ |
Javier Almansa Sobrino | 1994e56 | 2020-08-20 18:48:09 +0100 | [diff] [blame] | 84 | .equ generic_cpu_reg_dump, 0 |
Boyan Karatotev | 0d02082 | 2024-11-19 11:27:01 +0000 | [diff] [blame] | 85 | |
| 86 | cpu_reset_func_start generic |
| 87 | cpu_reset_func_end generic |
Javier Almansa Sobrino | 1994e56 | 2020-08-20 18:48:09 +0100 | [diff] [blame] | 88 | |
| 89 | declare_cpu_ops generic, AARCH64_GENERIC_MIDR, \ |
| 90 | generic_reset_func, \ |
| 91 | generic_core_pwr_dwn, \ |
| 92 | generic_cluster_pwr_dwn |