block/genhd.c: cleanups
[pv_ops_mirror.git] / include / asm-arm / arch-iop13xx / memory.h
blob031a0fa78efff1d96e28e1fa0f93f3e51689cdb4
1 #ifndef __ASM_ARCH_MEMORY_H
2 #define __ASM_ARCH_MEMORY_H
4 #include <asm/arch/hardware.h>
6 /*
7 * Physical DRAM offset.
8 */
9 #define PHYS_OFFSET UL(0x00000000)
10 #define TASK_SIZE UL(0x3f000000)
11 #define PAGE_OFFSET UL(0x40000000)
12 #define TASK_UNMAPPED_BASE ((TASK_SIZE + 0x01000000) / 3)
14 #ifndef __ASSEMBLY__
16 #if defined(CONFIG_ARCH_IOP13XX)
17 #define IOP13XX_PMMR_V_START (IOP13XX_PMMR_VIRT_MEM_BASE)
18 #define IOP13XX_PMMR_V_END (IOP13XX_PMMR_VIRT_MEM_BASE + IOP13XX_PMMR_SIZE)
19 #define IOP13XX_PMMR_P_START (IOP13XX_PMMR_PHYS_MEM_BASE)
20 #define IOP13XX_PMMR_P_END (IOP13XX_PMMR_PHYS_MEM_BASE + IOP13XX_PMMR_SIZE)
23 * Virtual view <-> PCI DMA view memory address translations
24 * virt_to_bus: Used to translate the virtual address to an
25 * address suitable to be passed to set_dma_addr
26 * bus_to_virt: Used to convert an address for DMA operations
27 * to an address that the kernel can use.
30 /* RAM has 1:1 mapping on the PCIe/x Busses */
31 #define __virt_to_bus(x) (__virt_to_phys(x))
32 #define __bus_to_virt(x) (__phys_to_virt(x))
34 #define virt_to_lbus(x) \
35 (( ((void*)(x) >= (void*)IOP13XX_PMMR_V_START) && \
36 ((void*)(x) < (void*)IOP13XX_PMMR_V_END) ) ? \
37 ((x) - IOP13XX_PMMR_VIRT_MEM_BASE + IOP13XX_PMMR_PHYS_MEM_BASE) : \
38 ((x) - PAGE_OFFSET + PHYS_OFFSET))
40 #define lbus_to_virt(x) \
41 (( ((x) >= IOP13XX_PMMR_P_START) && ((x) < IOP13XX_PMMR_P_END) ) ? \
42 ((x) - IOP13XX_PMMR_PHYS_MEM_BASE + IOP13XX_PMMR_VIRT_MEM_BASE ) : \
43 ((x) - PHYS_OFFSET + PAGE_OFFSET))
45 /* Device is an lbus device if it is on the platform bus of the IOP13XX */
46 #define is_lbus_device(dev) (dev &&\
47 (strncmp(dev->bus->name, "platform", 8) == 0))
49 #define __arch_page_to_dma(dev, page) \
50 ({is_lbus_device(dev) ? (dma_addr_t)virt_to_lbus(page_address(page)) : \
51 (dma_addr_t)__virt_to_bus(page_address(page));})
53 #define __arch_dma_to_virt(dev, addr) \
54 ({is_lbus_device(dev) ? lbus_to_virt(addr) : __bus_to_virt(addr);})
56 #define __arch_virt_to_dma(dev, addr) \
57 ({is_lbus_device(dev) ? virt_to_lbus(addr) : __virt_to_bus(addr);})
59 #endif /* CONFIG_ARCH_IOP13XX */
60 #endif /* !ASSEMBLY */
62 #define PFN_TO_NID(addr) (0)
64 #endif