Zelalem Aweke | 13dc8f1 | 2021-07-09 14:20:03 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2021, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #ifndef GTSI_SVC_H |
| 8 | #define GTSI_SVC_H |
| 9 | |
| 10 | /* GTSI error codes. */ |
| 11 | #define GTSI_SUCCESS 0 |
| 12 | #define GTSI_ERROR_NOT_SUPPORTED -1 |
| 13 | #define GTSI_ERROR_INVALID_ADDRESS -2 |
| 14 | #define GTSI_ERROR_INVALID_PAS -3 |
| 15 | |
| 16 | /* The macros below are used to identify GTSI calls from the SMC function ID */ |
| 17 | #define GTSI_FNUM_MIN_VALUE U(0x100) |
| 18 | #define GTSI_FNUM_MAX_VALUE U(0x101) |
| 19 | #define is_gtsi_fid(fid) __extension__ ({ \ |
| 20 | __typeof__(fid) _fid = (fid); \ |
| 21 | ((GET_SMC_NUM(_fid) >= GTSI_FNUM_MIN_VALUE) && \ |
| 22 | (GET_SMC_NUM(_fid) <= GTSI_FNUM_MAX_VALUE)); }) |
| 23 | |
| 24 | /* Get GTSI fastcall std FID from function number */ |
| 25 | #define GTSI_FID(smc_cc, func_num) \ |
| 26 | ((SMC_TYPE_FAST << FUNCID_TYPE_SHIFT) | \ |
| 27 | ((smc_cc) << FUNCID_CC_SHIFT) | \ |
| 28 | (OEN_STD_START << FUNCID_OEN_SHIFT) | \ |
| 29 | ((func_num) << FUNCID_NUM_SHIFT)) |
| 30 | |
| 31 | #define GRAN_TRANS_TO_REALM_FNUM U(0x100) |
| 32 | #define GRAN_TRANS_TO_NS_FNUM U(0x101) |
| 33 | |
| 34 | #define SMC_ASC_MARK_REALM GTSI_FID(SMC_64, GRAN_TRANS_TO_REALM_FNUM) |
| 35 | #define SMC_ASC_MARK_NONSECURE GTSI_FID(SMC_64, GRAN_TRANS_TO_NS_FNUM) |
| 36 | |
| 37 | #define GRAN_TRANS_RET_BAD_ADDR -2 |
| 38 | #define GRAN_TRANS_RET_BAD_PAS -3 |
| 39 | |
| 40 | #endif /* GTSI_SVC_H */ |