summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README9
-rw-r--r--arch/sandbox/config.mk1
-rw-r--r--arch/sandbox/include/asm/io.h10
-rw-r--r--include/common.h12
4 files changed, 32 insertions, 0 deletions
diff --git a/README b/README
index 0070694..51eb71b 100644
--- a/README
+++ b/README
@@ -3811,6 +3811,15 @@ Low Level (hardware related) configuration options:
that is executed before the actual U-Boot. E.g. when
compiling a NAND SPL.
+- CONFIG_ARCH_MAP_SYSMEM
+ Generally U-Boot (and in particular the md command) uses
+ effective address. It is therefore not necessary to regard
+ U-Boot address as virtual addresses that need to be translated
+ to physical addresses. However, sandbox requires this, since
+ it maintains its own little RAM buffer which contains all
+ addressable memory. This option causes some memory accesses
+ to be mapped through map_sysmem() / unmap_sysmem().
+
- CONFIG_USE_ARCH_MEMCPY
CONFIG_USE_ARCH_MEMSET
If these options are used a optimized version of memcpy/memset will
diff --git a/arch/sandbox/config.mk b/arch/sandbox/config.mk
index 02ce4a4..4fd0d4e 100644
--- a/arch/sandbox/config.mk
+++ b/arch/sandbox/config.mk
@@ -18,4 +18,5 @@
# MA 02111-1307 USA
PLATFORM_CPPFLAGS += -DCONFIG_SANDBOX -D__SANDBOX__ -U_FORTIFY_SOURCE
+PLATFORM_CPPFLAGS += -DCONFIG_ARCH_MAP_SYSMEM
PLATFORM_LIBS += -lrt
diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h
index 0392d21..d8c0236 100644
--- a/arch/sandbox/include/asm/io.h
+++ b/arch/sandbox/include/asm/io.h
@@ -39,3 +39,13 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
{
}
+
+/* For sandbox, we want addresses to point into our RAM buffer */
+static inline void *map_sysmem(phys_addr_t paddr, unsigned long len)
+{
+ return map_physmem(paddr, len, MAP_WRBACK);
+}
+
+static inline void unmap_sysmem(const void *vaddr)
+{
+}
diff --git a/include/common.h b/include/common.h
index 170f439..1d0728f 100644
--- a/include/common.h
+++ b/include/common.h
@@ -870,6 +870,18 @@ int cpu_disable(int nr);
int cpu_release(int nr, int argc, char * const argv[]);
#endif
+/* Define a null map_sysmem() if the architecture doesn't use it */
+# ifndef CONFIG_ARCH_MAP_SYSMEM
+static inline void *map_sysmem(phys_addr_t paddr, unsigned long len)
+{
+ return (void *)(uintptr_t)paddr;
+}
+
+static inline void unmap_sysmem(const void *vaddr)
+{
+}
+# endif
+
#endif /* __ASSEMBLY__ */
#ifdef CONFIG_PPC