pgalloc_32.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #ifndef _SPARC_PGALLOC_H
  2. #define _SPARC_PGALLOC_H
  3. #include <linux/kernel.h>
  4. #include <linux/sched.h>
  5. #include <asm/pgtsrmmu.h>
  6. #include <asm/pgtable.h>
  7. #include <asm/vaddrs.h>
  8. #include <asm/page.h>
  9. struct page;
  10. void *srmmu_get_nocache(int size, int align);
  11. void srmmu_free_nocache(void *addr, int size);
  12. extern struct resource sparc_iomap;
  13. #define check_pgt_cache() do { } while (0)
  14. pgd_t *get_pgd_fast(void);
  15. static inline void free_pgd_fast(pgd_t *pgd)
  16. {
  17. srmmu_free_nocache(pgd, SRMMU_PGD_TABLE_SIZE);
  18. }
  19. #define pgd_free(mm, pgd) free_pgd_fast(pgd)
  20. #define pgd_alloc(mm) get_pgd_fast()
  21. static inline void pgd_set(pgd_t * pgdp, pmd_t * pmdp)
  22. {
  23. unsigned long pa = __nocache_pa((unsigned long)pmdp);
  24. set_pte((pte_t *)pgdp, (SRMMU_ET_PTD | (pa >> 4)));
  25. }
  26. #define pgd_populate(MM, PGD, PMD) pgd_set(PGD, PMD)
  27. static inline pmd_t *pmd_alloc_one(struct mm_struct *mm,
  28. unsigned long address)
  29. {
  30. return srmmu_get_nocache(SRMMU_PMD_TABLE_SIZE,
  31. SRMMU_PMD_TABLE_SIZE);
  32. }
  33. static inline void free_pmd_fast(pmd_t * pmd)
  34. {
  35. srmmu_free_nocache(pmd, SRMMU_PMD_TABLE_SIZE);
  36. }
  37. #define pmd_free(mm, pmd) free_pmd_fast(pmd)
  38. #define __pmd_free_tlb(tlb, pmd, addr) pmd_free((tlb)->mm, pmd)
  39. void pmd_populate(struct mm_struct *mm, pmd_t *pmdp, struct page *ptep);
  40. #define pmd_pgtable(pmd) pmd_page(pmd)
  41. void pmd_set(pmd_t *pmdp, pte_t *ptep);
  42. #define pmd_populate_kernel(MM, PMD, PTE) pmd_set(PMD, PTE)
  43. pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address);
  44. static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
  45. unsigned long address)
  46. {
  47. return srmmu_get_nocache(PTE_SIZE, PTE_SIZE);
  48. }
  49. static inline void free_pte_fast(pte_t *pte)
  50. {
  51. srmmu_free_nocache(pte, PTE_SIZE);
  52. }
  53. #define pte_free_kernel(mm, pte) free_pte_fast(pte)
  54. void pte_free(struct mm_struct * mm, pgtable_t pte);
  55. #define __pte_free_tlb(tlb, pte, addr) pte_free((tlb)->mm, pte)
  56. #endif /* _SPARC_PGALLOC_H */