Isla Mitchell | abbffe9 | 2017-08-03 16:04:46 +0100 | [diff] [blame] | 1 | /* |
John Tsichritzis | da6d75a | 2019-02-19 13:49:06 +0000 | [diff] [blame] | 2 | * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved. |
Isla Mitchell | abbffe9 | 2017-08-03 16:04:46 +0100 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <arch.h> |
| 8 | #include <asm_macros.S> |
John Tsichritzis | da6d75a | 2019-02-19 13:49:06 +0000 | [diff] [blame] | 9 | #include <neoverse_n1.h> |
Dimitris Papastamos | 08268e2 | 2018-02-13 11:28:02 +0000 | [diff] [blame] | 10 | #include <cpuamu.h> |
Isla Mitchell | abbffe9 | 2017-08-03 16:04:46 +0100 | [diff] [blame] | 11 | #include <cpu_macros.S> |
Dimitris Papastamos | 08268e2 | 2018-02-13 11:28:02 +0000 | [diff] [blame] | 12 | |
John Tsichritzis | 076b5f0 | 2019-03-19 17:20:52 +0000 | [diff] [blame] | 13 | /* Hardware handled coherency */ |
| 14 | #if HW_ASSISTED_COHERENCY == 0 |
| 15 | #error "Neoverse N1 must be compiled with HW_ASSISTED_COHERENCY enabled" |
| 16 | #endif |
| 17 | |
John Tsichritzis | 629d04f | 2019-06-03 13:54:30 +0100 | [diff] [blame] | 18 | /* 64-bit only core */ |
| 19 | #if CTX_INCLUDE_AARCH32_REGS == 1 |
| 20 | #error "Neoverse-N1 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0" |
| 21 | #endif |
| 22 | |
Dimitris Papastamos | 040b546 | 2018-03-26 16:46:01 +0100 | [diff] [blame] | 23 | /* -------------------------------------------------- |
Andre Przywara | 5f5d076 | 2019-05-20 14:57:06 +0100 | [diff] [blame] | 24 | * Errata Workaround for Neoverse N1 Erratum 1043202. |
John Tsichritzis | da6d75a | 2019-02-19 13:49:06 +0000 | [diff] [blame] | 25 | * This applies to revision r0p0 and r1p0 of Neoverse N1. |
Dimitris Papastamos | 040b546 | 2018-03-26 16:46:01 +0100 | [diff] [blame] | 26 | * Inputs: |
| 27 | * x0: variant[4:7] and revision[0:3] of current cpu. |
| 28 | * Shall clobber: x0-x17 |
| 29 | * -------------------------------------------------- |
| 30 | */ |
John Tsichritzis | da6d75a | 2019-02-19 13:49:06 +0000 | [diff] [blame] | 31 | func errata_n1_1043202_wa |
Dimitris Papastamos | 040b546 | 2018-03-26 16:46:01 +0100 | [diff] [blame] | 32 | /* Compare x0 against revision r1p0 */ |
| 33 | mov x17, x30 |
| 34 | bl check_errata_1043202 |
| 35 | cbz x0, 1f |
| 36 | |
| 37 | /* Apply instruction patching sequence */ |
| 38 | ldr x0, =0x0 |
| 39 | msr CPUPSELR_EL3, x0 |
| 40 | ldr x0, =0xF3BF8F2F |
| 41 | msr CPUPOR_EL3, x0 |
| 42 | ldr x0, =0xFFFFFFFF |
| 43 | msr CPUPMR_EL3, x0 |
| 44 | ldr x0, =0x800200071 |
| 45 | msr CPUPCR_EL3, x0 |
| 46 | isb |
| 47 | 1: |
| 48 | ret x17 |
John Tsichritzis | da6d75a | 2019-02-19 13:49:06 +0000 | [diff] [blame] | 49 | endfunc errata_n1_1043202_wa |
Dimitris Papastamos | 040b546 | 2018-03-26 16:46:01 +0100 | [diff] [blame] | 50 | |
| 51 | func check_errata_1043202 |
| 52 | /* Applies to r0p0 and r1p0 */ |
| 53 | mov x1, #0x10 |
| 54 | b cpu_rev_var_ls |
| 55 | endfunc check_errata_1043202 |
| 56 | |
Sami Mujawar | eca6e45 | 2019-05-10 14:28:37 +0100 | [diff] [blame] | 57 | /* -------------------------------------------------- |
| 58 | * Disable speculative loads if Neoverse N1 supports |
| 59 | * SSBS. |
| 60 | * |
| 61 | * Shall clobber: x0. |
| 62 | * -------------------------------------------------- |
| 63 | */ |
| 64 | func neoverse_n1_disable_speculative_loads |
| 65 | /* Check if the PE implements SSBS */ |
| 66 | mrs x0, id_aa64pfr1_el1 |
| 67 | tst x0, #(ID_AA64PFR1_EL1_SSBS_MASK << ID_AA64PFR1_EL1_SSBS_SHIFT) |
| 68 | b.eq 1f |
| 69 | |
| 70 | /* Disable speculative loads */ |
| 71 | msr SSBS, xzr |
| 72 | isb |
| 73 | |
| 74 | 1: |
| 75 | ret |
| 76 | endfunc neoverse_n1_disable_speculative_loads |
| 77 | |
Andre Przywara | 5f5d076 | 2019-05-20 14:57:06 +0100 | [diff] [blame] | 78 | /* -------------------------------------------------- |
lauwal01 | a601afe | 2019-06-24 11:23:50 -0500 | [diff] [blame] | 79 | * Errata Workaround for Neoverse N1 Errata #1073348 |
| 80 | * This applies to revision r0p0 and r1p0 of Neoverse N1. |
| 81 | * Inputs: |
| 82 | * x0: variant[4:7] and revision[0:3] of current cpu. |
| 83 | * Shall clobber: x0-x17 |
| 84 | * -------------------------------------------------- |
| 85 | */ |
| 86 | func errata_n1_1073348_wa |
| 87 | /* Compare x0 against revision r1p0 */ |
| 88 | mov x17, x30 |
| 89 | bl check_errata_1073348 |
| 90 | cbz x0, 1f |
| 91 | mrs x1, NEOVERSE_N1_CPUACTLR_EL1 |
| 92 | orr x1, x1, NEOVERSE_N1_CPUACTLR_EL1_BIT_6 |
| 93 | msr NEOVERSE_N1_CPUACTLR_EL1, x1 |
| 94 | isb |
| 95 | 1: |
| 96 | ret x17 |
| 97 | endfunc errata_n1_1073348_wa |
| 98 | |
| 99 | func check_errata_1073348 |
| 100 | /* Applies to r0p0 and r1p0 */ |
| 101 | mov x1, #0x10 |
| 102 | b cpu_rev_var_ls |
| 103 | endfunc check_errata_1073348 |
| 104 | |
| 105 | /* -------------------------------------------------- |
lauwal01 | e34606f | 2019-06-24 11:28:34 -0500 | [diff] [blame] | 106 | * Errata Workaround for Neoverse N1 Errata #1130799 |
| 107 | * This applies to revision <=r2p0 of Neoverse N1. |
| 108 | * Inputs: |
| 109 | * x0: variant[4:7] and revision[0:3] of current cpu. |
| 110 | * Shall clobber: x0-x17 |
| 111 | * -------------------------------------------------- |
| 112 | */ |
| 113 | func errata_n1_1130799_wa |
| 114 | /* Compare x0 against revision r2p0 */ |
| 115 | mov x17, x30 |
| 116 | bl check_errata_1130799 |
| 117 | cbz x0, 1f |
| 118 | mrs x1, NEOVERSE_N1_CPUACTLR2_EL1 |
| 119 | orr x1, x1, NEOVERSE_N1_CPUACTLR2_EL1_BIT_59 |
| 120 | msr NEOVERSE_N1_CPUACTLR2_EL1, x1 |
| 121 | isb |
| 122 | 1: |
| 123 | ret x17 |
| 124 | endfunc errata_n1_1130799_wa |
| 125 | |
| 126 | func check_errata_1130799 |
| 127 | /* Applies to <=r2p0 */ |
| 128 | mov x1, #0x20 |
| 129 | b cpu_rev_var_ls |
| 130 | endfunc check_errata_1130799 |
| 131 | |
| 132 | /* -------------------------------------------------- |
lauwal01 | 2017ab2 | 2019-06-24 11:32:40 -0500 | [diff] [blame] | 133 | * Errata Workaround for Neoverse N1 Errata #1165347 |
| 134 | * This applies to revision <=r2p0 of Neoverse N1. |
| 135 | * Inputs: |
| 136 | * x0: variant[4:7] and revision[0:3] of current cpu. |
| 137 | * Shall clobber: x0-x17 |
| 138 | * -------------------------------------------------- |
| 139 | */ |
| 140 | func errata_n1_1165347_wa |
| 141 | /* Compare x0 against revision r2p0 */ |
| 142 | mov x17, x30 |
| 143 | bl check_errata_1165347 |
| 144 | cbz x0, 1f |
| 145 | mrs x1, NEOVERSE_N1_CPUACTLR2_EL1 |
| 146 | orr x1, x1, NEOVERSE_N1_CPUACTLR2_EL1_BIT_0 |
| 147 | orr x1, x1, NEOVERSE_N1_CPUACTLR2_EL1_BIT_15 |
| 148 | msr NEOVERSE_N1_CPUACTLR2_EL1, x1 |
| 149 | isb |
| 150 | 1: |
| 151 | ret x17 |
| 152 | endfunc errata_n1_1165347_wa |
| 153 | |
| 154 | func check_errata_1165347 |
| 155 | /* Applies to <=r2p0 */ |
| 156 | mov x1, #0x20 |
| 157 | b cpu_rev_var_ls |
| 158 | endfunc check_errata_1165347 |
| 159 | |
| 160 | /* -------------------------------------------------- |
lauwal01 | ef5fa7d | 2019-06-24 11:35:37 -0500 | [diff] [blame] | 161 | * Errata Workaround for Neoverse N1 Errata #1207823 |
| 162 | * This applies to revision <=r2p0 of Neoverse N1. |
| 163 | * Inputs: |
| 164 | * x0: variant[4:7] and revision[0:3] of current cpu. |
| 165 | * Shall clobber: x0-x17 |
| 166 | * -------------------------------------------------- |
| 167 | */ |
| 168 | func errata_n1_1207823_wa |
| 169 | /* Compare x0 against revision r2p0 */ |
| 170 | mov x17, x30 |
| 171 | bl check_errata_1207823 |
| 172 | cbz x0, 1f |
| 173 | mrs x1, NEOVERSE_N1_CPUACTLR2_EL1 |
| 174 | orr x1, x1, NEOVERSE_N1_CPUACTLR2_EL1_BIT_11 |
| 175 | msr NEOVERSE_N1_CPUACTLR2_EL1, x1 |
| 176 | isb |
| 177 | 1: |
| 178 | ret x17 |
| 179 | endfunc errata_n1_1207823_wa |
| 180 | |
| 181 | func check_errata_1207823 |
| 182 | /* Applies to <=r2p0 */ |
| 183 | mov x1, #0x20 |
| 184 | b cpu_rev_var_ls |
| 185 | endfunc check_errata_1207823 |
| 186 | |
| 187 | /* -------------------------------------------------- |
lauwal01 | 9eceb02 | 2019-06-24 11:38:53 -0500 | [diff] [blame] | 188 | * Errata Workaround for Neoverse N1 Errata #1220197 |
| 189 | * This applies to revision <=r2p0 of Neoverse N1. |
| 190 | * Inputs: |
| 191 | * x0: variant[4:7] and revision[0:3] of current cpu. |
| 192 | * Shall clobber: x0-x17 |
| 193 | * -------------------------------------------------- |
| 194 | */ |
| 195 | func errata_n1_1220197_wa |
| 196 | /* Compare x0 against revision r2p0 */ |
| 197 | mov x17, x30 |
| 198 | bl check_errata_1220197 |
| 199 | cbz x0, 1f |
| 200 | mrs x1, NEOVERSE_N1_CPUECTLR_EL1 |
| 201 | orr x1, x1, NEOVERSE_N1_WS_THR_L2_MASK |
| 202 | msr NEOVERSE_N1_CPUECTLR_EL1, x1 |
| 203 | isb |
| 204 | 1: |
| 205 | ret x17 |
| 206 | endfunc errata_n1_1220197_wa |
| 207 | |
| 208 | func check_errata_1220197 |
| 209 | /* Applies to <=r2p0 */ |
| 210 | mov x1, #0x20 |
| 211 | b cpu_rev_var_ls |
| 212 | endfunc check_errata_1220197 |
| 213 | |
| 214 | /* -------------------------------------------------- |
lauwal01 | 335b3c7 | 2019-06-24 11:42:02 -0500 | [diff] [blame] | 215 | * Errata Workaround for Neoverse N1 Errata #1257314 |
| 216 | * This applies to revision <=r3p0 of Neoverse N1. |
| 217 | * Inputs: |
| 218 | * x0: variant[4:7] and revision[0:3] of current cpu. |
| 219 | * Shall clobber: x0-x17 |
| 220 | * -------------------------------------------------- |
| 221 | */ |
| 222 | func errata_n1_1257314_wa |
| 223 | /* Compare x0 against revision r3p0 */ |
| 224 | mov x17, x30 |
| 225 | bl check_errata_1257314 |
| 226 | cbz x0, 1f |
| 227 | mrs x1, NEOVERSE_N1_CPUACTLR3_EL1 |
| 228 | orr x1, x1, NEOVERSE_N1_CPUACTLR3_EL1_BIT_10 |
| 229 | msr NEOVERSE_N1_CPUACTLR3_EL1, x1 |
| 230 | isb |
| 231 | 1: |
| 232 | ret x17 |
| 233 | endfunc errata_n1_1257314_wa |
| 234 | |
| 235 | func check_errata_1257314 |
| 236 | /* Applies to <=r3p0 */ |
| 237 | mov x1, #0x30 |
| 238 | b cpu_rev_var_ls |
| 239 | endfunc check_errata_1257314 |
| 240 | |
| 241 | /* -------------------------------------------------- |
lauwal01 | 411f495 | 2019-06-24 11:44:58 -0500 | [diff] [blame] | 242 | * Errata Workaround for Neoverse N1 Errata #1262606 |
| 243 | * This applies to revision <=r3p0 of Neoverse N1. |
| 244 | * Inputs: |
| 245 | * x0: variant[4:7] and revision[0:3] of current cpu. |
| 246 | * Shall clobber: x0-x17 |
| 247 | * -------------------------------------------------- |
| 248 | */ |
| 249 | func errata_n1_1262606_wa |
| 250 | /* Compare x0 against revision r3p0 */ |
| 251 | mov x17, x30 |
| 252 | bl check_errata_1262606 |
| 253 | cbz x0, 1f |
| 254 | mrs x1, NEOVERSE_N1_CPUACTLR_EL1 |
| 255 | orr x1, x1, NEOVERSE_N1_CPUACTLR_EL1_BIT_13 |
| 256 | msr NEOVERSE_N1_CPUACTLR_EL1, x1 |
| 257 | isb |
| 258 | 1: |
| 259 | ret x17 |
| 260 | endfunc errata_n1_1262606_wa |
| 261 | |
| 262 | func check_errata_1262606 |
| 263 | /* Applies to <=r3p0 */ |
| 264 | mov x1, #0x30 |
| 265 | b cpu_rev_var_ls |
| 266 | endfunc check_errata_1262606 |
| 267 | |
| 268 | /* -------------------------------------------------- |
lauwal01 | 11c4837 | 2019-06-24 11:47:30 -0500 | [diff] [blame^] | 269 | * Errata Workaround for Neoverse N1 Errata #1262888 |
| 270 | * This applies to revision <=r3p0 of Neoverse N1. |
| 271 | * Inputs: |
| 272 | * x0: variant[4:7] and revision[0:3] of current cpu. |
| 273 | * Shall clobber: x0-x17 |
| 274 | * -------------------------------------------------- |
| 275 | */ |
| 276 | func errata_n1_1262888_wa |
| 277 | /* Compare x0 against revision r3p0 */ |
| 278 | mov x17, x30 |
| 279 | bl check_errata_1262888 |
| 280 | cbz x0, 1f |
| 281 | mrs x1, NEOVERSE_N1_CPUECTLR_EL1 |
| 282 | orr x1, x1, NEOVERSE_N1_CPUECTLR_EL1_MM_TLBPF_DIS_BIT |
| 283 | msr NEOVERSE_N1_CPUECTLR_EL1, x1 |
| 284 | isb |
| 285 | 1: |
| 286 | ret x17 |
| 287 | endfunc errata_n1_1262888_wa |
| 288 | |
| 289 | func check_errata_1262888 |
| 290 | /* Applies to <=r3p0 */ |
| 291 | mov x1, #0x30 |
| 292 | b cpu_rev_var_ls |
| 293 | endfunc check_errata_1262888 |
| 294 | |
| 295 | /* -------------------------------------------------- |
Andre Przywara | 5f5d076 | 2019-05-20 14:57:06 +0100 | [diff] [blame] | 296 | * Errata Workaround for Neoverse N1 Erratum 1315703. |
| 297 | * This applies to revision <= r3p0 of Neoverse N1. |
| 298 | * Inputs: |
| 299 | * x0: variant[4:7] and revision[0:3] of current cpu. |
| 300 | * Shall clobber: x0-x17 |
| 301 | * -------------------------------------------------- |
| 302 | */ |
| 303 | func errata_n1_1315703_wa |
| 304 | /* Compare x0 against revision r3p1 */ |
| 305 | mov x17, x30 |
| 306 | bl check_errata_1315703 |
| 307 | cbz x0, 1f |
| 308 | |
| 309 | mrs x0, NEOVERSE_N1_CPUACTLR2_EL1 |
| 310 | orr x0, x0, #NEOVERSE_N1_CPUACTLR2_EL1_BIT_16 |
| 311 | msr NEOVERSE_N1_CPUACTLR2_EL1, x0 |
| 312 | isb |
| 313 | |
| 314 | 1: |
| 315 | ret x17 |
| 316 | endfunc errata_n1_1315703_wa |
| 317 | |
| 318 | func check_errata_1315703 |
| 319 | /* Applies to everything <= r3p0. */ |
| 320 | mov x1, #0x30 |
| 321 | b cpu_rev_var_ls |
| 322 | endfunc check_errata_1315703 |
| 323 | |
John Tsichritzis | da6d75a | 2019-02-19 13:49:06 +0000 | [diff] [blame] | 324 | func neoverse_n1_reset_func |
Dimitris Papastamos | 040b546 | 2018-03-26 16:46:01 +0100 | [diff] [blame] | 325 | mov x19, x30 |
John Tsichritzis | 8074448 | 2019-03-04 16:41:26 +0000 | [diff] [blame] | 326 | |
Sami Mujawar | eca6e45 | 2019-05-10 14:28:37 +0100 | [diff] [blame] | 327 | bl neoverse_n1_disable_speculative_loads |
John Tsichritzis | 8074448 | 2019-03-04 16:41:26 +0000 | [diff] [blame] | 328 | |
Louis Mayencourt | 632ab3e | 2019-04-18 14:34:11 +0100 | [diff] [blame] | 329 | /* Forces all cacheable atomic instructions to be near */ |
| 330 | mrs x0, NEOVERSE_N1_CPUACTLR2_EL1 |
| 331 | orr x0, x0, #NEOVERSE_N1_CPUACTLR2_EL1_BIT_2 |
| 332 | msr NEOVERSE_N1_CPUACTLR2_EL1, x0 |
| 333 | isb |
| 334 | |
Dimitris Papastamos | 040b546 | 2018-03-26 16:46:01 +0100 | [diff] [blame] | 335 | bl cpu_get_rev_var |
| 336 | mov x18, x0 |
| 337 | |
John Tsichritzis | da6d75a | 2019-02-19 13:49:06 +0000 | [diff] [blame] | 338 | #if ERRATA_N1_1043202 |
Dimitris Papastamos | 040b546 | 2018-03-26 16:46:01 +0100 | [diff] [blame] | 339 | mov x0, x18 |
John Tsichritzis | da6d75a | 2019-02-19 13:49:06 +0000 | [diff] [blame] | 340 | bl errata_n1_1043202_wa |
Dimitris Papastamos | 040b546 | 2018-03-26 16:46:01 +0100 | [diff] [blame] | 341 | #endif |
| 342 | |
lauwal01 | a601afe | 2019-06-24 11:23:50 -0500 | [diff] [blame] | 343 | #if ERRATA_N1_1073348 |
| 344 | mov x0, x18 |
| 345 | bl errata_n1_1073348_wa |
| 346 | #endif |
| 347 | |
lauwal01 | e34606f | 2019-06-24 11:28:34 -0500 | [diff] [blame] | 348 | #if ERRATA_N1_1130799 |
| 349 | mov x0, x18 |
| 350 | bl errata_n1_1130799_wa |
| 351 | #endif |
| 352 | |
lauwal01 | 2017ab2 | 2019-06-24 11:32:40 -0500 | [diff] [blame] | 353 | #if ERRATA_N1_1165347 |
| 354 | mov x0, x18 |
| 355 | bl errata_n1_1165347_wa |
| 356 | #endif |
| 357 | |
lauwal01 | ef5fa7d | 2019-06-24 11:35:37 -0500 | [diff] [blame] | 358 | #if ERRATA_N1_1207823 |
| 359 | mov x0, x18 |
| 360 | bl errata_n1_1207823_wa |
| 361 | #endif |
| 362 | |
lauwal01 | 9eceb02 | 2019-06-24 11:38:53 -0500 | [diff] [blame] | 363 | #if ERRATA_N1_1220197 |
| 364 | mov x0, x18 |
| 365 | bl errata_n1_1220197_wa |
| 366 | #endif |
| 367 | |
lauwal01 | 335b3c7 | 2019-06-24 11:42:02 -0500 | [diff] [blame] | 368 | #if ERRATA_N1_1257314 |
| 369 | mov x0, x18 |
| 370 | bl errata_n1_1257314_wa |
| 371 | #endif |
| 372 | |
lauwal01 | 411f495 | 2019-06-24 11:44:58 -0500 | [diff] [blame] | 373 | #if ERRATA_N1_1262606 |
| 374 | mov x0, x18 |
| 375 | bl errata_n1_1262606_wa |
| 376 | #endif |
| 377 | |
lauwal01 | 11c4837 | 2019-06-24 11:47:30 -0500 | [diff] [blame^] | 378 | #if ERRATA_N1_1262888 |
| 379 | mov x0, x18 |
| 380 | bl errata_n1_1262888_wa |
| 381 | #endif |
| 382 | |
Andre Przywara | 5f5d076 | 2019-05-20 14:57:06 +0100 | [diff] [blame] | 383 | #if ERRATA_N1_1315703 |
| 384 | mov x0, x18 |
| 385 | bl errata_n1_1315703_wa |
| 386 | #endif |
| 387 | |
Dimitris Papastamos | 08268e2 | 2018-02-13 11:28:02 +0000 | [diff] [blame] | 388 | #if ENABLE_AMU |
| 389 | /* Make sure accesses from EL0/EL1 and EL2 are not trapped to EL3 */ |
| 390 | mrs x0, actlr_el3 |
John Tsichritzis | da6d75a | 2019-02-19 13:49:06 +0000 | [diff] [blame] | 391 | orr x0, x0, #NEOVERSE_N1_ACTLR_AMEN_BIT |
Dimitris Papastamos | 08268e2 | 2018-02-13 11:28:02 +0000 | [diff] [blame] | 392 | msr actlr_el3, x0 |
| 393 | isb |
| 394 | |
| 395 | /* Make sure accesses from EL0/EL1 are not trapped to EL2 */ |
| 396 | mrs x0, actlr_el2 |
John Tsichritzis | da6d75a | 2019-02-19 13:49:06 +0000 | [diff] [blame] | 397 | orr x0, x0, #NEOVERSE_N1_ACTLR_AMEN_BIT |
Dimitris Papastamos | 08268e2 | 2018-02-13 11:28:02 +0000 | [diff] [blame] | 398 | msr actlr_el2, x0 |
| 399 | isb |
| 400 | |
| 401 | /* Enable group0 counters */ |
John Tsichritzis | da6d75a | 2019-02-19 13:49:06 +0000 | [diff] [blame] | 402 | mov x0, #NEOVERSE_N1_AMU_GROUP0_MASK |
Dimitris Papastamos | 08268e2 | 2018-02-13 11:28:02 +0000 | [diff] [blame] | 403 | msr CPUAMCNTENSET_EL0, x0 |
| 404 | isb |
| 405 | #endif |
Louis Mayencourt | bb2f077 | 2019-06-10 16:43:39 +0100 | [diff] [blame] | 406 | |
| 407 | #if ERRATA_DSU_936184 |
| 408 | bl errata_dsu_936184_wa |
| 409 | #endif |
| 410 | |
Dimitris Papastamos | 040b546 | 2018-03-26 16:46:01 +0100 | [diff] [blame] | 411 | ret x19 |
John Tsichritzis | da6d75a | 2019-02-19 13:49:06 +0000 | [diff] [blame] | 412 | endfunc neoverse_n1_reset_func |
Isla Mitchell | abbffe9 | 2017-08-03 16:04:46 +0100 | [diff] [blame] | 413 | |
| 414 | /* --------------------------------------------- |
| 415 | * HW will do the cache maintenance while powering down |
| 416 | * --------------------------------------------- |
| 417 | */ |
John Tsichritzis | da6d75a | 2019-02-19 13:49:06 +0000 | [diff] [blame] | 418 | func neoverse_n1_core_pwr_dwn |
Isla Mitchell | abbffe9 | 2017-08-03 16:04:46 +0100 | [diff] [blame] | 419 | /* --------------------------------------------- |
| 420 | * Enable CPU power down bit in power control register |
| 421 | * --------------------------------------------- |
| 422 | */ |
John Tsichritzis | da6d75a | 2019-02-19 13:49:06 +0000 | [diff] [blame] | 423 | mrs x0, NEOVERSE_N1_CPUPWRCTLR_EL1 |
| 424 | orr x0, x0, #NEOVERSE_N1_CORE_PWRDN_EN_MASK |
| 425 | msr NEOVERSE_N1_CPUPWRCTLR_EL1, x0 |
Isla Mitchell | abbffe9 | 2017-08-03 16:04:46 +0100 | [diff] [blame] | 426 | isb |
| 427 | ret |
John Tsichritzis | da6d75a | 2019-02-19 13:49:06 +0000 | [diff] [blame] | 428 | endfunc neoverse_n1_core_pwr_dwn |
Isla Mitchell | abbffe9 | 2017-08-03 16:04:46 +0100 | [diff] [blame] | 429 | |
Dimitris Papastamos | 040b546 | 2018-03-26 16:46:01 +0100 | [diff] [blame] | 430 | #if REPORT_ERRATA |
| 431 | /* |
John Tsichritzis | da6d75a | 2019-02-19 13:49:06 +0000 | [diff] [blame] | 432 | * Errata printing function for Neoverse N1. Must follow AAPCS. |
Dimitris Papastamos | 040b546 | 2018-03-26 16:46:01 +0100 | [diff] [blame] | 433 | */ |
John Tsichritzis | da6d75a | 2019-02-19 13:49:06 +0000 | [diff] [blame] | 434 | func neoverse_n1_errata_report |
Dimitris Papastamos | 040b546 | 2018-03-26 16:46:01 +0100 | [diff] [blame] | 435 | stp x8, x30, [sp, #-16]! |
| 436 | |
| 437 | bl cpu_get_rev_var |
| 438 | mov x8, x0 |
| 439 | |
| 440 | /* |
| 441 | * Report all errata. The revision-variant information is passed to |
| 442 | * checking functions of each errata. |
| 443 | */ |
John Tsichritzis | da6d75a | 2019-02-19 13:49:06 +0000 | [diff] [blame] | 444 | report_errata ERRATA_N1_1043202, neoverse_n1, 1043202 |
lauwal01 | a601afe | 2019-06-24 11:23:50 -0500 | [diff] [blame] | 445 | report_errata ERRATA_N1_1073348, neoverse_n1, 1073348 |
lauwal01 | e34606f | 2019-06-24 11:28:34 -0500 | [diff] [blame] | 446 | report_errata ERRATA_N1_1130799, neoverse_n1, 1130799 |
lauwal01 | 2017ab2 | 2019-06-24 11:32:40 -0500 | [diff] [blame] | 447 | report_errata ERRATA_N1_1165347, neoverse_n1, 1165347 |
lauwal01 | ef5fa7d | 2019-06-24 11:35:37 -0500 | [diff] [blame] | 448 | report_errata ERRATA_N1_1207823, neoverse_n1, 1207823 |
lauwal01 | 9eceb02 | 2019-06-24 11:38:53 -0500 | [diff] [blame] | 449 | report_errata ERRATA_N1_1220197, neoverse_n1, 1220197 |
lauwal01 | 335b3c7 | 2019-06-24 11:42:02 -0500 | [diff] [blame] | 450 | report_errata ERRATA_N1_1257314, neoverse_n1, 1257314 |
lauwal01 | 411f495 | 2019-06-24 11:44:58 -0500 | [diff] [blame] | 451 | report_errata ERRATA_N1_1262606, neoverse_n1, 1262606 |
lauwal01 | 11c4837 | 2019-06-24 11:47:30 -0500 | [diff] [blame^] | 452 | report_errata ERRATA_N1_1262888, neoverse_n1, 1262888 |
Andre Przywara | 5f5d076 | 2019-05-20 14:57:06 +0100 | [diff] [blame] | 453 | report_errata ERRATA_N1_1315703, neoverse_n1, 1315703 |
Louis Mayencourt | bb2f077 | 2019-06-10 16:43:39 +0100 | [diff] [blame] | 454 | report_errata ERRATA_DSU_936184, neoverse_n1, dsu_936184 |
Dimitris Papastamos | 040b546 | 2018-03-26 16:46:01 +0100 | [diff] [blame] | 455 | |
| 456 | ldp x8, x30, [sp], #16 |
| 457 | ret |
John Tsichritzis | da6d75a | 2019-02-19 13:49:06 +0000 | [diff] [blame] | 458 | endfunc neoverse_n1_errata_report |
Dimitris Papastamos | 040b546 | 2018-03-26 16:46:01 +0100 | [diff] [blame] | 459 | #endif |
| 460 | |
Isla Mitchell | abbffe9 | 2017-08-03 16:04:46 +0100 | [diff] [blame] | 461 | /* --------------------------------------------- |
John Tsichritzis | da6d75a | 2019-02-19 13:49:06 +0000 | [diff] [blame] | 462 | * This function provides neoverse_n1 specific |
Isla Mitchell | abbffe9 | 2017-08-03 16:04:46 +0100 | [diff] [blame] | 463 | * register information for crash reporting. |
| 464 | * It needs to return with x6 pointing to |
| 465 | * a list of register names in ascii and |
| 466 | * x8 - x15 having values of registers to be |
| 467 | * reported. |
| 468 | * --------------------------------------------- |
| 469 | */ |
John Tsichritzis | da6d75a | 2019-02-19 13:49:06 +0000 | [diff] [blame] | 470 | .section .rodata.neoverse_n1_regs, "aS" |
| 471 | neoverse_n1_regs: /* The ascii list of register names to be reported */ |
Isla Mitchell | abbffe9 | 2017-08-03 16:04:46 +0100 | [diff] [blame] | 472 | .asciz "cpuectlr_el1", "" |
| 473 | |
John Tsichritzis | da6d75a | 2019-02-19 13:49:06 +0000 | [diff] [blame] | 474 | func neoverse_n1_cpu_reg_dump |
| 475 | adr x6, neoverse_n1_regs |
| 476 | mrs x8, NEOVERSE_N1_CPUECTLR_EL1 |
Isla Mitchell | abbffe9 | 2017-08-03 16:04:46 +0100 | [diff] [blame] | 477 | ret |
John Tsichritzis | da6d75a | 2019-02-19 13:49:06 +0000 | [diff] [blame] | 478 | endfunc neoverse_n1_cpu_reg_dump |
Isla Mitchell | abbffe9 | 2017-08-03 16:04:46 +0100 | [diff] [blame] | 479 | |
John Tsichritzis | da6d75a | 2019-02-19 13:49:06 +0000 | [diff] [blame] | 480 | declare_cpu_ops neoverse_n1, NEOVERSE_N1_MIDR, \ |
| 481 | neoverse_n1_reset_func, \ |
| 482 | neoverse_n1_core_pwr_dwn |