drivers/misc/sgi-xp: replace partid_t with a short
[linux-2.6/openmoko-kernel/knife-kernel.git] / include / asm-blackfin / page.h
blobc7db0220fbd6dd74d7a8b97a4bae4fe801fdfc25
1 #ifndef _BLACKFIN_PAGE_H
2 #define _BLACKFIN_PAGE_H
4 /* PAGE_SHIFT determines the page size */
6 #define PAGE_SHIFT 12
7 #ifdef __ASSEMBLY__
8 #define PAGE_SIZE (1 << PAGE_SHIFT)
9 #else
10 #define PAGE_SIZE (1UL << PAGE_SHIFT)
11 #endif
12 #define PAGE_MASK (~(PAGE_SIZE-1))
14 #include <asm/setup.h>
16 #ifndef __ASSEMBLY__
18 #define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
19 #define free_user_page(page, addr) free_page(addr)
21 #define clear_page(page) memset((page), 0, PAGE_SIZE)
22 #define copy_page(to,from) memcpy((to), (from), PAGE_SIZE)
24 #define clear_user_page(page, vaddr,pg) clear_page(page)
25 #define copy_user_page(to, from, vaddr,pg) copy_page(to, from)
28 * These are used to make use of C type-checking..
30 typedef struct {
31 unsigned long pte;
32 } pte_t;
33 typedef struct {
34 unsigned long pmd[16];
35 } pmd_t;
36 typedef struct {
37 unsigned long pgd;
38 } pgd_t;
39 typedef struct {
40 unsigned long pgprot;
41 } pgprot_t;
42 typedef struct page *pgtable_t;
44 #define pte_val(x) ((x).pte)
45 #define pmd_val(x) ((&x)->pmd[0])
46 #define pgd_val(x) ((x).pgd)
47 #define pgprot_val(x) ((x).pgprot)
49 #define __pte(x) ((pte_t) { (x) } )
50 #define __pmd(x) ((pmd_t) { (x) } )
51 #define __pgd(x) ((pgd_t) { (x) } )
52 #define __pgprot(x) ((pgprot_t) { (x) } )
54 /* to align the pointer to the (next) page boundary */
55 #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
57 extern unsigned long memory_start;
58 extern unsigned long memory_end;
60 #endif /* !__ASSEMBLY__ */
62 #include <asm/page_offset.h>
63 #include <asm/io.h>
65 #define PAGE_OFFSET (PAGE_OFFSET_RAW)
67 #ifndef __ASSEMBLY__
69 #define __pa(vaddr) virt_to_phys((void *)(vaddr))
70 #define __va(paddr) phys_to_virt((unsigned long)(paddr))
72 #define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)
74 #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
75 #define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
76 #define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT))
77 #define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
78 #define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
80 #define pfn_to_page(pfn) virt_to_page(pfn_to_virt(pfn))
81 #define page_to_pfn(page) virt_to_pfn(page_to_virt(page))
82 #define pfn_valid(pfn) ((pfn) < max_mapnr)
84 #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
85 ((void *)(kaddr) < (void *)memory_end))
87 #include <asm-generic/page.h>
89 #endif /* __ASSEMBLY__ */
91 #endif /* _BLACKFIN_PAGE_H */