aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2006-03-21 04:45:59 -0500
committerPaul Mackerras <paulus@samba.org>2006-03-21 23:04:17 -0500
commit57cfb814f698d30894bc28e22125550193ebe549 (patch)
tree755fd11b1a528f8de7913119b457f866734cb81a
parent3d15910bfbeb02286ce4b5009c53754e88066ccb (diff)
[PATCH] powerpc: Replace platform_is_lpar() with a firmware feature
It has been decreed that platform numbers are evil, so as a step in that direction, replace platform_is_lpar() with a FW_FEATURE_LPAR bit. Currently FW_FEATURE_LPAR really means i/pSeries LPAR, in the future we might have to clean that up if we need to be more specific about what LPAR actually means. But that's another patch ... Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r--arch/powerpc/mm/hash_utils_64.c4
-rw-r--r--arch/powerpc/oprofile/op_model_power4.c3
-rw-r--r--arch/powerpc/platforms/iseries/setup.c10
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c2
-rw-r--r--arch/powerpc/platforms/pseries/setup.c11
-rw-r--r--arch/powerpc/platforms/pseries/smp.c2
-rw-r--r--arch/powerpc/platforms/pseries/xics.c3
-rw-r--r--include/asm-powerpc/firmware.h7
-rw-r--r--include/asm-powerpc/processor.h1
9 files changed, 26 insertions, 17 deletions
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 7b4eccffd002..89b35c181314 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -422,7 +422,7 @@ void __init htab_initialize(void)
422 422
423 htab_hash_mask = pteg_count - 1; 423 htab_hash_mask = pteg_count - 1;
424 424
425 if (platform_is_lpar()) { 425 if (firmware_has_feature(FW_FEATURE_LPAR)) {
426 /* Using a hypervisor which owns the htab */ 426 /* Using a hypervisor which owns the htab */
427 htab_address = NULL; 427 htab_address = NULL;
428 _SDR1 = 0; 428 _SDR1 = 0;
@@ -517,7 +517,7 @@ void __init htab_initialize(void)
517 517
518void htab_initialize_secondary(void) 518void htab_initialize_secondary(void)
519{ 519{
520 if (!platform_is_lpar()) 520 if (!firmware_has_feature(FW_FEATURE_LPAR))
521 mtspr(SPRN_SDR1, _SDR1); 521 mtspr(SPRN_SDR1, _SDR1);
522} 522}
523 523
diff --git a/arch/powerpc/oprofile/op_model_power4.c b/arch/powerpc/oprofile/op_model_power4.c
index 659a021da0c7..4b06e53eb9b4 100644
--- a/arch/powerpc/oprofile/op_model_power4.c
+++ b/arch/powerpc/oprofile/op_model_power4.c
@@ -10,6 +10,7 @@
10#include <linux/oprofile.h> 10#include <linux/oprofile.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/smp.h> 12#include <linux/smp.h>
13#include <asm/firmware.h>
13#include <asm/ptrace.h> 14#include <asm/ptrace.h>
14#include <asm/system.h> 15#include <asm/system.h>
15#include <asm/processor.h> 16#include <asm/processor.h>
@@ -232,7 +233,7 @@ static unsigned long get_pc(struct pt_regs *regs)
232 mmcra = mfspr(SPRN_MMCRA); 233 mmcra = mfspr(SPRN_MMCRA);
233 234
234 /* Were we in the hypervisor? */ 235 /* Were we in the hypervisor? */
235 if (platform_is_lpar() && (mmcra & MMCRA_SIHV)) 236 if (firmware_has_feature(FW_FEATURE_LPAR) && (mmcra & MMCRA_SIHV))
236 /* function descriptor madness */ 237 /* function descriptor madness */
237 return *((unsigned long *)hypervisor_bucket); 238 return *((unsigned long *)hypervisor_bucket);
238 239
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c
index 3ecc4a652d82..b08c3686f903 100644
--- a/arch/powerpc/platforms/iseries/setup.c
+++ b/arch/powerpc/platforms/iseries/setup.c
@@ -303,8 +303,6 @@ static void __init iSeries_init_early(void)
303{ 303{
304 DBG(" -> iSeries_init_early()\n"); 304 DBG(" -> iSeries_init_early()\n");
305 305
306 ppc64_firmware_features = FW_FEATURE_ISERIES;
307
308 ppc64_interrupt_controller = IC_ISERIES; 306 ppc64_interrupt_controller = IC_ISERIES;
309 307
310#if defined(CONFIG_BLK_DEV_INITRD) 308#if defined(CONFIG_BLK_DEV_INITRD)
@@ -711,7 +709,13 @@ void __init iSeries_init_IRQ(void) { }
711 709
712static int __init iseries_probe(int platform) 710static int __init iseries_probe(int platform)
713{ 711{
714 return PLATFORM_ISERIES_LPAR == platform; 712 if (PLATFORM_ISERIES_LPAR != platform)
713 return 0;
714
715 ppc64_firmware_features |= FW_FEATURE_ISERIES;
716 ppc64_firmware_features |= FW_FEATURE_LPAR;
717
718 return 1;
715} 719}
716 720
717struct machdep_calls __initdata iseries_md = { 721struct machdep_calls __initdata iseries_md = {
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 57930e23cc74..2643078433f0 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -580,7 +580,7 @@ void iommu_init_early_pSeries(void)
580 return; 580 return;
581 } 581 }
582 582
583 if (platform_is_lpar()) { 583 if (firmware_has_feature(FW_FEATURE_LPAR)) {
584 if (firmware_has_feature(FW_FEATURE_MULTITCE)) { 584 if (firmware_has_feature(FW_FEATURE_MULTITCE)) {
585 ppc_md.tce_build = tce_buildmulti_pSeriesLP; 585 ppc_md.tce_build = tce_buildmulti_pSeriesLP;
586 ppc_md.tce_free = tce_freemulti_pSeriesLP; 586 ppc_md.tce_free = tce_freemulti_pSeriesLP;
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 149751a3742a..44d5c7fdcd97 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -246,7 +246,7 @@ static void __init pSeries_setup_arch(void)
246 ppc_md.idle_loop = default_idle; 246 ppc_md.idle_loop = default_idle;
247 } 247 }
248 248
249 if (platform_is_lpar()) 249 if (firmware_has_feature(FW_FEATURE_LPAR))
250 ppc_md.enable_pmcs = pseries_lpar_enable_pmcs; 250 ppc_md.enable_pmcs = pseries_lpar_enable_pmcs;
251 else 251 else
252 ppc_md.enable_pmcs = power4_enable_pmcs; 252 ppc_md.enable_pmcs = power4_enable_pmcs;
@@ -324,12 +324,12 @@ static void __init pSeries_init_early(void)
324 324
325 fw_feature_init(); 325 fw_feature_init();
326 326
327 if (platform_is_lpar()) 327 if (firmware_has_feature(FW_FEATURE_LPAR))
328 hpte_init_lpar(); 328 hpte_init_lpar();
329 else 329 else
330 hpte_init_native(); 330 hpte_init_native();
331 331
332 if (platform_is_lpar()) 332 if (firmware_has_feature(FW_FEATURE_LPAR))
333 find_udbg_vterm(); 333 find_udbg_vterm();
334 334
335 if (firmware_has_feature(FW_FEATURE_DABR)) 335 if (firmware_has_feature(FW_FEATURE_DABR))
@@ -385,6 +385,9 @@ static int __init pSeries_probe(int platform)
385 * it here ... 385 * it here ...
386 */ 386 */
387 387
388 if (platform == PLATFORM_PSERIES_LPAR)
389 ppc64_firmware_features |= FW_FEATURE_LPAR;
390
388 return 1; 391 return 1;
389} 392}
390 393
@@ -524,7 +527,7 @@ static void pseries_shared_idle(void)
524 527
525static int pSeries_pci_probe_mode(struct pci_bus *bus) 528static int pSeries_pci_probe_mode(struct pci_bus *bus)
526{ 529{
527 if (platform_is_lpar()) 530 if (firmware_has_feature(FW_FEATURE_LPAR))
528 return PCI_PROBE_DEVTREE; 531 return PCI_PROBE_DEVTREE;
529 return PCI_PROBE_NORMAL; 532 return PCI_PROBE_NORMAL;
530} 533}
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index 8d710af50756..3cf78a6cd27c 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -443,7 +443,7 @@ void __init smp_init_pSeries(void)
443 smp_ops->cpu_die = pSeries_cpu_die; 443 smp_ops->cpu_die = pSeries_cpu_die;
444 444
445 /* Processors can be added/removed only on LPAR */ 445 /* Processors can be added/removed only on LPAR */
446 if (platform_is_lpar()) 446 if (firmware_has_feature(FW_FEATURE_LPAR))
447 pSeries_reconfig_notifier_register(&pSeries_smp_nb); 447 pSeries_reconfig_notifier_register(&pSeries_smp_nb);
448#endif 448#endif
449 449
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
index fd823c7c9ac8..eb86cdb9b802 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -20,6 +20,7 @@
20#include <linux/gfp.h> 20#include <linux/gfp.h>
21#include <linux/radix-tree.h> 21#include <linux/radix-tree.h>
22#include <linux/cpu.h> 22#include <linux/cpu.h>
23#include <asm/firmware.h>
23#include <asm/prom.h> 24#include <asm/prom.h>
24#include <asm/io.h> 25#include <asm/io.h>
25#include <asm/pgtable.h> 26#include <asm/pgtable.h>
@@ -536,7 +537,7 @@ nextnode:
536 of_node_put(np); 537 of_node_put(np);
537 } 538 }
538 539
539 if (platform_is_lpar()) 540 if (firmware_has_feature(FW_FEATURE_LPAR))
540 ops = &pSeriesLP_ops; 541 ops = &pSeriesLP_ops;
541 else { 542 else {
542#ifdef CONFIG_SMP 543#ifdef CONFIG_SMP
diff --git a/include/asm-powerpc/firmware.h b/include/asm-powerpc/firmware.h
index b7791a1b05db..ce3788224ed0 100644
--- a/include/asm-powerpc/firmware.h
+++ b/include/asm-powerpc/firmware.h
@@ -41,6 +41,7 @@
41#define FW_FEATURE_MULTITCE (1UL<<19) 41#define FW_FEATURE_MULTITCE (1UL<<19)
42#define FW_FEATURE_SPLPAR (1UL<<20) 42#define FW_FEATURE_SPLPAR (1UL<<20)
43#define FW_FEATURE_ISERIES (1UL<<21) 43#define FW_FEATURE_ISERIES (1UL<<21)
44#define FW_FEATURE_LPAR (1UL<<22)
44 45
45enum { 46enum {
46#ifdef CONFIG_PPC64 47#ifdef CONFIG_PPC64
@@ -51,10 +52,10 @@ enum {
51 FW_FEATURE_MIGRATE | FW_FEATURE_PERFMON | FW_FEATURE_CRQ | 52 FW_FEATURE_MIGRATE | FW_FEATURE_PERFMON | FW_FEATURE_CRQ |
52 FW_FEATURE_VIO | FW_FEATURE_RDMA | FW_FEATURE_LLAN | 53 FW_FEATURE_VIO | FW_FEATURE_RDMA | FW_FEATURE_LLAN |
53 FW_FEATURE_BULK | FW_FEATURE_XDABR | FW_FEATURE_MULTITCE | 54 FW_FEATURE_BULK | FW_FEATURE_XDABR | FW_FEATURE_MULTITCE |
54 FW_FEATURE_SPLPAR, 55 FW_FEATURE_SPLPAR | FW_FEATURE_LPAR,
55 FW_FEATURE_PSERIES_ALWAYS = 0, 56 FW_FEATURE_PSERIES_ALWAYS = 0,
56 FW_FEATURE_ISERIES_POSSIBLE = FW_FEATURE_ISERIES, 57 FW_FEATURE_ISERIES_POSSIBLE = FW_FEATURE_ISERIES | FW_FEATURE_LPAR,
57 FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES, 58 FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES | FW_FEATURE_LPAR,
58 FW_FEATURE_POSSIBLE = 59 FW_FEATURE_POSSIBLE =
59#ifdef CONFIG_PPC_PSERIES 60#ifdef CONFIG_PPC_PSERIES
60 FW_FEATURE_PSERIES_POSSIBLE | 61 FW_FEATURE_PSERIES_POSSIBLE |
diff --git a/include/asm-powerpc/processor.h b/include/asm-powerpc/processor.h
index 415fa393b00c..1c64a211cf19 100644
--- a/include/asm-powerpc/processor.h
+++ b/include/asm-powerpc/processor.h
@@ -52,7 +52,6 @@
52#ifdef __KERNEL__ 52#ifdef __KERNEL__
53#define platform_is_pseries() (_machine == PLATFORM_PSERIES || \ 53#define platform_is_pseries() (_machine == PLATFORM_PSERIES || \
54 _machine == PLATFORM_PSERIES_LPAR) 54 _machine == PLATFORM_PSERIES_LPAR)
55#define platform_is_lpar() (!!(_machine & PLATFORM_LPAR))
56 55
57#if defined(CONFIG_PPC_MULTIPLATFORM) 56#if defined(CONFIG_PPC_MULTIPLATFORM)
58extern int _machine; 57extern int _machine;