aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/octeon_switch.S
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/kernel/octeon_switch.S')
-rw-r--r--arch/mips/kernel/octeon_switch.S104
1 files changed, 52 insertions, 52 deletions
diff --git a/arch/mips/kernel/octeon_switch.S b/arch/mips/kernel/octeon_switch.S
index 207f1341578b..0e23343eb0a9 100644
--- a/arch/mips/kernel/octeon_switch.S
+++ b/arch/mips/kernel/octeon_switch.S
@@ -30,7 +30,7 @@
30 30
31/* 31/*
32 * task_struct *resume(task_struct *prev, task_struct *next, 32 * task_struct *resume(task_struct *prev, task_struct *next,
33 * struct thread_info *next_ti, int usedfpu) 33 * struct thread_info *next_ti, int usedfpu)
34 */ 34 */
35 .align 7 35 .align 7
36 LEAF(resume) 36 LEAF(resume)
@@ -69,7 +69,7 @@
691: 691:
70#if CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0 70#if CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0
71 /* Check if we need to store CVMSEG state */ 71 /* Check if we need to store CVMSEG state */
72 mfc0 t0, $11,7 /* CvmMemCtl */ 72 mfc0 t0, $11,7 /* CvmMemCtl */
73 bbit0 t0, 6, 3f /* Is user access enabled? */ 73 bbit0 t0, 6, 3f /* Is user access enabled? */
74 74
75 /* Store the CVMSEG state */ 75 /* Store the CVMSEG state */
@@ -77,8 +77,8 @@
77 andi t0, 0x3f 77 andi t0, 0x3f
78 /* Multiply * (cache line size/sizeof(long)/2) */ 78 /* Multiply * (cache line size/sizeof(long)/2) */
79 sll t0, 7-LONGLOG-1 79 sll t0, 7-LONGLOG-1
80 li t1, -32768 /* Base address of CVMSEG */ 80 li t1, -32768 /* Base address of CVMSEG */
81 LONG_ADDI t2, a0, THREAD_CVMSEG /* Where to store CVMSEG to */ 81 LONG_ADDI t2, a0, THREAD_CVMSEG /* Where to store CVMSEG to */
82 synciobdma 82 synciobdma
832: 832:
84 .set noreorder 84 .set noreorder
@@ -89,13 +89,13 @@
89 LONG_S t8, 0(t2) /* Store CVMSEG to thread storage */ 89 LONG_S t8, 0(t2) /* Store CVMSEG to thread storage */
90 LONG_ADDU t2, LONGSIZE*2 /* Increment loc in thread storage */ 90 LONG_ADDU t2, LONGSIZE*2 /* Increment loc in thread storage */
91 bnez t0, 2b /* Loop until we've copied it all */ 91 bnez t0, 2b /* Loop until we've copied it all */
92 LONG_S t9, -LONGSIZE(t2)/* Store CVMSEG to thread storage */ 92 LONG_S t9, -LONGSIZE(t2)/* Store CVMSEG to thread storage */
93 .set reorder 93 .set reorder
94 94
95 /* Disable access to CVMSEG */ 95 /* Disable access to CVMSEG */
96 mfc0 t0, $11,7 /* CvmMemCtl */ 96 mfc0 t0, $11,7 /* CvmMemCtl */
97 xori t0, t0, 0x40 /* Bit 6 is CVMSEG user enable */ 97 xori t0, t0, 0x40 /* Bit 6 is CVMSEG user enable */
98 mtc0 t0, $11,7 /* CvmMemCtl */ 98 mtc0 t0, $11,7 /* CvmMemCtl */
99#endif 99#endif
1003: 1003:
101 /* 101 /*
@@ -133,7 +133,7 @@
133 133
134 dmfc0 t9, $9,7 /* CvmCtl register. */ 134 dmfc0 t9, $9,7 /* CvmCtl register. */
135 135
136 /* Save the COP2 CRC state */ 136 /* Save the COP2 CRC state */
137 dmfc2 t0, 0x0201 137 dmfc2 t0, 0x0201
138 dmfc2 t1, 0x0202 138 dmfc2 t1, 0x0202
139 dmfc2 t2, 0x0200 139 dmfc2 t2, 0x0200
@@ -149,30 +149,30 @@
149 sd t0, OCTEON_CP2_LLM_DAT(a0) 149 sd t0, OCTEON_CP2_LLM_DAT(a0)
150 sd t1, OCTEON_CP2_LLM_DAT+8(a0) 150 sd t1, OCTEON_CP2_LLM_DAT+8(a0)
151 151
1521: bbit1 t9, 26, 3f /* done if CvmCtl[NOCRYPTO] set */ 1521: bbit1 t9, 26, 3f /* done if CvmCtl[NOCRYPTO] set */
153 153
154 /* Save the COP2 crypto state */ 154 /* Save the COP2 crypto state */
155 /* this part is mostly common to both pass 1 and later revisions */ 155 /* this part is mostly common to both pass 1 and later revisions */
156 dmfc2 t0, 0x0084 156 dmfc2 t0, 0x0084
157 dmfc2 t1, 0x0080 157 dmfc2 t1, 0x0080
158 dmfc2 t2, 0x0081 158 dmfc2 t2, 0x0081
159 dmfc2 t3, 0x0082 159 dmfc2 t3, 0x0082
160 sd t0, OCTEON_CP2_3DES_IV(a0) 160 sd t0, OCTEON_CP2_3DES_IV(a0)
161 dmfc2 t0, 0x0088 161 dmfc2 t0, 0x0088
162 sd t1, OCTEON_CP2_3DES_KEY(a0) 162 sd t1, OCTEON_CP2_3DES_KEY(a0)
163 dmfc2 t1, 0x0111 /* only necessary for pass 1 */ 163 dmfc2 t1, 0x0111 /* only necessary for pass 1 */
164 sd t2, OCTEON_CP2_3DES_KEY+8(a0) 164 sd t2, OCTEON_CP2_3DES_KEY+8(a0)
165 dmfc2 t2, 0x0102 165 dmfc2 t2, 0x0102
166 sd t3, OCTEON_CP2_3DES_KEY+16(a0) 166 sd t3, OCTEON_CP2_3DES_KEY+16(a0)
167 dmfc2 t3, 0x0103 167 dmfc2 t3, 0x0103
168 sd t0, OCTEON_CP2_3DES_RESULT(a0) 168 sd t0, OCTEON_CP2_3DES_RESULT(a0)
169 dmfc2 t0, 0x0104 169 dmfc2 t0, 0x0104
170 sd t1, OCTEON_CP2_AES_INP0(a0) /* only necessary for pass 1 */ 170 sd t1, OCTEON_CP2_AES_INP0(a0) /* only necessary for pass 1 */
171 dmfc2 t1, 0x0105 171 dmfc2 t1, 0x0105
172 sd t2, OCTEON_CP2_AES_IV(a0) 172 sd t2, OCTEON_CP2_AES_IV(a0)
173 dmfc2 t2, 0x0106 173 dmfc2 t2, 0x0106
174 sd t3, OCTEON_CP2_AES_IV+8(a0) 174 sd t3, OCTEON_CP2_AES_IV+8(a0)
175 dmfc2 t3, 0x0107 175 dmfc2 t3, 0x0107
176 sd t0, OCTEON_CP2_AES_KEY(a0) 176 sd t0, OCTEON_CP2_AES_KEY(a0)
177 dmfc2 t0, 0x0110 177 dmfc2 t0, 0x0110
178 sd t1, OCTEON_CP2_AES_KEY+8(a0) 178 sd t1, OCTEON_CP2_AES_KEY+8(a0)
@@ -180,7 +180,7 @@
180 sd t2, OCTEON_CP2_AES_KEY+16(a0) 180 sd t2, OCTEON_CP2_AES_KEY+16(a0)
181 dmfc2 t2, 0x0101 181 dmfc2 t2, 0x0101
182 sd t3, OCTEON_CP2_AES_KEY+24(a0) 182 sd t3, OCTEON_CP2_AES_KEY+24(a0)
183 mfc0 t3, $15,0 /* Get the processor ID register */ 183 mfc0 t3, $15,0 /* Get the processor ID register */
184 sd t0, OCTEON_CP2_AES_KEYLEN(a0) 184 sd t0, OCTEON_CP2_AES_KEYLEN(a0)
185 li t0, 0x000d0000 /* This is the processor ID of Octeon Pass1 */ 185 li t0, 0x000d0000 /* This is the processor ID of Octeon Pass1 */
186 sd t1, OCTEON_CP2_AES_RESULT(a0) 186 sd t1, OCTEON_CP2_AES_RESULT(a0)
@@ -188,7 +188,7 @@
188 /* Skip to the Pass1 version of the remainder of the COP2 state */ 188 /* Skip to the Pass1 version of the remainder of the COP2 state */
189 beq t3, t0, 2f 189 beq t3, t0, 2f
190 190
191 /* the non-pass1 state when !CvmCtl[NOCRYPTO] */ 191 /* the non-pass1 state when !CvmCtl[NOCRYPTO] */
192 dmfc2 t1, 0x0240 192 dmfc2 t1, 0x0240
193 dmfc2 t2, 0x0241 193 dmfc2 t2, 0x0241
194 dmfc2 t3, 0x0242 194 dmfc2 t3, 0x0242
@@ -214,7 +214,7 @@
214 sd t2, OCTEON_CP2_HSH_DATW+72(a0) 214 sd t2, OCTEON_CP2_HSH_DATW+72(a0)
215 dmfc2 t2, 0x024D 215 dmfc2 t2, 0x024D
216 sd t3, OCTEON_CP2_HSH_DATW+80(a0) 216 sd t3, OCTEON_CP2_HSH_DATW+80(a0)
217 dmfc2 t3, 0x024E 217 dmfc2 t3, 0x024E
218 sd t0, OCTEON_CP2_HSH_DATW+88(a0) 218 sd t0, OCTEON_CP2_HSH_DATW+88(a0)
219 dmfc2 t0, 0x0250 219 dmfc2 t0, 0x0250
220 sd t1, OCTEON_CP2_HSH_DATW+96(a0) 220 sd t1, OCTEON_CP2_HSH_DATW+96(a0)
@@ -232,9 +232,9 @@
232 sd t3, OCTEON_CP2_HSH_IVW+24(a0) 232 sd t3, OCTEON_CP2_HSH_IVW+24(a0)
233 dmfc2 t3, 0x0257 233 dmfc2 t3, 0x0257
234 sd t0, OCTEON_CP2_HSH_IVW+32(a0) 234 sd t0, OCTEON_CP2_HSH_IVW+32(a0)
235 dmfc2 t0, 0x0258 235 dmfc2 t0, 0x0258
236 sd t1, OCTEON_CP2_HSH_IVW+40(a0) 236 sd t1, OCTEON_CP2_HSH_IVW+40(a0)
237 dmfc2 t1, 0x0259 237 dmfc2 t1, 0x0259
238 sd t2, OCTEON_CP2_HSH_IVW+48(a0) 238 sd t2, OCTEON_CP2_HSH_IVW+48(a0)
239 dmfc2 t2, 0x025E 239 dmfc2 t2, 0x025E
240 sd t3, OCTEON_CP2_HSH_IVW+56(a0) 240 sd t3, OCTEON_CP2_HSH_IVW+56(a0)
@@ -247,7 +247,7 @@
247 sd t0, OCTEON_CP2_GFM_RESULT+8(a0) 247 sd t0, OCTEON_CP2_GFM_RESULT+8(a0)
248 jr ra 248 jr ra
249 249
2502: /* pass 1 special stuff when !CvmCtl[NOCRYPTO] */ 2502: /* pass 1 special stuff when !CvmCtl[NOCRYPTO] */
251 dmfc2 t3, 0x0040 251 dmfc2 t3, 0x0040
252 dmfc2 t0, 0x0041 252 dmfc2 t0, 0x0041
253 dmfc2 t1, 0x0042 253 dmfc2 t1, 0x0042
@@ -269,7 +269,7 @@
269 sd t3, OCTEON_CP2_HSH_IVW+8(a0) 269 sd t3, OCTEON_CP2_HSH_IVW+8(a0)
270 sd t0, OCTEON_CP2_HSH_IVW+16(a0) 270 sd t0, OCTEON_CP2_HSH_IVW+16(a0)
271 271
2723: /* pass 1 or CvmCtl[NOCRYPTO] set */ 2723: /* pass 1 or CvmCtl[NOCRYPTO] set */
273 jr ra 273 jr ra
274 END(octeon_cop2_save) 274 END(octeon_cop2_save)
275 275
@@ -280,19 +280,19 @@
280 .set push 280 .set push
281 .set noreorder 281 .set noreorder
282 LEAF(octeon_cop2_restore) 282 LEAF(octeon_cop2_restore)
283 /* First cache line was prefetched before the call */ 283 /* First cache line was prefetched before the call */
284 pref 4, 128(a0) 284 pref 4, 128(a0)
285 dmfc0 t9, $9,7 /* CvmCtl register. */ 285 dmfc0 t9, $9,7 /* CvmCtl register. */
286 286
287 pref 4, 256(a0) 287 pref 4, 256(a0)
288 ld t0, OCTEON_CP2_CRC_IV(a0) 288 ld t0, OCTEON_CP2_CRC_IV(a0)
289 pref 4, 384(a0) 289 pref 4, 384(a0)
290 ld t1, OCTEON_CP2_CRC_LENGTH(a0) 290 ld t1, OCTEON_CP2_CRC_LENGTH(a0)
291 ld t2, OCTEON_CP2_CRC_POLY(a0) 291 ld t2, OCTEON_CP2_CRC_POLY(a0)
292 292
293 /* Restore the COP2 CRC state */ 293 /* Restore the COP2 CRC state */
294 dmtc2 t0, 0x0201 294 dmtc2 t0, 0x0201
295 dmtc2 t1, 0x1202 295 dmtc2 t1, 0x1202
296 bbit1 t9, 28, 2f /* Skip LLM if CvmCtl[NODFA_CP2] is set */ 296 bbit1 t9, 28, 2f /* Skip LLM if CvmCtl[NODFA_CP2] is set */
297 dmtc2 t2, 0x4200 297 dmtc2 t2, 0x4200
298 298
@@ -310,19 +310,19 @@
310 ld t0, OCTEON_CP2_3DES_IV(a0) 310 ld t0, OCTEON_CP2_3DES_IV(a0)
311 ld t1, OCTEON_CP2_3DES_KEY(a0) 311 ld t1, OCTEON_CP2_3DES_KEY(a0)
312 ld t2, OCTEON_CP2_3DES_KEY+8(a0) 312 ld t2, OCTEON_CP2_3DES_KEY+8(a0)
313 dmtc2 t0, 0x0084 313 dmtc2 t0, 0x0084
314 ld t0, OCTEON_CP2_3DES_KEY+16(a0) 314 ld t0, OCTEON_CP2_3DES_KEY+16(a0)
315 dmtc2 t1, 0x0080 315 dmtc2 t1, 0x0080
316 ld t1, OCTEON_CP2_3DES_RESULT(a0) 316 ld t1, OCTEON_CP2_3DES_RESULT(a0)
317 dmtc2 t2, 0x0081 317 dmtc2 t2, 0x0081
318 ld t2, OCTEON_CP2_AES_INP0(a0) /* only really needed for pass 1 */ 318 ld t2, OCTEON_CP2_AES_INP0(a0) /* only really needed for pass 1 */
319 dmtc2 t0, 0x0082 319 dmtc2 t0, 0x0082
320 ld t0, OCTEON_CP2_AES_IV(a0) 320 ld t0, OCTEON_CP2_AES_IV(a0)
321 dmtc2 t1, 0x0098 321 dmtc2 t1, 0x0098
322 ld t1, OCTEON_CP2_AES_IV+8(a0) 322 ld t1, OCTEON_CP2_AES_IV+8(a0)
323 dmtc2 t2, 0x010A /* only really needed for pass 1 */ 323 dmtc2 t2, 0x010A /* only really needed for pass 1 */
324 ld t2, OCTEON_CP2_AES_KEY(a0) 324 ld t2, OCTEON_CP2_AES_KEY(a0)
325 dmtc2 t0, 0x0102 325 dmtc2 t0, 0x0102
326 ld t0, OCTEON_CP2_AES_KEY+8(a0) 326 ld t0, OCTEON_CP2_AES_KEY+8(a0)
327 dmtc2 t1, 0x0103 327 dmtc2 t1, 0x0103
328 ld t1, OCTEON_CP2_AES_KEY+16(a0) 328 ld t1, OCTEON_CP2_AES_KEY+16(a0)
@@ -334,14 +334,14 @@
334 ld t1, OCTEON_CP2_AES_RESULT(a0) 334 ld t1, OCTEON_CP2_AES_RESULT(a0)
335 dmtc2 t2, 0x0107 335 dmtc2 t2, 0x0107
336 ld t2, OCTEON_CP2_AES_RESULT+8(a0) 336 ld t2, OCTEON_CP2_AES_RESULT+8(a0)
337 mfc0 t3, $15,0 /* Get the processor ID register */ 337 mfc0 t3, $15,0 /* Get the processor ID register */
338 dmtc2 t0, 0x0110 338 dmtc2 t0, 0x0110
339 li t0, 0x000d0000 /* This is the processor ID of Octeon Pass1 */ 339 li t0, 0x000d0000 /* This is the processor ID of Octeon Pass1 */
340 dmtc2 t1, 0x0100 340 dmtc2 t1, 0x0100
341 bne t0, t3, 3f /* Skip the next stuff for non-pass1 */ 341 bne t0, t3, 3f /* Skip the next stuff for non-pass1 */
342 dmtc2 t2, 0x0101 342 dmtc2 t2, 0x0101
343 343
344 /* this code is specific for pass 1 */ 344 /* this code is specific for pass 1 */
345 ld t0, OCTEON_CP2_HSH_DATW(a0) 345 ld t0, OCTEON_CP2_HSH_DATW(a0)
346 ld t1, OCTEON_CP2_HSH_DATW+8(a0) 346 ld t1, OCTEON_CP2_HSH_DATW+8(a0)
347 ld t2, OCTEON_CP2_HSH_DATW+16(a0) 347 ld t2, OCTEON_CP2_HSH_DATW+16(a0)
@@ -361,10 +361,10 @@
361 ld t0, OCTEON_CP2_HSH_IVW+16(a0) 361 ld t0, OCTEON_CP2_HSH_IVW+16(a0)
362 dmtc2 t1, 0x0048 362 dmtc2 t1, 0x0048
363 dmtc2 t2, 0x0049 363 dmtc2 t2, 0x0049
364 b done_restore /* unconditional branch */ 364 b done_restore /* unconditional branch */
365 dmtc2 t0, 0x004A 365 dmtc2 t0, 0x004A
366 366
3673: /* this is post-pass1 code */ 3673: /* this is post-pass1 code */
368 ld t2, OCTEON_CP2_HSH_DATW(a0) 368 ld t2, OCTEON_CP2_HSH_DATW(a0)
369 ld t0, OCTEON_CP2_HSH_DATW+8(a0) 369 ld t0, OCTEON_CP2_HSH_DATW+8(a0)
370 ld t1, OCTEON_CP2_HSH_DATW+16(a0) 370 ld t1, OCTEON_CP2_HSH_DATW+16(a0)
@@ -433,7 +433,7 @@ done_restore:
433 * sp is assumed to point to a struct pt_regs 433 * sp is assumed to point to a struct pt_regs
434 * 434 *
435 * NOTE: This is called in SAVE_SOME in stackframe.h. It can only 435 * NOTE: This is called in SAVE_SOME in stackframe.h. It can only
436 * safely modify k0 and k1. 436 * safely modify k0 and k1.
437 */ 437 */
438 .align 7 438 .align 7
439 .set push 439 .set push
@@ -446,14 +446,14 @@ done_restore:
446 /* Save the multiplier state */ 446 /* Save the multiplier state */
447 v3mulu k0, $0, $0 447 v3mulu k0, $0, $0
448 v3mulu k1, $0, $0 448 v3mulu k1, $0, $0
449 sd k0, PT_MTP(sp) /* PT_MTP has P0 */ 449 sd k0, PT_MTP(sp) /* PT_MTP has P0 */
450 v3mulu k0, $0, $0 450 v3mulu k0, $0, $0
451 sd k1, PT_MTP+8(sp) /* PT_MTP+8 has P1 */ 451 sd k1, PT_MTP+8(sp) /* PT_MTP+8 has P1 */
452 ori k1, $0, 1 452 ori k1, $0, 1
453 v3mulu k1, k1, $0 453 v3mulu k1, k1, $0
454 sd k0, PT_MTP+16(sp) /* PT_MTP+16 has P2 */ 454 sd k0, PT_MTP+16(sp) /* PT_MTP+16 has P2 */
455 v3mulu k0, $0, $0 455 v3mulu k0, $0, $0
456 sd k1, PT_MPL(sp) /* PT_MPL has MPL0 */ 456 sd k1, PT_MPL(sp) /* PT_MPL has MPL0 */
457 v3mulu k1, $0, $0 457 v3mulu k1, $0, $0
458 sd k0, PT_MPL+8(sp) /* PT_MPL+8 has MPL1 */ 458 sd k0, PT_MPL+8(sp) /* PT_MPL+8 has MPL1 */
459 jr ra 459 jr ra
@@ -475,19 +475,19 @@ done_restore:
475 .set noreorder 475 .set noreorder
476 LEAF(octeon_mult_restore) 476 LEAF(octeon_mult_restore)
477 dmfc0 k1, $9,7 /* CvmCtl register. */ 477 dmfc0 k1, $9,7 /* CvmCtl register. */
478 ld v0, PT_MPL(sp) /* MPL0 */ 478 ld v0, PT_MPL(sp) /* MPL0 */
479 ld v1, PT_MPL+8(sp) /* MPL1 */ 479 ld v1, PT_MPL+8(sp) /* MPL1 */
480 ld k0, PT_MPL+16(sp) /* MPL2 */ 480 ld k0, PT_MPL+16(sp) /* MPL2 */
481 bbit1 k1, 27, 1f /* Skip CvmCtl[NOMUL] */ 481 bbit1 k1, 27, 1f /* Skip CvmCtl[NOMUL] */
482 /* Normally falls through, so no time wasted here */ 482 /* Normally falls through, so no time wasted here */
483 nop 483 nop
484 484
485 /* Restore the multiplier state */ 485 /* Restore the multiplier state */
486 ld k1, PT_MTP+16(sp) /* P2 */ 486 ld k1, PT_MTP+16(sp) /* P2 */
487 MTM0 v0 /* MPL0 */ 487 MTM0 v0 /* MPL0 */
488 ld v0, PT_MTP+8(sp) /* P1 */ 488 ld v0, PT_MTP+8(sp) /* P1 */
489 MTM1 v1 /* MPL1 */ 489 MTM1 v1 /* MPL1 */
490 ld v1, PT_MTP(sp) /* P0 */ 490 ld v1, PT_MTP(sp) /* P0 */
491 MTM2 k0 /* MPL2 */ 491 MTM2 k0 /* MPL2 */
492 MTP2 k1 /* P2 */ 492 MTP2 k1 /* P2 */
493 MTP1 v0 /* P1 */ 493 MTP1 v0 /* P1 */