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