Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame^] | 1 | /* |
| 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 | |
| 22 | #define SMCCC_MAJOR_VERSION 1 |
| 23 | #define SMCCC_MINOR_VERSION 1 |
| 24 | |
| 25 | #define SMC_UNKNOWN -1 |
| 26 | |
| 27 | /* TODO: Import SMCCC 2.0 properly instead of having this */ |
| 28 | #define FUNCID_NAMESPACE_SHIFT U(28) |
| 29 | #define FUNCID_NAMESPACE_MASK U(0x3) |
| 30 | #define FUNCID_NAMESPACE_WIDTH U(2) |
| 31 | #define FUNCID_NAMESPACE_SPRT U(2) |
| 32 | #define FUNCID_NAMESPACE_SPCI U(3) |
| 33 | |
| 34 | /******************************************************************************* |
| 35 | * Bit definitions inside the function id as per the SMC calling convention |
| 36 | ******************************************************************************/ |
| 37 | #define FUNCID_TYPE_SHIFT 31 |
| 38 | #define FUNCID_CC_SHIFT 30 |
| 39 | #define FUNCID_OEN_SHIFT 24 |
| 40 | #define FUNCID_NUM_SHIFT 0 |
| 41 | |
| 42 | #define FUNCID_TYPE_MASK 0x1 |
| 43 | #define FUNCID_CC_MASK 0x1 |
| 44 | #define FUNCID_OEN_MASK 0x3f |
| 45 | #define FUNCID_NUM_MASK 0xffff |
| 46 | |
| 47 | #define FUNCID_TYPE_WIDTH 1 |
| 48 | #define FUNCID_CC_WIDTH 1 |
| 49 | #define FUNCID_OEN_WIDTH 6 |
| 50 | #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 | |
| 77 | #endif /* __SMCCC_H__ */ |