blob: 603523f18e9fb7a8965d318911a2f45dbf5d9d7a [file] [log] [blame]
Antonio Nino Diaze8ce60a2018-11-08 14:12:40 +00001/*
2 * Copyright (c) 2018, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <debug.h>
8#include <smccc.h>
9#include <smccc_helpers.h>
10#include <spci_svc.h>
11#include <utils.h>
12
13#include "spm_private.h"
14
15/*******************************************************************************
16 * This function handles all SMCs in the range reserved for SPCI.
17 ******************************************************************************/
18uint64_t spci_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2,
19 uint64_t x3, uint64_t x4, void *cookie, void *handle,
20 uint64_t flags)
21{
22 uint32_t spci_fid;
23
24 /* SPCI only supported from the Non-secure world for now */
25 if (is_caller_non_secure(flags) == SMC_FROM_SECURE) {
26 SMC_RET1(handle, SMC_UNK);
27 }
28
29 if ((smc_fid & SPCI_FID_TUN_FLAG) == 0) {
30
31 /* Miscellaneous calls */
32
33 spci_fid = (smc_fid >> SPCI_FID_MISC_SHIFT) & SPCI_FID_MISC_MASK;
34
35 switch (spci_fid) {
36
37 case SPCI_FID_VERSION:
38 SMC_RET1(handle, SPCI_VERSION_COMPILED);
39
40 default:
41 break;
42 }
43
44 } else {
45
46 /* Tunneled calls */
47
48 }
49
50 WARN("SPCI: Unsupported call 0x%08x\n", smc_fid);
51 SMC_RET1(handle, SPCI_NOT_SUPPORTED);
52}