xref: /rk3399_ARM-atf/include/bl1/bl1.h (revision 82cb2c1ad9897473743f08437d0a3995bed561b9)
1 /*
2  * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef __BL1_FWU_H__
8 #define __BL1_FWU_H__
9 
10 #include <bl_common.h>
11 
12 /*
13  * Defines for BL1 SMC function ids.
14  */
15 #define BL1_SMC_CALL_COUNT		0x0
16 #define BL1_SMC_UID			0x1
17 /* SMC #0x2 reserved */
18 #define BL1_SMC_VERSION			0x3
19 
20 /*
21  * Corresponds to the function ID of the SMC that
22  * the BL1 exception handler service to execute BL31.
23  */
24 #define BL1_SMC_RUN_IMAGE		0x4
25 
26 /*
27  * BL1 SMC version
28  */
29 #define BL1_SMC_MAJOR_VER		0x0
30 #define BL1_SMC_MINOR_VER		0x1
31 
32 /*
33  * Defines for FWU SMC function ids.
34  */
35 
36 #define FWU_SMC_IMAGE_COPY		0x10
37 #define FWU_SMC_IMAGE_AUTH		0x11
38 #define FWU_SMC_IMAGE_EXECUTE		0x12
39 #define FWU_SMC_IMAGE_RESUME		0x13
40 #define FWU_SMC_SEC_IMAGE_DONE		0x14
41 #define FWU_SMC_UPDATE_DONE		0x15
42 
43 /*
44  * Number of FWU calls (above) implemented
45  */
46 #define FWU_NUM_SMC_CALLS		6
47 
48 #if TRUSTED_BOARD_BOOT
49 # define BL1_NUM_SMC_CALLS		(FWU_NUM_SMC_CALLS + 4)
50 #else
51 # define BL1_NUM_SMC_CALLS		4
52 #endif
53 
54 /*
55  * The macros below are used to identify FWU
56  * calls from the SMC function ID
57  */
58 #define FWU_SMC_FID_START		FWU_SMC_IMAGE_COPY
59 #define FWU_SMC_FID_END			FWU_SMC_UPDATE_DONE
60 #define is_fwu_fid(_fid) \
61     ((_fid >= FWU_SMC_FID_START) && (_fid <= FWU_SMC_FID_END))
62 
63 #ifndef __ASSEMBLY__
64 #include <cassert.h>
65 
66 /*
67  * Check if the total number of FWU SMC calls are as expected.
68  */
69 CASSERT(FWU_NUM_SMC_CALLS == 	\
70 		(FWU_SMC_FID_END - FWU_SMC_FID_START + 1),\
71 		assert_FWU_NUM_SMC_CALLS_mismatch);
72 
73 #endif /* __ASSEMBLY__ */
74 #endif /* __BL1_FWU_H__ */
75