Linux 2.6.16.22
[linux/fpc-iii.git] / include / asm-sh64 / page.h
blobc86df90f7cbd879b0f5d63c5831b40a789a898a4
1 #ifndef __ASM_SH64_PAGE_H
2 #define __ASM_SH64_PAGE_H
4 /*
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
9 * include/asm-sh64/page.h
11 * Copyright (C) 2000, 2001 Paolo Alberelli
12 * Copyright (C) 2003, 2004 Paul Mundt
14 * benedict.gaster@superh.com 19th, 24th July 2002.
16 * Modified to take account of enabling for D-CACHE support.
20 #include <linux/config.h>
22 /* PAGE_SHIFT determines the page size */
23 #define PAGE_SHIFT 12
24 #ifdef __ASSEMBLY__
25 #define PAGE_SIZE 4096
26 #else
27 #define PAGE_SIZE (1UL << PAGE_SHIFT)
28 #endif
29 #define PAGE_MASK (~(PAGE_SIZE-1))
30 #define PTE_MASK PAGE_MASK
32 #if defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
33 #define HPAGE_SHIFT 16
34 #elif defined(CONFIG_HUGETLB_PAGE_SIZE_1MB)
35 #define HPAGE_SHIFT 20
36 #elif defined(CONFIG_HUGETLB_PAGE_SIZE_512MB)
37 #define HPAGE_SHIFT 29
38 #endif
40 #ifdef CONFIG_HUGETLB_PAGE
41 #define HPAGE_SIZE (1UL << HPAGE_SHIFT)
42 #define HPAGE_MASK (~(HPAGE_SIZE-1))
43 #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT-PAGE_SHIFT)
44 #define ARCH_HAS_SETCLEAR_HUGE_PTE
45 #endif
47 #ifdef __KERNEL__
48 #ifndef __ASSEMBLY__
50 extern struct page *mem_map;
51 extern void sh64_page_clear(void *page);
52 extern void sh64_page_copy(void *from, void *to);
54 #define clear_page(page) sh64_page_clear(page)
55 #define copy_page(to,from) sh64_page_copy(from, to)
57 #if defined(CONFIG_DCACHE_DISABLED)
59 #define clear_user_page(page, vaddr, pg) clear_page(page)
60 #define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
62 #else
64 extern void clear_user_page(void *to, unsigned long address, struct page *pg);
65 extern void copy_user_page(void *to, void *from, unsigned long address, struct page *pg);
67 #endif /* defined(CONFIG_DCACHE_DISABLED) */
70 * These are used to make use of C type-checking..
72 typedef struct { unsigned long long pte; } pte_t;
73 typedef struct { unsigned long pmd; } pmd_t;
74 typedef struct { unsigned long pgd; } pgd_t;
75 typedef struct { unsigned long pgprot; } pgprot_t;
77 #define pte_val(x) ((x).pte)
78 #define pmd_val(x) ((x).pmd)
79 #define pgd_val(x) ((x).pgd)
80 #define pgprot_val(x) ((x).pgprot)
82 #define __pte(x) ((pte_t) { (x) } )
83 #define __pmd(x) ((pmd_t) { (x) } )
84 #define __pgd(x) ((pgd_t) { (x) } )
85 #define __pgprot(x) ((pgprot_t) { (x) } )
87 #endif /* !__ASSEMBLY__ */
89 /* to align the pointer to the (next) page boundary */
90 #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
93 * Kconfig defined.
95 #define __MEMORY_START (CONFIG_MEMORY_START)
96 #define PAGE_OFFSET (CONFIG_CACHED_MEMORY_OFFSET)
98 #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
99 #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
100 #define MAP_NR(addr) ((__pa(addr)-__MEMORY_START) >> PAGE_SHIFT)
101 #define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
103 #define phys_to_page(phys) (mem_map + (((phys) - __MEMORY_START) >> PAGE_SHIFT))
104 #define page_to_phys(page) (((page - mem_map) << PAGE_SHIFT) + __MEMORY_START)
106 /* PFN start number, because of __MEMORY_START */
107 #define PFN_START (__MEMORY_START >> PAGE_SHIFT)
109 #define pfn_to_page(pfn) (mem_map + (pfn) - PFN_START)
110 #define page_to_pfn(page) ((unsigned long)((page) - mem_map) + PFN_START)
111 #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
112 #define pfn_valid(pfn) (((pfn) - PFN_START) < max_mapnr)
113 #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
115 #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
116 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
118 #endif /* __KERNEL__ */
120 #include <asm-generic/page.h>
122 #endif /* __ASM_SH64_PAGE_H */