diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-03-28 07:15:54 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-03-28 07:15:54 -0500 |
commit | e8222502ee6157e2713da9e0792c21f4ad458d50 (patch) | |
tree | 0f970fb99912c257a7e5254f863a53f79d22ab14 /arch/powerpc/kernel/setup_64.c | |
parent | 056cb48a2fb6fb31debf665695a9f97b45cfb8ec (diff) |
[PATCH] powerpc: Kill _machine and hard-coded platform numbers
This removes statically assigned platform numbers and reworks the
powerpc platform probe code to use a better mechanism. With this,
board support files can simply declare a new machine type with a
macro, and implement a probe() function that uses the flattened
device-tree to detect if they apply for a given machine.
We now have a machine_is() macro that replaces the comparisons of
_machine with the various PLATFORM_* constants. This commit also
changes various drivers to use the new macro instead of looking at
_machine.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/setup_64.c')
-rw-r--r-- | arch/powerpc/kernel/setup_64.c | 56 |
1 files changed, 4 insertions, 52 deletions
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index 5b63a861ef43..6aea1fb74b69 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c | |||
@@ -95,11 +95,6 @@ int dcache_bsize; | |||
95 | int icache_bsize; | 95 | int icache_bsize; |
96 | int ucache_bsize; | 96 | int ucache_bsize; |
97 | 97 | ||
98 | /* The main machine-dep calls structure | ||
99 | */ | ||
100 | struct machdep_calls ppc_md; | ||
101 | EXPORT_SYMBOL(ppc_md); | ||
102 | |||
103 | #ifdef CONFIG_MAGIC_SYSRQ | 98 | #ifdef CONFIG_MAGIC_SYSRQ |
104 | unsigned long SYSRQ_KEY; | 99 | unsigned long SYSRQ_KEY; |
105 | #endif /* CONFIG_MAGIC_SYSRQ */ | 100 | #endif /* CONFIG_MAGIC_SYSRQ */ |
@@ -160,32 +155,6 @@ early_param("smt-enabled", early_smt_enabled); | |||
160 | #define check_smt_enabled() | 155 | #define check_smt_enabled() |
161 | #endif /* CONFIG_SMP */ | 156 | #endif /* CONFIG_SMP */ |
162 | 157 | ||
163 | extern struct machdep_calls pSeries_md; | ||
164 | extern struct machdep_calls pmac_md; | ||
165 | extern struct machdep_calls maple_md; | ||
166 | extern struct machdep_calls cell_md; | ||
167 | extern struct machdep_calls iseries_md; | ||
168 | |||
169 | /* Ultimately, stuff them in an elf section like initcalls... */ | ||
170 | static struct machdep_calls __initdata *machines[] = { | ||
171 | #ifdef CONFIG_PPC_PSERIES | ||
172 | &pSeries_md, | ||
173 | #endif /* CONFIG_PPC_PSERIES */ | ||
174 | #ifdef CONFIG_PPC_PMAC | ||
175 | &pmac_md, | ||
176 | #endif /* CONFIG_PPC_PMAC */ | ||
177 | #ifdef CONFIG_PPC_MAPLE | ||
178 | &maple_md, | ||
179 | #endif /* CONFIG_PPC_MAPLE */ | ||
180 | #ifdef CONFIG_PPC_CELL | ||
181 | &cell_md, | ||
182 | #endif | ||
183 | #ifdef CONFIG_PPC_ISERIES | ||
184 | &iseries_md, | ||
185 | #endif | ||
186 | NULL | ||
187 | }; | ||
188 | |||
189 | /* | 158 | /* |
190 | * Early initialization entry point. This is called by head.S | 159 | * Early initialization entry point. This is called by head.S |
191 | * with MMU translation disabled. We rely on the "feature" of | 160 | * with MMU translation disabled. We rely on the "feature" of |
@@ -207,12 +176,10 @@ static struct machdep_calls __initdata *machines[] = { | |||
207 | 176 | ||
208 | void __init early_setup(unsigned long dt_ptr) | 177 | void __init early_setup(unsigned long dt_ptr) |
209 | { | 178 | { |
210 | static struct machdep_calls **mach; | ||
211 | |||
212 | /* Enable early debugging if any specified (see udbg.h) */ | 179 | /* Enable early debugging if any specified (see udbg.h) */ |
213 | udbg_early_init(); | 180 | udbg_early_init(); |
214 | 181 | ||
215 | DBG(" -> early_setup()\n"); | 182 | DBG(" -> early_setup(), dt_ptr: 0x%lx\n", dt_ptr); |
216 | 183 | ||
217 | /* | 184 | /* |
218 | * Do early initializations using the flattened device | 185 | * Do early initializations using the flattened device |
@@ -229,22 +196,8 @@ void __init early_setup(unsigned long dt_ptr) | |||
229 | get_paca()->stab_real = __pa((u64)&initial_stab); | 196 | get_paca()->stab_real = __pa((u64)&initial_stab); |
230 | get_paca()->stab_addr = (u64)&initial_stab; | 197 | get_paca()->stab_addr = (u64)&initial_stab; |
231 | 198 | ||
232 | /* | 199 | /* Probe the machine type */ |
233 | * Iterate all ppc_md structures until we find the proper | 200 | probe_machine(); |
234 | * one for the current machine type | ||
235 | */ | ||
236 | DBG("Probing machine type for platform %x...\n", _machine); | ||
237 | |||
238 | for (mach = machines; *mach; mach++) { | ||
239 | if ((*mach)->probe(_machine)) | ||
240 | break; | ||
241 | } | ||
242 | /* What can we do if we didn't find ? */ | ||
243 | if (*mach == NULL) { | ||
244 | DBG("No suitable machine found !\n"); | ||
245 | for (;;); | ||
246 | } | ||
247 | ppc_md = **mach; | ||
248 | 201 | ||
249 | #ifdef CONFIG_CRASH_DUMP | 202 | #ifdef CONFIG_CRASH_DUMP |
250 | kdump_setup(); | 203 | kdump_setup(); |
@@ -346,7 +299,7 @@ static void __init initialize_cache_info(void) | |||
346 | const char *dc, *ic; | 299 | const char *dc, *ic; |
347 | 300 | ||
348 | /* Then read cache informations */ | 301 | /* Then read cache informations */ |
349 | if (_machine == PLATFORM_POWERMAC) { | 302 | if (machine_is(powermac)) { |
350 | dc = "d-cache-block-size"; | 303 | dc = "d-cache-block-size"; |
351 | ic = "i-cache-block-size"; | 304 | ic = "i-cache-block-size"; |
352 | } else { | 305 | } else { |
@@ -490,7 +443,6 @@ void __init setup_system(void) | |||
490 | printk("ppc64_pft_size = 0x%lx\n", ppc64_pft_size); | 443 | printk("ppc64_pft_size = 0x%lx\n", ppc64_pft_size); |
491 | printk("ppc64_interrupt_controller = 0x%ld\n", | 444 | printk("ppc64_interrupt_controller = 0x%ld\n", |
492 | ppc64_interrupt_controller); | 445 | ppc64_interrupt_controller); |
493 | printk("platform = 0x%x\n", _machine); | ||
494 | printk("physicalMemorySize = 0x%lx\n", lmb_phys_mem_size()); | 446 | printk("physicalMemorySize = 0x%lx\n", lmb_phys_mem_size()); |
495 | printk("ppc64_caches.dcache_line_size = 0x%x\n", | 447 | printk("ppc64_caches.dcache_line_size = 0x%x\n", |
496 | ppc64_caches.dline_size); | 448 | ppc64_caches.dline_size); |