diff options
-rw-r--r-- | arch/arm/include/asm/cputype.h | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h index a59dcb5ab5fc..574269ed2232 100644 --- a/arch/arm/include/asm/cputype.h +++ b/arch/arm/include/asm/cputype.h | |||
@@ -50,6 +50,7 @@ extern unsigned int processor_id; | |||
50 | : "cc"); \ | 50 | : "cc"); \ |
51 | __val; \ | 51 | __val; \ |
52 | }) | 52 | }) |
53 | |||
53 | #define read_cpuid_ext(ext_reg) \ | 54 | #define read_cpuid_ext(ext_reg) \ |
54 | ({ \ | 55 | ({ \ |
55 | unsigned int __val; \ | 56 | unsigned int __val; \ |
@@ -59,12 +60,25 @@ extern unsigned int processor_id; | |||
59 | : "cc"); \ | 60 | : "cc"); \ |
60 | __val; \ | 61 | __val; \ |
61 | }) | 62 | }) |
62 | #else | 63 | |
63 | #define read_cpuid(reg) (processor_id) | 64 | #else /* ifdef CONFIG_CPU_CP15 */ |
64 | #define read_cpuid_ext(reg) 0 | ||
65 | #endif | ||
66 | 65 | ||
67 | /* | 66 | /* |
67 | * read_cpuid and read_cpuid_ext should only ever be called on machines that | ||
68 | * have cp15 so warn on other usages. | ||
69 | */ | ||
70 | #define read_cpuid(reg) \ | ||
71 | ({ \ | ||
72 | WARN_ON_ONCE(1); \ | ||
73 | 0; \ | ||
74 | }) | ||
75 | |||
76 | #define read_cpuid_ext(reg) read_cpuid(reg) | ||
77 | |||
78 | #endif /* ifdef CONFIG_CPU_CP15 / else */ | ||
79 | |||
80 | #ifdef CONFIG_CPU_CP15 | ||
81 | /* | ||
68 | * The CPU ID never changes at run time, so we might as well tell the | 82 | * The CPU ID never changes at run time, so we might as well tell the |
69 | * compiler that it's constant. Use this function to read the CPU ID | 83 | * compiler that it's constant. Use this function to read the CPU ID |
70 | * rather than directly reading processor_id or read_cpuid() directly. | 84 | * rather than directly reading processor_id or read_cpuid() directly. |
@@ -74,6 +88,15 @@ static inline unsigned int __attribute_const__ read_cpuid_id(void) | |||
74 | return read_cpuid(CPUID_ID); | 88 | return read_cpuid(CPUID_ID); |
75 | } | 89 | } |
76 | 90 | ||
91 | #else /* ifdef CONFIG_CPU_CP15 */ | ||
92 | |||
93 | static inline unsigned int __attribute_const__ read_cpuid_id(void) | ||
94 | { | ||
95 | return processor_id; | ||
96 | } | ||
97 | |||
98 | #endif /* ifdef CONFIG_CPU_CP15 / else */ | ||
99 | |||
77 | static inline unsigned int __attribute_const__ read_cpuid_cachetype(void) | 100 | static inline unsigned int __attribute_const__ read_cpuid_cachetype(void) |
78 | { | 101 | { |
79 | return read_cpuid(CPUID_CACHETYPE); | 102 | return read_cpuid(CPUID_CACHETYPE); |