summaryrefslogtreecommitdiffstats
path: root/arch/sandbox/cpu
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@imgtec.com>2017-09-14 15:05:13 -0700
committerTom Rini <trini@konsulko.com>2017-10-02 21:52:24 -0400
commitf7ae1ca3e894d67ef1e8b6256a26c08e30e25127 (patch)
tree8c669e393695f36ccaba5f94b8a69aa6df489762 /arch/sandbox/cpu
parentae07d609e951d0018daa1bd82aa56a1c294743cc (diff)
downloadu-boot-f7ae1ca3e894d67ef1e8b6256a26c08e30e25127.tar.gz
u-boot-f7ae1ca3e894d67ef1e8b6256a26c08e30e25127.tar.xz
u-boot-f7ae1ca3e894d67ef1e8b6256a26c08e30e25127.zip
sandbox: Use asm-generic/io.h
Convert the sandbox architecture to make use of the new asm-generic/io.h to provide address mapping functions. As sandbox actually performs non-identity mapping between physical & virtual addresses we can't simply make use of the generic mapping functions, but are able to implement phys_to_virt() & make use of it from map_physmem(). Signed-off-by: Paul Burton <paul.burton@imgtec.com> Cc: Simon Glass <sjg@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/sandbox/cpu')
-rw-r--r--arch/sandbox/cpu/cpu.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c
index 01991049cc..66c3a6a88a 100644
--- a/arch/sandbox/cpu/cpu.c
+++ b/arch/sandbox/cpu/cpu.c
@@ -56,6 +56,16 @@ int cleanup_before_linux_select(int flags)
return 0;
}
+void *phys_to_virt(phys_addr_t paddr)
+{
+ return (void *)(gd->arch.ram_buf + paddr);
+}
+
+phys_addr_t virt_to_phys(void *vaddr)
+{
+ return (phys_addr_t)((uint8_t *)vaddr - gd->arch.ram_buf);
+}
+
void *map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
{
#if defined(CONFIG_PCI) && !defined(CONFIG_SPL_BUILD)
@@ -73,7 +83,7 @@ void *map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
}
#endif
- return (void *)(gd->arch.ram_buf + paddr);
+ return phys_to_virt(paddr);
}
void unmap_physmem(const void *vaddr, unsigned long flags)