aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2005-08-03 00:40:16 -0400
committerPaul Mackerras <paulus@samba.org>2005-08-28 20:53:35 -0400
commit8d15a3e55f49678b0900dcf5c1cddb322a129325 (patch)
treec86205bde42833c25bf2f3b51f8b67f9d4e52a22 /arch/ppc64
parent1ababe11480d59d75be806804c71fa55d203a5a6 (diff)
[PATCH] ppc64: make firmware_has_feature() stronger
Make firmware_has_feature() evaluate at compile time for the non pSeries case and tidy up code where possible. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/ppc64')
-rw-r--r--arch/ppc64/kernel/Makefile2
-rw-r--r--arch/ppc64/kernel/cputable.c27
-rw-r--r--arch/ppc64/kernel/firmware.c47
-rw-r--r--arch/ppc64/kernel/pSeries_setup.c4
-rw-r--r--arch/ppc64/kernel/process.c9
-rw-r--r--arch/ppc64/kernel/sysfs.c2
-rw-r--r--arch/ppc64/kernel/time.c4
7 files changed, 54 insertions, 41 deletions
diff --git a/arch/ppc64/kernel/Makefile b/arch/ppc64/kernel/Makefile
index cbf87dcac92a..f4b3bfcc109d 100644
--- a/arch/ppc64/kernel/Makefile
+++ b/arch/ppc64/kernel/Makefile
@@ -11,7 +11,7 @@ obj-y := setup.o entry.o traps.o irq.o idle.o dma.o \
11 udbg.o binfmt_elf32.o sys_ppc32.o ioctl32.o \ 11 udbg.o binfmt_elf32.o sys_ppc32.o ioctl32.o \
12 ptrace32.o signal32.o rtc.o init_task.o \ 12 ptrace32.o signal32.o rtc.o init_task.o \
13 lmb.o cputable.o cpu_setup_power4.o idle_power4.o \ 13 lmb.o cputable.o cpu_setup_power4.o idle_power4.o \
14 iommu.o sysfs.o vdso.o pmc.o 14 iommu.o sysfs.o vdso.o pmc.o firmware.o
15obj-y += vdso32/ vdso64/ 15obj-y += vdso32/ vdso64/
16 16
17obj-$(CONFIG_PPC_OF) += of_device.o 17obj-$(CONFIG_PPC_OF) += of_device.o
diff --git a/arch/ppc64/kernel/cputable.c b/arch/ppc64/kernel/cputable.c
index 6294fc7bd442..4847f2ac8c9f 100644
--- a/arch/ppc64/kernel/cputable.c
+++ b/arch/ppc64/kernel/cputable.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Modifications for ppc64: 6 * Modifications for ppc64:
7 * Copyright (C) 2003 Dave Engebretsen <engebret@us.ibm.com> 7 * Copyright (C) 2003 Dave Engebretsen <engebret@us.ibm.com>
8 * 8 *
9 * This program is free software; you can redistribute it and/or 9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License 10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 11 * as published by the Free Software Foundation; either version
@@ -20,11 +20,9 @@
20#include <linux/module.h> 20#include <linux/module.h>
21 21
22#include <asm/cputable.h> 22#include <asm/cputable.h>
23#include <asm/firmware.h>
24 23
25struct cpu_spec* cur_cpu_spec = NULL; 24struct cpu_spec* cur_cpu_spec = NULL;
26EXPORT_SYMBOL(cur_cpu_spec); 25EXPORT_SYMBOL(cur_cpu_spec);
27unsigned long ppc64_firmware_features;
28 26
29/* NOTE: 27/* NOTE:
30 * Unlike ppc32, ppc64 will only call this once for the boot CPU, it's 28 * Unlike ppc32, ppc64 will only call this once for the boot CPU, it's
@@ -244,26 +242,3 @@ struct cpu_spec cpu_specs[] = {
244 .cpu_setup = __setup_cpu_power4, 242 .cpu_setup = __setup_cpu_power4,
245 } 243 }
246}; 244};
247
248firmware_feature_t firmware_features_table[FIRMWARE_MAX_FEATURES] = {
249 {FW_FEATURE_PFT, "hcall-pft"},
250 {FW_FEATURE_TCE, "hcall-tce"},
251 {FW_FEATURE_SPRG0, "hcall-sprg0"},
252 {FW_FEATURE_DABR, "hcall-dabr"},
253 {FW_FEATURE_COPY, "hcall-copy"},
254 {FW_FEATURE_ASR, "hcall-asr"},
255 {FW_FEATURE_DEBUG, "hcall-debug"},
256 {FW_FEATURE_PERF, "hcall-perf"},
257 {FW_FEATURE_DUMP, "hcall-dump"},
258 {FW_FEATURE_INTERRUPT, "hcall-interrupt"},
259 {FW_FEATURE_MIGRATE, "hcall-migrate"},
260 {FW_FEATURE_PERFMON, "hcall-perfmon"},
261 {FW_FEATURE_CRQ, "hcall-crq"},
262 {FW_FEATURE_VIO, "hcall-vio"},
263 {FW_FEATURE_RDMA, "hcall-rdma"},
264 {FW_FEATURE_LLAN, "hcall-lLAN"},
265 {FW_FEATURE_BULK, "hcall-bulk"},
266 {FW_FEATURE_XDABR, "hcall-xdabr"},
267 {FW_FEATURE_MULTITCE, "hcall-multi-tce"},
268 {FW_FEATURE_SPLPAR, "hcall-splpar"},
269};
diff --git a/arch/ppc64/kernel/firmware.c b/arch/ppc64/kernel/firmware.c
new file mode 100644
index 000000000000..d8432c0fb27d
--- /dev/null
+++ b/arch/ppc64/kernel/firmware.c
@@ -0,0 +1,47 @@
1/*
2 * arch/ppc64/kernel/firmware.c
3 *
4 * Extracted from cputable.c
5 *
6 * Copyright (C) 2001 Ben. Herrenschmidt (benh@kernel.crashing.org)
7 *
8 * Modifications for ppc64:
9 * Copyright (C) 2003 Dave Engebretsen <engebret@us.ibm.com>
10 * Copyright (C) 2005 Stephen Rothwell, IBM Corporation
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 */
17
18#include <linux/config.h>
19
20#include <asm/firmware.h>
21
22unsigned long ppc64_firmware_features;
23
24#ifdef CONFIG_PPC_PSERIES
25firmware_feature_t firmware_features_table[FIRMWARE_MAX_FEATURES] = {
26 {FW_FEATURE_PFT, "hcall-pft"},
27 {FW_FEATURE_TCE, "hcall-tce"},
28 {FW_FEATURE_SPRG0, "hcall-sprg0"},
29 {FW_FEATURE_DABR, "hcall-dabr"},
30 {FW_FEATURE_COPY, "hcall-copy"},
31 {FW_FEATURE_ASR, "hcall-asr"},
32 {FW_FEATURE_DEBUG, "hcall-debug"},
33 {FW_FEATURE_PERF, "hcall-perf"},
34 {FW_FEATURE_DUMP, "hcall-dump"},
35 {FW_FEATURE_INTERRUPT, "hcall-interrupt"},
36 {FW_FEATURE_MIGRATE, "hcall-migrate"},
37 {FW_FEATURE_PERFMON, "hcall-perfmon"},
38 {FW_FEATURE_CRQ, "hcall-crq"},
39 {FW_FEATURE_VIO, "hcall-vio"},
40 {FW_FEATURE_RDMA, "hcall-rdma"},
41 {FW_FEATURE_LLAN, "hcall-lLAN"},
42 {FW_FEATURE_BULK, "hcall-bulk"},
43 {FW_FEATURE_XDABR, "hcall-xdabr"},
44 {FW_FEATURE_MULTITCE, "hcall-multi-tce"},
45 {FW_FEATURE_SPLPAR, "hcall-splpar"},
46};
47#endif
diff --git a/arch/ppc64/kernel/pSeries_setup.c b/arch/ppc64/kernel/pSeries_setup.c
index 0058f32a3d89..7ae7a2ca1085 100644
--- a/arch/ppc64/kernel/pSeries_setup.c
+++ b/arch/ppc64/kernel/pSeries_setup.c
@@ -231,11 +231,9 @@ static void __init pSeries_setup_arch(void)
231 231
232 pSeries_nvram_init(); 232 pSeries_nvram_init();
233 233
234 if (firmware_has_feature(FW_FEATURE_SPLPAR))
235 vpa_init(boot_cpuid);
236
237 /* Choose an idle loop */ 234 /* Choose an idle loop */
238 if (firmware_has_feature(FW_FEATURE_SPLPAR)) { 235 if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
236 vpa_init(boot_cpuid);
239 if (get_paca()->lppaca.shared_proc) { 237 if (get_paca()->lppaca.shared_proc) {
240 printk(KERN_INFO "Using shared processor idle loop\n"); 238 printk(KERN_INFO "Using shared processor idle loop\n");
241 ppc_md.idle_loop = pseries_shared_idle; 239 ppc_md.idle_loop = pseries_shared_idle;
diff --git a/arch/ppc64/kernel/process.c b/arch/ppc64/kernel/process.c
index 9bad983333b1..7a7e027653ad 100644
--- a/arch/ppc64/kernel/process.c
+++ b/arch/ppc64/kernel/process.c
@@ -203,10 +203,9 @@ struct task_struct *__switch_to(struct task_struct *prev,
203 new_thread = &new->thread; 203 new_thread = &new->thread;
204 old_thread = &current->thread; 204 old_thread = &current->thread;
205 205
206/* Collect purr utilization data per process and per processor wise */ 206 /* Collect purr utilization data per process and per processor
207/* purr is nothing but processor time base */ 207 * wise purr is nothing but processor time base
208 208 */
209#if defined(CONFIG_PPC_PSERIES)
210 if (firmware_has_feature(FW_FEATURE_SPLPAR)) { 209 if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
211 struct cpu_usage *cu = &__get_cpu_var(cpu_usage_array); 210 struct cpu_usage *cu = &__get_cpu_var(cpu_usage_array);
212 long unsigned start_tb, current_tb; 211 long unsigned start_tb, current_tb;
@@ -215,8 +214,6 @@ struct task_struct *__switch_to(struct task_struct *prev,
215 old_thread->accum_tb += (current_tb - start_tb); 214 old_thread->accum_tb += (current_tb - start_tb);
216 new_thread->start_tb = current_tb; 215 new_thread->start_tb = current_tb;
217 } 216 }
218#endif
219
220 217
221 local_irq_save(flags); 218 local_irq_save(flags);
222 last = _switch(old_thread, new_thread); 219 last = _switch(old_thread, new_thread);
diff --git a/arch/ppc64/kernel/sysfs.c b/arch/ppc64/kernel/sysfs.c
index e399963521c0..eca15d25e026 100644
--- a/arch/ppc64/kernel/sysfs.c
+++ b/arch/ppc64/kernel/sysfs.c
@@ -153,11 +153,9 @@ void ppc64_enable_pmcs(void)
153 break; 153 break;
154 } 154 }
155 155
156#ifdef CONFIG_PPC_PSERIES
157 /* instruct hypervisor to maintain PMCs */ 156 /* instruct hypervisor to maintain PMCs */
158 if (firmware_has_feature(FW_FEATURE_SPLPAR)) 157 if (firmware_has_feature(FW_FEATURE_SPLPAR))
159 get_paca()->lppaca.pmcregs_in_use = 1; 158 get_paca()->lppaca.pmcregs_in_use = 1;
160#endif /* CONFIG_PPC_PSERIES */
161} 159}
162 160
163#else 161#else
diff --git a/arch/ppc64/kernel/time.c b/arch/ppc64/kernel/time.c
index d523056fd660..1696e1b05bb9 100644
--- a/arch/ppc64/kernel/time.c
+++ b/arch/ppc64/kernel/time.c
@@ -371,13 +371,11 @@ int timer_interrupt(struct pt_regs * regs)
371 process_hvlpevents(regs); 371 process_hvlpevents(regs);
372#endif 372#endif
373 373
374/* collect purr register values often, for accurate calculations */ 374 /* collect purr register values often, for accurate calculations */
375#if defined(CONFIG_PPC_PSERIES)
376 if (firmware_has_feature(FW_FEATURE_SPLPAR)) { 375 if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
377 struct cpu_usage *cu = &__get_cpu_var(cpu_usage_array); 376 struct cpu_usage *cu = &__get_cpu_var(cpu_usage_array);
378 cu->current_tb = mfspr(SPRN_PURR); 377 cu->current_tb = mfspr(SPRN_PURR);
379 } 378 }
380#endif
381 379
382 irq_exit(); 380 irq_exit();
383 381