aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/setup_32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel/setup_32.c')
-rw-r--r--arch/powerpc/kernel/setup_32.c113
1 files changed, 23 insertions, 90 deletions
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index d544fa311757..00f57754407e 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -36,8 +36,6 @@
36#include <asm/time.h> 36#include <asm/time.h>
37#include <asm/serial.h> 37#include <asm/serial.h>
38#include <asm/udbg.h> 38#include <asm/udbg.h>
39#include <asm/mmu_context.h>
40#include <asm/epapr_hcalls.h>
41#include <asm/code-patching.h> 39#include <asm/code-patching.h>
42 40
43#define DBG(fmt...) 41#define DBG(fmt...)
@@ -62,9 +60,7 @@ int icache_bsize;
62int ucache_bsize; 60int ucache_bsize;
63 61
64/* 62/*
65 * We're called here very early in the boot. We determine the machine 63 * We're called here very early in the boot.
66 * type and call the appropriate low-level setup functions.
67 * -- Cort <cort@fsmlabs.com>
68 * 64 *
69 * Note that the kernel may be running at an address which is different 65 * Note that the kernel may be running at an address which is different
70 * from the address that it was linked at, so we must use RELOC/PTRRELOC 66 * from the address that it was linked at, so we must use RELOC/PTRRELOC
@@ -73,7 +69,6 @@ int ucache_bsize;
73notrace unsigned long __init early_init(unsigned long dt_ptr) 69notrace unsigned long __init early_init(unsigned long dt_ptr)
74{ 70{
75 unsigned long offset = reloc_offset(); 71 unsigned long offset = reloc_offset();
76 struct cpu_spec *spec;
77 72
78 /* First zero the BSS -- use memset_io, some platforms don't have 73 /* First zero the BSS -- use memset_io, some platforms don't have
79 * caches on yet */ 74 * caches on yet */
@@ -84,27 +79,19 @@ notrace unsigned long __init early_init(unsigned long dt_ptr)
84 * Identify the CPU type and fix up code sections 79 * Identify the CPU type and fix up code sections
85 * that depend on which cpu we have. 80 * that depend on which cpu we have.
86 */ 81 */
87 spec = identify_cpu(offset, mfspr(SPRN_PVR)); 82 identify_cpu(offset, mfspr(SPRN_PVR));
88 83
89 do_feature_fixups(spec->cpu_features, 84 apply_feature_fixups();
90 PTRRELOC(&__start___ftr_fixup),
91 PTRRELOC(&__stop___ftr_fixup));
92
93 do_feature_fixups(spec->mmu_features,
94 PTRRELOC(&__start___mmu_ftr_fixup),
95 PTRRELOC(&__stop___mmu_ftr_fixup));
96
97 do_lwsync_fixups(spec->cpu_features,
98 PTRRELOC(&__start___lwsync_fixup),
99 PTRRELOC(&__stop___lwsync_fixup));
100
101 do_final_fixups();
102 85
103 return KERNELBASE + offset; 86 return KERNELBASE + offset;
104} 87}
105 88
106 89
107/* 90/*
91 * This is run before start_kernel(), the kernel has been relocated
92 * and we are running with enough of the MMU enabled to have our
93 * proper kernel virtual addresses
94 *
108 * Find out what kind of machine we're on and save any data we need 95 * Find out what kind of machine we're on and save any data we need
109 * from the early boot process (devtree is copied on pmac by prom_init()). 96 * from the early boot process (devtree is copied on pmac by prom_init()).
110 * This is called very early on the boot process, after a minimal 97 * This is called very early on the boot process, after a minimal
@@ -123,27 +110,9 @@ notrace void __init machine_init(u64 dt_ptr)
123 /* Do some early initialization based on the flat device tree */ 110 /* Do some early initialization based on the flat device tree */
124 early_init_devtree(__va(dt_ptr)); 111 early_init_devtree(__va(dt_ptr));
125 112
126 epapr_paravirt_early_init();
127
128 early_init_mmu(); 113 early_init_mmu();
129 114
130 probe_machine();
131
132 setup_kdump_trampoline(); 115 setup_kdump_trampoline();
133
134#ifdef CONFIG_6xx
135 if (cpu_has_feature(CPU_FTR_CAN_DOZE) ||
136 cpu_has_feature(CPU_FTR_CAN_NAP))
137 ppc_md.power_save = ppc6xx_idle;
138#endif
139
140#ifdef CONFIG_E500
141 if (cpu_has_feature(CPU_FTR_CAN_DOZE) ||
142 cpu_has_feature(CPU_FTR_CAN_NAP))
143 ppc_md.power_save = e500_idle;
144#endif
145 if (ppc_md.progress)
146 ppc_md.progress("id mach(): done", 0x200);
147} 116}
148 117
149/* Checks "l2cr=xxxx" command-line option */ 118/* Checks "l2cr=xxxx" command-line option */
@@ -221,7 +190,7 @@ int __init ppc_init(void)
221 190
222arch_initcall(ppc_init); 191arch_initcall(ppc_init);
223 192
224static void __init irqstack_early_init(void) 193void __init irqstack_early_init(void)
225{ 194{
226 unsigned int i; 195 unsigned int i;
227 196
@@ -236,7 +205,7 @@ static void __init irqstack_early_init(void)
236} 205}
237 206
238#if defined(CONFIG_BOOKE) || defined(CONFIG_40x) 207#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
239static void __init exc_lvl_early_init(void) 208void __init exc_lvl_early_init(void)
240{ 209{
241 unsigned int i, hw_cpu; 210 unsigned int i, hw_cpu;
242 211
@@ -259,33 +228,25 @@ static void __init exc_lvl_early_init(void)
259#endif 228#endif
260 } 229 }
261} 230}
262#else
263#define exc_lvl_early_init()
264#endif 231#endif
265 232
266/* Warning, IO base is not yet inited */ 233void __init setup_power_save(void)
267void __init setup_arch(char **cmdline_p)
268{ 234{
269 *cmdline_p = boot_command_line; 235#ifdef CONFIG_6xx
270 236 if (cpu_has_feature(CPU_FTR_CAN_DOZE) ||
271 /* so udelay does something sensible, assume <= 1000 bogomips */ 237 cpu_has_feature(CPU_FTR_CAN_NAP))
272 loops_per_jiffy = 500000000 / HZ; 238 ppc_md.power_save = ppc6xx_idle;
273 239#endif
274 unflatten_device_tree();
275 check_for_initrd();
276
277 if (ppc_md.init_early)
278 ppc_md.init_early();
279
280 find_legacy_serial_ports();
281
282 smp_setup_cpu_maps();
283
284 /* Register early console */
285 register_early_udbg_console();
286 240
287 xmon_setup(); 241#ifdef CONFIG_E500
242 if (cpu_has_feature(CPU_FTR_CAN_DOZE) ||
243 cpu_has_feature(CPU_FTR_CAN_NAP))
244 ppc_md.power_save = e500_idle;
245#endif
246}
288 247
248__init void initialize_cache_info(void)
249{
289 /* 250 /*
290 * Set cache line size based on type of cpu as a default. 251 * Set cache line size based on type of cpu as a default.
291 * Systems with OF can look in the properties on the cpu node(s) 252 * Systems with OF can look in the properties on the cpu node(s)
@@ -296,32 +257,4 @@ void __init setup_arch(char **cmdline_p)
296 ucache_bsize = 0; 257 ucache_bsize = 0;
297 if (cpu_has_feature(CPU_FTR_UNIFIED_ID_CACHE)) 258 if (cpu_has_feature(CPU_FTR_UNIFIED_ID_CACHE))
298 ucache_bsize = icache_bsize = dcache_bsize; 259 ucache_bsize = icache_bsize = dcache_bsize;
299
300 if (ppc_md.panic)
301 setup_panic();
302
303 init_mm.start_code = (unsigned long)_stext;
304 init_mm.end_code = (unsigned long) _etext;
305 init_mm.end_data = (unsigned long) _edata;
306 init_mm.brk = klimit;
307
308 exc_lvl_early_init();
309
310 irqstack_early_init();
311
312 initmem_init();
313 if ( ppc_md.progress ) ppc_md.progress("setup_arch: initmem", 0x3eab);
314
315#ifdef CONFIG_DUMMY_CONSOLE
316 conswitchp = &dummy_con;
317#endif
318
319 if (ppc_md.setup_arch)
320 ppc_md.setup_arch();
321 if ( ppc_md.progress ) ppc_md.progress("arch: exit", 0x3eab);
322
323 paging_init();
324
325 /* Initialize the MMU context management stuff */
326 mmu_context_init();
327} 260}