Tegra: fix the NS DRAM address calculation logic
authorVarun Wadekar <vwadekar@nvidia.com>
Wed, 25 Jan 2017 21:35:27 +0000 (13:35 -0800)
committerVarun Wadekar <vwadekar@nvidia.com>
Mon, 1 May 2017 22:33:44 +0000 (15:33 -0700)
This patch fixes the logic used to calculate the end of NS memory
aperture. The functions allows zero sized NS apertures as that is
a valid requirement for some use cases. e.g. VPR resize.

Change-Id: Ie966e0ea2f9c6888d21c38e734003704094b3720
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
plat/nvidia/tegra/common/tegra_bl31_setup.c

index ffaa0ba3f18e053e40f55f65d0aa92ce927439f9..1dc806632de4ac4e102a5111cafc023ca9655f6d 100644 (file)
@@ -381,13 +381,12 @@ void bl31_plat_arch_setup(void)
  ******************************************************************************/
 int bl31_check_ns_address(uint64_t base, uint64_t size_in_bytes)
 {
-       uint64_t end = base + size_in_bytes - 1;
+       uint64_t end = base + size_in_bytes;
 
        /*
         * Check if the NS DRAM address is valid
         */
-       if ((base < TEGRA_DRAM_BASE) || (end > TEGRA_DRAM_END) ||
-           (base >= end)) {
+       if ((base < TEGRA_DRAM_BASE) || (end > TEGRA_DRAM_END)) {
                ERROR("NS address is out-of-bounds!\n");
                return -EFAULT;
        }