memory.h 2.1 KB

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