drm/ast: Only warn about unsupported TX chips on Gen4 and later
[drm/drm-misc.git] / arch / csky / include / asm / page.h
blob4911d0892b71d7e2d1d4141e7190a866ccd8dec1
1 /* SPDX-License-Identifier: GPL-2.0 */
3 #ifndef __ASM_CSKY_PAGE_H
4 #define __ASM_CSKY_PAGE_H
6 #include <asm/setup.h>
7 #include <asm/cache.h>
8 #include <linux/const.h>
10 #include <vdso/page.h>
12 #define THREAD_SIZE (PAGE_SIZE * 2)
13 #define THREAD_MASK (~(THREAD_SIZE - 1))
14 #define THREAD_SHIFT (PAGE_SHIFT + 1)
18 * For C-SKY "User-space:Kernel-space" is "2GB:2GB" fixed by hardware and there
19 * are two segment registers (MSA0 + MSA1) to mapping 512MB + 512MB physical
20 * address region. We use them mapping kernel 1GB direct-map address area and
21 * for more than 1GB of memory we use highmem.
23 #define PAGE_OFFSET CONFIG_PAGE_OFFSET
24 #define SSEG_SIZE 0x20000000
25 #define LOWMEM_LIMIT (SSEG_SIZE * 2)
27 #define PHYS_OFFSET_OFFSET (CONFIG_DRAM_BASE & (SSEG_SIZE - 1))
29 #ifndef __ASSEMBLY__
31 #include <linux/pfn.h>
33 #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && \
34 (void *)(kaddr) < high_memory)
36 extern void *memset(void *dest, int c, size_t l);
37 extern void *memcpy(void *to, const void *from, size_t l);
39 #define clear_page(page) memset((page), 0, PAGE_SIZE)
40 #define copy_page(to, from) memcpy((to), (from), PAGE_SIZE)
42 struct page;
44 #include <abi/page.h>
46 struct vm_area_struct;
48 typedef struct { unsigned long pte_low; } pte_t;
49 #define pte_val(x) ((x).pte_low)
51 typedef struct { unsigned long pgd; } pgd_t;
52 typedef struct { unsigned long pgprot; } pgprot_t;
53 typedef struct page *pgtable_t;
55 #define pgd_val(x) ((x).pgd)
56 #define pgprot_val(x) ((x).pgprot)
58 #define ptep_buddy(x) ((pte_t *)((unsigned long)(x) ^ sizeof(pte_t)))
60 #define __pte(x) ((pte_t) { (x) })
61 #define __pgd(x) ((pgd_t) { (x) })
62 #define __pgprot(x) ((pgprot_t) { (x) })
64 extern unsigned long va_pa_offset;
66 #define ARCH_PFN_OFFSET PFN_DOWN(va_pa_offset + PHYS_OFFSET_OFFSET)
68 #define __pa(x) ((unsigned long)(x) - PAGE_OFFSET + va_pa_offset)
69 #define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET - va_pa_offset))
71 #define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x), 0))
73 static inline unsigned long virt_to_pfn(const void *kaddr)
75 return __pa(kaddr) >> PAGE_SHIFT;
78 #define MAP_NR(x) PFN_DOWN((unsigned long)(x) - PAGE_OFFSET - \
79 PHYS_OFFSET_OFFSET)
80 #define virt_to_page(x) (mem_map + MAP_NR(x))
82 #define pfn_to_kaddr(x) __va(PFN_PHYS(x))
84 #include <asm-generic/memory_model.h>
85 #include <asm-generic/getorder.h>
87 #endif /* !__ASSEMBLY__ */
88 #endif /* __ASM_CSKY_PAGE_H */