blob: dc704f204aa9abee595b39cec0602273eb2744ad [file] [log] [blame]
Juan Pablo Condec9fe7ce2023-07-05 11:57:50 -05001/*
2 * Copyright (c) 2023, Arm Limited. All rights reserved.
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 <cortex_gelas.h>
11#include <cpu_macros.S>
12#include <plat_macros.S>
13
14/* Hardware handled coherency */
15#if HW_ASSISTED_COHERENCY == 0
16#error "Gelas must be compiled with HW_ASSISTED_COHERENCY enabled"
17#endif
18
19/* 64-bit only core */
20#if CTX_INCLUDE_AARCH32_REGS == 1
21#error "Gelas supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0"
22#endif
23
24cpu_reset_func_start cortex_gelas
25 /* ----------------------------------------------------
26 * Disable speculative loads
27 * ----------------------------------------------------
28 */
29 msr SSBS, xzr
30cpu_reset_func_end cortex_gelas
31
32 /* ----------------------------------------------------
33 * HW will do the cache maintenance while powering down
34 * ----------------------------------------------------
35 */
36func cortex_gelas_core_pwr_dwn
Juan Pablo Condeefdfe362023-08-14 16:20:52 -050037#if ENABLE_SME_FOR_NS
Juan Pablo Condec9fe7ce2023-07-05 11:57:50 -050038 /* ---------------------------------------------------
Juan Pablo Condeefdfe362023-08-14 16:20:52 -050039 * Disable SME if enabled and supported
Juan Pablo Condec9fe7ce2023-07-05 11:57:50 -050040 * ---------------------------------------------------
41 */
Juan Pablo Condeefdfe362023-08-14 16:20:52 -050042 mrs x0, ID_AA64PFR1_EL1
43 ubfx x0, x0, #ID_AA64PFR1_EL1_SME_SHIFT, \
44 #ID_AA64PFR1_EL1_SME_WIDTH
45 cmp x0, #ID_AA64PFR1_EL1_SME_NOT_SUPPORTED
46 b.eq 1f
Juan Pablo Condec9fe7ce2023-07-05 11:57:50 -050047 msr CORTEX_GELAS_SVCRSM, xzr
48 msr CORTEX_GELAS_SVCRZA, xzr
Juan Pablo Condeefdfe362023-08-14 16:20:52 -0500491:
50#endif
Juan Pablo Condec9fe7ce2023-07-05 11:57:50 -050051 /* ---------------------------------------------------
52 * Enable CPU power down bit in power control register
53 * ---------------------------------------------------
54 */
55 sysreg_bit_set CORTEX_GELAS_CPUPWRCTLR_EL1, \
56 CORTEX_GELAS_CPUPWRCTLR_EL1_CORE_PWRDN_BIT
57 isb
58 ret
59endfunc cortex_gelas_core_pwr_dwn
60
61errata_report_shim cortex_gelas
62
63 /* ---------------------------------------------
64 * This function provides Gelas specific
65 * register information for crash reporting.
66 * It needs to return with x6 pointing to
67 * a list of register names in ascii and
68 * x8 - x15 having values of registers to be
69 * reported.
70 * ---------------------------------------------
71 */
72.section .rodata.cortex_gelas_regs, "aS"
73cortex_gelas_regs: /* The ASCII list of register names to be reported */
74 .asciz "imp_cpuectlr_el1", ""
75
76func cortex_gelas_cpu_reg_dump
77 adr x6, cortex_gelas_regs
78 mrs x8, CORTEX_GELAS_IMP_CPUECTLR_EL1
79 ret
80endfunc cortex_gelas_cpu_reg_dump
81
82declare_cpu_ops cortex_gelas, CORTEX_GELAS_MIDR, \
83 cortex_gelas_reset_func, \
84 cortex_gelas_core_pwr_dwn