1b04ea14bSJohn Tsichritzis/* 2da6d75a0SJohn Tsichritzis * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved. 3b04ea14bSJohn Tsichritzis * 4b04ea14bSJohn Tsichritzis * SPDX-License-Identifier: BSD-3-Clause 5b04ea14bSJohn Tsichritzis */ 6b04ea14bSJohn Tsichritzis 7b04ea14bSJohn Tsichritzis#include <arch.h> 8b04ea14bSJohn Tsichritzis#include <asm_macros.S> 9da6d75a0SJohn Tsichritzis#include <neoverse_n1.h> 10b04ea14bSJohn Tsichritzis#include <cpuamu.h> 11b04ea14bSJohn Tsichritzis#include <cpu_macros.S> 12b04ea14bSJohn Tsichritzis 13076b5f02SJohn Tsichritzis/* Hardware handled coherency */ 14076b5f02SJohn Tsichritzis#if HW_ASSISTED_COHERENCY == 0 15076b5f02SJohn Tsichritzis#error "Neoverse N1 must be compiled with HW_ASSISTED_COHERENCY enabled" 16076b5f02SJohn Tsichritzis#endif 17076b5f02SJohn Tsichritzis 18629d04f5SJohn Tsichritzis/* 64-bit only core */ 19629d04f5SJohn Tsichritzis#if CTX_INCLUDE_AARCH32_REGS == 1 20629d04f5SJohn Tsichritzis#error "Neoverse-N1 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0" 21629d04f5SJohn Tsichritzis#endif 22629d04f5SJohn Tsichritzis 23b04ea14bSJohn Tsichritzis/* -------------------------------------------------- 245f5d0763SAndre Przywara * Errata Workaround for Neoverse N1 Erratum 1043202. 25da6d75a0SJohn Tsichritzis * This applies to revision r0p0 and r1p0 of Neoverse N1. 26b04ea14bSJohn Tsichritzis * Inputs: 27b04ea14bSJohn Tsichritzis * x0: variant[4:7] and revision[0:3] of current cpu. 28b04ea14bSJohn Tsichritzis * Shall clobber: x0-x17 29b04ea14bSJohn Tsichritzis * -------------------------------------------------- 30b04ea14bSJohn Tsichritzis */ 31da6d75a0SJohn Tsichritzisfunc errata_n1_1043202_wa 32b04ea14bSJohn Tsichritzis /* Compare x0 against revision r1p0 */ 33b04ea14bSJohn Tsichritzis mov x17, x30 34b04ea14bSJohn Tsichritzis bl check_errata_1043202 35b04ea14bSJohn Tsichritzis cbz x0, 1f 36b04ea14bSJohn Tsichritzis 37b04ea14bSJohn Tsichritzis /* Apply instruction patching sequence */ 38b04ea14bSJohn Tsichritzis ldr x0, =0x0 39b04ea14bSJohn Tsichritzis msr CPUPSELR_EL3, x0 40b04ea14bSJohn Tsichritzis ldr x0, =0xF3BF8F2F 41b04ea14bSJohn Tsichritzis msr CPUPOR_EL3, x0 42b04ea14bSJohn Tsichritzis ldr x0, =0xFFFFFFFF 43b04ea14bSJohn Tsichritzis msr CPUPMR_EL3, x0 44b04ea14bSJohn Tsichritzis ldr x0, =0x800200071 45b04ea14bSJohn Tsichritzis msr CPUPCR_EL3, x0 46b04ea14bSJohn Tsichritzis isb 47b04ea14bSJohn Tsichritzis1: 48b04ea14bSJohn Tsichritzis ret x17 49da6d75a0SJohn Tsichritzisendfunc errata_n1_1043202_wa 50b04ea14bSJohn Tsichritzis 51b04ea14bSJohn Tsichritzisfunc check_errata_1043202 52b04ea14bSJohn Tsichritzis /* Applies to r0p0 and r1p0 */ 53b04ea14bSJohn Tsichritzis mov x1, #0x10 54b04ea14bSJohn Tsichritzis b cpu_rev_var_ls 55b04ea14bSJohn Tsichritzisendfunc check_errata_1043202 56b04ea14bSJohn Tsichritzis 57eca6e453SSami Mujawar/* -------------------------------------------------- 58eca6e453SSami Mujawar * Disable speculative loads if Neoverse N1 supports 59eca6e453SSami Mujawar * SSBS. 60eca6e453SSami Mujawar * 61eca6e453SSami Mujawar * Shall clobber: x0. 62eca6e453SSami Mujawar * -------------------------------------------------- 63eca6e453SSami Mujawar */ 64eca6e453SSami Mujawarfunc neoverse_n1_disable_speculative_loads 65eca6e453SSami Mujawar /* Check if the PE implements SSBS */ 66eca6e453SSami Mujawar mrs x0, id_aa64pfr1_el1 67eca6e453SSami Mujawar tst x0, #(ID_AA64PFR1_EL1_SSBS_MASK << ID_AA64PFR1_EL1_SSBS_SHIFT) 68eca6e453SSami Mujawar b.eq 1f 69eca6e453SSami Mujawar 70eca6e453SSami Mujawar /* Disable speculative loads */ 71eca6e453SSami Mujawar msr SSBS, xzr 72eca6e453SSami Mujawar isb 73eca6e453SSami Mujawar 74eca6e453SSami Mujawar1: 75eca6e453SSami Mujawar ret 76eca6e453SSami Mujawarendfunc neoverse_n1_disable_speculative_loads 77eca6e453SSami Mujawar 785f5d0763SAndre Przywara/* -------------------------------------------------- 79a601afe1Slauwal01 * Errata Workaround for Neoverse N1 Errata #1073348 80a601afe1Slauwal01 * This applies to revision r0p0 and r1p0 of Neoverse N1. 81a601afe1Slauwal01 * Inputs: 82a601afe1Slauwal01 * x0: variant[4:7] and revision[0:3] of current cpu. 83a601afe1Slauwal01 * Shall clobber: x0-x17 84a601afe1Slauwal01 * -------------------------------------------------- 85a601afe1Slauwal01 */ 86a601afe1Slauwal01func errata_n1_1073348_wa 87a601afe1Slauwal01 /* Compare x0 against revision r1p0 */ 88a601afe1Slauwal01 mov x17, x30 89a601afe1Slauwal01 bl check_errata_1073348 90a601afe1Slauwal01 cbz x0, 1f 91a601afe1Slauwal01 mrs x1, NEOVERSE_N1_CPUACTLR_EL1 92a601afe1Slauwal01 orr x1, x1, NEOVERSE_N1_CPUACTLR_EL1_BIT_6 93a601afe1Slauwal01 msr NEOVERSE_N1_CPUACTLR_EL1, x1 94a601afe1Slauwal01 isb 95a601afe1Slauwal011: 96a601afe1Slauwal01 ret x17 97a601afe1Slauwal01endfunc errata_n1_1073348_wa 98a601afe1Slauwal01 99a601afe1Slauwal01func check_errata_1073348 100a601afe1Slauwal01 /* Applies to r0p0 and r1p0 */ 101a601afe1Slauwal01 mov x1, #0x10 102a601afe1Slauwal01 b cpu_rev_var_ls 103a601afe1Slauwal01endfunc check_errata_1073348 104a601afe1Slauwal01 105a601afe1Slauwal01/* -------------------------------------------------- 106e34606f2Slauwal01 * Errata Workaround for Neoverse N1 Errata #1130799 107e34606f2Slauwal01 * This applies to revision <=r2p0 of Neoverse N1. 108e34606f2Slauwal01 * Inputs: 109e34606f2Slauwal01 * x0: variant[4:7] and revision[0:3] of current cpu. 110e34606f2Slauwal01 * Shall clobber: x0-x17 111e34606f2Slauwal01 * -------------------------------------------------- 112e34606f2Slauwal01 */ 113e34606f2Slauwal01func errata_n1_1130799_wa 114e34606f2Slauwal01 /* Compare x0 against revision r2p0 */ 115e34606f2Slauwal01 mov x17, x30 116e34606f2Slauwal01 bl check_errata_1130799 117e34606f2Slauwal01 cbz x0, 1f 118e34606f2Slauwal01 mrs x1, NEOVERSE_N1_CPUACTLR2_EL1 119e34606f2Slauwal01 orr x1, x1, NEOVERSE_N1_CPUACTLR2_EL1_BIT_59 120e34606f2Slauwal01 msr NEOVERSE_N1_CPUACTLR2_EL1, x1 121e34606f2Slauwal01 isb 122e34606f2Slauwal011: 123e34606f2Slauwal01 ret x17 124e34606f2Slauwal01endfunc errata_n1_1130799_wa 125e34606f2Slauwal01 126e34606f2Slauwal01func check_errata_1130799 127e34606f2Slauwal01 /* Applies to <=r2p0 */ 128e34606f2Slauwal01 mov x1, #0x20 129e34606f2Slauwal01 b cpu_rev_var_ls 130e34606f2Slauwal01endfunc check_errata_1130799 131e34606f2Slauwal01 132e34606f2Slauwal01/* -------------------------------------------------- 1332017ab24Slauwal01 * Errata Workaround for Neoverse N1 Errata #1165347 1342017ab24Slauwal01 * This applies to revision <=r2p0 of Neoverse N1. 1352017ab24Slauwal01 * Inputs: 1362017ab24Slauwal01 * x0: variant[4:7] and revision[0:3] of current cpu. 1372017ab24Slauwal01 * Shall clobber: x0-x17 1382017ab24Slauwal01 * -------------------------------------------------- 1392017ab24Slauwal01 */ 1402017ab24Slauwal01func errata_n1_1165347_wa 1412017ab24Slauwal01 /* Compare x0 against revision r2p0 */ 1422017ab24Slauwal01 mov x17, x30 1432017ab24Slauwal01 bl check_errata_1165347 1442017ab24Slauwal01 cbz x0, 1f 1452017ab24Slauwal01 mrs x1, NEOVERSE_N1_CPUACTLR2_EL1 1462017ab24Slauwal01 orr x1, x1, NEOVERSE_N1_CPUACTLR2_EL1_BIT_0 1472017ab24Slauwal01 orr x1, x1, NEOVERSE_N1_CPUACTLR2_EL1_BIT_15 1482017ab24Slauwal01 msr NEOVERSE_N1_CPUACTLR2_EL1, x1 1492017ab24Slauwal01 isb 1502017ab24Slauwal011: 1512017ab24Slauwal01 ret x17 1522017ab24Slauwal01endfunc errata_n1_1165347_wa 1532017ab24Slauwal01 1542017ab24Slauwal01func check_errata_1165347 1552017ab24Slauwal01 /* Applies to <=r2p0 */ 1562017ab24Slauwal01 mov x1, #0x20 1572017ab24Slauwal01 b cpu_rev_var_ls 1582017ab24Slauwal01endfunc check_errata_1165347 1592017ab24Slauwal01 1602017ab24Slauwal01/* -------------------------------------------------- 161ef5fa7d4Slauwal01 * Errata Workaround for Neoverse N1 Errata #1207823 162ef5fa7d4Slauwal01 * This applies to revision <=r2p0 of Neoverse N1. 163ef5fa7d4Slauwal01 * Inputs: 164ef5fa7d4Slauwal01 * x0: variant[4:7] and revision[0:3] of current cpu. 165ef5fa7d4Slauwal01 * Shall clobber: x0-x17 166ef5fa7d4Slauwal01 * -------------------------------------------------- 167ef5fa7d4Slauwal01 */ 168ef5fa7d4Slauwal01func errata_n1_1207823_wa 169ef5fa7d4Slauwal01 /* Compare x0 against revision r2p0 */ 170ef5fa7d4Slauwal01 mov x17, x30 171ef5fa7d4Slauwal01 bl check_errata_1207823 172ef5fa7d4Slauwal01 cbz x0, 1f 173ef5fa7d4Slauwal01 mrs x1, NEOVERSE_N1_CPUACTLR2_EL1 174ef5fa7d4Slauwal01 orr x1, x1, NEOVERSE_N1_CPUACTLR2_EL1_BIT_11 175ef5fa7d4Slauwal01 msr NEOVERSE_N1_CPUACTLR2_EL1, x1 176ef5fa7d4Slauwal01 isb 177ef5fa7d4Slauwal011: 178ef5fa7d4Slauwal01 ret x17 179ef5fa7d4Slauwal01endfunc errata_n1_1207823_wa 180ef5fa7d4Slauwal01 181ef5fa7d4Slauwal01func check_errata_1207823 182ef5fa7d4Slauwal01 /* Applies to <=r2p0 */ 183ef5fa7d4Slauwal01 mov x1, #0x20 184ef5fa7d4Slauwal01 b cpu_rev_var_ls 185ef5fa7d4Slauwal01endfunc check_errata_1207823 186ef5fa7d4Slauwal01 187ef5fa7d4Slauwal01/* -------------------------------------------------- 1889eceb020Slauwal01 * Errata Workaround for Neoverse N1 Errata #1220197 1899eceb020Slauwal01 * This applies to revision <=r2p0 of Neoverse N1. 1909eceb020Slauwal01 * Inputs: 1919eceb020Slauwal01 * x0: variant[4:7] and revision[0:3] of current cpu. 1929eceb020Slauwal01 * Shall clobber: x0-x17 1939eceb020Slauwal01 * -------------------------------------------------- 1949eceb020Slauwal01 */ 1959eceb020Slauwal01func errata_n1_1220197_wa 1969eceb020Slauwal01 /* Compare x0 against revision r2p0 */ 1979eceb020Slauwal01 mov x17, x30 1989eceb020Slauwal01 bl check_errata_1220197 1999eceb020Slauwal01 cbz x0, 1f 2009eceb020Slauwal01 mrs x1, NEOVERSE_N1_CPUECTLR_EL1 2019eceb020Slauwal01 orr x1, x1, NEOVERSE_N1_WS_THR_L2_MASK 2029eceb020Slauwal01 msr NEOVERSE_N1_CPUECTLR_EL1, x1 2039eceb020Slauwal01 isb 2049eceb020Slauwal011: 2059eceb020Slauwal01 ret x17 2069eceb020Slauwal01endfunc errata_n1_1220197_wa 2079eceb020Slauwal01 2089eceb020Slauwal01func check_errata_1220197 2099eceb020Slauwal01 /* Applies to <=r2p0 */ 2109eceb020Slauwal01 mov x1, #0x20 2119eceb020Slauwal01 b cpu_rev_var_ls 2129eceb020Slauwal01endfunc check_errata_1220197 2139eceb020Slauwal01 2149eceb020Slauwal01/* -------------------------------------------------- 215335b3c79Slauwal01 * Errata Workaround for Neoverse N1 Errata #1257314 216335b3c79Slauwal01 * This applies to revision <=r3p0 of Neoverse N1. 217335b3c79Slauwal01 * Inputs: 218335b3c79Slauwal01 * x0: variant[4:7] and revision[0:3] of current cpu. 219335b3c79Slauwal01 * Shall clobber: x0-x17 220335b3c79Slauwal01 * -------------------------------------------------- 221335b3c79Slauwal01 */ 222335b3c79Slauwal01func errata_n1_1257314_wa 223335b3c79Slauwal01 /* Compare x0 against revision r3p0 */ 224335b3c79Slauwal01 mov x17, x30 225335b3c79Slauwal01 bl check_errata_1257314 226335b3c79Slauwal01 cbz x0, 1f 227335b3c79Slauwal01 mrs x1, NEOVERSE_N1_CPUACTLR3_EL1 228335b3c79Slauwal01 orr x1, x1, NEOVERSE_N1_CPUACTLR3_EL1_BIT_10 229335b3c79Slauwal01 msr NEOVERSE_N1_CPUACTLR3_EL1, x1 230335b3c79Slauwal01 isb 231335b3c79Slauwal011: 232335b3c79Slauwal01 ret x17 233335b3c79Slauwal01endfunc errata_n1_1257314_wa 234335b3c79Slauwal01 235335b3c79Slauwal01func check_errata_1257314 236335b3c79Slauwal01 /* Applies to <=r3p0 */ 237335b3c79Slauwal01 mov x1, #0x30 238335b3c79Slauwal01 b cpu_rev_var_ls 239335b3c79Slauwal01endfunc check_errata_1257314 240335b3c79Slauwal01 241335b3c79Slauwal01/* -------------------------------------------------- 242411f4959Slauwal01 * Errata Workaround for Neoverse N1 Errata #1262606 243411f4959Slauwal01 * This applies to revision <=r3p0 of Neoverse N1. 244411f4959Slauwal01 * Inputs: 245411f4959Slauwal01 * x0: variant[4:7] and revision[0:3] of current cpu. 246411f4959Slauwal01 * Shall clobber: x0-x17 247411f4959Slauwal01 * -------------------------------------------------- 248411f4959Slauwal01 */ 249411f4959Slauwal01func errata_n1_1262606_wa 250411f4959Slauwal01 /* Compare x0 against revision r3p0 */ 251411f4959Slauwal01 mov x17, x30 252411f4959Slauwal01 bl check_errata_1262606 253411f4959Slauwal01 cbz x0, 1f 254411f4959Slauwal01 mrs x1, NEOVERSE_N1_CPUACTLR_EL1 255411f4959Slauwal01 orr x1, x1, NEOVERSE_N1_CPUACTLR_EL1_BIT_13 256411f4959Slauwal01 msr NEOVERSE_N1_CPUACTLR_EL1, x1 257411f4959Slauwal01 isb 258411f4959Slauwal011: 259411f4959Slauwal01 ret x17 260411f4959Slauwal01endfunc errata_n1_1262606_wa 261411f4959Slauwal01 262411f4959Slauwal01func check_errata_1262606 263411f4959Slauwal01 /* Applies to <=r3p0 */ 264411f4959Slauwal01 mov x1, #0x30 265411f4959Slauwal01 b cpu_rev_var_ls 266411f4959Slauwal01endfunc check_errata_1262606 267411f4959Slauwal01 268411f4959Slauwal01/* -------------------------------------------------- 269*11c48370Slauwal01 * Errata Workaround for Neoverse N1 Errata #1262888 270*11c48370Slauwal01 * This applies to revision <=r3p0 of Neoverse N1. 271*11c48370Slauwal01 * Inputs: 272*11c48370Slauwal01 * x0: variant[4:7] and revision[0:3] of current cpu. 273*11c48370Slauwal01 * Shall clobber: x0-x17 274*11c48370Slauwal01 * -------------------------------------------------- 275*11c48370Slauwal01 */ 276*11c48370Slauwal01func errata_n1_1262888_wa 277*11c48370Slauwal01 /* Compare x0 against revision r3p0 */ 278*11c48370Slauwal01 mov x17, x30 279*11c48370Slauwal01 bl check_errata_1262888 280*11c48370Slauwal01 cbz x0, 1f 281*11c48370Slauwal01 mrs x1, NEOVERSE_N1_CPUECTLR_EL1 282*11c48370Slauwal01 orr x1, x1, NEOVERSE_N1_CPUECTLR_EL1_MM_TLBPF_DIS_BIT 283*11c48370Slauwal01 msr NEOVERSE_N1_CPUECTLR_EL1, x1 284*11c48370Slauwal01 isb 285*11c48370Slauwal011: 286*11c48370Slauwal01 ret x17 287*11c48370Slauwal01endfunc errata_n1_1262888_wa 288*11c48370Slauwal01 289*11c48370Slauwal01func check_errata_1262888 290*11c48370Slauwal01 /* Applies to <=r3p0 */ 291*11c48370Slauwal01 mov x1, #0x30 292*11c48370Slauwal01 b cpu_rev_var_ls 293*11c48370Slauwal01endfunc check_errata_1262888 294*11c48370Slauwal01 295*11c48370Slauwal01/* -------------------------------------------------- 2965f5d0763SAndre Przywara * Errata Workaround for Neoverse N1 Erratum 1315703. 2975f5d0763SAndre Przywara * This applies to revision <= r3p0 of Neoverse N1. 2985f5d0763SAndre Przywara * Inputs: 2995f5d0763SAndre Przywara * x0: variant[4:7] and revision[0:3] of current cpu. 3005f5d0763SAndre Przywara * Shall clobber: x0-x17 3015f5d0763SAndre Przywara * -------------------------------------------------- 3025f5d0763SAndre Przywara */ 3035f5d0763SAndre Przywarafunc errata_n1_1315703_wa 3045f5d0763SAndre Przywara /* Compare x0 against revision r3p1 */ 3055f5d0763SAndre Przywara mov x17, x30 3065f5d0763SAndre Przywara bl check_errata_1315703 3075f5d0763SAndre Przywara cbz x0, 1f 3085f5d0763SAndre Przywara 3095f5d0763SAndre Przywara mrs x0, NEOVERSE_N1_CPUACTLR2_EL1 3105f5d0763SAndre Przywara orr x0, x0, #NEOVERSE_N1_CPUACTLR2_EL1_BIT_16 3115f5d0763SAndre Przywara msr NEOVERSE_N1_CPUACTLR2_EL1, x0 3125f5d0763SAndre Przywara isb 3135f5d0763SAndre Przywara 3145f5d0763SAndre Przywara1: 3155f5d0763SAndre Przywara ret x17 3165f5d0763SAndre Przywaraendfunc errata_n1_1315703_wa 3175f5d0763SAndre Przywara 3185f5d0763SAndre Przywarafunc check_errata_1315703 3195f5d0763SAndre Przywara /* Applies to everything <= r3p0. */ 3205f5d0763SAndre Przywara mov x1, #0x30 3215f5d0763SAndre Przywara b cpu_rev_var_ls 3225f5d0763SAndre Przywaraendfunc check_errata_1315703 3235f5d0763SAndre Przywara 324da6d75a0SJohn Tsichritzisfunc neoverse_n1_reset_func 325b04ea14bSJohn Tsichritzis mov x19, x30 3268074448fSJohn Tsichritzis 327eca6e453SSami Mujawar bl neoverse_n1_disable_speculative_loads 3288074448fSJohn Tsichritzis 329632ab3ebSLouis Mayencourt /* Forces all cacheable atomic instructions to be near */ 330632ab3ebSLouis Mayencourt mrs x0, NEOVERSE_N1_CPUACTLR2_EL1 331632ab3ebSLouis Mayencourt orr x0, x0, #NEOVERSE_N1_CPUACTLR2_EL1_BIT_2 332632ab3ebSLouis Mayencourt msr NEOVERSE_N1_CPUACTLR2_EL1, x0 333632ab3ebSLouis Mayencourt isb 334632ab3ebSLouis Mayencourt 335b04ea14bSJohn Tsichritzis bl cpu_get_rev_var 336b04ea14bSJohn Tsichritzis mov x18, x0 337b04ea14bSJohn Tsichritzis 338da6d75a0SJohn Tsichritzis#if ERRATA_N1_1043202 339b04ea14bSJohn Tsichritzis mov x0, x18 340da6d75a0SJohn Tsichritzis bl errata_n1_1043202_wa 341b04ea14bSJohn Tsichritzis#endif 342b04ea14bSJohn Tsichritzis 343a601afe1Slauwal01#if ERRATA_N1_1073348 344a601afe1Slauwal01 mov x0, x18 345a601afe1Slauwal01 bl errata_n1_1073348_wa 346a601afe1Slauwal01#endif 347a601afe1Slauwal01 348e34606f2Slauwal01#if ERRATA_N1_1130799 349e34606f2Slauwal01 mov x0, x18 350e34606f2Slauwal01 bl errata_n1_1130799_wa 351e34606f2Slauwal01#endif 352e34606f2Slauwal01 3532017ab24Slauwal01#if ERRATA_N1_1165347 3542017ab24Slauwal01 mov x0, x18 3552017ab24Slauwal01 bl errata_n1_1165347_wa 3562017ab24Slauwal01#endif 3572017ab24Slauwal01 358ef5fa7d4Slauwal01#if ERRATA_N1_1207823 359ef5fa7d4Slauwal01 mov x0, x18 360ef5fa7d4Slauwal01 bl errata_n1_1207823_wa 361ef5fa7d4Slauwal01#endif 362ef5fa7d4Slauwal01 3639eceb020Slauwal01#if ERRATA_N1_1220197 3649eceb020Slauwal01 mov x0, x18 3659eceb020Slauwal01 bl errata_n1_1220197_wa 3669eceb020Slauwal01#endif 3679eceb020Slauwal01 368335b3c79Slauwal01#if ERRATA_N1_1257314 369335b3c79Slauwal01 mov x0, x18 370335b3c79Slauwal01 bl errata_n1_1257314_wa 371335b3c79Slauwal01#endif 372335b3c79Slauwal01 373411f4959Slauwal01#if ERRATA_N1_1262606 374411f4959Slauwal01 mov x0, x18 375411f4959Slauwal01 bl errata_n1_1262606_wa 376411f4959Slauwal01#endif 377411f4959Slauwal01 378*11c48370Slauwal01#if ERRATA_N1_1262888 379*11c48370Slauwal01 mov x0, x18 380*11c48370Slauwal01 bl errata_n1_1262888_wa 381*11c48370Slauwal01#endif 382*11c48370Slauwal01 3835f5d0763SAndre Przywara#if ERRATA_N1_1315703 3845f5d0763SAndre Przywara mov x0, x18 3855f5d0763SAndre Przywara bl errata_n1_1315703_wa 3865f5d0763SAndre Przywara#endif 3875f5d0763SAndre Przywara 388b04ea14bSJohn Tsichritzis#if ENABLE_AMU 389b04ea14bSJohn Tsichritzis /* Make sure accesses from EL0/EL1 and EL2 are not trapped to EL3 */ 390b04ea14bSJohn Tsichritzis mrs x0, actlr_el3 391da6d75a0SJohn Tsichritzis orr x0, x0, #NEOVERSE_N1_ACTLR_AMEN_BIT 392b04ea14bSJohn Tsichritzis msr actlr_el3, x0 393b04ea14bSJohn Tsichritzis isb 394b04ea14bSJohn Tsichritzis 395b04ea14bSJohn Tsichritzis /* Make sure accesses from EL0/EL1 are not trapped to EL2 */ 396b04ea14bSJohn Tsichritzis mrs x0, actlr_el2 397da6d75a0SJohn Tsichritzis orr x0, x0, #NEOVERSE_N1_ACTLR_AMEN_BIT 398b04ea14bSJohn Tsichritzis msr actlr_el2, x0 399b04ea14bSJohn Tsichritzis isb 400b04ea14bSJohn Tsichritzis 401b04ea14bSJohn Tsichritzis /* Enable group0 counters */ 402da6d75a0SJohn Tsichritzis mov x0, #NEOVERSE_N1_AMU_GROUP0_MASK 403b04ea14bSJohn Tsichritzis msr CPUAMCNTENSET_EL0, x0 404b04ea14bSJohn Tsichritzis isb 405b04ea14bSJohn Tsichritzis#endif 406bb2f077aSLouis Mayencourt 407bb2f077aSLouis Mayencourt#if ERRATA_DSU_936184 408bb2f077aSLouis Mayencourt bl errata_dsu_936184_wa 409bb2f077aSLouis Mayencourt#endif 410bb2f077aSLouis Mayencourt 411b04ea14bSJohn Tsichritzis ret x19 412da6d75a0SJohn Tsichritzisendfunc neoverse_n1_reset_func 413b04ea14bSJohn Tsichritzis 414b04ea14bSJohn Tsichritzis /* --------------------------------------------- 415b04ea14bSJohn Tsichritzis * HW will do the cache maintenance while powering down 416b04ea14bSJohn Tsichritzis * --------------------------------------------- 417b04ea14bSJohn Tsichritzis */ 418da6d75a0SJohn Tsichritzisfunc neoverse_n1_core_pwr_dwn 419b04ea14bSJohn Tsichritzis /* --------------------------------------------- 420b04ea14bSJohn Tsichritzis * Enable CPU power down bit in power control register 421b04ea14bSJohn Tsichritzis * --------------------------------------------- 422b04ea14bSJohn Tsichritzis */ 423da6d75a0SJohn Tsichritzis mrs x0, NEOVERSE_N1_CPUPWRCTLR_EL1 424da6d75a0SJohn Tsichritzis orr x0, x0, #NEOVERSE_N1_CORE_PWRDN_EN_MASK 425da6d75a0SJohn Tsichritzis msr NEOVERSE_N1_CPUPWRCTLR_EL1, x0 426b04ea14bSJohn Tsichritzis isb 427b04ea14bSJohn Tsichritzis ret 428da6d75a0SJohn Tsichritzisendfunc neoverse_n1_core_pwr_dwn 429b04ea14bSJohn Tsichritzis 430b04ea14bSJohn Tsichritzis#if REPORT_ERRATA 431b04ea14bSJohn Tsichritzis/* 432da6d75a0SJohn Tsichritzis * Errata printing function for Neoverse N1. Must follow AAPCS. 433b04ea14bSJohn Tsichritzis */ 434da6d75a0SJohn Tsichritzisfunc neoverse_n1_errata_report 435b04ea14bSJohn Tsichritzis stp x8, x30, [sp, #-16]! 436b04ea14bSJohn Tsichritzis 437b04ea14bSJohn Tsichritzis bl cpu_get_rev_var 438b04ea14bSJohn Tsichritzis mov x8, x0 439b04ea14bSJohn Tsichritzis 440b04ea14bSJohn Tsichritzis /* 441b04ea14bSJohn Tsichritzis * Report all errata. The revision-variant information is passed to 442b04ea14bSJohn Tsichritzis * checking functions of each errata. 443b04ea14bSJohn Tsichritzis */ 444da6d75a0SJohn Tsichritzis report_errata ERRATA_N1_1043202, neoverse_n1, 1043202 445a601afe1Slauwal01 report_errata ERRATA_N1_1073348, neoverse_n1, 1073348 446e34606f2Slauwal01 report_errata ERRATA_N1_1130799, neoverse_n1, 1130799 4472017ab24Slauwal01 report_errata ERRATA_N1_1165347, neoverse_n1, 1165347 448ef5fa7d4Slauwal01 report_errata ERRATA_N1_1207823, neoverse_n1, 1207823 4499eceb020Slauwal01 report_errata ERRATA_N1_1220197, neoverse_n1, 1220197 450335b3c79Slauwal01 report_errata ERRATA_N1_1257314, neoverse_n1, 1257314 451411f4959Slauwal01 report_errata ERRATA_N1_1262606, neoverse_n1, 1262606 452*11c48370Slauwal01 report_errata ERRATA_N1_1262888, neoverse_n1, 1262888 4535f5d0763SAndre Przywara report_errata ERRATA_N1_1315703, neoverse_n1, 1315703 454bb2f077aSLouis Mayencourt report_errata ERRATA_DSU_936184, neoverse_n1, dsu_936184 455b04ea14bSJohn Tsichritzis 456b04ea14bSJohn Tsichritzis ldp x8, x30, [sp], #16 457b04ea14bSJohn Tsichritzis ret 458da6d75a0SJohn Tsichritzisendfunc neoverse_n1_errata_report 459b04ea14bSJohn Tsichritzis#endif 460b04ea14bSJohn Tsichritzis 461b04ea14bSJohn Tsichritzis /* --------------------------------------------- 462da6d75a0SJohn Tsichritzis * This function provides neoverse_n1 specific 463b04ea14bSJohn Tsichritzis * register information for crash reporting. 464b04ea14bSJohn Tsichritzis * It needs to return with x6 pointing to 465b04ea14bSJohn Tsichritzis * a list of register names in ascii and 466b04ea14bSJohn Tsichritzis * x8 - x15 having values of registers to be 467b04ea14bSJohn Tsichritzis * reported. 468b04ea14bSJohn Tsichritzis * --------------------------------------------- 469b04ea14bSJohn Tsichritzis */ 470da6d75a0SJohn Tsichritzis.section .rodata.neoverse_n1_regs, "aS" 471da6d75a0SJohn Tsichritzisneoverse_n1_regs: /* The ascii list of register names to be reported */ 472b04ea14bSJohn Tsichritzis .asciz "cpuectlr_el1", "" 473b04ea14bSJohn Tsichritzis 474da6d75a0SJohn Tsichritzisfunc neoverse_n1_cpu_reg_dump 475da6d75a0SJohn Tsichritzis adr x6, neoverse_n1_regs 476da6d75a0SJohn Tsichritzis mrs x8, NEOVERSE_N1_CPUECTLR_EL1 477b04ea14bSJohn Tsichritzis ret 478da6d75a0SJohn Tsichritzisendfunc neoverse_n1_cpu_reg_dump 479b04ea14bSJohn Tsichritzis 480da6d75a0SJohn Tsichritzisdeclare_cpu_ops neoverse_n1, NEOVERSE_N1_MIDR, \ 481da6d75a0SJohn Tsichritzis neoverse_n1_reset_func, \ 482da6d75a0SJohn Tsichritzis neoverse_n1_core_pwr_dwn 483