blob: c27fbf2e371dec5705221a53e057d90ad7f547cb [file] [log] [blame]
Anson Huangf753d462019-01-15 10:34:04 +08001/*
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
14static int32_t imx_sip_setup(void)
15{
16 return 0;
17}
18
19static 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);
Anson Huang922c45f2019-01-15 10:56:36 +080032 case IMX_SIP_CPUFREQ:
33 SMC_RET1(handle, imx_cpufreq_handler(smc_fid, x1, x2, x3));
34 break;
Anson Huange1d418c2019-01-18 10:01:50 +080035 case IMX_SIP_WAKEUP_SRC:
36 SMC_RET1(handle, imx_wakeup_src_handler(smc_fid, x1, x2, x3));
Anson Huang6e47de52019-01-18 10:27:48 +080037 case IMX_SIP_OTP_READ:
38 case IMX_SIP_OTP_WRITE:
39 return imx_otp_handler(smc_fid, handle, x1, x2);
Anson Huange708bfb2019-01-18 10:35:54 +080040 case IMX_SIP_MISC_SET_TEMP:
41 SMC_RET1(handle, imx_misc_set_temp_handler(smc_fid, x1, x2, x3, x4));
Anson Huangf753d462019-01-15 10:34:04 +080042#endif
Anson Huang971392d2019-01-18 10:43:59 +080043 case IMX_SIP_BUILDINFO:
44 SMC_RET1(handle, imx_buildinfo_handler(smc_fid, x1, x2, x3, x4));
Anson Huangf753d462019-01-15 10:34:04 +080045 default:
46 WARN("Unimplemented i.MX SiP Service Call: 0x%x\n", smc_fid);
47 SMC_RET1(handle, SMC_UNK);
48 break;
49 }
50}
51
52/* Define a runtime service descriptor for fast SMC calls */
53DECLARE_RT_SVC(
54 imx_sip_svc,
55 OEN_SIP_START,
56 OEN_SIP_END,
57 SMC_TYPE_FAST,
58 imx_sip_setup,
59 imx_sip_handler
60);