1/*
2 * linux/arch/unicore32/include/asm/cpu-single.h
3 *
4 * Code specific to PKUnity SoC and UniCore ISA
5 *
6 * Copyright (C) 2001-2010 GUAN Xue-tao
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#ifndef __UNICORE_CPU_SINGLE_H__
13#define __UNICORE_CPU_SINGLE_H__
14
15#include <asm/page.h>
16#include <asm/memory.h>
17
18#ifdef __KERNEL__
19#ifndef __ASSEMBLY__
20
21#define cpu_switch_mm(pgd, mm) cpu_do_switch_mm(virt_to_phys(pgd), mm)
22
23#define cpu_get_pgd()					\
24	({						\
25		unsigned long pg;			\
26		__asm__("movc	%0, p0.c2, #0"		\
27			 : "=r" (pg) : : "cc");		\
28		pg &= ~0x0fff;				\
29		(pgd_t *)phys_to_virt(pg);		\
30	})
31
32struct mm_struct;
33
34/* declare all the functions as extern */
35extern void cpu_proc_fin(void);
36extern int cpu_do_idle(void);
37extern void cpu_dcache_clean_area(void *, int);
38extern void cpu_do_switch_mm(unsigned long pgd_phys, struct mm_struct *mm);
39extern void cpu_set_pte(pte_t *ptep, pte_t pte);
40extern void cpu_reset(unsigned long addr) __attribute__((noreturn));
41
42#endif /* __ASSEMBLY__ */
43#endif /* __KERNEL__ */
44
45#endif /* __UNICORE_CPU_SINGLE_H__ */
46