1/* 2 * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7#include <arch.h> 8#include <asm_macros.S> 9#include <drivers/console.h> 10#include <platform_def.h> 11 12 .weak plat_report_exception 13#if !ERROR_DEPRECATED 14 .weak plat_crash_console_init 15 .weak plat_crash_console_putc 16 .weak plat_crash_console_flush 17#endif 18 .weak plat_reset_handler 19 .weak plat_disable_acp 20 .weak bl1_plat_prepare_exit 21 .weak plat_panic_handler 22 .weak bl31_plat_enable_mmu 23 .weak bl32_plat_enable_mmu 24 25 .weak plat_handle_uncontainable_ea 26 .weak plat_handle_double_fault 27 .weak plat_handle_el3_ea 28 29 .globl platform_get_core_pos 30 31#define MPIDR_RES_BIT_MASK 0xff000000 32 33 /* ----------------------------------------------------- 34 * Placeholder function which should be redefined by 35 * each platform. 36 * ----------------------------------------------------- 37 */ 38func plat_report_exception 39 ret 40endfunc plat_report_exception 41 42#if !ERROR_DEPRECATED 43func plat_crash_console_init 44 mov x0, #0 45 ret 46endfunc plat_crash_console_init 47 48func plat_crash_console_putc 49 ret 50endfunc plat_crash_console_putc 51 52func plat_crash_console_flush 53 ret 54endfunc plat_crash_console_flush 55#endif /* ERROR_DEPRECATED */ 56 57 /* ----------------------------------------------------- 58 * Placeholder function which should be redefined by 59 * each platform. This function should preserve x19 - x29. 60 * ----------------------------------------------------- 61 */ 62func plat_reset_handler 63 ret 64endfunc plat_reset_handler 65 66 /* ----------------------------------------------------- 67 * Placeholder function which should be redefined by 68 * each platform. This function is allowed to use 69 * registers x0 - x17. 70 * ----------------------------------------------------- 71 */ 72func plat_disable_acp 73 ret 74endfunc plat_disable_acp 75 76 /* ----------------------------------------------------- 77 * void bl1_plat_prepare_exit(entry_point_info_t *ep_info); 78 * Called before exiting BL1. Default: do nothing 79 * ----------------------------------------------------- 80 */ 81func bl1_plat_prepare_exit 82 ret 83endfunc bl1_plat_prepare_exit 84 85 /* ----------------------------------------------------- 86 * void plat_panic_handler(void) __dead2; 87 * Endless loop by default. 88 * ----------------------------------------------------- 89 */ 90func plat_panic_handler 91 wfi 92 b plat_panic_handler 93endfunc plat_panic_handler 94 95 /* ----------------------------------------------------- 96 * void bl31_plat_enable_mmu(uint32_t flags); 97 * 98 * Enable MMU in BL31. 99 * ----------------------------------------------------- 100 */ 101func bl31_plat_enable_mmu 102 b enable_mmu_direct_el3 103endfunc bl31_plat_enable_mmu 104 105 /* ----------------------------------------------------- 106 * void bl32_plat_enable_mmu(uint32_t flags); 107 * 108 * Enable MMU in BL32. 109 * ----------------------------------------------------- 110 */ 111func bl32_plat_enable_mmu 112 b enable_mmu_direct_el1 113endfunc bl32_plat_enable_mmu 114 115 116 /* ----------------------------------------------------- 117 * Platform handler for Uncontainable External Abort. 118 * 119 * x0: EA reason 120 * x1: EA syndrome 121 * ----------------------------------------------------- 122 */ 123func plat_handle_uncontainable_ea 124 b report_unhandled_exception 125endfunc plat_handle_uncontainable_ea 126 127 /* ----------------------------------------------------- 128 * Platform handler for Double Fault. 129 * 130 * x0: EA reason 131 * x1: EA syndrome 132 * ----------------------------------------------------- 133 */ 134func plat_handle_double_fault 135 b report_unhandled_exception 136endfunc plat_handle_double_fault 137 138 /* ----------------------------------------------------- 139 * Platform handler for EL3 External Abort. 140 * ----------------------------------------------------- 141 */ 142func plat_handle_el3_ea 143 b report_unhandled_exception 144endfunc plat_handle_el3_ea 145