1 /* 2 * Copyright (c) 2022 Arm Limited. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 * 6 */ 7 8 #include <stdint.h> 9 10 #include <plat/common/platform.h> 11 #include <platform_def.h> 12 13 /******************************************************************************* 14 * Check passed region is within Non-Secure region of DRAM 15 ******************************************************************************/ plat_drtm_validate_ns_region(uintptr_t region_start,size_t region_size)16int plat_drtm_validate_ns_region(uintptr_t region_start, 17 size_t region_size) 18 { 19 uintptr_t region_end = region_start + region_size - 1; 20 21 if (region_start >= region_end) { 22 return -1; 23 } else if ((region_start >= ARM_NS_DRAM1_BASE) && 24 (region_start < (ARM_NS_DRAM1_BASE + ARM_NS_DRAM1_SIZE)) && 25 (region_end >= ARM_NS_DRAM1_BASE) && 26 (region_end < (ARM_NS_DRAM1_BASE + ARM_NS_DRAM1_SIZE))) { 27 return 0; 28 } else if ((region_start >= ARM_DRAM2_BASE) && 29 (region_start < (ARM_DRAM2_BASE + ARM_DRAM2_SIZE)) && 30 (region_end >= ARM_DRAM2_BASE) && 31 (region_end < (ARM_DRAM2_BASE + ARM_DRAM2_SIZE))) { 32 return 0; 33 } 34 35 return -1; 36 } 37