MIPS: math-emu: Implement the FCCR, FEXR and FENR registers
[linux-drm-fsl-dcu.git] / arch / mips / include / asm / mipsregs.h
index fef004434096596ebb54ecf8834dc04e9f3fd4c4..120f2225ed3f4f6589cc6e12a59bc9ae5520be95 100644 (file)
  */
 #define CP0_TX39_CACHE $7
 
-/*
- * Coprocessor 1 (FPU) register names
- */
-#define CP1_REVISION   $0
-#define CP1_STATUS     $31
-
-/*
- * FPU Status Register Values
- */
-/*
- * Status Register Values
- */
-
-#define FPU_CSR_FLUSH  0x01000000      /* flush denormalised results to 0 */
-#define FPU_CSR_COND   0x00800000      /* $fcc0 */
-#define FPU_CSR_COND0  0x00800000      /* $fcc0 */
-#define FPU_CSR_COND1  0x02000000      /* $fcc1 */
-#define FPU_CSR_COND2  0x04000000      /* $fcc2 */
-#define FPU_CSR_COND3  0x08000000      /* $fcc3 */
-#define FPU_CSR_COND4  0x10000000      /* $fcc4 */
-#define FPU_CSR_COND5  0x20000000      /* $fcc5 */
-#define FPU_CSR_COND6  0x40000000      /* $fcc6 */
-#define FPU_CSR_COND7  0x80000000      /* $fcc7 */
-
-/*
- * Bits 18 - 20 of the FPU Status Register will be read as 0,
- * and should be written as zero.
- */
-#define FPU_CSR_RSVD   0x001c0000
-
-/*
- * X the exception cause indicator
- * E the exception enable
- * S the sticky/flag bit
-*/
-#define FPU_CSR_ALL_X  0x0003f000
-#define FPU_CSR_UNI_X  0x00020000
-#define FPU_CSR_INV_X  0x00010000
-#define FPU_CSR_DIV_X  0x00008000
-#define FPU_CSR_OVF_X  0x00004000
-#define FPU_CSR_UDF_X  0x00002000
-#define FPU_CSR_INE_X  0x00001000
-
-#define FPU_CSR_ALL_E  0x00000f80
-#define FPU_CSR_INV_E  0x00000800
-#define FPU_CSR_DIV_E  0x00000400
-#define FPU_CSR_OVF_E  0x00000200
-#define FPU_CSR_UDF_E  0x00000100
-#define FPU_CSR_INE_E  0x00000080
-
-#define FPU_CSR_ALL_S  0x0000007c
-#define FPU_CSR_INV_S  0x00000040
-#define FPU_CSR_DIV_S  0x00000020
-#define FPU_CSR_OVF_S  0x00000010
-#define FPU_CSR_UDF_S  0x00000008
-#define FPU_CSR_INE_S  0x00000004
-
-/* Bits 0 and 1 of FPU Status Register specify the rounding mode */
-#define FPU_CSR_RM     0x00000003
-#define FPU_CSR_RN     0x0     /* nearest */
-#define FPU_CSR_RZ     0x1     /* towards zero */
-#define FPU_CSR_RU     0x2     /* towards +Infinity */
-#define FPU_CSR_RD     0x3     /* towards -Infinity */
-
 
 /*
  * Values for PageMask register
  */
 #define ST0_MX                 0x01000000
 
-/*
- * Bitfields in the TX39 family CP0 Configuration Register 3
- */
-#define TX39_CONF_ICS_SHIFT    19
-#define TX39_CONF_ICS_MASK     0x00380000
-#define TX39_CONF_ICS_1KB      0x00000000
-#define TX39_CONF_ICS_2KB      0x00080000
-#define TX39_CONF_ICS_4KB      0x00100000
-#define TX39_CONF_ICS_8KB      0x00180000
-#define TX39_CONF_ICS_16KB     0x00200000
-
-#define TX39_CONF_DCS_SHIFT    16
-#define TX39_CONF_DCS_MASK     0x00070000
-#define TX39_CONF_DCS_1KB      0x00000000
-#define TX39_CONF_DCS_2KB      0x00010000
-#define TX39_CONF_DCS_4KB      0x00020000
-#define TX39_CONF_DCS_8KB      0x00030000
-#define TX39_CONF_DCS_16KB     0x00040000
-
-#define TX39_CONF_CWFON                0x00004000
-#define TX39_CONF_WBON         0x00002000
-#define TX39_CONF_RF_SHIFT     10
-#define TX39_CONF_RF_MASK      0x00000c00
-#define TX39_CONF_DOZE         0x00000200
-#define TX39_CONF_HALT         0x00000100
-#define TX39_CONF_LOCK         0x00000080
-#define TX39_CONF_ICE          0x00000020
-#define TX39_CONF_DCE          0x00000010
-#define TX39_CONF_IRSIZE_SHIFT 2
-#define TX39_CONF_IRSIZE_MASK  0x0000000c
-#define TX39_CONF_DRSIZE_SHIFT 0
-#define TX39_CONF_DRSIZE_MASK  0x00000003
-
 /*
  * Status register bits available in all MIPS CPUs.
  */
 
 /*
  * Bitfields and bit numbers in the coprocessor 0 IntCtl register. (MIPSR2)
- *
- * Refer to your MIPS R4xx0 manual, chapter 5 for explanation.
  */
