1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * linux/arch/unicore32/mm/mm.h
4 *
5 * Code specific to PKUnity SoC and UniCore ISA
6 *
7 * Copyright (C) 2001-2010 GUAN Xue-tao
8 */
9 #include <asm/hwdef-copro.h>
10
11 /* the upper-most page table pointer */
12 extern pmd_t *top_pmd;
13 extern int sysctl_overcommit_memory;
14
15 #define TOP_PTE(x) pte_offset_kernel(top_pmd, x)
16
pmd_off(pgd_t * pgd,unsigned long virt)17 static inline pmd_t *pmd_off(pgd_t *pgd, unsigned long virt)
18 {
19 return pmd_offset((pud_t *)pgd, virt);
20 }
21
pmd_off_k(unsigned long virt)22 static inline pmd_t *pmd_off_k(unsigned long virt)
23 {
24 return pmd_off(pgd_offset_k(virt), virt);
25 }
26
27 struct mem_type {
28 unsigned int prot_pte;
29 unsigned int prot_l1;
30 unsigned int prot_sect;
31 };
32
33 const struct mem_type *get_mem_type(unsigned int type);
34
35 extern void __flush_dcache_page(struct address_space *, struct page *);
36 extern void hook_fault_code(int nr, int (*fn)
37 (unsigned long, unsigned int, struct pt_regs *),
38 int sig, int code, const char *name);
39
40 void __init bootmem_init(void);
41 void uc32_mm_memblock_reserve(void);
42