14e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park/** @addtogroup FCI 24e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * @{ 34e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * @file 44e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * FastCall declarations. 54e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * 64e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * Holds the functions for SIQ, YIELD and FastCall for switching to the secure world. 74e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * <!-- Copyright Giesecke & Devrient GmbH 2009-2012 --> 84e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * 94e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * Redistribution and use in source and binary forms, with or without 104e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * modification, are permitted provided that the following conditions 114e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * are met: 124e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * 1. Redistributions of source code must retain the above copyright 134e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * notice, this list of conditions and the following disclaimer. 144e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * 2. Redistributions in binary form must reproduce the above copyright 154e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * notice, this list of conditions and the following disclaimer in the 164e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * documentation and/or other materials provided with the distribution. 174e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * 3. The name of the author may not be used to endorse or promote 184e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * products derived from this software without specific prior 194e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * written permission. 204e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * 214e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 224e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 234e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 244e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 254e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 264e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 274e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 284e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 294e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 304e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 314e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 324e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park */ 334e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#ifndef MCIFC_H_ 344e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MCIFC_H_ 354e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park 364e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park/** @name MobiCore FastCall Defines 374e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * Defines for the two different FastCall's. 384e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park */ 394e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park/** @{ */ 404e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park 414e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park// --- global ---- 424e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_FC_INVALID ((uint32_t) 0 ) /**< Invalid FastCall ID */ 434e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_FC_INIT ((uint32_t)(-1)) /**< Initializing FastCall. */ 444e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_FC_INFO ((uint32_t)(-2)) /**< Info FastCall. */ 454e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park 464e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park// following defines are currently frozen, so they will candidate for later big-change 474e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park// --- sleep modes --- 484e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_FC_SLEEP ((uint32_t)(-3)) /**< enter power-sleep */ 494e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_FC_AFTR ((uint32_t)(-5)) /**< enter AFTR-sleep (called from core-0) */ 504e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park// --- wake-up access --- 514e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_FC_CORE_X_WAKEUP ((uint32_t)(-4)) /**< wakeup/boot core-x (optional core-number in r1, not "0" ) */ 524e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_FC_C15_RESUME ((uint32_t)(-11)) /**< Write power control & diag registers */ 534e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_FC_CMD_SAVE ((uint32_t)(-6)) /**< Save core context to CP15 table(r1 is core number) */ 544e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_FC_CMD_SHUTDOWN ((uint32_t)(-7)) /**< Shutdown core(r1 is core number, cache flush is expected) */ 554e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park// --- L2 cache access --- 564e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_FC_L2X0_CTRL ((uint32_t)(-21)) /**< Write to L2X0 control register */ 574e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_FC_L2X0_SETUP1 ((uint32_t)(-22)) /**< Setup L2X0 register - part 1 */ 584e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_FC_L2X0_SETUP2 ((uint32_t)(-23)) /**< Setup L2X0 register - part 2 */ 594e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_FC_L2X0_INVALL ((uint32_t)(-24)) /**< Invalidate all L2 cache */ 604e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_FC_L2X0_DEBUG ((uint32_t)(-25)) /**< Write L2X0 debug register */ 614e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park// --- MEM traces --- 624e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_FC_MEM_TRACE ((uint32_t)(-31)) /**< Enable SWd tracing via memory */ 634e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park// --- write access to CP15 regs --- 644e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_FC_CP15_REG ((uint32_t)(-101)) /**< general CP15/cache register update */ 654e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park// --- store value in sDDRRAM --- 664e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_FC_STORE_BINFO ((uint32_t)(-201)) /**< write a 32bit value in secure DDRRAM in incremented art (max 2kB) */ 674e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park 684e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_FC_MAX_ID ((uint32_t)(0xFFFF0000)) /**< Maximum allowed FastCall ID */ 694e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park 704e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park// r1 is requested status (0,1,2), on return r2 holds this status value 714e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park 724e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park/** @} */ 734e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park 744e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park/** @name MobiCore SMC Defines 754e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * Defines the different secure monitor calls (SMC) for world switching. 764e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * @{ */ 774e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_SMC_N_YIELD 0x3 /**< Yield to switch from NWd to SWd. */ 784e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_SMC_N_SIQ 0x4 /**< SIQ to switch from NWd to SWd. */ 794e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park/** @} */ 804e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park 814e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park/** @name MobiCore status 824e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * MobiCore status information. 834e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * @{ */ 844e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_STATUS_NOT_INITIALIZED 0 /**< MobiCore is not yet initialized. FastCall FcInit() has to be used function to set up MobiCore.*/ 854e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_STATUS_BAD_INIT 1 /**< Bad parameters have been passed in FcInit(). */ 864e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_STATUS_INITIALIZED 2 /**< MobiCore did initialize properly. */ 874e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_STATUS_HALT 3 /**< MobiCore kernel halted due to an unrecoverable exception. Further information is available extended info */ 884e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park/** @} */ 894e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park 904e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park/** @name Extended Info Identifiers 914e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * Extended info parameters for MC_FC_INFO to obtain further information depending on MobiCore state. 924e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * @{ */ 934e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_EXT_INFO_ID_MCI_VERSION 0 /**< Version of the MobiCore Control Interface (MCI) */ 944e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_EXT_INFO_ID_FLAGS 1 /**< MobiCore control flags */ 954e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_EXT_INFO_ID_HALT_CODE 2 /**< MobiCore halt condition code */ 964e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_EXT_INFO_ID_HALT_IP 3 /**< MobiCore halt condition instruction pointer */ 974e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_EXT_INFO_ID_FAULT_CNT 4 /**< MobiCore fault counter */ 984e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_EXT_INFO_ID_FAULT_CAUSE 5 /**< MobiCore last fault cause */ 994e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_EXT_INFO_ID_FAULT_META 6 /**< MobiCore last fault meta */ 1004e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_EXT_INFO_ID_FAULT_THREAD 7 /**< MobiCore last fault threadid */ 1014e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_EXT_INFO_ID_FAULT_IP 8 /**< MobiCore last fault instruction pointer */ 1024e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_EXT_INFO_ID_FAULT_SP 9 /**< MobiCore last fault stack pointer */ 1034e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_EXT_INFO_ID_FAULT_ARCH_DFSR 10 /**< MobiCore last fault ARM arch information */ 1044e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_EXT_INFO_ID_FAULT_ARCH_ADFSR 11 /**< MobiCore last fault ARM arch information */ 1054e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_EXT_INFO_ID_FAULT_ARCH_DFAR 12 /**< MobiCore last fault ARM arch information */ 1064e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_EXT_INFO_ID_FAULT_ARCH_IFSR 13 /**< MobiCore last fault ARM arch information */ 1074e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_EXT_INFO_ID_FAULT_ARCH_AIFSR 14 /**< MobiCore last fault ARM arch information */ 1084e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_EXT_INFO_ID_FAULT_ARCH_IFAR 15 /**< MobiCore last fault ARM arch information */ 1094e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_EXT_INFO_ID_MC_CONFIGURED 16 /**< MobiCore configured by Daemon via fc_init flag */ 1104e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_EXT_INFO_ID_MC_SCHED_STATUS 17 /**< MobiCore scheduling status: idle/non-idle */ 1114e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_EXT_INFO_ID_MC_STATUS 18 /**< MobiCore runtime status: initialized, halted */ 1124e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_EXT_INFO_ID_MC_EXC_PARTNER 19 /**< MobiCore exception handler last partner */ 1134e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_EXT_INFO_ID_MC_EXC_IPCPEER 20 /**< MobiCore exception handler last peer */ 1144e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_EXT_INFO_ID_MC_EXC_IPCMSG 21 /**< MobiCore exception handler last IPC message */ 1154e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_EXT_INFO_ID_MC_EXC_IPCDATA 22 /**< MobiCore exception handler last IPC data */ 1164e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park 1174e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park/** @} */ 1184e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park 1194e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park/** @name FastCall return values 1204e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * Return values of the MobiCore FastCalls. 1214e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park * @{ */ 1224e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_FC_RET_OK 0 /**< No error. Everything worked fine. */ 1234e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_FC_RET_ERR_INVALID 1 /**< FastCall was not successful. */ 1244e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#define MC_FC_RET_ERR_ALREADY_INITIALIZED 5 /**< MobiCore has already been initialized. */ 1254e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park/** @} */ 1264e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park 1274e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park#endif /** MCIFC_H_ */ 1284e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park 1294e9e8c9c0169b40318386436d762c3d73cf4c328DongJin Park/** @} */ 130