OMAP3: PM: Ensure MUSB block can idle when driver not loaded
[linux-ginger.git] / arch / powerpc / include / asm / feature-fixups.h
blobe4094a5cb05b6f7de223dd6c15eaf888289d5240
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 /* MMU feature dependent sections */
85 #define BEGIN_MMU_FTR_SECTION_NESTED(label) START_FTR_SECTION(label)
86 #define BEGIN_MMU_FTR_SECTION START_FTR_SECTION(97)
88 #define END_MMU_FTR_SECTION_NESTED(msk, val, label) \
89 FTR_SECTION_ELSE_NESTED(label) \
90 MAKE_FTR_SECTION_ENTRY(msk, val, label, __mmu_ftr_fixup)
92 #define END_MMU_FTR_SECTION(msk, val) \
93 END_MMU_FTR_SECTION_NESTED(msk, val, 97)
95 #define END_MMU_FTR_SECTION_IFSET(msk) END_MMU_FTR_SECTION((msk), (msk))
96 #define END_MMU_FTR_SECTION_IFCLR(msk) END_MMU_FTR_SECTION((msk), 0)
98 /* MMU feature sections with alternatives, use BEGIN_FTR_SECTION to start */
99 #define MMU_FTR_SECTION_ELSE_NESTED(label) FTR_SECTION_ELSE_NESTED(label)
100 #define MMU_FTR_SECTION_ELSE MMU_FTR_SECTION_ELSE_NESTED(97)
101 #define ALT_MMU_FTR_SECTION_END_NESTED(msk, val, label) \
102 MAKE_FTR_SECTION_ENTRY(msk, val, label, __mmu_ftr_fixup)
103 #define ALT_MMU_FTR_SECTION_END_NESTED_IFSET(msk, label) \
104 ALT_MMU_FTR_SECTION_END_NESTED(msk, msk, label)
105 #define ALT_MMU_FTR_SECTION_END_NESTED_IFCLR(msk, label) \
106 ALT_MMU_FTR_SECTION_END_NESTED(msk, 0, label)
107 #define ALT_MMU_FTR_SECTION_END(msk, val) \
108 ALT_MMU_FTR_SECTION_END_NESTED(msk, val, 97)
109 #define ALT_MMU_FTR_SECTION_END_IFSET(msk) \
110 ALT_MMU_FTR_SECTION_END_NESTED_IFSET(msk, 97)
111 #define ALT_MMU_FTR_SECTION_END_IFCLR(msk) \
112 ALT_MMU_FTR_SECTION_END_NESTED_IFCLR(msk, 97)
114 /* Firmware feature dependent sections */
115 #define BEGIN_FW_FTR_SECTION_NESTED(label) START_FTR_SECTION(label)
116 #define BEGIN_FW_FTR_SECTION START_FTR_SECTION(97)
118 #define END_FW_FTR_SECTION_NESTED(msk, val, label) \
119 FTR_SECTION_ELSE_NESTED(label) \
120 MAKE_FTR_SECTION_ENTRY(msk, val, label, __fw_ftr_fixup)
122 #define END_FW_FTR_SECTION(msk, val) \
123 END_FW_FTR_SECTION_NESTED(msk, val, 97)
125 #define END_FW_FTR_SECTION_IFSET(msk) END_FW_FTR_SECTION((msk), (msk))
126 #define END_FW_FTR_SECTION_IFCLR(msk) END_FW_FTR_SECTION((msk), 0)
128 /* Firmware feature sections with alternatives */
129 #define FW_FTR_SECTION_ELSE_NESTED(label) FTR_SECTION_ELSE_NESTED(label)
130 #define FW_FTR_SECTION_ELSE FTR_SECTION_ELSE_NESTED(97)
131 #define ALT_FW_FTR_SECTION_END_NESTED(msk, val, label) \
132 MAKE_FTR_SECTION_ENTRY(msk, val, label, __fw_ftr_fixup)
133 #define ALT_FW_FTR_SECTION_END_NESTED_IFSET(msk, label) \
134 ALT_FW_FTR_SECTION_END_NESTED(msk, msk, label)
135 #define ALT_FW_FTR_SECTION_END_NESTED_IFCLR(msk, label) \
136 ALT_FW_FTR_SECTION_END_NESTED(msk, 0, label)
137 #define ALT_FW_FTR_SECTION_END(msk, val) \
138 ALT_FW_FTR_SECTION_END_NESTED(msk, val, 97)
139 #define ALT_FW_FTR_SECTION_END_IFSET(msk) \
140 ALT_FW_FTR_SECTION_END_NESTED_IFSET(msk, 97)
141 #define ALT_FW_FTR_SECTION_END_IFCLR(msk) \
142 ALT_FW_FTR_SECTION_END_NESTED_IFCLR(msk, 97)
144 #endif /* __ASSEMBLY__ */
146 /* LWSYNC feature sections */
147 #define START_LWSYNC_SECTION(label) label##1:
148 #define MAKE_LWSYNC_SECTION_ENTRY(label, sect) \
149 label##2: \
150 .pushsection sect,"a"; \
151 .align 2; \
152 label##3: \
153 .long label##1b-label##3b; \
154 .popsection;
156 #endif /* __ASM_POWERPC_FEATURE_FIXUPS_H */