blob: e0d20a9e7e0316a232e1f0bbb691b841a5d95083 [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
37 /* ---------------------------------------------------
38 * Disable SME
39 * ---------------------------------------------------
40 */
41 msr CORTEX_GELAS_SVCRSM, xzr
42 msr CORTEX_GELAS_SVCRZA, xzr
43
44 /* ---------------------------------------------------
45 * Enable CPU power down bit in power control register
46 * ---------------------------------------------------
47 */
48 sysreg_bit_set CORTEX_GELAS_CPUPWRCTLR_EL1, \
49 CORTEX_GELAS_CPUPWRCTLR_EL1_CORE_PWRDN_BIT
50 isb
51 ret
52endfunc cortex_gelas_core_pwr_dwn
53
54errata_report_shim cortex_gelas
55
56 /* ---------------------------------------------
57 * This function provides Gelas specific
58 * register information for crash reporting.
59 * It needs to return with x6 pointing to
60 * a list of register names in ascii and
61 * x8 - x15 having values of registers to be
62 * reported.
63 * ---------------------------------------------
64 */
65.section .rodata.cortex_gelas_regs, "aS"
66cortex_gelas_regs: /* The ASCII list of register names to be reported */
67 .asciz "imp_cpuectlr_el1", ""
68
69func cortex_gelas_cpu_reg_dump
70 adr x6, cortex_gelas_regs
71 mrs x8, CORTEX_GELAS_IMP_CPUECTLR_EL1
72 ret
73endfunc cortex_gelas_cpu_reg_dump
74
75declare_cpu_ops cortex_gelas, CORTEX_GELAS_MIDR, \
76 cortex_gelas_reset_func, \
77 cortex_gelas_core_pwr_dwn