xref: /rk3399_ARM-atf/plat/st/stm32mp2/services/stm32mp2_svc_setup.c (revision f55b136abcdd2d6ba3bd5613eee8fff943de0fd1)
1 /*
2  * Copyright (c) 2024, STMicroelectronics - All Rights Reserved
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <stdbool.h>
8 #include <stdint.h>
9 
10 #include <common/debug.h>
11 #include <common/runtime_svc.h>
12 #include <lib/mmio.h>
13 
14 #include <stm32mp2_smc.h>
15 #include <stm32mp_svc_setup.h>
16 
17 /*
18  * Platform-level Standard Service SIP SMC handler. This handler will dispatch
19  * the SMC to the correct feature handler.
20  */
21 void plat_svc_smc_handler(uint32_t smc_fid, u_register_t x1,
22 			  u_register_t x2, u_register_t x3,
23 			  u_register_t x4, uint32_t *ret1,
24 			  uint32_t *ret2, bool *ret2_enabled,
25 			  u_register_t flags)
26 {
27 	switch (smc_fid) {
28 	case STM32_SIP_SVC_CALL_COUNT:
29 		*ret1 = STM32_COMMON_SIP_NUM_CALLS;
30 		break;
31 	default:
32 		WARN("Unimplemented STM32MP2 Service Call: 0x%x\n", smc_fid);
33 		*ret1 = STM32_SMC_NOT_SUPPORTED;
34 		break;
35 	}
36 }
37