Linux Audio

Check our new training course

Loading...
v3.5.6
 1#ifndef _SPARC_PGALLOC_H
 2#define _SPARC_PGALLOC_H
 3
 4#include <linux/kernel.h>
 5#include <linux/sched.h>
 6
 7#include <asm/pgtsrmmu.h>
 8#include <asm/pgtable.h>
 9#include <asm/vaddrs.h>
10#include <asm/page.h>
 
11
12struct page;
13
14extern struct pgtable_cache_struct {
15	unsigned long *pgd_cache;
16	unsigned long *pte_cache;
17	unsigned long pgtable_cache_sz;
18	unsigned long pgd_cache_sz;
19} pgt_quicklists;
20
21unsigned long srmmu_get_nocache(int size, int align);
22void srmmu_free_nocache(unsigned long vaddr, int size);
23
24#define pgd_quicklist           (pgt_quicklists.pgd_cache)
25#define pmd_quicklist           ((unsigned long *)0)
26#define pte_quicklist           (pgt_quicklists.pte_cache)
27#define pgtable_cache_size      (pgt_quicklists.pgtable_cache_sz)
28#define pgd_cache_size		(pgt_quicklists.pgd_cache_sz)
29
30#define check_pgt_cache()	do { } while (0)
 
 
 
 
 
31
32pgd_t *get_pgd_fast(void);
33static inline void free_pgd_fast(pgd_t *pgd)
34{
35	srmmu_free_nocache((unsigned long)pgd, SRMMU_PGD_TABLE_SIZE);
36}
37
38#define pgd_free(mm, pgd)	free_pgd_fast(pgd)
39#define pgd_alloc(mm)	get_pgd_fast()
40
41static inline void pgd_set(pgd_t * pgdp, pmd_t * pmdp)
42{
43	unsigned long pa = __nocache_pa((unsigned long)pmdp);
44
45	set_pte((pte_t *)pgdp, (SRMMU_ET_PTD | (pa >> 4)));
46}
47
48#define pgd_populate(MM, PGD, PMD)      pgd_set(PGD, PMD)
49
50static inline pmd_t *pmd_alloc_one(struct mm_struct *mm,
51				   unsigned long address)
52{
53	return (pmd_t *)srmmu_get_nocache(SRMMU_PMD_TABLE_SIZE,
54					  SRMMU_PMD_TABLE_SIZE);
55}
56
57static inline void free_pmd_fast(pmd_t * pmd)
58{
59	srmmu_free_nocache((unsigned long)pmd, SRMMU_PMD_TABLE_SIZE);
60}
61
62#define pmd_free(mm, pmd)		free_pmd_fast(pmd)
63#define __pmd_free_tlb(tlb, pmd, addr)	pmd_free((tlb)->mm, pmd)
64
65void pmd_populate(struct mm_struct *mm, pmd_t *pmdp, struct page *ptep);
 
66#define pmd_pgtable(pmd) pmd_page(pmd)
 
 
67
68void pmd_set(pmd_t *pmdp, pte_t *ptep);
69#define pmd_populate_kernel(MM, PMD, PTE) pmd_set(PMD, PTE)
70
71pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address);
72
73static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
74					  unsigned long address)
75{
76	return (pte_t *)srmmu_get_nocache(PTE_SIZE, PTE_SIZE);
77}
78
79
80static inline void free_pte_fast(pte_t *pte)
81{
82	srmmu_free_nocache((unsigned long)pte, PTE_SIZE);
83}
84
85#define pte_free_kernel(mm, pte)	free_pte_fast(pte)
 
86
87void pte_free(struct mm_struct * mm, pgtable_t pte);
 
88#define __pte_free_tlb(tlb, pte, addr)	pte_free((tlb)->mm, pte)
89
90#endif /* _SPARC_PGALLOC_H */
v3.1
 1#ifndef _SPARC_PGALLOC_H
 2#define _SPARC_PGALLOC_H
 3
 4#include <linux/kernel.h>
 5#include <linux/sched.h>
 6
 
 
 
 7#include <asm/page.h>
 8#include <asm/btfixup.h>
 9
