[PATCH] ucb1400_ts depends SND_AC97_BUS
[linux-2.6/openmoko-kernel.git] / include / asm-parisc / page.h
blob3567208191e37d09f47199a26a0a223dce1b6c28
1 #ifndef _PARISC_PAGE_H
2 #define _PARISC_PAGE_H
4 #ifdef __KERNEL__
6 #if defined(CONFIG_PARISC_PAGE_SIZE_4KB)
7 # define PAGE_SHIFT 12
8 #elif defined(CONFIG_PARISC_PAGE_SIZE_16KB)
9 # define PAGE_SHIFT 14
10 #elif defined(CONFIG_PARISC_PAGE_SIZE_64KB)
11 # define PAGE_SHIFT 16
12 #else
13 # error "unknown default kernel page size"
14 #endif
15 #define PAGE_SIZE (1UL << PAGE_SHIFT)
16 #define PAGE_MASK (~(PAGE_SIZE-1))
19 #ifndef __ASSEMBLY__
21 #include <asm/types.h>
22 #include <asm/cache.h>
24 #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
25 #define copy_page(to,from) copy_user_page_asm((void *)(to), (void *)(from))
27 struct page;
29 void copy_user_page_asm(void *to, void *from);
30 void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
31 struct page *pg);
32 void clear_user_page(void *page, unsigned long vaddr, struct page *pg);
35 * These are used to make use of C type-checking..
37 #define STRICT_MM_TYPECHECKS
38 #ifdef STRICT_MM_TYPECHECKS
39 typedef struct { unsigned long pte;
40 #if !defined(CONFIG_64BIT)
41 unsigned long future_flags;
42 /* XXX: it's possible to remove future_flags and change BITS_PER_PTE_ENTRY
43 to 2, but then strangely the identical 32bit kernel boots on a
44 c3000(pa20), but not any longer on a 715(pa11).
45 Still investigating... HelgeD.
47 #endif
48 } pte_t; /* either 32 or 64bit */
50 /* NOTE: even on 64 bits, these entries are __u32 because we allocate
51 * the pmd and pgd in ZONE_DMA (i.e. under 4GB) */
52 typedef struct { __u32 pmd; } pmd_t;
53 typedef struct { __u32 pgd; } pgd_t;
54 typedef struct { unsigned long pgprot; } pgprot_t;
56 #define pte_val(x) ((x).pte)
57 /* These do not work lvalues, so make sure we don't use them as such. */
58 #define pmd_val(x) ((x).pmd + 0)
59 #define pgd_val(x) ((x).pgd + 0)
60 #define pgprot_val(x) ((x).pgprot)
62 #define __pte(x) ((pte_t) { (x) } )
63 #define __pmd(x) ((pmd_t) { (x) } )
64 #define __pgd(x) ((pgd_t) { (x) } )
65 #define __pgprot(x) ((pgprot_t) { (x) } )
67 #define __pmd_val_set(x,n) (x).pmd = (n)
68 #define __pgd_val_set(x,n) (x).pgd = (n)
70 #else
72 * .. while these make it easier on the compiler
74 typedef unsigned long pte_t;
75 typedef __u32 pmd_t;
76 typedef __u32 pgd_t;
77 typedef unsigned long pgprot_t;
79 #define pte_val(x) (x)
80 #define pmd_val(x) (x)
81 #define pgd_val(x) (x)
82 #define pgprot_val(x) (x)
84 #define __pte(x) (x)
85 #define __pmd(x) (x)
86 #define __pgd(x) (x)
87 #define __pgprot(x) (x)
89 #define __pmd_val_set(x,n) (x) = (n)
90 #define __pgd_val_set(x,n) (x) = (n)
92 #endif /* STRICT_MM_TYPECHECKS */
95 typedef struct __physmem_range {
96 unsigned long start_pfn;
97 unsigned long pages; /* PAGE_SIZE pages */
98 } physmem_range_t;
100 extern physmem_range_t pmem_ranges[];
101 extern int npmem_ranges;
103 #endif /* !__ASSEMBLY__ */
105 /* WARNING: The definitions below must match exactly to sizeof(pte_t)
106 * etc
108 #ifdef __LP64__
109 #define BITS_PER_PTE_ENTRY 3
110 #define BITS_PER_PMD_ENTRY 2
111 #define BITS_PER_PGD_ENTRY 2
112 #else
113 #define BITS_PER_PTE_ENTRY 3
114 #define BITS_PER_PMD_ENTRY 2
115 #define BITS_PER_PGD_ENTRY BITS_PER_PMD_ENTRY
116 #endif
117 #define PGD_ENTRY_SIZE (1UL << BITS_PER_PGD_ENTRY)
118 #define PMD_ENTRY_SIZE (1UL << BITS_PER_PMD_ENTRY)
119 #define PTE_ENTRY_SIZE (1UL << BITS_PER_PTE_ENTRY)
121 /* to align the pointer to the (next) page boundary */
122 #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
125 #define LINUX_GATEWAY_SPACE 0
127 /* This governs the relationship between virtual and physical addresses.
128 * If you alter it, make sure to take care of our various fixed mapping
129 * segments in fixmap.h */
130 #define __PAGE_OFFSET (0x10000000)
132 #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
134 /* The size of the gateway page (we leave lots of room for expansion) */
135 #define GATEWAY_PAGE_SIZE 0x4000
137 /* The start of the actual kernel binary---used in vmlinux.lds.S
138 * Leave some space after __PAGE_OFFSET for detecting kernel null
139 * ptr derefs */
140 #define KERNEL_BINARY_TEXT_START (__PAGE_OFFSET + 0x100000)
142 /* These macros don't work for 64-bit C code -- don't allow in C at all */
143 #ifdef __ASSEMBLY__
144 # define PA(x) ((x)-__PAGE_OFFSET)
145 # define VA(x) ((x)+__PAGE_OFFSET)
146 #endif
147 #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
148 #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
150 #ifndef CONFIG_DISCONTIGMEM
151 #define pfn_valid(pfn) ((pfn) < max_mapnr)
152 #endif /* CONFIG_DISCONTIGMEM */
154 #ifdef CONFIG_HUGETLB_PAGE
155 #define HPAGE_SHIFT 22 /* 4MB (is this fixed?) */
156 #define HPAGE_SIZE ((1UL) << HPAGE_SHIFT)
157 #define HPAGE_MASK (~(HPAGE_SIZE - 1))
158 #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
159 #endif
161 #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
163 #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
164 #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
166 #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
167 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
169 #include <asm-generic/memory_model.h>
170 #include <asm-generic/page.h>
172 #endif /* __KERNEL__ */
174 #endif /* _PARISC_PAGE_H */