1 /* 2 * Copyright (c) 2024, Arm Limited and Contributors. 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 #include <services/ven_el3_svc.h> 12 #include <tools_share/uuid.h> 13 14 /* vendor-specific EL3 UUID */ 15 DEFINE_SVC_UUID2(ven_el3_svc_uid, 16 0xb6011dca, 0x57c4, 0x407e, 0x83, 0xf0, 17 0xa7, 0xed, 0xda, 0xf0, 0xdf, 0x6c); 18 19 static int ven_el3_svc_setup(void) 20 { 21 return 0; 22 } 23 24 /* 25 * This function handles Arm defined vendor-specific EL3 Service Calls. 26 */ 27 static uintptr_t ven_el3_svc_handler(unsigned int smc_fid, 28 u_register_t x1, 29 u_register_t x2, 30 u_register_t x3, 31 u_register_t x4, 32 void *cookie, 33 void *handle, 34 u_register_t flags) 35 { 36 switch (smc_fid) { 37 case VEN_EL3_SVC_UID: 38 /* Return UID to the caller */ 39 SMC_UUID_RET(handle, ven_el3_svc_uid); 40 break; 41 case VEN_EL3_SVC_VERSION: 42 SMC_RET2(handle, VEN_EL3_SVC_VERSION_MAJOR, VEN_EL3_SVC_VERSION_MINOR); 43 break; 44 default: 45 WARN("Unimplemented Vendor specific EL3 Service call: 0x%x\n", smc_fid); 46 SMC_RET1(handle, SMC_UNK); 47 break; 48 } 49 } 50 51 /* Define a runtime service descriptor for fast SMC calls */ 52 DECLARE_RT_SVC( 53 ven_el3_svc, 54 OEN_VEN_EL3_START, 55 OEN_VEN_EL3_END, 56 SMC_TYPE_FAST, 57 ven_el3_svc_setup, 58 ven_el3_svc_handler 59 ); 60