summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2016-01-29 16:10:04 -0700
committerSimon Glass <sjg@chromium.org>2016-02-09 15:41:19 -0700
commit986fe378172fa4bd5be1432ab2f8f7c2b1c43bae (patch)
tree643948b0e7d77d99ae113978bf435623bd92af1e
parent1934665742e38c8ced9342a9c3005a3eab0b1a7c (diff)
downloadtalos-obmc-uboot-986fe378172fa4bd5be1432ab2f8f7c2b1c43bae.tar.gz
talos-obmc-uboot-986fe378172fa4bd5be1432ab2f8f7c2b1c43bae.zip
itest: allow map_physmem to return 0 in limited cases
On some systems, RAM starts at address 0. If the user executes itest against address 0 on such a system, it will call map_physmem(0, ...) which will return 0 back; mapping only changes the address on sandbox. This causes itest to believe map_physmem() has failed, and hence fails the comparison. Fix itest so that it allows map_physmem() to return 0 /if/ the orignal address passed to it was also 0. This fixes "tegra-uboot-flasher flash" on Tegra20. This has the disadvantage that on sandbox, failed mapping attempts for address 0 are not detected. Instead, should the code only call map_physmem() on sandbox? Or, should map_physmem() return its error status some other way. Or, should the special case only be allowed on systems where the base of RAM is 0 somehow? Fixes: 7861204c9af7 ("itest: make memory access work under sandbox") Signed-off-by: Stephen Warren <swarren@nvidia.com>
-rw-r--r--cmd/itest.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd/itest.c b/cmd/itest.c
index 91ae5c2704..fb4d797e43 100644
--- a/cmd/itest.c
+++ b/cmd/itest.c
@@ -59,7 +59,7 @@ static long evalexp(char *s, int w)
if (s[0] == '*') {
addr = simple_strtoul(&s[1], NULL, 16);
buf = map_physmem(addr, w, MAP_WRBACK);
- if (!buf) {
+ if (!buf && addr) {
puts("Failed to map physical memory\n");
return 0;
}
OpenPOWER on IntegriCloud