diff options
author | Dave Martin <dave.martin@linaro.org> | 2011-08-19 12:58:35 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-10-17 04:12:40 -0400 |
commit | 2ecccf90f2a6d821af4d33f086d59895e5d3bedc (patch) | |
tree | d12438e595a0cfa5051187f69a1badddb1b317b3 | |
parent | 40c6d8aee40e373db75e6b0b4230fc8e8259d7a6 (diff) |
ARM: 7029/1: Make cpu_architecture into a global variable
The CPU architecture really should not be changing at runtime, so
make it a global variable instead of a function.
The cpu_architecture() function declared in <asm/system.h> remains
the correct way to read this variable from C code.
Signed-off-by: Dave Martin <dave.martin@linaro.org>
Reviewed-by: Jon Medhurst <tixy@yxit.co.uk>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/include/asm/system.h | 3 | ||||
-rw-r--r-- | arch/arm/kernel/setup.c | 20 |
2 files changed, 21 insertions, 2 deletions
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h index 832888d0c20c..4adf71b2b54a 100644 --- a/arch/arm/include/asm/system.h +++ b/arch/arm/include/asm/system.h | |||
@@ -57,6 +57,7 @@ | |||
57 | 57 | ||
58 | #ifndef __ASSEMBLY__ | 58 | #ifndef __ASSEMBLY__ |
59 | 59 | ||
60 | #include <linux/compiler.h> | ||
60 | #include <linux/linkage.h> | 61 | #include <linux/linkage.h> |
61 | #include <linux/irqflags.h> | 62 | #include <linux/irqflags.h> |
62 | 63 | ||
@@ -104,7 +105,7 @@ struct mm_struct; | |||
104 | extern void show_pte(struct mm_struct *mm, unsigned long addr); | 105 | extern void show_pte(struct mm_struct *mm, unsigned long addr); |
105 | extern void __show_regs(struct pt_regs *); | 106 | extern void __show_regs(struct pt_regs *); |
106 | 107 | ||
107 | extern int cpu_architecture(void); | 108 | extern int __pure cpu_architecture(void); |
108 | extern void cpu_init(void); | 109 | extern void cpu_init(void); |
109 | 110 | ||
110 | void arm_machine_restart(char mode, const char *cmd); | 111 | void arm_machine_restart(char mode, const char *cmd); |
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index e514c76043b4..10fce616e995 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -29,6 +29,8 @@ | |||
29 | #include <linux/fs.h> | 29 | #include <linux/fs.h> |
30 | #include <linux/proc_fs.h> | 30 | #include <linux/proc_fs.h> |
31 | #include <linux/memblock.h> | 31 | #include <linux/memblock.h> |
32 | #include <linux/bug.h> | ||
33 | #include <linux/compiler.h> | ||
32 | 34 | ||
33 | #include <asm/unified.h> | 35 | #include <asm/unified.h> |
34 | #include <asm/cpu.h> | 36 | #include <asm/cpu.h> |
@@ -42,6 +44,7 @@ | |||
42 | #include <asm/cacheflush.h> | 44 | #include <asm/cacheflush.h> |
43 | #include <asm/cachetype.h> | 45 | #include <asm/cachetype.h> |
44 | #include <asm/tlbflush.h> | 46 | #include <asm/tlbflush.h> |
47 | #include <asm/system.h> | ||
45 | 48 | ||
46 | #include <asm/prom.h> | 49 | #include <asm/prom.h> |
47 | #include <asm/mach/arch.h> | 50 | #include <asm/mach/arch.h> |
@@ -115,6 +118,13 @@ struct outer_cache_fns outer_cache __read_mostly; | |||
115 | EXPORT_SYMBOL(outer_cache); | 118 | EXPORT_SYMBOL(outer_cache); |
116 | #endif | 119 | #endif |
117 | 120 | ||
121 | /* | ||
122 | * Cached cpu_architecture() result for use by assembler code. | ||
123 | * C code should use the cpu_architecture() function instead of accessing this | ||
124 | * variable directly. | ||
125 | */ | ||
126 | int __cpu_architecture __read_mostly = CPU_ARCH_UNKNOWN; | ||
127 | |||
118 | struct stack { | 128 | struct stack { |
119 | u32 irq[3]; | 129 | u32 irq[3]; |
120 | u32 abt[3]; | 130 | u32 abt[3]; |
@@ -210,7 +220,7 @@ static const char *proc_arch[] = { | |||
210 | "?(17)", | 220 | "?(17)", |
211 | }; | 221 | }; |
212 | 222 | ||
213 | int cpu_architecture(void) | 223 | static int __get_cpu_architecture(void) |
214 | { | 224 | { |
215 | int cpu_arch; | 225 | int cpu_arch; |
216 | 226 | ||
@@ -243,6 +253,13 @@ int cpu_architecture(void) | |||
243 | return cpu_arch; | 253 | return cpu_arch; |
244 | } | 254 | } |
245 | 255 | ||
256 | int __pure cpu_architecture(void) | ||
257 | { | ||
258 | BUG_ON(__cpu_architecture == CPU_ARCH_UNKNOWN); | ||
259 | |||
260 | return __cpu_architecture; | ||
261 | } | ||
262 | |||
246 | static int cpu_has_aliasing_icache(unsigned int arch) | 263 | static int cpu_has_aliasing_icache(unsigned int arch) |
247 | { | 264 | { |
248 | int aliasing_icache; | 265 | int aliasing_icache; |
@@ -414,6 +431,7 @@ static void __init setup_processor(void) | |||
414 | } | 431 | } |
415 | 432 | ||
416 | cpu_name = list->cpu_name; | 433 | cpu_name = list->cpu_name; |
434 | __cpu_architecture = __get_cpu_architecture(); | ||
417 | 435 | ||
418 | #ifdef MULTI_CPU | 436 | #ifdef MULTI_CPU |
419 | processor = *list->proc; | 437 | processor = *list->proc; |