Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 1 | /* |
Antonio Nino Diaz | d3ec543 | 2017-02-17 17:11:27 +0000 | [diff] [blame] | 2 | * Copyright (c) 2013-2017, 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> |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 9 | #include <platform_def.h> |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 10 | |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 11 | .weak plat_report_exception |
Soby Mathew | 066f713 | 2014-07-14 16:57:23 +0100 | [diff] [blame] | 12 | .weak plat_crash_console_init |
| 13 | .weak plat_crash_console_putc |
Antonio Nino Diaz | d3ec543 | 2017-02-17 17:11:27 +0000 | [diff] [blame] | 14 | .weak plat_crash_console_flush |
Soby Mathew | f1785fd | 2014-08-14 12:22:32 +0100 | [diff] [blame] | 15 | .weak plat_reset_handler |
Soby Mathew | 8e2f287 | 2014-08-14 12:49:05 +0100 | [diff] [blame] | 16 | .weak plat_disable_acp |
Juan Castillo | d1413b2 | 2015-10-05 16:59:38 +0100 | [diff] [blame] | 17 | .weak bl1_plat_prepare_exit |
Juan Castillo | 26ae583 | 2015-09-25 15:41:14 +0100 | [diff] [blame] | 18 | .weak plat_error_handler |
Antonio Nino Diaz | 1f21bcf | 2016-02-01 13:57:25 +0000 | [diff] [blame] | 19 | .weak plat_panic_handler |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 20 | |
Soby Mathew | 70716d6 | 2015-07-13 16:26:11 +0100 | [diff] [blame] | 21 | #if !ENABLE_PLAT_COMPAT |
| 22 | .globl platform_get_core_pos |
| 23 | |
| 24 | #define MPIDR_RES_BIT_MASK 0xff000000 |
| 25 | |
| 26 | /* ------------------------------------------------------------------ |
| 27 | * int platform_get_core_pos(int mpidr) |
| 28 | * Returns the CPU index of the CPU specified by mpidr. This is |
| 29 | * defined when platform compatibility is disabled to enable Trusted |
| 30 | * Firmware components like SPD using the old platform API to work. |
| 31 | * This API is deprecated and it assumes that the mpidr specified is |
| 32 | * that of a valid and present CPU. Instead, plat_my_core_pos() |
| 33 | * should be used for CPU index of the current CPU and |
| 34 | * plat_core_pos_by_mpidr() should be used for CPU index of a |
| 35 | * CPU specified by its mpidr. |
| 36 | * ------------------------------------------------------------------ |
| 37 | */ |
| 38 | func_deprecated platform_get_core_pos |
| 39 | bic x0, x0, #MPIDR_RES_BIT_MASK |
| 40 | mrs x1, mpidr_el1 |
| 41 | bic x1, x1, #MPIDR_RES_BIT_MASK |
| 42 | cmp x0, x1 |
| 43 | beq plat_my_core_pos |
| 44 | b platform_core_pos_helper |
| 45 | endfunc_deprecated platform_get_core_pos |
| 46 | #endif |
| 47 | |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 48 | /* ----------------------------------------------------- |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 49 | * Placeholder function which should be redefined by |
| 50 | * each platform. |
| 51 | * ----------------------------------------------------- |
| 52 | */ |
Andrew Thoelke | 38bde41 | 2014-03-18 13:46:55 +0000 | [diff] [blame] | 53 | func plat_report_exception |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 54 | ret |
Kévin Petit | a877c25 | 2015-03-24 14:03:57 +0000 | [diff] [blame] | 55 | endfunc plat_report_exception |
Soby Mathew | 066f713 | 2014-07-14 16:57:23 +0100 | [diff] [blame] | 56 | |
| 57 | /* ----------------------------------------------------- |
| 58 | * Placeholder function which should be redefined by |
| 59 | * each platform. |
| 60 | * ----------------------------------------------------- |
| 61 | */ |
| 62 | func plat_crash_console_init |
| 63 | mov x0, #0 |
| 64 | ret |
Kévin Petit | a877c25 | 2015-03-24 14:03:57 +0000 | [diff] [blame] | 65 | endfunc plat_crash_console_init |
Soby Mathew | 066f713 | 2014-07-14 16:57:23 +0100 | [diff] [blame] | 66 | |
| 67 | /* ----------------------------------------------------- |
| 68 | * Placeholder function which should be redefined by |
| 69 | * each platform. |
| 70 | * ----------------------------------------------------- |
| 71 | */ |
| 72 | func plat_crash_console_putc |
| 73 | ret |
Kévin Petit | a877c25 | 2015-03-24 14:03:57 +0000 | [diff] [blame] | 74 | endfunc plat_crash_console_putc |
Soby Mathew | f1785fd | 2014-08-14 12:22:32 +0100 | [diff] [blame] | 75 | |
| 76 | /* ----------------------------------------------------- |
| 77 | * Placeholder function which should be redefined by |
Antonio Nino Diaz | d3ec543 | 2017-02-17 17:11:27 +0000 | [diff] [blame] | 78 | * each platform. |
| 79 | * ----------------------------------------------------- |
| 80 | */ |
| 81 | func plat_crash_console_flush |
| 82 | ret |
| 83 | endfunc plat_crash_console_flush |
| 84 | |
| 85 | /* ----------------------------------------------------- |
| 86 | * Placeholder function which should be redefined by |
Masahiro Yamada | 4c165ca | 2016-09-24 18:07:46 +0900 | [diff] [blame] | 87 | * each platform. This function should preserve x19 - x29. |
Soby Mathew | f1785fd | 2014-08-14 12:22:32 +0100 | [diff] [blame] | 88 | * ----------------------------------------------------- |
| 89 | */ |
| 90 | func plat_reset_handler |
| 91 | ret |
Kévin Petit | a877c25 | 2015-03-24 14:03:57 +0000 | [diff] [blame] | 92 | endfunc plat_reset_handler |
Soby Mathew | 8e2f287 | 2014-08-14 12:49:05 +0100 | [diff] [blame] | 93 | |
| 94 | /* ----------------------------------------------------- |
| 95 | * Placeholder function which should be redefined by |
| 96 | * each platform. This function is allowed to use |
| 97 | * registers x0 - x17. |
| 98 | * ----------------------------------------------------- |
| 99 | */ |
| 100 | func plat_disable_acp |
| 101 | ret |
Kévin Petit | a877c25 | 2015-03-24 14:03:57 +0000 | [diff] [blame] | 102 | endfunc plat_disable_acp |
Juan Castillo | d1413b2 | 2015-10-05 16:59:38 +0100 | [diff] [blame] | 103 | |
| 104 | /* ----------------------------------------------------- |
Sandrine Bailleux | 87322b3 | 2015-11-10 15:01:57 +0000 | [diff] [blame] | 105 | * void bl1_plat_prepare_exit(entry_point_info_t *ep_info); |
Juan Castillo | d1413b2 | 2015-10-05 16:59:38 +0100 | [diff] [blame] | 106 | * Called before exiting BL1. Default: do nothing |
| 107 | * ----------------------------------------------------- |
| 108 | */ |
| 109 | func bl1_plat_prepare_exit |
| 110 | ret |
| 111 | endfunc bl1_plat_prepare_exit |
Juan Castillo | 26ae583 | 2015-09-25 15:41:14 +0100 | [diff] [blame] | 112 | |
| 113 | /* ----------------------------------------------------- |
| 114 | * void plat_error_handler(int err) __dead2; |
| 115 | * Endless loop by default. |
| 116 | * ----------------------------------------------------- |
| 117 | */ |
| 118 | func plat_error_handler |
Sandrine Bailleux | 628198b | 2016-08-18 09:24:40 +0100 | [diff] [blame] | 119 | wfi |
Juan Castillo | 26ae583 | 2015-09-25 15:41:14 +0100 | [diff] [blame] | 120 | b plat_error_handler |
| 121 | endfunc plat_error_handler |
Antonio Nino Diaz | 1f21bcf | 2016-02-01 13:57:25 +0000 | [diff] [blame] | 122 | |
| 123 | /* ----------------------------------------------------- |
| 124 | * void plat_panic_handler(void) __dead2; |
| 125 | * Endless loop by default. |
| 126 | * ----------------------------------------------------- |
| 127 | */ |
| 128 | func plat_panic_handler |
Sandrine Bailleux | 628198b | 2016-08-18 09:24:40 +0100 | [diff] [blame] | 129 | wfi |
Antonio Nino Diaz | 1f21bcf | 2016-02-01 13:57:25 +0000 | [diff] [blame] | 130 | b plat_panic_handler |
| 131 | endfunc plat_panic_handler |