Jens Wiklander | c288886 | 2014-08-04 15:39:58 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2014, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions are met: |
| 6 | * |
| 7 | * Redistributions of source code must retain the above copyright notice, this |
| 8 | * list of conditions and the following disclaimer. |
| 9 | * |
| 10 | * Redistributions in binary form must reproduce the above copyright notice, |
| 11 | * this list of conditions and the following disclaimer in the documentation |
| 12 | * and/or other materials provided with the distribution. |
| 13 | * |
| 14 | * Neither the name of ARM nor the names of its contributors may be used |
| 15 | * to endorse or promote products derived from this software without specific |
| 16 | * prior written permission. |
| 17 | * |
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 28 | * POSSIBILITY OF SUCH DAMAGE. |
| 29 | */ |
| 30 | |
| 31 | /* Copyright (c) 2014, Linaro Limited. All rights reserved. */ |
| 32 | |
| 33 | #ifndef TEESMC_OPTEED_H |
| 34 | #define TEESMC_OPTEED_H |
| 35 | |
| 36 | /* |
| 37 | * This file specify SMC function IDs used when returning from TEE to the |
| 38 | * secure monitor. |
| 39 | * |
| 40 | * All SMC Function IDs indicates SMC32 Calling Convention but will carry |
| 41 | * full 64 bit values in the argument registers if invoked from Aarch64 |
| 42 | * mode. This violates the SMC Calling Convention, but since this |
| 43 | * convention only coveres API towards Normwal World it's something that |
| 44 | * only concerns the OP-TEE Dispatcher in ARM Trusted Firmware and OP-TEE |
| 45 | * OS at Secure EL1. |
| 46 | */ |
| 47 | |
| 48 | /* |
| 49 | * Issued when returning from initial entry. |
| 50 | * |
| 51 | * Register usage: |
| 52 | * r0/x0 SMC Function ID, TEESMC_OPTEED_RETURN_ENTRY_DONE |
| 53 | * r1/x1 Pointer to entry vector |
| 54 | */ |
| 55 | #define TEESMC_OPTEED_FUNCID_RETURN_ENTRY_DONE 0 |
| 56 | #define TEESMC_OPTEED_RETURN_ENTRY_DONE \ |
| 57 | TEESMC_OPTEED_RV(TEESMC_OPTEED_FUNCID_RETURN_ENTRY_DONE) |
| 58 | |
| 59 | |
| 60 | |
| 61 | /* |
| 62 | * Issued when returning from "cpu_on" vector |
| 63 | * |
| 64 | * Register usage: |
| 65 | * r0/x0 SMC Function ID, TEESMC_OPTEED_RETURN_ON_DONE |
| 66 | * r1/x1 0 on success and anything else to indicate error condition |
| 67 | */ |
| 68 | #define TEESMC_OPTEED_FUNCID_RETURN_ON_DONE 1 |
| 69 | #define TEESMC_OPTEED_RETURN_ON_DONE \ |
| 70 | TEESMC_OPTEED_RV(TEESMC_OPTEED_FUNCID_RETURN_ON_DONE) |
| 71 | |
| 72 | /* |
| 73 | * Issued when returning from "cpu_off" vector |
| 74 | * |
| 75 | * Register usage: |
| 76 | * r0/x0 SMC Function ID, TEESMC_OPTEED_RETURN_OFF_DONE |
| 77 | * r1/x1 0 on success and anything else to indicate error condition |
| 78 | */ |
| 79 | #define TEESMC_OPTEED_FUNCID_RETURN_OFF_DONE 2 |
| 80 | #define TEESMC_OPTEED_RETURN_OFF_DONE \ |
| 81 | TEESMC_OPTEED_RV(TEESMC_OPTEED_FUNCID_RETURN_OFF_DONE) |
| 82 | |
| 83 | /* |
| 84 | * Issued when returning from "cpu_suspend" vector |
| 85 | * |
| 86 | * Register usage: |
| 87 | * r0/x0 SMC Function ID, TEESMC_OPTEED_RETURN_SUSPEND_DONE |
| 88 | * r1/x1 0 on success and anything else to indicate error condition |
| 89 | */ |
| 90 | #define TEESMC_OPTEED_FUNCID_RETURN_SUSPEND_DONE 3 |
| 91 | #define TEESMC_OPTEED_RETURN_SUSPEND_DONE \ |
| 92 | TEESMC_OPTEED_RV(TEESMC_OPTEED_FUNCID_RETURN_SUSPEND_DONE) |
| 93 | |
| 94 | /* |
| 95 | * Issued when returning from "cpu_resume" vector |
| 96 | * |
| 97 | * Register usage: |
| 98 | * r0/x0 SMC Function ID, TEESMC_OPTEED_RETURN_RESUME_DONE |
| 99 | * r1/x1 0 on success and anything else to indicate error condition |
| 100 | */ |
| 101 | #define TEESMC_OPTEED_FUNCID_RETURN_RESUME_DONE 4 |
| 102 | #define TEESMC_OPTEED_RETURN_RESUME_DONE \ |
| 103 | TEESMC_OPTEED_RV(TEESMC_OPTEED_FUNCID_RETURN_RESUME_DONE) |
| 104 | |
| 105 | /* |
| 106 | * Issued when returning from "std_smc" or "fast_smc" vector |
| 107 | * |
| 108 | * Register usage: |
| 109 | * r0/x0 SMC Function ID, TEESMC_OPTEED_RETURN_CALL_DONE |
| 110 | * r1-4/x1-4 Return value 0-3 which will passed to normal world in |
| 111 | * r0-3/x0-3 |
| 112 | */ |
| 113 | #define TEESMC_OPTEED_FUNCID_RETURN_CALL_DONE 5 |
| 114 | #define TEESMC_OPTEED_RETURN_CALL_DONE \ |
| 115 | TEESMC_OPTEED_RV(TEESMC_OPTEED_FUNCID_RETURN_CALL_DONE) |
| 116 | |
| 117 | /* |
| 118 | * Issued when returning from "fiq" vector |
| 119 | * |
| 120 | * Register usage: |
| 121 | * r0/x0 SMC Function ID, TEESMC_OPTEED_RETURN_FIQ_DONE |
| 122 | */ |
| 123 | #define TEESMC_OPTEED_FUNCID_RETURN_FIQ_DONE 6 |
| 124 | #define TEESMC_OPTEED_RETURN_FIQ_DONE \ |
| 125 | TEESMC_OPTEED_RV(TEESMC_OPTEED_FUNCID_RETURN_FIQ_DONE) |
| 126 | |
| 127 | /* |
| 128 | * Issued when returning from "system_off" vector |
| 129 | * |
| 130 | * Register usage: |
| 131 | * r0/x0 SMC Function ID, TEESMC_OPTEED_RETURN_SYSTEM_OFF_DONE |
| 132 | */ |
| 133 | #define TEESMC_OPTEED_FUNCID_RETURN_SYSTEM_OFF_DONE 7 |
| 134 | #define TEESMC_OPTEED_RETURN_SYSTEM_OFF_DONE \ |
| 135 | TEESMC_OPTEED_RV(TEESMC_OPTEED_FUNCID_RETURN_SYSTEM_OFF_DONE) |
| 136 | |
| 137 | /* |
| 138 | * Issued when returning from "system_reset" vector |
| 139 | * |
| 140 | * Register usage: |
| 141 | * r0/x0 SMC Function ID, TEESMC_OPTEED_RETURN_SYSTEM_RESET_DONE |
| 142 | */ |
| 143 | #define TEESMC_OPTEED_FUNCID_RETURN_SYSTEM_RESET_DONE 8 |
| 144 | #define TEESMC_OPTEED_RETURN_SYSTEM_RESET_DONE \ |
| 145 | TEESMC_OPTEED_RV(TEESMC_OPTEED_FUNCID_RETURN_SYSTEM_RESET_DONE) |
| 146 | |
| 147 | #endif /*TEESMC_OPTEED_H*/ |