pgtable.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #ifndef _BLACKFIN_PGTABLE_H
  2. #define _BLACKFIN_PGTABLE_H
  3. #include <asm-generic/4level-fixup.h>
  4. #include <asm/page.h>
  5. #include <asm/def_LPBlackfin.h>
  6. typedef pte_t *pte_addr_t;
  7. /*
  8. * Trivial page table functions.
  9. */
  10. #define pgd_present(pgd) (1)
  11. #define pgd_none(pgd) (0)
  12. #define pgd_bad(pgd) (0)
  13. #define pgd_clear(pgdp)
  14. #define kern_addr_valid(addr) (1)
  15. #define pmd_offset(a, b) ((void *)0)
  16. #define pmd_none(x) (!pmd_val(x))
  17. #define pmd_present(x) (pmd_val(x))
  18. #define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0)
  19. #define pmd_bad(x) (pmd_val(x) & ~PAGE_MASK)
  20. #define kern_addr_valid(addr) (1)
  21. #define PAGE_NONE __pgprot(0) /* these mean nothing to NO_MM */
  22. #define PAGE_SHARED __pgprot(0) /* these mean nothing to NO_MM */
  23. #define PAGE_COPY __pgprot(0) /* these mean nothing to NO_MM */
  24. #define PAGE_READONLY __pgprot(0) /* these mean nothing to NO_MM */
  25. #define PAGE_KERNEL __pgprot(0) /* these mean nothing to NO_MM */
  26. #define pgprot_noncached(prot) (prot)
  27. extern void paging_init(void);
  28. #define __swp_type(x) (0)
  29. #define __swp_offset(x) (0)
  30. #define __swp_entry(typ,off) ((swp_entry_t) { ((typ) | ((off) << 7)) })
  31. #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
  32. #define __swp_entry_to_pte(x) ((pte_t) { (x).val })
  33. static inline int pte_file(pte_t pte)
  34. {
  35. return 0;
  36. }
  37. #define set_pte(pteptr, pteval) (*(pteptr) = pteval)
  38. #define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval)
  39. /*
  40. * Page assess control based on Blackfin CPLB management
  41. */
  42. #define _PAGE_RD (CPLB_USER_RD)
  43. #define _PAGE_WR (CPLB_USER_WR)
  44. #define _PAGE_USER (CPLB_USER_RD | CPLB_USER_WR)
  45. #define _PAGE_ACCESSED CPLB_ALL_ACCESS
  46. #define _PAGE_DIRTY (CPLB_DIRTY)
  47. #define PTE_BIT_FUNC(fn, op) \
  48. static inline pte_t pte_##fn(pte_t _pte) { _pte.pte op; return _pte; }
  49. PTE_BIT_FUNC(rdprotect, &= ~_PAGE_RD);
  50. PTE_BIT_FUNC(mkread, |= _PAGE_RD);
  51. PTE_BIT_FUNC(wrprotect, &= ~_PAGE_WR);
  52. PTE_BIT_FUNC(mkwrite, |= _PAGE_WR);
  53. PTE_BIT_FUNC(exprotect, &= ~_PAGE_USER);
  54. PTE_BIT_FUNC(mkexec, |= _PAGE_USER);
  55. PTE_BIT_FUNC(mkclean, &= ~_PAGE_DIRTY);
  56. PTE_BIT_FUNC(mkdirty, |= _PAGE_DIRTY);
  57. PTE_BIT_FUNC(mkold, &= ~_PAGE_ACCESSED);
  58. PTE_BIT_FUNC(mkyoung, |= _PAGE_ACCESSED);
  59. /*
  60. * ZERO_PAGE is a global shared page that is always zero: used
  61. * for zero-mapped memory areas etc..
  62. */
  63. #define ZERO_PAGE(vaddr) (virt_to_page(0))
  64. extern unsigned int kobjsize(const void *objp);
  65. #define swapper_pg_dir ((pgd_t *) 0)
  66. /*
  67. * No page table caches to initialise.
  68. */
  69. #define pgtable_cache_init() do { } while (0)
  70. #define io_remap_pfn_range remap_pfn_range
  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. #include <asm-generic/pgtable.h>
  78. #endif /* _BLACKFIN_PGTABLE_H */