10struct page;
11
12extern struct pgtable_cache_struct {
13	unsigned long *pgd_cache;
14	unsigned long *pte_cache;
15	unsigned long pgtable_cache_sz;
16	unsigned long pgd_cache_sz;
17} pgt_quicklists;
 
 
 
 
18#define pgd_quicklist           (pgt_quicklists.pgd_cache)
19#define pmd_quicklist           ((unsigned long *)0)
20#define pte_quicklist           (pgt_quicklists.pte_cache)
21#define pgtable_cache_size      (pgt_quicklists.pgtable_cache_sz)
22#define pgd_cache_size		(pgt_quicklists.pgd_cache_sz)
23
24extern void check_pgt_cache(void);
25BTFIXUPDEF_CALL(void,	 do_check_pgt_cache, int, int)
26#define do_check_pgt_cache(low,high) BTFIXUP_CALL(do_check_pgt_cache)(low,high)
27
28BTFIXUPDEF_CALL(pgd_t *, get_pgd_fast, void)
29#define get_pgd_fast()		BTFIXUP_CALL(get_pgd_fast)()
30
31BTFIXUPDEF_CALL(void, free_pgd_fast, pgd_t *)
32#define free_pgd_fast(pgd)	BTFIXUP_CALL(free_pgd_fast)(pgd)
 
 
 
33
34#define pgd_free(mm, pgd)	free_pgd_fast(pgd)
35#define pgd_alloc(mm)	get_pgd_fast()
36
37BTFIXUPDEF_CALL(void, pgd_set, pgd_t *, pmd_t *)
38#define pgd_set(pgdp,pmdp) BTFIXUP_CALL(pgd_set)(pgdp,pmdp)
 
 
 
 
 
39#define pgd_populate(MM, PGD, PMD)      pgd_set(PGD, PMD)
40
41BTFIXUPDEF_CALL(pmd_t *, pmd_alloc_one, struct mm_struct *, unsigned long)
42#define pmd_alloc_one(mm, address)	BTFIXUP_CALL(pmd_alloc_one)(mm, address)
43
44BTFIXUPDEF_CALL(void, free_pmd_fast, pmd_t *)
45#define free_pmd_fast(pmd)	BTFIXUP_CALL(free_pmd_fast)(pmd)
 
 
 
 
 
 
46
47#define pmd_free(mm, pmd)		free_pmd_fast(pmd)
48#define __pmd_free_tlb(tlb, pmd, addr)	pmd_free((tlb)->mm, pmd)
49
50BTFIXUPDEF_CALL(void, pmd_populate, pmd_t *, struct page *)
51#define pmd_populate(MM, PMD, PTE)        BTFIXUP_CALL(pmd_populate)(PMD, PTE)
52#define pmd_pgtable(pmd) pmd_page(pmd)
53BTFIXUPDEF_CALL(void, pmd_set, pmd_t *, pte_t *)
54#define pmd_populate_kernel(MM, PMD, PTE) BTFIXUP_CALL(pmd_set)(PMD, PTE)
55
56BTFIXUPDEF_CALL(pgtable_t , pte_alloc_one, struct mm_struct *, unsigned long)
57#define pte_alloc_one(mm, address)	BTFIXUP_CALL(pte_alloc_one)(mm, address)
58BTFIXUPDEF_CALL(pte_t *, pte_alloc_one_kernel, struct mm_struct *, unsigned long)
59#define pte_alloc_one_kernel(mm, addr)	BTFIXUP_CALL(pte_alloc_one_kernel)(mm, addr)
 
 
 
 
 
 
 
 
 
 
 
 
60
61BTFIXUPDEF_CALL(void, free_pte_fast, pte_t *)
62#define pte_free_kernel(mm, pte)	BTFIXUP_CALL(free_pte_fast)(pte)
63
64BTFIXUPDEF_CALL(void, pte_free, pgtable_t )
65#define pte_free(mm, pte)		BTFIXUP_CALL(pte_free)(pte)
66#define __pte_free_tlb(tlb, pte, addr)	pte_free((tlb)->mm, pte)
67
68#endif /* _SPARC_PGALLOC_H */