Linux 2.6.28-rc5
[cris-mirror.git] / arch / powerpc / include / asm / feature-fixups.h
bloba1029967620be29003550a84fd12d3e78a13c4b7
1 #ifndef __ASM_POWERPC_FEATURE_FIXUPS_H
2 #define __ASM_POWERPC_FEATURE_FIXUPS_H
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 */
11 #ifdef __ASSEMBLY__
14 * Feature section common macros
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.
22 #if defined(CONFIG_PPC64) && !defined(__powerpc64__)
23 /* 64 bits kernel, 32 bits code (ie. vdso32) */
24 #define FTR_ENTRY_LONG .llong
25 #define FTR_ENTRY_OFFSET .long 0xffffffff; .long
26 #else
27 /* 64 bit kernel 64 bit code, or 32 bit kernel 32 bit code */
28 #define FTR_ENTRY_LONG PPC_LONG
29 #define FTR_ENTRY_OFFSET PPC_LONG
30 #endif
32 #define START_FTR_SECTION(label) label##1:
34 #define FTR_SECTION_ELSE_NESTED(label) \
35 label##2: \
36 .pushsection __ftr_alt_##label,"a"; \
37 .align 2; \
38 label##3:
40 #define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \
41 label##4: \
42 .popsection; \
43 .pushsection sect,"a"; \
44 .align 3; \
45 label##5: \
46 FTR_ENTRY_LONG msk; \
47 FTR_ENTRY_LONG val; \
48 FTR_ENTRY_OFFSET label##1b-label##5b; \
49 FTR_ENTRY_OFFSET label##2b-label##5b; \
50 FTR_ENTRY_OFFSET label##3b-label##5b; \
51 FTR_ENTRY_OFFSET label##4b-label##5b; \
52 .popsection;
55 /* CPU feature dependent sections */
56 #define BEGIN_FTR_SECTION_NESTED(label) START_FTR_SECTION(label)
57 #define BEGIN_FTR_SECTION START_FTR_SECTION(97)
59 #define END_FTR_SECTION_NESTED(msk, val, label) \
60 FTR_SECTION_ELSE_NESTED(label) \
61 MAKE_FTR_SECTION_ENTRY(msk, val, label, __ftr_fixup)
63 #define END_FTR_SECTION(msk, val) \
64 END_FTR_SECTION_NESTED(msk, val, 97)
66 #define END_FTR_SECTION_IFSET(msk) END_FTR_SECTION((msk), (msk))
67 #define END_FTR_SECTION_IFCLR(msk) END_FTR_SECTION((msk), 0)
69 /* CPU feature sections with alternatives, use BEGIN_FTR_SECTION to start */
70 #define FTR_SECTION_ELSE FTR_SECTION_ELSE_NESTED(97)
71 #define ALT_FTR_SECTION_END_NESTED(msk, val, label) \
72 MAKE_FTR_SECTION_ENTRY(msk, val, label, __ftr_fixup)
73 #define ALT_FTR_SECTION_END_NESTED_IFSET(msk, label) \
74 ALT_FTR_SECTION_END_NESTED(msk, msk, label)
75 #define ALT_FTR_SECTION_END_NESTED_IFCLR(msk, label) \
76 ALT_FTR_SECTION_END_NESTED(msk, 0, label)
77 #define ALT_FTR_SECTION_END(msk, val) \
78 ALT_FTR_SECTION_END_NESTED(msk, val, 97)
79 #define ALT_FTR_SECTION_END_IFSET(msk) \
80 ALT_FTR_SECTION_END_NESTED_IFSET(msk, 97)
81 #define ALT_FTR_SECTION_END_IFCLR(msk) \
82 ALT_FTR_SECTION_END_NESTED_IFCLR(msk, 97)
84 /* Firmware feature dependent sections */
85 #define BEGIN_FW_FTR_SECTION_NESTED(label) START_FTR_SECTION(label)
86 #define BEGIN_FW_FTR_SECTION START_FTR_SECTION(97)
88 #define END_FW_FTR_SECTION_NESTED(msk, val, label) \
89 FTR_SECTION_ELSE_NESTED(label) \
90 MAKE_FTR_SECTION_ENTRY(msk, val, label, __fw_ftr_fixup)
92 #define END_FW_FTR_SECTION(msk, val) \
93 END_FW_FTR_SECTION_NESTED(msk, val, 97)
95 #define END_FW_FTR_SECTION_IFSET(msk) END_FW_FTR_SECTION((msk), (msk))
96 #define END_FW_FTR_SECTION_IFCLR(msk) END_FW_FTR_SECTION((msk), 0)
98 /* Firmware feature sections with alternatives */
99 #define FW_FTR_SECTION_ELSE_NESTED(label) FTR_SECTION_ELSE_NESTED(label)
100 #define FW_FTR_SECTION_ELSE FTR_SECTION_ELSE_NESTED(97)
101 #define ALT_FW_FTR_SECTION_END_NESTED(msk, val, label) \
102 MAKE_FTR_SECTION_ENTRY(msk, val, label, __fw_ftr_fixup)
103 #define ALT_FW_FTR_SECTION_END_NESTED_IFSET(msk, label) \
104 ALT_FW_FTR_SECTION_END_NESTED(msk, msk, label)
105 #define ALT_FW_FTR_SECTION_END_NESTED_IFCLR(msk, label) \
106 ALT_FW_FTR_SECTION_END_NESTED(msk, 0, label)
107 #define ALT_FW_FTR_SECTION_END(msk, val) \
108 ALT_FW_FTR_SECTION_END_NESTED(msk, val, 97)
109 #define ALT_FW_FTR_SECTION_END_IFSET(msk) \
110 ALT_FW_FTR_SECTION_END_NESTED_IFSET(msk, 97)
111 #define ALT_FW_FTR_SECTION_END_IFCLR(msk) \
112 ALT_FW_FTR_SECTION_END_NESTED_IFCLR(msk, 97)
114 #endif /* __ASSEMBLY__ */
116 /* LWSYNC feature sections */
117 #define START_LWSYNC_SECTION(label) label##1:
118 #define MAKE_LWSYNC_SECTION_ENTRY(label, sect) \
119 label##2: \
120 .pushsection sect,"a"; \
121 .align 2; \
122 label##3: \
123 .long label##1b-label##3b; \
124 .popsection;
126 #endif /* __ASM_POWERPC_FEATURE_FIXUPS_H */