pgtable.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. #define set_pte(pteptr, pteval) (*(pteptr) = pteval)
  39. #define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval)
  40. /*
  41. * Page assess control based on Blackfin CPLB management
  42. */
  43. #define _PAGE_RD (CPLB_USER_RD)
  44. #define _PAGE_WR (CPLB_USER_WR)
  45. #define _PAGE_USER (CPLB_USER_RD | CPLB_USER_WR)
  46. #define _PAGE_ACCESSED CPLB_ALL_ACCESS
  47. #define _PAGE_DIRTY (CPLB_DIRTY)
  48. #define PTE_BIT_FUNC(fn, op) \
  49. static inline pte_t pte_##fn(pte_t _pte) { _pte.pte op; return _pte; }
  50. PTE_BIT_FUNC(rdprotect, &= ~_PAGE_RD);
  51. PTE_BIT_FUNC(mkread, |= _PAGE_RD);
  52. PTE_BIT_FUNC(wrprotect, &= ~_PAGE_WR);
  53. PTE_BIT_FUNC(mkwrite, |= _PAGE_WR);
  54. PTE_BIT_FUNC(exprotect, &= ~_PAGE_USER);
  55. PTE_BIT_FUNC(mkexec, |= _PAGE_USER);
  56. PTE_BIT_FUNC(mkclean, &= ~_PAGE_DIRTY);
  57. PTE_BIT_FUNC(mkdirty, |= _PAGE_DIRTY);
  58. PTE_BIT_FUNC(mkold, &= ~_PAGE_ACCESSED);
  59. PTE_BIT_FUNC(mkyoung, |= _PAGE_ACCESSED);
  60. /*
  61. * ZERO_PAGE is a global shared page that is always zero: used
  62. * for zero-mapped memory areas etc..
  63. */
  64. #define ZERO_PAGE(vaddr) virt_to_page(empty_zero_page)
  65. extern char empty_zero_page[];
  66. #define swapper_pg_dir ((pgd_t *) 0)
  67. /*
  68. * No page table caches to initialise.
  69. */
  70. #define pgtable_cache_init() do { } while (0)
  71. /*
  72. * All 32bit addresses are effectively valid for vmalloc...
  73. * Sort of meaningless for non-VM targets.
  74. */
  75. #define VMALLOC_START 0
  76. #define VMALLOC_END 0xffffffff
  77. /* provide a special get_unmapped_area for framebuffer mmaps of nommu */
  78. extern unsigned long get_fb_unmapped_area(struct file *filp, unsigned long,
  79. unsigned long, unsigned long,
  80. unsigned long);
  81. #define HAVE_ARCH_FB_UNMAPPED_AREA
  82. #define pgprot_writecombine pgprot_noncached
  83. #include <asm-generic/pgtable.h>
  84. #endif /* _BLACKFIN_PGTABLE_H */