1 /*
2  * This file is subject to the terms and conditions of the GNU General Public
3  * License.  See the file "COPYING" in the main directory of this archive
4  * for more details.
5  *
6  * Copyright (C) 2005 Embedded Alley Solutions, Inc
7  * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
8  * Copyright (C) 2009 Jiajie Chen (chenjiajie@cse.buaa.edu.cn)
9  * Copyright (C) 2012 Huacai Chen (chenhc@lemote.com)
10  */
11 #ifndef __ASM_MACH_LOONGSON64_KERNEL_ENTRY_H
12 #define __ASM_MACH_LOONGSON64_KERNEL_ENTRY_H
13 
14 /*
15  * Override macros used in arch/mips/kernel/head.S.
16  */
17 	.macro	kernel_entry_setup
18 #ifdef CONFIG_CPU_LOONGSON3
19 	.set	push
20 	.set	mips64
21 	/* Set LPA on LOONGSON3 config3 */
22 	mfc0	t0, $16, 3
23 	or	t0, (0x1 << 7)
24 	mtc0	t0, $16, 3
25 	/* Set ELPA on LOONGSON3 pagegrain */
26 	mfc0	t0, $5, 1
27 	or	t0, (0x1 << 29)
28 	mtc0	t0, $5, 1
29 #ifdef CONFIG_LOONGSON3_ENHANCEMENT
30 	/* Enable STFill Buffer */
31 	mfc0	t0, $16, 6
32 	or	t0, 0x100
33 	mtc0	t0, $16, 6
34 #endif
35 	_ehb
36 	.set	pop
37 #endif
38 	.endm
39 
40 /*
41  * Do SMP slave processor setup.
42  */
43 	.macro	smp_slave_setup
44 #ifdef CONFIG_CPU_LOONGSON3
45 	.set	push
46 	.set	mips64
47 	/* Set LPA on LOONGSON3 config3 */
48 	mfc0	t0, $16, 3
49 	or	t0, (0x1 << 7)
50 	mtc0	t0, $16, 3
51 	/* Set ELPA on LOONGSON3 pagegrain */
52 	mfc0	t0, $5, 1
53 	or	t0, (0x1 << 29)
54 	mtc0	t0, $5, 1
55 #ifdef CONFIG_LOONGSON3_ENHANCEMENT
56 	/* Enable STFill Buffer */
57 	mfc0	t0, $16, 6
58 	or	t0, 0x100
59 	mtc0	t0, $16, 6
60 #endif
61 	_ehb
62 	.set	pop
63 #endif
64 	.endm
65 
66 #endif /* __ASM_MACH_LOONGSON64_KERNEL_ENTRY_H */
67