Zelalem Aweke | c8bc23e | 2021-07-09 15:32:21 -0500 | [diff] [blame] | 1 | /* |
Soby Mathew | 68ea954 | 2022-03-22 13:58:52 +0000 | [diff] [blame] | 2 | * Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved. |
Zelalem Aweke | c8bc23e | 2021-07-09 15:32:21 -0500 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #ifndef TRP_PRIVATE_H |
| 8 | #define TRP_PRIVATE_H |
| 9 | |
Javier Almansa Sobrino | 7176a77 | 2021-11-24 18:37:37 +0000 | [diff] [blame] | 10 | #include <services/rmmd_svc.h> |
Javier Almansa Sobrino | 4165e84 | 2022-04-25 17:18:15 +0100 | [diff] [blame] | 11 | #include <trp_helpers.h> |
Zelalem Aweke | c8bc23e | 2021-07-09 15:32:21 -0500 | [diff] [blame] | 12 | |
Javier Almansa Sobrino | 7176a77 | 2021-11-24 18:37:37 +0000 | [diff] [blame] | 13 | /* Definitions for RMM-EL3 Interface ABI VERSION */ |
| 14 | #define TRP_RMM_EL3_ABI_VERS_MAJOR RMM_EL3_IFC_VERSION_MAJOR |
| 15 | #define TRP_RMM_EL3_ABI_VERS_MINOR RMM_EL3_IFC_VERSION_MINOR |
| 16 | #define TRP_RMM_EL3_ABI_VERS (((TRP_RMM_EL3_ABI_VERS_MAJOR & 0x7FFF) << 16) | \ |
| 17 | (TRP_RMM_EL3_ABI_VERS_MINOR & 0xFFFF)) |
| 18 | |
| 19 | #define TRP_PLATFORM_CORE_COUNT PLATFORM_CORE_COUNT |
| 20 | |
Zelalem Aweke | c8bc23e | 2021-07-09 15:32:21 -0500 | [diff] [blame] | 21 | #ifndef __ASSEMBLER__ |
| 22 | |
| 23 | #include <stdint.h> |
| 24 | |
Zelalem Aweke | c8bc23e | 2021-07-09 15:32:21 -0500 | [diff] [blame] | 25 | #define write_trp_arg(args, offset, val) (((args)->regs[offset >> 3]) \ |
| 26 | = val) |
Subhasish Ghosh | 3ad1603 | 2022-05-12 12:22:17 +0100 | [diff] [blame] | 27 | /* RMI SMC64 FIDs handled by the TRP */ |
| 28 | #define RMI_RMM_REQ_VERSION SMC64_RMI_FID(U(0)) |
| 29 | #define RMI_RMM_GRANULE_DELEGATE SMC64_RMI_FID(U(1)) |
| 30 | #define RMI_RMM_GRANULE_UNDELEGATE SMC64_RMI_FID(U(2)) |
Soby Mathew | 68ea954 | 2022-03-22 13:58:52 +0000 | [diff] [blame] | 31 | |
Zelalem Aweke | c8bc23e | 2021-07-09 15:32:21 -0500 | [diff] [blame] | 32 | /* Definitions for RMI VERSION */ |
| 33 | #define RMI_ABI_VERSION_MAJOR U(0x0) |
| 34 | #define RMI_ABI_VERSION_MINOR U(0x0) |
Javier Almansa Sobrino | 7176a77 | 2021-11-24 18:37:37 +0000 | [diff] [blame] | 35 | #define RMI_ABI_VERSION (((RMI_ABI_VERSION_MAJOR & 0x7FFF) \ |
| 36 | << 16) | \ |
| 37 | (RMI_ABI_VERSION_MINOR & 0xFFFF)) |
| 38 | |
| 39 | #define TRP_RMM_EL3_VERSION_GET_MAJOR(x) \ |
| 40 | RMM_EL3_IFC_VERSION_GET_MAJOR((x)) |
| 41 | #define TRP_RMM_EL3_VERSION_GET_MINOR(x) \ |
| 42 | RMM_EL3_IFC_VERSION_GET_MAJOR_MINOR((x)) |
Zelalem Aweke | c8bc23e | 2021-07-09 15:32:21 -0500 | [diff] [blame] | 43 | |
| 44 | /* Helper to issue SMC calls to BL31 */ |
| 45 | uint64_t trp_smc(trp_args_t *); |
| 46 | |
| 47 | /* The main function to executed only by Primary CPU */ |
| 48 | void trp_main(void); |
| 49 | |
| 50 | /* Setup TRP. Executed only by Primary CPU */ |
Javier Almansa Sobrino | 7176a77 | 2021-11-24 18:37:37 +0000 | [diff] [blame] | 51 | void trp_setup(uint64_t x0, |
| 52 | uint64_t x1, |
| 53 | uint64_t x2, |
| 54 | uint64_t x3); |
Zelalem Aweke | c8bc23e | 2021-07-09 15:32:21 -0500 | [diff] [blame] | 55 | |
Javier Almansa Sobrino | 04a6f2f | 2022-12-01 17:20:45 +0000 | [diff] [blame] | 56 | /* Validate arguments for warm boot only */ |
| 57 | int trp_validate_warmboot_args(uint64_t x0, uint64_t x1, |
| 58 | uint64_t x2, uint64_t x3); |
| 59 | |
Zelalem Aweke | c8bc23e | 2021-07-09 15:32:21 -0500 | [diff] [blame] | 60 | #endif /* __ASSEMBLER__ */ |
| 61 | #endif /* TRP_PRIVATE_H */ |