spi-topcliff-pch: Fix issue for transmitting over 4KByte
[zen-stable.git] / arch / m68k / include / asm / mcf_pgalloc.h
blob313f3dd23cdc955f56af3fb581aa0e398d3a0f21
1 #ifndef M68K_MCF_PGALLOC_H
2 #define M68K_MCF_PGALLOC_H
4 #include <asm/tlb.h>
5 #include <asm/tlbflush.h>
7 extern inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
9 free_page((unsigned long) pte);
12 extern const char bad_pmd_string[];
14 extern inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
15 unsigned long address)
17 unsigned long page = __get_free_page(GFP_DMA|__GFP_REPEAT);
19 if (!page)
20 return NULL;
22 memset((void *)page, 0, PAGE_SIZE);
23 return (pte_t *) (page);
26 extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address)
28 return (pmd_t *) pgd;
31 #define pmd_alloc_one_fast(mm, address) ({ BUG(); ((pmd_t *)1); })
32 #define pmd_alloc_one(mm, address) ({ BUG(); ((pmd_t *)2); })
34 #define pte_alloc_one_fast(mm, addr) pte_alloc_one(mm, addr)
36 #define pmd_populate(mm, pmd, page) (pmd_val(*pmd) = \
37 (unsigned long)(page_address(page)))
39 #define pmd_populate_kernel(mm, pmd, pte) (pmd_val(*pmd) = (unsigned long)(pte))
41 #define pmd_pgtable(pmd) pmd_page(pmd)
43 static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t page,
44 unsigned long address)
46 __free_page(page);
49 #define __pmd_free_tlb(tlb, pmd, address) do { } while (0)
51 static inline struct page *pte_alloc_one(struct mm_struct *mm,
52 unsigned long address)
54 struct page *page = alloc_pages(GFP_DMA|__GFP_REPEAT, 0);
55 pte_t *pte;
57 if (!page)
58 return NULL;
60 pte = kmap(page);
61 if (pte) {
62 clear_page(pte);
63 __flush_page_to_ram(pte);
64 flush_tlb_kernel_page(pte);
65 nocache_page(pte);
67 kunmap(page);
69 return page;
72 extern inline void pte_free(struct mm_struct *mm, struct page *page)
74 __free_page(page);
78 * In our implementation, each pgd entry contains 1 pmd that is never allocated
79 * or freed. pgd_present is always 1, so this should never be called. -NL
81 #define pmd_free(mm, pmd) BUG()
83 static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
85 free_page((unsigned long) pgd);
88 static inline pgd_t *pgd_alloc(struct mm_struct *mm)
90 pgd_t *new_pgd;
92 new_pgd = (pgd_t *)__get_free_page(GFP_DMA | __GFP_NOWARN);
93 if (!new_pgd)
94 return NULL;
95 memcpy(new_pgd, swapper_pg_dir, PAGE_SIZE);
96 memset(new_pgd, 0, PAGE_OFFSET >> PGDIR_SHIFT);
97 return new_pgd;
100 #define pgd_populate(mm, pmd, pte) BUG()
102 #endif /* M68K_MCF_PGALLOC_H */