Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * OpenRISC Linux
4 *
5 * Linux architectural port borrowing liberally from similar works of
6 * others. All original copyrights apply as per the original source
7 * declaration.
8 *
9 * OpenRISC implementation:
10 * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
11 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
12 * et al.
13 */
14
15#ifndef __ASM_OPENRISC_PAGE_H
16#define __ASM_OPENRISC_PAGE_H
17
18#include <vdso/page.h>
19
20#define PAGE_OFFSET 0xc0000000
21#define KERNELBASE PAGE_OFFSET
22
23/* This is not necessarily the right place for this, but it's needed by
24 * drivers/of/fdt.c
25 */
26#include <asm/setup.h>
27
28#ifndef __ASSEMBLY__
29
30#define clear_page(page) memset((page), 0, PAGE_SIZE)
31#define copy_page(to, from) memcpy((to), (from), PAGE_SIZE)
32
33#define clear_user_page(page, vaddr, pg) clear_page(page)
34#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
35
36/*
37 * These are used to make use of C type-checking..
38 */
39typedef struct {
40 unsigned long pte;
41} pte_t;
42typedef struct {
43 unsigned long pgd;
44} pgd_t;
45typedef struct {
46 unsigned long pgprot;
47} pgprot_t;
48typedef struct page *pgtable_t;
49
50#define pte_val(x) ((x).pte)
51#define pgd_val(x) ((x).pgd)
52#define pgprot_val(x) ((x).pgprot)
53
54#define __pte(x) ((pte_t) { (x) })
55#define __pgd(x) ((pgd_t) { (x) })
56#define __pgprot(x) ((pgprot_t) { (x) })
57
58#endif /* !__ASSEMBLY__ */
59
60
61#ifndef __ASSEMBLY__
62
63#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET))
64#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
65
66static inline unsigned long virt_to_pfn(const void *kaddr)
67{
68 return __pa(kaddr) >> PAGE_SHIFT;
69}
70
71#define virt_to_page(addr) \
72 (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT))
73
74#define virt_addr_valid(kaddr) (pfn_valid(virt_to_pfn(kaddr)))
75
76#endif /* __ASSEMBLY__ */
77
78#include <asm-generic/memory_model.h>
79#include <asm-generic/getorder.h>
80
81#endif /* __ASM_OPENRISC_PAGE_H */