linux-3.0.x for AP-SH4A-0A Board
リビジョン | 2988d6f59bdecf10e3a6f0e13861dc8108cd2faf (tree) |
---|---|
日時 | 2011-08-23 01:28:30 |
作者 | Dave Martin <dave.martin@lina...> |
コミッター | Nicolas Pitre |
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>
(cherry picked from commit db9c84ccacb0e7a7903117929cf1dc914f82fc90)
@@ -57,6 +57,7 @@ | ||
57 | 57 | |
58 | 58 | #ifndef __ASSEMBLY__ |
59 | 59 | |
60 | +#include <linux/compiler.h> | |
60 | 61 | #include <linux/linkage.h> |
61 | 62 | #include <linux/irqflags.h> |
62 | 63 |
@@ -104,7 +105,7 @@ struct mm_struct; | ||
104 | 105 | extern void show_pte(struct mm_struct *mm, unsigned long addr); |
105 | 106 | extern void __show_regs(struct pt_regs *); |
106 | 107 | |
107 | -extern int cpu_architecture(void); | |
108 | +extern int __pure cpu_architecture(void); | |
108 | 109 | extern void cpu_init(void); |
109 | 110 | |
110 | 111 | void arm_machine_restart(char mode, const char *cmd); |
@@ -29,6 +29,8 @@ | ||
29 | 29 | #include <linux/fs.h> |
30 | 30 | #include <linux/proc_fs.h> |
31 | 31 | #include <linux/memblock.h> |
32 | +#include <linux/bug.h> | |
33 | +#include <linux/compiler.h> | |
32 | 34 | |
33 | 35 | #include <asm/unified.h> |
34 | 36 | #include <asm/cpu.h> |
@@ -42,6 +44,7 @@ | ||
42 | 44 | #include <asm/cacheflush.h> |
43 | 45 | #include <asm/cachetype.h> |
44 | 46 | #include <asm/tlbflush.h> |
47 | +#include <asm/system.h> | |
45 | 48 | |
46 | 49 | #include <asm/prom.h> |
47 | 50 | #include <asm/mach/arch.h> |
@@ -115,6 +118,13 @@ struct outer_cache_fns outer_cache __read_mostly; | ||
115 | 118 | EXPORT_SYMBOL(outer_cache); |
116 | 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 | 128 | struct stack { |
119 | 129 | u32 irq[3]; |
120 | 130 | u32 abt[3]; |
@@ -210,7 +220,7 @@ static const char *proc_arch[] = { | ||
210 | 220 | "?(17)", |
211 | 221 | }; |
212 | 222 | |
213 | -int cpu_architecture(void) | |
223 | +static int __get_cpu_architecture(void) | |
214 | 224 | { |
215 | 225 | int cpu_arch; |
216 | 226 |
@@ -243,6 +253,13 @@ int cpu_architecture(void) | ||
243 | 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 | 263 | static int cpu_has_aliasing_icache(unsigned int arch) |
247 | 264 | { |
248 | 265 | int aliasing_icache; |
@@ -414,6 +431,7 @@ static void __init setup_processor(void) | ||
414 | 431 | } |
415 | 432 | |
416 | 433 | cpu_name = list->cpu_name; |
434 | + __cpu_architecture = __get_cpu_architecture(); | |
417 | 435 | |
418 | 436 | #ifdef MULTI_CPU |
419 | 437 | processor = *list->proc; |