pgtable-nopmd.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #ifndef _PGTABLE_NOPMD_H
  2. #define _PGTABLE_NOPMD_H
  3. #ifndef __ASSEMBLY__
  4. #include <asm-generic/pgtable-nopud.h>
  5. #define __PAGETABLE_PMD_FOLDED
  6. /*
  7. * Having the pmd type consist of a pud gets the size right, and allows
  8. * us to conceptually access the pud entry that this pmd is folded into
  9. * without casting.
  10. */
  11. typedef struct { pud_t pud; } pmd_t;
  12. #define PMD_SHIFT PUD_SHIFT
  13. #define PTRS_PER_PMD 1
  14. #define PMD_SIZE (1UL << PMD_SHIFT)
  15. #define PMD_MASK (~(PMD_SIZE-1))
  16. /*
  17. * The "pud_xxx()" functions here are trivial for a folded two-level
  18. * setup: the pmd is never bad, and a pmd always exists (as it's folded
  19. * into the pud entry)
  20. */
  21. static inline int pud_none(pud_t pud) { return 0; }
  22. static inline int pud_bad(pud_t pud) { return 0; }
  23. static inline int pud_present(pud_t pud) { return 1; }
  24. static inline void pud_clear(pud_t *pud) { }
  25. #define pmd_ERROR(pmd) (pud_ERROR((pmd).pud))
  26. #define pud_populate(mm, pmd, pte) do { } while (0)
  27. /*
  28. * (pmds are folded into puds so this doesn't get actually called,
  29. * but the define is needed for a generic inline function.)
  30. */
  31. #define set_pud(pudptr, pudval) set_pmd((pmd_t *)(pudptr), (pmd_t) { pudval })
  32. static inline pmd_t * pmd_offset(pud_t * pud, unsigned long address)
  33. {
  34. return (pmd_t *)pud;
  35. }
  36. #define pmd_val(x) (pud_val((x).pud))
  37. #define __pmd(x) ((pmd_t) { __pud(x) } )
  38. #define pud_page(pud) (pmd_page((pmd_t){ pud }))
  39. #define pud_page_vaddr(pud) (pmd_page_vaddr((pmd_t){ pud }))
  40. /*
  41. * allocating and freeing a pmd is trivial: the 1-entry pmd is
  42. * inside the pud, so has no extra memory associated with it.
  43. */
  44. #define pmd_alloc_one(mm, address) NULL
  45. #define pmd_free(x) do { } while (0)
  46. #define __pmd_free_tlb(tlb, x) do { } while (0)
  47. #undef pmd_addr_end
  48. #define pmd_addr_end(addr, end) (end)
  49. #endif /* __ASSEMBLY__ */
  50. #endif /* _PGTABLE_NOPMD_H */