Merge tag 'gpio-v4.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux...
[firefly-linux-kernel-4.4.55.git] / arch / mips / kernel / r4k_fpu.S
index b8044d612ad3934057af8d03829440941024f0c7..f09546ee2cdc907dc02e4c391c103ba381e35a5e 100644 (file)
@@ -107,66 +107,6 @@ LEAF(_save_fp_context)
        .set pop
        END(_save_fp_context)
 
-#ifdef CONFIG_MIPS32_COMPAT
-       /* Save 32-bit process floating point context */
-LEAF(_save_fp_context32)
-       .set push
-       .set MIPS_ISA_ARCH_LEVEL_RAW
-       SET_HARDFLOAT
-       cfc1    t1, fcr31
-
-#ifndef CONFIG_CPU_MIPS64_R6
-       mfc0    t0, CP0_STATUS
-       sll     t0, t0, 5
-       bgez    t0, 1f                  # skip storing odd if FR=0
-        nop
-#endif
-
-       /* Store the 16 odd double precision registers */
-       EX      sdc1 $f1, SC32_FPREGS+8(a0)
-       EX      sdc1 $f3, SC32_FPREGS+24(a0)
-       EX      sdc1 $f5, SC32_FPREGS+40(a0)
-       EX      sdc1 $f7, SC32_FPREGS+56(a0)
-       EX      sdc1 $f9, SC32_FPREGS+72(a0)
-       EX      sdc1 $f11, SC32_FPREGS+88(a0)
-       EX      sdc1 $f13, SC32_FPREGS+104(a0)
-       EX      sdc1 $f15, SC32_FPREGS+120(a0)
-       EX      sdc1 $f17, SC32_FPREGS+136(a0)
-       EX      sdc1 $f19, SC32_FPREGS+152(a0)
-       EX      sdc1 $f21, SC32_FPREGS+168(a0)
-       EX      sdc1 $f23, SC32_FPREGS+184(a0)
-       EX      sdc1 $f25, SC32_FPREGS+200(a0)
-       EX      sdc1 $f27, SC32_FPREGS+216(a0)
-       EX      sdc1 $f29, SC32_FPREGS+232(a0)
-       EX      sdc1 $f31, SC32_FPREGS+248(a0)
-
-       /* Store the 16 even double precision registers */
-1:     EX      sdc1 $f0, SC32_FPREGS+0(a0)
-       EX      sdc1 $f2, SC32_FPREGS+16(a0)
-       EX      sdc1 $f4, SC32_FPREGS+32(a0)
-       EX      sdc1 $f6, SC32_FPREGS+48(a0)
-       EX      sdc1 $f8, SC32_FPREGS+64(a0)
-       EX      sdc1 $f10, SC32_FPREGS+80(a0)
-       EX      sdc1 $f12, SC32_FPREGS+96(a0)
-       EX      sdc1 $f14, SC32_FPREGS+112(a0)
-       EX      sdc1 $f16, SC32_FPREGS+128(a0)
-       EX      sdc1 $f18, SC32_FPREGS+144(a0)
-       EX      sdc1 $f20, SC32_FPREGS+160(a0)
-       EX      sdc1 $f22, SC32_FPREGS+176(a0)
-       EX      sdc1 $f24, SC32_FPREGS+192(a0)
-       EX      sdc1 $f26, SC32_FPREGS+208(a0)
-       EX      sdc1 $f28, SC32_FPREGS+224(a0)
-       EX      sdc1 $f30, SC32_FPREGS+240(a0)
-       EX      sw t1, SC32_FPC_CSR(a0)
-       cfc1    t0, $0                          # implementation/version
-       EX      sw t0, SC32_FPC_EIR(a0)
-       .set pop
-
-       jr      ra
-        li     v0, 0                                   # success
-       END(_save_fp_context32)
-#endif
-
 /**
  * _restore_fp_context() - restore FP context to the FPU
  * @a0 - pointer to fpregs field of sigcontext
@@ -232,60 +172,6 @@ LEAF(_restore_fp_context)
         li     v0, 0                                   # success
        END(_restore_fp_context)
 
-#ifdef CONFIG_MIPS32_COMPAT
-LEAF(_restore_fp_context32)
-       /* Restore an o32 sigcontext.  */
-       .set push
-       SET_HARDFLOAT
-       EX      lw t1, SC32_FPC_CSR(a0)
-
-#ifndef CONFIG_CPU_MIPS64_R6
-       mfc0    t0, CP0_STATUS
-       sll     t0, t0, 5
-       bgez    t0, 1f                  # skip loading odd if FR=0
-        nop
-#endif
-
-       EX      ldc1 $f1, SC32_FPREGS+8(a0)
-       EX      ldc1 $f3, SC32_FPREGS+24(a0)
-       EX      ldc1 $f5, SC32_FPREGS+40(a0)
-       EX      ldc1 $f7, SC32_FPREGS+56(a0)
-       EX      ldc1 $f9, SC32_FPREGS+72(a0)
-       EX      ldc1 $f11, SC32_FPREGS+88(a0)
-       EX      ldc1 $f13, SC32_FPREGS+104(a0)
-       EX      ldc1 $f15, SC32_FPREGS+120(a0)
-       EX      ldc1 $f17, SC32_FPREGS+136(a0)
-       EX      ldc1 $f19, SC32_FPREGS+152(a0)
-       EX      ldc1 $f21, SC32_FPREGS+168(a0)
-       EX      ldc1 $f23, SC32_FPREGS+184(a0)
-       EX      ldc1 $f25, SC32_FPREGS+200(a0)
-       EX      ldc1 $f27, SC32_FPREGS+216(a0)
-       EX      ldc1 $f29, SC32_FPREGS+232(a0)
-       EX      ldc1 $f31, SC32_FPREGS+248(a0)
-
-1:     EX      ldc1 $f0, SC32_FPREGS+0(a0)
-       EX      ldc1 $f2, SC32_FPREGS+16(a0)
-       EX      ldc1 $f4, SC32_FPREGS+32(a0)
-       EX      ldc1 $f6, SC32_FPREGS+48(a0)
-       EX      ldc1 $f8, SC32_FPREGS+64(a0)
-       EX      ldc1 $f10, SC32_FPREGS+80(a0)
-       EX      ldc1 $f12, SC32_FPREGS+96(a0)
-       EX      ldc1 $f14, SC32_FPREGS+112(a0)
-       EX      ldc1 $f16, SC32_FPREGS+128(a0)
-       EX      ldc1 $f18, SC32_FPREGS+144(a0)
-       EX      ldc1 $f20, SC32_FPREGS+160(a0)
-       EX      ldc1 $f22, SC32_FPREGS+176(a0)
-       EX      ldc1 $f24, SC32_FPREGS+192(a0)
-       EX      ldc1 $f26, SC32_FPREGS+208(a0)
-       EX      ldc1 $f28, SC32_FPREGS+224(a0)
-       EX      ldc1 $f30, SC32_FPREGS+240(a0)
-       ctc1    t1, fcr31
-       jr      ra
-        li     v0, 0                                   # success
-       .set pop
-       END(_restore_fp_context32)
-#endif
-
 #ifdef CONFIG_CPU_HAS_MSA
 
        .macro  op_one_wr       op, idx, base
