Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 1 | /* |
Manish V Badarkhe | bc93a34 | 2020-04-28 17:59:32 +0100 | [diff] [blame] | 2 | * Copyright (c) 2018-2020, Arm Limited. All rights reserved. |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 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 Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 22 | #define SMC_UNKNOWN -1 |
Manish V Badarkhe | bc93a34 | 2020-04-28 17:59:32 +0100 | [diff] [blame] | 23 | #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 Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 30 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 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 | |
Manish V Badarkhe | bc93a34 | 2020-04-28 17:59:32 +0100 | [diff] [blame] | 74 | /******************************************************************************* |
| 75 | * Argument definitions passed to SMC call |
| 76 | ******************************************************************************/ |
| 77 | #define SMC_GET_SOC_VERSION 0 |
| 78 | #define SMC_GET_SOC_REVISION 1 |
| 79 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 80 | #endif /* __SMCCC_H__ */ |