+#define INTCTLB_IPFDC          23
+#define INTCTLF_IPFDC          (_ULCAST_(7) << INTCTLB_IPFDC)
 #define INTCTLB_IPPCI          26
 #define INTCTLF_IPPCI          (_ULCAST_(7) << INTCTLB_IPPCI)
 #define INTCTLB_IPTI           29
  *
  * Refer to your MIPS R4xx0 manual, chapter 5 for explanation.
  */
-#define         CAUSEB_EXCCODE         2
-#define         CAUSEF_EXCCODE         (_ULCAST_(31)  <<  2)
-#define         CAUSEB_IP              8
-#define         CAUSEF_IP              (_ULCAST_(255) <<  8)
+#define CAUSEB_EXCCODE         2
+#define CAUSEF_EXCCODE         (_ULCAST_(31)  <<  2)
+#define CAUSEB_IP              8
+#define CAUSEF_IP              (_ULCAST_(255) <<  8)
 #define         CAUSEB_IP0             8
 #define         CAUSEF_IP0             (_ULCAST_(1)   <<  8)
 #define         CAUSEB_IP1             9
 #define         CAUSEF_IP6             (_ULCAST_(1)   << 14)
 #define         CAUSEB_IP7             15
 #define         CAUSEF_IP7             (_ULCAST_(1)   << 15)
-#define         CAUSEB_IV              23
-#define         CAUSEF_IV              (_ULCAST_(1)   << 23)
-#define         CAUSEB_PCI             26
-#define         CAUSEF_PCI             (_ULCAST_(1)   << 26)
-#define         CAUSEB_CE              28
-#define         CAUSEF_CE              (_ULCAST_(3)   << 28)
-#define         CAUSEB_TI              30
-#define         CAUSEF_TI              (_ULCAST_(1)   << 30)
-#define         CAUSEB_BD              31
-#define         CAUSEF_BD              (_ULCAST_(1)   << 31)
+#define CAUSEB_FDCI            21
+#define CAUSEF_FDCI            (_ULCAST_(1)   << 21)
+#define CAUSEB_IV              23
+#define CAUSEF_IV              (_ULCAST_(1)   << 23)
+#define CAUSEB_PCI             26
+#define CAUSEF_PCI             (_ULCAST_(1)   << 26)
+#define CAUSEB_CE              28
+#define CAUSEF_CE              (_ULCAST_(3)   << 28)
+#define CAUSEB_TI              30
+#define CAUSEF_TI              (_ULCAST_(1)   << 30)
+#define CAUSEB_BD              31
+#define CAUSEF_BD              (_ULCAST_(1)   << 31)
 
 /*
  * Bits in the coprocessor 0 config register.
 #define MIPS_CMGCRB_BASE       11
 #define MIPS_CMGCRF_BASE       (~_ULCAST_((1 << MIPS_CMGCRB_BASE) - 1))
 
-/*
- * Bits in the MIPS32/64 coprocessor 1 (FPU) revision register.
- */
-#define MIPS_FPIR_S            (_ULCAST_(1) << 16)
-#define MIPS_FPIR_D            (_ULCAST_(1) << 17)
-#define MIPS_FPIR_PS           (_ULCAST_(1) << 18)
-#define MIPS_FPIR_3D           (_ULCAST_(1) << 19)
-#define MIPS_FPIR_W            (_ULCAST_(1) << 20)
-#define MIPS_FPIR_L            (_ULCAST_(1) << 21)
-#define MIPS_FPIR_F64          (_ULCAST_(1) << 22)
-#define MIPS_FPIR_FREP         (_ULCAST_(1) << 29)
-
 /*
  * Bits in the MIPS32 Memory Segmentation registers.
  */
 #define MIPS_PWCTL_PSN_SHIFT   0
 #define MIPS_PWCTL_PSN_MASK    0x0000003f
 
