diff options
Diffstat (limited to 'arch/blackfin/mm/init.c')
-rw-r--r-- | arch/blackfin/mm/init.c | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/arch/blackfin/mm/init.c b/arch/blackfin/mm/init.c index bc240abb8745..d0532b72bba5 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,32 @@ 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_SMP | ||
123 | cpu_pda[cpu].imask = 0x1f; | ||
124 | #endif | ||
125 | } | ||
126 | |||
127 | void __cpuinit reserve_pda(void) | ||
128 | { | ||
129 | printk(KERN_INFO "PDA for CPU%u reserved at %p\n", smp_processor_id(), | ||
130 | &cpu_pda[smp_processor_id()]); | ||
131 | } | ||
132 | |||
101 | void __init mem_init(void) | 133 | void __init mem_init(void) |
102 | { | 134 | { |
103 | unsigned int codek = 0, datak = 0, initk = 0; | 135 | unsigned int codek = 0, datak = 0, initk = 0; |
@@ -141,21 +173,13 @@ void __init mem_init(void) | |||
141 | 173 | ||
142 | static int __init sram_init(void) | 174 | static int __init sram_init(void) |
143 | { | 175 | { |
144 | unsigned long tmp; | ||
145 | |||
146 | /* Initialize the blackfin L1 Memory. */ | 176 | /* Initialize the blackfin L1 Memory. */ |
147 | bfin_sram_init(); | 177 | bfin_sram_init(); |
148 | 178 | ||
149 | /* Allocate this once; never free it. We assume this gives us a | 179 | /* Reserve the PDA space for the boot CPU right after we |
150 | pointer to the start of L1 scratchpad memory; panic if it | 180 | * initialized the scratch memory allocator. |
151 | doesn't. */ | 181 | */ |
152 | tmp = (unsigned long)l1sram_alloc(sizeof(struct l1_scratch_task_info)); | 182 | 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; | 183 | return 0; |
160 | } | 184 | } |
161 | pure_initcall(sram_init); | 185 | pure_initcall(sram_init); |