Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* $Id: pgalloc.h,v 1.16 2001/12/21 04:56:17 davem Exp $ */ |
| 2 | #ifndef _SPARC_PGALLOC_H |
| 3 | #define _SPARC_PGALLOC_H |
| 4 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | #include <linux/kernel.h> |
| 6 | #include <linux/sched.h> |
| 7 | |
| 8 | #include <asm/page.h> |
| 9 | #include <asm/btfixup.h> |
| 10 | |
| 11 | struct page; |
| 12 | |
| 13 | extern struct pgtable_cache_struct { |
| 14 | unsigned long *pgd_cache; |
| 15 | unsigned long *pte_cache; |
| 16 | unsigned long pgtable_cache_sz; |
| 17 | unsigned long pgd_cache_sz; |
| 18 | } pgt_quicklists; |
| 19 | #define pgd_quicklist (pgt_quicklists.pgd_cache) |
| 20 | #define pmd_quicklist ((unsigned long *)0) |
| 21 | #define pte_quicklist (pgt_quicklists.pte_cache) |
| 22 | #define pgtable_cache_size (pgt_quicklists.pgtable_cache_sz) |
| 23 | #define pgd_cache_size (pgt_quicklists.pgd_cache_sz) |
| 24 | |
| 25 | extern void check_pgt_cache(void); |
| 26 | BTFIXUPDEF_CALL(void, do_check_pgt_cache, int, int) |
| 27 | #define do_check_pgt_cache(low,high) BTFIXUP_CALL(do_check_pgt_cache)(low,high) |
| 28 | |
| 29 | BTFIXUPDEF_CALL(pgd_t *, get_pgd_fast, void) |
| 30 | #define get_pgd_fast() BTFIXUP_CALL(get_pgd_fast)() |
| 31 | |
| 32 | BTFIXUPDEF_CALL(void, free_pgd_fast, pgd_t *) |
| 33 | #define free_pgd_fast(pgd) BTFIXUP_CALL(free_pgd_fast)(pgd) |
| 34 | |
Benjamin Herrenschmidt | 5e54197 | 2008-02-04 22:29:14 -0800 | [diff] [blame] | 35 | #define pgd_free(mm, pgd) free_pgd_fast(pgd) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | #define pgd_alloc(mm) get_pgd_fast() |
| 37 | |
| 38 | BTFIXUPDEF_CALL(void, pgd_set, pgd_t *, pmd_t *) |
| 39 | #define pgd_set(pgdp,pmdp) BTFIXUP_CALL(pgd_set)(pgdp,pmdp) |
| 40 | #define pgd_populate(MM, PGD, PMD) pgd_set(PGD, PMD) |
| 41 | |
| 42 | BTFIXUPDEF_CALL(pmd_t *, pmd_alloc_one, struct mm_struct *, unsigned long) |
| 43 | #define pmd_alloc_one(mm, address) BTFIXUP_CALL(pmd_alloc_one)(mm, address) |
| 44 | |
| 45 | BTFIXUPDEF_CALL(void, free_pmd_fast, pmd_t *) |
| 46 | #define free_pmd_fast(pmd) BTFIXUP_CALL(free_pmd_fast)(pmd) |
| 47 | |
Benjamin Herrenschmidt | 5e54197 | 2008-02-04 22:29:14 -0800 | [diff] [blame] | 48 | #define pmd_free(mm, pmd) free_pmd_fast(pmd) |
| 49 | #define __pmd_free_tlb(tlb, pmd) pmd_free((tlb)->mm, pmd) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | |
| 51 | BTFIXUPDEF_CALL(void, pmd_populate, pmd_t *, struct page *) |
| 52 | #define pmd_populate(MM, PMD, PTE) BTFIXUP_CALL(pmd_populate)(PMD, PTE) |
Martin Schwidefsky | 2f569af | 2008-02-08 04:22:04 -0800 | [diff] [blame] | 53 | #define pmd_pgtable(pmd) pmd_page(pmd) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | BTFIXUPDEF_CALL(void, pmd_set, pmd_t *, pte_t *) |
| 55 | #define pmd_populate_kernel(MM, PMD, PTE) BTFIXUP_CALL(pmd_set)(PMD, PTE) |
| 56 | |
Martin Schwidefsky | 2f569af | 2008-02-08 04:22:04 -0800 | [diff] [blame] | 57 | BTFIXUPDEF_CALL(pgtable_t , pte_alloc_one, struct mm_struct *, unsigned long) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | #define pte_alloc_one(mm, address) BTFIXUP_CALL(pte_alloc_one)(mm, address) |
| 59 | BTFIXUPDEF_CALL(pte_t *, pte_alloc_one_kernel, struct mm_struct *, unsigned long) |
| 60 | #define pte_alloc_one_kernel(mm, addr) BTFIXUP_CALL(pte_alloc_one_kernel)(mm, addr) |
| 61 | |
| 62 | BTFIXUPDEF_CALL(void, free_pte_fast, pte_t *) |
Benjamin Herrenschmidt | 5e54197 | 2008-02-04 22:29:14 -0800 | [diff] [blame] | 63 | #define pte_free_kernel(mm, pte) BTFIXUP_CALL(free_pte_fast)(pte) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | |
Martin Schwidefsky | 2f569af | 2008-02-08 04:22:04 -0800 | [diff] [blame] | 65 | BTFIXUPDEF_CALL(void, pte_free, pgtable_t ) |
Benjamin Herrenschmidt | 5e54197 | 2008-02-04 22:29:14 -0800 | [diff] [blame] | 66 | #define pte_free(mm, pte) BTFIXUP_CALL(pte_free)(pte) |
| 67 | #define __pte_free_tlb(tlb, pte) pte_free((tlb)->mm, pte) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | |
| 69 | #endif /* _SPARC_PGALLOC_H */ |