14f6ad66aSAchin Gupta/* 2*801cf93cSAntonio Nino Diaz * Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved. 34f6ad66aSAchin Gupta * 44f6ad66aSAchin Gupta * Redistribution and use in source and binary forms, with or without 54f6ad66aSAchin Gupta * modification, are permitted provided that the following conditions are met: 64f6ad66aSAchin Gupta * 74f6ad66aSAchin Gupta * Redistributions of source code must retain the above copyright notice, this 84f6ad66aSAchin Gupta * list of conditions and the following disclaimer. 94f6ad66aSAchin Gupta * 104f6ad66aSAchin Gupta * Redistributions in binary form must reproduce the above copyright notice, 114f6ad66aSAchin Gupta * this list of conditions and the following disclaimer in the documentation 124f6ad66aSAchin Gupta * and/or other materials provided with the distribution. 134f6ad66aSAchin Gupta * 144f6ad66aSAchin Gupta * Neither the name of ARM nor the names of its contributors may be used 154f6ad66aSAchin Gupta * to endorse or promote products derived from this software without specific 164f6ad66aSAchin Gupta * prior written permission. 174f6ad66aSAchin Gupta * 184f6ad66aSAchin Gupta * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 194f6ad66aSAchin Gupta * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 204f6ad66aSAchin Gupta * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 214f6ad66aSAchin Gupta * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 224f6ad66aSAchin Gupta * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 234f6ad66aSAchin Gupta * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 244f6ad66aSAchin Gupta * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 254f6ad66aSAchin Gupta * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 264f6ad66aSAchin Gupta * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 274f6ad66aSAchin Gupta * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 284f6ad66aSAchin Gupta * POSSIBILITY OF SUCH DAMAGE. 294f6ad66aSAchin Gupta */ 304f6ad66aSAchin Gupta 314f6ad66aSAchin Gupta#include <arch.h> 320a30cf54SAndrew Thoelke#include <asm_macros.S> 335f0cdb05SDan Handley#include <platform_def.h> 344f6ad66aSAchin Gupta 354f6ad66aSAchin Gupta .weak plat_report_exception 36c67b09bdSSoby Mathew .weak plat_crash_console_init 37c67b09bdSSoby Mathew .weak plat_crash_console_putc 38*801cf93cSAntonio Nino Diaz .weak plat_crash_console_flush 3924fb838fSSoby Mathew .weak plat_reset_handler 40add40351SSoby Mathew .weak plat_disable_acp 41e3f67124SJuan Castillo .weak bl1_plat_prepare_exit 4240fc6cd1SJuan Castillo .weak plat_error_handler 431c3ea103SAntonio Nino Diaz .weak plat_panic_handler 444f6ad66aSAchin Gupta 455c8babcdSSoby Mathew#if !ENABLE_PLAT_COMPAT 465c8babcdSSoby Mathew .globl platform_get_core_pos 475c8babcdSSoby Mathew 485c8babcdSSoby Mathew#define MPIDR_RES_BIT_MASK 0xff000000 495c8babcdSSoby Mathew 505c8babcdSSoby Mathew /* ------------------------------------------------------------------ 515c8babcdSSoby Mathew * int platform_get_core_pos(int mpidr) 525c8babcdSSoby Mathew * Returns the CPU index of the CPU specified by mpidr. This is 535c8babcdSSoby Mathew * defined when platform compatibility is disabled to enable Trusted 545c8babcdSSoby Mathew * Firmware components like SPD using the old platform API to work. 555c8babcdSSoby Mathew * This API is deprecated and it assumes that the mpidr specified is 565c8babcdSSoby Mathew * that of a valid and present CPU. Instead, plat_my_core_pos() 575c8babcdSSoby Mathew * should be used for CPU index of the current CPU and 585c8babcdSSoby Mathew * plat_core_pos_by_mpidr() should be used for CPU index of a 595c8babcdSSoby Mathew * CPU specified by its mpidr. 605c8babcdSSoby Mathew * ------------------------------------------------------------------ 615c8babcdSSoby Mathew */ 625c8babcdSSoby Mathewfunc_deprecated platform_get_core_pos 635c8babcdSSoby Mathew bic x0, x0, #MPIDR_RES_BIT_MASK 645c8babcdSSoby Mathew mrs x1, mpidr_el1 655c8babcdSSoby Mathew bic x1, x1, #MPIDR_RES_BIT_MASK 665c8babcdSSoby Mathew cmp x0, x1 675c8babcdSSoby Mathew beq plat_my_core_pos 685c8babcdSSoby Mathew b platform_core_pos_helper 695c8babcdSSoby Mathewendfunc_deprecated platform_get_core_pos 705c8babcdSSoby Mathew#endif 715c8babcdSSoby Mathew 724f6ad66aSAchin Gupta /* ----------------------------------------------------- 734f6ad66aSAchin Gupta * Placeholder function which should be redefined by 744f6ad66aSAchin Gupta * each platform. 754f6ad66aSAchin Gupta * ----------------------------------------------------- 764f6ad66aSAchin Gupta */ 770a30cf54SAndrew Thoelkefunc plat_report_exception 784f6ad66aSAchin Gupta ret 798b779620SKévin Petitendfunc plat_report_exception 80c67b09bdSSoby Mathew 81c67b09bdSSoby Mathew /* ----------------------------------------------------- 82c67b09bdSSoby Mathew * Placeholder function which should be redefined by 83c67b09bdSSoby Mathew * each platform. 84c67b09bdSSoby Mathew * ----------------------------------------------------- 85c67b09bdSSoby Mathew */ 86c67b09bdSSoby Mathewfunc plat_crash_console_init 87c67b09bdSSoby Mathew mov x0, #0 88c67b09bdSSoby Mathew ret 898b779620SKévin Petitendfunc plat_crash_console_init 90c67b09bdSSoby Mathew 91c67b09bdSSoby Mathew /* ----------------------------------------------------- 92c67b09bdSSoby Mathew * Placeholder function which should be redefined by 93c67b09bdSSoby Mathew * each platform. 94c67b09bdSSoby Mathew * ----------------------------------------------------- 95c67b09bdSSoby Mathew */ 96c67b09bdSSoby Mathewfunc plat_crash_console_putc 97c67b09bdSSoby Mathew ret 988b779620SKévin Petitendfunc plat_crash_console_putc 9924fb838fSSoby Mathew 10024fb838fSSoby Mathew /* ----------------------------------------------------- 10124fb838fSSoby Mathew * Placeholder function which should be redefined by 102*801cf93cSAntonio Nino Diaz * each platform. 103*801cf93cSAntonio Nino Diaz * ----------------------------------------------------- 104*801cf93cSAntonio Nino Diaz */ 105*801cf93cSAntonio Nino Diazfunc plat_crash_console_flush 106*801cf93cSAntonio Nino Diaz ret 107*801cf93cSAntonio Nino Diazendfunc plat_crash_console_flush 108*801cf93cSAntonio Nino Diaz 109*801cf93cSAntonio Nino Diaz /* ----------------------------------------------------- 110*801cf93cSAntonio Nino Diaz * Placeholder function which should be redefined by 111240b3140SMasahiro Yamada * each platform. This function should preserve x19 - x29. 11224fb838fSSoby Mathew * ----------------------------------------------------- 11324fb838fSSoby Mathew */ 11424fb838fSSoby Mathewfunc plat_reset_handler 11524fb838fSSoby Mathew ret 1168b779620SKévin Petitendfunc plat_reset_handler 117add40351SSoby Mathew 118add40351SSoby Mathew /* ----------------------------------------------------- 119add40351SSoby Mathew * Placeholder function which should be redefined by 120add40351SSoby Mathew * each platform. This function is allowed to use 121add40351SSoby Mathew * registers x0 - x17. 122add40351SSoby Mathew * ----------------------------------------------------- 123add40351SSoby Mathew */ 124add40351SSoby Mathewfunc plat_disable_acp 125add40351SSoby Mathew ret 1268b779620SKévin Petitendfunc plat_disable_acp 127e3f67124SJuan Castillo 128e3f67124SJuan Castillo /* ----------------------------------------------------- 129862b5dc2SSandrine Bailleux * void bl1_plat_prepare_exit(entry_point_info_t *ep_info); 130e3f67124SJuan Castillo * Called before exiting BL1. Default: do nothing 131e3f67124SJuan Castillo * ----------------------------------------------------- 132e3f67124SJuan Castillo */ 133e3f67124SJuan Castillofunc bl1_plat_prepare_exit 134e3f67124SJuan Castillo ret 135e3f67124SJuan Castilloendfunc bl1_plat_prepare_exit 13640fc6cd1SJuan Castillo 13740fc6cd1SJuan Castillo /* ----------------------------------------------------- 13840fc6cd1SJuan Castillo * void plat_error_handler(int err) __dead2; 13940fc6cd1SJuan Castillo * Endless loop by default. 14040fc6cd1SJuan Castillo * ----------------------------------------------------- 14140fc6cd1SJuan Castillo */ 14240fc6cd1SJuan Castillofunc plat_error_handler 1438c9e1af0SSandrine Bailleux wfi 14440fc6cd1SJuan Castillo b plat_error_handler 14540fc6cd1SJuan Castilloendfunc plat_error_handler 1461c3ea103SAntonio Nino Diaz 1471c3ea103SAntonio Nino Diaz /* ----------------------------------------------------- 1481c3ea103SAntonio Nino Diaz * void plat_panic_handler(void) __dead2; 1491c3ea103SAntonio Nino Diaz * Endless loop by default. 1501c3ea103SAntonio Nino Diaz * ----------------------------------------------------- 1511c3ea103SAntonio Nino Diaz */ 1521c3ea103SAntonio Nino Diazfunc plat_panic_handler 1538c9e1af0SSandrine Bailleux wfi 1541c3ea103SAntonio Nino Diaz b plat_panic_handler 1551c3ea103SAntonio Nino Diazendfunc plat_panic_handler 156