diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2008-06-23 21:32:39 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-06-30 21:28:25 -0400 |
commit | c5157e587b33b1185cf73207fc53760cf1351430 (patch) | |
tree | 996a4e76bae11001a8e97141c617c159dde37ec8 /include | |
parent | 51c52e86694f19e84600a40f6156889feafd8ae9 (diff) |
powerpc: Consolidate CPU and firmware feature fixup macros
The CPU and firmware feature fixup macros are currently spread across
three files, firmware.h, cputable.h and asm-compat.h. Consolidate them
into their own file, feature-fixups.h
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-powerpc/asm-compat.h | 51 | ||||
-rw-r--r-- | include/asm-powerpc/cputable.h | 14 | ||||
-rw-r--r-- | include/asm-powerpc/feature-fixups.h | 102 | ||||
-rw-r--r-- | include/asm-powerpc/firmware.h | 13 |
4 files changed, 104 insertions, 76 deletions
diff --git a/include/asm-powerpc/asm-compat.h b/include/asm-powerpc/asm-compat.h index c19e7367fce6..8ec2e1da68bf 100644 --- a/include/asm-powerpc/asm-compat.h +++ b/include/asm-powerpc/asm-compat.h | |||
@@ -15,57 +15,6 @@ | |||
15 | #endif | 15 | #endif |
16 | 16 | ||
17 | 17 | ||
18 | /* | ||
19 | * Feature section common macros | ||
20 | * | ||
21 | * Note that the entries now contain offsets between the table entry | ||
22 | * and the code rather than absolute code pointers in order to be | ||
23 | * useable with the vdso shared library. There is also an assumption | ||
24 | * that values will be negative, that is, the fixup table has to be | ||
25 | * located after the code it fixes up. | ||
26 | */ | ||
27 | #ifdef CONFIG_PPC64 | ||
28 | #ifdef __powerpc64__ | ||
29 | /* 64 bits kernel, 64 bits code */ | ||
30 | #define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \ | ||
31 | 99: \ | ||
32 | .section sect,"a"; \ | ||
33 | .align 3; \ | ||
34 | 98: \ | ||
35 | .llong msk; \ | ||
36 | .llong val; \ | ||
37 | .llong label##b-98b; \ | ||
38 | .llong 99b-98b; \ | ||
39 | .previous | ||
40 | #else /* __powerpc64__ */ | ||
41 | /* 64 bits kernel, 32 bits code (ie. vdso32) */ | ||
42 | #define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \ | ||
43 | 99: \ | ||
44 | .section sect,"a"; \ | ||
45 | .align 3; \ | ||
46 | 98: \ | ||
47 | .llong msk; \ | ||
48 | .llong val; \ | ||
49 | .long 0xffffffff; \ | ||
50 | .long label##b-98b; \ | ||
51 | .long 0xffffffff; \ | ||
52 | .long 99b-98b; \ | ||
53 | .previous | ||
54 | #endif /* !__powerpc64__ */ | ||
55 | #else /* CONFIG_PPC64 */ | ||
56 | /* 32 bits kernel, 32 bits code */ | ||
57 | #define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \ | ||
58 | 99: \ | ||
59 | .section sect,"a"; \ | ||
60 | .align 2; \ | ||
61 | 98: \ | ||
62 | .long msk; \ | ||
63 | .long val; \ | ||
64 | .long label##b-98b; \ | ||
65 | .long 99b-98b; \ | ||
66 | .previous | ||
67 | #endif /* !CONFIG_PPC64 */ | ||
68 | |||
69 | #ifdef __powerpc64__ | 18 | #ifdef __powerpc64__ |
70 | 19 | ||
71 | /* operations for longs and pointers */ | 20 | /* operations for longs and pointers */ |
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h index 3189ac5d0a69..0d96b0284a73 100644 --- a/include/asm-powerpc/cputable.h +++ b/include/asm-powerpc/cputable.h | |||
@@ -32,6 +32,7 @@ | |||
32 | #ifdef __KERNEL__ | 32 | #ifdef __KERNEL__ |
33 | 33 | ||
34 | #include <asm/asm-compat.h> | 34 | #include <asm/asm-compat.h> |
35 | #include <asm/feature-fixups.h> | ||
35 | 36 | ||
36 | #ifndef __ASSEMBLY__ | 37 | #ifndef __ASSEMBLY__ |
37 | 38 | ||
@@ -489,18 +490,5 @@ static inline int cpu_has_feature(unsigned long feature) | |||
489 | 490 | ||
490 | #endif /* !__ASSEMBLY__ */ | 491 | #endif /* !__ASSEMBLY__ */ |
491 | 492 | ||
492 | #ifdef __ASSEMBLY__ | ||
493 | |||
494 | #define BEGIN_FTR_SECTION_NESTED(label) label: | ||
495 | #define BEGIN_FTR_SECTION BEGIN_FTR_SECTION_NESTED(97) | ||
496 | #define END_FTR_SECTION_NESTED(msk, val, label) \ | ||
497 | MAKE_FTR_SECTION_ENTRY(msk, val, label, __ftr_fixup) | ||
498 | #define END_FTR_SECTION(msk, val) \ | ||
499 | END_FTR_SECTION_NESTED(msk, val, 97) | ||
500 | |||
501 | #define END_FTR_SECTION_IFSET(msk) END_FTR_SECTION((msk), (msk)) | ||
502 | #define END_FTR_SECTION_IFCLR(msk) END_FTR_SECTION((msk), 0) | ||
503 | #endif /* __ASSEMBLY__ */ | ||
504 | |||
505 | #endif /* __KERNEL__ */ | 493 | #endif /* __KERNEL__ */ |
506 | #endif /* __ASM_POWERPC_CPUTABLE_H */ | 494 | #endif /* __ASM_POWERPC_CPUTABLE_H */ |
diff --git a/include/asm-powerpc/feature-fixups.h b/include/asm-powerpc/feature-fixups.h new file mode 100644 index 000000000000..85972125bbb8 --- /dev/null +++ b/include/asm-powerpc/feature-fixups.h | |||
@@ -0,0 +1,102 @@ | |||
1 | #ifndef __ASM_POWERPC_FEATURE_FIXUPS_H | ||
2 | #define __ASM_POWERPC_FEATURE_FIXUPS_H | ||
3 | |||
4 | /* | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #ifdef __ASSEMBLY__ | ||
12 | |||
13 | /* | ||
14 | * Feature section common macros | ||
15 | * | ||
16 | * Note that the entries now contain offsets between the table entry | ||
17 | * and the code rather than absolute code pointers in order to be | ||
18 | * useable with the vdso shared library. There is also an assumption | ||
19 | * that values will be negative, that is, the fixup table has to be | ||
20 | * located after the code it fixes up. | ||
21 | */ | ||
22 | #ifdef CONFIG_PPC64 | ||
23 | |||
24 | #ifdef __powerpc64__ | ||
25 | |||
26 | /* 64 bits kernel, 64 bits code */ | ||
27 | #define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \ | ||
28 | 99: \ | ||
29 | .section sect,"a"; \ | ||
30 | .align 3; \ | ||
31 | 98: \ | ||
32 | .llong msk; \ | ||
33 | .llong val; \ | ||
34 | .llong label##b-98b; \ | ||
35 | .llong 99b-98b; \ | ||
36 | .previous | ||
37 | |||
38 | #else /* __powerpc64__ */ | ||
39 | |||
40 | /* 64 bits kernel, 32 bits code (ie. vdso32) */ | ||
41 | #define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \ | ||
42 | 99: \ | ||
43 | .section sect,"a"; \ | ||
44 | .align 3; \ | ||
45 | 98: \ | ||
46 | .llong msk; \ | ||
47 | .llong val; \ | ||
48 | .long 0xffffffff; \ | ||
49 | .long label##b-98b; \ | ||
50 | .long 0xffffffff; \ | ||
51 | .long 99b-98b; \ | ||
52 | .previous | ||
53 | |||
54 | #endif /* !__powerpc64__ */ | ||
55 | |||
56 | #else /* CONFIG_PPC64 */ | ||
57 | |||
58 | /* 32 bits kernel, 32 bits code */ | ||
59 | #define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \ | ||
60 | 99: \ | ||
61 | .section sect,"a"; \ | ||
62 | .align 2; \ | ||
63 | 98: \ | ||
64 | .long msk; \ | ||
65 | .long val; \ | ||
66 | .long label##b-98b; \ | ||
67 | .long 99b-98b; \ | ||
68 | .previous | ||
69 | |||
70 | #endif /* !CONFIG_PPC64 */ | ||
71 | |||
72 | |||
73 | /* CPU feature dependent sections */ | ||
74 | #define BEGIN_FTR_SECTION_NESTED(label) label: | ||
75 | #define BEGIN_FTR_SECTION BEGIN_FTR_SECTION_NESTED(97) | ||
76 | |||
77 | #define END_FTR_SECTION_NESTED(msk, val, label) \ | ||
78 | MAKE_FTR_SECTION_ENTRY(msk, val, label, __ftr_fixup) | ||
79 | |||
80 | #define END_FTR_SECTION(msk, val) \ | ||
81 | END_FTR_SECTION_NESTED(msk, val, 97) | ||
82 | |||
83 | #define END_FTR_SECTION_IFSET(msk) END_FTR_SECTION((msk), (msk)) | ||
84 | #define END_FTR_SECTION_IFCLR(msk) END_FTR_SECTION((msk), 0) | ||
85 | |||
86 | |||
87 | /* Firmware feature dependent sections */ | ||
88 | #define BEGIN_FW_FTR_SECTION_NESTED(label) label: | ||
89 | #define BEGIN_FW_FTR_SECTION BEGIN_FW_FTR_SECTION_NESTED(97) | ||
90 | |||
91 | #define END_FW_FTR_SECTION_NESTED(msk, val, label) \ | ||
92 | MAKE_FTR_SECTION_ENTRY(msk, val, label, __fw_ftr_fixup) | ||
93 | |||
94 | #define END_FW_FTR_SECTION(msk, val) \ | ||
95 | END_FW_FTR_SECTION_NESTED(msk, val, 97) | ||
96 | |||
97 | #define END_FW_FTR_SECTION_IFSET(msk) END_FW_FTR_SECTION((msk), (msk)) | ||
98 | #define END_FW_FTR_SECTION_IFCLR(msk) END_FW_FTR_SECTION((msk), 0) | ||
99 | |||
100 | #endif /* __ASSEMBLY__ */ | ||
101 | |||
102 | #endif /* __ASM_POWERPC_FEATURE_FIXUPS_H */ | ||
diff --git a/include/asm-powerpc/firmware.h b/include/asm-powerpc/firmware.h index 1e41bd1c8502..ef328995ba9d 100644 --- a/include/asm-powerpc/firmware.h +++ b/include/asm-powerpc/firmware.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #ifdef __KERNEL__ | 15 | #ifdef __KERNEL__ |
16 | 16 | ||
17 | #include <asm/asm-compat.h> | 17 | #include <asm/asm-compat.h> |
18 | #include <asm/feature-fixups.h> | ||
18 | 19 | ||
19 | /* firmware feature bitmask values */ | 20 | /* firmware feature bitmask values */ |
20 | #define FIRMWARE_MAX_FEATURES 63 | 21 | #define FIRMWARE_MAX_FEATURES 63 |
@@ -125,18 +126,6 @@ extern int fwnmi_active; | |||
125 | 126 | ||
126 | extern unsigned int __start___fw_ftr_fixup, __stop___fw_ftr_fixup; | 127 | extern unsigned int __start___fw_ftr_fixup, __stop___fw_ftr_fixup; |
127 | 128 | ||
128 | #else /* __ASSEMBLY__ */ | ||
129 | |||
130 | #define BEGIN_FW_FTR_SECTION_NESTED(label) label: | ||
131 | #define BEGIN_FW_FTR_SECTION BEGIN_FW_FTR_SECTION_NESTED(97) | ||
132 | #define END_FW_FTR_SECTION_NESTED(msk, val, label) \ | ||
133 | MAKE_FTR_SECTION_ENTRY(msk, val, label, __fw_ftr_fixup) | ||
134 | #define END_FW_FTR_SECTION(msk, val) \ | ||
135 | END_FW_FTR_SECTION_NESTED(msk, val, 97) | ||
136 | |||
137 | #define END_FW_FTR_SECTION_IFSET(msk) END_FW_FTR_SECTION((msk), (msk)) | ||
138 | #define END_FW_FTR_SECTION_IFCLR(msk) END_FW_FTR_SECTION((msk), 0) | ||
139 | |||
140 | #endif /* __ASSEMBLY__ */ | 129 | #endif /* __ASSEMBLY__ */ |
141 | #endif /* __KERNEL__ */ | 130 | #endif /* __KERNEL__ */ |
142 | #endif /* __ASM_POWERPC_FIRMWARE_H */ | 131 | #endif /* __ASM_POWERPC_FIRMWARE_H */ |