Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 1 | /* |
Varun Wadekar | 9388afa | 2019-01-10 15:45:15 -0800 | [diff] [blame] | 2 | * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved. |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <arch.h> |
Andrew Thoelke | 38bde41 | 2014-03-18 13:46:55 +0000 | [diff] [blame] | 8 | #include <asm_macros.S> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 9 | #include <drivers/console.h> |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 10 | #include <platform_def.h> |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 11 | |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 12 | .weak plat_report_exception |
Antonio Nino Diaz | 6b0968e | 2018-10-17 16:49:26 +0100 | [diff] [blame] | 13 | #if !ERROR_DEPRECATED |
Soby Mathew | 066f713 | 2014-07-14 16:57:23 +0100 | [diff] [blame] | 14 | .weak plat_crash_console_init |
| 15 | .weak plat_crash_console_putc |
Antonio Nino Diaz | d3ec543 | 2017-02-17 17:11:27 +0000 | [diff] [blame] | 16 | .weak plat_crash_console_flush |
Antonio Nino Diaz | 6b0968e | 2018-10-17 16:49:26 +0100 | [diff] [blame] | 17 | #endif |
Soby Mathew | f1785fd | 2014-08-14 12:22:32 +0100 | [diff] [blame] | 18 | .weak plat_reset_handler |
Soby Mathew | 8e2f287 | 2014-08-14 12:49:05 +0100 | [diff] [blame] | 19 | .weak plat_disable_acp |
Juan Castillo | d1413b2 | 2015-10-05 16:59:38 +0100 | [diff] [blame] | 20 | .weak bl1_plat_prepare_exit |
Antonio Nino Diaz | 1f21bcf | 2016-02-01 13:57:25 +0000 | [diff] [blame] | 21 | .weak plat_panic_handler |
Jeenu Viswambharan | e834ee1 | 2018-04-27 15:17:03 +0100 | [diff] [blame] | 22 | .weak bl31_plat_enable_mmu |
| 23 | .weak bl32_plat_enable_mmu |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 24 | |
Jeenu Viswambharan | 9d4c9c1 | 2018-05-17 09:52:36 +0100 | [diff] [blame] | 25 | .weak plat_handle_uncontainable_ea |
Jeenu Viswambharan | 93bc4bd | 2018-05-17 11:24:01 +0100 | [diff] [blame] | 26 | .weak plat_handle_double_fault |
Jeenu Viswambharan | 911fcc9 | 2018-07-06 16:50:06 +0100 | [diff] [blame] | 27 | .weak plat_handle_el3_ea |
Jeenu Viswambharan | 9d4c9c1 | 2018-05-17 09:52:36 +0100 | [diff] [blame] | 28 | |
Soby Mathew | 70716d6 | 2015-07-13 16:26:11 +0100 | [diff] [blame] | 29 | #define MPIDR_RES_BIT_MASK 0xff000000 |
| 30 | |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 31 | /* ----------------------------------------------------- |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 32 | * Placeholder function which should be redefined by |
| 33 | * each platform. |
| 34 | * ----------------------------------------------------- |
| 35 | */ |
Andrew Thoelke | 38bde41 | 2014-03-18 13:46:55 +0000 | [diff] [blame] | 36 | func plat_report_exception |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 37 | ret |
Kévin Petit | a877c25 | 2015-03-24 14:03:57 +0000 | [diff] [blame] | 38 | endfunc plat_report_exception |
Soby Mathew | 066f713 | 2014-07-14 16:57:23 +0100 | [diff] [blame] | 39 | |
Antonio Nino Diaz | 6b0968e | 2018-10-17 16:49:26 +0100 | [diff] [blame] | 40 | #if !ERROR_DEPRECATED |
Soby Mathew | 066f713 | 2014-07-14 16:57:23 +0100 | [diff] [blame] | 41 | func plat_crash_console_init |
| 42 | mov x0, #0 |
| 43 | ret |
Kévin Petit | a877c25 | 2015-03-24 14:03:57 +0000 | [diff] [blame] | 44 | endfunc plat_crash_console_init |
Soby Mathew | 066f713 | 2014-07-14 16:57:23 +0100 | [diff] [blame] | 45 | |
Julius Werner | aae9bb1 | 2017-09-18 16:49:48 -0700 | [diff] [blame] | 46 | func plat_crash_console_putc |
| 47 | ret |
| 48 | endfunc plat_crash_console_putc |
| 49 | |
Antonio Nino Diaz | d3ec543 | 2017-02-17 17:11:27 +0000 | [diff] [blame] | 50 | func plat_crash_console_flush |
| 51 | ret |
| 52 | endfunc plat_crash_console_flush |
Antonio Nino Diaz | 6b0968e | 2018-10-17 16:49:26 +0100 | [diff] [blame] | 53 | #endif /* ERROR_DEPRECATED */ |
Antonio Nino Diaz | d3ec543 | 2017-02-17 17:11:27 +0000 | [diff] [blame] | 54 | |
| 55 | /* ----------------------------------------------------- |
| 56 | * Placeholder function which should be redefined by |
Masahiro Yamada | 4c165ca | 2016-09-24 18:07:46 +0900 | [diff] [blame] | 57 | * each platform. This function should preserve x19 - x29. |
Soby Mathew | f1785fd | 2014-08-14 12:22:32 +0100 | [diff] [blame] | 58 | * ----------------------------------------------------- |
| 59 | */ |
| 60 | func plat_reset_handler |
| 61 | ret |
Kévin Petit | a877c25 | 2015-03-24 14:03:57 +0000 | [diff] [blame] | 62 | endfunc plat_reset_handler |
Soby Mathew | 8e2f287 | 2014-08-14 12:49:05 +0100 | [diff] [blame] | 63 | |
| 64 | /* ----------------------------------------------------- |
| 65 | * Placeholder function which should be redefined by |
| 66 | * each platform. This function is allowed to use |
| 67 | * registers x0 - x17. |
| 68 | * ----------------------------------------------------- |
| 69 | */ |
| 70 | func plat_disable_acp |
| 71 | ret |
Kévin Petit | a877c25 | 2015-03-24 14:03:57 +0000 | [diff] [blame] | 72 | endfunc plat_disable_acp |
Juan Castillo | d1413b2 | 2015-10-05 16:59:38 +0100 | [diff] [blame] | 73 | |
| 74 | /* ----------------------------------------------------- |
Sandrine Bailleux | 87322b3 | 2015-11-10 15:01:57 +0000 | [diff] [blame] | 75 | * void bl1_plat_prepare_exit(entry_point_info_t *ep_info); |
Juan Castillo | d1413b2 | 2015-10-05 16:59:38 +0100 | [diff] [blame] | 76 | * Called before exiting BL1. Default: do nothing |
| 77 | * ----------------------------------------------------- |
| 78 | */ |
| 79 | func bl1_plat_prepare_exit |
| 80 | ret |
| 81 | endfunc bl1_plat_prepare_exit |
Juan Castillo | 26ae583 | 2015-09-25 15:41:14 +0100 | [diff] [blame] | 82 | |
| 83 | /* ----------------------------------------------------- |
Antonio Nino Diaz | 1f21bcf | 2016-02-01 13:57:25 +0000 | [diff] [blame] | 84 | * void plat_panic_handler(void) __dead2; |
| 85 | * Endless loop by default. |
| 86 | * ----------------------------------------------------- |
| 87 | */ |
| 88 | func plat_panic_handler |
Sandrine Bailleux | 628198b | 2016-08-18 09:24:40 +0100 | [diff] [blame] | 89 | wfi |
Antonio Nino Diaz | 1f21bcf | 2016-02-01 13:57:25 +0000 | [diff] [blame] | 90 | b plat_panic_handler |
| 91 | endfunc plat_panic_handler |
Jeenu Viswambharan | e834ee1 | 2018-04-27 15:17:03 +0100 | [diff] [blame] | 92 | |
| 93 | /* ----------------------------------------------------- |
| 94 | * void bl31_plat_enable_mmu(uint32_t flags); |
| 95 | * |
| 96 | * Enable MMU in BL31. |
| 97 | * ----------------------------------------------------- |
| 98 | */ |
| 99 | func bl31_plat_enable_mmu |
| 100 | b enable_mmu_direct_el3 |
| 101 | endfunc bl31_plat_enable_mmu |
| 102 | |
| 103 | /* ----------------------------------------------------- |
| 104 | * void bl32_plat_enable_mmu(uint32_t flags); |
| 105 | * |
| 106 | * Enable MMU in BL32. |
| 107 | * ----------------------------------------------------- |
| 108 | */ |
| 109 | func bl32_plat_enable_mmu |
| 110 | b enable_mmu_direct_el1 |
| 111 | endfunc bl32_plat_enable_mmu |
Jeenu Viswambharan | 9d4c9c1 | 2018-05-17 09:52:36 +0100 | [diff] [blame] | 112 | |
| 113 | |
| 114 | /* ----------------------------------------------------- |
| 115 | * Platform handler for Uncontainable External Abort. |
| 116 | * |
| 117 | * x0: EA reason |
| 118 | * x1: EA syndrome |
| 119 | * ----------------------------------------------------- |
| 120 | */ |
| 121 | func plat_handle_uncontainable_ea |
| 122 | b report_unhandled_exception |
| 123 | endfunc plat_handle_uncontainable_ea |
Jeenu Viswambharan | 93bc4bd | 2018-05-17 11:24:01 +0100 | [diff] [blame] | 124 | |
| 125 | /* ----------------------------------------------------- |
| 126 | * Platform handler for Double Fault. |
| 127 | * |
| 128 | * x0: EA reason |
| 129 | * x1: EA syndrome |
| 130 | * ----------------------------------------------------- |
| 131 | */ |
| 132 | func plat_handle_double_fault |
| 133 | b report_unhandled_exception |
| 134 | endfunc plat_handle_double_fault |
Jeenu Viswambharan | 911fcc9 | 2018-07-06 16:50:06 +0100 | [diff] [blame] | 135 | |
| 136 | /* ----------------------------------------------------- |
| 137 | * Platform handler for EL3 External Abort. |
| 138 | * ----------------------------------------------------- |
| 139 | */ |
| 140 | func plat_handle_el3_ea |
| 141 | b report_unhandled_exception |
| 142 | endfunc plat_handle_el3_ea |