1
2
3
4
5
6 #include <asm/feature-fixups.h>
7 #include <asm/ppc_asm.h>
8 #include <asm/synch.h>
9 #include <asm/asm-compat.h>
10
11 .text
12
13 #define globl(x) \
14 .globl x; \
15 x:
16
17 globl(ftr_fixup_test1)
18 or 1,1,1
19 or 2,2,2
20 or 3,3,3
21
22 globl(end_ftr_fixup_test1)
23
24 globl(ftr_fixup_test1_orig)
25 or 1,1,1
26 or 2,2,2
27 or 3,3,3
28
29 globl(ftr_fixup_test1_expected)
30 or 1,1,1
31 nop
32 or 3,3,3
33
34 globl(ftr_fixup_test2)
35 or 1,1,1
36 or 2,2,2
37 or 3,3,3
38
39 globl(end_ftr_fixup_test2)
40
41 globl(ftr_fixup_test2_orig)
42 or 1,1,1
43 or 2,2,2
44 or 3,3,3
45
46 globl(ftr_fixup_test2_alt)
47 or 31,31,31
48
49 globl(ftr_fixup_test2_expected)
50 or 1,1,1
51 or 31,31,31
52 or 3,3,3
53
54 globl(ftr_fixup_test3)
55 or 1,1,1
56 or 2,2,2
57 or 3,3,3
58
59 globl(end_ftr_fixup_test3)
60
61 globl(ftr_fixup_test3_orig)
62 or 1,1,1
63 or 2,2,2
64 or 3,3,3
65
66 globl(ftr_fixup_test3_alt)
67 or 31,31,31
68 or 31,31,31
69
70 globl(ftr_fixup_test4)
71 or 1,1,1
72 or 2,2,2
73 or 2,2,2
74 or 2,2,2
75 or 2,2,2
76 or 3,3,3
77
78 globl(end_ftr_fixup_test4)
79
80 globl(ftr_fixup_test4_expected)
81 or 1,1,1
82 or 31,31,31
83 or 31,31,31
84 nop
85 nop
86 or 3,3,3
87
88 globl(ftr_fixup_test4_orig)
89 or 1,1,1
90 or 2,2,2
91 or 2,2,2
92 or 2,2,2
93 or 2,2,2
94 or 3,3,3
95
96 globl(ftr_fixup_test4_alt)
97 or 31,31,31
98 or 31,31,31
99
100
101 globl(ftr_fixup_test5)
102 or 1,1,1
103 BEGIN_FTR_SECTION
104 or 2,2,2
105 or 2,2,2
106 or 2,2,2
107 or 2,2,2
108 or 2,2,2
109 or 2,2,2
110 or 2,2,2
111 FTR_SECTION_ELSE
112 2: b 3f
113 3: or 5,5,5
114 beq 3b
115 b 1f
116 or 6,6,6
117 b 2b
118 1: bdnz 3b
119 ALT_FTR_SECTION_END(0, 1)
120 or 1,1,1
121
122 globl(end_ftr_fixup_test5)
123
124 globl(ftr_fixup_test5_expected)
125 or 1,1,1
126 2: b 3f
127 3: or 5,5,5
128 beq 3b
129 b 1f
130 or 6,6,6
131 b 2b
132 1: bdnz 3b
133 or 1,1,1
134
135 globl(ftr_fixup_test6)
136 1: or 1,1,1
137 BEGIN_FTR_SECTION
138 or 5,5,5
139 2: PPC_LCMPI r3,0
140 beq 4f
141 blt 2b
142 b 1b
143 b 4f
144 FTR_SECTION_ELSE
145 2: or 2,2,2
146 PPC_LCMPI r3,1
147 beq 3f
148 blt 2b
149 b 3f
150 b 1b
151 ALT_FTR_SECTION_END(0, 1)
152 3: or 1,1,1
153 or 2,2,2
154 4: or 3,3,3
155
156 globl(end_ftr_fixup_test6)
157
158 globl(ftr_fixup_test6_expected)
159 1: or 1,1,1
160 2: or 2,2,2
161 PPC_LCMPI r3,1
162 beq 3f
163 blt 2b
164 b 3f
165 b 1b
166 3: or 1,1,1
167 or 2,2,2
168 or 3,3,3
169
170 globl(ftr_fixup_test7)
171 or 1,1,1
172 BEGIN_FTR_SECTION
173 or 2,2,2
174 or 2,2,2
175 or 2,2,2
176 or 2,2,2
177 or 2,2,2
178 or 2,2,2
179 or 2,2,2
180 FTR_SECTION_ELSE
181 2: b 3f
182 3: or 5,5,5
183 beq 3b
184 b 1f
185 or 6,6,6
186 b 2b
187 bdnz 3b
188 1:
189 ALT_FTR_SECTION_END(0, 1)
190 or 1,1,1
191 or 1,1,1
192
193 globl(end_ftr_fixup_test7)
194 nop
195
196 globl(ftr_fixup_test7_expected)
197 or 1,1,1
198 2: b 3f
199 3: or 5,5,5
200 beq 3b
201 b 1f
202 or 6,6,6
203 b 2b
204 bdnz 3b
205 1: or 1,1,1
206
207 #if 0
208
209
210
211 ftr_fixup_test_too_big:
212 or 1,1,1
213 BEGIN_FTR_SECTION
214 or 2,2,2
215 or 2,2,2
216 or 2,2,2
217 FTR_SECTION_ELSE
218 or 3,3,3
219 or 3,3,3
220 or 3,3,3
221 or 3,3,3
222 ALT_FTR_SECTION_END(0, 1)
223 or 1,1,1
224 #endif
225
226 #define MAKE_MACRO_TEST(TYPE) \
227 globl(ftr_fixup_test_ ##TYPE##_macros) \
228 or 1,1,1; \
229 \
230 BEGIN_##TYPE##_SECTION \
231 or 2,2,2; \
232 or 2,2,2; \
233 or 2,2,2; \
234 END_##TYPE##_SECTION(0, 1) \
235 or 1,1,1; \
236 or 1,1,1; \
237 \
238 BEGIN_##TYPE##_SECTION \
239 or 2,2,2; \
240 or 2,2,2; \
241 or 2,2,2; \
242 END_##TYPE##_SECTION(0, 0) \
243 or 1,1,1; \
244 or 1,1,1; \
245 \
246 BEGIN_##TYPE##_SECTION \
247 or 2,2,2; \
248 or 2,2,2; \
249 BEGIN_##TYPE##_SECTION_NESTED(80) \
250 or 3,3,3; \
251 or 3,3,3; \
252 END_##TYPE##_SECTION_NESTED(0, 1, 80) \
253 or 2,2,2; \
254 or 2,2,2; \
255 END_##TYPE##_SECTION(0, 0) \
256 or 1,1,1; \
257 or 1,1,1; \
258 \
259 BEGIN_##TYPE##_SECTION \
260 or 2,2,2; \
261 or 2,2,2; \
262 BEGIN_##TYPE##_SECTION_NESTED(80) \
263 or 3,3,3; \
264 or 3,3,3; \
265 END_##TYPE##_SECTION_NESTED(0, 0, 80) \
266 or 2,2,2; \
267 or 2,2,2; \
268 END_##TYPE##_SECTION(0, 1) \
269 or 1,1,1; \
270 or 1,1,1; \
271 \
272 BEGIN_##TYPE##_SECTION \
273 or 2,2,2; \
274 or 2,2,2; \
275 BEGIN_##TYPE##_SECTION_NESTED(80) \
276 or 3,3,3; \
277 or 3,3,3; \
278 END_##TYPE##_SECTION_NESTED(0, 0, 80) \
279 or 2,2,2; \
280 or 2,2,2; \
281 END_##TYPE##_SECTION(0, 0) \
282 or 1,1,1; \
283 or 1,1,1; \
284 \
285 BEGIN_##TYPE##_SECTION \
286 or 3,3,3; \
287 or 3,3,3; \
288 or 3,3,3; \
289 ##TYPE##_SECTION_ELSE \
290 or 5,5,5; \
291 or 5,5,5; \
292 ALT_##TYPE##_SECTION_END(0, 0) \
293 or 1,1,1; \
294 or 1,1,1; \
295 \
296 BEGIN_##TYPE##_SECTION \
297 or 3,3,3; \
298 or 3,3,3; \
299 or 3,3,3; \
300 ##TYPE##_SECTION_ELSE \
301 or 31,31,31; \
302 or 31,31,31; \
303 or 31,31,31; \
304 ALT_##TYPE##_SECTION_END(0, 1) \
305 or 1,1,1; \
306 or 1,1,1; \
307 \
308 BEGIN_##TYPE##_SECTION \
309 or 3,3,3; \
310 or 3,3,3; \
311 or 3,3,3; \
312 ##TYPE##_SECTION_ELSE \
313 or 31,31,31; \
314 ALT_##TYPE##_SECTION_END(0, 1) \
315 or 1,1,1; \
316 or 1,1,1; \
317 \
318 \
319 BEGIN_##TYPE##_SECTION \
320 or 3,3,3; \
321 BEGIN_##TYPE##_SECTION_NESTED(95) \
322 or 3,3,3; \
323 or 3,3,3; \
324 END_##TYPE##_SECTION_NESTED(0, 1, 95) \
325 or 3,3,3; \
326 ##TYPE##_SECTION_ELSE \
327 or 2,2,2; \
328 or 2,2,2; \
329 ALT_##TYPE##_SECTION_END(0, 0) \
330 or 1,1,1; \
331 or 1,1,1; \
332 \
333 BEGIN_##TYPE##_SECTION \
334 or 3,3,3; \
335 or 3,3,3; \
336 or 3,3,3; \
337 ##TYPE##_SECTION_ELSE \
338 or 5,5,5; \
339 BEGIN_##TYPE##_SECTION_NESTED(95) \
340 or 3,3,3; \
341 END_##TYPE##_SECTION_NESTED(0, 1, 95) \
342 or 5,5,5; \
343 ALT_##TYPE##_SECTION_END(0, 0) \
344 or 1,1,1; \
345 or 1,1,1; \
346 \
347 BEGIN_##TYPE##_SECTION \
348 or 3,3,3; \
349 or 3,3,3; \
350 or 3,3,3; \
351 ##TYPE##_SECTION_ELSE \
352 or 5,5,5; \
353 BEGIN_##TYPE##_SECTION_NESTED(95) \
354 or 3,3,3; \
355 END_##TYPE##_SECTION_NESTED(0, 1, 95) \
356 or 5,5,5; \
357 ALT_##TYPE##_SECTION_END(0, 1) \
358 or 1,1,1; \
359 or 1,1,1; \
360 \
361 BEGIN_##TYPE##_SECTION \
362 or 2,2,2; \
363 BEGIN_##TYPE##_SECTION_NESTED(95) \
364 or 1,1,1; \
365 ##TYPE##_SECTION_ELSE_NESTED(95) \
366 or 5,5,5; \
367 ALT_##TYPE##_SECTION_END_NESTED(0, 0, 95) \
368 or 2,2,2; \
369 END_##TYPE##_SECTION(0, 0) \
370 or 1,1,1; \
371 or 1,1,1; \
372 \
373 BEGIN_##TYPE##_SECTION \
374 or 2,2,2; \
375 BEGIN_##TYPE##_SECTION_NESTED(95) \
376 or 1,1,1; \
377 ##TYPE##_SECTION_ELSE_NESTED(95) \
378 or 5,5,5; \
379 ALT_##TYPE##_SECTION_END_NESTED(0, 1, 95) \
380 or 2,2,2; \
381 END_##TYPE##_SECTION(0, 0) \
382 or 1,1,1; \
383 or 1,1,1; \
384 \
385 BEGIN_##TYPE##_SECTION \
386 or 2,2,2; \
387 BEGIN_##TYPE##_SECTION_NESTED(95) \
388 or 1,1,1; \
389 ##TYPE##_SECTION_ELSE_NESTED(95) \
390 or 5,5,5; \
391 ALT_##TYPE##_SECTION_END_NESTED(0, 0, 95) \
392 or 2,2,2; \
393 END_##TYPE##_SECTION(0, 1) \
394 or 1,1,1; \
395 or 1,1,1; \
396 \
397 BEGIN_##TYPE##_SECTION \
398 or 2,2,2; \
399 BEGIN_##TYPE##_SECTION_NESTED(95) \
400 or 1,1,1; \
401 ##TYPE##_SECTION_ELSE_NESTED(95) \
402 or 5,5,5; \
403 ALT_##TYPE##_SECTION_END_NESTED(0, 0, 95) \
404 or 2,2,2; \
405 ##TYPE##_SECTION_ELSE \
406 or 31,31,31; \
407 BEGIN_##TYPE##_SECTION_NESTED(94) \
408 or 5,5,5; \
409 ##TYPE##_SECTION_ELSE_NESTED(94) \
410 or 1,1,1; \
411 ALT_##TYPE##_SECTION_END_NESTED(0, 0, 94) \
412 or 31,31,31; \
413 ALT_##TYPE##_SECTION_END(0, 0) \
414 or 1,1,1; \
415 or 1,1,1; \
416 \
417 BEGIN_##TYPE##_SECTION \
418 or 2,2,2; \
419 BEGIN_##TYPE##_SECTION_NESTED(95) \
420 or 1,1,1; \
421 ##TYPE##_SECTION_ELSE_NESTED(95) \
422 or 5,5,5; \
423 ALT_##TYPE##_SECTION_END_NESTED(0, 1, 95) \
424 or 2,2,2; \
425 ##TYPE##_SECTION_ELSE \
426 or 31,31,31; \
427 BEGIN_##TYPE##_SECTION_NESTED(94) \
428 or 5,5,5; \
429 ##TYPE##_SECTION_ELSE_NESTED(94) \
430 or 1,1,1; \
431 ALT_##TYPE##_SECTION_END_NESTED(0, 0, 94) \
432 or 31,31,31; \
433 ALT_##TYPE##_SECTION_END(0, 0) \
434 or 1,1,1; \
435 or 1,1,1; \
436 \
437 BEGIN_##TYPE##_SECTION \
438 or 2,2,2; \
439 BEGIN_##TYPE##_SECTION_NESTED(95) \
440 or 1,1,1; \
441 ##TYPE##_SECTION_ELSE_NESTED(95) \
442 or 5,5,5; \
443 ALT_##TYPE##_SECTION_END_NESTED(0, 1, 95) \
444 or 2,2,2; \
445 ##TYPE##_SECTION_ELSE \
446 or 31,31,31; \
447 BEGIN_##TYPE##_SECTION_NESTED(94) \
448 or 5,5,5; \
449 ##TYPE##_SECTION_ELSE_NESTED(94) \
450 or 1,1,1; \
451 ALT_##TYPE##_SECTION_END_NESTED(0, 0, 94) \
452 or 31,31,31; \
453 ALT_##TYPE##_SECTION_END(0, 1) \
454 or 1,1,1; \
455 or 1,1,1; \
456 \
457 BEGIN_##TYPE##_SECTION \
458 or 2,2,2; \
459 BEGIN_##TYPE##_SECTION_NESTED(95) \
460 or 1,1,1; \
461 ##TYPE##_SECTION_ELSE_NESTED(95) \
462 or 5,5,5; \
463 ALT_##TYPE##_SECTION_END_NESTED(0, 1, 95) \
464 or 2,2,2; \
465 ##TYPE##_SECTION_ELSE \
466 or 31,31,31; \
467 BEGIN_##TYPE##_SECTION_NESTED(94) \
468 or 5,5,5; \
469 ##TYPE##_SECTION_ELSE_NESTED(94) \
470 or 1,1,1; \
471 ALT_##TYPE##_SECTION_END_NESTED(0, 1, 94) \
472 or 31,31,31; \
473 ALT_##TYPE##_SECTION_END(0, 1) \
474 or 1,1,1; \
475 or 1,1,1; \
476 \
477 BEGIN_##TYPE##_SECTION \
478 or 2,2,2; \
479 or 2,2,2; \
480 or 2,2,2; \
481 or 2,2,2; \
482 ##TYPE##_SECTION_ELSE \
483 BEGIN_##TYPE##_SECTION_NESTED(94) \
484 or 5,5,5; \
485 or 5,5,5; \
486 or 5,5,5; \
487 or 5,5,5; \
488 ##TYPE##_SECTION_ELSE_NESTED(94) \
489 or 1,1,1; \
490 or 1,1,1; \
491 or 1,1,1; \
492 or 1,1,1; \
493 ALT_##TYPE##_SECTION_END_NESTED(0, 1, 94) \
494 ALT_##TYPE##_SECTION_END(0, 1) \
495 or 1,1,1; \
496 or 1,1,1;
497
498 #define MAKE_MACRO_TEST_EXPECTED(TYPE) \
499 globl(ftr_fixup_test_ ##TYPE##_macros_expected) \
500 or 1,1,1; \
501 \
502 \
503 nop; \
504 nop; \
505 nop; \
506 \
507 or 1,1,1; \
508 or 1,1,1; \
509 \
510 \
511 or 2,2,2; \
512 or 2,2,2; \
513 or 2,2,2; \
514 \
515 or 1,1,1; \
516 or 1,1,1; \
517 \
518 \
519 or 2,2,2; \
520 or 2,2,2; \
521 \
522 nop; \
523 nop; \
524 \
525 or 2,2,2; \
526 or 2,2,2; \
527 \
528 or 1,1,1; \
529 or 1,1,1; \
530 \
531 \
532 \
533 nop; \
534 nop; \
535 \
536 nop; \
537 nop; \
538 \
539 nop; \
540 nop; \
541 \
542 or 1,1,1; \
543 or 1,1,1; \
544 \
545 \
546 or 2,2,2; \
547 or 2,2,2; \
548 \
549 or 3,3,3; \
550 or 3,3,3; \
551 \
552 or 2,2,2; \
553 or 2,2,2; \
554 \
555 or 1,1,1; \
556 or 1,1,1; \
557 \
558 \
559 or 3,3,3; \
560 or 3,3,3; \
561 or 3,3,3; \
562 \
563 \
564 \
565 \
566 or 1,1,1; \
567 or 1,1,1; \
568 \
569 \
570 \
571 \
572 \
573 \
574 or 31,31,31; \
575 or 31,31,31; \
576 or 31,31,31; \
577 \
578 or 1,1,1; \
579 or 1,1,1; \
580 \
581 \
582 \
583 \
584 \
585 \
586 or 31,31,31; \
587 nop; \
588 nop; \
589 \
590 or 1,1,1; \
591 or 1,1,1; \
592 \
593 \
594 \
595 or 3,3,3; \
596 \
597 nop; \
598 nop; \
599 \
600 or 3,3,3; \
601 \
602 \
603 \
604 \
605 or 1,1,1; \
606 or 1,1,1; \
607 \
608 \
609 or 3,3,3; \
610 or 3,3,3; \
611 or 3,3,3; \
612 \
613 \
614 \
615 \
616 \
617 \
618 \
619 or 1,1,1; \
620 or 1,1,1; \
621 \
622 \
623 \
624 \
625 \
626 \
627 or 5,5,5; \
628 \
629 nop; \
630 \
631 or 5,5,5; \
632 \
633 or 1,1,1; \
634 or 1,1,1; \
635 \
636 \
637 or 2,2,2; \
638 \
639 or 1,1,1; \
640 \
641 \
642 \
643 or 2,2,2; \
644 \
645 or 1,1,1; \
646 or 1,1,1; \
647 \
648 \
649 or 2,2,2; \
650 \
651 \
652 \
653 or 5,5,5; \
654 \
655 or 2,2,2; \
656 \
657 or 1,1,1; \
658 or 1,1,1; \
659 \
660 \
661 nop; \
662 \
663 nop; \
664 \
665 \
666 \
667 nop; \
668 \
669 or 1,1,1; \
670 or 1,1,1; \
671 \
672 \
673 or 2,2,2; \
674 \
675 or 1,1,1; \
676 \
677 \
678 \
679 or 2,2,2; \
680 \
681 \
682 \
683 \
684 \
685 \
686 \
687 \
688 \
689 or 1,1,1; \
690 or 1,1,1; \
691 \
692 \
693 or 2,2,2; \
694 \
695 \
696 \
697 or 5,5,5; \
698 \
699 or 2,2,2; \
700 \
701 \
702 \
703 \
704 \
705 \
706 \
707 \
708 \
709 or 1,1,1; \
710 or 1,1,1; \
711 \
712 \
713 \
714 \
715 \
716 \
717 \
718 \
719 \
720 \
721 or 31,31,31; \
722 \
723 or 5,5,5; \
724 \
725 \
726 \
727 or 31,31,31; \
728 \
729 or 1,1,1; \
730 or 1,1,1; \
731 \
732 \
733 \
734 \
735 \
736 \
737 \
738 \
739 \
740 \
741 or 31,31,31; \
742 \
743 \
744 \
745 or 1,1,1; \
746 \
747 or 31,31,31; \
748 \
749 or 1,1,1; \
750 or 1,1,1; \
751 \
752 \
753 \
754 \
755 \
756 \
757 \
758 \
759 \
760 \
761 \
762 \
763 \
764 or 1,1,1; \
765 or 1,1,1; \
766 or 1,1,1; \
767 or 1,1,1; \
768 \
769 \
770 or 1,1,1; \
771 or 1,1,1;
772
773 MAKE_MACRO_TEST(FTR);
774 MAKE_MACRO_TEST_EXPECTED(FTR);
775
776 #ifdef CONFIG_PPC64
777 MAKE_MACRO_TEST(FW_FTR);
778 MAKE_MACRO_TEST_EXPECTED(FW_FTR);
779 #endif
780
781 globl(lwsync_fixup_test)
782 1: or 1,1,1
783 LWSYNC
784 globl(end_lwsync_fixup_test)
785
786 globl(lwsync_fixup_test_expected_LWSYNC)
787 1: or 1,1,1
788 lwsync
789
790 globl(lwsync_fixup_test_expected_SYNC)
791 1: or 1,1,1
792 sync
793