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

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

Version: ~ [ linux-5.16-rc3 ] ~ [ linux-5.15.5 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.82 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.162 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.218 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.256 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.291 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.293 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ 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.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 
  3 #ifndef __ASM_CSKY_PAGE_H
  4 #define __ASM_CSKY_PAGE_H
  5 
  6 #include <asm/setup.h>
  7 #include <asm/cache.h>
  8 #include <linux/const.h>
  9 
 10 /*
 11  * PAGE_SHIFT determines the page size: 4KB
 12  */
 13 #define PAGE_SHIFT      12
 14 #define PAGE_SIZE       (_AC(1, UL) << PAGE_SHIFT)
 15 #define PAGE_MASK       (~(PAGE_SIZE - 1))
 16 #define THREAD_SIZE     (PAGE_SIZE * 2)
 17 #define THREAD_MASK     (~(THREAD_SIZE - 1))
 18 #define THREAD_SHIFT    (PAGE_SHIFT + 1)
 19 
 20 
 21 /*
 22  * For C-SKY "User-space:Kernel-space" is "2GB:2GB" fixed by hardware and there
 23  * are two segment registers (MSA0 + MSA1) to mapping 512MB + 512MB physical
 24  * address region. We use them mapping kernel 1GB direct-map address area and
 25  * for more than 1GB of memory we use highmem.
 26  */
 27 #define PAGE_OFFSET     0x80000000
 28 #define SSEG_SIZE       0x20000000
 29 #define LOWMEM_LIMIT    (SSEG_SIZE * 2)
 30 
 31 #define PHYS_OFFSET_OFFSET (CONFIG_RAM_BASE & (SSEG_SIZE - 1))
 32 
 33 #ifndef __ASSEMBLY__
 34 
 35 #include <linux/pfn.h>
 36 
 37 #define virt_to_pfn(kaddr)      (__pa(kaddr) >> PAGE_SHIFT)
 38 #define pfn_to_virt(pfn)        __va((pfn) << PAGE_SHIFT)
 39 
 40 #define virt_addr_valid(kaddr)  ((void *)(kaddr) >= (void *)PAGE_OFFSET && \
 41                         (void *)(kaddr) < high_memory)
 42 #define pfn_valid(pfn)          ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
 43 
 44 extern void *memset(void *dest, int c, size_t l);
 45 extern void *memcpy(void *to, const void *from, size_t l);
 46 
 47 #define clear_page(page)        memset((page), 0, PAGE_SIZE)
 48 #define copy_page(to, from)     memcpy((to), (from), PAGE_SIZE)
 49 
 50 #define page_to_phys(page)      (page_to_pfn(page) << PAGE_SHIFT)
 51 #define phys_to_page(paddr)     (pfn_to_page(PFN_DOWN(paddr)))
 52 
 53 struct page;
 54 
 55 #include <abi/page.h>
 56 
 57 struct vm_area_struct;
 58 
 59 typedef struct { unsigned long pte_low; } pte_t;
 60 #define pte_val(x)      ((x).pte_low)
 61 
 62 typedef struct { unsigned long pgd; } pgd_t;
 63 typedef struct { unsigned long pgprot; } pgprot_t;
 64 typedef struct page *pgtable_t;
 65 
 66 #define pgd_val(x)      ((x).pgd)
 67 #define pgprot_val(x)   ((x).pgprot)
 68 
 69 #define ptep_buddy(x)   ((pte_t *)((unsigned long)(x) ^ sizeof(pte_t)))
 70 
 71 #define __pte(x)        ((pte_t) { (x) })
 72 #define __pgd(x)        ((pgd_t) { (x) })
 73 #define __pgprot(x)     ((pgprot_t) { (x) })
 74 
 75 extern unsigned long va_pa_offset;
 76 
 77 #define ARCH_PFN_OFFSET PFN_DOWN(va_pa_offset + PHYS_OFFSET_OFFSET)
 78 
 79 #define __pa(x)          ((unsigned long)(x) - PAGE_OFFSET + va_pa_offset)
 80 #define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET - va_pa_offset))
 81 
 82 #define __pa_symbol(x)  __pa(RELOC_HIDE((unsigned long)(x), 0))
 83 
 84 #define MAP_NR(x)       PFN_DOWN((unsigned long)(x) - PAGE_OFFSET - \
 85                                  PHYS_OFFSET_OFFSET)
 86 #define virt_to_page(x) (mem_map + MAP_NR(x))
 87 
 88 #define VM_DATA_DEFAULT_FLAGS   (VM_READ | VM_WRITE | VM_EXEC | \
 89                                 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 90 
 91 #define pfn_to_kaddr(x) __va(PFN_PHYS(x))
 92 
 93 #include <asm-generic/memory_model.h>
 94 #include <asm-generic/getorder.h>
 95 
 96 #endif /* !__ASSEMBLY__ */
 97 #endif /* __ASM_CSKY_PAGE_H */
 98 

~ [ 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