blob: 506a84f55fe14ee7219a3886b1659ed7b43f2e01 [file] [log] [blame]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02001/*
2 * Copyright (c) 2018, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef __SMCCC_H__
8#define __SMCCC_H__
9
10#include <utils_def.h>
11
12#define SMCCC_VERSION_MAJOR_SHIFT U(16)
13#define SMCCC_VERSION_MAJOR_MASK U(0x7FFF)
14#define SMCCC_VERSION_MINOR_SHIFT U(0)
15#define SMCCC_VERSION_MINOR_MASK U(0xFFFF)
16#define MAKE_SMCCC_VERSION(_major, _minor) \
17 ((((uint32_t)(_major) & SMCCC_VERSION_MAJOR_MASK) << \
18 SMCCC_VERSION_MAJOR_SHIFT) \
19 | (((uint32_t)(_minor) & SMCCC_VERSION_MINOR_MASK) << \
20 SMCCC_VERSION_MINOR_SHIFT))
21
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020022#define SMC_UNKNOWN -1
23
24/* TODO: Import SMCCC 2.0 properly instead of having this */
25#define FUNCID_NAMESPACE_SHIFT U(28)
26#define FUNCID_NAMESPACE_MASK U(0x3)
27#define FUNCID_NAMESPACE_WIDTH U(2)
28#define FUNCID_NAMESPACE_SPRT U(2)
29#define FUNCID_NAMESPACE_SPCI U(3)
30
31/*******************************************************************************
32 * Bit definitions inside the function id as per the SMC calling convention
33 ******************************************************************************/
34#define FUNCID_TYPE_SHIFT 31
35#define FUNCID_CC_SHIFT 30
36#define FUNCID_OEN_SHIFT 24
37#define FUNCID_NUM_SHIFT 0
38
39#define FUNCID_TYPE_MASK 0x1
40#define FUNCID_CC_MASK 0x1
41#define FUNCID_OEN_MASK 0x3f
42#define FUNCID_NUM_MASK 0xffff
43
44#define FUNCID_TYPE_WIDTH 1
45#define FUNCID_CC_WIDTH 1
46#define FUNCID_OEN_WIDTH 6
47#define FUNCID_NUM_WIDTH 16
48
49#define SMC_64 1
50#define SMC_32 0
51#define SMC_TYPE_FAST 1
52#define SMC_TYPE_STD 0
53
54/*******************************************************************************
55 * Owning entity number definitions inside the function id as per the SMC
56 * calling convention
57 ******************************************************************************/
58#define OEN_ARM_START 0
59#define OEN_ARM_END 0
60#define OEN_CPU_START 1
61#define OEN_CPU_END 1
62#define OEN_SIP_START 2
63#define OEN_SIP_END 2
64#define OEN_OEM_START 3
65#define OEN_OEM_END 3
66#define OEN_STD_START 4 /* Standard Calls */
67#define OEN_STD_END 4
68#define OEN_TAP_START 48 /* Trusted Applications */
69#define OEN_TAP_END 49
70#define OEN_TOS_START 50 /* Trusted OS */
71#define OEN_TOS_END 63
72#define OEN_LIMIT 64
73
74#endif /* __SMCCC_H__ */