14f6ad66aSAchin Gupta/* 2801cf93cSAntonio Nino Diaz * Copyright (c) 2013-2017, 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> 95f0cdb05SDan Handley#include <platform_def.h> 104f6ad66aSAchin Gupta 114f6ad66aSAchin Gupta .weak plat_report_exception 12c67b09bdSSoby Mathew .weak plat_crash_console_init 13c67b09bdSSoby Mathew .weak plat_crash_console_putc 14801cf93cSAntonio Nino Diaz .weak plat_crash_console_flush 1524fb838fSSoby Mathew .weak plat_reset_handler 16add40351SSoby Mathew .weak plat_disable_acp 17e3f67124SJuan Castillo .weak bl1_plat_prepare_exit 1840fc6cd1SJuan Castillo .weak plat_error_handler 191c3ea103SAntonio Nino Diaz .weak plat_panic_handler 20*01f62b6dSRoberto Vargas .weak bl2_plat_preload_setup 21*01f62b6dSRoberto Vargas .weak plat_try_next_boot_source 224f6ad66aSAchin Gupta 235c8babcdSSoby Mathew#if !ENABLE_PLAT_COMPAT 245c8babcdSSoby Mathew .globl platform_get_core_pos 255c8babcdSSoby Mathew 265c8babcdSSoby Mathew#define MPIDR_RES_BIT_MASK 0xff000000 275c8babcdSSoby Mathew 285c8babcdSSoby Mathew /* ------------------------------------------------------------------ 295c8babcdSSoby Mathew * int platform_get_core_pos(int mpidr) 305c8babcdSSoby Mathew * Returns the CPU index of the CPU specified by mpidr. This is 315c8babcdSSoby Mathew * defined when platform compatibility is disabled to enable Trusted 325c8babcdSSoby Mathew * Firmware components like SPD using the old platform API to work. 335c8babcdSSoby Mathew * This API is deprecated and it assumes that the mpidr specified is 345c8babcdSSoby Mathew * that of a valid and present CPU. Instead, plat_my_core_pos() 355c8babcdSSoby Mathew * should be used for CPU index of the current CPU and 365c8babcdSSoby Mathew * plat_core_pos_by_mpidr() should be used for CPU index of a 375c8babcdSSoby Mathew * CPU specified by its mpidr. 385c8babcdSSoby Mathew * ------------------------------------------------------------------ 395c8babcdSSoby Mathew */ 405c8babcdSSoby Mathewfunc_deprecated platform_get_core_pos 415c8babcdSSoby Mathew bic x0, x0, #MPIDR_RES_BIT_MASK 425c8babcdSSoby Mathew mrs x1, mpidr_el1 435c8babcdSSoby Mathew bic x1, x1, #MPIDR_RES_BIT_MASK 445c8babcdSSoby Mathew cmp x0, x1 455c8babcdSSoby Mathew beq plat_my_core_pos 465c8babcdSSoby Mathew b platform_core_pos_helper 475c8babcdSSoby Mathewendfunc_deprecated platform_get_core_pos 485c8babcdSSoby Mathew#endif 495c8babcdSSoby Mathew 504f6ad66aSAchin Gupta /* ----------------------------------------------------- 514f6ad66aSAchin Gupta * Placeholder function which should be redefined by 524f6ad66aSAchin Gupta * each platform. 534f6ad66aSAchin Gupta * ----------------------------------------------------- 544f6ad66aSAchin Gupta */ 550a30cf54SAndrew Thoelkefunc plat_report_exception 564f6ad66aSAchin Gupta ret 578b779620SKévin Petitendfunc plat_report_exception 58c67b09bdSSoby Mathew 59c67b09bdSSoby Mathew /* ----------------------------------------------------- 60c67b09bdSSoby Mathew * Placeholder function which should be redefined by 61c67b09bdSSoby Mathew * each platform. 62c67b09bdSSoby Mathew * ----------------------------------------------------- 63c67b09bdSSoby Mathew */ 64c67b09bdSSoby Mathewfunc plat_crash_console_init 65c67b09bdSSoby Mathew mov x0, #0 66c67b09bdSSoby Mathew ret 678b779620SKévin Petitendfunc plat_crash_console_init 68c67b09bdSSoby Mathew 69c67b09bdSSoby Mathew /* ----------------------------------------------------- 70c67b09bdSSoby Mathew * Placeholder function which should be redefined by 71c67b09bdSSoby Mathew * each platform. 72c67b09bdSSoby Mathew * ----------------------------------------------------- 73c67b09bdSSoby Mathew */ 74c67b09bdSSoby Mathewfunc plat_crash_console_putc 75c67b09bdSSoby Mathew ret 768b779620SKévin Petitendfunc plat_crash_console_putc 7724fb838fSSoby Mathew 7824fb838fSSoby Mathew /* ----------------------------------------------------- 7924fb838fSSoby Mathew * Placeholder function which should be redefined by 80801cf93cSAntonio Nino Diaz * each platform. 81801cf93cSAntonio Nino Diaz * ----------------------------------------------------- 82801cf93cSAntonio Nino Diaz */ 83801cf93cSAntonio Nino Diazfunc plat_crash_console_flush 84801cf93cSAntonio Nino Diaz ret 85801cf93cSAntonio Nino Diazendfunc plat_crash_console_flush 86801cf93cSAntonio Nino Diaz 87801cf93cSAntonio Nino Diaz /* ----------------------------------------------------- 88801cf93cSAntonio Nino Diaz * Placeholder function which should be redefined by 89240b3140SMasahiro Yamada * each platform. This function should preserve x19 - x29. 9024fb838fSSoby Mathew * ----------------------------------------------------- 9124fb838fSSoby Mathew */ 9224fb838fSSoby Mathewfunc plat_reset_handler 9324fb838fSSoby Mathew ret 948b779620SKévin Petitendfunc plat_reset_handler 95add40351SSoby Mathew 96add40351SSoby Mathew /* ----------------------------------------------------- 97add40351SSoby Mathew * Placeholder function which should be redefined by 98add40351SSoby Mathew * each platform. This function is allowed to use 99add40351SSoby Mathew * registers x0 - x17. 100add40351SSoby Mathew * ----------------------------------------------------- 101add40351SSoby Mathew */ 102add40351SSoby Mathewfunc plat_disable_acp 103add40351SSoby Mathew ret 1048b779620SKévin Petitendfunc plat_disable_acp 105e3f67124SJuan Castillo 106e3f67124SJuan Castillo /* ----------------------------------------------------- 107862b5dc2SSandrine Bailleux * void bl1_plat_prepare_exit(entry_point_info_t *ep_info); 108e3f67124SJuan Castillo * Called before exiting BL1. Default: do nothing 109e3f67124SJuan Castillo * ----------------------------------------------------- 110e3f67124SJuan Castillo */ 111e3f67124SJuan Castillofunc bl1_plat_prepare_exit 112e3f67124SJuan Castillo ret 113e3f67124SJuan Castilloendfunc bl1_plat_prepare_exit 11440fc6cd1SJuan Castillo 11540fc6cd1SJuan Castillo /* ----------------------------------------------------- 11640fc6cd1SJuan Castillo * void plat_error_handler(int err) __dead2; 11740fc6cd1SJuan Castillo * Endless loop by default. 11840fc6cd1SJuan Castillo * ----------------------------------------------------- 11940fc6cd1SJuan Castillo */ 12040fc6cd1SJuan Castillofunc plat_error_handler 1218c9e1af0SSandrine Bailleux wfi 12240fc6cd1SJuan Castillo b plat_error_handler 12340fc6cd1SJuan Castilloendfunc plat_error_handler 1241c3ea103SAntonio Nino Diaz 1251c3ea103SAntonio Nino Diaz /* ----------------------------------------------------- 1261c3ea103SAntonio Nino Diaz * void plat_panic_handler(void) __dead2; 1271c3ea103SAntonio Nino Diaz * Endless loop by default. 1281c3ea103SAntonio Nino Diaz * ----------------------------------------------------- 1291c3ea103SAntonio Nino Diaz */ 1301c3ea103SAntonio Nino Diazfunc plat_panic_handler 1318c9e1af0SSandrine Bailleux wfi 1321c3ea103SAntonio Nino Diaz b plat_panic_handler 1331c3ea103SAntonio Nino Diazendfunc plat_panic_handler 134*01f62b6dSRoberto Vargas 135*01f62b6dSRoberto Vargas /* ----------------------------------------------------- 136*01f62b6dSRoberto Vargas * Placeholder function which should be redefined by 137*01f62b6dSRoberto Vargas * each platfrom. 138*01f62b6dSRoberto Vargas * ----------------------------------------------------- 139*01f62b6dSRoberto Vargas */ 140*01f62b6dSRoberto Vargasfunc bl2_plat_preload_setup 141*01f62b6dSRoberto Vargas ret 142*01f62b6dSRoberto Vargasendfunc bl2_plat_preload_setup 143*01f62b6dSRoberto Vargas 144*01f62b6dSRoberto Vargas /* ----------------------------------------------------- 145*01f62b6dSRoberto Vargas * Placeholder function which should be redefined by 146*01f62b6dSRoberto Vargas * each platfrom. 147*01f62b6dSRoberto Vargas * ----------------------------------------------------- 148*01f62b6dSRoberto Vargas */ 149*01f62b6dSRoberto Vargasfunc plat_try_next_boot_source 150*01f62b6dSRoberto Vargas mov x0, #0 151*01f62b6dSRoberto Vargas ret 152*01f62b6dSRoberto Vargasendfunc plat_try_next_boot_source 153