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 | |
| 10 | /* Definitions to help the assembler access the SMC/ERET args structure */ |
| 11 | #define TRP_ARGS_SIZE TRP_ARGS_END |
| 12 | #define TRP_ARG0 0x0 |
| 13 | #define TRP_ARG1 0x8 |
| 14 | #define TRP_ARG2 0x10 |
| 15 | #define TRP_ARG3 0x18 |
| 16 | #define TRP_ARG4 0x20 |
| 17 | #define TRP_ARG5 0x28 |
| 18 | #define TRP_ARG6 0x30 |
| 19 | #define TRP_ARG7 0x38 |
| 20 | #define TRP_ARGS_END 0x40 |
| 21 | |
| 22 | #ifndef __ASSEMBLER__ |
| 23 | |
| 24 | #include <stdint.h> |
| 25 | |
| 26 | /* Data structure to hold SMC arguments */ |
| 27 | typedef struct trp_args { |
| 28 | uint64_t regs[TRP_ARGS_END >> 3]; |
| 29 | } __aligned(CACHE_WRITEBACK_GRANULE) trp_args_t; |
| 30 | |
| 31 | #define write_trp_arg(args, offset, val) (((args)->regs[offset >> 3]) \ |
| 32 | = val) |
Subhasish Ghosh | 3ad1603 | 2022-05-12 12:22:17 +0100 | [diff] [blame] | 33 | /* RMI SMC64 FIDs handled by the TRP */ |
| 34 | #define RMI_RMM_REQ_VERSION SMC64_RMI_FID(U(0)) |
| 35 | #define RMI_RMM_GRANULE_DELEGATE SMC64_RMI_FID(U(1)) |
| 36 | #define RMI_RMM_GRANULE_UNDELEGATE SMC64_RMI_FID(U(2)) |
Soby Mathew | 68ea954 | 2022-03-22 13:58:52 +0000 | [diff] [blame] | 37 | |
Zelalem Aweke | c8bc23e | 2021-07-09 15:32:21 -0500 | [diff] [blame] | 38 | /* Definitions for RMI VERSION */ |
| 39 | #define RMI_ABI_VERSION_MAJOR U(0x0) |
| 40 | #define RMI_ABI_VERSION_MINOR U(0x0) |
| 41 | #define RMI_ABI_VERSION ((RMI_ABI_VERSION_MAJOR << 16) | \ |
| 42 | RMI_ABI_VERSION_MINOR) |
| 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 */ |
| 51 | void trp_setup(void); |
| 52 | |
| 53 | #endif /* __ASSEMBLER__ */ |
| 54 | #endif /* TRP_PRIVATE_H */ |