Skip to content

Commit 15d07dc

Browse files
Russell Kingdhowells
authored andcommitted
ARM: move CP15 definitions to separate header file
Avoid namespace conflicts with drivers over the CP15 definitions by moving CP15 related prototypes and definitions to a private header file. Acked-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> [Tegra] Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com> Tested-by: H Hartley Sweeten <hsweeten@visionengravers.com> [EP93xx] Acked-by: Nicolas Pitre <nico@linaro.org> Acked-by: Kukjin Kim <kgene.kim@samsung.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: David Howells <dhowells@redhat.com>
1 parent ec22120 commit 15d07dc

18 files changed

Lines changed: 103 additions & 84 deletions

File tree

‎arch/arm/include/asm/cp15.h‎

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#ifndef __ASM_ARM_CP15_H
2+
#define __ASM_ARM_CP15_H
3+
4+
#include <asm/system.h>
5+
6+
/*
7+
* CR1 bits (CP#15 CR1)
8+
*/
9+
#define CR_M (1 << 0) /* MMU enable */
10+
#define CR_A (1 << 1) /* Alignment abort enable */
11+
#define CR_C (1 << 2) /* Dcache enable */
12+
#define CR_W (1 << 3) /* Write buffer enable */
13+
#define CR_P (1 << 4) /* 32-bit exception handler */
14+
#define CR_D (1 << 5) /* 32-bit data address range */
15+
#define CR_L (1 << 6) /* Implementation defined */
16+
#define CR_B (1 << 7) /* Big endian */
17+
#define CR_S (1 << 8) /* System MMU protection */
18+
#define CR_R (1 << 9) /* ROM MMU protection */
19+
#define CR_F (1 << 10) /* Implementation defined */
20+
#define CR_Z (1 << 11) /* Implementation defined */
21+
#define CR_I (1 << 12) /* Icache enable */
22+
#define CR_V (1 << 13) /* Vectors relocated to 0xffff0000 */
23+
#define CR_RR (1 << 14) /* Round Robin cache replacement */
24+
#define CR_L4 (1 << 15) /* LDR pc can set T bit */
25+
#define CR_DT (1 << 16)
26+
#define CR_IT (1 << 18)
27+
#define CR_ST (1 << 19)
28+
#define CR_FI (1 << 21) /* Fast interrupt (lower latency mode) */
29+
#define CR_U (1 << 22) /* Unaligned access operation */
30+
#define CR_XP (1 << 23) /* Extended page tables */
31+
#define CR_VE (1 << 24) /* Vectored interrupts */
32+
#define CR_EE (1 << 25) /* Exception (Big) Endian */
33+
#define CR_TRE (1 << 28) /* TEX remap enable */
34+
#define CR_AFE (1 << 29) /* Access flag enable */
35+
#define CR_TE (1 << 30) /* Thumb exception enable */
36+
37+
#ifndef __ASSEMBLY__
38+
39+
#if __LINUX_ARM_ARCH__ >= 4
40+
#define vectors_high() (cr_alignment & CR_V)
41+
#else
42+
#define vectors_high() (0)
43+
#endif
44+
45+
extern unsigned long cr_no_alignment; /* defined in entry-armv.S */
46+
extern unsigned long cr_alignment; /* defined in entry-armv.S */
47+
48+
static inline unsigned int get_cr(void)
49+
{
50+
unsigned int val;
51+
asm("mrc p15, 0, %0, c1, c0, 0 @ get CR" : "=r" (val) : : "cc");
52+
return val;
53+
}
54+
55+
static inline void set_cr(unsigned int val)
56+
{
57+
asm volatile("mcr p15, 0, %0, c1, c0, 0 @ set CR"
58+
: : "r" (val) : "cc");
59+
isb();
60+
}
61+
62+
#ifndef CONFIG_SMP
63+
extern void adjust_cr(unsigned long mask, unsigned long set);
64+
#endif
65+
66+
#define CPACC_FULL(n) (3 << (n * 2))
67+
#define CPACC_SVC(n) (1 << (n * 2))
68+
#define CPACC_DISABLE(n) (0 << (n * 2))
69+
70+
static inline unsigned int get_copro_access(void)
71+
{
72+
unsigned int val;
73+
asm("mrc p15, 0, %0, c1, c0, 2 @ get copro access"
74+
: "=r" (val) : : "cc");
75+
return val;
76+
}
77+
78+
static inline void set_copro_access(unsigned int val)
79+
{
80+
asm volatile("mcr p15, 0, %0, c1, c0, 2 @ set copro access"
81+
: : "r" (val) : "cc");
82+
isb();
83+
}
84+
85+
#endif
86+
87+
#endif

