1 #ifndef __ASM_SH64_PAGE_H
2 #define __ASM_SH64_PAGE_H
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
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.
21 /* PAGE_SHIFT determines the page size */
24 #define PAGE_SIZE 4096
26 #define PAGE_SIZE (1UL << PAGE_SHIFT)
28 #define PAGE_MASK (~(PAGE_SIZE-1))
29 #define PTE_MASK PAGE_MASK
31 #if defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
32 #define HPAGE_SHIFT 16
33 #elif defined(CONFIG_HUGETLB_PAGE_SIZE_1MB)
34 #define HPAGE_SHIFT 20
35 #elif defined(CONFIG_HUGETLB_PAGE_SIZE_512MB)
36 #define HPAGE_SHIFT 29
39 #ifdef CONFIG_HUGETLB_PAGE
40 #define HPAGE_SIZE (1UL << HPAGE_SHIFT)
41 #define HPAGE_MASK (~(HPAGE_SIZE-1))
42 #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT-PAGE_SHIFT)
43 #define ARCH_HAS_SETCLEAR_HUGE_PTE
49 extern struct page
*mem_map
;
50 extern void sh64_page_clear(void *page
);
51 extern void sh64_page_copy(void *from
, void *to
);
53 #define clear_page(page) sh64_page_clear(page)
54 #define copy_page(to,from) sh64_page_copy(from, to)
56 #if defined(CONFIG_DCACHE_DISABLED)
58 #define clear_user_page(page, vaddr, pg) clear_page(page)
59 #define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
63 extern void clear_user_page(void *to
, unsigned long address
, struct page
*pg
);
64 extern void copy_user_page(void *to
, void *from
, unsigned long address
, struct page
*pg
);
66 #endif /* defined(CONFIG_DCACHE_DISABLED) */
69 * These are used to make use of C type-checking..
71 typedef struct { unsigned long long pte
; } pte_t
;
72 typedef struct { unsigned long pmd
; } pmd_t
;
73 typedef struct { unsigned long pgd
; } pgd_t
;
74 typedef struct { unsigned long pgprot
; } pgprot_t
;
76 #define pte_val(x) ((x).pte)
77 #define pmd_val(x) ((x).pmd)
78 #define pgd_val(x) ((x).pgd)
79 #define pgprot_val(x) ((x).pgprot)
81 #define __pte(x) ((pte_t) { (x) } )
82 #define __pmd(x) ((pmd_t) { (x) } )
83 #define __pgd(x) ((pgd_t) { (x) } )
84 #define __pgprot(x) ((pgprot_t) { (x) } )
86 #endif /* !__ASSEMBLY__ */
88 /* to align the pointer to the (next) page boundary */
89 #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
94 #define __MEMORY_START (CONFIG_MEMORY_START)
95 #define PAGE_OFFSET (CONFIG_CACHED_MEMORY_OFFSET)
97 #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
98 #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
99 #define MAP_NR(addr) ((__pa(addr)-__MEMORY_START) >> PAGE_SHIFT)
100 #define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
102 #define phys_to_page(phys) (mem_map + (((phys) - __MEMORY_START) >> PAGE_SHIFT))
103 #define page_to_phys(page) (((page - mem_map) << PAGE_SHIFT) + __MEMORY_START)
105 /* PFN start number, because of __MEMORY_START */
106 #define PFN_START (__MEMORY_START >> PAGE_SHIFT)
107 #define ARCH_PFN_OFFSET (PFN_START)
108 #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
109 #define pfn_valid(pfn) (((pfn) - PFN_START) < max_mapnr)
110 #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
112 #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
113 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
115 #include <asm-generic/memory_model.h>
116 #include <asm-generic/page.h>
118 #endif /* __KERNEL__ */
119 #endif /* __ASM_SH64_PAGE_H */