blob: 513ec8f270b0f47fd4d7dbc117cfd9eedd599f58 [file] [log] [blame]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02001/*
Arunachalam Ganapathy417edca2023-09-05 17:44:24 +01002 * Copyright (c) 2018-2023, Arm Limited. All rights reserved.
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02003 *
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
Manish V Badarkhebc93a342020-04-28 17:59:32 +010023#define SMC_OK 0
24
25/* Return codes for Arm Architecture Service SMC calls */
26#define SMC_ARCH_CALL_SUCCESS 0
27#define SMC_ARCH_CALL_NOT_SUPPORTED -1
28#define SMC_ARCH_CALL_NOT_REQUIRED -2
29#define SMC_ARCH_CALL_INVAL_PARAM -3
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020030
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020031/*******************************************************************************
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
Arunachalam Ganapathy417edca2023-09-05 17:44:24 +010037#define FUNCID_SVE_HINT_SHIFT 16
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020038#define FUNCID_NUM_SHIFT 0
39
40#define FUNCID_TYPE_MASK 0x1
41#define FUNCID_CC_MASK 0x1
42#define FUNCID_OEN_MASK 0x3f
Arunachalam Ganapathy417edca2023-09-05 17:44:24 +010043#define FUNCID_SVE_HINT_MASK 0x1
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020044#define FUNCID_NUM_MASK 0xffff
45
46#define FUNCID_TYPE_WIDTH 1
47#define FUNCID_CC_WIDTH 1
48#define FUNCID_OEN_WIDTH 6
Arunachalam Ganapathy417edca2023-09-05 17:44:24 +010049#define FUNCID_SVE_HINT_WIDTH 1
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020050#define FUNCID_NUM_WIDTH 16
51
52#define SMC_64 1
53#define SMC_32 0
54#define SMC_TYPE_FAST 1
55#define SMC_TYPE_STD 0
56
57/*******************************************************************************
58 * Owning entity number definitions inside the function id as per the SMC
59 * calling convention
60 ******************************************************************************/
61#define OEN_ARM_START 0
62#define OEN_ARM_END 0
63#define OEN_CPU_START 1
64#define OEN_CPU_END 1
65#define OEN_SIP_START 2
66#define OEN_SIP_END 2
67#define OEN_OEM_START 3
68#define OEN_OEM_END 3
69#define OEN_STD_START 4 /* Standard Calls */
70#define OEN_STD_END 4
71#define OEN_TAP_START 48 /* Trusted Applications */
72#define OEN_TAP_END 49
73#define OEN_TOS_START 50 /* Trusted OS */
74#define OEN_TOS_END 63
75#define OEN_LIMIT 64
76
Manish V Badarkhebc93a342020-04-28 17:59:32 +010077/*******************************************************************************
78 * Argument definitions passed to SMC call
79 ******************************************************************************/
80#define SMC_GET_SOC_VERSION 0
81#define SMC_GET_SOC_REVISION 1
82
Boyan Karatotev7b7ca222024-10-25 13:33:18 +010083#define SCR_EL3_OPCODE U(0x1E1100)
84#define CPTR_EL3_OPCODE U(0x1E1140)
85#define MDCR_EL3_OPCODE U(0x1E1320)
86#define MPAM3_EL3_OPCODE U(0x1EA500)
87
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020088#endif /* __SMCCC_H__ */