memory.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * arch/arm/mach-realview/include/mach/memory.h
  3. *
  4. * Copyright (C) 2003 ARM Limited
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. */
  20. #ifndef __ASM_ARCH_MEMORY_H
  21. #define __ASM_ARCH_MEMORY_H
  22. /*
  23. * Physical DRAM offset.
  24. */
  25. #ifdef CONFIG_REALVIEW_HIGH_PHYS_OFFSET
  26. #define PLAT_PHYS_OFFSET UL(0x70000000)
  27. #else
  28. #define PLAT_PHYS_OFFSET UL(0x00000000)
  29. #endif
  30. #if !defined(__ASSEMBLY__) && defined(CONFIG_ZONE_DMA)
  31. extern void realview_adjust_zones(unsigned long *size, unsigned long *hole);
  32. #define arch_adjust_zones(size, hole) \
  33. realview_adjust_zones(size, hole)
  34. #define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_256M - 1)
  35. #define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_256M)
  36. #endif
  37. #ifdef CONFIG_SPARSEMEM
  38. /*
  39. * Sparsemem definitions for RealView PBX.
  40. *
  41. * The RealView PBX board has another block of 512MB of RAM at 0x20000000,
  42. * however only the block at 0x70000000 (or the 256MB mirror at 0x00000000)
  43. * may be used for DMA.
  44. *
  45. * The macros below define a section size of 256MB and a non-linear virtual to
  46. * physical mapping:
  47. *
  48. * 256MB @ 0x00000000 -> PAGE_OFFSET
  49. * 512MB @ 0x20000000 -> PAGE_OFFSET + 0x10000000
  50. * 256MB @ 0x80000000 -> PAGE_OFFSET + 0x30000000
  51. */
  52. #ifdef CONFIG_REALVIEW_HIGH_PHYS_OFFSET
  53. #error "SPARSEMEM not available with REALVIEW_HIGH_PHYS_OFFSET"
  54. #endif
  55. #define MAX_PHYSMEM_BITS 32
  56. #define SECTION_SIZE_BITS 28
  57. /* bank page offsets */
  58. #define PAGE_OFFSET1 (PAGE_OFFSET + 0x10000000)
  59. #define PAGE_OFFSET2 (PAGE_OFFSET + 0x30000000)
  60. #define __phys_to_virt(phys) \
  61. ((phys) >= 0x80000000 ? (phys) - 0x80000000 + PAGE_OFFSET2 : \
  62. (phys) >= 0x20000000 ? (phys) - 0x20000000 + PAGE_OFFSET1 : \
  63. (phys) + PAGE_OFFSET)
  64. #define __virt_to_phys(virt) \
  65. ((virt) >= PAGE_OFFSET2 ? (virt) - PAGE_OFFSET2 + 0x80000000 : \
  66. (virt) >= PAGE_OFFSET1 ? (virt) - PAGE_OFFSET1 + 0x20000000 : \
  67. (virt) - PAGE_OFFSET)
  68. #endif /* CONFIG_SPARSEMEM */
  69. #endif