+/* CDMMBase register bit definitions */
+#define MIPS_CDMMBASE_SIZE_SHIFT 0
+#define MIPS_CDMMBASE_SIZE     (_ULCAST_(511) << MIPS_CDMMBASE_SIZE_SHIFT)
+#define MIPS_CDMMBASE_CI       (_ULCAST_(1) << 9)
+#define MIPS_CDMMBASE_EN       (_ULCAST_(1) << 10)
+#define MIPS_CDMMBASE_ADDR_SHIFT 11
+#define MIPS_CDMMBASE_ADDR_START 15
+
+/*
+ * Bitfields in the TX39 family CP0 Configuration Register 3
+ */
+#define TX39_CONF_ICS_SHIFT    19
+#define TX39_CONF_ICS_MASK     0x00380000
+#define TX39_CONF_ICS_1KB      0x00000000
+#define TX39_CONF_ICS_2KB      0x00080000
+#define TX39_CONF_ICS_4KB      0x00100000
+#define TX39_CONF_ICS_8KB      0x00180000
+#define TX39_CONF_ICS_16KB     0x00200000
+
+#define TX39_CONF_DCS_SHIFT    16
+#define TX39_CONF_DCS_MASK     0x00070000
+#define TX39_CONF_DCS_1KB      0x00000000
+#define TX39_CONF_DCS_2KB      0x00010000
+#define TX39_CONF_DCS_4KB      0x00020000
+#define TX39_CONF_DCS_8KB      0x00030000
+#define TX39_CONF_DCS_16KB     0x00040000
+
+#define TX39_CONF_CWFON                0x00004000
+#define TX39_CONF_WBON         0x00002000
+#define TX39_CONF_RF_SHIFT     10
+#define TX39_CONF_RF_MASK      0x00000c00
+#define TX39_CONF_DOZE         0x00000200
+#define TX39_CONF_HALT         0x00000100
+#define TX39_CONF_LOCK         0x00000080
+#define TX39_CONF_ICE          0x00000020
+#define TX39_CONF_DCE          0x00000010
+#define TX39_CONF_IRSIZE_SHIFT 2
+#define TX39_CONF_IRSIZE_MASK  0x0000000c
+#define TX39_CONF_DRSIZE_SHIFT 0
+#define TX39_CONF_DRSIZE_MASK  0x00000003
+
+
+/*
+ * Coprocessor 1 (FPU) register names
+ */
+#define CP1_REVISION   $0
+#define CP1_UFR                $1
+#define CP1_UNFR       $4
+#define CP1_FCCR       $25
+#define CP1_FEXR       $26
+#define CP1_FENR       $28
+#define CP1_STATUS     $31
+
+
+/*
+ * Bits in the MIPS32/64 coprocessor 1 (FPU) revision register.
+ */
+#define MIPS_FPIR_S            (_ULCAST_(1) << 16)
+#define MIPS_FPIR_D            (_ULCAST_(1) << 17)
+#define MIPS_FPIR_PS           (_ULCAST_(1) << 18)
+#define MIPS_FPIR_3D           (_ULCAST_(1) << 19)
+#define MIPS_FPIR_W            (_ULCAST_(1) << 20)
+#define MIPS_FPIR_L            (_ULCAST_(1) << 21)
+#define MIPS_FPIR_F64          (_ULCAST_(1) << 22)
+#define MIPS_FPIR_FREP         (_ULCAST_(1) << 29)
+
+/*
+ * Bits in the MIPS32/64 coprocessor 1 (FPU) condition codes register.
+ */
+#define MIPS_FCCR_CONDX_S      0
+#define MIPS_FCCR_CONDX                (_ULCAST_(255) << MIPS_FCCR_CONDX_S)
+#define MIPS_FCCR_COND0_S      0
+#define MIPS_FCCR_COND0                (_ULCAST_(1) << MIPS_FCCR_COND0_S)
+#define MIPS_FCCR_COND1_S      1
+#define MIPS_FCCR_COND1                (_ULCAST_(1) << MIPS_FCCR_COND1_S)
+#define MIPS_FCCR_COND2_S      2
+#define MIPS_FCCR_COND2                (_ULCAST_(1) << MIPS_FCCR_COND2_S)
+#define MIPS_FCCR_COND3_S      3
+#define MIPS_FCCR_COND3                (_ULCAST_(1) << MIPS_FCCR_COND3_S)
+#define MIPS_FCCR_COND4_S      4
+#define MIPS_FCCR_COND4                (_ULCAST_(1) << MIPS_FCCR_COND4_S)
+#define MIPS_FCCR_COND5_S      5
+#define MIPS_FCCR_COND5                (_ULCAST_(1) << MIPS_FCCR_COND5_S)
+#define MIPS_FCCR_COND6_S      6
+#define MIPS_FCCR_COND6                (_ULCAST_(1) << MIPS_FCCR_COND6_S)
+#define MIPS_FCCR_COND7_S      7
+#define MIPS_FCCR_COND7                (_ULCAST_(1) << MIPS_FCCR_COND7_S)
+
+/*
+ * Bits in the MIPS32/64 coprocessor 1 (FPU) enables register.
+ */
+#define MIPS_FENR_FS_S         2
+#define MIPS_FENR_FS           (_ULCAST_(1) << MIPS_FENR_FS_S)
+
+/*
+ * FPU Status Register Values
+ */
+#define FPU_CSR_COND_S 23                                      /* $fcc0 */
+#define FPU_CSR_COND   (_ULCAST_(1) << FPU_CSR_COND_S)
+
+#define FPU_CSR_FS_S   24              /* flush denormalised results to 0 */
+#define FPU_CSR_FS     (_ULCAST_(1) << FPU_CSR_FS_S)
+
+#define FPU_CSR_CONDX_S        25                                      /* $fcc[7:1] */
+#define FPU_CSR_CONDX  (_ULCAST_(127) << FPU_CSR_CONDX_S)
+#define FPU_CSR_COND1_S        25                                      /* $fcc1 */
+#define FPU_CSR_COND1  (_ULCAST_(1) << FPU_CSR_COND1_S)
+#define FPU_CSR_COND2_S        26                                      /* $fcc2 */
+#define FPU_CSR_COND2  (_ULCAST_(1) << FPU_CSR_COND2_S)
+#define FPU_CSR_COND3_S        27                                      /* $fcc3 */
+#define FPU_CSR_COND3  (_ULCAST_(1) << FPU_CSR_COND3_S)
+#define FPU_CSR_COND4_S        28                                      /* $fcc4 */
+#define FPU_CSR_COND4  (_ULCAST_(1) << FPU_CSR_COND4_S)
+#define FPU_CSR_COND5_S        29                                      /* $fcc5 */
+#define FPU_CSR_COND5  (_ULCAST_(1) << FPU_CSR_COND5_S)
+#define FPU_CSR_COND6_S        30                                      /* $fcc6 */
+#define FPU_CSR_COND6  (_ULCAST_(1) << FPU_CSR_COND6_S)
+#define FPU_CSR_COND7_S        31                                      /* $fcc7 */
+#define FPU_CSR_COND7  (_ULCAST_(1) << FPU_CSR_COND7_S)
+
+/*
+ * Bits 18 - 20 of the FPU Status Register will be read as 0,
+ * and should be written as zero.
+ */
+#define FPU_CSR_RSVD   0x001c0000
+
+/*
+ * X the exception cause indicator
+ * E the exception enable
+ * S the sticky/flag bit
+*/
+#define FPU_CSR_ALL_X  0x0003f000
+#define FPU_CSR_UNI_X  0x00020000
+#define FPU_CSR_INV_X  0x00010000
+#define FPU_CSR_DIV_X  0x00008000
+#define FPU_CSR_OVF_X  0x00004000
+#define FPU_CSR_UDF_X  0x00002000
+#define FPU_CSR_INE_X  0x00001000
+
+#define FPU_CSR_ALL_E  0x00000f80
+#define FPU_CSR_INV_E  0x00000800
+#define FPU_CSR_DIV_E  0x00000400
+#define FPU_CSR_OVF_E  0x00000200
+#define FPU_CSR_UDF_E  0x00000100
+#define FPU_CSR_INE_E  0x00000080
+
+#define FPU_CSR_ALL_S  0x0000007c
+#define FPU_CSR_INV_S  0x00000040
+#define FPU_CSR_DIV_S  0x00000020
+#define FPU_CSR_OVF_S  0x00000010
+#define FPU_CSR_UDF_S  0x00000008
+#define FPU_CSR_INE_S  0x00000004
+
+/* Bits 0 and 1 of FPU Status Register specify the rounding mode */
+#define FPU_CSR_RM     0x00000003
+#define FPU_CSR_RN     0x0     /* nearest */
+#define FPU_CSR_RZ     0x1     /* towards zero */
+#define FPU_CSR_RU     0x2     /* towards +Infinity */
+#define FPU_CSR_RD     0x3     /* towards -Infinity */
+
+
 #ifndef __ASSEMBLY__
 
 /*
@@ -1282,6 +1336,9 @@ do {                                                                      \
 #define read_c0_ebase()                __read_32bit_c0_register($15, 1)
 #define write_c0_ebase(val)    __write_32bit_c0_register($15, 1, val)
 
+#define read_c0_cdmmbase()     __read_ulong_c0_register($15, 2)
+#define write_c0_cdmmbase(val) __write_ulong_c0_register($15, 2, val)
+
 /* MIPSR3 */
 #define read_c0_segctl0()      __read_32bit_c0_register($5, 2)
 #define write_c0_segctl0(val)  __write_32bit_c0_register($5, 2, val)