Commit 2ecccf90 authored by Dave Martin's avatar Dave Martin Committed by Russell King

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: default avatarDave Martin <dave.martin@linaro.org>
Reviewed-by: default avatarJon Medhurst <tixy@yxit.co.uk>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 40c6d8ae
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <linux/compiler.h>
#include <linux/linkage.h> #include <linux/linkage.h>
#include <linux/irqflags.h> #include <linux/irqflags.h>
...@@ -104,7 +105,7 @@ struct mm_struct; ...@@ -104,7 +105,7 @@ struct mm_struct;
extern void show_pte(struct mm_struct *mm, unsigned long addr); extern void show_pte(struct mm_struct *mm, unsigned long addr);
extern void __show_regs(struct pt_regs *); extern void __show_regs(struct pt_regs *);
extern int cpu_architecture(void); extern int __pure cpu_architecture(void);
extern void cpu_init(void); extern void cpu_init(void);
void arm_machine_restart(char mode, const char *cmd); void arm_machine_restart(char mode, const char *cmd);
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/memblock.h> #include <linux/memblock.h>
#include <linux/bug.h>
#include <linux/compiler.h>
#include <asm/unified.h> #include <asm/unified.h>
#include <asm/cpu.h> #include <asm/cpu.h>
...@@ -42,6 +44,7 @@ ...@@ -42,6 +44,7 @@
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <asm/cachetype.h> #include <asm/cachetype.h>
#include <asm/tlbflush.h> #include <asm/tlbflush.h>
#include <asm/system.h>
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
...@@ -115,6 +118,13 @@ struct outer_cache_fns outer_cache __read_mostly; ...@@ -115,6 +118,13 @@ struct outer_cache_fns outer_cache __read_mostly;
EXPORT_SYMBOL(outer_cache); EXPORT_SYMBOL(outer_cache);
#endif #endif
/*
* Cached cpu_architecture() result for use by assembler code.
* C code should use the cpu_architecture() function instead of accessing this
* variable directly.
*/
int __cpu_architecture __read_mostly = CPU_ARCH_UNKNOWN;
struct stack { struct stack {
u32 irq[3]; u32 irq[3];
u32 abt[3]; u32 abt[3];
...@@ -210,7 +220,7 @@ static const char *proc_arch[] = { ...@@ -210,7 +220,7 @@ static const char *proc_arch[] = {
"?(17)", "?(17)",
}; };
int cpu_architecture(void) static int __get_cpu_architecture(void)
{ {
int cpu_arch; int cpu_arch;
...@@ -243,6 +253,13 @@ int cpu_architecture(void) ...@@ -243,6 +253,13 @@ int cpu_architecture(void)
return cpu_arch; return cpu_arch;
} }
int __pure cpu_architecture(void)
{
BUG_ON(__cpu_architecture == CPU_ARCH_UNKNOWN);
return __cpu_architecture;
}
static int cpu_has_aliasing_icache(unsigned int arch) static int cpu_has_aliasing_icache(unsigned int arch)
{ {
int aliasing_icache; int aliasing_icache;
...@@ -414,6 +431,7 @@ static void __init setup_processor(void) ...@@ -414,6 +431,7 @@ static void __init setup_processor(void)
} }
cpu_name = list->cpu_name; cpu_name = list->cpu_name;
__cpu_architecture = __get_cpu_architecture();
#ifdef MULTI_CPU #ifdef MULTI_CPU
processor = *list->proc; processor = *list->proc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment