blob: c5af1be8e8c03238217c8c665194ef10352a1a17 [file] [log] [blame]
/*
* Copyright (c) 2024-2025, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#ifndef REALM_HELPERS_H
#define REALM_HELPERS_H
#include <realm_rsi.h>
/* Generate 64-bit random number */
unsigned long long realm_rand64(void);
/* Reset the undefined aborts counter */
void realm_reset_undef_abort_count(void);
/* Return the undefined aborts counter value */
unsigned int realm_get_undef_abort_count(void);
/*
* Sync exception handler.
* If the exception is an undefined abort, it increases the value
* of the abort counter and returns 'true'. Otherwise, it returns 'false'
*/
bool realm_sync_exception_handler(void);
/*
* Function to enter Aux Plane from Primary Plane
* arg1 == plane index
* arg2 == permission index to be used by plane
* arg3 == base entrypoint
* arg4 == entry flags
* aarg5 == run object, needs to be PAGE aligned
*/
bool realm_plane_enter(u_register_t plane_index, u_register_t perm_index,
u_register_t base, u_register_t flags, rsi_plane_run *run);
/* This function will call the Host to request IPA of the NS shared buffer */
u_register_t realm_get_ns_buffer(void);
/* This function will return plane index of current plane */
unsigned int realm_get_my_plane_num(void);
/** This function will return true for primary plane false for aux plane */
bool realm_is_plane0(void);
/* Function for initializing planes, called at Boot */
void realm_plane_init(void);
bool plane_common_init(u_register_t plane_index, u_register_t perm_index,
u_register_t base, rsi_plane_run *run);
#endif /* REALM_HELPERS_H */