aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32/include/asm/page.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-08-08 14:38:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-08-08 14:38:42 -0400
commit49b75b87ce2dfbd99e59a50c3681b154d07e3a22 (patch)
treef14e1da19a13d87a512f9043c2f37fd75dd122b3 /arch/avr32/include/asm/page.h
parentf1c7f79b6ab4f7ada002a0fae47f462ede6b6857 (diff)
parent097d9eb537ff4d88b74c3fe67392e27c478ca3c5 (diff)
Merge branch 'for-linus-merged' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'for-linus-merged' of master.kernel.org:/home/rmk/linux-2.6-arm: [ARM] 5177/1: arm/mach-sa1100/Makefile: remove CONFIG_SA1100_USB [ARM] 5166/1: magician: add MAINTAINERS entry [ARM] fix pnx4008 build errors [ARM] Fix SMP booting with non-zero PHYS_OFFSET [ARM] 5185/1: Fix spi num_chipselect for lubbock [ARM] Move include/asm-arm/arch-* to arch/arm/*/include/mach [ARM] Add support for arch/arm/mach-*/include and arch/arm/plat-*/include [ARM] Remove asm/hardware.h, use asm/arch/hardware.h instead [ARM] Eliminate useless includes of asm/mach-types.h [ARM] Fix circular include dependency with IRQ headers avr32: Use <mach/foo.h> instead of <asm/arch/foo.h> avr32: Introduce arch/avr32/mach-*/include/mach avr32: Move include/asm-avr32 to arch/avr32/include/asm [ARM] sa1100_wdt: use reset_status to remember watchdog reset status [ARM] pxa: introduce reset_status and clear_reset_status for driver's usage [ARM] pxa: introduce reset.h for reset specific header information
Diffstat (limited to 'arch/avr32/include/asm/page.h')
-rw-r--r--arch/avr32/include/asm/page.h104
1 files changed, 104 insertions, 0 deletions
diff --git a/arch/avr32/include/asm/page.h b/arch/avr32/include/asm/page.h
new file mode 100644
index 00000000000..f805d1cb11b
--- /dev/null
+++ b/arch/avr32/include/asm/page.h
@@ -0,0 +1,104 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_AVR32_PAGE_H
9#define __ASM_AVR32_PAGE_H
10
11#include <linux/const.h>
12
13/* PAGE_SHIFT determines the page size */
14#define PAGE_SHIFT 12
15#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
16#define PAGE_MASK (~(PAGE_SIZE-1))
17#define PTE_MASK PAGE_MASK
18
19#ifndef __ASSEMBLY__
20
21#include <asm/addrspace.h>
22
23extern void clear_page(void *to);
24extern void copy_page(void *to, void *from);
25
26#define clear_user_page(page, vaddr, pg) clear_page(page)
27#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
28
29/*
30 * These are used to make use of C type-checking..
31 */
32typedef struct { unsigned long pte; } pte_t;
33typedef struct { unsigned long pgd; } pgd_t;
34typedef struct { unsigned long pgprot; } pgprot_t;
35typedef struct page *pgtable_t;
36
37#define pte_val(x) ((x).pte)
38#define pgd_val(x) ((x).pgd)
39#define pgprot_val(x) ((x).pgprot)
40
41#define __pte(x) ((pte_t) { (x) })
42#define __pgd(x) ((pgd_t) { (x) })
43#define __pgprot(x) ((pgprot_t) { (x) })
44
45/* FIXME: These should be removed soon */
46extern unsigned long memory_start, memory_end;
47
48/* Pure 2^n version of get_order */
49static inline int get_order(unsigned long size)
50{
51 unsigned lz;
52
53 size = (size - 1) >> PAGE_SHIFT;
54 asm("clz %0, %1" : "=r"(lz) : "r"(size));
55 return 32 - lz;
56}
57
58#endif /* !__ASSEMBLY__ */
59
60/*
61 * The hardware maps the virtual addresses 0x80000000 -> 0x9fffffff
62 * permanently to the physical addresses 0x00000000 -> 0x1fffffff when
63 * segmentation is enabled. We want to make use of this in order to
64 * minimize TLB pressure.
65 */
66#define PAGE_OFFSET (0x80000000UL)
67
68/*
69 * ALSA uses virt_to_page() on DMA pages, which I'm not entirely sure
70 * is a good idea. Anyway, we can't simply subtract PAGE_OFFSET here
71 * in that case, so we'll have to mask out the three most significant
72 * bits of the address instead...
73 *
74 * What's the difference between __pa() and virt_to_phys() anyway?
75 */
76#define __pa(x) PHYSADDR(x)
77#define __va(x) ((void *)(P1SEGADDR(x)))
78
79#define MAP_NR(addr) (((unsigned long)(addr) - PAGE_OFFSET) >> PAGE_SHIFT)
80
81#define phys_to_page(phys) (pfn_to_page(phys >> PAGE_SHIFT))
82#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
83
84#ifndef CONFIG_NEED_MULTIPLE_NODES
85
86#define PHYS_PFN_OFFSET (CONFIG_PHYS_OFFSET >> PAGE_SHIFT)
87
88#define pfn_to_page(pfn) (mem_map + ((pfn) - PHYS_PFN_OFFSET))
89#define page_to_pfn(page) ((unsigned long)((page) - mem_map) + PHYS_PFN_OFFSET)
90#define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr))
91#endif /* CONFIG_NEED_MULTIPLE_NODES */
92
93#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
94#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
95
96#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \
97 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
98
99/*
100 * Memory above this physical address will be considered highmem.
101 */
102#define HIGHMEM_START 0x20000000UL
103
104#endif /* __ASM_AVR32_PAGE_H */