RT-AC66 3.0.0.4.374.130 core
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / include / asm-blackfin / page.h
blobffad947f1b2a9c7884f7fea9efd65dedf82f64b7
1 #ifndef _BLACKFIN_PAGE_H
2 #define _BLACKFIN_PAGE_H
4 /* PAGE_SHIFT determines the page size */
6 #define PAGE_SHIFT 12
7 #define PAGE_SIZE (1UL << PAGE_SHIFT)
8 #define PAGE_MASK (~(PAGE_SIZE-1))
10 #ifdef __KERNEL__
12 #include <asm/setup.h>
14 #ifndef __ASSEMBLY__
16 #define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
17 #define free_user_page(page, addr) free_page(addr)
19 #define clear_page(page) memset((page), 0, PAGE_SIZE)
20 #define copy_page(to,from) memcpy((to), (from), PAGE_SIZE)
22 #define clear_user_page(page, vaddr,pg) clear_page(page)
23 #define copy_user_page(to, from, vaddr,pg) copy_page(to, from)
26 * These are used to make use of C type-checking..
28 typedef struct {
29 unsigned long pte;
30 } pte_t;
31 typedef struct {
32 unsigned long pmd[16];
33 } pmd_t;
34 typedef struct {
35 unsigned long pgd;
36 } pgd_t;
37 typedef struct {
38 unsigned long pgprot;
39 } pgprot_t;
41 #define pte_val(x) ((x).pte)
42 #define pmd_val(x) ((&x)->pmd[0])
43 #define pgd_val(x) ((x).pgd)
44 #define pgprot_val(x) ((x).pgprot)
46 #define __pte(x) ((pte_t) { (x) } )
47 #define __pmd(x) ((pmd_t) { (x) } )
48 #define __pgd(x) ((pgd_t) { (x) } )
49 #define __pgprot(x) ((pgprot_t) { (x) } )
51 /* to align the pointer to the (next) page boundary */
52 #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
54 extern unsigned long memory_start;
55 extern unsigned long memory_end;
57 #endif /* !__ASSEMBLY__ */
59 #include <asm/page_offset.h>
60 #include <asm/io.h>
62 #define PAGE_OFFSET (PAGE_OFFSET_RAW)
64 #ifndef __ASSEMBLY__
66 #define __pa(vaddr) virt_to_phys((void *)(vaddr))
67 #define __va(paddr) phys_to_virt((unsigned long)(paddr))
69 #define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)
71 #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
72 #define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
73 #define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT))
74 #define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
75 #define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
77 #define pfn_to_page(pfn) virt_to_page(pfn_to_virt(pfn))
78 #define page_to_pfn(page) virt_to_pfn(page_to_virt(page))
79 #define pfn_valid(pfn) ((pfn) < max_mapnr)
81 #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
82 ((void *)(kaddr) < (void *)memory_end))
84 #include <asm-generic/page.h>
86 #endif /* __ASSEMBLY__ */
87 #endif /* __KERNEL__ */
89 #endif /* _BLACKFIN_PAGE_H */