mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-16 09:34:18 +00:00
feat(fvp): add plat API to validate that passed region is non-secure
Added a platform function to check passed region is within the Non-Secure region of DRAM. Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com> Change-Id: Ie5808fa6a1b6e6bc99f4185fa8acc52af0d5f14d
This commit is contained in:
parent
b1392f429c
commit
d5f225d95d
2 changed files with 43 additions and 0 deletions
|
@ -64,4 +64,11 @@ uint64_t plat_drtm_get_tcb_hash_features(void);
|
|||
int plat_set_drtm_error(uint64_t error_code);
|
||||
int plat_get_drtm_error(uint64_t *error_code);
|
||||
|
||||
/*
|
||||
* Platform-specific function to ensure passed region lies within
|
||||
* Non-Secure region of DRAM
|
||||
*/
|
||||
int plat_drtm_validate_ns_region(uintptr_t region_start,
|
||||
size_t region_size);
|
||||
|
||||
#endif /* PLAT_DRTM_H */
|
||||
|
|
36
plat/arm/board/fvp/fvp_drtm_addr.c
Normal file
36
plat/arm/board/fvp/fvp_drtm_addr.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) 2022 Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <plat/common/platform.h>
|
||||
#include <platform_def.h>
|
||||
|
||||
/*******************************************************************************
|
||||
* Check passed region is within Non-Secure region of DRAM
|
||||
******************************************************************************/
|
||||
int plat_drtm_validate_ns_region(uintptr_t region_start,
|
||||
size_t region_size)
|
||||
{
|
||||
uintptr_t region_end = region_start + region_size - 1;
|
||||
|
||||
if (region_start >= region_end) {
|
||||
return -1;
|
||||
} else if ((region_start >= ARM_NS_DRAM1_BASE) &&
|
||||
(region_start < (ARM_NS_DRAM1_BASE + ARM_NS_DRAM1_SIZE)) &&
|
||||
(region_end >= ARM_NS_DRAM1_BASE) &&
|
||||
(region_end < (ARM_NS_DRAM1_BASE + ARM_NS_DRAM1_SIZE))) {
|
||||
return 0;
|
||||
} else if ((region_start >= ARM_DRAM2_BASE) &&
|
||||
(region_start < (ARM_DRAM2_BASE + ARM_DRAM2_SIZE)) &&
|
||||
(region_end >= ARM_DRAM2_BASE) &&
|
||||
(region_end < (ARM_DRAM2_BASE + ARM_DRAM2_SIZE))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
Loading…
Add table
Reference in a new issue