Madhukar Pappireddy | cc30710 | 2023-09-09 23:02:34 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2023, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <stdint.h> |
| 8 | |
| 9 | #include <common/debug.h> |
| 10 | #include <common/runtime_svc.h> |
| 11 | |
| 12 | #include <plat/arm/common/arm_sip_svc.h> |
| 13 | #include <plat/common/platform.h> |
| 14 | |
| 15 | #if ENABLE_SPMD_LP |
| 16 | #include <services/el3_spmd_logical_sp.h> |
| 17 | #endif |
| 18 | |
| 19 | uintptr_t plat_arm_sip_handler(uint32_t 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 | { |
Madhukar Pappireddy | 3b228e1 | 2023-08-24 16:57:22 -0500 | [diff] [blame] | 28 | #if PLAT_TEST_SPM |
| 29 | bool secure_origin; |
| 30 | |
| 31 | /* Determine which security state this SMC originated from */ |
| 32 | secure_origin = is_caller_secure(flags); |
| 33 | |
| 34 | switch (smc_fid) { |
| 35 | case ARM_SIP_SET_INTERRUPT_PENDING: |
| 36 | if (!secure_origin) { |
| 37 | SMC_RET1(handle, SMC_UNK); |
| 38 | } |
| 39 | |
| 40 | VERBOSE("SiP Call- Set interrupt pending %d\n", (uint32_t)x1); |
| 41 | plat_ic_set_interrupt_pending(x1); |
| 42 | |
| 43 | SMC_RET1(handle, SMC_OK); |
| 44 | break; /* Not reached */ |
| 45 | default: |
| 46 | break; |
| 47 | } |
| 48 | #endif |
| 49 | |
Madhukar Pappireddy | cc30710 | 2023-09-09 23:02:34 -0500 | [diff] [blame] | 50 | #if ENABLE_SPMD_LP |
| 51 | return plat_spmd_logical_sp_smc_handler(smc_fid, x1, x2, x3, x4, |
| 52 | cookie, handle, flags); |
| 53 | #else |
| 54 | WARN("Unimplemented ARM SiP Service Call: 0x%x\n", smc_fid); |
| 55 | SMC_RET1(handle, SMC_UNK); |
| 56 | #endif |
| 57 | } |