rtl8366_smi: implement a function for detecting whether the attached switch is RTL836...
[openwrt.git] / target / linux / coldfire / files-2.6.31 / arch / m68k / include / asm / cf_pgalloc.h
1 /*
2 * Copyright 2007-2009 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
5 #ifndef M68K_CF_PGALLOC_H
6 #define M68K_CF_PGALLOC_H
7 #include <linux/highmem.h>
8 #include <asm/coldfire.h>
9 #include <asm/page.h>
10 #include <asm/cf_tlbflush.h>
11 #include <asm/cf_cacheflush.h>
12
13 extern inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
14 {
15 free_page((unsigned long) pte);
16 }
17
18 extern const char bad_pmd_string[];
19
20 extern inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
21 unsigned long address)
22 {
23 unsigned long page = __get_free_page(GFP_KERNEL|__GFP_REPEAT);
24
25 if (!page)
26 return NULL;
27
28 memset((void *)page, 0, PAGE_SIZE);
29 return (pte_t *) (page);
30 }
31
32 extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address)
33 {
34 return (pmd_t *) pgd;
35 }
36
37 #define pmd_alloc_one_fast(mm, address) ({ BUG(); ((pmd_t *)1); })
38 #define pmd_alloc_one(mm, address) ({ BUG(); ((pmd_t *)2); })
39
40 #define pte_alloc_one_fast(mm, addr) pte_alloc_one(mm, addr)
41
42 #define pmd_populate(mm, pmd, page) (pmd_val(*pmd) = \
43 (unsigned long)(page_address(page)))
44
45 #define pmd_populate_kernel(mm, pmd, pte) (pmd_val(*pmd) = (unsigned long)(pte))
46
47 #define pmd_pgtable(pmd) pmd_page(pmd)
48
49 static inline void __pte_free_tlb(struct mmu_gather *tlb, struct page *page, unsigned long address)
50 {
51 __free_page(page);
52 }
53
54 #define __pmd_free_tlb(tlb, pmd, addr) do { } while (0)
55
56 static inline struct page *pte_alloc_one(struct mm_struct *mm,
57 unsigned long address)
58 {
59 struct page *page = alloc_pages(GFP_KERNEL|__GFP_REPEAT, 0);
60 pte_t *pte;
61
62 if (!page)
63 return NULL;
64
65 pte = kmap(page);
66 // if (pte) {
67 clear_page(pte);
68 __flush_page_to_ram(pte);
69 flush_tlb_kernel_page(pte);
70 nocache_page(pte);
71 // }
72 kunmap(page);
73
74 return page;
75 }
76
77 extern inline void pte_free(struct mm_struct *mm, struct page *page)
78 {
79 __free_page(page);
80 }
81
82 /*
83 * In our implementation, each pgd entry contains 1 pmd that is never allocated
84 * or freed. pgd_present is always 1, so this should never be called. -NL
85 */
86 #define pmd_free(mm, pmd) BUG()
87
88 extern inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
89 {
90 free_page((unsigned long) pgd);
91 }
92
93 extern inline pgd_t *pgd_alloc(struct mm_struct *mm)
94 {
95 pgd_t *new_pgd;
96
97 new_pgd = (pgd_t *)__get_free_page(GFP_KERNEL | __GFP_NOWARN);
98 if (!new_pgd)
99 return NULL;
100 memcpy(new_pgd, swapper_pg_dir, PAGE_SIZE);
101 memset(new_pgd, 0, PAGE_OFFSET >> PGDIR_SHIFT);
102 return new_pgd;
103 }
104
105 #define pgd_populate(mm, pmd, pte) BUG()
106
107 #endif /* M68K_CF_PGALLOC_H */
This page took 0.048831 seconds and 5 git commands to generate.