pgtable.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. * Copyright 2004-2009 Analog Devices Inc.
  3. *
  4. * Licensed under the GPL-2 or later.
  5. */
  6. #ifndef _BLACKFIN_PGTABLE_H
  7. #define _BLACKFIN_PGTABLE_H
  8. #include <asm-generic/4level-fixup.h>
  9. #include <asm/page.h>
  10. #include <asm/def_LPBlackfin.h>
  11. typedef pte_t *pte_addr_t;
  12. /*
  13. * Trivial page table functions.
  14. */
  15. #define pgd_present(pgd) (1)
  16. #define pgd_none(pgd) (0)
  17. #define pgd_bad(pgd) (0)
  18. #define pgd_clear(pgdp)
  19. #define kern_addr_valid(addr) (1)
  20. #define pmd_offset(a, b) ((void *)0)
  21. #define pmd_none(x) (!pmd_val(x))
  22. #define pmd_present(x) (pmd_val(x))
  23. #define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0)
  24. #define pmd_bad(x) (pmd_val(x) & ~PAGE_MASK)
  25. #define kern_addr_valid(addr) (1)
  26. #define PAGE_NONE __pgprot(0) /* these mean nothing to NO_MM */
  27. #define PAGE_SHARED __pgprot(0) /* these mean nothing to NO_MM */
  28. #define PAGE_COPY __pgprot(0) /* these mean nothing to NO_MM */
  29. #define PAGE_READONLY __pgprot(0) /* these mean nothing to NO_MM */
  30. #define PAGE_KERNEL __pgprot(0) /* these mean nothing to NO_MM */
  31. #define pgprot_noncached(prot) (prot)
  32. extern void paging_init(void);
  33. #define __swp_type(x) (0)
  34. #define __swp_offset(x) (0)
  35. #define __swp_entry(typ,off) ((swp_entry_t) { ((typ) | ((off) << 7)) })
  36. #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
  37. #define __swp_entry_to_pte(x) ((pte_t) { (x).val })
  38. static inline int pte_file(pte_t pte)
  39. {
  40. return 0;
  41. }
  42. #define set_pte(pteptr, pteval) (*(pteptr) = pteval)
  43. #define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval)
  44. /*
  45. * Page assess control based on Blackfin CPLB management
  46. */
  47. #define _PAGE_RD (CPLB_USER_RD)
  48. #define _PAGE_WR (CPLB_USER_WR)
  49. #define _PAGE_USER (CPLB_USER_RD | CPLB_USER_WR)
  50. #define _PAGE_ACCESSED CPLB_ALL_ACCESS
  51. #define _PAGE_DIRTY (CPLB_DIRTY)
  52. #define PTE_BIT_FUNC(fn, op) \
  53. static inline pte_t pte_##fn(pte_t _pte) { _pte.pte op; return _pte; }
  54. PTE_BIT_FUNC(rdprotect, &= ~_PAGE_RD);
  55. PTE_BIT_FUNC(mkread, |= _PAGE_RD);
  56. PTE_BIT_FUNC(wrprotect, &= ~_PAGE_WR);
  57. PTE_BIT_FUNC(mkwrite, |= _PAGE_WR);
  58. PTE_BIT_FUNC(exprotect, &= ~_PAGE_USER);
  59. PTE_BIT_FUNC(mkexec, |= _PAGE_USER);
  60. PTE_BIT_FUNC(mkclean, &= ~_PAGE_DIRTY);
  61. PTE_BIT_FUNC(mkdirty, |= _PAGE_DIRTY);
  62. PTE_BIT_FUNC(mkold, &= ~_PAGE_ACCESSED);
  63. PTE_BIT_FUNC(mkyoung, |= _PAGE_ACCESSED);
  64. /*
  65. * ZERO_PAGE is a global shared page that is always zero: used
  66. * for zero-mapped memory areas etc..
  67. */
  68. #define ZERO_PAGE(vaddr) virt_to_page(empty_zero_page)
  69. extern char empty_zero_page[];
  70. extern unsigned int kobjsize(const void *objp);
  71. #define swapper_pg_dir ((pgd_t *) 0)
  72. /*
  73. * No page table caches to initialise.
  74. */
  75. #define pgtable_cache_init() do { } while (0)
  76. #define io_remap_pfn_range remap_pfn_range
  77. /*
  78. * All 32bit addresses are effectively valid for vmalloc...
  79. * Sort of meaningless for non-VM targets.
  80. */
  81. #define VMALLOC_START 0
  82. #define VMALLOC_END 0xffffffff
  83. /* provide a special get_unmapped_area for framebuffer mmaps of nommu */
  84. extern unsigned long get_fb_unmapped_area(struct file *filp, unsigned long,
  85. unsigned long, unsigned long,
  86. unsigned long);
  87. #define HAVE_ARCH_FB_UNMAPPED_AREA
  88. #include <asm-generic/pgtable.h>
  89. #endif /* _BLACKFIN_PGTABLE_H */