blob: 2b8bd8b3d4db3acbbc8ef767e88a99f5085228ba [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_V1_H
8#define SMCCC_V1_H
9
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000010#ifndef SMCCC_H
Antonio Nino Diaz35c8cfc2018-04-23 15:43:29 +010011#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_OEN_SHIFT U(24)
26#define FUNCID_OEN_MASK U(0x3f)
27#define FUNCID_OEN_WIDTH U(6)
28
29#define FUNCID_NUM_SHIFT U(0)
30#define FUNCID_NUM_MASK U(0xffff)
31#define FUNCID_NUM_WIDTH U(16)
32
33#define GET_SMC_TYPE(id) (((id) >> FUNCID_TYPE_SHIFT) & \
34 FUNCID_TYPE_MASK)
35#define GET_SMC_CC(id) (((id) >> FUNCID_CC_SHIFT) & \
36 FUNCID_CC_MASK)
37#define GET_SMC_OEN(id) (((id) >> FUNCID_OEN_SHIFT) & \
38 FUNCID_OEN_MASK)
39
40/*******************************************************************************
41 * Owning entity number definitions inside the function id as per the SMC
42 * calling convention
43 ******************************************************************************/
44#define OEN_ARM_START U(0)
45#define OEN_ARM_END U(0)
46#define OEN_CPU_START U(1)
47#define OEN_CPU_END U(1)
48#define OEN_SIP_START U(2)
49#define OEN_SIP_END U(2)
50#define OEN_OEM_START U(3)
51#define OEN_OEM_END U(3)
52#define OEN_STD_START U(4) /* Standard Service Calls */
53#define OEN_STD_END U(4)
54#define OEN_STD_HYP_START U(5) /* Standard Hypervisor Service calls */
55#define OEN_STD_HYP_END U(5)
56#define OEN_VEN_HYP_START U(6) /* Vendor Hypervisor Service calls */
57#define OEN_VEN_HYP_END U(6)
58#define OEN_TAP_START U(48) /* Trusted Applications */
59#define OEN_TAP_END U(49)
60#define OEN_TOS_START U(50) /* Trusted OS */
61#define OEN_TOS_END U(63)
62#define OEN_LIMIT U(64)
63
64/* Flags and error codes */
65#define SMC_64 U(1)
66#define SMC_32 U(0)
67
68#define SMC_TYPE_FAST ULL(1)
Antonio Nino Diaz35c8cfc2018-04-23 15:43:29 +010069#define SMC_TYPE_YIELD ULL(0)
70
71#define SMC_OK ULL(0)
72#define SMC_UNK -1
73#define SMC_PREEMPTED -2 /* Not defined by the SMCCC */
74
75#endif /* SMCCC_V1_H */