WIP FPC-III support
[linux/fpc-iii.git] / arch / mips / include / asm / mach-loongson64 / kernel-entry-init.h
blobe4d77f4f0fe3970648c77323430d34099d93961a
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.
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)
11 #ifndef __ASM_MACH_LOONGSON64_KERNEL_ENTRY_H
12 #define __ASM_MACH_LOONGSON64_KERNEL_ENTRY_H
14 #include <asm/cpu.h>
17 * Override macros used in arch/mips/kernel/head.S.
19 .macro kernel_entry_setup
20 .set push
21 .set mips64
22 /* Set ELPA on LOONGSON3 pagegrain */
23 mfc0 t0, CP0_PAGEGRAIN
24 or t0, (0x1 << 29)
25 mtc0 t0, CP0_PAGEGRAIN
26 /* Enable STFill Buffer */
27 mfc0 t0, CP0_PRID
28 /* Loongson-3A R4+ */
29 andi t1, t0, PRID_IMP_MASK
30 li t2, PRID_IMP_LOONGSON_64G
31 beq t1, t2, 1f
32 nop
33 /* Loongson-3A R2/R3 */
34 andi t0, (PRID_IMP_MASK | PRID_REV_MASK)
35 slti t0, (PRID_IMP_LOONGSON_64C | PRID_REV_LOONGSON3A_R2_0)
36 bnez t0, 2f
37 nop
39 mfc0 t0, CP0_CONFIG6
40 or t0, 0x100
41 mtc0 t0, CP0_CONFIG6
43 _ehb
44 .set pop
45 .endm
48 * Do SMP slave processor setup.
50 .macro smp_slave_setup
51 .set push
52 .set mips64
53 /* Set ELPA on LOONGSON3 pagegrain */
54 mfc0 t0, CP0_PAGEGRAIN
55 or t0, (0x1 << 29)
56 mtc0 t0, CP0_PAGEGRAIN
57 /* Enable STFill Buffer */
58 mfc0 t0, CP0_PRID
59 /* Loongson-3A R4+ */
60 andi t1, t0, PRID_IMP_MASK
61 li t2, PRID_IMP_LOONGSON_64G
62 beq t1, t2, 1f
63 nop
64 /* Loongson-3A R2/R3 */
65 andi t0, (PRID_IMP_MASK | PRID_REV_MASK)
66 slti t0, (PRID_IMP_LOONGSON_64C | PRID_REV_LOONGSON3A_R2_0)
67 bnez t0, 2f
68 nop
70 mfc0 t0, CP0_CONFIG6
71 or t0, 0x100
72 mtc0 t0, CP0_CONFIG6
74 _ehb
75 .set pop
76 .endm
78 #endif /* __ASM_MACH_LOONGSON64_KERNEL_ENTRY_H */