diff options
Diffstat (limited to 'include/asm-powerpc/ppc_asm.h')
-rw-r--r-- | include/asm-powerpc/ppc_asm.h | 114 |
1 files changed, 112 insertions, 2 deletions
diff --git a/include/asm-powerpc/ppc_asm.h b/include/asm-powerpc/ppc_asm.h index 2dbd4e7884fa..0966899d974b 100644 --- a/include/asm-powerpc/ppc_asm.h +++ b/include/asm-powerpc/ppc_asm.h | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | #include <linux/stringify.h> | 7 | #include <linux/stringify.h> |
8 | #include <asm/asm-compat.h> | 8 | #include <asm/asm-compat.h> |
9 | #include <asm/processor.h> | ||
9 | 10 | ||
10 | #ifndef __ASSEMBLY__ | 11 | #ifndef __ASSEMBLY__ |
11 | #error __FILE__ should only be used in assembler files | 12 | #error __FILE__ should only be used in assembler files |
@@ -73,6 +74,15 @@ END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \ | |||
73 | REST_10GPRS(22, base) | 74 | REST_10GPRS(22, base) |
74 | #endif | 75 | #endif |
75 | 76 | ||
77 | /* | ||
78 | * Define what the VSX XX1 form instructions will look like, then add | ||
79 | * the 128 bit load store instructions based on that. | ||
80 | */ | ||
81 | #define VSX_XX1(xs, ra, rb) (((xs) & 0x1f) << 21 | ((ra) << 16) | \ | ||
82 | ((rb) << 11) | (((xs) >> 5))) | ||
83 | |||
84 | #define STXVD2X(xs, ra, rb) .long (0x7c000798 | VSX_XX1((xs), (ra), (rb))) | ||
85 | #define LXVD2X(xs, ra, rb) .long (0x7c000698 | VSX_XX1((xs), (ra), (rb))) | ||
76 | 86 | ||
77 | #define SAVE_2GPRS(n, base) SAVE_GPR(n, base); SAVE_GPR(n+1, base) | 87 | #define SAVE_2GPRS(n, base) SAVE_GPR(n, base); SAVE_GPR(n+1, base) |
78 | #define SAVE_4GPRS(n, base) SAVE_2GPRS(n, base); SAVE_2GPRS(n+2, base) | 88 | #define SAVE_4GPRS(n, base) SAVE_2GPRS(n, base); SAVE_2GPRS(n+2, base) |
@@ -83,13 +93,13 @@ END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \ | |||
83 | #define REST_8GPRS(n, base) REST_4GPRS(n, base); REST_4GPRS(n+4, base) | 93 | #define REST_8GPRS(n, base) REST_4GPRS(n, base); REST_4GPRS(n+4, base) |
84 | #define REST_10GPRS(n, base) REST_8GPRS(n, base); REST_2GPRS(n+8, base) | 94 | #define REST_10GPRS(n, base) REST_8GPRS(n, base); REST_2GPRS(n+8, base) |
85 | 95 | ||
86 | #define SAVE_FPR(n, base) stfd n,THREAD_FPR0+8*(n)(base) | 96 | #define SAVE_FPR(n, base) stfd n,THREAD_FPR0+8*TS_FPRWIDTH*(n)(base) |
87 | #define SAVE_2FPRS(n, base) SAVE_FPR(n, base); SAVE_FPR(n+1, base) | 97 | #define SAVE_2FPRS(n, base) SAVE_FPR(n, base); SAVE_FPR(n+1, base) |
88 | #define SAVE_4FPRS(n, base) SAVE_2FPRS(n, base); SAVE_2FPRS(n+2, base) | 98 | #define SAVE_4FPRS(n, base) SAVE_2FPRS(n, base); SAVE_2FPRS(n+2, base) |
89 | #define SAVE_8FPRS(n, base) SAVE_4FPRS(n, base); SAVE_4FPRS(n+4, base) | 99 | #define SAVE_8FPRS(n, base) SAVE_4FPRS(n, base); SAVE_4FPRS(n+4, base) |
90 | #define SAVE_16FPRS(n, base) SAVE_8FPRS(n, base); SAVE_8FPRS(n+8, base) | 100 | #define SAVE_16FPRS(n, base) SAVE_8FPRS(n, base); SAVE_8FPRS(n+8, base) |
91 | #define SAVE_32FPRS(n, base) SAVE_16FPRS(n, base); SAVE_16FPRS(n+16, base) | 101 | #define SAVE_32FPRS(n, base) SAVE_16FPRS(n, base); SAVE_16FPRS(n+16, base) |
92 | #define REST_FPR(n, base) lfd n,THREAD_FPR0+8*(n)(base) | 102 | #define REST_FPR(n, base) lfd n,THREAD_FPR0+8*TS_FPRWIDTH*(n)(base) |
93 | #define REST_2FPRS(n, base) REST_FPR(n, base); REST_FPR(n+1, base) | 103 | #define REST_2FPRS(n, base) REST_FPR(n, base); REST_FPR(n+1, base) |
94 | #define REST_4FPRS(n, base) REST_2FPRS(n, base); REST_2FPRS(n+2, base) | 104 | #define REST_4FPRS(n, base) REST_2FPRS(n, base); REST_2FPRS(n+2, base) |
95 | #define REST_8FPRS(n, base) REST_4FPRS(n, base); REST_4FPRS(n+4, base) | 105 | #define REST_8FPRS(n, base) REST_4FPRS(n, base); REST_4FPRS(n+4, base) |
@@ -109,6 +119,33 @@ END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \ | |||
109 | #define REST_16VRS(n,b,base) REST_8VRS(n,b,base); REST_8VRS(n+8,b,base) | 119 | #define REST_16VRS(n,b,base) REST_8VRS(n,b,base); REST_8VRS(n+8,b,base) |
110 | #define REST_32VRS(n,b,base) REST_16VRS(n,b,base); REST_16VRS(n+16,b,base) | 120 | #define REST_32VRS(n,b,base) REST_16VRS(n,b,base); REST_16VRS(n+16,b,base) |
111 | 121 | ||
122 | /* Save the lower 32 VSRs in the thread VSR region */ | ||
123 | #define SAVE_VSR(n,b,base) li b,THREAD_VSR0+(16*(n)); STXVD2X(n,b,base) | ||
124 | #define SAVE_2VSRS(n,b,base) SAVE_VSR(n,b,base); SAVE_VSR(n+1,b,base) | ||
125 | #define SAVE_4VSRS(n,b,base) SAVE_2VSRS(n,b,base); SAVE_2VSRS(n+2,b,base) | ||
126 | #define SAVE_8VSRS(n,b,base) SAVE_4VSRS(n,b,base); SAVE_4VSRS(n+4,b,base) | ||
127 | #define SAVE_16VSRS(n,b,base) SAVE_8VSRS(n,b,base); SAVE_8VSRS(n+8,b,base) | ||
128 | #define SAVE_32VSRS(n,b,base) SAVE_16VSRS(n,b,base); SAVE_16VSRS(n+16,b,base) | ||
129 | #define REST_VSR(n,b,base) li b,THREAD_VSR0+(16*(n)); LXVD2X(n,b,base) | ||
130 | #define REST_2VSRS(n,b,base) REST_VSR(n,b,base); REST_VSR(n+1,b,base) | ||
131 | #define REST_4VSRS(n,b,base) REST_2VSRS(n,b,base); REST_2VSRS(n+2,b,base) | ||
132 | #define REST_8VSRS(n,b,base) REST_4VSRS(n,b,base); REST_4VSRS(n+4,b,base) | ||
133 | #define REST_16VSRS(n,b,base) REST_8VSRS(n,b,base); REST_8VSRS(n+8,b,base) | ||
134 | #define REST_32VSRS(n,b,base) REST_16VSRS(n,b,base); REST_16VSRS(n+16,b,base) | ||
135 | /* Save the upper 32 VSRs (32-63) in the thread VSX region (0-31) */ | ||
136 | #define SAVE_VSRU(n,b,base) li b,THREAD_VR0+(16*(n)); STXVD2X(n+32,b,base) | ||
137 | #define SAVE_2VSRSU(n,b,base) SAVE_VSRU(n,b,base); SAVE_VSRU(n+1,b,base) | ||
138 | #define SAVE_4VSRSU(n,b,base) SAVE_2VSRSU(n,b,base); SAVE_2VSRSU(n+2,b,base) | ||
139 | #define SAVE_8VSRSU(n,b,base) SAVE_4VSRSU(n,b,base); SAVE_4VSRSU(n+4,b,base) | ||
140 | #define SAVE_16VSRSU(n,b,base) SAVE_8VSRSU(n,b,base); SAVE_8VSRSU(n+8,b,base) | ||
141 | #define SAVE_32VSRSU(n,b,base) SAVE_16VSRSU(n,b,base); SAVE_16VSRSU(n+16,b,base) | ||
142 | #define REST_VSRU(n,b,base) li b,THREAD_VR0+(16*(n)); LXVD2X(n+32,b,base) | ||
143 | #define REST_2VSRSU(n,b,base) REST_VSRU(n,b,base); REST_VSRU(n+1,b,base) | ||
144 | #define REST_4VSRSU(n,b,base) REST_2VSRSU(n,b,base); REST_2VSRSU(n+2,b,base) | ||
145 | #define REST_8VSRSU(n,b,base) REST_4VSRSU(n,b,base); REST_4VSRSU(n+4,b,base) | ||
146 | #define REST_16VSRSU(n,b,base) REST_8VSRSU(n,b,base); REST_8VSRSU(n+8,b,base) | ||
147 | #define REST_32VSRSU(n,b,base) REST_16VSRSU(n,b,base); REST_16VSRSU(n+16,b,base) | ||
148 | |||
112 | #define SAVE_EVR(n,s,base) evmergehi s,s,n; stw s,THREAD_EVR0+4*(n)(base) | 149 | #define SAVE_EVR(n,s,base) evmergehi s,s,n; stw s,THREAD_EVR0+4*(n)(base) |
113 | #define SAVE_2EVRS(n,s,base) SAVE_EVR(n,s,base); SAVE_EVR(n+1,s,base) | 150 | #define SAVE_2EVRS(n,s,base) SAVE_EVR(n,s,base); SAVE_EVR(n+1,s,base) |
114 | #define SAVE_4EVRS(n,s,base) SAVE_2EVRS(n,s,base); SAVE_2EVRS(n+2,s,base) | 151 | #define SAVE_4EVRS(n,s,base) SAVE_2EVRS(n,s,base); SAVE_2EVRS(n+2,s,base) |
@@ -356,6 +393,12 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601) | |||
356 | #define toreal(rd) | 393 | #define toreal(rd) |
357 | #define fromreal(rd) | 394 | #define fromreal(rd) |
358 | 395 | ||
396 | /* | ||
397 | * We use addis to ensure compatibility with the "classic" ppc versions of | ||
398 | * these macros, which use rs = 0 to get the tophys offset in rd, rather than | ||
399 | * converting the address in r0, and so this version has to do that too | ||
400 | * (i.e. set register rd to 0 when rs == 0). | ||
401 | */ | ||
359 | #define tophys(rd,rs) \ | 402 | #define tophys(rd,rs) \ |
360 | addis rd,rs,0 | 403 | addis rd,rs,0 |
361 | 404 | ||
@@ -533,6 +576,73 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601) | |||
533 | #define vr30 30 | 576 | #define vr30 30 |
534 | #define vr31 31 | 577 | #define vr31 31 |
535 | 578 | ||
579 | /* VSX Registers (VSRs) */ | ||
580 | |||
581 | #define vsr0 0 | ||
582 | #define vsr1 1 | ||
583 | #define vsr2 2 | ||
584 | #define vsr3 3 | ||
585 | #define vsr4 4 | ||
586 | #define vsr5 5 | ||
587 | #define vsr6 6 | ||
588 | #define vsr7 7 | ||
589 | #define vsr8 8 | ||
590 | #define vsr9 9 | ||
591 | #define vsr10 10 | ||
592 | #define vsr11 11 | ||
593 | #define vsr12 12 | ||
594 | #define vsr13 13 | ||
595 | #define vsr14 14 | ||
596 | #define vsr15 15 | ||
597 | #define vsr16 16 | ||
598 | #define vsr17 17 | ||
599 | #define vsr18 18 | ||
600 | #define vsr19 19 | ||
601 | #define vsr20 20 | ||
602 | #define vsr21 21 | ||
603 | #define vsr22 22 | ||
604 | #define vsr23 23 | ||
605 | #define vsr24 24 | ||
606 | #define vsr25 25 | ||
607 | #define vsr26 26 | ||
608 | #define vsr27 27 | ||
609 | #define vsr28 28 | ||
610 | #define vsr29 29 | ||
611 | #define vsr30 30 | ||
612 | #define vsr31 31 | ||
613 | #define vsr32 32 | ||
614 | #define vsr33 33 | ||
615 | #define vsr34 34 | ||
616 | #define vsr35 35 | ||
617 | #define vsr36 36 | ||
618 | #define vsr37 37 | ||
619 | #define vsr38 38 | ||
620 | #define vsr39 39 | ||
621 | #define vsr40 40 | ||
622 | #define vsr41 41 | ||
623 | #define vsr42 42 | ||
624 | #define vsr43 43 | ||
625 | #define vsr44 44 | ||
626 | #define vsr45 45 | ||
627 | #define vsr46 46 | ||
628 | #define vsr47 47 | ||
629 | #define vsr48 48 | ||
630 | #define vsr49 49 | ||
631 | #define vsr50 50 | ||
632 | #define vsr51 51 | ||
633 | #define vsr52 52 | ||
634 | #define vsr53 53 | ||
635 | #define vsr54 54 | ||
636 | #define vsr55 55 | ||
637 | #define vsr56 56 | ||
638 | #define vsr57 57 | ||
639 | #define vsr58 58 | ||
640 | #define vsr59 59 | ||
641 | #define vsr60 60 | ||
642 | #define vsr61 61 | ||
643 | #define vsr62 62 | ||
644 | #define vsr63 63 | ||
645 | |||
536 | /* SPE Registers (EVPRs) */ | 646 | /* SPE Registers (EVPRs) */ |
537 | 647 | ||
538 | #define evr0 0 | 648 | #define evr0 0 |