14f6ad66aSAchin Gupta/* 2*e095ba34SVarun Wadekar * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved. 34f6ad66aSAchin Gupta * 482cb2c1aSdp-arm * SPDX-License-Identifier: BSD-3-Clause 54f6ad66aSAchin Gupta */ 64f6ad66aSAchin Gupta 74f6ad66aSAchin Gupta#include <arch.h> 80a30cf54SAndrew Thoelke#include <asm_macros.S> 909d40e0eSAntonio Nino Diaz#include <drivers/console.h> 105f0cdb05SDan Handley#include <platform_def.h> 114f6ad66aSAchin Gupta 124f6ad66aSAchin Gupta .weak plat_report_exception 1324fb838fSSoby Mathew .weak plat_reset_handler 14add40351SSoby Mathew .weak plat_disable_acp 15e3f67124SJuan Castillo .weak bl1_plat_prepare_exit 161c3ea103SAntonio Nino Diaz .weak plat_panic_handler 1764ee263eSJeenu Viswambharan .weak bl31_plat_enable_mmu 1864ee263eSJeenu Viswambharan .weak bl32_plat_enable_mmu 194f6ad66aSAchin Gupta 20b56dc2a9SJeenu Viswambharan .weak plat_handle_uncontainable_ea 21d5a23af5SJeenu Viswambharan .weak plat_handle_double_fault 22eaeaa4d0SJeenu Viswambharan .weak plat_handle_el3_ea 23b56dc2a9SJeenu Viswambharan 245c8babcdSSoby Mathew#define MPIDR_RES_BIT_MASK 0xff000000 255c8babcdSSoby Mathew 264f6ad66aSAchin Gupta /* ----------------------------------------------------- 274f6ad66aSAchin Gupta * Placeholder function which should be redefined by 284f6ad66aSAchin Gupta * each platform. 294f6ad66aSAchin Gupta * ----------------------------------------------------- 304f6ad66aSAchin Gupta */ 310a30cf54SAndrew Thoelkefunc plat_report_exception 324f6ad66aSAchin Gupta ret 338b779620SKévin Petitendfunc plat_report_exception 34c67b09bdSSoby Mathew 35801cf93cSAntonio Nino Diaz /* ----------------------------------------------------- 36801cf93cSAntonio Nino Diaz * Placeholder function which should be redefined by 37240b3140SMasahiro Yamada * each platform. This function should preserve x19 - x29. 3824fb838fSSoby Mathew * ----------------------------------------------------- 3924fb838fSSoby Mathew */ 4024fb838fSSoby Mathewfunc plat_reset_handler 4124fb838fSSoby Mathew ret 428b779620SKévin Petitendfunc plat_reset_handler 43add40351SSoby Mathew 44add40351SSoby Mathew /* ----------------------------------------------------- 45add40351SSoby Mathew * Placeholder function which should be redefined by 46add40351SSoby Mathew * each platform. This function is allowed to use 47add40351SSoby Mathew * registers x0 - x17. 48add40351SSoby Mathew * ----------------------------------------------------- 49add40351SSoby Mathew */ 50add40351SSoby Mathewfunc plat_disable_acp 51add40351SSoby Mathew ret 528b779620SKévin Petitendfunc plat_disable_acp 53e3f67124SJuan Castillo 54e3f67124SJuan Castillo /* ----------------------------------------------------- 55862b5dc2SSandrine Bailleux * void bl1_plat_prepare_exit(entry_point_info_t *ep_info); 56e3f67124SJuan Castillo * Called before exiting BL1. Default: do nothing 57e3f67124SJuan Castillo * ----------------------------------------------------- 58e3f67124SJuan Castillo */ 59e3f67124SJuan Castillofunc bl1_plat_prepare_exit 60e3f67124SJuan Castillo ret 61e3f67124SJuan Castilloendfunc bl1_plat_prepare_exit 6240fc6cd1SJuan Castillo 6340fc6cd1SJuan Castillo /* ----------------------------------------------------- 641c3ea103SAntonio Nino Diaz * void plat_panic_handler(void) __dead2; 651c3ea103SAntonio Nino Diaz * Endless loop by default. 661c3ea103SAntonio Nino Diaz * ----------------------------------------------------- 671c3ea103SAntonio Nino Diaz */ 681c3ea103SAntonio Nino Diazfunc plat_panic_handler 698c9e1af0SSandrine Bailleux wfi 701c3ea103SAntonio Nino Diaz b plat_panic_handler 711c3ea103SAntonio Nino Diazendfunc plat_panic_handler 7264ee263eSJeenu Viswambharan 7364ee263eSJeenu Viswambharan /* ----------------------------------------------------- 7464ee263eSJeenu Viswambharan * void bl31_plat_enable_mmu(uint32_t flags); 7564ee263eSJeenu Viswambharan * 7664ee263eSJeenu Viswambharan * Enable MMU in BL31. 7764ee263eSJeenu Viswambharan * ----------------------------------------------------- 7864ee263eSJeenu Viswambharan */ 7964ee263eSJeenu Viswambharanfunc bl31_plat_enable_mmu 8064ee263eSJeenu Viswambharan b enable_mmu_direct_el3 8164ee263eSJeenu Viswambharanendfunc bl31_plat_enable_mmu 8264ee263eSJeenu Viswambharan 8364ee263eSJeenu Viswambharan /* ----------------------------------------------------- 8464ee263eSJeenu Viswambharan * void bl32_plat_enable_mmu(uint32_t flags); 8564ee263eSJeenu Viswambharan * 8664ee263eSJeenu Viswambharan * Enable MMU in BL32. 8764ee263eSJeenu Viswambharan * ----------------------------------------------------- 8864ee263eSJeenu Viswambharan */ 8964ee263eSJeenu Viswambharanfunc bl32_plat_enable_mmu 9064ee263eSJeenu Viswambharan b enable_mmu_direct_el1 9164ee263eSJeenu Viswambharanendfunc bl32_plat_enable_mmu 92b56dc2a9SJeenu Viswambharan 93b56dc2a9SJeenu Viswambharan 94b56dc2a9SJeenu Viswambharan /* ----------------------------------------------------- 95b56dc2a9SJeenu Viswambharan * Platform handler for Uncontainable External Abort. 96b56dc2a9SJeenu Viswambharan * 97b56dc2a9SJeenu Viswambharan * x0: EA reason 98b56dc2a9SJeenu Viswambharan * x1: EA syndrome 99b56dc2a9SJeenu Viswambharan * ----------------------------------------------------- 100b56dc2a9SJeenu Viswambharan */ 101b56dc2a9SJeenu Viswambharanfunc plat_handle_uncontainable_ea 102b56dc2a9SJeenu Viswambharan b report_unhandled_exception 103b56dc2a9SJeenu Viswambharanendfunc plat_handle_uncontainable_ea 104d5a23af5SJeenu Viswambharan 105d5a23af5SJeenu Viswambharan /* ----------------------------------------------------- 106d5a23af5SJeenu Viswambharan * Platform handler for Double Fault. 107d5a23af5SJeenu Viswambharan * 108d5a23af5SJeenu Viswambharan * x0: EA reason 109d5a23af5SJeenu Viswambharan * x1: EA syndrome 110d5a23af5SJeenu Viswambharan * ----------------------------------------------------- 111d5a23af5SJeenu Viswambharan */ 112d5a23af5SJeenu Viswambharanfunc plat_handle_double_fault 113d5a23af5SJeenu Viswambharan b report_unhandled_exception 114d5a23af5SJeenu Viswambharanendfunc plat_handle_double_fault 115eaeaa4d0SJeenu Viswambharan 116eaeaa4d0SJeenu Viswambharan /* ----------------------------------------------------- 117eaeaa4d0SJeenu Viswambharan * Platform handler for EL3 External Abort. 118eaeaa4d0SJeenu Viswambharan * ----------------------------------------------------- 119eaeaa4d0SJeenu Viswambharan */ 120eaeaa4d0SJeenu Viswambharanfunc plat_handle_el3_ea 121eaeaa4d0SJeenu Viswambharan b report_unhandled_exception 122eaeaa4d0SJeenu Viswambharanendfunc plat_handle_el3_ea 123