• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2014-2019, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 /* Copyright (c) 2014, Linaro Limited. All rights reserved. */
8 
9 #ifndef TEESMC_OPTEED_H
10 #define TEESMC_OPTEED_H
11 
12 /*
13  * This file specifies SMC function IDs used when returning from TEE to the
14  * secure monitor.
15  *
16  * All SMC Function IDs indicates SMC32 Calling Convention but will carry
17  * full 64 bit values in the argument registers if invoked from Aarch64
18  * mode. This violates the SMC Calling Convention, but since this
19  * convention only coveres API towards Normal World it's something that
20  * only concerns the OP-TEE Dispatcher in Trusted Firmware-A and OP-TEE
21  * OS at Secure EL1.
22  */
23 
24 /*
25  * Issued when returning from initial entry.
26  *
27  * Register usage:
28  * r0/x0	SMC Function ID, TEESMC_OPTEED_RETURN_ENTRY_DONE
29  * r1/x1	Pointer to entry vector
30  */
31 #define TEESMC_OPTEED_FUNCID_RETURN_ENTRY_DONE		0
32 #define TEESMC_OPTEED_RETURN_ENTRY_DONE \
33 	TEESMC_OPTEED_RV(TEESMC_OPTEED_FUNCID_RETURN_ENTRY_DONE)
34 
35 
36 
37 /*
38  * Issued when returning from "cpu_on" vector
39  *
40  * Register usage:
41  * r0/x0	SMC Function ID, TEESMC_OPTEED_RETURN_ON_DONE
42  * r1/x1	0 on success and anything else to indicate error condition
43  */
44 #define TEESMC_OPTEED_FUNCID_RETURN_ON_DONE		1
45 #define TEESMC_OPTEED_RETURN_ON_DONE \
46 	TEESMC_OPTEED_RV(TEESMC_OPTEED_FUNCID_RETURN_ON_DONE)
47 
48 /*
49  * Issued when returning from "cpu_off" vector
50  *
51  * Register usage:
52  * r0/x0	SMC Function ID, TEESMC_OPTEED_RETURN_OFF_DONE
53  * r1/x1	0 on success and anything else to indicate error condition
54  */
55 #define TEESMC_OPTEED_FUNCID_RETURN_OFF_DONE		2
56 #define TEESMC_OPTEED_RETURN_OFF_DONE \
57 	TEESMC_OPTEED_RV(TEESMC_OPTEED_FUNCID_RETURN_OFF_DONE)
58 
59 /*
60  * Issued when returning from "cpu_suspend" vector
61  *
62  * Register usage:
63  * r0/x0	SMC Function ID, TEESMC_OPTEED_RETURN_SUSPEND_DONE
64  * r1/x1	0 on success and anything else to indicate error condition
65  */
66 #define TEESMC_OPTEED_FUNCID_RETURN_SUSPEND_DONE	3
67 #define TEESMC_OPTEED_RETURN_SUSPEND_DONE \
68 	TEESMC_OPTEED_RV(TEESMC_OPTEED_FUNCID_RETURN_SUSPEND_DONE)
69 
70 /*
71  * Issued when returning from "cpu_resume" vector
72  *
73  * Register usage:
74  * r0/x0	SMC Function ID, TEESMC_OPTEED_RETURN_RESUME_DONE
75  * r1/x1	0 on success and anything else to indicate error condition
76  */
77 #define TEESMC_OPTEED_FUNCID_RETURN_RESUME_DONE		4
78 #define TEESMC_OPTEED_RETURN_RESUME_DONE \
79 	TEESMC_OPTEED_RV(TEESMC_OPTEED_FUNCID_RETURN_RESUME_DONE)
80 
81 /*
82  * Issued when returning from "std_smc" or "fast_smc" vector
83  *
84  * Register usage:
85  * r0/x0	SMC Function ID, TEESMC_OPTEED_RETURN_CALL_DONE
86  * r1-4/x1-4	Return value 0-3 which will passed to normal world in
87  *		r0-3/x0-3
88  */
89 #define TEESMC_OPTEED_FUNCID_RETURN_CALL_DONE		5
90 #define TEESMC_OPTEED_RETURN_CALL_DONE \
91 	TEESMC_OPTEED_RV(TEESMC_OPTEED_FUNCID_RETURN_CALL_DONE)
92 
93 /*
94  * Issued when returning from "fiq" vector
95  *
96  * Register usage:
97  * r0/x0	SMC Function ID, TEESMC_OPTEED_RETURN_FIQ_DONE
98  */
99 #define TEESMC_OPTEED_FUNCID_RETURN_FIQ_DONE		6
100 #define TEESMC_OPTEED_RETURN_FIQ_DONE \
101 	TEESMC_OPTEED_RV(TEESMC_OPTEED_FUNCID_RETURN_FIQ_DONE)
102 
103 /*
104  * Issued when returning from "system_off" vector
105  *
106  * Register usage:
107  * r0/x0	SMC Function ID, TEESMC_OPTEED_RETURN_SYSTEM_OFF_DONE
108  */
109 #define TEESMC_OPTEED_FUNCID_RETURN_SYSTEM_OFF_DONE	7
110 #define TEESMC_OPTEED_RETURN_SYSTEM_OFF_DONE \
111 	TEESMC_OPTEED_RV(TEESMC_OPTEED_FUNCID_RETURN_SYSTEM_OFF_DONE)
112 
113 /*
114  * Issued when returning from "system_reset" vector
115  *
116  * Register usage:
117  * r0/x0	SMC Function ID, TEESMC_OPTEED_RETURN_SYSTEM_RESET_DONE
118  */
119 #define TEESMC_OPTEED_FUNCID_RETURN_SYSTEM_RESET_DONE	8
120 #define TEESMC_OPTEED_RETURN_SYSTEM_RESET_DONE \
121 	TEESMC_OPTEED_RV(TEESMC_OPTEED_FUNCID_RETURN_SYSTEM_RESET_DONE)
122 
123 #endif /*TEESMC_OPTEED_H*/
124