[U-Boot] [PATCH v6 2/6] test/py: return a RAM address different from 0 as it can be interpreted as NULL

Quentin Schulz quentin.schulz at bootlin.com
Mon Jul 9 17:16:26 UTC 2018


Some functions test that the given address is not NULL (0) and fail or
have a different behaviour if that's the case (e.g. hexport_r).

Let's make the RAM base address to be not zero by setting it to 2MiB if
that's the case.

2MiB is chosen because it represents the size of an ARM LPAE/v8 section.

Suggested-by: Stephen Warren <swarren at wwwdotorg.org>
Signed-off-by: Quentin Schulz <quentin.schulz at bootlin.com>
Reviewed-by: Simon Glass <sjg at chromium.org>
Reviewed-by: Stephen Warren <swarren at nvidia.com>
Tested-by: Stephen Warren <swarren at nvidia.com>
---

added in v5

 test/py/u_boot_utils.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/test/py/u_boot_utils.py b/test/py/u_boot_utils.py
index bb31e57..07520ac 100644
--- a/test/py/u_boot_utils.py
+++ b/test/py/u_boot_utils.py
@@ -236,6 +236,12 @@ def find_ram_base(u_boot_console):
             ram_base = -1
             raise Exception('Failed to find RAM bank start in `bdinfo`')
 
+    # We don't want ram_base to be zero as some functions test if the given
+    # address is NULL (0). Let's add 2MiB then (size of an ARM LPAE/v8 section).
+
+    if ram_base == 0:
+        ram_base += 1024 * 1024 * 2
+
     return ram_base
 
 class PersistentFileHelperCtxMgr(object):
-- 
git-series 0.9.1


More information about the U-Boot mailing list