diff options
author | Graf Yang <graf.yang@analog.com> | 2008-11-18 04:48:22 -0500 |
---|---|---|
committer | Bryan Wu <cooloney@kernel.org> | 2008-11-18 04:48:22 -0500 |
commit | 8f65873e47784a390949f0d61e5692dbf2a8253e (patch) | |
tree | 4d9509bf5e52ebac190d79de04b783829d44f49e /arch/blackfin/mm/init.c | |
parent | b8a989893cbdeb6c97a7b5af5f38fb0e480235f9 (diff) |
Blackfin arch: SMP supporting patchset: Blackfin kernel and memory management code
Blackfin dual core BF561 processor can support SMP like features.
https://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:smp-like
In this patch, we provide SMP extend to Blackfin kernel and memory management code
Singed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Diffstat (limited to 'arch/blackfin/mm/init.c')
-rw-r--r-- | arch/blackfin/mm/init.c | 60 |
1 files changed, 47 insertions, 13 deletions
diff --git a/arch/blackfin/mm/init.c b/arch/blackfin/mm/init.c index bc240abb8745..57d306b9c56d 100644 --- a/arch/blackfin/mm/init.c +++ b/arch/blackfin/mm/init.c | |||
@@ -31,7 +31,8 @@ | |||
31 | #include <linux/bootmem.h> | 31 | #include <linux/bootmem.h> |
32 | #include <linux/uaccess.h> | 32 | #include <linux/uaccess.h> |
33 | #include <asm/bfin-global.h> | 33 | #include <asm/bfin-global.h> |
34 | #include <asm/l1layout.h> | 34 | #include <asm/pda.h> |
35 | #include <asm/cplbinit.h> | ||
35 | #include "blackfin_sram.h" | 36 | #include "blackfin_sram.h" |
36 | 37 | ||
37 | /* | 38 | /* |
@@ -53,6 +54,11 @@ static unsigned long empty_bad_page; | |||
53 | 54 | ||
54 | unsigned long empty_zero_page; | 55 | unsigned long empty_zero_page; |
55 | 56 | ||
57 | extern unsigned long exception_stack[NR_CPUS][1024]; | ||
58 | |||
59 | struct blackfin_pda cpu_pda[NR_CPUS]; | ||
60 | EXPORT_SYMBOL(cpu_pda); | ||
61 | |||
56 | /* | 62 | /* |
57 | * paging_init() continues the virtual memory environment setup which | 63 | * paging_init() continues the virtual memory environment setup which |
58 | * was begun by the code in arch/head.S. | 64 | * was begun by the code in arch/head.S. |
@@ -98,6 +104,42 @@ void __init paging_init(void) | |||
98 | } | 104 | } |
99 | } | 105 | } |
100 | 106 | ||
107 | asmlinkage void init_pda(void) | ||
108 | { | ||
109 | unsigned int cpu = raw_smp_processor_id(); | ||
110 | |||
111 | /* Initialize the PDA fields holding references to other parts | ||
112 | of the memory. The content of such memory is still | ||
113 | undefined at the time of the call, we are only setting up | ||
114 | valid pointers to it. */ | ||
115 | memset(&cpu_pda[cpu], 0, sizeof(cpu_pda[cpu])); | ||
116 | |||
117 | cpu_pda[0].next = &cpu_pda[1]; | ||
118 | cpu_pda[1].next = &cpu_pda[0]; | ||
119 | |||
120 | cpu_pda[cpu].ex_stack = exception_stack[cpu + 1]; | ||
121 | |||
122 | #ifdef CONFIG_MPU | ||
123 | #else | ||
124 | cpu_pda[cpu].ipdt = ipdt_tables[cpu]; | ||
125 | cpu_pda[cpu].dpdt = dpdt_tables[cpu]; | ||
126 | #ifdef CONFIG_CPLB_INFO | ||
127 | cpu_pda[cpu].ipdt_swapcount = ipdt_swapcount_tables[cpu]; | ||
128 | cpu_pda[cpu].dpdt_swapcount = dpdt_swapcount_tables[cpu]; | ||
129 | #endif | ||
130 | #endif | ||
131 | |||
132 | #ifdef CONFIG_SMP | ||
133 | cpu_pda[cpu].imask = 0x1f; | ||
134 | #endif | ||
135 | } | ||
136 | |||
137 | void __cpuinit reserve_pda(void) | ||
138 | { | ||
139 | printk(KERN_INFO "PDA for CPU%u reserved at %p\n", smp_processor_id(), | ||
140 | &cpu_pda[smp_processor_id()]); | ||
141 | } | ||
142 | |||
101 | void __init mem_init(void) | 143 | void __init mem_init(void) |
102 | { | 144 | { |
103 | unsigned int codek = 0, datak = 0, initk = 0; | 145 | unsigned int codek = 0, datak = 0, initk = 0; |
@@ -141,21 +183,13 @@ void __init mem_init(void) | |||
141 | 183 | ||
142 | static int __init sram_init(void) | 184 | static int __init sram_init(void) |
143 | { | 185 | { |
144 | unsigned long tmp; | ||
145 | |||
146 | /* Initialize the blackfin L1 Memory. */ | 186 | /* Initialize the blackfin L1 Memory. */ |
147 | bfin_sram_init(); | 187 | bfin_sram_init(); |
148 | 188 | ||
149 | /* Allocate this once; never free it. We assume this gives us a | 189 | /* Reserve the PDA space for the boot CPU right after we |
150 | pointer to the start of L1 scratchpad memory; panic if it | 190 | * initialized the scratch memory allocator. |
151 | doesn't. */ | 191 | */ |
152 | tmp = (unsigned long)l1sram_alloc(sizeof(struct l1_scratch_task_info)); | 192 | reserve_pda(); |
153 | if (tmp != (unsigned long)L1_SCRATCH_TASK_INFO) { | ||
154 | printk(KERN_EMERG "mem_init(): Did not get the right address from l1sram_alloc: %08lx != %08lx\n", | ||
155 | tmp, (unsigned long)L1_SCRATCH_TASK_INFO); | ||
156 | panic("No L1, time to give up\n"); | ||
157 | } | ||
158 | |||
159 | return 0; | 193 | return 0; |
160 | } | 194 | } |
161 | pure_initcall(sram_init); | 195 | pure_initcall(sram_init); |