aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/pseries/setup.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2006-03-28 07:15:54 -0500
committerPaul Mackerras <paulus@samba.org>2006-03-28 07:15:54 -0500
commite8222502ee6157e2713da9e0792c21f4ad458d50 (patch)
tree0f970fb99912c257a7e5254f863a53f79d22ab14 /arch/powerpc/platforms/pseries/setup.c
parent056cb48a2fb6fb31debf665695a9f97b45cfb8ec (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/platforms/pseries/setup.c')
-rw-r--r--arch/powerpc/platforms/pseries/setup.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 1b0c4c034a26..b2fbf8ba8fbb 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -372,24 +372,42 @@ static int pSeries_check_legacy_ioport(unsigned int baseport)
372/* 372/*
373 * Called very early, MMU is off, device-tree isn't unflattened 373 * Called very early, MMU is off, device-tree isn't unflattened
374 */ 374 */
375extern struct machdep_calls pSeries_md;
376 375
377static int __init pSeries_probe(int platform) 376static int __init pSeries_probe_hypertas(unsigned long node,
377 const char *uname, int depth,
378 void *data)
378{ 379{
379 if (platform != PLATFORM_PSERIES && 380 if (depth != 1 ||
380 platform != PLATFORM_PSERIES_LPAR) 381 (strcmp(uname, "rtas") != 0 && strcmp(uname, "rtas@0") != 0))
382 return 0;
383
384 if (of_get_flat_dt_prop(node, "ibm,hypertas-functions", NULL) != NULL)
385 powerpc_firmware_features |= FW_FEATURE_LPAR;
386
387 return 1;
388}
389
390static int __init pSeries_probe(void)
391{
392 char *dtype = of_get_flat_dt_prop(of_get_flat_dt_root(),
393 "device_type", NULL);
394 if (dtype == NULL)
395 return 0;
396 if (strcmp(dtype, "chrp"))
381 return 0; 397 return 0;
382 398
383 /* if we have some ppc_md fixups for LPAR to do, do 399 DBG("pSeries detected, looking for LPAR capability...\n");
384 * it here ...
385 */
386 400
387 if (platform == PLATFORM_PSERIES_LPAR) 401 /* Now try to figure out if we are running on LPAR */
388 powerpc_firmware_features |= FW_FEATURE_LPAR; 402 of_scan_flat_dt(pSeries_probe_hypertas, NULL);
403
404 DBG("Machine is%s LPAR !\n",
405 (powerpc_firmware_features & FW_FEATURE_LPAR) ? "" : " not");
389 406
390 return 1; 407 return 1;
391} 408}
392 409
410
393DECLARE_PER_CPU(unsigned long, smt_snooze_delay); 411DECLARE_PER_CPU(unsigned long, smt_snooze_delay);
394 412
395static void pseries_dedicated_idle_sleep(void) 413static void pseries_dedicated_idle_sleep(void)
@@ -501,7 +519,8 @@ static void pseries_kexec_cpu_down(int crash_shutdown, int secondary)
501} 519}
502#endif 520#endif
503 521
504struct machdep_calls __initdata pSeries_md = { 522define_machine(pseries) {
523 .name = "pSeries",
505 .probe = pSeries_probe, 524 .probe = pSeries_probe,
506 .setup_arch = pSeries_setup_arch, 525 .setup_arch = pSeries_setup_arch,
507 .init_early = pSeries_init_early, 526 .init_early = pSeries_init_early,