cortex_x2.S 2.01 KB
Newer Older
Jimmy Brisson's avatar
Jimmy Brisson committed
1
/*
2
 * Copyright (c) 2021, Arm Limited. All rights reserved.
Jimmy Brisson's avatar
Jimmy Brisson committed
3
4
5
6
7
8
9
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include <arch.h>
#include <asm_macros.S>
#include <common/bl_common.h>
10
#include <cortex_x2.h>
Jimmy Brisson's avatar
Jimmy Brisson committed
11
12
13
14
15
#include <cpu_macros.S>
#include <plat_macros.S>

/* Hardware handled coherency */
#if HW_ASSISTED_COHERENCY == 0
16
#error "Cortex X2 must be compiled with HW_ASSISTED_COHERENCY enabled"
Jimmy Brisson's avatar
Jimmy Brisson committed
17
18
19
20
#endif

/* 64-bit only core */
#if CTX_INCLUDE_AARCH32_REGS == 1
21
#error "Cortex X2 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0"
Jimmy Brisson's avatar
Jimmy Brisson committed
22
23
24
25
26
27
#endif

	/* ----------------------------------------------------
	 * HW will do the cache maintenance while powering down
	 * ----------------------------------------------------
	 */
28
func cortex_x2_core_pwr_dwn
Jimmy Brisson's avatar
Jimmy Brisson committed
29
30
31
32
	/* ---------------------------------------------------
	 * Enable CPU power down bit in power control register
	 * ---------------------------------------------------
	 */
33
34
35
	mrs	x0, CORTEX_X2_CPUPWRCTLR_EL1
	orr	x0, x0, #CORTEX_X2_CPUPWRCTLR_EL1_CORE_PWRDN_BIT
	msr	CORTEX_X2_CPUPWRCTLR_EL1, x0
Jimmy Brisson's avatar
Jimmy Brisson committed
36
37
	isb
	ret
38
endfunc cortex_x2_core_pwr_dwn
Jimmy Brisson's avatar
Jimmy Brisson committed
39
40

	/*
41
	 * Errata printing function for Cortex X2. Must follow AAPCS.
Jimmy Brisson's avatar
Jimmy Brisson committed
42
43
	 */
#if REPORT_ERRATA
44
func cortex_x2_errata_report
Jimmy Brisson's avatar
Jimmy Brisson committed
45
	ret
46
endfunc cortex_x2_errata_report
Jimmy Brisson's avatar
Jimmy Brisson committed
47
48
#endif

49
func cortex_x2_reset_func
Jimmy Brisson's avatar
Jimmy Brisson committed
50
51
52
53
	/* Disable speculative loads */
	msr	SSBS, xzr
	isb
	ret
54
endfunc cortex_x2_reset_func
Jimmy Brisson's avatar
Jimmy Brisson committed
55
56

	/* ---------------------------------------------
57
	 * This function provides Cortex X2 specific
Jimmy Brisson's avatar
Jimmy Brisson committed
58
59
60
61
62
63
64
	 * register information for crash reporting.
	 * It needs to return with x6 pointing to
	 * a list of register names in ascii and
	 * x8 - x15 having values of registers to be
	 * reported.
	 * ---------------------------------------------
	 */
65
66
.section .rodata.cortex_x2_regs, "aS"
cortex_x2_regs:  /* The ascii list of register names to be reported */
Jimmy Brisson's avatar
Jimmy Brisson committed
67
68
	.asciz	"cpuectlr_el1", ""

69
70
71
func cortex_x2_cpu_reg_dump
	adr	x6, cortex_x2_regs
	mrs	x8, CORTEX_X2_CPUECTLR_EL1
Jimmy Brisson's avatar
Jimmy Brisson committed
72
	ret
73
endfunc cortex_x2_cpu_reg_dump
Jimmy Brisson's avatar
Jimmy Brisson committed
74

75
76
77
declare_cpu_ops cortex_x2, CORTEX_X2_MIDR, \
	cortex_x2_reset_func, \
	cortex_x2_core_pwr_dwn