summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorOlof Johansson <olof@austin.ibm.com>2005-03-04 17:27:37 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-03-04 17:27:37 -0800
commitb21d1ff22952382860b6a163ae9325ea5d3bc30b (patch)
tree823e61649ae41bc3557be31aefd166c224e1b66e /include
parent1eeae0158ecd0535a2bc257a53d3472cc37ceb15 (diff)
[PATCH] PPC/PPC64: Abstract cpu_feature checks.
Abstract most manual mask checks of cpu_features with cpu_has_feature() Signed-off-by: Olof Johansson <olof@austin.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r--include/asm-ppc/cputable.h5
-rw-r--r--include/asm-ppc64/cacheflush.h2
-rw-r--r--include/asm-ppc64/cputable.h5
-rw-r--r--include/asm-ppc64/mmu_context.h4
-rw-r--r--include/asm-ppc64/page.h2
5 files changed, 14 insertions, 4 deletions
diff --git a/include/asm-ppc/cputable.h b/include/asm-ppc/cputable.h
index 34f37ab61324..22de04fe1b4c 100644
--- a/include/asm-ppc/cputable.h
+++ b/include/asm-ppc/cputable.h
@@ -61,6 +61,11 @@ struct cpu_spec {
extern struct cpu_spec cpu_specs[];
extern struct cpu_spec *cur_cpu_spec[];
+static inline unsigned int cpu_has_feature(unsigned int feature)
+{
+ return cur_cpu_spec[0]->cpu_features & feature;
+}
+
#endif /* __ASSEMBLY__ */
/* CPU kernel features */
diff --git a/include/asm-ppc64/cacheflush.h b/include/asm-ppc64/cacheflush.h
index d0f0dfd263d6..33d72572fdf4 100644
--- a/include/asm-ppc64/cacheflush.h
+++ b/include/asm-ppc64/cacheflush.h
@@ -40,7 +40,7 @@ extern void __flush_dcache_icache(void *page_va);
static inline void flush_icache_range(unsigned long start, unsigned long stop)
{
- if (!(cur_cpu_spec->cpu_features & CPU_FTR_COHERENT_ICACHE))
+ if (!cpu_has_feature(CPU_FTR_COHERENT_ICACHE))
__flush_icache_range(start, stop);
}
diff --git a/include/asm-ppc64/cputable.h b/include/asm-ppc64/cputable.h
index 6ef442318e46..cbbfbec78b6b 100644
--- a/include/asm-ppc64/cputable.h
+++ b/include/asm-ppc64/cputable.h
@@ -66,6 +66,11 @@ struct cpu_spec {
extern struct cpu_spec cpu_specs[];
extern struct cpu_spec *cur_cpu_spec;
+static inline unsigned long cpu_has_feature(unsigned long feature)
+{
+ return cur_cpu_spec->cpu_features & feature;
+}
+
/* firmware feature bitmask values */
#define FIRMWARE_MAX_FEATURES 63
diff --git a/include/asm-ppc64/mmu_context.h b/include/asm-ppc64/mmu_context.h
index 37f6ea055bf3..c2e8e0466383 100644
--- a/include/asm-ppc64/mmu_context.h
+++ b/include/asm-ppc64/mmu_context.h
@@ -59,11 +59,11 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
return;
#ifdef CONFIG_ALTIVEC
- if (cur_cpu_spec->cpu_features & CPU_FTR_ALTIVEC)
+ if (cpu_has_feature(CPU_FTR_ALTIVEC))
asm volatile ("dssall");
#endif /* CONFIG_ALTIVEC */
- if (cur_cpu_spec->cpu_features & CPU_FTR_SLB)
+ if (cpu_has_feature(CPU_FTR_SLB))
switch_slb(tsk, next);
else
switch_stab(tsk, next);
diff --git a/include/asm-ppc64/page.h b/include/asm-ppc64/page.h
index ca828e5aeb8a..ef16df988b62 100644
--- a/include/asm-ppc64/page.h
+++ b/include/asm-ppc64/page.h
@@ -67,7 +67,7 @@
#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
#define in_hugepage_area(context, addr) \
- ((cur_cpu_spec->cpu_features & CPU_FTR_16M_PAGE) && \
+ (cpu_has_feature(CPU_FTR_16M_PAGE) && \
( (((addr) >= TASK_HPAGE_BASE) && ((addr) < TASK_HPAGE_END)) || \
( ((addr) < 0x100000000L) && \
((1 << GET_ESID(addr)) & (context).htlb_segs) ) ) )