Juan Pablo Conde | 88ffad2 | 2024-10-11 21:22:29 -0500 | [diff] [blame] | 1 | /* |
Javier Almansa Sobrino | 82cd82e | 2025-01-17 17:37:42 +0000 | [diff] [blame^] | 2 | * Copyright (c) 2024-2025, Arm Limited. All rights reserved. |
Juan Pablo Conde | 88ffad2 | 2024-10-11 21:22:29 -0500 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef REALM_HELPERS_H |
| 9 | #define REALM_HELPERS_H |
| 10 | |
Shruti Gupta | 9110508 | 2024-11-27 05:29:55 +0000 | [diff] [blame] | 11 | #include <realm_rsi.h> |
| 12 | |
Juan Pablo Conde | 88ffad2 | 2024-10-11 21:22:29 -0500 | [diff] [blame] | 13 | /* Generate 64-bit random number */ |
| 14 | unsigned long long realm_rand64(void); |
Javier Almansa Sobrino | 82cd82e | 2025-01-17 17:37:42 +0000 | [diff] [blame^] | 15 | |
| 16 | /* Reset the undefined aborts counter */ |
| 17 | void realm_reset_undef_abort_count(void); |
| 18 | |
| 19 | /* Return the undefined aborts counter value */ |
| 20 | unsigned int realm_get_undef_abort_count(void); |
| 21 | |
| 22 | /* |
| 23 | * Sync exception handler. |
| 24 | * If the exception is an undefined abort, it increases the value |
| 25 | * of the abort counter and returns 'true'. Otherwise, it returns 'false' |
| 26 | */ |
| 27 | bool realm_sync_exception_handler(void); |
| 28 | |
Shruti Gupta | 5abab76 | 2024-11-27 04:57:53 +0000 | [diff] [blame] | 29 | /* |
| 30 | * Function to enter Aux Plane from Primary Plane |
| 31 | * arg1 == plane index |
| 32 | * arg2 == permission index to be used by plane |
| 33 | * arg3 == base entrypoint |
| 34 | * arg4 == entry flags |
| 35 | * aarg5 == run object, needs to be PAGE aligned |
| 36 | */ |
| 37 | bool realm_plane_enter(u_register_t plane_index, u_register_t perm_index, |
| 38 | u_register_t base, u_register_t flags, rsi_plane_run *run); |
| 39 | |
Shruti Gupta | 9110508 | 2024-11-27 05:29:55 +0000 | [diff] [blame] | 40 | /* This function will call the Host to request IPA of the NS shared buffer */ |
| 41 | u_register_t realm_get_ns_buffer(void); |
| 42 | |
| 43 | /* This function will return plane index of current plane */ |
| 44 | unsigned int realm_get_my_plane_num(void); |
| 45 | |
| 46 | /** This function will return true for primary plane false for aux plane */ |
| 47 | bool realm_is_plane0(void); |
| 48 | |
Shruti Gupta | 5abab76 | 2024-11-27 04:57:53 +0000 | [diff] [blame] | 49 | /* Function for initializing planes, called at Boot */ |
| 50 | void realm_plane_init(void); |
Shruti Gupta | 4143468 | 2024-12-05 14:57:48 +0000 | [diff] [blame] | 51 | bool plane_common_init(u_register_t plane_index, u_register_t perm_index, |
| 52 | u_register_t base, rsi_plane_run *run); |
Juan Pablo Conde | 88ffad2 | 2024-10-11 21:22:29 -0500 | [diff] [blame] | 53 | |
| 54 | #endif /* REALM_HELPERS_H */ |
| 55 | |