cortex_a55.S 2.87 KB
Newer Older
1
/*
2
 * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
3
4
5
6
7
8
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include <arch.h>
#include <asm_macros.S>
9
#include <common/bl_common.h>
Isla Mitchell's avatar
Isla Mitchell committed
10
#include <cortex_a55.h>
11
12
13
#include <cpu_macros.S>
#include <plat_macros.S>

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
	/* --------------------------------------------------
	 * Errata Workaround for Cortex A55 Errata #768277.
	 * This applies only to revision r0p0 of Cortex A55.
	 * Inputs:
	 * x0: variant[4:7] and revision[0:3] of current cpu.
	 * Shall clobber: x0-x17
	 * --------------------------------------------------
	 */
func errata_a55_768277_wa
	/*
	 * Compare x0 against revision r0p0
	 */
	mov	x17, x30
	bl	check_errata_768277
	cbz	x0, 1f
	mrs	x1, CORTEX_A55_CPUACTLR_EL1
	orr	x1, x1, #CORTEX_A55_CPUACTLR_EL1_DISABLE_DUAL_ISSUE
	msr	CORTEX_A55_CPUACTLR_EL1, x1
	isb
1:
	ret	x17
endfunc errata_a55_768277_wa

func check_errata_768277
	mov	x1, #0x00
	b	cpu_rev_var_ls
endfunc check_errata_768277

42
43
func cortex_a55_reset_func
	mov	x19, x30
44

45
46
47
#if ERRATA_DSU_936184
	bl	errata_dsu_936184_wa
#endif
48
49
50
51
52
53
54
55
56

	bl	cpu_get_rev_var
	mov	x18, x0

#if ERRATA_A55_768277
	mov	x0, x18
	bl	errata_a55_768277_wa
#endif

57
58
59
	ret	x19
endfunc cortex_a55_reset_func

60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
	/* ---------------------------------------------
	 * HW will do the cache maintenance while powering down
	 * ---------------------------------------------
	 */
func cortex_a55_core_pwr_dwn
	/* ---------------------------------------------
	 * Enable CPU power down bit in power control register
	 * ---------------------------------------------
	 */
	mrs	x0, CORTEX_A55_CPUPWRCTLR_EL1
	orr	x0, x0, #CORTEX_A55_CORE_PWRDN_EN_MASK
	msr	CORTEX_A55_CPUPWRCTLR_EL1, x0
	isb
	ret
endfunc cortex_a55_core_pwr_dwn

76
77
78
79
80
81
82
83
84
85
86
87
88
89
#if REPORT_ERRATA
/*
 * Errata printing function for Cortex A55. Must follow AAPCS & can use stack.
 */
func cortex_a55_errata_report
	stp	x8, x30, [sp, #-16]!
	bl	cpu_get_rev_var
	mov	x8, x0

	/*
	 * Report all errata. The revision variant information is at x8, where
	 * "report_errata" is expecting it and it doesn't corrupt it.
	 */
	report_errata ERRATA_DSU_936184, cortex_a55, dsu_936184
90
	report_errata ERRATA_A55_768277, cortex_a55, 768277
91
92
93
94
95
96

	ldp	x8, x30, [sp], #16
	ret
endfunc cortex_a55_errata_report
#endif

97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
	/* ---------------------------------------------
	 * This function provides cortex_a55 specific
	 * 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.
	 * ---------------------------------------------
	 */
.section .rodata.cortex_a55_regs, "aS"
cortex_a55_regs:  /* The ascii list of register names to be reported */
	.asciz	"cpuectlr_el1", ""

func cortex_a55_cpu_reg_dump
	adr	x6, cortex_a55_regs
	mrs	x8, CORTEX_A55_CPUECTLR_EL1
	ret
endfunc cortex_a55_cpu_reg_dump

declare_cpu_ops cortex_a55, CORTEX_A55_MIDR, \
117
	cortex_a55_reset_func, \
118
	cortex_a55_core_pwr_dwn