[PATCH] 2/4 create firmware_has_feature()
Stephen Rothwell
sfr at canb.auug.org.au
Wed Aug 3 14:35:25 EST 2005
Create the firmware_has_feature() inline and move the firmware feature
stuff into its own header file.
Signed-off-by: Stephen Rothwell <sfr at canb.auug.org.au>
--
Cheers,
Stephen Rothwell sfr at canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
diff -ruNp linus-firmware.1/arch/ppc64/kernel/cputable.c linus-firmware.2/arch/ppc64/kernel/cputable.c
--- linus-firmware.1/arch/ppc64/kernel/cputable.c 2005-07-22 16:48:41.000000000 +1000
+++ linus-firmware.2/arch/ppc64/kernel/cputable.c 2005-07-22 17:09:21.000000000 +1000
@@ -20,6 +20,7 @@
#include <linux/module.h>
#include <asm/cputable.h>
+#include <asm/firmware.h>
struct cpu_spec* cur_cpu_spec = NULL;
EXPORT_SYMBOL(cur_cpu_spec);
diff -ruNp linus-firmware.1/arch/ppc64/kernel/lparcfg.c linus-firmware.2/arch/ppc64/kernel/lparcfg.c
--- linus-firmware.1/arch/ppc64/kernel/lparcfg.c 2005-07-22 16:38:40.000000000 +1000
+++ linus-firmware.2/arch/ppc64/kernel/lparcfg.c 2005-07-22 17:11:46.000000000 +1000
@@ -29,7 +29,7 @@
#include <asm/iSeries/HvLpConfig.h>
#include <asm/lppaca.h>
#include <asm/hvcall.h>
-#include <asm/cputable.h>
+#include <asm/firmware.h>
#include <asm/rtas.h>
#include <asm/system.h>
#include <asm/time.h>
@@ -377,7 +377,7 @@ static int lparcfg_data(struct seq_file
partition_active_processors = lparcfg_count_active_processors();
- if (ppc64_firmware_features & FW_FEATURE_SPLPAR) {
+ if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
unsigned long h_entitled, h_unallocated;
unsigned long h_aggregation, h_resource;
unsigned long pool_idle_time, pool_procs;
@@ -571,7 +571,7 @@ int __init lparcfg_init(void)
mode_t mode = S_IRUSR;
/* Allow writing if we have FW_FEATURE_SPLPAR */
- if (ppc64_firmware_features & FW_FEATURE_SPLPAR) {
+ if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
lparcfg_fops.write = lparcfg_write;
mode |= S_IWUSR;
}
diff -ruNp linus-firmware.1/arch/ppc64/kernel/pSeries_iommu.c linus-firmware.2/arch/ppc64/kernel/pSeries_iommu.c
--- linus-firmware.1/arch/ppc64/kernel/pSeries_iommu.c 2005-07-22 16:38:57.000000000 +1000
+++ linus-firmware.2/arch/ppc64/kernel/pSeries_iommu.c 2005-07-22 17:12:33.000000000 +1000
@@ -45,6 +45,7 @@
#include <asm/plpar_wrappers.h>
#include <asm/pSeries_reconfig.h>
#include <asm/systemcfg.h>
+#include <asm/firmware.h>
#include "pci.h"
#define DBG(fmt...)
@@ -546,7 +547,7 @@ void iommu_init_early_pSeries(void)
}
if (systemcfg->platform & PLATFORM_LPAR) {
- if (ppc64_firmware_features & FW_FEATURE_MULTITCE) {
+ if (firmware_has_feature(FW_FEATURE_MULTITCE)) {
ppc_md.tce_build = tce_buildmulti_pSeriesLP;
ppc_md.tce_free = tce_freemulti_pSeriesLP;
} else {
diff -ruNp linus-firmware.1/arch/ppc64/kernel/pSeries_setup.c linus-firmware.2/arch/ppc64/kernel/pSeries_setup.c
--- linus-firmware.1/arch/ppc64/kernel/pSeries_setup.c 2005-07-22 16:40:08.000000000 +1000
+++ linus-firmware.2/arch/ppc64/kernel/pSeries_setup.c 2005-07-22 17:14:01.000000000 +1000
@@ -60,7 +60,7 @@
#include <asm/nvram.h>
#include <asm/plpar_wrappers.h>
#include <asm/xics.h>
-#include <asm/cputable.h>
+#include <asm/firmware.h>
#include "i8259.h"
#include "mpic.h"
@@ -231,11 +231,11 @@ static void __init pSeries_setup_arch(vo
pSeries_nvram_init();
- if (ppc64_firmware_features & FW_FEATURE_SPLPAR)
+ if (firmware_has_feature(FW_FEATURE_SPLPAR))
vpa_init(boot_cpuid);
/* Choose an idle loop */
- if (ppc64_firmware_features & FW_FEATURE_SPLPAR) {
+ if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
if (get_paca()->lppaca.shared_proc) {
printk(KERN_INFO "Using shared processor idle loop\n");
ppc_md.idle_loop = pseries_shared_idle;
diff -ruNp linus-firmware.1/arch/ppc64/kernel/pSeries_smp.c linus-firmware.2/arch/ppc64/kernel/pSeries_smp.c
--- linus-firmware.1/arch/ppc64/kernel/pSeries_smp.c 2005-07-22 16:40:18.000000000 +1000
+++ linus-firmware.2/arch/ppc64/kernel/pSeries_smp.c 2005-07-22 17:15:01.000000000 +1000
@@ -41,6 +41,7 @@
#include <asm/machdep.h>
#include <asm/xics.h>
#include <asm/cputable.h>
+#include <asm/firmware.h>
#include <asm/system.h>
#include <asm/rtas.h>
#include <asm/plpar_wrappers.h>
@@ -326,7 +327,7 @@ static void __devinit smp_xics_setup_cpu
if (cpu != boot_cpuid)
xics_setup_cpu();
- if (ppc64_firmware_features & FW_FEATURE_SPLPAR)
+ if (firmware_has_feature(FW_FEATURE_SPLPAR))
vpa_init(cpu);
cpu_clear(cpu, of_spin_map);
diff -ruNp linus-firmware.1/arch/ppc64/kernel/process.c linus-firmware.2/arch/ppc64/kernel/process.c
--- linus-firmware.1/arch/ppc64/kernel/process.c 2005-07-22 16:40:26.000000000 +1000
+++ linus-firmware.2/arch/ppc64/kernel/process.c 2005-07-22 17:15:35.000000000 +1000
@@ -50,6 +50,7 @@
#include <asm/machdep.h>
#include <asm/iSeries/HvCallHpt.h>
#include <asm/cputable.h>
+#include <asm/firmware.h>
#include <asm/sections.h>
#include <asm/tlbflush.h>
#include <asm/time.h>
@@ -206,7 +207,7 @@ struct task_struct *__switch_to(struct t
/* purr is nothing but processor time base */
#if defined(CONFIG_PPC_PSERIES)
- if (ppc64_firmware_features & FW_FEATURE_SPLPAR) {
+ if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
struct cpu_usage *cu = &__get_cpu_var(cpu_usage_array);
long unsigned start_tb, current_tb;
start_tb = old_thread->start_tb;
diff -ruNp linus-firmware.1/arch/ppc64/kernel/sysfs.c linus-firmware.2/arch/ppc64/kernel/sysfs.c
--- linus-firmware.1/arch/ppc64/kernel/sysfs.c 2005-07-22 16:40:34.000000000 +1000
+++ linus-firmware.2/arch/ppc64/kernel/sysfs.c 2005-07-22 17:15:57.000000000 +1000
@@ -13,6 +13,7 @@
#include <asm/current.h>
#include <asm/processor.h>
#include <asm/cputable.h>
+#include <asm/firmware.h>
#include <asm/hvcall.h>
#include <asm/prom.h>
#include <asm/systemcfg.h>
@@ -154,7 +155,7 @@ void ppc64_enable_pmcs(void)
#ifdef CONFIG_PPC_PSERIES
/* instruct hypervisor to maintain PMCs */
- if (ppc64_firmware_features & FW_FEATURE_SPLPAR)
+ if (firmware_has_feature(FW_FEATURE_SPLPAR))
get_paca()->lppaca.pmcregs_in_use = 1;
#endif /* CONFIG_PPC_PSERIES */
}
diff -ruNp linus-firmware.1/arch/ppc64/kernel/time.c linus-firmware.2/arch/ppc64/kernel/time.c
--- linus-firmware.1/arch/ppc64/kernel/time.c 2005-07-22 16:40:43.000000000 +1000
+++ linus-firmware.2/arch/ppc64/kernel/time.c 2005-07-22 17:16:40.000000000 +1000
@@ -67,6 +67,7 @@
#include <asm/prom.h>
#include <asm/sections.h>
#include <asm/systemcfg.h>
+#include <asm/firmware.h>
u64 jiffies_64 __cacheline_aligned_in_smp = INITIAL_JIFFIES;
@@ -372,7 +373,7 @@ int timer_interrupt(struct pt_regs * reg
/* collect purr register values often, for accurate calculations */
#if defined(CONFIG_PPC_PSERIES)
- if (ppc64_firmware_features & FW_FEATURE_SPLPAR) {
+ if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
struct cpu_usage *cu = &__get_cpu_var(cpu_usage_array);
cu->current_tb = mfspr(SPRN_PURR);
}
diff -ruNp linus-firmware.1/include/asm-ppc64/cputable.h linus-firmware.2/include/asm-ppc64/cputable.h
--- linus-firmware.1/include/asm-ppc64/cputable.h 2005-07-22 16:42:23.000000000 +1000
+++ linus-firmware.2/include/asm-ppc64/cputable.h 2005-07-22 17:06:42.000000000 +1000
@@ -66,44 +66,6 @@ static inline unsigned long cpu_has_feat
return cur_cpu_spec->cpu_features & feature;
}
-
-/* This is used to identify firmware features which are available
- * to the kernel.
- */
-extern unsigned long ppc64_firmware_features;
-
-/* firmware feature bitmask values */
-#define FIRMWARE_MAX_FEATURES 63
-
-#define FW_FEATURE_PFT (1UL<<0)
-#define FW_FEATURE_TCE (1UL<<1)
-#define FW_FEATURE_SPRG0 (1UL<<2)
-#define FW_FEATURE_DABR (1UL<<3)
-#define FW_FEATURE_COPY (1UL<<4)
-#define FW_FEATURE_ASR (1UL<<5)
-#define FW_FEATURE_DEBUG (1UL<<6)
-#define FW_FEATURE_TERM (1UL<<7)
-#define FW_FEATURE_PERF (1UL<<8)
-#define FW_FEATURE_DUMP (1UL<<9)
-#define FW_FEATURE_INTERRUPT (1UL<<10)
-#define FW_FEATURE_MIGRATE (1UL<<11)
-#define FW_FEATURE_PERFMON (1UL<<12)
-#define FW_FEATURE_CRQ (1UL<<13)
-#define FW_FEATURE_VIO (1UL<<14)
-#define FW_FEATURE_RDMA (1UL<<15)
-#define FW_FEATURE_LLAN (1UL<<16)
-#define FW_FEATURE_BULK (1UL<<17)
-#define FW_FEATURE_XDABR (1UL<<18)
-#define FW_FEATURE_MULTITCE (1UL<<19)
-#define FW_FEATURE_SPLPAR (1UL<<20)
-
-typedef struct {
- unsigned long val;
- char * name;
-} firmware_feature_t;
-
-extern firmware_feature_t firmware_features_table[];
-
#endif /* __ASSEMBLY__ */
/* CPU kernel features */
@@ -140,10 +102,8 @@ extern firmware_feature_t firmware_featu
#define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000)
#define CPU_FTR_CTRL ASM_CONST(0x0000100000000000)
-/* Platform firmware features */
-#define FW_FTR_ ASM_CONST(0x0000000000000001)
-
#ifndef __ASSEMBLY__
+
#define COMMON_USER_PPC64 (PPC_FEATURE_32 | PPC_FEATURE_64 | \
PPC_FEATURE_HAS_FPU | PPC_FEATURE_HAS_MMU)
@@ -156,10 +116,9 @@ extern firmware_feature_t firmware_featu
#define CPU_FTR_PPCAS_ARCH_V2 (CPU_FTR_PPCAS_ARCH_V2_BASE)
#else
#define CPU_FTR_PPCAS_ARCH_V2 (CPU_FTR_PPCAS_ARCH_V2_BASE | CPU_FTR_16M_PAGE)
-#endif
+#endif /* CONFIG_PPC_ISERIES */
-#define COMMON_PPC64_FW (0)
-#endif
+#endif /* __ASSEMBLY */
#ifdef __ASSEMBLY__
diff -ruNp linus-firmware.1/include/asm-ppc64/firmware.h linus-firmware.2/include/asm-ppc64/firmware.h
--- linus-firmware.1/include/asm-ppc64/firmware.h 1970-01-01 10:00:00.000000000 +1000
+++ linus-firmware.2/include/asm-ppc64/firmware.h 2005-07-22 17:18:19.000000000 +1000
@@ -0,0 +1,67 @@
+/*
+ * include/asm-ppc64/firmware.h
+ *
+ * Extracted from include/asm-ppc64/cputable.h
+ *
+ * Copyright (C) 2001 Ben. Herrenschmidt (benh at kernel.crashing.org)
+ *
+ * Modifications for ppc64:
+ * Copyright (C) 2003 Dave Engebretsen <engebret at us.ibm.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+#ifndef __ASM_PPC_FIRMWARE_H
+#define __ASM_PPC_FIRMWARE_H
+
+#ifdef __KERNEL__
+
+#ifndef __ASSEMBLY__
+
+/* firmware feature bitmask values */
+#define FIRMWARE_MAX_FEATURES 63
+
+#define FW_FEATURE_PFT (1UL<<0)
+#define FW_FEATURE_TCE (1UL<<1)
+#define FW_FEATURE_SPRG0 (1UL<<2)
+#define FW_FEATURE_DABR (1UL<<3)
+#define FW_FEATURE_COPY (1UL<<4)
+#define FW_FEATURE_ASR (1UL<<5)
+#define FW_FEATURE_DEBUG (1UL<<6)
+#define FW_FEATURE_TERM (1UL<<7)
+#define FW_FEATURE_PERF (1UL<<8)
+#define FW_FEATURE_DUMP (1UL<<9)
+#define FW_FEATURE_INTERRUPT (1UL<<10)
+#define FW_FEATURE_MIGRATE (1UL<<11)
+#define FW_FEATURE_PERFMON (1UL<<12)
+#define FW_FEATURE_CRQ (1UL<<13)
+#define FW_FEATURE_VIO (1UL<<14)
+#define FW_FEATURE_RDMA (1UL<<15)
+#define FW_FEATURE_LLAN (1UL<<16)
+#define FW_FEATURE_BULK (1UL<<17)
+#define FW_FEATURE_XDABR (1UL<<18)
+#define FW_FEATURE_MULTITCE (1UL<<19)
+#define FW_FEATURE_SPLPAR (1UL<<20)
+
+/* This is used to identify firmware features which are available
+ * to the kernel.
+ */
+extern unsigned long ppc64_firmware_features;
+
+static inline unsigned long firmware_has_feature(unsigned long feature)
+{
+ return ppc64_firmware_features & feature;
+}
+
+typedef struct {
+ unsigned long val;
+ char * name;
+} firmware_feature_t;
+
+extern firmware_feature_t firmware_features_table[];
+
+#endif /* __ASSEMBLY__ */
+#endif /* __KERNEL__ */
+#endif /* __ASM_PPC_FIRMWARE_H */
More information about the Linuxppc64-dev
mailing list