csky: Support vmlinux bootup with MMU off
Modify SETUP_MMU macro to fit on both MMU-on or MMU-off enviornment and vmlinux could bootup from MMU off enviornment for some cases. Unify the style of _start and _start_smp_secondary in head.S to make head.S looks more concise and easy to understand. Signed-off-by: Guo Ren <ren_guo@c-sky.com> Cc: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
@@ -7,16 +7,11 @@
|
||||
|
||||
__HEAD
|
||||
ENTRY(_start)
|
||||
/* set super user mode */
|
||||
lrw a3, DEFAULT_PSR_VALUE
|
||||
mtcr a3, psr
|
||||
psrset ee
|
||||
|
||||
SETUP_MMU a3
|
||||
SETUP_MMU
|
||||
|
||||
/* set stack point */
|
||||
lrw a3, init_thread_union + THREAD_SIZE
|
||||
mov sp, a3
|
||||
lrw r6, init_thread_union + THREAD_SIZE
|
||||
mov sp, r6
|
||||
|
||||
jmpi csky_start
|
||||
END(_start)
|
||||
@@ -24,53 +19,12 @@ END(_start)
|
||||
#ifdef CONFIG_SMP
|
||||
.align 10
|
||||
ENTRY(_start_smp_secondary)
|
||||
/* Invalid I/Dcache BTB BHT */
|
||||
movi a3, 7
|
||||
lsli a3, 16
|
||||
addi a3, (1<<4) | 3
|
||||
mtcr a3, cr17
|
||||
|
||||
tlbi.alls
|
||||
|
||||
/* setup PAGEMASK */
|
||||
movi a3, 0
|
||||
mtcr a3, cr<6, 15>
|
||||
|
||||
/* setup MEL0/MEL1 */
|
||||
grs a0, _start_smp_pc
|
||||
_start_smp_pc:
|
||||
bmaski a1, 13
|
||||
andn a0, a1
|
||||
movi a1, 0x00000006
|
||||
movi a2, 0x00001006
|
||||
or a1, a0
|
||||
or a2, a0
|
||||
mtcr a1, cr<2, 15>
|
||||
mtcr a2, cr<3, 15>
|
||||
|
||||
/* setup MEH */
|
||||
mtcr a0, cr<4, 15>
|
||||
|
||||
/* write TLB */
|
||||
bgeni a3, 28
|
||||
mtcr a3, cr<8, 15>
|
||||
|
||||
SETUP_MMU a3
|
||||
|
||||
/* enable MMU */
|
||||
movi a3, 1
|
||||
mtcr a3, cr18
|
||||
|
||||
jmpi _goto_mmu_on
|
||||
_goto_mmu_on:
|
||||
lrw a3, DEFAULT_PSR_VALUE
|
||||
mtcr a3, psr
|
||||
psrset ee
|
||||
SETUP_MMU
|
||||
|
||||
/* set stack point */
|
||||
lrw a3, secondary_stack
|
||||
ld.w a3, (a3, 0)
|
||||
mov sp, a3
|
||||
lrw r6, secondary_stack
|
||||
ld.w r6, (r6, 0)
|
||||
mov sp, r6
|
||||
|
||||
jmpi csky_start_secondary
|
||||
END(_start_smp_secondary)
|
||||
|
@@ -145,7 +145,8 @@ void __init setup_arch(char **cmdline_p)
|
||||
unsigned long phys_offset;
|
||||
EXPORT_SYMBOL(phys_offset);
|
||||
|
||||
asmlinkage __visible void __init csky_start(unsigned int unused, void *param)
|
||||
asmlinkage __visible void __init csky_start(unsigned int unused,
|
||||
void *dtb_start)
|
||||
{
|
||||
/* Clean up bss section */
|
||||
memset(__bss_start, 0, __bss_stop - __bss_start);
|
||||
@@ -155,10 +156,10 @@ asmlinkage __visible void __init csky_start(unsigned int unused, void *param)
|
||||
pre_trap_init();
|
||||
pre_mmu_init();
|
||||
|
||||
if (param == NULL)
|
||||
if (dtb_start == NULL)
|
||||
early_init_dt_scan(__dtb_start);
|
||||
else
|
||||
early_init_dt_scan(param);
|
||||
early_init_dt_scan(dtb_start);
|
||||
|
||||
start_kernel();
|
||||
|
||||
|
Reference in New Issue
Block a user