blob: 20d5fe4cd7e5943944b10e313bceae5b09ab6d8f [file] [log] [blame]
David Wang805c2c72016-11-09 16:29:02 +00001/*
Ambroise Vincent7927fa02019-02-21 16:20:43 +00002 * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
David Wang805c2c72016-11-09 16:29:02 +00003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
David Wang805c2c72016-11-09 16:29:02 +00007#include <arch.h>
8#include <asm_macros.S>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00009#include <common/bl_common.h>
Isla Mitchell99305012017-07-11 14:54:08 +010010#include <cortex_a55.h>
David Wang805c2c72016-11-09 16:29:02 +000011#include <cpu_macros.S>
12#include <plat_macros.S>
13
Ambroise Vincent7927fa02019-02-21 16:20:43 +000014 /* --------------------------------------------------
15 * Errata Workaround for Cortex A55 Errata #768277.
16 * This applies only to revision r0p0 of Cortex A55.
17 * Inputs:
18 * x0: variant[4:7] and revision[0:3] of current cpu.
19 * Shall clobber: x0-x17
20 * --------------------------------------------------
21 */
22func errata_a55_768277_wa
23 /*
24 * Compare x0 against revision r0p0
25 */
26 mov x17, x30
27 bl check_errata_768277
28 cbz x0, 1f
29 mrs x1, CORTEX_A55_CPUACTLR_EL1
30 orr x1, x1, #CORTEX_A55_CPUACTLR_EL1_DISABLE_DUAL_ISSUE
31 msr CORTEX_A55_CPUACTLR_EL1, x1
32 isb
331:
34 ret x17
35endfunc errata_a55_768277_wa
36
37func check_errata_768277
38 mov x1, #0x00
39 b cpu_rev_var_ls
40endfunc check_errata_768277
41
Ambroise Vincent6f319602019-02-21 16:25:37 +000042 /* ------------------------------------------------------------------
43 * Errata Workaround for Cortex A55 Errata #778703.
44 * This applies only to revision r0p0 of Cortex A55 where L2 cache is
45 * not configured.
46 * Inputs:
47 * x0: variant[4:7] and revision[0:3] of current cpu.
48 * Shall clobber: x0-x17
49 * ------------------------------------------------------------------
50 */
51func errata_a55_778703_wa
52 /*
53 * Compare x0 against revision r0p0 and check that no private L2 cache
54 * is configured
55 */
56 mov x17, x30
57 bl check_errata_778703
58 cbz x0, 1f
59 mrs x1, CORTEX_A55_CPUECTLR_EL1
60 orr x1, x1, #CORTEX_A55_CPUECTLR_EL1_L1WSCTL
61 msr CORTEX_A55_CPUECTLR_EL1, x1
62 mrs x1, CORTEX_A55_CPUACTLR_EL1
63 orr x1, x1, #CORTEX_A55_CPUACTLR_EL1_DISABLE_WRITE_STREAMING
64 msr CORTEX_A55_CPUACTLR_EL1, x1
65 isb
661:
67 ret x17
68endfunc errata_a55_778703_wa
69
70func check_errata_778703
71 mov x16, x30
72 mov x1, #0x00
73 bl cpu_rev_var_ls
74 /*
75 * Check that no private L2 cache is configured
76 */
77 mrs x1, CORTEX_A55_CLIDR_EL1
78 and x1, x1, CORTEX_A55_CLIDR_EL1_CTYPE3
79 cmp x1, #0
80 mov x2, #ERRATA_NOT_APPLIES
81 csel x0, x0, x2, eq
82 ret x16
83endfunc check_errata_778703
84
John Tsichritzis4daa1de2018-07-23 09:11:59 +010085func cortex_a55_reset_func
86 mov x19, x30
Ambroise Vincent7927fa02019-02-21 16:20:43 +000087
John Tsichritzis4daa1de2018-07-23 09:11:59 +010088#if ERRATA_DSU_936184
89 bl errata_dsu_936184_wa
90#endif
Ambroise Vincent7927fa02019-02-21 16:20:43 +000091
92 bl cpu_get_rev_var
93 mov x18, x0
94
95#if ERRATA_A55_768277
96 mov x0, x18
97 bl errata_a55_768277_wa
98#endif
99
Ambroise Vincent6f319602019-02-21 16:25:37 +0000100#if ERRATA_A55_778703
101 mov x0, x18
102 bl errata_a55_778703_wa
103#endif
104
John Tsichritzis4daa1de2018-07-23 09:11:59 +0100105 ret x19
106endfunc cortex_a55_reset_func
107
David Wang805c2c72016-11-09 16:29:02 +0000108 /* ---------------------------------------------
109 * HW will do the cache maintenance while powering down
110 * ---------------------------------------------
111 */
112func cortex_a55_core_pwr_dwn
113 /* ---------------------------------------------
114 * Enable CPU power down bit in power control register
115 * ---------------------------------------------
116 */
117 mrs x0, CORTEX_A55_CPUPWRCTLR_EL1
118 orr x0, x0, #CORTEX_A55_CORE_PWRDN_EN_MASK
119 msr CORTEX_A55_CPUPWRCTLR_EL1, x0
120 isb
121 ret
122endfunc cortex_a55_core_pwr_dwn
123
John Tsichritzis4daa1de2018-07-23 09:11:59 +0100124#if REPORT_ERRATA
125/*
126 * Errata printing function for Cortex A55. Must follow AAPCS & can use stack.
127 */
128func cortex_a55_errata_report
129 stp x8, x30, [sp, #-16]!
130 bl cpu_get_rev_var
131 mov x8, x0
132
133 /*
134 * Report all errata. The revision variant information is at x8, where
135 * "report_errata" is expecting it and it doesn't corrupt it.
136 */
137 report_errata ERRATA_DSU_936184, cortex_a55, dsu_936184
Ambroise Vincent7927fa02019-02-21 16:20:43 +0000138 report_errata ERRATA_A55_768277, cortex_a55, 768277
Ambroise Vincent6f319602019-02-21 16:25:37 +0000139 report_errata ERRATA_A55_778703, cortex_a55, 778703
John Tsichritzis4daa1de2018-07-23 09:11:59 +0100140
141 ldp x8, x30, [sp], #16
142 ret
143endfunc cortex_a55_errata_report
144#endif
145
David Wang805c2c72016-11-09 16:29:02 +0000146 /* ---------------------------------------------
147 * This function provides cortex_a55 specific
148 * register information for crash reporting.
149 * It needs to return with x6 pointing to
150 * a list of register names in ascii and
151 * x8 - x15 having values of registers to be
152 * reported.
153 * ---------------------------------------------
154 */
155.section .rodata.cortex_a55_regs, "aS"
156cortex_a55_regs: /* The ascii list of register names to be reported */
157 .asciz "cpuectlr_el1", ""
158
159func cortex_a55_cpu_reg_dump
160 adr x6, cortex_a55_regs
161 mrs x8, CORTEX_A55_CPUECTLR_EL1
162 ret
163endfunc cortex_a55_cpu_reg_dump
164
165declare_cpu_ops cortex_a55, CORTEX_A55_MIDR, \
John Tsichritzis4daa1de2018-07-23 09:11:59 +0100166 cortex_a55_reset_func, \
David Wang805c2c72016-11-09 16:29:02 +0000167 cortex_a55_core_pwr_dwn