|
33 | 33 | .endif
|
34 | 34 | .endm
|
35 | 35 |
|
36 |
| -.macro __ALTERNATIVE_CFG old_c, new_c, vendor_id, errata_id, enable |
| 36 | +.macro ALTERNATIVE_CFG old_c, new_c, vendor_id, errata_id, enable |
37 | 37 | 886 :
|
38 | 38 | .option push
|
39 | 39 | .option norvc
|
|
44 | 44 | ALT_NEW_CONTENT \vendor_id, \errata_id, \enable, \new_c
|
45 | 45 | .endm
|
46 | 46 |
|
47 |
| -#define _ALTERNATIVE_CFG(old_c, new_c, vendor_id, errata_id, CONFIG_k) \ |
48 |
| - __ALTERNATIVE_CFG old_c, new_c, vendor_id, errata_id, IS_ENABLED(CONFIG_k) |
49 |
| - |
50 |
| -.macro __ALTERNATIVE_CFG_2 old_c, new_c_1, vendor_id_1, errata_id_1, enable_1, \ |
51 |
| - new_c_2, vendor_id_2, errata_id_2, enable_2 |
52 |
| -886 : |
53 |
| - .option push |
54 |
| - .option norvc |
55 |
| - .option norelax |
56 |
| - \old_c |
57 |
| - .option pop |
58 |
| -887 : |
59 |
| - ALT_NEW_CONTENT \vendor_id_1, \errata_id_1, \enable_1, \new_c_1 |
| 47 | +.macro ALTERNATIVE_CFG_2 old_c, new_c_1, vendor_id_1, errata_id_1, enable_1, \ |
| 48 | + new_c_2, vendor_id_2, errata_id_2, enable_2 |
| 49 | + ALTERNATIVE_CFG \old_c, \new_c_1, \vendor_id_1, \errata_id_1, \enable_1 |
60 | 50 | ALT_NEW_CONTENT \vendor_id_2, \errata_id_2, \enable_2, \new_c_2
|
61 | 51 | .endm
|
62 | 52 |
|
63 |
| -#define _ALTERNATIVE_CFG_2(old_c, new_c_1, vendor_id_1, errata_id_1, \ |
64 |
| - CONFIG_k_1, \ |
65 |
| - new_c_2, vendor_id_2, errata_id_2, \ |
66 |
| - CONFIG_k_2) \ |
67 |
| - __ALTERNATIVE_CFG_2 old_c, new_c_1, vendor_id_1, errata_id_1, \ |
68 |
| - IS_ENABLED(CONFIG_k_1), \ |
69 |
| - new_c_2, vendor_id_2, errata_id_2, \ |
70 |
| - IS_ENABLED(CONFIG_k_2) |
| 53 | +#define __ALTERNATIVE_CFG(...) ALTERNATIVE_CFG __VA_ARGS__ |
| 54 | +#define __ALTERNATIVE_CFG_2(...) ALTERNATIVE_CFG_2 __VA_ARGS__ |
71 | 55 |
|
72 | 56 | #else /* !__ASSEMBLY__ */
|
73 | 57 |
|
|
109 | 93 | "887 :\n" \
|
110 | 94 | ALT_NEW_CONTENT(vendor_id, errata_id, enable, new_c)
|
111 | 95 |
|
112 |
| -#define _ALTERNATIVE_CFG(old_c, new_c, vendor_id, errata_id, CONFIG_k) \ |
113 |
| - __ALTERNATIVE_CFG(old_c, new_c, vendor_id, errata_id, IS_ENABLED(CONFIG_k)) |
114 |
| - |
115 |
| -#define __ALTERNATIVE_CFG_2(old_c, new_c_1, vendor_id_1, errata_id_1, \ |
116 |
| - enable_1, \ |
117 |
| - new_c_2, vendor_id_2, errata_id_2, \ |
118 |
| - enable_2) \ |
119 |
| - "886 :\n" \ |
120 |
| - ".option push\n" \ |
121 |
| - ".option norvc\n" \ |
122 |
| - ".option norelax\n" \ |
123 |
| - old_c "\n" \ |
124 |
| - ".option pop\n" \ |
125 |
| - "887 :\n" \ |
126 |
| - ALT_NEW_CONTENT(vendor_id_1, errata_id_1, enable_1, new_c_1) \ |
| 96 | +#define __ALTERNATIVE_CFG_2(old_c, new_c_1, vendor_id_1, errata_id_1, enable_1, \ |
| 97 | + new_c_2, vendor_id_2, errata_id_2, enable_2) \ |
| 98 | + __ALTERNATIVE_CFG(old_c, new_c_1, vendor_id_1, errata_id_1, enable_1) \ |
127 | 99 | ALT_NEW_CONTENT(vendor_id_2, errata_id_2, enable_2, new_c_2)
|
128 | 100 |
|
129 |
| -#define _ALTERNATIVE_CFG_2(old_c, new_c_1, vendor_id_1, errata_id_1, \ |
130 |
| - CONFIG_k_1, \ |
131 |
| - new_c_2, vendor_id_2, errata_id_2, \ |
132 |
| - CONFIG_k_2) \ |
133 |
| - __ALTERNATIVE_CFG_2(old_c, new_c_1, vendor_id_1, errata_id_1, \ |
134 |
| - IS_ENABLED(CONFIG_k_1), \ |
135 |
| - new_c_2, vendor_id_2, errata_id_2, \ |
136 |
| - IS_ENABLED(CONFIG_k_2)) |
137 |
| - |
138 | 101 | #endif /* __ASSEMBLY__ */
|
139 | 102 |
|
| 103 | +#define _ALTERNATIVE_CFG(old_c, new_c, vendor_id, errata_id, CONFIG_k) \ |
| 104 | + __ALTERNATIVE_CFG(old_c, new_c, vendor_id, errata_id, IS_ENABLED(CONFIG_k)) |
| 105 | + |
| 106 | +#define _ALTERNATIVE_CFG_2(old_c, new_c_1, vendor_id_1, errata_id_1, CONFIG_k_1, \ |
| 107 | + new_c_2, vendor_id_2, errata_id_2, CONFIG_k_2) \ |
| 108 | + __ALTERNATIVE_CFG_2(old_c, new_c_1, vendor_id_1, errata_id_1, IS_ENABLED(CONFIG_k_1), \ |
| 109 | + new_c_2, vendor_id_2, errata_id_2, IS_ENABLED(CONFIG_k_2)) |
| 110 | + |
140 | 111 | #else /* CONFIG_RISCV_ALTERNATIVE */
|
141 | 112 | #ifdef __ASSEMBLY__
|
142 | 113 |
|
143 |
| -.macro __ALTERNATIVE_CFG old_c |
| 114 | +.macro ALTERNATIVE_CFG old_c |
144 | 115 | \old_c
|
145 | 116 | .endm
|
146 | 117 |
|
147 |
| -#define _ALTERNATIVE_CFG(old_c, new_c, vendor_id, errata_id, CONFIG_k) \ |
148 |
| - __ALTERNATIVE_CFG old_c |
| 118 | +#define _ALTERNATIVE_CFG(old_c, ...) \ |
| 119 | + ALTERNATIVE_CFG old_c |
149 | 120 |
|
150 |
| -#define _ALTERNATIVE_CFG_2(old_c, new_c_1, vendor_id_1, errata_id_1, \ |
151 |
| - CONFIG_k_1, \ |
152 |
| - new_c_2, vendor_id_2, errata_id_2, \ |
153 |
| - CONFIG_k_2) \ |
154 |
| - __ALTERNATIVE_CFG old_c |
| 121 | +#define _ALTERNATIVE_CFG_2(old_c, ...) \ |
| 122 | + ALTERNATIVE_CFG old_c |
155 | 123 |
|
156 | 124 | #else /* !__ASSEMBLY__ */
|
157 | 125 |
|
158 |
| -#define __ALTERNATIVE_CFG(old_c) \ |
| 126 | +#define __ALTERNATIVE_CFG(old_c) \ |
159 | 127 | old_c "\n"
|
160 | 128 |
|
161 |
| -#define _ALTERNATIVE_CFG(old_c, new_c, vendor_id, errata_id, CONFIG_k) \ |
| 129 | +#define _ALTERNATIVE_CFG(old_c, ...) \ |
162 | 130 | __ALTERNATIVE_CFG(old_c)
|
163 | 131 |
|
164 |
| -#define _ALTERNATIVE_CFG_2(old_c, new_c_1, vendor_id_1, errata_id_1, \ |
165 |
| - CONFIG_k_1, \ |
166 |
| - new_c_2, vendor_id_2, errata_id_2, \ |
167 |
| - CONFIG_k_2) \ |
168 |
| - __ALTERNATIVE_CFG(old_c) |
| 132 | +#define _ALTERNATIVE_CFG_2(old_c, ...) \ |
| 133 | + __ALTERNATIVE_CFG(old_c) |
169 | 134 |
|
170 | 135 | #endif /* __ASSEMBLY__ */
|
171 | 136 | #endif /* CONFIG_RISCV_ALTERNATIVE */
|
|
193 | 158 | * on the following sample code and then replace ALTERNATIVE() with
|
194 | 159 | * ALTERNATIVE_2() to append its customized content.
|
195 | 160 | */
|
196 |
| -#define ALTERNATIVE_2(old_content, new_content_1, vendor_id_1, \ |
197 |
| - errata_id_1, CONFIG_k_1, \ |
198 |
| - new_content_2, vendor_id_2, \ |
199 |
| - errata_id_2, CONFIG_k_2) \ |
200 |
| - _ALTERNATIVE_CFG_2(old_content, new_content_1, vendor_id_1, \ |
201 |
| - errata_id_1, CONFIG_k_1, \ |
202 |
| - new_content_2, vendor_id_2, \ |
203 |
| - errata_id_2, CONFIG_k_2) |
| 161 | +#define ALTERNATIVE_2(old_content, new_content_1, vendor_id_1, errata_id_1, CONFIG_k_1, \ |
| 162 | + new_content_2, vendor_id_2, errata_id_2, CONFIG_k_2) \ |
| 163 | + _ALTERNATIVE_CFG_2(old_content, new_content_1, vendor_id_1, errata_id_1, CONFIG_k_1, \ |
| 164 | + new_content_2, vendor_id_2, errata_id_2, CONFIG_k_2) |
204 | 165 |
|
205 | 166 | #endif
|
0 commit comments