1
2
3
4
5
6
7
8
9
10
11 #ifndef __ASM_MACH_LOONGSON64_KERNEL_ENTRY_H
12 #define __ASM_MACH_LOONGSON64_KERNEL_ENTRY_H
13
14 #include <asm/cpu.h>
15
16
17
18
19 .macro kernel_entry_setup
20 #ifdef CONFIG_CPU_LOONGSON3
21 .set push
22 .set mips64
23
24 mfc0 t0, CP0_CONFIG3
25 or t0, (0x1 << 7)
26 mtc0 t0, CP0_CONFIG3
27
28 mfc0 t0, CP0_PAGEGRAIN
29 or t0, (0x1 << 29)
30 mtc0 t0, CP0_PAGEGRAIN
31
32 mfc0 t0, CP0_PRID
33 andi t0, (PRID_IMP_MASK | PRID_REV_MASK)
34 slti t0, (PRID_IMP_LOONGSON_64 | PRID_REV_LOONGSON3A_R2_0)
35 bnez t0, 1f
36 mfc0 t0, CP0_CONFIG6
37 or t0, 0x100
38 mtc0 t0, CP0_CONFIG6
39 1:
40 _ehb
41 .set pop
42 #endif
43 .endm
44
45
46
47
48 .macro smp_slave_setup
49 #ifdef CONFIG_CPU_LOONGSON3
50 .set push
51 .set mips64
52
53 mfc0 t0, CP0_CONFIG3
54 or t0, (0x1 << 7)
55 mtc0 t0, CP0_CONFIG3
56
57 mfc0 t0, CP0_PAGEGRAIN
58 or t0, (0x1 << 29)
59 mtc0 t0, CP0_PAGEGRAIN
60
61 mfc0 t0, CP0_PRID
62 andi t0, (PRID_IMP_MASK | PRID_REV_MASK)
63 slti t0, (PRID_IMP_LOONGSON_64 | PRID_REV_LOONGSON3A_R2_0)
64 bnez t0, 1f
65 mfc0 t0, CP0_CONFIG6
66 or t0, 0x100
67 mtc0 t0, CP0_CONFIG6
68 1:
69 _ehb
70 .set pop
71 #endif
72 .endm
73
74 #endif