1 /* SPDX-License-Identifier: GPL-2.0-or-later */
5 * Linux architectural port borrowing liberally from similar works of
6 * others. All original copyrights apply as per the original source
9 * OpenRISC implementation:
10 * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
11 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
15 #ifndef __ASM_OPENRISC_PAGE_H
16 #define __ASM_OPENRISC_PAGE_H
18 #include <vdso/page.h>
20 #define PAGE_OFFSET 0xc0000000
21 #define KERNELBASE PAGE_OFFSET
23 /* This is not necessarily the right place for this, but it's needed by
26 #include <asm/setup.h>
30 #define clear_page(page) memset((page), 0, PAGE_SIZE)
31 #define copy_page(to, from) memcpy((to), (from), PAGE_SIZE)
33 #define clear_user_page(page, vaddr, pg) clear_page(page)
34 #define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
37 * These are used to make use of C type-checking..
48 typedef struct page
*pgtable_t
;
50 #define pte_val(x) ((x).pte)
51 #define pgd_val(x) ((x).pgd)
52 #define pgprot_val(x) ((x).pgprot)
54 #define __pte(x) ((pte_t) { (x) })
55 #define __pgd(x) ((pgd_t) { (x) })
56 #define __pgprot(x) ((pgprot_t) { (x) })
58 #endif /* !__ASSEMBLY__ */
63 #define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET))
64 #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
66 static inline unsigned long virt_to_pfn(const void *kaddr
)
68 return __pa(kaddr
) >> PAGE_SHIFT
;
71 #define virt_to_page(addr) \
72 (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT))
74 #define virt_addr_valid(kaddr) (pfn_valid(virt_to_pfn(kaddr)))
76 #endif /* __ASSEMBLY__ */
78 #include <asm-generic/memory_model.h>
79 #include <asm-generic/getorder.h>
81 #endif /* __ASM_OPENRISC_PAGE_H */