4 * Copyright (c) 2005 blackfin.uclinux.org
6 * See file CREDITS for list of people who contributed to this
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 #ifndef _BLACKFIN_PAGE_H
26 #define _BLACKFIN_PAGE_H
28 #include <linux/config.h>
30 /* PAGE_SHIFT determines the page size */
32 #define PAGE_SHIFT (12)
33 #define PAGE_SIZE (4096)
34 #define PAGE_MASK (~(PAGE_SIZE-1))
38 #include <asm/setup.h>
41 #define KTHREAD_SIZE (8192)
43 #define KTHREAD_SIZE PAGE_SIZE
48 #define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
49 #define free_user_page(page, addr) free_page(addr)
51 #define clear_page(page) memset((page), 0, PAGE_SIZE)
52 #define copy_page(to,from) memcpy((to), (from), PAGE_SIZE)
54 #define clear_user_page(page, vaddr) clear_page(page)
55 #define copy_user_page(to, from, vaddr) copy_page(to, from)
58 * These are used to make use of C type-checking..
64 unsigned long pmd[16];
73 #define pte_val(x) ((x).pte)
74 #define pmd_val(x) ((&x)->pmd[0])
75 #define pgd_val(x) ((x).pgd)
76 #define pgprot_val(x) ((x).pgprot)
78 #define __pte(x) ((pte_t) { (x) } )
79 #define __pmd(x) ((pmd_t) { (x) } )
80 #define __pgd(x) ((pgd_t) { (x) } )
81 #define __pgprot(x) ((pgprot_t) { (x) } )
83 /* to align the pointer to the (next) page boundary */
84 #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
86 /* Pure 2^n version of get_order */
87 extern __inline__ int get_order(unsigned long size)
91 size = (size - 1) >> (PAGE_SHIFT - 1);
100 #endif /* !__ASSEMBLY__ */
102 #include <asm/page_offset.h>
104 #define PAGE_OFFSET (PAGE_OFFSET_RAW)
108 #define __pa(vaddr) virt_to_phys((void *)vaddr)
109 #define __va(paddr) phys_to_virt((unsigned long)paddr)
111 #define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)
112 #define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT))
113 #define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
115 #define PAGE_BUG(page) do { \