treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / mips / include / asm / mach-loongson64 / kernel-entry-init.h
blob87a5bfbf8cfe9b925c351f42de612be1b8dcaf82
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 LPA on LOONGSON3 config3 */
23 mfc0 t0, CP0_CONFIG3
24 or t0, (0x1 << 7)
25 mtc0 t0, CP0_CONFIG3
26 /* Set ELPA on LOONGSON3 pagegrain */
27 mfc0 t0, CP0_PAGEGRAIN
28 or t0, (0x1 << 29)
29 mtc0 t0, CP0_PAGEGRAIN
30 /* Enable STFill Buffer */
31 mfc0 t0, CP0_PRID
32 /* Loongson-3A R4+ */
33 andi t1, t0, PRID_IMP_MASK
34 li t2, PRID_IMP_LOONGSON_64G
35 beq t1, t2, 1f
36 nop
37 /* Loongson-3A R2/R3 */
38 andi t0, (PRID_IMP_MASK | PRID_REV_MASK)
39 slti t0, (PRID_IMP_LOONGSON_64C | PRID_REV_LOONGSON3A_R2_0)
40 bnez t0, 2f
41 nop
43 mfc0 t0, CP0_CONFIG6
44 or t0, 0x100
45 mtc0 t0, CP0_CONFIG6
47 _ehb
48 .set pop
49 .endm
52 * Do SMP slave processor setup.
54 .macro smp_slave_setup
55 .set push
56 .set mips64
57 /* Set LPA on LOONGSON3 config3 */
58 mfc0 t0, CP0_CONFIG3
59 or t0, (0x1 << 7)
60 mtc0 t0, CP0_CONFIG3
61 /* Set ELPA on LOONGSON3 pagegrain */
62 mfc0 t0, CP0_PAGEGRAIN
63 or t0, (0x1 << 29)
64 mtc0 t0, CP0_PAGEGRAIN
65 /* Enable STFill Buffer */
66 mfc0 t0, CP0_PRID
67 /* Loongson-3A R4+ */
68 andi t1, t0, PRID_IMP_MASK
69 li t2, PRID_IMP_LOONGSON_64G
70 beq t1, t2, 1f
71 nop
72 /* Loongson-3A R2/R3 */
73 andi t0, (PRID_IMP_MASK | PRID_REV_MASK)
74 slti t0, (PRID_IMP_LOONGSON_64C | PRID_REV_LOONGSON3A_R2_0)
75 bnez t0, 2f
76 nop
78 mfc0 t0, CP0_CONFIG6
79 or t0, 0x100
80 mtc0 t0, CP0_CONFIG6
82 _ehb
83 .set pop
84 .endm
86 #endif /* __ASM_MACH_LOONGSON64_KERNEL_ENTRY_H */