~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arm/mach-iop13xx/include/mach/memory.h

Version: ~ [ linux-5.4-rc3 ] ~ [ linux-5.3.6 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.79 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.149 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.196 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.196 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.75 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef __ASM_ARCH_MEMORY_H
  2 #define __ASM_ARCH_MEMORY_H
  3 
  4 #include <mach/hardware.h>
  5 
  6 #ifndef __ASSEMBLY__
  7 
  8 #if defined(CONFIG_ARCH_IOP13XX)
  9 #define IOP13XX_PMMR_V_START (IOP13XX_PMMR_VIRT_MEM_BASE)
 10 #define IOP13XX_PMMR_V_END   (IOP13XX_PMMR_VIRT_MEM_BASE + IOP13XX_PMMR_SIZE)
 11 #define IOP13XX_PMMR_P_START (IOP13XX_PMMR_PHYS_MEM_BASE)
 12 #define IOP13XX_PMMR_P_END   (IOP13XX_PMMR_PHYS_MEM_BASE + IOP13XX_PMMR_SIZE)
 13 
 14 static inline dma_addr_t __virt_to_lbus(void __iomem *x)
 15 {
 16         return x + IOP13XX_PMMR_PHYS_MEM_BASE - IOP13XX_PMMR_VIRT_MEM_BASE;
 17 }
 18 
 19 static inline void __iomem *__lbus_to_virt(dma_addr_t x)
 20 {
 21         return x + IOP13XX_PMMR_VIRT_MEM_BASE - IOP13XX_PMMR_PHYS_MEM_BASE;
 22 }
 23 
 24 #define __is_lbus_dma(a)                                \
 25         ((a) >= IOP13XX_PMMR_P_START && (a) < IOP13XX_PMMR_P_END)
 26 
 27 #define __is_lbus_virt(a)                               \
 28         ((a) >= IOP13XX_PMMR_V_START && (a) < IOP13XX_PMMR_V_END)
 29 
 30 /* Device is an lbus device if it is on the platform bus of the IOP13XX */
 31 #define is_lbus_device(dev)                             \
 32         (dev && strncmp(dev->bus->name, "platform", 8) == 0)
 33 
 34 #define __arch_dma_to_virt(dev, addr)                                   \
 35         ({                                                              \
 36                 void * __virt;                                          \
 37                 dma_addr_t __dma = addr;                                \
 38                 if (is_lbus_device(dev) && __is_lbus_dma(__dma))        \
 39                         __virt = __lbus_to_virt(__dma);                 \
 40                 else                                                    \
 41                         __virt = (void *)__phys_to_virt(__dma);         \
 42                 __virt;                                                 \
 43         })
 44 
 45 #define __arch_virt_to_dma(dev, addr)                                   \
 46         ({                                                              \
 47                 void * __virt = addr;                                   \
 48                 dma_addr_t __dma;                                       \
 49                 if (is_lbus_device(dev) && __is_lbus_virt(__virt))      \
 50                         __dma = __virt_to_lbus(__virt);                 \
 51                 else                                                    \
 52                         __dma = __virt_to_phys((unsigned long)__virt);  \
 53                 __dma;                                                  \
 54         })
 55 
 56 #define __arch_pfn_to_dma(dev, pfn)                                     \
 57         ({                                                              \
 58                 /* __is_lbus_virt() can never be true for RAM pages */  \
 59                 (dma_addr_t)__pfn_to_phys(pfn);                         \
 60         })
 61 
 62 #define __arch_dma_to_pfn(dev, addr)    __phys_to_pfn(addr)
 63 
 64 #endif /* CONFIG_ARCH_IOP13XX */
 65 #endif /* !ASSEMBLY */
 66 
 67 #endif
 68 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp