blob: 628c160fd897e981e5ea2b4e8e6b6fe33c0794a7 [file] [log] [blame]
Antonio Nino Diaz35c8cfc2018-04-23 15:43:29 +01001/*
2 * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef SMCCC_V2_H
8#define SMCCC_V2_H
9
10#ifndef __SMCCC_H__
11#error "This file must only be included from smccc.h"
12#endif
13
14/*******************************************************************************
15 * Bit definitions inside the function id as per the SMC calling convention
16 ******************************************************************************/
17#define FUNCID_TYPE_SHIFT U(31)
18#define FUNCID_TYPE_MASK U(0x1)
19#define FUNCID_TYPE_WIDTH U(1)
20
21#define FUNCID_CC_SHIFT U(30)
22#define FUNCID_CC_MASK U(0x1)
23#define FUNCID_CC_WIDTH U(1)
24
25#define FUNCID_NAMESPACE_SHIFT U(28)
26#define FUNCID_NAMESPACE_MASK U(0x3)
27#define FUNCID_NAMESPACE_WIDTH U(2)
28
29#define FUNCID_OEN_SHIFT U(24)
30#define FUNCID_OEN_MASK U(0xf)
31#define FUNCID_OEN_WIDTH U(4)
32
33#define FUNCID_NUM_SHIFT U(0)
34#define FUNCID_NUM_MASK U(0xffff)
35#define FUNCID_NUM_WIDTH U(16)
36
37#define GET_SMC_TYPE(id) (((id) >> FUNCID_TYPE_SHIFT) & \
38 FUNCID_TYPE_MASK)
39#define GET_SMC_CC(id) (((id) >> FUNCID_CC_SHIFT) & \
40 FUNCID_CC_MASK)
41#define GET_SMC_NAMESPACE(id) (((id) >> FUNCID_NAMESPACE_SHIFT) & \
42 FUNCID_NAMESPACE_MASK)
43#define GET_SMC_OEN(id) (((id) >> FUNCID_OEN_SHIFT) & \
44 FUNCID_OEN_MASK)
45
46/*******************************************************************************
47 * Owning entity number definitions inside the function id as per the SMC
48 * calling convention
49 ******************************************************************************/
50#define OEN_ARM_START U(0)
51#define OEN_ARM_END U(0)
52#define OEN_CPU_START U(1)
53#define OEN_CPU_END U(1)
54#define OEN_SIP_START U(2)
55#define OEN_SIP_END U(2)
56#define OEN_OEM_START U(3)
57#define OEN_OEM_END U(3)
58#define OEN_STD_START U(4) /* Standard Service Calls */
59#define OEN_STD_END U(4)
60#define OEN_STD_HYP_START U(5) /* Standard Hypervisor Service calls */
61#define OEN_STD_HYP_END U(5)
62#define OEN_VEN_HYP_START U(6) /* Vendor Hypervisor Service calls */
63#define OEN_VEN_HYP_END U(6)
64#define OEN_LIMIT U(16)
65
66/*******************************************************************************
67 * Service namespaces as per the SMC Calling Convention v2.X
68 ******************************************************************************/
69#define FUNCID_NAMESPACE_START U(0)
70#define FUNCID_NAMESPACE_COMPAT U(0)
71#define FUNCID_NAMESPACE_VENDOR U(1)
72#define FUNCID_NAMESPACE_SPRT U(2)
73#define FUNCID_NAMESPACE_SPCI U(3)
74#define FUNCID_NAMESPACE_LIMIT U(4)
75
76/* Flags and error codes */
77#define SMC_64 U(1)
78#define SMC_32 U(0)
79
80#define SMC_TYPE_FAST ULL(1)
81
82#define SMC_OK ULL(0)
83#define SMC_UNK -1
84
85#endif /* SMCCC_V2_H */