David Wang | 805c2c7 | 2016-11-09 16:29:02 +0000 | [diff] [blame] | 1 | /* |
Ambroise Vincent | 7927fa0 | 2019-02-21 16:20:43 +0000 | [diff] [blame^] | 2 | * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved. |
David Wang | 805c2c7 | 2016-11-09 16:29:02 +0000 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
David Wang | 805c2c7 | 2016-11-09 16:29:02 +0000 | [diff] [blame] | 7 | #include <arch.h> |
| 8 | #include <asm_macros.S> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 9 | #include <common/bl_common.h> |
Isla Mitchell | 9930501 | 2017-07-11 14:54:08 +0100 | [diff] [blame] | 10 | #include <cortex_a55.h> |
David Wang | 805c2c7 | 2016-11-09 16:29:02 +0000 | [diff] [blame] | 11 | #include <cpu_macros.S> |
| 12 | #include <plat_macros.S> |
| 13 | |
Ambroise Vincent | 7927fa0 | 2019-02-21 16:20:43 +0000 | [diff] [blame^] | 14 | /* -------------------------------------------------- |
| 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 | */ |
| 22 | func 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 |
| 33 | 1: |
| 34 | ret x17 |
| 35 | endfunc errata_a55_768277_wa |
| 36 | |
| 37 | func check_errata_768277 |
| 38 | mov x1, #0x00 |
| 39 | b cpu_rev_var_ls |
| 40 | endfunc check_errata_768277 |
| 41 | |
John Tsichritzis | 4daa1de | 2018-07-23 09:11:59 +0100 | [diff] [blame] | 42 | func cortex_a55_reset_func |
| 43 | mov x19, x30 |
Ambroise Vincent | 7927fa0 | 2019-02-21 16:20:43 +0000 | [diff] [blame^] | 44 | |
John Tsichritzis | 4daa1de | 2018-07-23 09:11:59 +0100 | [diff] [blame] | 45 | #if ERRATA_DSU_936184 |
| 46 | bl errata_dsu_936184_wa |
| 47 | #endif |
Ambroise Vincent | 7927fa0 | 2019-02-21 16:20:43 +0000 | [diff] [blame^] | 48 | |
| 49 | bl cpu_get_rev_var |
| 50 | mov x18, x0 |
| 51 | |
| 52 | #if ERRATA_A55_768277 |
| 53 | mov x0, x18 |
| 54 | bl errata_a55_768277_wa |
| 55 | #endif |
| 56 | |
John Tsichritzis | 4daa1de | 2018-07-23 09:11:59 +0100 | [diff] [blame] | 57 | ret x19 |
| 58 | endfunc cortex_a55_reset_func |
| 59 | |
David Wang | 805c2c7 | 2016-11-09 16:29:02 +0000 | [diff] [blame] | 60 | /* --------------------------------------------- |
| 61 | * HW will do the cache maintenance while powering down |
| 62 | * --------------------------------------------- |
| 63 | */ |
| 64 | func cortex_a55_core_pwr_dwn |
| 65 | /* --------------------------------------------- |
| 66 | * Enable CPU power down bit in power control register |
| 67 | * --------------------------------------------- |
| 68 | */ |
| 69 | mrs x0, CORTEX_A55_CPUPWRCTLR_EL1 |
| 70 | orr x0, x0, #CORTEX_A55_CORE_PWRDN_EN_MASK |
| 71 | msr CORTEX_A55_CPUPWRCTLR_EL1, x0 |
| 72 | isb |
| 73 | ret |
| 74 | endfunc cortex_a55_core_pwr_dwn |
| 75 | |
John Tsichritzis | 4daa1de | 2018-07-23 09:11:59 +0100 | [diff] [blame] | 76 | #if REPORT_ERRATA |
| 77 | /* |
| 78 | * Errata printing function for Cortex A55. Must follow AAPCS & can use stack. |
| 79 | */ |
| 80 | func cortex_a55_errata_report |
| 81 | stp x8, x30, [sp, #-16]! |
| 82 | bl cpu_get_rev_var |
| 83 | mov x8, x0 |
| 84 | |
| 85 | /* |
| 86 | * Report all errata. The revision variant information is at x8, where |
| 87 | * "report_errata" is expecting it and it doesn't corrupt it. |
| 88 | */ |
| 89 | report_errata ERRATA_DSU_936184, cortex_a55, dsu_936184 |
Ambroise Vincent | 7927fa0 | 2019-02-21 16:20:43 +0000 | [diff] [blame^] | 90 | report_errata ERRATA_A55_768277, cortex_a55, 768277 |
John Tsichritzis | 4daa1de | 2018-07-23 09:11:59 +0100 | [diff] [blame] | 91 | |
| 92 | ldp x8, x30, [sp], #16 |
| 93 | ret |
| 94 | endfunc cortex_a55_errata_report |
| 95 | #endif |
| 96 | |
David Wang | 805c2c7 | 2016-11-09 16:29:02 +0000 | [diff] [blame] | 97 | /* --------------------------------------------- |
| 98 | * This function provides cortex_a55 specific |
| 99 | * register information for crash reporting. |
| 100 | * It needs to return with x6 pointing to |
| 101 | * a list of register names in ascii and |
| 102 | * x8 - x15 having values of registers to be |
| 103 | * reported. |
| 104 | * --------------------------------------------- |
| 105 | */ |
| 106 | .section .rodata.cortex_a55_regs, "aS" |
| 107 | cortex_a55_regs: /* The ascii list of register names to be reported */ |
| 108 | .asciz "cpuectlr_el1", "" |
| 109 | |
| 110 | func cortex_a55_cpu_reg_dump |
| 111 | adr x6, cortex_a55_regs |
| 112 | mrs x8, CORTEX_A55_CPUECTLR_EL1 |
| 113 | ret |
| 114 | endfunc cortex_a55_cpu_reg_dump |
| 115 | |
| 116 | declare_cpu_ops cortex_a55, CORTEX_A55_MIDR, \ |
John Tsichritzis | 4daa1de | 2018-07-23 09:11:59 +0100 | [diff] [blame] | 117 | cortex_a55_reset_func, \ |
David Wang | 805c2c7 | 2016-11-09 16:29:02 +0000 | [diff] [blame] | 118 | cortex_a55_core_pwr_dwn |