@@ -350,6 +236,124 @@ LEAF(\name)
        op_msa_wr       write_msa_wr_w, ld_w
        op_msa_wr       write_msa_wr_d, ld_d
 
+#endif /* CONFIG_CPU_HAS_MSA */
+
+#ifdef CONFIG_CPU_HAS_MSA
+
+       .macro  save_msa_upper  wr, off, base
+       .set    push
+       .set    noat
+#ifdef CONFIG_64BIT
+       copy_u_d \wr, 1
+       EX sd   $1, \off(\base)
+#elif defined(CONFIG_CPU_LITTLE_ENDIAN)
+       copy_u_w \wr, 2
+       EX sw   $1, \off(\base)
+       copy_u_w \wr, 3
+       EX sw   $1, (\off+4)(\base)
+#else /* CONFIG_CPU_BIG_ENDIAN */
+       copy_u_w \wr, 2
+       EX sw   $1, (\off+4)(\base)
+       copy_u_w \wr, 3
+       EX sw   $1, \off(\base)
+#endif
+       .set    pop
+       .endm
+
+LEAF(_save_msa_all_upper)
+       save_msa_upper  0, 0x00, a0
+       save_msa_upper  1, 0x08, a0
+       save_msa_upper  2, 0x10, a0
+       save_msa_upper  3, 0x18, a0
+       save_msa_upper  4, 0x20, a0
+       save_msa_upper  5, 0x28, a0
+       save_msa_upper  6, 0x30, a0
+       save_msa_upper  7, 0x38, a0
+       save_msa_upper  8, 0x40, a0
+       save_msa_upper  9, 0x48, a0
+       save_msa_upper  10, 0x50, a0
+       save_msa_upper  11, 0x58, a0
+       save_msa_upper  12, 0x60, a0
+       save_msa_upper  13, 0x68, a0
+       save_msa_upper  14, 0x70, a0
+       save_msa_upper  15, 0x78, a0
+       save_msa_upper  16, 0x80, a0
+       save_msa_upper  17, 0x88, a0
+       save_msa_upper  18, 0x90, a0
+       save_msa_upper  19, 0x98, a0
+       save_msa_upper  20, 0xa0, a0
+       save_msa_upper  21, 0xa8, a0
+       save_msa_upper  22, 0xb0, a0
+       save_msa_upper  23, 0xb8, a0
+       save_msa_upper  24, 0xc0, a0
+       save_msa_upper  25, 0xc8, a0
+       save_msa_upper  26, 0xd0, a0
+       save_msa_upper  27, 0xd8, a0
+       save_msa_upper  28, 0xe0, a0
+       save_msa_upper  29, 0xe8, a0
+       save_msa_upper  30, 0xf0, a0
+       save_msa_upper  31, 0xf8, a0
+       jr      ra
+        li     v0, 0
+       END(_save_msa_all_upper)
+
+       .macro  restore_msa_upper       wr, off, base
+       .set    push
+       .set    noat
+#ifdef CONFIG_64BIT
+       EX ld   $1, \off(\base)
+       insert_d \wr, 1
+#elif defined(CONFIG_CPU_LITTLE_ENDIAN)
+       EX lw   $1, \off(\base)
+       insert_w \wr, 2
+       EX lw   $1, (\off+4)(\base)
+       insert_w \wr, 3
+#else /* CONFIG_CPU_BIG_ENDIAN */
+       EX lw   $1, (\off+4)(\base)
+       insert_w \wr, 2
+       EX lw   $1, \off(\base)
+       insert_w \wr, 3
+#endif
+       .set    pop
+       .endm
+
+LEAF(_restore_msa_all_upper)
+       restore_msa_upper       0, 0x00, a0
+       restore_msa_upper       1, 0x08, a0
+       restore_msa_upper       2, 0x10, a0
+       restore_msa_upper       3, 0x18, a0
+       restore_msa_upper       4, 0x20, a0
+       restore_msa_upper       5, 0x28, a0
+       restore_msa_upper       6, 0x30, a0
+       restore_msa_upper       7, 0x38, a0
+       restore_msa_upper       8, 0x40, a0
+       restore_msa_upper       9, 0x48, a0
+       restore_msa_upper       10, 0x50, a0
+       restore_msa_upper       11, 0x58, a0
+       restore_msa_upper       12, 0x60, a0
+       restore_msa_upper       13, 0x68, a0
+       restore_msa_upper       14, 0x70, a0
+       restore_msa_upper       15, 0x78, a0
+       restore_msa_upper       16, 0x80, a0
+       restore_msa_upper       17, 0x88, a0
+       restore_msa_upper       18, 0x90, a0
+       restore_msa_upper       19, 0x98, a0
+       restore_msa_upper       20, 0xa0, a0
+       restore_msa_upper       21, 0xa8, a0
+       restore_msa_upper       22, 0xb0, a0
+       restore_msa_upper       23, 0xb8, a0
+       restore_msa_upper       24, 0xc0, a0
+       restore_msa_upper       25, 0xc8, a0
+       restore_msa_upper       26, 0xd0, a0
+       restore_msa_upper       27, 0xd8, a0
+       restore_msa_upper       28, 0xe0, a0
+       restore_msa_upper       29, 0xe8, a0
+       restore_msa_upper       30, 0xf0, a0
+       restore_msa_upper       31, 0xf8, a0
+       jr      ra
+        li     v0, 0
+       END(_restore_msa_all_upper)
+
 #endif /* CONFIG_CPU_HAS_MSA */
 
        .set    reorder