xref: /rk3399_ARM-atf/plat/imx/common/imx_sip_svc.c (revision 025514ba80f9bd51af460ff29c4a325904c1812c)
1 /*
2  * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <stdint.h>
8 #include <common/debug.h>
9 #include <common/runtime_svc.h>
10 #include <lib/pmf/pmf.h>
11 #include <tools_share/uuid.h>
12 #include <imx_sip_svc.h>
13 
14 static int32_t imx_sip_setup(void)
15 {
16 	return 0;
17 }
18 
19 static uintptr_t imx_sip_handler(unsigned int smc_fid,
20 			u_register_t x1,
21 			u_register_t x2,
22 			u_register_t x3,
23 			u_register_t x4,
24 			void *cookie,
25 			void *handle,
26 			u_register_t flags)
27 {
28 	switch (smc_fid) {
29 #if (defined(PLAT_IMX8QM) || defined(PLAT_IMX8QX))
30 	case  IMX_SIP_SRTC:
31 		return imx_srtc_handler(smc_fid, handle, x1, x2, x3, x4);
32 #endif
33 	default:
34 		WARN("Unimplemented i.MX SiP Service Call: 0x%x\n", smc_fid);
35 		SMC_RET1(handle, SMC_UNK);
36 		break;
37 	}
38 }
39 
40 /* Define a runtime service descriptor for fast SMC calls */
41 DECLARE_RT_SVC(
42 		imx_sip_svc,
43 		OEN_SIP_START,
44 		OEN_SIP_END,
45 		SMC_TYPE_FAST,
46 		imx_sip_setup,
47 		imx_sip_handler
48 );
49