Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _H8300_PAGE_H |
| 2 | #define _H8300_PAGE_H |
| 3 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | /* PAGE_SHIFT determines the page size */ |
| 5 | |
| 6 | #define PAGE_SHIFT (12) |
| 7 | #define PAGE_SIZE (1UL << PAGE_SHIFT) |
| 8 | #define PAGE_MASK (~(PAGE_SIZE-1)) |
| 9 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | #include <asm/setup.h> |
| 11 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #ifndef __ASSEMBLY__ |
| 13 | |
| 14 | #define get_user_page(vaddr) __get_free_page(GFP_KERNEL) |
| 15 | #define free_user_page(page, addr) free_page(addr) |
| 16 | |
| 17 | #define clear_page(page) memset((page), 0, PAGE_SIZE) |
| 18 | #define copy_page(to,from) memcpy((to), (from), PAGE_SIZE) |
| 19 | |
| 20 | #define clear_user_page(page, vaddr, pg) clear_page(page) |
| 21 | #define copy_user_page(to, from, vaddr, pg) copy_page(to, from) |
| 22 | |
Mel Gorman | 769848c | 2007-07-17 04:03:05 -0700 | [diff] [blame] | 23 | #define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \ |
| 24 | alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE |
| 26 | |
| 27 | /* |
| 28 | * These are used to make use of C type-checking.. |
| 29 | */ |
| 30 | typedef struct { unsigned long pte; } pte_t; |
| 31 | typedef struct { unsigned long pmd[16]; } pmd_t; |
| 32 | typedef struct { unsigned long pgd; } pgd_t; |
| 33 | typedef struct { unsigned long pgprot; } pgprot_t; |
Martin Schwidefsky | 257ce73 | 2008-02-09 03:13:00 -0800 | [diff] [blame] | 34 | typedef struct page *pgtable_t; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | |
| 36 | #define pte_val(x) ((x).pte) |
| 37 | #define pmd_val(x) ((&x)->pmd[0]) |
| 38 | #define pgd_val(x) ((x).pgd) |
| 39 | #define pgprot_val(x) ((x).pgprot) |
| 40 | |
| 41 | #define __pte(x) ((pte_t) { (x) } ) |
| 42 | #define __pmd(x) ((pmd_t) { (x) } ) |
| 43 | #define __pgd(x) ((pgd_t) { (x) } ) |
| 44 | #define __pgprot(x) ((pgprot_t) { (x) } ) |
| 45 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | extern unsigned long memory_start; |
| 47 | extern unsigned long memory_end; |
| 48 | |
| 49 | #endif /* !__ASSEMBLY__ */ |
| 50 | |
| 51 | #include <asm/page_offset.h> |
| 52 | |
| 53 | #define PAGE_OFFSET (PAGE_OFFSET_RAW) |
| 54 | |
| 55 | #ifndef __ASSEMBLY__ |
| 56 | |
Yoshinori Sato | 74ad74c | 2005-04-16 15:25:21 -0700 | [diff] [blame] | 57 | #define __pa(vaddr) virt_to_phys(vaddr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | #define __va(paddr) phys_to_virt((unsigned long)paddr) |
| 59 | |
| 60 | #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) |
| 61 | #define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT) |
| 62 | |
| 63 | #define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT) |
| 64 | #define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | #define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET) |
Yoshinori Sato | 74ad74c | 2005-04-16 15:25:21 -0700 | [diff] [blame] | 66 | #define pfn_valid(page) (page < max_mapnr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | |
KAMEZAWA Hiroyuki | dd6cc76 | 2006-03-27 01:15:41 -0800 | [diff] [blame] | 68 | #define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | |
| 70 | #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \ |
| 71 | ((void *)(kaddr) < (void *)memory_end)) |
| 72 | |
| 73 | #endif /* __ASSEMBLY__ */ |
| 74 | |
KAMEZAWA Hiroyuki | dd6cc76 | 2006-03-27 01:15:41 -0800 | [diff] [blame] | 75 | #include <asm-generic/memory_model.h> |
Arnd Bergmann | 5b17e1c | 2009-05-13 22:56:30 +0000 | [diff] [blame] | 76 | #include <asm-generic/getorder.h> |
Stephen Rothwell | fd4fd5a | 2005-09-03 15:54:30 -0700 | [diff] [blame] | 77 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | #endif /* _H8300_PAGE_H */ |