‎arch/arm/include/asm/system.h‎

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,6 @@
1414
#define CPU_ARCH_ARMv6 8
1515
#define CPU_ARCH_ARMv7 9
1616

17-
/*
18-
* CR1 bits (CP#15 CR1)
19-
*/
20-
#define CR_M (1 << 0) /* MMU enable */
21-
#define CR_A (1 << 1) /* Alignment abort enable */
22-
#define CR_C (1 << 2) /* Dcache enable */
23-
#define CR_W (1 << 3) /* Write buffer enable */
24-
#define CR_P (1 << 4) /* 32-bit exception handler */
25-
#define CR_D (1 << 5) /* 32-bit data address range */
26-
#define CR_L (1 << 6) /* Implementation defined */
27-
#define CR_B (1 << 7) /* Big endian */
28-
#define CR_S (1 << 8) /* System MMU protection */
29-
#define CR_R (1 << 9) /* ROM MMU protection */
30-
#define CR_F (1 << 10) /* Implementation defined */
31-
#define CR_Z (1 << 11) /* Implementation defined */
32-
#define CR_I (1 << 12) /* Icache enable */
33-
#define CR_V (1 << 13) /* Vectors relocated to 0xffff0000 */
34-
#define CR_RR (1 << 14) /* Round Robin cache replacement */
35-
#define CR_L4 (1 << 15) /* LDR pc can set T bit */
36-
#define CR_DT (1 << 16)
37-
#define CR_IT (1 << 18)
38-
#define CR_ST (1 << 19)
39-
#define CR_FI (1 << 21) /* Fast interrupt (lower latency mode) */
40-
#define CR_U (1 << 22) /* Unaligned access operation */
41-
#define CR_XP (1 << 23) /* Extended page tables */
42-
#define CR_VE (1 << 24) /* Vectored interrupts */
43-
#define CR_EE (1 << 25) /* Exception (Big) Endian */
44-
#define CR_TRE (1 << 28) /* TEX remap enable */
45-
#define CR_AFE (1 << 29) /* Access flag enable */
46-
#define CR_TE (1 << 30) /* Thumb exception enable */
47-
4817
/*
4918
* This is used to ensure the compiler did actually allocate the register we
5019
* asked it for some inline assembly sequences. Apparently we can't trust
@@ -119,12 +88,6 @@ extern void (*arm_pm_restart)(char str, const char *cmd);
11988

12089
extern unsigned int user_debug;
12190

122-
#if __LINUX_ARM_ARCH__ >= 4
123-
#define vectors_high() (cr_alignment & CR_V)
124-
#else
125-
#define vectors_high() (0)
126-
#endif
127-
12891
#if __LINUX_ARM_ARCH__ >= 7 || \
12992
(__LINUX_ARM_ARCH__ == 6 && defined(CONFIG_CPU_32v6K))
13093
#define sev() __asm__ __volatile__ ("sev" : : : "memory")
@@ -185,46 +148,6 @@ extern unsigned int user_debug;
185148
#define set_mb(var, value) do { var = value; smp_mb(); } while (0)
186149
#define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
187150

188-
extern unsigned long cr_no_alignment; /* defined in entry-armv.S */
189-
extern unsigned long cr_alignment; /* defined in entry-armv.S */
190-
191-
static inline unsigned int get_cr(void)
192-
{
193-
unsigned int val;
194-
asm("mrc p15, 0, %0, c1, c0, 0 @ get CR" : "=r" (val) : : "cc");
195-
return val;
196-
}
197-
198-
static inline void set_cr(unsigned int val)
199-
{
200-
asm volatile("mcr p15, 0, %0, c1, c0, 0 @ set CR"
201-
: : "r" (val) : "cc");
202-
isb();
203-
}
204-
205-
#ifndef CONFIG_SMP
206-
extern void adjust_cr(unsigned long mask, unsigned long set);
207-
#endif
208-
209-
#define CPACC_FULL(n) (3 << (n * 2))
210-
#define CPACC_SVC(n) (1 << (n * 2))
211-
#define CPACC_DISABLE(n) (0 << (n * 2))
212-
213-
static inline unsigned int get_copro_access(void)
214-
{
215-
unsigned int val;
216-
asm("mrc p15, 0, %0, c1, c0, 2 @ get copro access"
217-
: "=r" (val) : : "cc");
218-
return val;
219-
}
220-
221-
static inline void set_copro_access(unsigned int val)
222-
{
223-
asm volatile("mcr p15, 0, %0, c1, c0, 2 @ set copro access"
224-
: : "r" (val) : "cc");
225-
isb();
226-
}
227-
228151
/*
229152
* switch_mm() may do a full cache flush over the context switch,
230153
* so enable interrupts over the context switch to avoid high

‎arch/arm/kernel/fiq.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242
#include <linux/seq_file.h>
4343

4444
#include <asm/cacheflush.h>
45+
#include <asm/cp15.h>
4546
#include <asm/fiq.h>
4647
#include <asm/irq.h>
47-
#include <asm/system.h>
4848
#include <asm/traps.h>
4949

5050
static unsigned long no_fiq_insn;

‎arch/arm/kernel/head-nommu.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
#include <asm/assembler.h>
1818
#include <asm/ptrace.h>
1919
#include <asm/asm-offsets.h>
20+
#include <asm/cp15.h>
2021
#include <asm/thread_info.h>
21-
#include <asm/system.h>
2222

2323
/*
2424
* Kernel startup entry point.

‎arch/arm/kernel/head.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
#include <linux/init.h>
1616

1717
#include <asm/assembler.h>
18+
#include <asm/cp15.h>
1819
#include <asm/domain.h>
1920
#include <asm/ptrace.h>
2021
#include <asm/asm-offsets.h>
2122
#include <asm/memory.h>
2223
#include <asm/thread_info.h>
23-
#include <asm/system.h>
2424
#include <asm/pgtable.h>
2525

2626
#ifdef CONFIG_DEBUG_LL

‎arch/arm/kernel/setup.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <linux/sort.h>
3434

3535
#include <asm/unified.h>
36+
#include <asm/cp15.h>
3637
#include <asm/cpu.h>
3738
#include <asm/cputype.h>
3839
#include <asm/elf.h>
@@ -44,7 +45,6 @@
4445
#include <asm/cacheflush.h>
4546
#include <asm/cachetype.h>
4647
#include <asm/tlbflush.h>
47-
#include <asm/system.h>
4848

4949
#include <asm/prom.h>
5050
#include <asm/mach/arch.h>

‎arch/arm/mach-exynos/hotplug.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/io.h>
1717

1818
#include <asm/cacheflush.h>
19+
#include <asm/cp15.h>
1920
#include <asm/smp_plat.h>
2021

2122
#include <mach/regs-pmu.h>

‎arch/arm/mach-realview/hotplug.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/smp.h>
1414

1515
#include <asm/cacheflush.h>
16+
#include <asm/cp15.h>
1617
#include <asm/smp_plat.h>
1718

1819
extern volatile int pen_release;

‎arch/arm/mach-tegra/hotplug.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/smp.h>
1414

1515
#include <asm/cacheflush.h>
16+
#include <asm/cp15.h>
1617

1718
static inline void cpu_enter_lowpower(void)
1819
{

‎arch/arm/mach-vexpress/hotplug.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#include <asm/cacheflush.h>
1616
#include <asm/smp_plat.h>
17-
#include <asm/system.h>
17+
#include <asm/cp15.h>
1818

1919
extern volatile int pen_release;
2020

0 commit comments

Comments
 (0)