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
6 * Chris Dearman (chris@mips.com)
7 * Copyright (C) 2007 Mips Technologies, Inc.
8 * Copyright (C) 2014 Imagination Technologies Ltd.
10 #ifndef __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H
11 #define __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H
13 #include <asm/regdef.h>
14 #include <asm/mipsregs.h>
17 * Prepare segments for EVA boot:
19 * This is in case the processor boots in legacy configuration
20 * (SI_EVAReset is de-asserted and CONFIG5.K == 0)
22 * ========================= Mappings =============================
23 * Virtual memory Physical memory Mapping
24 * 0x00000000 - 0x7fffffff 0x80000000 - 0xfffffffff MUSUK (kuseg)
25 * Flat 2GB physical memory
27 * 0x80000000 - 0x9fffffff 0x00000000 - 0x1ffffffff MUSUK (kseg0)
28 * 0xa0000000 - 0xbf000000 0x00000000 - 0x1ffffffff MUSUK (kseg1)
29 * 0xc0000000 - 0xdfffffff - MK (kseg2)
30 * 0xe0000000 - 0xffffffff - MK (kseg3)
33 * Lowmem is expanded to 2GB
35 * The following code uses the t0, t1, t2 and ra registers without
36 * previously preserving them.
39 .macro platform_eva_init
44 * Get Config.K0 value and use it to program
45 * the segmentation registers
48 andi t1
, 0x7 /* CCA */
52 li t0
, ((MIPS_SEGCFG_MK
<< MIPS_SEGCFG_AM_SHIFT
) | \
53 (0 << MIPS_SEGCFG_PA_SHIFT
) | \
54 (1 << MIPS_SEGCFG_EU_SHIFT
)) | \
55 (((MIPS_SEGCFG_MK
<< MIPS_SEGCFG_AM_SHIFT
) | \
56 (0 << MIPS_SEGCFG_PA_SHIFT
) | \
57 (1 << MIPS_SEGCFG_EU_SHIFT
)) << 16)
62 li t0
, ((MIPS_SEGCFG_MUSUK
<< MIPS_SEGCFG_AM_SHIFT
) | \
63 (0 << MIPS_SEGCFG_PA_SHIFT
) | \
64 (2 << MIPS_SEGCFG_C_SHIFT
) | \
65 (1 << MIPS_SEGCFG_EU_SHIFT
)) | \
66 (((MIPS_SEGCFG_MUSUK
<< MIPS_SEGCFG_AM_SHIFT
) | \
67 (0 << MIPS_SEGCFG_PA_SHIFT
) | \
68 (1 << MIPS_SEGCFG_EU_SHIFT
)) << 16)
73 li t0
, ((MIPS_SEGCFG_MUSUK
<< MIPS_SEGCFG_AM_SHIFT
) | \
74 (6 << MIPS_SEGCFG_PA_SHIFT
) | \
75 (1 << MIPS_SEGCFG_EU_SHIFT
)) | \
76 (((MIPS_SEGCFG_MUSUK
<< MIPS_SEGCFG_AM_SHIFT
) | \
77 (4 << MIPS_SEGCFG_PA_SHIFT
) | \
78 (1 << MIPS_SEGCFG_EU_SHIFT
)) << 16)
84 li t2
, 0x40000000 /* K bit */
93 .macro kernel_entry_setup
101 mfc0 t0
, CP0_CONFIG
, 1
103 mfc0 t0
, CP0_CONFIG
, 2
105 mfc0 t0
, CP0_CONFIG
, 3
106 sll t0
, t0
, 6 /* SC bit */
112 /* Assume we came from YAMON... */
113 PTR_LA v0
, 0x9fc00534 /* YAMON print */
116 PTR_LA a1
, nonsc_processor
119 PTR_LA v0
, 0x9fc00520 /* YAMON exit */
128 .asciz
"EVA kernel requires a MIPS core with Segment Control implemented\n"
130 #endif /* CONFIG_EVA */
135 * Do SMP slave processor setup necessary before we can safely execute C code.
137 .macro smp_slave_setup
145 #endif /* __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H */