diff options
Diffstat (limited to 'include/asm-arm/system.h')
-rw-r--r-- | include/asm-arm/system.h | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h index 6335de9a2bb3..514af792a598 100644 --- a/include/asm-arm/system.h +++ b/include/asm-arm/system.h | |||
@@ -48,20 +48,6 @@ | |||
48 | #define CPUID_TCM 2 | 48 | #define CPUID_TCM 2 |
49 | #define CPUID_TLBTYPE 3 | 49 | #define CPUID_TLBTYPE 3 |
50 | 50 | ||
51 | #ifdef CONFIG_CPU_CP15 | ||
52 | #define read_cpuid(reg) \ | ||
53 | ({ \ | ||
54 | unsigned int __val; \ | ||
55 | asm("mrc p15, 0, %0, c0, c0, " __stringify(reg) \ | ||
56 | : "=r" (__val) \ | ||
57 | : \ | ||
58 | : "cc"); \ | ||
59 | __val; \ | ||
60 | }) | ||
61 | #else | ||
62 | #define read_cpuid(reg) (processor_id) | ||
63 | #endif | ||
64 | |||
65 | /* | 51 | /* |
66 | * This is used to ensure the compiler did actually allocate the register we | 52 | * This is used to ensure the compiler did actually allocate the register we |
67 | * asked it for some inline assembly sequences. Apparently we can't trust | 53 | * asked it for some inline assembly sequences. Apparently we can't trust |
@@ -78,6 +64,21 @@ | |||
78 | #include <linux/stringify.h> | 64 | #include <linux/stringify.h> |
79 | #include <linux/irqflags.h> | 65 | #include <linux/irqflags.h> |
80 | 66 | ||
67 | #ifdef CONFIG_CPU_CP15 | ||
68 | #define read_cpuid(reg) \ | ||
69 | ({ \ | ||
70 | unsigned int __val; \ | ||
71 | asm("mrc p15, 0, %0, c0, c0, " __stringify(reg) \ | ||
72 | : "=r" (__val) \ | ||
73 | : \ | ||
74 | : "cc"); \ | ||
75 | __val; \ | ||
76 | }) | ||
77 | #else | ||
78 | extern unsigned int processor_id; | ||
79 | #define read_cpuid(reg) (processor_id) | ||
80 | #endif | ||
81 | |||
81 | /* | 82 | /* |
82 | * The CPU ID never changes at run time, so we might as well tell the | 83 | * The CPU ID never changes at run time, so we might as well tell the |
83 | * compiler that it's constant. Use this function to read the CPU ID | 84 | * compiler that it's constant. Use this function to read the CPU ID |