1/** @addtogroup FCI 2 * @{ 3 * @file 4 * FastCall declarations. 5 * 6 * Holds the functions for SIQ, YIELD and FastCall for switching to the secure world. 7 * <!-- Copyright Giesecke & Devrient GmbH 2009-2012 --> 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 3. The name of the author may not be used to endorse or promote 18 * products derived from this software without specific prior 19 * written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 22 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 25 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 27 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 30 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33#ifndef MCIFC_H_ 34#define MCIFC_H_ 35 36/** @name MobiCore FastCall Defines 37 * Defines for the two different FastCall's. 38 */ 39/** @{ */ 40 41// --- global ---- 42#define MC_FC_INVALID ((uint32_t) 0 ) /**< Invalid FastCall ID */ 43#define MC_FC_INIT ((uint32_t)(-1)) /**< Initializing FastCall. */ 44#define MC_FC_INFO ((uint32_t)(-2)) /**< Info FastCall. */ 45 46// following defines are currently frozen, so they will candidate for later big-change 47// --- sleep modes --- 48#define MC_FC_SLEEP ((uint32_t)(-3)) /**< enter power-sleep */ 49#define MC_FC_AFTR ((uint32_t)(-5)) /**< enter AFTR-sleep (called from core-0) */ 50// --- wake-up access --- 51#define MC_FC_CORE_X_WAKEUP ((uint32_t)(-4)) /**< wakeup/boot core-x (optional core-number in r1, not "0" ) */ 52#define MC_FC_C15_RESUME ((uint32_t)(-11)) /**< Write power control & diag registers */ 53#define MC_FC_CMD_SAVE ((uint32_t)(-6)) /**< Save core context to CP15 table(r1 is core number) */ 54#define MC_FC_CMD_SHUTDOWN ((uint32_t)(-7)) /**< Shutdown core(r1 is core number, cache flush is expected) */ 55// --- L2 cache access --- 56#define MC_FC_L2X0_CTRL ((uint32_t)(-21)) /**< Write to L2X0 control register */ 57#define MC_FC_L2X0_SETUP1 ((uint32_t)(-22)) /**< Setup L2X0 register - part 1 */ 58#define MC_FC_L2X0_SETUP2 ((uint32_t)(-23)) /**< Setup L2X0 register - part 2 */ 59#define MC_FC_L2X0_INVALL ((uint32_t)(-24)) /**< Invalidate all L2 cache */ 60#define MC_FC_L2X0_DEBUG ((uint32_t)(-25)) /**< Write L2X0 debug register */ 61// --- MEM traces --- 62#define MC_FC_MEM_TRACE ((uint32_t)(-31)) /**< Enable SWd tracing via memory */ 63// --- write access to CP15 regs --- 64#define MC_FC_CP15_REG ((uint32_t)(-101)) /**< general CP15/cache register update */ 65// --- store value in sDDRRAM --- 66#define MC_FC_STORE_BINFO ((uint32_t)(-201)) /**< write a 32bit value in secure DDRRAM in incremented art (max 2kB) */ 67 68#define MC_FC_MAX_ID ((uint32_t)(0xFFFF0000)) /**< Maximum allowed FastCall ID */ 69 70// r1 is requested status (0,1,2), on return r2 holds this status value 71 72/** @} */ 73 74/** @name MobiCore SMC Defines 75 * Defines the different secure monitor calls (SMC) for world switching. 76 * @{ */ 77#define MC_SMC_N_YIELD 0x3 /**< Yield to switch from NWd to SWd. */ 78#define MC_SMC_N_SIQ 0x4 /**< SIQ to switch from NWd to SWd. */ 79/** @} */ 80 81/** @name MobiCore status 82 * MobiCore status information. 83 * @{ */ 84#define MC_STATUS_NOT_INITIALIZED 0 /**< MobiCore is not yet initialized. FastCall FcInit() has to be used function to set up MobiCore.*/ 85#define MC_STATUS_BAD_INIT 1 /**< Bad parameters have been passed in FcInit(). */ 86#define MC_STATUS_INITIALIZED 2 /**< MobiCore did initialize properly. */ 87#define MC_STATUS_HALT 3 /**< MobiCore kernel halted due to an unrecoverable exception. Further information is available extended info */ 88/** @} */ 89 90/** @name Extended Info Identifiers 91 * Extended info parameters for MC_FC_INFO to obtain further information depending on MobiCore state. 92 * @{ */ 93#define MC_EXT_INFO_ID_MCI_VERSION 0 /**< Version of the MobiCore Control Interface (MCI) */ 94#define MC_EXT_INFO_ID_FLAGS 1 /**< MobiCore control flags */ 95#define MC_EXT_INFO_ID_HALT_CODE 2 /**< MobiCore halt condition code */ 96#define MC_EXT_INFO_ID_HALT_IP 3 /**< MobiCore halt condition instruction pointer */ 97#define MC_EXT_INFO_ID_FAULT_CNT 4 /**< MobiCore fault counter */ 98#define MC_EXT_INFO_ID_FAULT_CAUSE 5 /**< MobiCore last fault cause */ 99#define MC_EXT_INFO_ID_FAULT_META 6 /**< MobiCore last fault meta */ 100#define MC_EXT_INFO_ID_FAULT_THREAD 7 /**< MobiCore last fault threadid */ 101#define MC_EXT_INFO_ID_FAULT_IP 8 /**< MobiCore last fault instruction pointer */ 102#define MC_EXT_INFO_ID_FAULT_SP 9 /**< MobiCore last fault stack pointer */ 103#define MC_EXT_INFO_ID_FAULT_ARCH_DFSR 10 /**< MobiCore last fault ARM arch information */ 104#define MC_EXT_INFO_ID_FAULT_ARCH_ADFSR 11 /**< MobiCore last fault ARM arch information */ 105#define MC_EXT_INFO_ID_FAULT_ARCH_DFAR 12 /**< MobiCore last fault ARM arch information */ 106#define MC_EXT_INFO_ID_FAULT_ARCH_IFSR 13 /**< MobiCore last fault ARM arch information */ 107#define MC_EXT_INFO_ID_FAULT_ARCH_AIFSR 14 /**< MobiCore last fault ARM arch information */ 108#define MC_EXT_INFO_ID_FAULT_ARCH_IFAR 15 /**< MobiCore last fault ARM arch information */ 109#define MC_EXT_INFO_ID_MC_CONFIGURED 16 /**< MobiCore configured by Daemon via fc_init flag */ 110#define MC_EXT_INFO_ID_MC_SCHED_STATUS 17 /**< MobiCore scheduling status: idle/non-idle */ 111#define MC_EXT_INFO_ID_MC_STATUS 18 /**< MobiCore runtime status: initialized, halted */ 112#define MC_EXT_INFO_ID_MC_EXC_PARTNER 19 /**< MobiCore exception handler last partner */ 113#define MC_EXT_INFO_ID_MC_EXC_IPCPEER 20 /**< MobiCore exception handler last peer */ 114#define MC_EXT_INFO_ID_MC_EXC_IPCMSG 21 /**< MobiCore exception handler last IPC message */ 115#define MC_EXT_INFO_ID_MC_EXC_IPCDATA 22 /**< MobiCore exception handler last IPC data */ 116 117/** @} */ 118 119/** @name FastCall return values 120 * Return values of the MobiCore FastCalls. 121 * @{ */ 122#define MC_FC_RET_OK 0 /**< No error. Everything worked fine. */ 123#define MC_FC_RET_ERR_INVALID 1 /**< FastCall was not successful. */ 124#define MC_FC_RET_ERR_ALREADY_INITIALIZED 5 /**< MobiCore has already been initialized. */ 125/** @} */ 126 127#endif /** MCIFC_H_ */ 128 129/** @} */ 130