developer | a84a44a | 2020-08-19 17:20:15 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2020, MediaTek Inc. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <common/debug.h> |
| 8 | #include <common/runtime_svc.h> |
developer | afa342e | 2020-12-14 17:41:08 +0800 | [diff] [blame] | 9 | #include <mtk_sip_svc.h> |
| 10 | #include <mt_spm_vcorefs.h> |
| 11 | #include "plat_sip_calls.h" |
developer | a84a44a | 2020-08-19 17:20:15 +0800 | [diff] [blame] | 12 | |
| 13 | uintptr_t mediatek_plat_sip_handler(uint32_t smc_fid, |
| 14 | u_register_t x1, |
| 15 | u_register_t x2, |
| 16 | u_register_t x3, |
| 17 | u_register_t x4, |
| 18 | void *cookie, |
| 19 | void *handle, |
| 20 | u_register_t flags) |
| 21 | { |
developer | afa342e | 2020-12-14 17:41:08 +0800 | [diff] [blame] | 22 | uint64_t ret; |
developer | a84a44a | 2020-08-19 17:20:15 +0800 | [diff] [blame] | 23 | |
| 24 | switch (smc_fid) { |
developer | afa342e | 2020-12-14 17:41:08 +0800 | [diff] [blame] | 25 | case MTK_SIP_VCORE_CONTROL_ARCH32: |
| 26 | case MTK_SIP_VCORE_CONTROL_ARCH64: |
| 27 | ret = spm_vcorefs_args(x1, x2, x3, (uint64_t *)&x4); |
| 28 | SMC_RET2(handle, ret, x4); |
| 29 | break; |
developer | a84a44a | 2020-08-19 17:20:15 +0800 | [diff] [blame] | 30 | default: |
| 31 | ERROR("%s: unhandled SMC (0x%x)\n", __func__, smc_fid); |
| 32 | break; |
| 33 | } |
| 34 | |
| 35 | SMC_RET1(handle, SMC_UNK); |
| 36 | } |