OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [src/] [arch/] [arm/] [head-smp.S.ARM] - Blame information for rev 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
/*
2
 * Kernel Entry point for secondary cpus
3
 *
4
 * Copyright (C) 2010 B Labs Ltd.
5
 * Author: Prem Mallappa 
6
 */
7
 
8
#include INC_ARCH(asm.h)
9
#include INC_PLAT(offsets.h)
10
#include INC_ARCH(asm-macros.S)
11
 
12
#define C15_C0_M                0x0001  /* MMU */
13
#define C15_C0_A                0x0002  /* Alignment */
14
#define C15_C0_C                0x0004  /* (D) Cache */
15
#define C15_C0_W                0x0008  /* Write buffer */
16
#define C15_C0_B                0x0080  /* Endianness */
17
#define C15_C0_S                0x0100  /* System */
18
#define C15_C0_R                0x0200  /* ROM */
19
#define C15_C0_Z                0x0800  /* Branch Prediction */
20
#define C15_C0_I                0x1000  /* I cache */
21
#define C15_C0_V                0x2000  /* High vectors */
22
 
23
        .section .text.head
24
 
25
BEGIN_PROC(__smp_start)
26
        msr     cpsr_fxsc, #ARM_NOIRQ_SVC
27
 
28
        /* Disable mmu if it is enabled */
29
        mrc     p15, 0, r0, c1, c0, 0
30
        bic     r0, r0, #C15_C0_M       @ Disable MMU
31
        bic     r0, r0, #C15_C0_C       @ Disable (D) Cache
32
        bic     r0, r0, #C15_C0_I       @ Disable I cache
33
        bic     r0, r0, #C15_C0_W       @ Disable Write buffer
34
        mcr     p15, 0, r0, c1, c0, 0
35
 
36
        /* Setup boot stack (physical address) */
37
 
38
        /*
39
         * Each processor gets a unique 1024 byte stack.
40
         * This stack is used until the first task becomes
41
         * runnable, so there needs to be one for each core
42
         *
43
         * +----------+
44
         * |CPU3 Stack|
45
         * +----------+
46
         * |CPU2 Stack|
47
         * +----------+
48
         * |CPU1 Stack|
49
         * +----------+
50
         * |CPU0 Stack|
51
         * +----------+ _bootstack_physical
52
         */
53
        get_cpuid r0
54
        mov     r0, r0, lsl #12  /* 4 KB stack per-cpu */
55
        ldr     sp,     _secondary_cpu_stack
56
        sub     sp, sp, r0
57
 
58
        /*
59
         * Each processor will get its own irq/fiq/abt/und/svc stack
60
         * of size 16 bytes per mode. Each mode would have 64 bytes
61
         * of stack used in total for 4 cores.
62
         *
63
         * Note, unlike SVC mode all abort modes also include the
64
         * stack for primary core, i.e CPU0. There's no separation
65
         * of primary and secondary stack regions.
66
         *
67
         * +------------------+ __abt_stack_high
68
         * |  CPU0 ABT Stack  |
69
         * +------------------+ __abt_stack_high - 0x10
70
         * |  CPU1 ABT Stack  |
71
         * +------------------+ __abt_stack_high - 0x20
72
         * |  CPU2 ABT Stack  |
73
         * +------------------+ __abt_stack_high - 0x30
74
         * |  CPU3 ABT Stack  |
75
         * +------------------+ __abt_stack_high - 0x40
76
         *
77
         */
78
        get_cpuid r0
79
        mov     r0, r0, lsl #4  /* 16 byte stack for each core */
80
 
81
        /* Exception stacks are defined in vector page */
82
        msr     cpsr_fcx, #ARM_NOIRQ_ABT
83
        ldr     sp,     _sec_kern_abt_stack
84
        sub     sp, sp, r0
85
        msr     cpsr_fcx, #ARM_NOIRQ_IRQ
86
        ldr     sp,     _sec_kern_irq_stack
87
        sub     sp, sp, r0
88
        msr     cpsr_fcx, #ARM_NOIRQ_FIQ
89
        ldr     sp,     _sec_kern_fiq_stack
90
        sub     sp, sp, r0
91
        msr     cpsr_fcx, #ARM_NOIRQ_UND
92
        ldr     sp,     _sec_kern_und_stack
93
        sub     sp, sp, r0
94
        msr     cpsr_fcx, #ARM_NOIRQ_SVC
95
 
96
        /* Jump to start_kernel */
97
        bl      smp_secondary_init
98
 
99
        /* Never reached */
100
1:
101
        b       1b
102
 
103
_secondary_cpu_stack:
104
        .word   _bootstack_physical
105
 
106
/* Exception stacks are defined in vector page */
107
_sec_kern_abt_stack:
108
        .word   __abt_stack_high
109
_sec_kern_irq_stack:
110
        .word   __irq_stack_high
111
_sec_kern_fiq_stack:
112
        .word   __fiq_stack_high
113
_sec_kern_und_stack:
114
        .word   __und_stack_high

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.