]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Introduce virt_to_phys()
authorKumar Gala <galak@kernel.crashing.org>
Sat, 13 Dec 2008 23:20:27 +0000 (17:20 -0600)
committerWolfgang Denk <wd@denx.de>
Mon, 15 Dec 2008 21:04:29 +0000 (22:04 +0100)
virt_to_phys() returns the physical address given a virtual. In most
cases this will be just the input value as the vast majority of
systems run in a 1:1 mode.

However in systems that are not running this way it should report the
physical address or ~0 if no mapping exists for the given virtual
address.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
12 files changed:
include/asm-arm/io.h
include/asm-avr32/io.h
include/asm-blackfin/io.h
include/asm-i386/io.h
include/asm-m68k/io.h
include/asm-microblaze/io.h
include/asm-mips/io.h
include/asm-nios/io.h
include/asm-nios2/io.h
include/asm-ppc/io.h
include/asm-sh/io.h
include/asm-sparc/io.h

index f4ae3070036bf2814ee3c1aaff2ff806195d4aa1..fec3a7eace50ce220355e03bdd5629eed23be80a 100644 (file)
@@ -57,6 +57,11 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+       return (phys_addr_t)(vaddr);
+}
+
 /*
  * Generic virtual read/write.  Note that we don't support half-word
  * read/writes.  We define __arch_*[bl] here, and leave __arch_*w
index 06e52b137f51e476bfb13ec104a89a88e1a7070b..d22cd3561127c1fb60e65991cc1ba0f072f51c44 100644 (file)
@@ -125,4 +125,9 @@ static inline void unmap_physmem(void *vaddr, unsigned long len)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+       return (phys_addr_t)(vaddr);
+}
+
 #endif /* __ASM_AVR32_IO_H */
index da58914987c2241a369752da3fc5c35e72489db7..68064949834636a82e505f711bc92bd51305210a 100644 (file)
@@ -64,6 +64,11 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+       return (phys_addr_t)(vaddr);
+}
+
 /*
  * These are for ISA/PCI shared memory _only_ and should never be used
  * on any other type of memory, including Zorro memory. They are meant to
index 2c57140fb39047cf0a354b3fd5228f0909f10621..9b757d489e38091700085f93a76293065f66af97 100644 (file)
@@ -229,4 +229,9 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+       return (phys_addr_t)(vaddr);
+}
+
 #endif
index 1fccc1292328c3efb04b7a9863e02f72b7ca8524..50ea08751f1453ebd256ed1783393b45fc697e2f 100644 (file)
@@ -251,4 +251,9 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+       return (phys_addr_t)(vaddr);
+}
+
 #endif                         /* __ASM_M68K_IO_H__ */
index 8804724bff2c043a8dc6605438c37fee9b614179..7e190d15c60e98be1b2a68f191e33f19b5ed42d8 100644 (file)
@@ -155,4 +155,9 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+       return (phys_addr_t)(vaddr);
+}
+
 #endif /* __MICROBLAZE_IO_H__ */
index 3a0f33f204d11c4ff18c180d128e9ad062624d58..031186d037fe3d18de9cd52eaea78e62aeb72bd3 100644 (file)
@@ -118,7 +118,7 @@ static inline void set_io_port_base(unsigned long base)
  * Change virtual addresses to physical addresses and vv.
  * These are trivial on the 1:1 Linux/MIPS mapping
  */
-extern inline unsigned long virt_to_phys(volatile void * address)
+extern inline phys_addr_t virt_to_phys(void * address)
 {
        return CPHYSADDR(address);
 }
index 8b788068b3d5482219fa6228486f418276f8bb0f..899682cc40dab7d51e37fb7e7c164d295d845d42 100644 (file)
@@ -133,4 +133,9 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+       return (phys_addr_t)(vaddr);
+}
+
 #endif /* __ASM_NIOS_IO_H_ */
index 2f1ec26bd16f3770df3156915953913602f59585..01d11efeceab03a4d0e36a1590922002da5ae70f 100644 (file)
@@ -53,6 +53,11 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+       return (phys_addr_t)(vaddr);
+}
+
 extern unsigned char inb (unsigned char *port);
 extern unsigned short inw (unsigned short *port);
 extern unsigned inl (unsigned port);
index c3496818f048b44c2df1c2ffa0da66353849e1e4..c00de452d6d479d9bc39ae5337c705aa2f310782 100644 (file)
@@ -298,4 +298,9 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+       return (phys_addr_t)(vaddr);
+}
+
 #endif
index adc3f81ed677f097417d3e4c2e9b599040f3d753..ca598a60f384b9928288a43441593cba7784c60d 100644 (file)
@@ -261,5 +261,10 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+       return (phys_addr_t)(vaddr);
+}
+
 #endif /* __KERNEL__ */
 #endif /* __ASM_SH_IO_H */
index 5f8d05cc36db37c10957a45d507d59e3152e287b..0c5d86cb3a93cf178bd61b2aa17673c3ed3afef4 100644 (file)
@@ -90,4 +90,9 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+       return (phys_addr_t)(vaddr);
+}
+
 #endif