blob: 2d611217279b7d311797d521bffc4345f072a26c [file] [log] [blame]
Juan Pablo Condea0594ad2023-09-19 14:57:29 -05001/*
Boyan Karatotev2bef6ba2025-01-21 11:41:46 +00002 * Copyright (c) 2023-2025, Arm Limited. All rights reserved.
Juan Pablo Condea0594ad2023-09-19 14:57:29 -05003 *
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 <travis.h>
11#include <cpu_macros.S>
12#include <plat_macros.S>
13
14/* Hardware handled coherency */
15#if HW_ASSISTED_COHERENCY == 0
16#error "Travis 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 "Travis supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0"
22#endif
23
Boyan Karatotev3bfa5a02025-01-22 13:54:43 +000024cpu_reset_prologue travis
25
Juan Pablo Condea0594ad2023-09-19 14:57:29 -050026cpu_reset_func_start travis
27 /* ----------------------------------------------------
28 * Disable speculative loads
29 * ----------------------------------------------------
30 */
31 msr SSBS, xzr
Boyan Karatotevd2ab2132024-10-16 11:36:29 +010032 /* model bug: not cleared on reset */
33 sysreg_bit_clear TRAVIS_IMP_CPUPWRCTLR_EL1, \
34 TRAVIS_IMP_CPUPWRCTLR_EL1_CORE_PWRDN_EN_BIT
Juan Pablo Condea0594ad2023-09-19 14:57:29 -050035cpu_reset_func_end travis
36
37func travis_core_pwr_dwn
38#if ENABLE_SME_FOR_NS
39 /* ---------------------------------------------------
40 * Disable SME if enabled and supported
41 * ---------------------------------------------------
42 */
43 mrs x0, ID_AA64PFR1_EL1
44 ubfx x0, x0, #ID_AA64PFR1_EL1_SME_SHIFT, \
45 #ID_AA64PFR1_EL1_SME_WIDTH
Sona Mathew9e51f152024-03-11 15:58:15 -050046 cmp x0, #SME_NOT_IMPLEMENTED
Juan Pablo Condea0594ad2023-09-19 14:57:29 -050047 b.eq 1f
48 msr TRAVIS_SVCRSM, xzr
49 msr TRAVIS_SVCRZA, xzr
501:
51#endif
52 /* ---------------------------------------------------
Boyan Karatotev2bef6ba2025-01-21 11:41:46 +000053 * Flip CPU power down bit in power control register.
54 * It will be set on powerdown and cleared on wakeup
Juan Pablo Condea0594ad2023-09-19 14:57:29 -050055 * ---------------------------------------------------
56 */
Boyan Karatotev2bef6ba2025-01-21 11:41:46 +000057 sysreg_bit_toggle TRAVIS_IMP_CPUPWRCTLR_EL1, \
Juan Pablo Condea0594ad2023-09-19 14:57:29 -050058 TRAVIS_IMP_CPUPWRCTLR_EL1_CORE_PWRDN_EN_BIT
59 isb
60 ret
61endfunc travis_core_pwr_dwn
62
Juan Pablo Condea0594ad2023-09-19 14:57:29 -050063.section .rodata.travis_regs, "aS"
64travis_regs: /* The ASCII list of register names to be reported */
65 .asciz "cpuectlr_el1", ""
66
67func travis_cpu_reg_dump
68 adr x6, travis_regs
69 mrs x8, TRAVIS_IMP_CPUECTLR_EL1
70 ret
71endfunc travis_cpu_reg_dump
72
73declare_cpu_ops travis, TRAVIS_MIDR, \
74 travis_reset_func, \
75 travis_core_pwr_dwn