page_64.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. #ifndef _SPARC64_PAGE_H
  2. #define _SPARC64_PAGE_H
  3. #include <linux/const.h>
  4. #define PAGE_SHIFT 13
  5. #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
  6. #define PAGE_MASK (~(PAGE_SIZE-1))
  7. /* Flushing for D-cache alias handling is only needed if
  8. * the page size is smaller than 16K.
  9. */
  10. #if PAGE_SHIFT < 14
  11. #define DCACHE_ALIASING_POSSIBLE
  12. #endif
  13. #define HPAGE_SHIFT 23
  14. #define REAL_HPAGE_SHIFT 22
  15. #define REAL_HPAGE_SIZE (_AC(1,UL) << REAL_HPAGE_SHIFT)
  16. #if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
  17. #define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
  18. #define HPAGE_MASK (~(HPAGE_SIZE - 1UL))
  19. #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
  20. #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
  21. #define REAL_HPAGE_PER_HPAGE (_AC(1,UL) << (HPAGE_SHIFT - REAL_HPAGE_SHIFT))
  22. #endif
  23. #ifndef __ASSEMBLY__
  24. #if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
  25. struct pt_regs;
  26. void hugetlb_setup(struct pt_regs *regs);
  27. #endif
  28. #define WANT_PAGE_VIRTUAL
  29. void _clear_page(void *page);
  30. #define clear_page(X) _clear_page((void *)(X))
  31. struct page;
  32. void clear_user_page(void *addr, unsigned long vaddr, struct page *page);
  33. #define copy_page(X,Y) memcpy((void *)(X), (void *)(Y), PAGE_SIZE)
  34. void copy_user_page(void *to, void *from, unsigned long vaddr, struct page *topage);
  35. /* Unlike sparc32, sparc64's parameter passing API is more
  36. * sane in that structures which as small enough are passed
  37. * in registers instead of on the stack. Thus, setting
  38. * STRICT_MM_TYPECHECKS does not generate worse code so
  39. * let's enable it to get the type checking.
  40. */
  41. #define STRICT_MM_TYPECHECKS
  42. #ifdef STRICT_MM_TYPECHECKS
  43. /* These are used to make use of C type-checking.. */
  44. typedef struct { unsigned long pte; } pte_t;
  45. typedef struct { unsigned long iopte; } iopte_t;
  46. typedef struct { unsigned long pmd; } pmd_t;
  47. typedef struct { unsigned long pud; } pud_t;
  48. typedef struct { unsigned long pgd; } pgd_t;
  49. typedef struct { unsigned long pgprot; } pgprot_t;
  50. #define pte_val(x) ((x).pte)
  51. #define iopte_val(x) ((x).iopte)
  52. #define pmd_val(x) ((x).pmd)
  53. #define pud_val(x) ((x).pud)
  54. #define pgd_val(x) ((x).pgd)
  55. #define pgprot_val(x) ((x).pgprot)
  56. #define __pte(x) ((pte_t) { (x) } )
  57. #define __iopte(x) ((iopte_t) { (x) } )
  58. #define __pmd(x) ((pmd_t) { (x) } )
  59. #define __pud(x) ((pud_t) { (x) } )
  60. #define __pgd(x) ((pgd_t) { (x) } )
  61. #define __pgprot(x) ((pgprot_t) { (x) } )
  62. #else
  63. /* .. while these make it easier on the compiler */
  64. typedef unsigned long pte_t;
  65. typedef unsigned long iopte_t;
  66. typedef unsigned long pmd_t;
  67. typedef unsigned long pud_t;
  68. typedef unsigned long pgd_t;
  69. typedef unsigned long pgprot_t;
  70. #define pte_val(x) (x)
  71. #define iopte_val(x) (x)
  72. #define pmd_val(x) (x)
  73. #define pud_val(x) (x)
  74. #define pgd_val(x) (x)
  75. #define pgprot_val(x) (x)
  76. #define __pte(x) (x)
  77. #define __iopte(x) (x)
  78. #define __pmd(x) (x)
  79. #define __pud(x) (x)
  80. #define __pgd(x) (x)
  81. #define __pgprot(x) (x)
  82. #endif /* (STRICT_MM_TYPECHECKS) */
  83. typedef pte_t *pgtable_t;
  84. extern unsigned long sparc64_va_hole_top;
  85. extern unsigned long sparc64_va_hole_bottom;
  86. /* The next two defines specify the actual exclusion region we
  87. * enforce, wherein we use a 4GB red zone on each side of the VA hole.
  88. */
  89. #define VA_EXCLUDE_START (sparc64_va_hole_bottom - (1UL << 32UL))
  90. #define VA_EXCLUDE_END (sparc64_va_hole_top + (1UL << 32UL))
  91. #define TASK_UNMAPPED_BASE (test_thread_flag(TIF_32BIT) ? \
  92. _AC(0x0000000070000000,UL) : \
  93. VA_EXCLUDE_END)
  94. #include <asm-generic/memory_model.h>
  95. extern unsigned long PAGE_OFFSET;
  96. #endif /* !(__ASSEMBLY__) */
  97. /* The maximum number of physical memory address bits we support. The
  98. * largest value we can support is whatever "KPGD_SHIFT + KPTE_BITS"
  99. * evaluates to.
  100. */
  101. #define MAX_PHYS_ADDRESS_BITS 53
  102. #define ILOG2_4MB 22
  103. #define ILOG2_256MB 28
  104. #ifndef __ASSEMBLY__
  105. #define __pa(x) ((unsigned long)(x) - PAGE_OFFSET)
  106. #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
  107. #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
  108. #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr)>>PAGE_SHIFT)
  109. #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
  110. #define virt_to_phys __pa
  111. #define phys_to_virt __va
  112. #endif /* !(__ASSEMBLY__) */
  113. #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
  114. VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
  115. #include <asm-generic/getorder.h>
  116. #endif /* _SPARC64_PAGE_H */