~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/nios2/include/asm/page.h

Version: ~ [ linux-6.0-rc6 ] ~ [ linux-5.19.10 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.69 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.144 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.214 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.259 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.294 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.329 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.302 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
  3  * Copyright (C) 2004 Microtronix Datacom Ltd.
  4  *
  5  * MMU support based on asm/page.h from mips which is:
  6  *
  7  * Copyright (C) 1994 - 1999, 2000, 03 Ralf Baechle
  8  * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
  9  *
 10  * This file is subject to the terms and conditions of the GNU General Public
 11  * License.  See the file "COPYING" in the main directory of this archive
 12  * for more details.
 13  */
 14 
 15 #ifndef _ASM_NIOS2_PAGE_H
 16 #define _ASM_NIOS2_PAGE_H
 17 
 18 #include <linux/pfn.h>
 19 #include <linux/const.h>
 20 
 21 /*
 22  * PAGE_SHIFT determines the page size
 23  */
 24 #define PAGE_SHIFT      12
 25 #define PAGE_SIZE       (_AC(1, UL) << PAGE_SHIFT)
 26 #define PAGE_MASK       (~(PAGE_SIZE - 1))
 27 
 28 /*
 29  * PAGE_OFFSET -- the first address of the first page of memory.
 30  */
 31 #define PAGE_OFFSET     \
 32         (CONFIG_NIOS2_MEM_BASE + CONFIG_NIOS2_KERNEL_REGION_BASE)
 33 
 34 #ifndef __ASSEMBLY__
 35 
 36 /*
 37  * This gives the physical RAM offset.
 38  */
 39 #define PHYS_OFFSET             CONFIG_NIOS2_MEM_BASE
 40 
 41 /*
 42  * It's normally defined only for FLATMEM config but it's
 43  * used in our early mem init code for all memory models.
 44  * So always define it.
 45  */
 46 #define ARCH_PFN_OFFSET         PFN_UP(PHYS_OFFSET)
 47 
 48 #define clear_page(page)        memset((page), 0, PAGE_SIZE)
 49 #define copy_page(to, from)     memcpy((to), (from), PAGE_SIZE)
 50 
 51 struct page;
 52 
 53 extern void clear_user_page(void *addr, unsigned long vaddr, struct page *page);
 54 extern void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
 55                                 struct page *to);
 56 
 57 /*
 58  * These are used to make use of C type-checking.
 59  */
 60 typedef struct page *pgtable_t;
 61 typedef struct { unsigned long pte; } pte_t;
 62 typedef struct { unsigned long pgd; } pgd_t;
 63 typedef struct { unsigned long pgprot; } pgprot_t;
 64 
 65 #define pte_val(x)      ((x).pte)
 66 #define pgd_val(x)      ((x).pgd)
 67 #define pgprot_val(x)   ((x).pgprot)
 68 
 69 #define __pte(x)        ((pte_t) { (x) })
 70 #define __pgd(x)        ((pgd_t) { (x) })
 71 #define __pgprot(x)     ((pgprot_t) { (x) })
 72 
 73 extern unsigned long memory_start;
 74 extern unsigned long memory_end;
 75 extern unsigned long memory_size;
 76 
 77 extern struct page *mem_map;
 78 
 79 # define __pa(x)                \
 80         ((unsigned long)(x) - PAGE_OFFSET + PHYS_OFFSET)
 81 # define __va(x)                \
 82         ((void *)((unsigned long)(x) + PAGE_OFFSET - PHYS_OFFSET))
 83 
 84 #define page_to_virt(page)      \
 85         ((void *)(((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
 86 
 87 # define pfn_to_kaddr(pfn)      __va((pfn) << PAGE_SHIFT)
 88 
 89 static inline bool pfn_valid(unsigned long pfn)
 90 {
 91         /* avoid <linux/mm.h> include hell */
 92         extern unsigned long max_mapnr;
 93         unsigned long pfn_offset = ARCH_PFN_OFFSET;
 94 
 95         return pfn >= pfn_offset && pfn < max_mapnr;
 96 }
 97 
 98 # define virt_to_page(vaddr)    pfn_to_page(PFN_DOWN(virt_to_phys(vaddr)))
 99 # define virt_addr_valid(vaddr) pfn_valid(PFN_DOWN(virt_to_phys(vaddr)))
100 
101 # define VM_DATA_DEFAULT_FLAGS  VM_DATA_FLAGS_NON_EXEC
102 
103 #include <asm-generic/memory_model.h>
104 
105 #include <asm-generic/getorder.h>
106 
107 #endif /* !__ASSEMBLY__ */
108 
109 #endif /* _ASM_NIOS2_PAGE_H */
110 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp